1
0
forked from poc/pds

Added serial_number minimum length should be 9 digit and notification display duration and updated validations

This commit is contained in:
dhanabalan
2025-07-09 19:35:39 +05:30
parent eb2b857aa7
commit 4ac1823e5b
2 changed files with 234 additions and 41 deletions

View File

@@ -54,7 +54,9 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
->title("Invalid: Invoice Number")
->body("Invoice number can't be empty!")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', '', '', $plantId, $reworkType);
// $snoCount = LocatorInvoiceValidation::where('plant_id', $plantId)->where('invoice_number', $invoiceNo)->count();
$this->form->fill([
@@ -81,6 +83,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
->title('Invoice Not Found')
->body("Invoice number '$invoiceNo' doesn't exist in invoice table!<br><br>Scan the valid exist 'Invoice Number' to proceed..!")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', '', '', $plantId, $reworkType);
@@ -126,7 +129,9 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
->title("Invalid: Pallet Number")
->body("Pallet number '$palletNo' must be at least 10 digits.")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', $invoiceNo, '', $plantId, $reworkType);
$this->form->fill([
'plant_id' => $plantId,
@@ -143,13 +148,40 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
]);
return;
}
else if (strlen($serialNo) > 0 && strlen($serialNo) < 13)
else if (strlen($serialNo) > 0 && strlen($serialNo) < 9)
{
Notification::make()
->title("Invalid: Serial Number")
->body("Serial number '$serialNo' must be at least 13 digits.")
->body("Serial number '$serialNo' must be at least 9 digits.")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', $invoiceNo, '', $plantId, $reworkType);
$this->form->fill([
'plant_id' => $plantId,
'plant' => $plantId,
'invoice_number' => $invoiceNo,
'scan_pallet_no' => null,
'scan_serial_no' => null,
'rework_type' => $reworkType,
'reworkType' => $reworkType,
'update_invoice' => 0,
'update_pallet' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
]);
return;
}
else if (strlen($serialNo) > 0 && !ctype_alnum($serialNo))
{
Notification::make()
->title("Invalid: Serial Number")
->body("Serial number '$serialNo' must contain alpha-numeric values only.")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', $invoiceNo, '', $plantId, $reworkType);
$this->form->fill([
'plant_id' => $plantId,
@@ -196,6 +228,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
->title('Completed: Rework Invoice')
->body("Scanned invoice number '$invoiceNo' successfully moved into rework invoice table.<br><br>Please, scan the next completed invoice number to proceed..!")
->success()
->duration(800)
->send();
$this->dispatch('loadData', '', '', $plantId, $reworkType);
@@ -219,6 +252,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
->title('Completed: Invoice Found')
->body("Press 'Yes' and Press 'Enter' in Scan Invoice No to do rework for entire invoice.<br><br>Press 'No' to do rework against 'Pallet or Serial Number'..!")
->info()
->duration(1200)
->send();
$this->dispatch('loadData', $invoiceNo, '', $plantId, $reworkType);
@@ -244,6 +278,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
->title('Invoice Not Completed')
->body("Scanned invoice number '$invoiceNo' doesn't completed the scanning process!<br><br>Has '$notCompletedCount' pending serial number to scan!<br><br>Please, scan the valid completed invoice number to proceed..!")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', '', '', $plantId, $reworkType);
@@ -269,15 +304,18 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
->title("Choosed: Pallet Rework Type")
->body("Scan valid pallet number to proceed..!")
->danger()
->duration(1200)
->send();
return;
return;
}
else
{
Notification::make()
->title("Rework Type Not Found")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', '', '', $plantId, $reworkType);
$this->form->fill([
'plant_id' => $plantId,
@@ -331,7 +369,9 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
->title("Invalid: Invoice Number")
->body("Invoice number can't be empty!")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', '', '', $plantId, $reworkType);
// $snoCount = LocatorInvoiceValidation::where('plant_id', $plantId)->where('invoice_number', $invoiceNo)->count();
$this->form->fill([
@@ -358,6 +398,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
->title('Invoice Not Found')
->body("Invoice number '$invoiceNo' doesn't exist in invoice table!<br><br>Scan the valid exist 'Invoice Number' to proceed..!")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', '', '', $plantId, $reworkType);
@@ -403,7 +444,9 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
->title("Invalid: Pallet Number")
->body("Pallet number can't be empty!")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', $invoiceNo, '', $plantId, $reworkType);
// $snoCount = LocatorInvoiceValidation::where('plant_id', $plantId)->where('invoice_number', $invoiceNo)->count();
$this->form->fill([
@@ -427,7 +470,9 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
->title("Invalid: Pallet Number")
->body("Pallet number '$palletNo' must be at least 10 digits.")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', $invoiceNo, '', $plantId, $reworkType);
$this->form->fill([
'plant_id' => $plantId,
@@ -453,6 +498,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
->title('Pallet Not Found')
->body("Pallet number '$palletNo' doesn't exist in scanned invoice number '$invoiceNo'!<br><br>Scan the valid exist 'Pallet Number' to proceed..!")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', $invoiceNo, '', $plantId, $reworkType);
@@ -472,13 +518,40 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
return;
}
if (strlen($serialNo) > 0 && strlen($serialNo) < 13)
if (strlen($serialNo) > 0 && strlen($serialNo) < 9)
{
Notification::make()
->title("Invalid: Serial Number")
->body("Serial number '$serialNo' must be at least 13 digits.")
->body("Serial number '$serialNo' must be at least 9 digits.")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', $invoiceNo, $palletNo, $plantId, $reworkType);
$this->form->fill([
'plant_id' => $plantId,
'plant' => $plantId,
'invoice_number' => $invoiceNo,
'scan_pallet_no' => $palletNo,
'scan_serial_no' => null,
'rework_type' => $reworkType,
'reworkType' => $reworkType,
'update_invoice' => 0,
'update_pallet' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
]);
return;
}
else if (strlen($serialNo) > 0 && !ctype_alnum($serialNo))
{
Notification::make()
->title("Invalid: Serial Number")
->body("Serial number '$serialNo' must contain alpha-numeric values only.")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', $invoiceNo, $palletNo, $plantId, $reworkType);
$this->form->fill([
'plant_id' => $plantId,
@@ -526,6 +599,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
->title('Completed: Rework Pallet from Invoice')
->body("Scanned pallet number '$palletNo' successfully moved into rework invoice table from invoice number '$invoiceNo'.<br><br>Please, scan the next pallet number to proceed..!")
->success()
->duration(800)
->send();
$InvoiceSerialNumbers = LocatorInvoiceValidation::where('plant_id', $plantId)->where('invoice_number', $invoiceNo)->first();
@@ -535,6 +609,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
Notification::make()
->title("All available serial numbers are successfully moved into rework invoice table from invoice number '$invoiceNo'.<br><br>Please, scan the next invoice number to proceed..!")
->success()
->duration(1000)
->send();
$this->dispatch('loadData', '', '', $plantId, $reworkType);
@@ -576,6 +651,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
->title('Invoice Not Completed')
->body("Scanned invoice number '$invoiceNo' doesn't completed the scanning process!<br><br>Has '$notCompletedCount' pending serial number to scan!<br><br>Please, scan the valid completed invoice number to proceed..!")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', '', '', $plantId, $reworkType);
@@ -603,7 +679,9 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
->title("Invalid: Pallet Number")
->body("Pallet number can't be empty!")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', '', '', $plantId, $reworkType);
// $snoCount = LocatorInvoiceValidation::where('plant_id', $plantId)->where('invoice_number', $invoiceNo)->count();
$this->form->fill([
@@ -627,7 +705,9 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
->title("Invalid: Pallet Number")
->body("Pallet number '$palletNo' must be at least 10 digits.")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', '', '', $plantId, $reworkType);
$this->form->fill([
'plant_id' => $plantId,
@@ -653,6 +733,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
->title('Pallet Not Found')
->body("Pallet number '$palletNo' doesn't exist in pallet table!<br><br>Scan the valid exist 'Pallet Number' to proceed..!")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', '', '', $plantId, $reworkType);
@@ -692,6 +773,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
->title('Locator Pallet Found')
->body("Scanned pallet number '$palletNo' exist in locator number '$locatExist'.<br><br>Remove scanned 'Pallet' from 'Locator' to proceed re-master packing..!")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', '', '', $plantId, $reworkType);
@@ -712,13 +794,40 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
}
else
{
if (strlen($serialNo) > 0 && strlen($serialNo) < 13)
if (strlen($serialNo) > 0 && strlen($serialNo) < 9)
{
Notification::make()
->title("Invalid: Serial Number")
->body("Serial number '$serialNo' must be at least 13 digits.")
->body("Serial number '$serialNo' must be at least 9 digits.")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', '', $palletNo, $plantId, $reworkType);
$this->form->fill([
'plant_id' => $plantId,
'plant' => $plantId,
'invoice_number' => null,
'scan_pallet_no' => $palletNo,
'scan_serial_no' => null,
'rework_type' => $reworkType,
'reworkType' => $reworkType,
'update_invoice' => 0,
'update_pallet' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
]);
return;
}
else if (strlen($serialNo) > 0 && !ctype_alnum($serialNo))
{
Notification::make()
->title("Invalid: Serial Number")
->body("Serial number '$serialNo' must contain alpha-numeric values only.")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', '', $palletNo, $plantId, $reworkType);
$this->form->fill([
'plant_id' => $plantId,
@@ -747,6 +856,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
->title('Completed: Rework Pallet')
->body("Scanned pallet number '$palletNo' successfully removed from pallet table.<br><br>Please, scan the next pallet number to re-master packing..!")
->success()
->duration(800)
->send();
$this->dispatch('loadData', '', '', $plantId, $reworkType);
@@ -771,6 +881,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
->title('Completed: Pallet Found')
->body("Press 'Yes' and Press 'Enter' in Scan Pallet No to do re-master packing for entire pallet.<br><br>Press 'No' to do partial re-master packing against 'Serial Number'..!")
->info()
->duration(1200)
->send();
$this->dispatch('loadData', '', $palletNo, $plantId, $reworkType);
@@ -797,6 +908,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
->title('Pallet Not Completed')
->body("Scanned pallet number '$palletNo' doesn't completed the master packing!<br><br>Please, scan the valid completed pallet number to proceed..!")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', '', '', $plantId, $reworkType);
@@ -821,7 +933,9 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
Notification::make()
->title("Rework Type Not Found")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', '', '', $plantId, $reworkType);
$this->form->fill([
'plant_id' => $plantId,
@@ -875,7 +989,9 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
->title("Invalid: Invoice Number")
->body("Invoice number can't be empty!")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', '', '', $plantId, $reworkType);
// $snoCount = LocatorInvoiceValidation::where('plant_id', $plantId)->where('invoice_number', $invoiceNo)->count();
$this->form->fill([
@@ -902,6 +1018,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
->title('Invoice Not Found')
->body("Invoice number '$invoiceNo' doesn't exist in invoice table!<br><br>Scan the valid exist 'Invoice Number' to proceed..!")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', '', '', $plantId, $reworkType);
@@ -947,7 +1064,9 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
->title("Invalid: Pallet Number")
->body("Pallet number '$palletNo' must be at least 10 digits.")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', $invoiceNo, '', $plantId, $reworkType);
$this->form->fill([
'plant_id' => $plantId,
@@ -970,7 +1089,9 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
->title("Invalid: Serial Number")
->body("Serial number can't be empty!")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', $invoiceNo, '', $plantId, $reworkType);
// $snoCount = LocatorInvoiceValidation::where('plant_id', $plantId)->where('invoice_number', $invoiceNo)->count();
$this->form->fill([
@@ -988,13 +1109,40 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
]);
return;
}
else if (strlen($serialNo) < 13)
else if (strlen($serialNo) < 9)
{
Notification::make()
->title("Invalid: Serial Number")
->body("Serial number '$serialNo' must be at least 13 digits.")
->body("Serial number '$serialNo' must be at least 9 digits.")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', $invoiceNo, '', $plantId, $reworkType);
$this->form->fill([
'plant_id' => $plantId,
'plant' => $plantId,
'invoice_number' => $invoiceNo,
'scan_pallet_no' => null,
'scan_serial_no' => null,
'rework_type' => $reworkType,
'reworkType' => $reworkType,
'update_invoice' => 0,
'update_pallet' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
]);
return;
}
else if (!ctype_alnum($serialNo))
{
Notification::make()
->title("Invalid: Serial Number")
->body("Serial number '$serialNo' must contain alpha-numeric values only.")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', $invoiceNo, '', $plantId, $reworkType);
$this->form->fill([
'plant_id' => $plantId,
@@ -1020,6 +1168,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
->title('Serial Not Found')
->body("Serial number '$serialNo' doesn't exist in scanned invoice number '$invoiceNo'!<br><br>Scan the valid exist 'Serial Number' to proceed..!")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', $invoiceNo, '', $plantId, $reworkType);
@@ -1069,6 +1218,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
->title('Completed: Rework Serial from Invoice')
->body("Scanned serial number '$serialNo' successfully moved into rework invoice table from invoice number '$invoiceNo'.<br><br>Please, scan the next serial number to proceed..!")
->success()
->duration(800)
->send();
$InvoiceSerialNumbers = LocatorInvoiceValidation::where('plant_id', $plantId)->where('invoice_number', $invoiceNo)->first();
@@ -1078,6 +1228,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
Notification::make()
->title("All available serial numbers are successfully moved into rework invoice table from invoice number '$invoiceNo'.<br><br>Please, scan the next invoice number to proceed..!")
->success()
->duration(1000)
->send();
$this->dispatch('loadData', '', '', $plantId, $reworkType);
@@ -1119,6 +1270,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
->title('Invoice Not Completed')
->body("Scanned invoice number '$invoiceNo' doesn't completed the scanning process!<br><br>Has '$notCompletedCount' pending serial number to scan!<br><br>Please, scan the valid completed invoice number to proceed..!")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', '', '', $plantId, $reworkType);
@@ -1146,7 +1298,9 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
->title("Invalid: Pallet Number")
->body("Pallet number can't be empty!")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', '', '', $plantId, $reworkType);
// $snoCount = LocatorInvoiceValidation::where('plant_id', $plantId)->where('invoice_number', $invoiceNo)->count();
$this->form->fill([
@@ -1170,7 +1324,9 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
->title("Invalid: Pallet Number")
->body("Pallet number '$palletNo' must be at least 10 digits.")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', '', '', $plantId, $reworkType);
$this->form->fill([
'plant_id' => $plantId,
@@ -1196,6 +1352,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
->title('Pallet Not Found')
->body("Pallet number '$palletNo' doesn't exist in pallet table!<br><br>Scan the valid exist 'Pallet Number' to proceed..!")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', '', '', $plantId, $reworkType);
@@ -1235,6 +1392,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
->title('Locator Pallet Found')
->body("Scanned pallet number '$palletNo' exist in locator number '$locatExist'.<br><br>Remove scanned 'Pallet' from 'Locator' to proceed re-master packing..!")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', '' , '', $plantId, $reworkType);
@@ -1261,7 +1419,9 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
->title("Invalid: Serial Number")
->body("Serial number can't be empty!")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', '', $palletNo, $plantId, $reworkType);
// $snoCount = LocatorInvoiceValidation::where('plant_id', $plantId)->where('invoice_number', $invoiceNo)->count();
$this->form->fill([
@@ -1279,13 +1439,40 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
]);
return;
}
else if (strlen($serialNo) < 13)
else if (strlen($serialNo) < 9)
{
Notification::make()
->title("Invalid: Serial Number")
->body("Serial number '$serialNo' must be at least 13 digits.")
->title("Invalid: Serial Number")
->body("Serial number '$serialNo' must be at least 9 digits.")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', '', $palletNo, $plantId, $reworkType);
$this->form->fill([
'plant_id' => $plantId,
'plant' => $plantId,
'invoice_number' => null,
'scan_pallet_no' => $palletNo,
'scan_serial_no' => null,
'rework_type' => $reworkType,
'reworkType' => $reworkType,
'update_invoice' => 0,
'update_pallet' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
]);
return;
}
else if (!ctype_alnum($serialNo))
{
Notification::make()
->title("Invalid: Serial Number")
->body("Serial number '$serialNo' must contain alpha-numeric values only.")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', '', $palletNo, $plantId, $reworkType);
$this->form->fill([
'plant_id' => $plantId,
@@ -1311,6 +1498,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
->title('Serial Not Found')
->body("Serial number '$serialNo' doesn't exist in pallet number '$palletNo'!<br><br>Scan the valid exist 'Serial Number' to proceed..!")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', '', $palletNo, $plantId, $reworkType);
@@ -1347,6 +1535,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
->title('Completed: Rework Serial from Pallet')
->body("Scanned serial number '$serialNo' successfully removed from pallet number '$palletNo'.<br><br>Please, scan the next pallet number to re-master packing..!")
->success()
->duration(800)
->send();
$PalletSerialNumbers = PalletValidation::where('plant_id', $plantId)->where('pallet_number', $palletNo)->first();
@@ -1356,6 +1545,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
Notification::make()
->title("Pallet number '$palletNo' successfully re-master packed.<br><br>Please, scan the next pallet number to re-master packing..!")
->success()
->duration(1000)
->send();
$this->dispatch('loadData', '', '', $plantId, $reworkType);
@@ -1398,6 +1588,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
->title('Pallet Not Completed')
->body("Pallet number '$palletNo' doesn't completed the master packing for scanned serial number '$serialNo'!<br><br>Please, scan the valid completed pallet number to proceed..!")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', '' , '', $plantId, $reworkType);
@@ -1422,7 +1613,9 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord
Notification::make()
->title("Rework Type Not Found")
->danger()
->duration(1200)
->send();
$this->dispatch('loadData', '', '', $plantId, $reworkType);
$this->form->fill([
'plant_id' => $plantId,