From be2e9027a1f51cc0157cbc4d1ca70d1aabdf2a56 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Sat, 12 Sep 2026 09:30:11 +0530 Subject: [PATCH] Added supplier logic in panel box validation --- .../Resources/PanelBoxValidationResource.php | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/app/Filament/Resources/PanelBoxValidationResource.php b/app/Filament/Resources/PanelBoxValidationResource.php index e72c638..b00e054 100644 --- a/app/Filament/Resources/PanelBoxValidationResource.php +++ b/app/Filament/Resources/PanelBoxValidationResource.php @@ -607,6 +607,19 @@ class PanelBoxValidationResource extends Resource return; } + $sticker = StickerMaster::where('plant_id', $plantId)->where('item_id', $iId->id)->first(); + + if(!$sticker){ + Notification::make() + ->title('Unknown Item Code') + ->body("Item code not found '{$iId->code}' in sticker master.") + ->danger() + ->send(); + $set('item_id', null); + $set('serial_exists', false); + return; + } + $existInMaster = PanelGrMaster::where('document_number', $pOrder)->where('inspection_lot_number', $inspecLotNo)->where('item_id', $iId->id)->where('plant_id', $plantId)->first(); if(!$existInMaster){ @@ -670,19 +683,6 @@ class PanelBoxValidationResource extends Resource return; } - $sticker = StickerMaster::where('plant_id', $plantId)->where('item_id', $iId->id)->first(); - - if(!$sticker){ - Notification::make() - ->title('Unknown Item Code') - ->body("Item code not found '{$iId->code}' in sticker master.") - ->danger() - ->send(); - $set('item_id', null); - $set('serial_exists', false); - return; - } - $existQuanInPanel = PanelBoxValidation::where('plant_id', $plantId)->where('production_order', $pOrder)->where('inspection_lot_number', $inspecLotNo)->where('sticker_master_id', $sticker->id)->count(); if ($existQuanInPanel >= (int) $existInMaster->quantity) { @@ -812,7 +812,7 @@ class PanelBoxValidationResource extends Resource } } - $serialExists = PanelBoxValidation::where('serial_number', $serialNumber)->where('plant_id', $plantId)->first(); + $serialExists = PanelBoxValidation::where('serial_number', $serialNumber)->where('plant_id', $plantId)->where('panel_box_supplier', $supplier)->first(); if ($serialExists) { $set('serial_exists', true); -- 2.49.1