diff --git a/app/Filament/Pages/BulkStickerPrinting.php b/app/Filament/Pages/BulkStickerPrinting.php index 7103751..fe27e75 100644 --- a/app/Filament/Pages/BulkStickerPrinting.php +++ b/app/Filament/Pages/BulkStickerPrinting.php @@ -879,6 +879,18 @@ class BulkStickerPrinting extends Page implements HasForms } } + $updatePrintStatusCompleted = ProductionOrder::where('plant_id', $plantId)->where('production_order', $pOrder)->where('from_serial_number', $fromSerNo)->where('to_serial_number', $toSerNo)->where('print_status', 'Printed')->first(); + + if ($updatePrintStatusCompleted) { + Notification::make() + ->danger() + ->title('Duplicate Sticker') + ->body("Already Sticker generated successfully for Production Order '$pOrder' and plant '$plantName'.") + ->send(); + return; + } + + $structure = StickerStructureDetail::where('sticker_id',$stickerId)->first(); if (!$structure) { @@ -1035,6 +1047,13 @@ class BulkStickerPrinting extends Page implements HasForms $totalStickers = ($toSerNo - $fromSerNo) + 1; + $updatePrintStatus = ProductionOrder::where('plant_id', $plantId)->where('production_order', $pOrder)->where('from_serial_number', $fromSerNo)->where('to_serial_number', $toSerNo)->first(); + + if ($updatePrintStatus) { + $updatePrintStatus->update([ + 'print_status' => 'Printed', + ]); + } Notification::make() ->success()