Changed logic in bulk sticker printing page
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 18s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 13s
Laravel Pint / pint (pull_request) Successful in 2m51s
Laravel Larastan / larastan (pull_request) Failing after 6m4s
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 18s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 13s
Laravel Pint / pint (pull_request) Successful in 2m51s
Laravel Larastan / larastan (pull_request) Failing after 6m4s
This commit is contained in:
@@ -873,19 +873,6 @@ class BulkStickerPrinting extends Page implements HasForms
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if($stickerId == 'SelfPriming Monoblock Pump Dual'){
|
|
||||||
// if ($fromSerNo % 2 == 0 || $toSerNo % 2 != 0) {
|
|
||||||
|
|
||||||
// Notification::make()
|
|
||||||
// ->danger()
|
|
||||||
// ->title('Invalid Serial Number')
|
|
||||||
// ->body('For SelfPriming Monoblock Pump Dual, serial numbers must be even.')
|
|
||||||
// ->send();
|
|
||||||
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
$pOrderExist = ClassCharacteristic::where('plant_id',$plantId)->where('aufnr', $pOrder)->first();
|
$pOrderExist = ClassCharacteristic::where('plant_id',$plantId)->where('aufnr', $pOrder)->first();
|
||||||
|
|
||||||
if(!$pOrderExist){
|
if(!$pOrderExist){
|
||||||
@@ -916,17 +903,6 @@ class BulkStickerPrinting extends Page implements HasForms
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// $updatePrintStatusCompleted = StickerOrder::where('plant_id', $plantId)->where('production_order', $pOrder)->where('sticker_id', $stickerId)->where('from_serial_number', $fromSerNo)->where('to_serial_number', $toSerNo)->where('sticker_id', $stickerId)->where('print_status', 'Printed')->first();
|
|
||||||
|
|
||||||
// if ($updatePrintStatusCompleted) {
|
|
||||||
// Notification::make()
|
|
||||||
// ->danger()
|
|
||||||
// ->title('Duplicate Sticker')
|
|
||||||
// ->body("Already StickerId '$stickerId' generated successfully for Production Order '$pOrder' and plant '$plantName'.")
|
|
||||||
// ->send();
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
$existingSticker = StickerOrder::where('plant_id', $plantId)
|
$existingSticker = StickerOrder::where('plant_id', $plantId)
|
||||||
->where('production_order', $pOrder)
|
->where('production_order', $pOrder)
|
||||||
->where('sticker_id', $stickerId)
|
->where('sticker_id', $stickerId)
|
||||||
@@ -956,10 +932,9 @@ class BulkStickerPrinting extends Page implements HasForms
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$stickerMappingMasterItems = StickerMappingMaster::where('plant_id', $plantId)->get();
|
$stickerMappingMasterItem = StickerMappingMaster::where('plant_id', $plantId)->first();
|
||||||
// dd($plantId, $stickerMappingMasterItems);
|
|
||||||
|
|
||||||
if (!$stickerMappingMasterItems) {
|
if (!$stickerMappingMasterItem) {
|
||||||
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->danger()
|
->danger()
|
||||||
@@ -969,115 +944,62 @@ class BulkStickerPrinting extends Page implements HasForms
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$structure = null;
|
// foreach ($stickerMappingMasterItems as $mapping) {
|
||||||
$stickerMappingMasterItem = null;
|
|
||||||
|
|
||||||
foreach ($stickerMappingMasterItems as $mapping) {
|
// // Check sticker_structure1_id to sticker_structure8_id
|
||||||
|
// for ($i = 1; $i <= 8; $i++) {
|
||||||
|
|
||||||
// Check sticker_structure1_id to sticker_structure8_id
|
// $column = "sticker_structure{$i}_id";
|
||||||
for ($i = 1; $i <= 8; $i++) {
|
|
||||||
|
|
||||||
$column = "sticker_structure{$i}_id";
|
// $structureId = $mapping->{$column};
|
||||||
|
|
||||||
$structureId = $mapping->{$column};
|
// if (empty($structureId)) {
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
|
||||||
if (empty($structureId)) {
|
// // Find structure detail
|
||||||
continue;
|
// $detail = StickerStructureDetail::find($structureId);
|
||||||
}
|
|
||||||
|
|
||||||
// Find structure detail
|
// if (!$detail) {
|
||||||
$detail = StickerStructureDetail::find($structureId);
|
// continue;
|
||||||
|
// }
|
||||||
|
|
||||||
if (!$detail) {
|
// // Check whether this structure belongs to selected sticker
|
||||||
continue;
|
// if ((string) $detail->sticker_id === (string) $stickerId) {
|
||||||
}
|
|
||||||
|
|
||||||
// Check whether this structure belongs to selected sticker
|
// $structure = $detail;
|
||||||
if ((string) $detail->sticker_id === (string) $stickerId) {
|
|
||||||
|
|
||||||
$structure = $detail;
|
// // Keep the mapping record also
|
||||||
|
// $stickerMappingMasterItem = $mapping;
|
||||||
|
|
||||||
// Keep the mapping record also
|
// break 2;
|
||||||
$stickerMappingMasterItem = $mapping;
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
break 2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$structure) {
|
$checkItem = StickerMappingMaster::where('plant_id', $plantId)->where('item_id', $pOrderExist->item_id)->where('sticker_structure1_id', $structure->id)->first();
|
||||||
|
|
||||||
|
$itemCode = Item::where('id', $pOrderExist->item_id)->value('code');
|
||||||
|
|
||||||
|
if (!$checkItem) {
|
||||||
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->danger()
|
->danger()
|
||||||
->title('Sticker Structure Not Found')
|
->title('Item Not Found')
|
||||||
->body("No sticker structure found for selected sticker ID '{$stickerId}'.")
|
->body("Item code '$itemCode' not found in sticker mapping master for selected sticker ID '{$stickerId}'.")
|
||||||
->send();
|
->send();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$itemCharacteristicId = $stickerMappingMasterItem->item_id;
|
$itemCharacteristic1 = ClassCharacteristic::where('plant_id', $plantId)->where('aufnr', $pOrder)->where('item_id', $pOrderExist->item_id)->first();
|
||||||
|
|
||||||
$itemCode = Item::where('id', $itemCharacteristicId)->value('code');
|
|
||||||
|
|
||||||
if (!$itemCharacteristicId) {
|
|
||||||
|
|
||||||
Notification::make()
|
|
||||||
->danger()
|
|
||||||
->title('Item Characteristic Not Found')
|
|
||||||
->body('No item characteristic is configured in sticker mapping.')
|
|
||||||
->send();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$itemCharacteristic1 = ClassCharacteristic::where('plant_id', $plantId)->where('item_id',$itemCharacteristicId)->first();
|
|
||||||
|
|
||||||
if (!$itemCharacteristic1) {
|
if (!$itemCharacteristic1) {
|
||||||
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->danger()
|
->danger()
|
||||||
->title('Item Not Found')
|
->title('Item Not Found')
|
||||||
->body("Item code '{$itemCode}' was not found in class characteristic.")
|
->body("Item code '{$itemCode}' was not found against job number '$pOrder' in class characteristic.")
|
||||||
->send();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$itemCharacteristicPodr = ClassCharacteristic::where('plant_id', $plantId)->where('aufnr', $pOrder)->where('item_id', $itemCharacteristicId)->first();
|
|
||||||
|
|
||||||
if (!$itemCharacteristicPodr) {
|
|
||||||
|
|
||||||
Notification::make()
|
|
||||||
->danger()
|
|
||||||
->title('Item Not Found')
|
|
||||||
->body("Item code '{$itemCode}' with Job Number '{$pOrder}' was not found against plant '{$plantName}'.")
|
|
||||||
->send();
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$itemCodeMis = $pOrderExist->item_id;
|
|
||||||
|
|
||||||
$itemCodeInPOrd = Item::where('id', $itemCodeMis)->where('plant_id', $plantId)->first();
|
|
||||||
|
|
||||||
$itemCodeInStickerMapping = Item::where('id', $itemCharacteristicId)->where('plant_id', $plantId)->first();
|
|
||||||
|
|
||||||
if($itemCodeMis != $itemCharacteristicId){
|
|
||||||
Notification::make()
|
|
||||||
->danger()
|
|
||||||
->title('Item Mismatch Found')
|
|
||||||
->body("sticker mapping Item code '{$itemCodeInPOrd->code}' and item code '{$itemCodeInStickerMapping->code}' for Job Number '{$pOrder}' was not mapped in sticker mapping against plant '{$plantName}'.")
|
|
||||||
->send();
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$itemCode = Item::where('id', $itemCharacteristicId)->where('plant_id',$plantId)->value('code');
|
|
||||||
|
|
||||||
if (!$itemCode) {
|
|
||||||
|
|
||||||
Notification::make()
|
|
||||||
->danger()
|
|
||||||
->title('Item Not Found')
|
|
||||||
->body("Item code '{$itemCode}' found in item master.")
|
|
||||||
->send();
|
->send();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1110,7 +1032,7 @@ class BulkStickerPrinting extends Page implements HasForms
|
|||||||
}
|
}
|
||||||
|
|
||||||
$itemCharacteristic = ClassCharacteristic::where('plant_id', $plantId)
|
$itemCharacteristic = ClassCharacteristic::where('plant_id', $plantId)
|
||||||
->where('item_id', $itemCharacteristicId)
|
->where('item_id', $checkItem->item_id)
|
||||||
->where('machine_id', $matchedMachineId)
|
->where('machine_id', $matchedMachineId)
|
||||||
->where('aufnr', $pOrder)
|
->where('aufnr', $pOrder)
|
||||||
->first();
|
->first();
|
||||||
@@ -1166,30 +1088,7 @@ class BulkStickerPrinting extends Page implements HasForms
|
|||||||
|
|
||||||
$totalStickers = ($toSerNo - $fromSerNo) + 1;
|
$totalStickers = ($toSerNo - $fromSerNo) + 1;
|
||||||
|
|
||||||
$item = Item::where('id', $itemCharacteristicId)->where('plant_id', $plantId)->first();
|
$item = Item::where('id', $checkItem->item_id)->where('plant_id', $plantId)->first();
|
||||||
|
|
||||||
// $updatePrintStatus = StickerOrder::where('plant_id', $plantId)->where('production_order', $pOrder)->where('from_serial_number', $fromSerNo)->where('to_serial_number', $toSerNo)->first();
|
|
||||||
|
|
||||||
// if (!$updatePrintStatus) {
|
|
||||||
// StickerOrder::create([
|
|
||||||
// 'plant_id' => $plantId,
|
|
||||||
// 'item_id' => $item->id,
|
|
||||||
// 'production_order' => $pOrder,
|
|
||||||
// 'serial_number' => $fromSerNo,
|
|
||||||
// 'to_serial_number' => $toSerNo,
|
|
||||||
// 'sticker_id' => $stickerId,
|
|
||||||
// 'print_status' => 'Printed',
|
|
||||||
// ]);
|
|
||||||
|
|
||||||
// Notification::make()
|
|
||||||
// ->success()
|
|
||||||
// ->title('Sticker Generated')
|
|
||||||
// ->body("{$totalStickers} sticker(s) generated successfully.")
|
|
||||||
// ->seconds(3)
|
|
||||||
// ->send();
|
|
||||||
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
$from = (int) $fromSerNo;
|
$from = (int) $fromSerNo;
|
||||||
$to = (int) $toSerNo;
|
$to = (int) $toSerNo;
|
||||||
|
|||||||
Reference in New Issue
Block a user