Merge pull request 'changed logic in bulk sticker printing of machine issue' (#1278) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled

Reviewed-on: #1278
This commit was merged in pull request #1278.
This commit is contained in:
2026-10-20 05:35:14 +00:00

View File

@@ -1077,25 +1077,54 @@ class BulkStickerPrinting extends Page implements HasForms
$matchedMachineId = null; $matchedMachineId = null;
// for ($i = 1; $i <= 8; $i++) {
// $structureColumn = "sticker_structure{$i}_id";
// if (
// (string) $stickerMappingMasterItem->{$structureColumn}
// == (string) $structure->id
// ) {
// $machineColumn = "sticker{$i}_machine_id";
// $matchedMachineId = $stickerMappingMasterItem->{$machineColumn};
// break;
// }
// }
// if ($matchedMachineId == null || (string) $matchedMachineId != (string) $machineId)
// {
// Notification::make()
// ->danger()
// ->title('Machine Mapping Mismatch')
// ->body("Selected machine '{$machineId}' does not match the machine mapped to the selected sticker.")
// ->send();
// return;
// }
//..New
for ($i = 1; $i <= 8; $i++) { for ($i = 1; $i <= 8; $i++) {
$structureColumn = "sticker_structure{$i}_id"; $structureColumn = "sticker_structure{$i}_id";
$machineColumn = "sticker{$i}_machine_id";
$mappedStructureId = $stickerMappingMasterItem->{$structureColumn} ?? null;
if ( if (
(string) $stickerMappingMasterItem->{$structureColumn} $mappedStructureId !== null &&
== (string) $structure->id (string) $mappedStructureId === (string) $structure->id
) { ) {
$machineColumn = "sticker{$i}_machine_id"; $matchedMachineId = $stickerMappingMasterItem->{$machineColumn} ?? null;
$matchedMachineId = $stickerMappingMasterItem->{$machineColumn};
break; break;
} }
} }
if ( if (
$matchedMachineId == null || $matchedMachineId === null ||
(string) $matchedMachineId != (string) $machineId trim((string) $matchedMachineId) !== trim((string) $machineId)
) { ) {
Notification::make() Notification::make()
->danger() ->danger()
@@ -1106,25 +1135,11 @@ class BulkStickerPrinting extends Page implements HasForms
return; return;
} }
if ((string) $matchedMachineId != (string) $machineId) { // if ((string) $matchedMachineId != (string) $machineId) {
Notification::make()
->danger()
->title('Machine Not Found')
->body("Machine '{$machineId}' is not mapped for Item Code '{$itemCode}' against sticker '$stickerId' in sticker mapping master.")
->send();
return;
}
// $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) {
// Notification::make() // Notification::make()
// ->danger() // ->danger()
// ->title('Machine Not Found') // ->title('Machine Not Found')
// ->body("Machine '{$machineId}' is not mapped for Item Code '{$itemCode}' in sticker mapping master.") // ->body("Machine '{$machineId}' is not mapped for Item Code '{$itemCode}' against sticker '$stickerId' in sticker mapping master.")
// ->send(); // ->send();
// return; // return;