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

This commit is contained in:
dhanabalan
2026-10-07 15:20:35 +05:30
parent 5b54fd1795
commit 053d3d6132

View File

@@ -1054,16 +1054,39 @@ class StickerOrderReprint extends Page implements HasForms
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()
// ->danger()
// ->title('Machine Not Found')
// ->body("Machine '{$machineId}' is not mapped for Item Code '{$itemCode}' in the selected sticker mapping.")
// ->title('Invalid Sticker Reprint')
// ->body("Sticker reprint is invalid not found in sticker order.")
// ->send();
// 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)
->where('item_id', $itemCharacteristicId)
->where('machine_id', $matchedMachineId)
@@ -1108,13 +1131,22 @@ class StickerOrderReprint extends Page implements HasForms
$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) {
$count = (int) $updatePrintStatus->reprint_count ?? 0;
$updatePrintStatus->update([
'reprint_count' => $count + 1,
]);
$updatePrintStatus = StickerOrder::where('plant_id', $plantId)
->where('sticker_id', $stickerId)
->where('production_order', $pOrder)
->where('serial_number', $serialNo)
->first();
if ($updatePrintStatus) {
$count = (int) ($updatePrintStatus->reprint_count ?? 0);
$updatePrintStatus->update([
'reprint_count' => $count + 1,
]);
}
}
Notification::make()