Changed logic in bulk sticker prinitng page
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 15s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 17s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 14s
Laravel Pint / pint (pull_request) Successful in 3m43s
Laravel Larastan / larastan (pull_request) Failing after 6m16s

This commit is contained in:
dhanabalan
2026-10-16 11:29:08 +05:30
parent d6a408a61f
commit 2e12918203

View File

@@ -932,9 +932,9 @@ class BulkStickerPrinting extends Page implements HasForms
return;
}
$stickerMappingMasterItem = StickerMappingMaster::where('plant_id', $plantId)->first();
$stickerMappingMasterItems = StickerMappingMaster::where('plant_id', $plantId)->get();
if (!$stickerMappingMasterItem) {
if (!$stickerMappingMasterItems) {
Notification::make()
->danger()
@@ -944,55 +944,55 @@ class BulkStickerPrinting extends Page implements HasForms
return;
}
// foreach ($stickerMappingMasterItems as $mapping) {
foreach ($stickerMappingMasterItems as $mapping) {
// // Check sticker_structure1_id to sticker_structure8_id
// for ($i = 1; $i <= 8; $i++) {
// Check sticker_structure1_id to sticker_structure8_id
for ($i = 1; $i <= 8; $i++) {
// $column = "sticker_structure{$i}_id";
$column = "sticker_structure{$i}_id";
// $structureId = $mapping->{$column};
$structureId = $mapping->{$column};
// if (empty($structureId)) {
// continue;
// }
if (empty($structureId)) {
continue;
}
// // Find structure detail
// $detail = StickerStructureDetail::find($structureId);
// Find structure detail
$detail = StickerStructureDetail::find($structureId);
// if (!$detail) {
// continue;
// }
if (!$detail) {
continue;
}
// // Check whether this structure belongs to selected sticker
// if ((string) $detail->sticker_id === (string) $stickerId) {
// Check whether this structure belongs to selected sticker
if ((string) $detail->sticker_id === (string) $stickerId) {
// $structure = $detail;
$structure = $detail;
// // Keep the mapping record also
// $stickerMappingMasterItem = $mapping;
// Keep the mapping record also
$stickerMappingMasterItem = $mapping;
// break 2;
// }
// }
// }
break 2;
}
}
}
$checkItem = StickerMappingMaster::where('plant_id', $plantId)->where('item_id', $pOrderExist->item_id)->where('sticker_structure1_id', $structure->id)->first();
// $checkItem = StickerMappingMaster::where('plant_id', $plantId)->where('item_id', $pOrderExist->item_id)->where('sticker_structure1_id', $structure->id)->first();
$itemCode = Item::where('id', $pOrderExist->item_id)->value('code');
$plantCode = Plant::where('id', $plantId)->value('code');
if (!$checkItem) {
// if (!$checkItem) {
Notification::make()
->danger()
->title('Item Not Found')
->body("Item code '$itemCode' not found in sticker mapping master for selected sticker ID '{$stickerId}'.")
->send();
return;
}
// Notification::make()
// ->danger()
// ->title('Item Not Found')
// ->body("Item code '$itemCode' not found in sticker mapping master for selected sticker ID '{$stickerId}'.")
// ->send();
// return;
// }
$itemCharacteristic1 = ClassCharacteristic::where('plant_id', $plantId)->where('aufnr', $pOrder)->where('item_id', $pOrderExist->item_id)->first();
@@ -1010,17 +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};
break;
}
}
// $matchedMachineId = $stickerMappingMasterItem->{$machineColumn};
// 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();
@@ -1036,7 +1038,7 @@ class BulkStickerPrinting extends Page implements HasForms
}
$itemCharacteristic = ClassCharacteristic::where('plant_id', $plantId)
->where('item_id', $checkItem->item_id)
->where('item_id', $pOrderExist->item_id)
->where('machine_id', $machineId)
->where('aufnr', $pOrder)
->first();
@@ -1102,7 +1104,7 @@ class BulkStickerPrinting extends Page implements HasForms
$totalStickers = ($toSerNo - $fromSerNo) + 1;
$item = Item::where('id', $checkItem->item_id)->where('plant_id', $plantId)->first();
$item = Item::where('id', $pOrderExist->item_id)->where('plant_id', $plantId)->first();
$from = (int) $fromSerNo;
$to = (int) $toSerNo;