diff --git a/app/Filament/Pages/BulkStickerPrinting.php b/app/Filament/Pages/BulkStickerPrinting.php index 8a35c13d..a0ba5bb5 100644 --- a/app/Filament/Pages/BulkStickerPrinting.php +++ b/app/Filament/Pages/BulkStickerPrinting.php @@ -982,6 +982,8 @@ class BulkStickerPrinting extends Page implements HasForms $itemCode = Item::where('id', $pOrderExist->item_id)->value('code'); + $plantCode = Plant::where('id', $plantId)->value('code'); + if (!$checkItem) { Notification::make() @@ -1008,19 +1010,19 @@ class BulkStickerPrinting extends Page implements HasForms $matchedMachineId = null; - for ($i = 1; $i <= 8; $i++) { + // for ($i = 1; $i <= 8; $i++) { - $machineColumn = "sticker{$i}_machine_id"; + // $machineColumn = "sticker{$i}_machine_id"; - if ((string) $stickerMappingMasterItem->{$machineColumn} == (string) $machineId) { + // if ((string) $stickerMappingMasterItem->{$machineColumn} == (string) $machineId) { - $matchedMachineId = $stickerMappingMasterItem->{$machineColumn}; + // $matchedMachineId = $stickerMappingMasterItem->{$machineColumn}; - break; - } - } + // break; + // } + // } - // $matchedMachineId = StickerMappingMaster::where('plant_id', $plantId)->where('item_id', $pOrderExist->item_id)->where('sticker_structure1_id', $structure->id)->where('sticker1_machine_id', $machineId)->first(); + $matchedMachineId = StickerMappingMaster::where('plant_id', $plantId)->where('item_id', $pOrderExist->item_id)->where('sticker_structure1_id', $structure->id)->where('sticker1_machine_id', $machineId)->first(); if (!$matchedMachineId) { @@ -1035,10 +1037,20 @@ class BulkStickerPrinting extends Page implements HasForms $itemCharacteristic = ClassCharacteristic::where('plant_id', $plantId) ->where('item_id', $checkItem->item_id) - ->where('machine_id', $matchedMachineId) + ->where('machine_id', $machineId) ->where('aufnr', $pOrder) ->first(); + if(!$itemCharacteristic){ + Notification::make() + ->danger() + ->title('Record Not Found') + ->body("Record not found in class characteristic against job '$pOrder', item '$itemCode' and plant '$plantCode'.") + ->send(); + + return; + } + $elements = StickerDetail::where('sticker_structure_detail_id',$structure->id)->get(); if ($elements->isEmpty()) {