Changed logic in sticker order reprint
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 19s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 13s
Laravel Pint / pint (pull_request) Successful in 3m37s
Laravel Larastan / larastan (pull_request) Failing after 6m19s

This commit is contained in:
dhanabalan
2026-10-20 11:24:37 +05:30
parent 93092f45fe
commit f41bfa0ee7

View File

@@ -1090,7 +1090,7 @@ class StickerOrderReprint extends Page implements HasForms
return;
}
$stickerMappingMasterItems = StickerMappingMaster::where('plant_id', $plantId)->get();
$stickerMappingMasterItems = StickerMappingMaster::where('plant_id', $plantId)->where('item_id', $pOrderExist->item_id)->get();
if ($stickerMappingMasterItems->isEmpty()) {
Notification::make()
@@ -1208,35 +1208,27 @@ class StickerOrderReprint extends Page implements HasForms
for ($i = 1; $i <= 8; $i++) {
$structureColumn = "sticker_structure{$i}_id";
$machineColumn = "sticker{$i}_machine_id";
$mappedStructureId = $stickerMappingMasterItem->{$structureColumn} ?? null;
if (
(string) $stickerMappingMasterItem->{$structureColumn}
== (string) $structure->id
$mappedStructureId !== null &&
(string) $mappedStructureId === (string) $structure->id
) {
$machineColumn = "sticker{$i}_machine_id";
$matchedMachineId = $stickerMappingMasterItem->{$machineColumn};
$matchedMachineId = $stickerMappingMasterItem->{$machineColumn} ?? null;
break;
}
}
if ($matchedMachineId == null || (string) $matchedMachineId != (string) $machineId)
{
$selectedMachineId = trim((string) $machineId);
$mappedMachineId = trim((string) $matchedMachineId);
if ($mappedMachineId === '' || $mappedMachineId !== $selectedMachineId) {
Notification::make()
->danger()
->title('Machine Mapping Mismatch')
->body("Selected machine '{$machineId}' does not match the machine mapped to the selected sticker.")
->send();
return;
}
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.")
->body("Selected machine '{$selectedMachineId}' does not match the mapped machine '{$mappedMachineId}'.")
->send();
return;