From 60d8460e5fac4092b4a9396478ca1355e37b1098 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Mon, 26 Oct 2026 18:44:22 +0530 Subject: [PATCH] Changed logic in panel box validation --- .../Pages/PanelBoxInspectionStock.php | 41 +++++++++++++------ 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/app/Filament/Pages/PanelBoxInspectionStock.php b/app/Filament/Pages/PanelBoxInspectionStock.php index 55846ac9..61e140d7 100644 --- a/app/Filament/Pages/PanelBoxInspectionStock.php +++ b/app/Filament/Pages/PanelBoxInspectionStock.php @@ -448,18 +448,35 @@ class PanelBoxInspectionStock extends Page $serialExists = PanelBoxValidation::where('plant_id', $plantId)->where('serial_number', $serialNumber)->where('panel_box_supplier', $supplier)->first(); if ($serialExists) { - Notification::make() - ->title('Already Scanned In Testing') - ->body("Serial number already scanned '$serialNumber' with supplier number '$supplier'.
Please scan this serial number in Invoice Validation.") - ->success() - ->send(); - $this->dispatch('play-error-sound'); - $this->form->fill([ - 'plant_id' => $plantId, - 'line_id' => $lineId, - 'item_id' => null, - ]); - return; + + if($serialExists->inspection_lot_number != '' && $serialExists->production_order != ''){ + Notification::make() + ->title('Already Scanned In Testing') + ->body("Serial number already scanned '$serialNumber' with supplier number '$supplier'.
Please scan this serial number in Invoice Validation.") + ->success() + ->send(); + $this->dispatch('play-error-sound'); + $this->form->fill([ + 'plant_id' => $plantId, + 'line_id' => $lineId, + 'item_id' => null, + ]); + return; + } + else{ + Notification::make() + ->title('Duplicate Serial Number') + ->body("Duplicate Serial number '$serialNumber' with supplier number '$supplier'.") + ->success() + ->send(); + $this->form->fill([ + 'plant_id' => $plantId, + 'line_id' => $lineId, + 'item_id' => null, + ]); + return; + } + } $item = Item::where('code', $itemCode)->where('plant_id', $plantId)->first();