diff --git a/app/Filament/Resources/PanelBoxValidationResource.php b/app/Filament/Resources/PanelBoxValidationResource.php index 0d2f7bbf..14777020 100644 --- a/app/Filament/Resources/PanelBoxValidationResource.php +++ b/app/Filament/Resources/PanelBoxValidationResource.php @@ -784,7 +784,6 @@ class PanelBoxValidationResource extends Resource // return; // } - $set('panel_box_supplier', $supplier); $set('panel_box_serial_number', $panelBoxSerialNo); $set('panel_box_code', $panelBoxCode); @@ -1062,7 +1061,7 @@ class PanelBoxValidationResource extends Resource $set('serial_exists', false); } - $serialExistsPanel = PanelBoxValidation::where('serial_number', $serialNumber)->where('plant_id', $plantId)->where('panel_box_supplier', $supplier)->where('status', '!=', '')->whereNotNull('status')->where('status', 'Ok')->first(); + $serialExistsPanel = PanelBoxValidation::where('plant_id', $plantId)->where('serial_number', $serialNumber)->where('panel_box_supplier', $supplier)->where('panel_box_code', $panelBoxCode)->where('status', '!=', '')->whereNotNull('status')->where('status', 'Ok')->first(); if($serialExistsPanel){ Notification::make() @@ -1267,6 +1266,17 @@ class PanelBoxValidationResource extends Resource }) ->first(); + // $alreadyExists = PanelBoxValidation::where('serial_number', $serialNumber) + // ->where('plant_id', $plantId) + // ->where(function ($query) use ($pOrder, $inspecLotNo) { + // $query->where('production_order', $pOrder); + + // if (!empty($inspecLotNo)) { + // $query->orWhere('inspection_lot_number', $inspecLotNo); + // } + // }) + // ->first(); + $alreadyExistsSupplier = PanelBoxValidation::where('plant_id', $plantId)->where('serial_number', $serialNumber) ->where('panel_box_supplier', $supplierNo) ->first();