From 3bcc351fa6b29b6fef66c80a0046194b343b9281 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Sat, 27 Dec 2025 16:26:43 +0530 Subject: [PATCH] Removed production plan logic in sticker reprint page --- app/Filament/Pages/StickerReprint.php | 420 +++++++++++++------------- 1 file changed, 210 insertions(+), 210 deletions(-) diff --git a/app/Filament/Pages/StickerReprint.php b/app/Filament/Pages/StickerReprint.php index f42bb7f..627798a 100644 --- a/app/Filament/Pages/StickerReprint.php +++ b/app/Filament/Pages/StickerReprint.php @@ -712,251 +712,251 @@ class StickerReprint extends Page implements HasForms ]); } } - else - { - $existShifts = \App\Models\ProductionPlan::where('plant_id', $this->pId) - ->where('shift_id', $this->sId) - ->where('line_id', $this->lId) - ->whereDate('created_at', Carbon::yesterday()) - ->latest() - ->exists(); + // else + // { + // $existShifts = \App\Models\ProductionPlan::where('plant_id', $this->pId) + // ->where('shift_id', $this->sId) + // ->where('line_id', $this->lId) + // ->whereDate('created_at', Carbon::yesterday()) + // ->latest() + // ->exists(); - if ($existShifts) //if ($existShifts->count() > 0) - { // record exist on yesterday - //$currentDate = date('Y-m-d'); - $yesterday = date('Y-m-d', strtotime('-1 days')); + // if ($existShifts) //if ($existShifts->count() > 0) + // { // record exist on yesterday + // //$currentDate = date('Y-m-d'); + // $yesterday = date('Y-m-d', strtotime('-1 days')); - $shiftId = Shift::where('id', $this->sId) - ->first(); + // $shiftId = Shift::where('id', $this->sId) + // ->first(); - [$hRs, $miNs] = explode('.', $shiftId->duration) + [0, 0]; - $hRs = (int) $hRs; - // $miNs = (int) $miNs;-*/ + // [$hRs, $miNs] = explode('.', $shiftId->duration) + [0, 0]; + // $hRs = (int) $hRs; + // // $miNs = (int) $miNs;-*/ - $totalMinutes = $hRs * 60 + $miNs; + // $totalMinutes = $hRs * 60 + $miNs; - $from_dt = $yesterday . ' ' . $shiftId->start_time; + // $from_dt = $yesterday . ' ' . $shiftId->start_time; - $to_dt = date('Y-m-d H:i:s', strtotime($from_dt . " + $totalMinutes minutes")); + // $to_dt = date('Y-m-d H:i:s', strtotime($from_dt . " + $totalMinutes minutes")); - $currentDateTime = date('Y-m-d H:i:s'); + // $currentDateTime = date('Y-m-d H:i:s'); - // Check if current date time is within the range - if ($currentDateTime >= $from_dt && $currentDateTime < $to_dt) { - $this->form->fill([ - 'plant_id'=> $this->pId, - 'block_name'=> $this->bId, - 'shift_id'=> $this->sId, - 'line_id'=> $this->lId, - 'item_id'=> null, - 'serial_number'=> null, - 'success_msg'=> null, - 'production_order'=> $this->prodOrder, - 'sap_msg_status' => null, - 'sap_msg_description' => null, - 'operator_id'=> $operatorName, - 'recent_qr' => $this->recQr, - ]); - } - else - { - $currentDate = date('Y-m-d'); + // // Check if current date time is within the range + // if ($currentDateTime >= $from_dt && $currentDateTime < $to_dt) { + // $this->form->fill([ + // 'plant_id'=> $this->pId, + // 'block_name'=> $this->bId, + // 'shift_id'=> $this->sId, + // 'line_id'=> $this->lId, + // 'item_id'=> null, + // 'serial_number'=> null, + // 'success_msg'=> null, + // 'production_order'=> $this->prodOrder, + // 'sap_msg_status' => null, + // 'sap_msg_description' => null, + // 'operator_id'=> $operatorName, + // 'recent_qr' => $this->recQr, + // ]); + // } + // else + // { + // $currentDate = date('Y-m-d'); - $shiftId = Shift::where('id', $this->sId) - ->first(); + // $shiftId = Shift::where('id', $this->sId) + // ->first(); - [$hRs, $miNs] = explode('.', $shiftId->duration) + [0, 0]; - $hRs = (int) $hRs; - // $miNs = (int) $miNs;-*/ + // [$hRs, $miNs] = explode('.', $shiftId->duration) + [0, 0]; + // $hRs = (int) $hRs; + // // $miNs = (int) $miNs;-*/ - $totalMinutes = $hRs * 60 + $miNs; + // $totalMinutes = $hRs * 60 + $miNs; - $from_dt = $currentDate . ' ' . $shiftId->start_time; + // $from_dt = $currentDate . ' ' . $shiftId->start_time; - $to_dt = date('Y-m-d H:i:s', strtotime($from_dt . " + $totalMinutes minutes")); + // $to_dt = date('Y-m-d H:i:s', strtotime($from_dt . " + $totalMinutes minutes")); - $currentDateTime = date('Y-m-d H:i:s'); + // $currentDateTime = date('Y-m-d H:i:s'); - // Check if current date time is within the range - if ($currentDateTime >= $from_dt && $currentDateTime < $to_dt) { - //echo "Choosed a valid shift..."; - // $set('ppLineError', 'Valid (From: '.$from_dt.', To: '.$to_dt.')'); + // // Check if current date time is within the range + // if ($currentDateTime >= $from_dt && $currentDateTime < $to_dt) { + // //echo "Choosed a valid shift..."; + // // $set('ppLineError', 'Valid (From: '.$from_dt.', To: '.$to_dt.')'); - $this->form->fill([ - 'plant_id'=> $this->pId, - 'block_name'=> $this->bId, - 'shift_id'=> $this->sId, - 'line_id'=> $this->lId, - 'item_id'=> null, - 'serial_number'=> null, - 'success_msg'=> null, - 'production_order'=> $this->prodOrder, - 'sap_msg_status' => null, - 'sap_msg_description' => null, - 'operator_id'=> $operatorName, - 'recent_qr' => $this->recQr, - ]); - Notification::make() - ->title('Plan Not Found') - ->body("Please set production plan first.") - ->danger() - ->send(); - //$set('validationError', 'Curr.'.$currentDateTime.' (From: '.$from_dt.', To: '.$to_dt.')'); - return; - } - else - { - //echo "Choosed a valid shift..."; - // $set('ppLineError', 'Valid (From: '.$from_dt.', To: '.$to_dt.')'); + // $this->form->fill([ + // 'plant_id'=> $this->pId, + // 'block_name'=> $this->bId, + // 'shift_id'=> $this->sId, + // 'line_id'=> $this->lId, + // 'item_id'=> null, + // 'serial_number'=> null, + // 'success_msg'=> null, + // 'production_order'=> $this->prodOrder, + // 'sap_msg_status' => null, + // 'sap_msg_description' => null, + // 'operator_id'=> $operatorName, + // 'recent_qr' => $this->recQr, + // ]); + // Notification::make() + // ->title('Plan Not Found') + // ->body("Please set production plan first.") + // ->danger() + // ->send(); + // //$set('validationError', 'Curr.'.$currentDateTime.' (From: '.$from_dt.', To: '.$to_dt.')'); + // return; + // } + // else + // { + // //echo "Choosed a valid shift..."; + // // $set('ppLineError', 'Valid (From: '.$from_dt.', To: '.$to_dt.')'); - $this->form->fill([ - 'plant_id'=> $this->pId, - 'block_name'=> $this->bId, - 'shift_id'=> $this->sId, - 'line_id'=> $this->lId, - 'item_id'=> null, - 'serial_number'=> null, - 'success_msg'=> null, - 'production_order'=> $this->prodOrder, - 'sap_msg_status' => null, - 'sap_msg_description' => null, - 'operator_id'=> $operatorName, - 'recent_qr' => $this->recQr, - ]); - Notification::make() - ->title('Invalid Shift') - ->body("Please select a valid shift.") - ->danger() - ->send(); - //$set('validationError', 'Curr.'.$currentDateTime.' (From: '.$from_dt.', To: '.$to_dt.')'); - return; - } - } - } - else - { // record not exist on yesterday + // $this->form->fill([ + // 'plant_id'=> $this->pId, + // 'block_name'=> $this->bId, + // 'shift_id'=> $this->sId, + // 'line_id'=> $this->lId, + // 'item_id'=> null, + // 'serial_number'=> null, + // 'success_msg'=> null, + // 'production_order'=> $this->prodOrder, + // 'sap_msg_status' => null, + // 'sap_msg_description' => null, + // 'operator_id'=> $operatorName, + // 'recent_qr' => $this->recQr, + // ]); + // Notification::make() + // ->title('Invalid Shift') + // ->body("Please select a valid shift.") + // ->danger() + // ->send(); + // //$set('validationError', 'Curr.'.$currentDateTime.' (From: '.$from_dt.', To: '.$to_dt.')'); + // return; + // } + // } + // } + // else + // { // record not exist on yesterday - //$currentDate = date('Y-m-d'); - $yesterday = date('Y-m-d', strtotime('-1 days')); + // //$currentDate = date('Y-m-d'); + // $yesterday = date('Y-m-d', strtotime('-1 days')); - $shiftId = Shift::where('id', $this->sId) - ->first(); + // $shiftId = Shift::where('id', $this->sId) + // ->first(); - [$hRs, $miNs] = explode('.', $shiftId->duration) + [0, 0]; - $hRs = (int) $hRs; - // $miNs = (int) $miNs;-*/ + // [$hRs, $miNs] = explode('.', $shiftId->duration) + [0, 0]; + // $hRs = (int) $hRs; + // // $miNs = (int) $miNs;-*/ - $totalMinutes = $hRs * 60 + $miNs; + // $totalMinutes = $hRs * 60 + $miNs; - $from_dt = $yesterday . ' ' . $shiftId->start_time; + // $from_dt = $yesterday . ' ' . $shiftId->start_time; - $to_dt = date('Y-m-d H:i:s', strtotime($from_dt . " + $totalMinutes minutes")); + // $to_dt = date('Y-m-d H:i:s', strtotime($from_dt . " + $totalMinutes minutes")); - $currentDateTime = date('Y-m-d H:i:s'); + // $currentDateTime = date('Y-m-d H:i:s'); - // Check if current date time is within the range - if ($currentDateTime >= $from_dt && $currentDateTime < $to_dt) { - //echo "Choosed a valid shift..."; - // $set('ppLineError', 'Valid (From: '.$from_dt.', To: '.$to_dt.')'); + // // Check if current date time is within the range + // if ($currentDateTime >= $from_dt && $currentDateTime < $to_dt) { + // //echo "Choosed a valid shift..."; + // // $set('ppLineError', 'Valid (From: '.$from_dt.', To: '.$to_dt.')'); - $this->form->fill([ - 'plant_id'=> $this->pId, - 'block_name'=> $this->bId, - 'shift_id'=> $this->sId, - 'line_id'=> $this->lId, - 'item_id'=> null, - 'serial_number'=> null, - 'success_msg'=> null, - 'production_order'=> $this->prodOrder, - 'sap_msg_status' => null, - 'sap_msg_description' => null, - 'operator_id'=> $operatorName, - 'recent_qr' => $this->recQr, - ]); - Notification::make() - ->title('Plan Not Found') - ->body("Please set production plan first.") - ->danger() - ->send(); - //$set('validationError', 'Curr.'.$currentDateTime.' (From: '.$from_dt.', To: '.$to_dt.')'); - return; - } - else - { - $currentDate = date('Y-m-d'); + // $this->form->fill([ + // 'plant_id'=> $this->pId, + // 'block_name'=> $this->bId, + // 'shift_id'=> $this->sId, + // 'line_id'=> $this->lId, + // 'item_id'=> null, + // 'serial_number'=> null, + // 'success_msg'=> null, + // 'production_order'=> $this->prodOrder, + // 'sap_msg_status' => null, + // 'sap_msg_description' => null, + // 'operator_id'=> $operatorName, + // 'recent_qr' => $this->recQr, + // ]); + // Notification::make() + // ->title('Plan Not Found') + // ->body("Please set production plan first.") + // ->danger() + // ->send(); + // //$set('validationError', 'Curr.'.$currentDateTime.' (From: '.$from_dt.', To: '.$to_dt.')'); + // return; + // } + // else + // { + // $currentDate = date('Y-m-d'); - $shiftId = Shift::where('id', $this->sId) - ->first(); + // $shiftId = Shift::where('id', $this->sId) + // ->first(); - [$hRs, $miNs] = explode('.', $shiftId->duration) + [0, 0]; - $hRs = (int) $hRs; - // $miNs = (int) $miNs;-*/ + // [$hRs, $miNs] = explode('.', $shiftId->duration) + [0, 0]; + // $hRs = (int) $hRs; + // // $miNs = (int) $miNs;-*/ - $totalMinutes = $hRs * 60 + $miNs; + // $totalMinutes = $hRs * 60 + $miNs; - $from_dt = $currentDate . ' ' . $shiftId->start_time; + // $from_dt = $currentDate . ' ' . $shiftId->start_time; - $to_dt = date('Y-m-d H:i:s', strtotime($from_dt . " + $totalMinutes minutes")); + // $to_dt = date('Y-m-d H:i:s', strtotime($from_dt . " + $totalMinutes minutes")); - $currentDateTime = date('Y-m-d H:i:s'); + // $currentDateTime = date('Y-m-d H:i:s'); - // Check if current date time is within the range - if ($currentDateTime >= $from_dt && $currentDateTime < $to_dt) { - //echo "Choosed a valid shift..."; - // $set('ppLineError', 'Valid (From: '.$from_dt.', To: '.$to_dt.')'); + // // Check if current date time is within the range + // if ($currentDateTime >= $from_dt && $currentDateTime < $to_dt) { + // //echo "Choosed a valid shift..."; + // // $set('ppLineError', 'Valid (From: '.$from_dt.', To: '.$to_dt.')'); - $this->form->fill([ - 'plant_id'=> $this->pId, - 'block_name'=> $this->bId, - 'shift_id'=> $this->sId, - 'line_id'=> $this->lId, - 'item_id'=> null, - 'serial_number'=> null, - 'success_msg'=> null, - 'production_order'=> $this->prodOrder, - 'sap_msg_status' => null, - 'sap_msg_description' => null, - 'operator_id'=> $operatorName, - 'recent_qr' => $this->recQr, - ]); - Notification::make() - ->title('Plan Not Found') - ->body("Please set production plan first.") - ->danger() - ->send(); - //$set('validationError', 'Curr.'.$currentDateTime.' (From: '.$from_dt.', To: '.$to_dt.')'); - return; - } - else - { - //echo "Choosed a valid shift..."; - // $set('ppLineError', 'Valid (From: '.$from_dt.', To: '.$to_dt.')'); + // $this->form->fill([ + // 'plant_id'=> $this->pId, + // 'block_name'=> $this->bId, + // 'shift_id'=> $this->sId, + // 'line_id'=> $this->lId, + // 'item_id'=> null, + // 'serial_number'=> null, + // 'success_msg'=> null, + // 'production_order'=> $this->prodOrder, + // 'sap_msg_status' => null, + // 'sap_msg_description' => null, + // 'operator_id'=> $operatorName, + // 'recent_qr' => $this->recQr, + // ]); + // Notification::make() + // ->title('Plan Not Found') + // ->body("Please set production plan first.") + // ->danger() + // ->send(); + // //$set('validationError', 'Curr.'.$currentDateTime.' (From: '.$from_dt.', To: '.$to_dt.')'); + // return; + // } + // else + // { + // //echo "Choosed a valid shift..."; + // // $set('ppLineError', 'Valid (From: '.$from_dt.', To: '.$to_dt.')'); - $this->form->fill([ - 'plant_id'=> $this->pId, - 'block_name'=> $this->bId, - 'shift_id'=> $this->sId, - 'line_id'=> $this->lId, - 'item_id'=> null, - 'serial_number'=> null, - 'success_msg'=> null, - 'production_order'=> $this->prodOrder, - 'sap_msg_status' => null, - 'sap_msg_description' => null, - 'operator_id'=> $operatorName, - 'recent_qr' => $this->recQr, - ]); - Notification::make() - ->title('Invalid Shift') - ->body("Please select a valid shift.") - ->danger() - ->send(); - //$set('validationError', 'Curr.'.$currentDateTime.' (From: '.$from_dt.', To: '.$to_dt.')'); - return; - } - } - } - } + // $this->form->fill([ + // 'plant_id'=> $this->pId, + // 'block_name'=> $this->bId, + // 'shift_id'=> $this->sId, + // 'line_id'=> $this->lId, + // 'item_id'=> null, + // 'serial_number'=> null, + // 'success_msg'=> null, + // 'production_order'=> $this->prodOrder, + // 'sap_msg_status' => null, + // 'sap_msg_description' => null, + // 'operator_id'=> $operatorName, + // 'recent_qr' => $this->recQr, + // ]); + // Notification::make() + // ->title('Invalid Shift') + // ->body("Please select a valid shift.") + // ->danger() + // ->send(); + // //$set('validationError', 'Curr.'.$currentDateTime.' (From: '.$from_dt.', To: '.$to_dt.')'); + // return; + // } + // } + // } + // } // ******************************** -- 2.49.1