Merge pull request 'Changed logic in sticker order reprint' (#1282) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 13s
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 13s
Reviewed-on: #1282
This commit was merged in pull request #1282.
This commit is contained in:
@@ -1090,7 +1090,7 @@ class StickerOrderReprint extends Page implements HasForms
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$stickerMappingMasterItems = StickerMappingMaster::where('plant_id', $plantId)->get();
|
$stickerMappingMasterItems = StickerMappingMaster::where('plant_id', $plantId)->where('item_id', $pOrderExist->item_id)->get();
|
||||||
|
|
||||||
if ($stickerMappingMasterItems->isEmpty()) {
|
if ($stickerMappingMasterItems->isEmpty()) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
@@ -1208,35 +1208,27 @@ class StickerOrderReprint extends Page implements HasForms
|
|||||||
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 ($matchedMachineId == null || (string) $matchedMachineId != (string) $machineId)
|
$selectedMachineId = trim((string) $machineId);
|
||||||
{
|
$mappedMachineId = trim((string) $matchedMachineId);
|
||||||
|
|
||||||
|
if ($mappedMachineId === '' || $mappedMachineId !== $selectedMachineId) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->danger()
|
->danger()
|
||||||
->title('Machine Mapping Mismatch')
|
->title('Machine Mapping Mismatch')
|
||||||
->body("Selected machine '{$machineId}' does not match the machine mapped to the selected sticker.")
|
->body("Selected machine '{$selectedMachineId}' does not match the mapped machine '{$mappedMachineId}'.")
|
||||||
->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.")
|
|
||||||
->send();
|
->send();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user