diff --git a/app/Filament/Resources/WireMasterPackingResource/Pages/CreateWireMasterPacking.php b/app/Filament/Resources/WireMasterPackingResource/Pages/CreateWireMasterPacking.php index 8cff2eb..70bb860 100644 --- a/app/Filament/Resources/WireMasterPackingResource/Pages/CreateWireMasterPacking.php +++ b/app/Filament/Resources/WireMasterPackingResource/Pages/CreateWireMasterPacking.php @@ -109,7 +109,7 @@ class CreateWireMasterPacking extends CreateRecord $materialCode = $matches[1]; $processOrderId = $matches[2]; - $coilNo = $matches[3]; + $coilNo = $matches[3]; $weight = $matches[4]; $icode = Item::where('code', $materialCode)->first(); @@ -164,6 +164,33 @@ class CreateWireMasterPacking extends CreateRecord return; } + $itemId = Item::where('code', $materialCode) + ->where('plant_id', $plantId) + ->value('id'); + + $icodeAgaCPoPlant = CustomerPoMaster::where('item_id', $itemId)->where('plant_id', $plantId)->first(); + + if(!$icodeAgaCPoPlant) + { + Notification::make() + ->title("Unknown Item Code in Customer PO") + ->body("Item Code '$materialCode' not found in any active Customer PO against Plant Code '$plantcode'") + ->danger() + ->duration(5000) + ->send(); + + $this->form->fill([ + 'process_order' => null, + 'plant_id' => $plantId, + 'customer_po_master_id' => $customerPo, + 'wire_packing_number' => $wirePackNo, + 'Sno_quantity' => 0, + 'created_by' => $operatorName, + 'scanned_by' => $operatorName, + ]); + return; + } + $processOrderAgaPlant = WireMasterPacking::where('process_order', $processOrderId . '-' . $coilNo)->where('plant_id', $plantId)->first(); if($processOrderAgaPlant) @@ -220,7 +247,7 @@ class CreateWireMasterPacking extends CreateRecord return; } - if($weight > $customerPoRecord->quantity) + if((float)$weight > (float)$customerPoRecord->quantity) { Notification::make() ->title("Scanned Weight Exceeds PO Quantity")