Removed to serial number logic and added serial number in sticker order reprint
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 13s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 16s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 13s
Laravel Larastan / larastan (pull_request) Failing after 5m59s
Laravel Pint / pint (pull_request) Successful in 2m54s
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 13s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 16s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 13s
Laravel Larastan / larastan (pull_request) Failing after 5m59s
Laravel Pint / pint (pull_request) Successful in 2m54s
This commit is contained in:
@@ -1054,16 +1054,39 @@ class StickerOrderReprint extends Page implements HasForms
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if($matchedMachineId != $machineId){
|
// $updatePrintStatusExist = StickerOrder::where('plant_id', $plantId)->where('sticker_id',$stickerId)->where('production_order', $pOrder)->where('from_serial_number', '<=', $fromSerNo)->where('to_serial_number', '>=', $toSerNo)->first();
|
||||||
|
|
||||||
|
// if ($updatePrintStatusExist) {
|
||||||
// Notification::make()
|
// Notification::make()
|
||||||
// ->danger()
|
// ->danger()
|
||||||
// ->title('Machine Not Found')
|
// ->title('Invalid Sticker Reprint')
|
||||||
// ->body("Machine '{$machineId}' is not mapped for Item Code '{$itemCode}' in the selected sticker mapping.")
|
// ->body("Sticker reprint is invalid not found in sticker order.")
|
||||||
// ->send();
|
// ->send();
|
||||||
|
|
||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
$expectedSerialNumbers = range($fromSerNo, $toSerNo);
|
||||||
|
|
||||||
|
$existingSerialNumbers = StickerOrder::where('plant_id', $plantId)
|
||||||
|
->where('sticker_id', $stickerId)
|
||||||
|
->where('production_order', $pOrder)
|
||||||
|
->whereIn('serial_number', $expectedSerialNumbers)
|
||||||
|
->pluck('serial_number')
|
||||||
|
->toArray();
|
||||||
|
|
||||||
|
$missingSerialNumbers = array_diff($expectedSerialNumbers,$existingSerialNumbers);
|
||||||
|
|
||||||
|
if (!empty($missingSerialNumbers)) {
|
||||||
|
Notification::make()
|
||||||
|
->danger()
|
||||||
|
->title('Invalid Sticker Reprint')
|
||||||
|
->body("Missing Serial number ' ($missingSerialNumbers) . ' does not exist in sticker order to atke sticker reprint.")
|
||||||
|
->send();
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$itemCharacteristic = ClassCharacteristic::where('plant_id', $plantId)
|
$itemCharacteristic = ClassCharacteristic::where('plant_id', $plantId)
|
||||||
->where('item_id', $itemCharacteristicId)
|
->where('item_id', $itemCharacteristicId)
|
||||||
->where('machine_id', $matchedMachineId)
|
->where('machine_id', $matchedMachineId)
|
||||||
@@ -1108,13 +1131,22 @@ class StickerOrderReprint extends Page implements HasForms
|
|||||||
|
|
||||||
$this->dispatch('open-sticker-pdf',urls: [$pdfUrl]);
|
$this->dispatch('open-sticker-pdf',urls: [$pdfUrl]);
|
||||||
|
|
||||||
$updatePrintStatus = StickerOrder::where('plant_id', $plantId)->where('production_order', $pOrder)->where('from_serial_number', $fromSerNo)->where('to_serial_number', $toSerNo)->where('sticker_id',$stickerId)->first();
|
for ($serialNo = $fromSerNo; $serialNo <= $toSerNo; $serialNo++) {
|
||||||
|
|
||||||
if ($updatePrintStatus) {
|
$updatePrintStatus = StickerOrder::where('plant_id', $plantId)
|
||||||
$count = (int) $updatePrintStatus->reprint_count ?? 0;
|
->where('sticker_id', $stickerId)
|
||||||
$updatePrintStatus->update([
|
->where('production_order', $pOrder)
|
||||||
'reprint_count' => $count + 1,
|
->where('serial_number', $serialNo)
|
||||||
]);
|
->first();
|
||||||
|
|
||||||
|
if ($updatePrintStatus) {
|
||||||
|
|
||||||
|
$count = (int) ($updatePrintStatus->reprint_count ?? 0);
|
||||||
|
|
||||||
|
$updatePrintStatus->update([
|
||||||
|
'reprint_count' => $count + 1,
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
|
|||||||
Reference in New Issue
Block a user