changed logic to old version
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 20s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 30s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 27s
Laravel Pint / pint (pull_request) Successful in 4m10s
Laravel Larastan / larastan (pull_request) Failing after 6m22s
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 20s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 30s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 27s
Laravel Pint / pint (pull_request) Successful in 4m10s
Laravel Larastan / larastan (pull_request) Failing after 6m22s
This commit is contained in:
@@ -239,7 +239,6 @@ class PanelBoxValidationResource extends Resource
|
||||
$set('show_validation_image', false);
|
||||
$set('validation1_image_url', null);
|
||||
$set('serialPanelConfirmed', false);
|
||||
$set('production_order', null);
|
||||
|
||||
|
||||
if (! $pId) {
|
||||
@@ -248,18 +247,15 @@ class PanelBoxValidationResource extends Resource
|
||||
$set('pqLineError', null);
|
||||
}
|
||||
|
||||
|
||||
if(!empty($get('production_order'))){
|
||||
$pOrder = $get('production_order');
|
||||
if (! $pOrder) {
|
||||
$set('prodOrdError', "Production Order can't be empty.");
|
||||
$set('production_order', null);
|
||||
$set('part_validation_type', null);
|
||||
$set('show_validation_image', false);
|
||||
$set('validation1_image_url', null);
|
||||
} else {
|
||||
$set('prodOrdError', null);
|
||||
}
|
||||
$pOrder = $get('production_order');
|
||||
if (! $pOrder) {
|
||||
$set('prodOrdError', "Production Order can't be empty.");
|
||||
$set('production_order', null);
|
||||
$set('part_validation_type', null);
|
||||
$set('show_validation_image', false);
|
||||
$set('validation1_image_url', null);
|
||||
} else {
|
||||
$set('prodOrdError', null);
|
||||
}
|
||||
|
||||
$serialFields = [
|
||||
@@ -341,106 +337,106 @@ class PanelBoxValidationResource extends Resource
|
||||
}
|
||||
}
|
||||
|
||||
if(!empty($pOrder)){
|
||||
$existInMasterPo = PanelGrMaster::where('document_number', $pOrder)->where('plant_id', $plantId)->first();
|
||||
$existInMasterPo = PanelGrMaster::where('document_number', $pOrder)->where('plant_id', $plantId)->first();
|
||||
|
||||
if(!$existInMasterPo){
|
||||
if($existInMasterPo){
|
||||
|
||||
$serialPart = substr($sNumber, -10);
|
||||
|
||||
$serialNumber = substr($serialPart, 0, 4) . '/'
|
||||
. substr($serialPart, 4, 6);
|
||||
|
||||
$iId = Item::where('code', $iCode)->where('plant_id', $plantId)->first();
|
||||
|
||||
if(!$iId){
|
||||
Notification::make()
|
||||
->title('Document No Not Found')
|
||||
->body("No Panel GR record found for Production Order (Or) Doc No'{$pOrder}' and for Item '{$iCode}'.")
|
||||
->title('Item not found')
|
||||
->body("Item code'{$iCode}' not found against plant code '{$plaCode}' in item master.")
|
||||
->danger()
|
||||
->send();
|
||||
$set('item_id', null);
|
||||
return;
|
||||
}
|
||||
|
||||
if($existInMasterPo){
|
||||
$existInMaster = PanelGrMaster::where('document_number', $pOrder)->where('item_id', $iId->id)->where('plant_id', $plantId)->first();
|
||||
|
||||
$serialPart = substr($sNumber, -10);
|
||||
|
||||
$serialNumber = substr($serialPart, 0, 4) . '/'
|
||||
. substr($serialPart, 4, 6);
|
||||
|
||||
$iId = Item::where('code', $iCode)->where('plant_id', $plantId)->first();
|
||||
|
||||
if(!$iId){
|
||||
Notification::make()
|
||||
->title('Item not found')
|
||||
->body("Item code'{$iCode}' not found against plant code '{$plaCode}' in item master.")
|
||||
->danger()
|
||||
->send();
|
||||
$set('item_id', null);
|
||||
return;
|
||||
}
|
||||
|
||||
$existInMaster = PanelGrMaster::where('document_number', $pOrder)->where('item_id', $iId->id)->where('plant_id', $plantId)->first();
|
||||
|
||||
if(!$existInMaster){
|
||||
Notification::make()
|
||||
->title('Panel GR Record Not Found')
|
||||
->body("No Panel GR record found for Production Order (Or) Doc No'{$pOrder}' and for Item '{$iCode}'.")
|
||||
->danger()
|
||||
->send();
|
||||
$set('item_id', null);
|
||||
return;
|
||||
}
|
||||
else if($existInMaster->supplier_number == '' || $existInMaster->supplier_number == null){
|
||||
Notification::make()
|
||||
->title('Panel GR Found')
|
||||
->body("Supplier Number cannot be empty Panel GR record found for Production Order '{$pOrder}' and Item '{$iCode}'.")
|
||||
->danger()
|
||||
->send();
|
||||
$set('item_id', null);
|
||||
return;
|
||||
}
|
||||
else if($existInMaster->quantity == '' || $existInMaster->quantity == null){
|
||||
Notification::make()
|
||||
->title('Panel GR Found')
|
||||
->body("Quantity cannot be empty Panel GR record found for Production Order '{$pOrder}' and Item '{$iCode}'.")
|
||||
->danger()
|
||||
->send();
|
||||
$set('item_id', null);
|
||||
return;
|
||||
}
|
||||
else if($existInMaster->invoice_number == '' || $existInMaster->invoice_number == null){
|
||||
Notification::make()
|
||||
->title('Panel GR Found')
|
||||
->body("Invoice Number cannot be empty Panel GR record found for Production Order '{$pOrder}' and Item '{$iCode}'.")
|
||||
->danger()
|
||||
->send();
|
||||
$set('item_id', null);
|
||||
return;
|
||||
}
|
||||
|
||||
$sticker = StickerMaster::where('plant_id', $plantId)->where('item_id', $iId->id)->first();
|
||||
|
||||
if(!$sticker){
|
||||
Notification::make()
|
||||
->title('Unknown Item Code')
|
||||
->body("Item code not found '{$iId->code}' in sticker master.")
|
||||
->danger()
|
||||
->send();
|
||||
$set('item_id', null);
|
||||
}
|
||||
|
||||
$existQuanInPanel = PanelBoxValidation::where('plant_id', $plantId)->where('production_order', $pOrder)->where('sticker_master_id', $sticker->id)->count();
|
||||
|
||||
if ($existQuanInPanel >= (int) $existInMaster->quantity) {
|
||||
Notification::make()
|
||||
->title('Quantity Completed')
|
||||
->body("Panel box quantity '{$existQuanInPanel}' exceeds the available quantity '{$existInMaster->quantity}' in Panel GR Master for Production Order '{$pOrder}' and Item '{$iCode}'.")
|
||||
->danger()
|
||||
->send();
|
||||
$set('item_id', null);
|
||||
return;
|
||||
}
|
||||
|
||||
$set('item_id', $iCode);
|
||||
$set('serial_number', $serialNumber);
|
||||
$set('validationError', null);
|
||||
if(!$existInMaster){
|
||||
Notification::make()
|
||||
->title('Panel GR Record Not Found')
|
||||
->body("No Panel GR record found for Production Order (Or) Doc No'{$pOrder}' and for Item '{$iCode}'.")
|
||||
->danger()
|
||||
->send();
|
||||
$set('item_id', null);
|
||||
return;
|
||||
}
|
||||
else if($existInMaster->supplier_number == '' || $existInMaster->supplier_number == null){
|
||||
Notification::make()
|
||||
->title('Panel GR Found')
|
||||
->body("Supplier Number cannot be empty Panel GR record found for Production Order '{$pOrder}' and Item '{$iCode}'.")
|
||||
->danger()
|
||||
->send();
|
||||
$set('item_id', null);
|
||||
return;
|
||||
}
|
||||
else if($existInMaster->quantity == '' || $existInMaster->quantity == null){
|
||||
Notification::make()
|
||||
->title('Panel GR Found')
|
||||
->body("Quantity cannot be empty Panel GR record found for Production Order '{$pOrder}' and Item '{$iCode}'.")
|
||||
->danger()
|
||||
->send();
|
||||
$set('item_id', null);
|
||||
return;
|
||||
}
|
||||
else if($existInMaster->invoice_number == '' || $existInMaster->invoice_number == null){
|
||||
Notification::make()
|
||||
->title('Panel GR Found')
|
||||
->body("Invoice Number cannot be empty Panel GR record found for Production Order '{$pOrder}' and Item '{$iCode}'.")
|
||||
->danger()
|
||||
->send();
|
||||
$set('item_id', null);
|
||||
return;
|
||||
}
|
||||
|
||||
$sticker = StickerMaster::where('plant_id', $plantId)->where('item_id', $iId->id)->first();
|
||||
|
||||
if(!$sticker){
|
||||
Notification::make()
|
||||
->title('Unknown Item Code')
|
||||
->body("Item code not found '{$iId->code}' in sticker master.")
|
||||
->danger()
|
||||
->send();
|
||||
$set('item_id', null);
|
||||
}
|
||||
|
||||
$existQuanInPanel = PanelBoxValidation::where('plant_id', $plantId)->where('production_order', $pOrder)->where('sticker_master_id', $sticker->id)->count();
|
||||
|
||||
if ($existQuanInPanel >= (int) $existInMaster->quantity) {
|
||||
Notification::make()
|
||||
->title('Quantity Completed')
|
||||
->body("Panel box quantity '{$existQuanInPanel}' exceeds the available quantity '{$existInMaster->quantity}' in Panel GR Master for Production Order '{$pOrder}' and Item '{$iCode}'.")
|
||||
->danger()
|
||||
->send();
|
||||
$set('item_id', null);
|
||||
return;
|
||||
}
|
||||
|
||||
$set('item_id', $iCode);
|
||||
$set('serial_number', $serialNumber);
|
||||
$set('validationError', null);
|
||||
}
|
||||
else{
|
||||
$existInMasterProdOrder = ProductionOrder::where('production_order', $pOrder)->where('plant_id', $plantId)->first();
|
||||
|
||||
if(!$existInMasterProdOrder && !$existInMasterPo){
|
||||
Notification::make()
|
||||
->title('Production Order Not Found')
|
||||
->body("Production Order (Or) Doc No'{$pOrder}' not found against plant code '{$plaCode}' in both production order and Panel Gr master.")
|
||||
->danger()
|
||||
->send();
|
||||
$set('item_id', null);
|
||||
$set('serial_exists', false);
|
||||
return;
|
||||
}
|
||||
|
||||
$itemCode = $iCode;
|
||||
|
||||
@@ -451,8 +447,6 @@ class PanelBoxValidationResource extends Resource
|
||||
$serialNumber = substr($serialPart, 0, 4) . '/'
|
||||
. substr($serialPart, 4, 6);
|
||||
|
||||
$serialNumberForDb = str_replace('/', '', $sNumber);
|
||||
|
||||
$iId = Item::where('code', $itemCode)->where('plant_id', $plantId)->first();
|
||||
|
||||
if(!$iId){
|
||||
@@ -479,58 +473,6 @@ class PanelBoxValidationResource extends Resource
|
||||
return;
|
||||
}
|
||||
|
||||
$existInMasterProdOrder = ProductionOrder::where('plant_id', $plantId)
|
||||
->where('from_serial_number', '<=', $serialNumberForDb)
|
||||
->where('to_serial_number', '>=', $serialNumberForDb)
|
||||
->first();
|
||||
|
||||
if(!$existInMasterProdOrder){
|
||||
Notification::make()
|
||||
->title('Production Order Not Found')
|
||||
->body("Production Order not found against plant code '{$plaCode}' and serial number '$serialNumberForDb' in production order")
|
||||
->danger()
|
||||
->send();
|
||||
$set('production_order', null);
|
||||
$set('item_id', null);
|
||||
$set('serial_exists', false);
|
||||
return;
|
||||
}
|
||||
|
||||
$panelExistsPanelBoxSupplier = PanelBoxValidation::where('plant_id', $plantId)
|
||||
->where('panel_box_serial_number', $serialNumber)
|
||||
->where('panel_box_supplier', $supplier)
|
||||
->first();
|
||||
|
||||
if($panelExistsPanelBoxSupplier){
|
||||
Notification::make()
|
||||
->title('Duplicate Panel Box Serial Number')
|
||||
->body("Duplicate panel already exists.<br>Panel Box Code: $itemCode, Serial Number: $serialNumber, Supplier Number: $supplier in panel box validations")
|
||||
->danger()
|
||||
->seconds(4)
|
||||
->send();
|
||||
|
||||
$set('item_id', null);
|
||||
$set('serial_exists', false);
|
||||
}
|
||||
|
||||
$panelExistsPanelBox = PanelBoxValidation::where('plant_id', $plantId)
|
||||
->where('panel_box_serial_number', $serialNumber)
|
||||
->where('panel_box_supplier', $supplier)
|
||||
->where('panel_box_code', $itemCode)
|
||||
->first();
|
||||
|
||||
if($panelExistsPanelBox){
|
||||
Notification::make()
|
||||
->title('Duplicate Panel Box Serial Number')
|
||||
->body("Duplicate panel already exists.<br>Panel Box Code: $itemCode, Serial Number: $serialNumber, Supplier Number: $supplier in panel box validations")
|
||||
->danger()
|
||||
->seconds(4)
|
||||
->send();
|
||||
|
||||
$set('item_id', null);
|
||||
$set('serial_exists', false);
|
||||
}
|
||||
|
||||
$panelExistsInvoice = InvoiceValidation::where('plant_id', $plantId)
|
||||
->where('panel_box_serial_number', $serialNumber)
|
||||
->where('panel_box_supplier', $supplier)
|
||||
@@ -550,6 +492,19 @@ class PanelBoxValidationResource extends Resource
|
||||
return;
|
||||
}
|
||||
|
||||
// $plantCode = Plant::where('id', $plantId)->value('code');
|
||||
|
||||
// if($plantCode != $supplier){
|
||||
// Notification::make()
|
||||
// ->title('Supplier Mismatch')
|
||||
// ->body("Supplier code '$supplier' mismatch with selected plant code '$plantCode'.")
|
||||
// ->danger()
|
||||
// ->send();
|
||||
// $set('item_id', null);
|
||||
// $set('serial_exists', false);
|
||||
// return;
|
||||
// }
|
||||
|
||||
if ($existInMasterProdOrder->item_id != $iId->id) {
|
||||
$itemCodePOrd = Item::where('id', $existInMasterProdOrder->item_id)->value('code');
|
||||
|
||||
@@ -573,6 +528,20 @@ class PanelBoxValidationResource extends Resource
|
||||
$set('serial_exists', false);
|
||||
return;
|
||||
}
|
||||
|
||||
$existQuanInPanel = PanelBoxValidation::where('plant_id', $plantId)->where('production_order', $pOrder)->where('sticker_master_id', $sticker->id)->count();
|
||||
|
||||
if ($existQuanInPanel >= (int) $existInMasterProdOrder->quantity) {
|
||||
Notification::make()
|
||||
->title('Quantity Completed')
|
||||
->body("Panel box quantity '{$existQuanInPanel}' exceeds the available quantity '{$existInMasterProdOrder->quantity}' for Production Order '{$pOrder}' and Item '{$itemCode}' in production order table.")
|
||||
->danger()
|
||||
->send();
|
||||
$set('item_id', null);
|
||||
$set('serial_exists', false);
|
||||
return;
|
||||
}
|
||||
|
||||
if ($existInMasterProdOrder) {
|
||||
|
||||
$fromSerial = $existInMasterProdOrder->from_serial_number;
|
||||
@@ -592,22 +561,6 @@ class PanelBoxValidationResource extends Resource
|
||||
}
|
||||
}
|
||||
|
||||
$pOrder = $existInMasterProdOrder->production_order;
|
||||
$set('production_order', $pOrder);
|
||||
|
||||
$existQuanInPanel = PanelBoxValidation::where('plant_id', $plantId)->where('production_order', $pOrder)->where('sticker_master_id', $sticker->id)->count();
|
||||
|
||||
if ($existQuanInPanel >= (int) $existInMasterProdOrder->quantity) {
|
||||
Notification::make()
|
||||
->title('Quantity Completed')
|
||||
->body("Panel box quantity '{$existQuanInPanel}' exceeds the available quantity '{$existInMasterProdOrder->quantity}' for Production Order '{$pOrder}' and Item '{$itemCode}' in production order table.")
|
||||
->danger()
|
||||
->send();
|
||||
$set('item_id', null);
|
||||
$set('serial_exists', false);
|
||||
return;
|
||||
}
|
||||
|
||||
$set('item_id', $iCode);
|
||||
$set('serial_number', $serialNumber);
|
||||
$set('panel_box_supplier', $supplier);
|
||||
@@ -633,8 +586,6 @@ class PanelBoxValidationResource extends Resource
|
||||
return;
|
||||
}
|
||||
|
||||
$pOrder = $get('production_order');
|
||||
|
||||
$supplier = $parts[0];
|
||||
$panelBoxCode = $parts[1];
|
||||
$panelBoxSerialNo = implode('/', array_slice($parts, 2));
|
||||
@@ -659,6 +610,17 @@ class PanelBoxValidationResource extends Resource
|
||||
|
||||
$existInMasterPo = PanelGrMaster::where('document_number', $pOrder)->where('plant_id', $plantId)->first();
|
||||
|
||||
// if(!$existInMasterPo){
|
||||
// Notification::make()
|
||||
// ->title('Panel GR Record')
|
||||
// ->body("Production Order (Or) Doc No'{$pOrder}' not found against plant code '{$plaCode}' in Panel Gr master.")
|
||||
// ->danger()
|
||||
// ->send();
|
||||
// $set('item_id', null);
|
||||
// $set('serial_exists', false);
|
||||
// return;
|
||||
// }
|
||||
|
||||
if($existInMasterPo){
|
||||
|
||||
$iId = Item::where('code', $itemCode)->where('plant_id', $plantId)->first();
|
||||
@@ -706,25 +668,6 @@ class PanelBoxValidationResource extends Resource
|
||||
return;
|
||||
}
|
||||
|
||||
$panelExistsPanel = PanelBoxValidation::where('plant_id', $plantId)
|
||||
->where('panel_box_serial_number', $serialNumber)
|
||||
->where('panel_box_supplier', $supplier)
|
||||
->first();
|
||||
|
||||
if ($panelExistsPanel) {
|
||||
Notification::make()
|
||||
->title('Duplicate Panel Box Serial Number')
|
||||
->body("Duplicate panel already exists.<br>Panel Box Code: $itemCode, Serial Number: $serialNumber, Supplier Number: $supplier in panel box validation")
|
||||
->danger()
|
||||
->seconds(4)
|
||||
->send();
|
||||
|
||||
$set('item_id', null);
|
||||
$set('serial_exists', false);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$existInMaster = PanelGrMaster::where('document_number', $pOrder)->where('inspection_lot_number', $inspecLotNo)->where('item_id', $iId->id)->where('plant_id', $plantId)->first();
|
||||
|
||||
if(!$existInMaster){
|
||||
@@ -845,25 +788,6 @@ class PanelBoxValidationResource extends Resource
|
||||
return;
|
||||
}
|
||||
|
||||
$panelExists = PanelBoxValidation::where('plant_id', $plantId)
|
||||
->where('panel_box_serial_number', $serialNumber)
|
||||
->where('panel_box_supplier', $supplier)
|
||||
->first();
|
||||
|
||||
if ($panelExists) {
|
||||
Notification::make()
|
||||
->title('Duplicate Panel Box Serial Number')
|
||||
->body("Duplicate panel already exists.<br>Panel Box Code: $itemCode, Serial Number: $serialNumber, Supplier Number: $supplier in panel box validation")
|
||||
->danger()
|
||||
->seconds(4)
|
||||
->send();
|
||||
|
||||
$set('item_id', null);
|
||||
$set('serial_exists', false);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$panelExistsInvoice = InvoiceValidation::where('plant_id', $plantId)
|
||||
->where('panel_box_serial_number', $serialNumber)
|
||||
->where('panel_box_supplier', $supplier)
|
||||
@@ -1083,7 +1007,7 @@ class PanelBoxValidationResource extends Resource
|
||||
if($serialExistsPanel){
|
||||
Notification::make()
|
||||
->title('Panel Box Already Validated')
|
||||
->body("Serial number '$serialNumber' for supplier '$supplier' has already been tested and marked as 'Ok'")
|
||||
->body("Serial number '$serialNumber' for supplier '$supplier' has already been tested and marked as 'OK'")
|
||||
->success()
|
||||
->send();
|
||||
$set('item_id', null);
|
||||
|
||||
Reference in New Issue
Block a user