1
0
forked from poc/pds

Updated validations and success durations and added serial_number maximum length should be 20 digit and clear field if invalid input

This commit is contained in:
dhanabalan
2025-07-11 18:23:52 +05:30
parent 9fa4c0dd49
commit 27524c4d62
11 changed files with 360 additions and 291 deletions

View File

@@ -128,7 +128,7 @@ class LocatorValidation extends Page implements HasForms
$operatorName = Filament::auth()->user()->name;
if ($serialNo && $scanLocator )
if ($serialNo && $scanLocator)
{
return;
}
@@ -146,8 +146,8 @@ class LocatorValidation extends Page implements HasForms
([
'plant_id' => $plantId,
'scan_serial_no' => null,
'scan_pallet_no' => $palletNo,
'scan_locator_no' => $scanLocator,
'scan_pallet_no' => null,
'scan_locator_no' => null,
'pallet_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
@@ -167,8 +167,8 @@ class LocatorValidation extends Page implements HasForms
([
'plant_id' => $plantId,
'scan_serial_no' => null,
'scan_pallet_no' => $palletNo,
'scan_locator_no' => $scanLocator,
'scan_pallet_no' => null,
'scan_locator_no' => null,
'pallet_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
@@ -191,8 +191,8 @@ class LocatorValidation extends Page implements HasForms
([
'plant_id' => $plantId,
'scan_serial_no' => null,
'scan_pallet_no' => $palletNo,
'scan_locator_no' => $scanLocator,
'scan_pallet_no' => null,
'scan_locator_no' => null,
'pallet_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
@@ -269,14 +269,14 @@ class LocatorValidation extends Page implements HasForms
->danger()
->duration(1200)
->send();
$this->dispatch('loadLocator' ,'',$plantId);
$this->dispatch('loadLocator' ,'',$plantId);
$this->form->fill
([
'plant_id' => $plantId,
'scan_serial_no' => null,
'scan_pallet_no' => $palletNo,
'scan_locator_no' => $scanLocator,
'scan_pallet_no' => null,
'scan_locator_no' => null,
'pallet_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
@@ -334,7 +334,11 @@ class LocatorValidation extends Page implements HasForms
$operatorName = Filament::auth()->user()->name;
if ($palletNo && $scanLocator )
if ($palletNo && $scanLocator)
{
return;
}
else if ($palletNo)
{
return;
}
@@ -351,19 +355,19 @@ class LocatorValidation extends Page implements HasForms
$this->form->fill
([
'plant_id' => $plantId,
'scan_serial_no' => $serialNo,
'scan_serial_no' => null,
'scan_pallet_no' => null,
'scan_locator_no' => $scanLocator,
'scan_locator_no' => null,
'pallet_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
]);
return;
}
else if (strlen($serialNo) < 9)
else if (strlen($serialNo) < 9 || strlen($serialNo) > 20)
{
Notification::make()
->title("Serial number '$serialNo' must be at least 9 digits.")
->title("Serial number should contain minimum 9 digits and maximum 20 digits.")
->danger()
->duration(1200)
->send();
@@ -372,9 +376,9 @@ class LocatorValidation extends Page implements HasForms
$this->form->fill
([
'plant_id' => $plantId,
'scan_serial_no' => $serialNo,
'scan_serial_no' => null,
'scan_pallet_no' => null,
'scan_locator_no' => $scanLocator,
'scan_locator_no' => null,
'pallet_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
@@ -388,13 +392,14 @@ class LocatorValidation extends Page implements HasForms
->danger()
->duration(1200)
->send();
$this->dispatch('loadLocator' ,'',$plantId);
$this->form->fill
([
'plant_id' => $plantId,
'scan_serial_no' => $serialNo,
'scan_serial_no' => null,
'scan_pallet_no' => null,
'scan_locator_no' => $scanLocator,
'scan_locator_no' => null,
'pallet_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
@@ -412,22 +417,23 @@ class LocatorValidation extends Page implements HasForms
if ($invoicesnoexists)
{
Notification::make()
->title("Serial number '$serialNo' already exists in invoice number '$invoiceNo' and completed the scanning process.")
->title("Serial number '$serialNo' already exists in invoice number '$invoiceNo' and completed the scanning process..!")
->danger()
->duration(1200)
->send();
$this->dispatch('loadLocator' ,'',$plantId);
$this->form->fill
([
'plant_id' => $plantId,
'scan_serial_no' => $serialNo,
'scan_pallet_no' => null,
'scan_locator_no' => $scanLocator,
'pallet_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
]);
return;
$this->dispatch('loadLocator' ,'',$plantId);
$this->form->fill
([
'plant_id' => $plantId,
'scan_serial_no' => null,
'scan_pallet_no' => null,
'scan_locator_no' => null,
'pallet_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
]);
return;
}
$existingRecord = PalletValidation::where('plant_id', $plantId)
@@ -464,9 +470,9 @@ class LocatorValidation extends Page implements HasForms
$this->form->fill
([
'plant_id' => $plantId,
'scan_serial_no' => $serialNo,
'scan_serial_no' => null,
'scan_pallet_no' => null,
'scan_locator_no' => $scanLocator,
'scan_locator_no' => null,
'pallet_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
@@ -532,9 +538,12 @@ class LocatorValidation extends Page implements HasForms
$operatorName = Filament::auth()->user()->name;
$this->locators = PalletValidation::where('plant_id', $plantId)
->where('locator_number', '11111')
->get();
$this->locators = PalletValidation::where('plant_id', $plantId)->where('locator_number', '11111')->get();
if (!$palletNo && !$serialNo)
{
return;
}
if ($scanLocator == null || $scanLocator == '')
{
@@ -550,7 +559,7 @@ class LocatorValidation extends Page implements HasForms
'plant_id' => $plantId,
'scan_serial_no' => $serialNo,
'scan_pallet_no' => $palletNo,
'scan_locator_no' => $scanLocator,
'scan_locator_no' => null,
'pallet_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
@@ -571,7 +580,7 @@ class LocatorValidation extends Page implements HasForms
'plant_id' => $plantId,
'scan_serial_no' => $serialNo,
'scan_pallet_no' => $palletNo,
'scan_locator_no' => $scanLocator,
'scan_locator_no' => null,
'pallet_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
@@ -603,7 +612,7 @@ class LocatorValidation extends Page implements HasForms
'plant_id' => $plantId,
'scan_serial_no' => $serialNo,
'scan_pallet_no' => $palletNo,
'scan_locator_no' => $scanLocator,
'scan_locator_no' => null,
'pallet_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
@@ -631,7 +640,7 @@ class LocatorValidation extends Page implements HasForms
'plant_id' => $plantId,
'scan_serial_no' => $serialNo,
'scan_pallet_no' => $palletNo,
'scan_locator_no' => $scanLocator,
'scan_locator_no' => null,
'pallet_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
@@ -658,8 +667,8 @@ class LocatorValidation extends Page implements HasForms
([
'plant_id' => $plantId,
'scan_serial_no' => null,
'scan_pallet_no' => $palletNo,
'scan_locator_no' => $scanLocator,
'scan_pallet_no' => null,
'scan_locator_no' => null,
'pallet_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
@@ -687,8 +696,8 @@ class LocatorValidation extends Page implements HasForms
([
'plant_id' => $plantId,
'scan_serial_no' => null,
'scan_pallet_no' => $palletNo,
'scan_locator_no' => $scanLocator,
'scan_pallet_no' => null,
'scan_locator_no' => null,
'pallet_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
@@ -714,7 +723,7 @@ class LocatorValidation extends Page implements HasForms
'plant_id' => $plantId,
'scan_serial_no' => null,
'scan_pallet_no' => $palletNo,
'scan_locator_no' => $scanLocator,
'scan_locator_no' => null,
'pallet_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
@@ -762,10 +771,10 @@ class LocatorValidation extends Page implements HasForms
]);
return;
}
else if (strlen($serialNo) < 9)
else if (strlen($serialNo) < 9 || strlen($serialNo) > 20)
{
Notification::make()
->title("Serial number '$serialNo' must be at least 9 digits.")
->title("Serial number should contain minimum 9 digits and maximum 20 digits.")
->danger()
->duration(1200)
->send();
@@ -774,9 +783,9 @@ class LocatorValidation extends Page implements HasForms
$this->form->fill
([
'plant_id' => $plantId,
'scan_serial_no' => $serialNo,
'scan_serial_no' => null,
'scan_pallet_no' => null,
'scan_locator_no' => $scanLocator,
'scan_locator_no' => null,
'pallet_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
@@ -795,9 +804,9 @@ class LocatorValidation extends Page implements HasForms
$this->form->fill
([
'plant_id' => $plantId,
'scan_serial_no' => $serialNo,
'scan_serial_no' => null,
'scan_pallet_no' => null,
'scan_locator_no' => $scanLocator,
'scan_locator_no' => null,
'pallet_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
@@ -815,7 +824,7 @@ class LocatorValidation extends Page implements HasForms
if ($invoicesnoexists)
{
Notification::make()
->title("Serial number '$serialNo' already exists in invoice number '$invoiceNo' and completed the scanning process.")
->title("Serial number '$serialNo' already exists in invoice number '$invoiceNo' and completed the scanning process..!")
->danger()
->duration(1200)
->send();
@@ -824,14 +833,13 @@ class LocatorValidation extends Page implements HasForms
$this->form->fill
([
'plant_id' => $plantId,
'scan_serial_no' => $serialNo,
'scan_serial_no' => null,
'scan_pallet_no' => null,
'scan_locator_no' => $scanLocator,
'scan_locator_no' => null,
'pallet_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
]);
return;
}
@@ -851,15 +859,38 @@ class LocatorValidation extends Page implements HasForms
$this->form->fill
([
'plant_id' => $plantId,
'scan_serial_no' => $serialNo,
'scan_serial_no' => null,
'scan_pallet_no' => null,
'scan_locator_no' => $scanLocator,
'scan_locator_no' => null,
'pallet_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
]);
return;
}
else if ($serialExist && $serialExist->pallet_number && $serialExist->pallet_number != null && $serialExist->pallet_number != '')
{
Notification::make()
->title("Serial number '$serialNo' already exists in pallet number '{$serialExist->pallet_number}'.")
->danger()
->duration(1200)
->send();
$this->dispatch('loadLocator' ,'',$plantId);
$this->form->fill
([
'plant_id' => $plantId,
'scan_serial_no' => null,
'scan_pallet_no' => null,
'scan_locator_no' => null,
'pallet_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
]);
return;
}
//heretocontinue
if ($serialExist && $serialExist->locator_number == $scanLocator)
{
@@ -918,6 +949,11 @@ class LocatorValidation extends Page implements HasForms
$operatorName = Filament::auth()->user()->name;
if (!$palletNo && !$serialNo)
{
return;
}
if ($scanLocator == null || $scanLocator == '') {
Notification::make()
->title("Locator number can't be empty!")
@@ -931,7 +967,7 @@ class LocatorValidation extends Page implements HasForms
'plant_id' => $plantId,
'scan_serial_no' => $serialNo,
'scan_pallet_no' => $palletNo,
'scan_locator_no' => $scanLocator,
'scan_locator_no' => null,
'pallet_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
@@ -978,7 +1014,7 @@ class LocatorValidation extends Page implements HasForms
'plant_id' => $plantId,
'scan_serial_no' => $serialNo,
'scan_pallet_no' => $palletNo,
'scan_locator_no' => $scanLocator,
'scan_locator_no' => null,
'pallet_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
@@ -1003,7 +1039,7 @@ class LocatorValidation extends Page implements HasForms
'plant_id' => $plantId,
'scan_serial_no' => $serialNo,
'scan_pallet_no' => $palletNo,
'scan_locator_no' => $scanLocator,
'scan_locator_no' => null,
'pallet_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
@@ -1026,8 +1062,8 @@ class LocatorValidation extends Page implements HasForms
([
'plant_id' => $plantId,
'scan_serial_no' => null,
'scan_pallet_no' => $palletNo,
'scan_locator_no' => $scanLocator,
'scan_pallet_no' => null,
'scan_locator_no' => null,
'pallet_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
@@ -1050,8 +1086,8 @@ class LocatorValidation extends Page implements HasForms
([
'plant_id' => $plantId,
'scan_serial_no' => null,
'scan_pallet_no' => $palletNo,
'scan_locator_no' => $scanLocator,
'scan_pallet_no' => null,
'scan_locator_no' => null,
'pallet_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
@@ -1079,8 +1115,8 @@ class LocatorValidation extends Page implements HasForms
([
'plant_id' => $plantId,
'scan_serial_no' => null,
'scan_pallet_no' => $palletNo,
'scan_locator_no' => $scanLocator,
'scan_pallet_no' => null,
'scan_locator_no' => null,
'pallet_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
@@ -1107,8 +1143,8 @@ class LocatorValidation extends Page implements HasForms
$this->form->fill([
'plant_id' => $plantId,
'scan_serial_no' => null,
'scan_pallet_no' => $palletNo,
'scan_locator_no' => $scanLocator,
'scan_pallet_no' => null,
'scan_locator_no' => null,
'pallet_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
@@ -1131,7 +1167,7 @@ class LocatorValidation extends Page implements HasForms
Notification::make()
->title("Scanned pallet number '$palletNo' added into locator number '$scanLocator' successfully.")
->success()
->duration(1000)
->duration(500)
->send();
$locator = Locator::where('locator_number', $scanLocator)
@@ -1170,13 +1206,14 @@ class LocatorValidation extends Page implements HasForms
->danger()
->duration(1200)
->send();
$this->dispatch('loadLocator' ,'',$plantId);
$this->form->fill
([
'plant_id' => $plantId,
'scan_serial_no' => null,
'scan_pallet_no' => $palletNo,
'scan_locator_no' => $scanLocator,
'scan_pallet_no' => null,
'scan_locator_no' => null,
'pallet_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
@@ -1186,7 +1223,6 @@ class LocatorValidation extends Page implements HasForms
}
else
{
if ($serialNo == '' || $serialNo == null) {
Notification::make()
->title("Serial number is required to add when pallet number is empty.")
@@ -1198,19 +1234,19 @@ class LocatorValidation extends Page implements HasForms
$this->form->fill
([
'plant_id' => $plantId,
'scan_serial_no' => $serialNo,
'scan_serial_no' => null,
'scan_pallet_no' => null,
'scan_locator_no' => $scanLocator,
'scan_locator_no' => null,
'pallet_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
]);
return;
}
else if (strlen($serialNo) < 9)
else if (strlen($serialNo) < 9 || strlen($serialNo) > 20)
{
Notification::make()
->title("Serial number '$serialNo' must be at least 9 digits.")
->title("Serial number should contain minimum 9 digits and maximum 20 digits.")
->danger()
->duration(1200)
->send();
@@ -1219,9 +1255,9 @@ class LocatorValidation extends Page implements HasForms
$this->form->fill
([
'plant_id' => $plantId,
'scan_serial_no' => $serialNo,
'scan_serial_no' => null,
'scan_pallet_no' => null,
'scan_locator_no' => $scanLocator,
'scan_locator_no' => null,
'pallet_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
@@ -1240,9 +1276,9 @@ class LocatorValidation extends Page implements HasForms
$this->form->fill
([
'plant_id' => $plantId,
'scan_serial_no' => $serialNo,
'scan_serial_no' => null,
'scan_pallet_no' => null,
'scan_locator_no' => $scanLocator,
'scan_locator_no' => null,
'pallet_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
@@ -1251,16 +1287,16 @@ class LocatorValidation extends Page implements HasForms
}
$invoicesnoexists = LocatorInvoiceValidation::where('plant_id', $plantId)
->where('serial_number', $serialNo)
->where('scanned_status', '=','Scanned')
->first();
->where('serial_number', $serialNo)
->where('scanned_status', '=','Scanned')
->first();
$invoiceNo = $invoicesnoexists?->invoice_number;
if ($invoicesnoexists)
{
Notification::make()
->title("Serial number '$serialNo' already exists in invoice number '$invoiceNo' and completed the scanning process.")
->title("Serial number '$serialNo' already exists in invoice number '$invoiceNo' and completed the scanning process..!")
->danger()
->duration(1200)
->send();
@@ -1269,9 +1305,9 @@ class LocatorValidation extends Page implements HasForms
$this->form->fill
([
'plant_id' => $plantId,
'scan_serial_no' => $serialNo,
'scan_serial_no' => null,
'scan_pallet_no' => null,
'scan_locator_no' => $scanLocator,
'scan_locator_no' => null,
'pallet_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
@@ -1280,10 +1316,10 @@ class LocatorValidation extends Page implements HasForms
}
$palletexists = PalletValidation::where('plant_id', $plantId)
->where('serial_number', $serialNo)
->where('pallet_number', '!=', '')
->where('pallet_number', '!=', null)
->first();
->where('serial_number', $serialNo)
->where('pallet_number', '!=', '')
->where('pallet_number', '!=', null)
->first();
if($palletexists)
{
@@ -1297,9 +1333,9 @@ class LocatorValidation extends Page implements HasForms
$this->form->fill
([
'plant_id' => $plantId,
'scan_serial_no' => $serialNo,
'scan_serial_no' => null,
'scan_pallet_no' => null,
'scan_locator_no' => $scanLocator,
'scan_locator_no' => null,
'pallet_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
@@ -1325,9 +1361,9 @@ class LocatorValidation extends Page implements HasForms
$this->form->fill
([
'plant_id' => $plantId,
'scan_serial_no' => $serialNo,
'scan_serial_no' => null,
'scan_pallet_no' => null,
'scan_locator_no' => $scanLocator,
'scan_locator_no' => null,
'pallet_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
@@ -1360,7 +1396,7 @@ class LocatorValidation extends Page implements HasForms
Notification::make()
->title("Scanned serial number '$serialNo' added into locator number '$scanLocator' successfully.")
->success()
->duration(1000)
->duration(500)
->send();
// $count = PalletValidation::where('plant_id', $plantId)
@@ -1406,6 +1442,11 @@ class LocatorValidation extends Page implements HasForms
$operatorName = Filament::auth()->user()->name;
if (!$palletNo && !$serialNo)
{
return;
}
if ($scanLocator == null || $scanLocator == '') {
Notification::make()
->title("Locator number can't be empty!")
@@ -1419,7 +1460,7 @@ class LocatorValidation extends Page implements HasForms
'plant_id' => $plantId,
'scan_serial_no' => $serialNo,
'scan_pallet_no' => $palletNo,
'scan_locator_no' => $scanLocator,
'scan_locator_no' => null,
'pallet_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
@@ -1440,7 +1481,7 @@ class LocatorValidation extends Page implements HasForms
'plant_id' => $plantId,
'scan_serial_no' => $serialNo,
'scan_pallet_no' => $palletNo,
'scan_locator_no' => $scanLocator,
'scan_locator_no' => null,
'pallet_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
@@ -1466,7 +1507,7 @@ class LocatorValidation extends Page implements HasForms
'plant_id' => $plantId,
'scan_serial_no' => $serialNo,
'scan_pallet_no' => $palletNo,
'scan_locator_no' => $scanLocator,
'scan_locator_no' => null,
'pallet_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
@@ -1489,8 +1530,8 @@ class LocatorValidation extends Page implements HasForms
([
'plant_id' => $plantId,
'scan_serial_no' => null,
'scan_pallet_no' => $palletNo,
'scan_locator_no' => $scanLocator,
'scan_pallet_no' => null,
'scan_locator_no' => null,
'pallet_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
@@ -1499,7 +1540,6 @@ class LocatorValidation extends Page implements HasForms
}
$Palletexists = PalletValidation::where('pallet_number', $palletNo)->where('plant_id', $plantId)->first();
if(!$Palletexists)
{
Notification::make()
@@ -1513,8 +1553,8 @@ class LocatorValidation extends Page implements HasForms
([
'plant_id' => $plantId,
'scan_serial_no' => null,
'scan_pallet_no' => $palletNo,
'scan_locator_no' => $scanLocator,
'scan_pallet_no' => null,
'scan_locator_no' => null,
'pallet_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
@@ -1542,8 +1582,8 @@ class LocatorValidation extends Page implements HasForms
([
'plant_id' => $plantId,
'scan_serial_no' => null,
'scan_pallet_no' => $palletNo,
'scan_locator_no' => $scanLocator,
'scan_pallet_no' => null,
'scan_locator_no' => null,
'pallet_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
@@ -1571,7 +1611,7 @@ class LocatorValidation extends Page implements HasForms
'plant_id' => $plantId,
'scan_serial_no' => null,
'scan_pallet_no' => $palletNo,
'scan_locator_no' => $scanLocator,
'scan_locator_no' => null,
'pallet_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
@@ -1665,7 +1705,7 @@ class LocatorValidation extends Page implements HasForms
Notification::make()
->title("Scanned pallet number '{$palletNo}' removed from locator number '$scanLocator' successfully.")
->success()
->duration(1000)
->duration(500)
->send();
$this->dispatch('loadLocator' ,$scanLocator,$plantId);
@@ -1704,7 +1744,6 @@ class LocatorValidation extends Page implements HasForms
}
else
{
if ($serialNo == '' || $serialNo == null)
{
Notification::make()
@@ -1717,19 +1756,19 @@ class LocatorValidation extends Page implements HasForms
$this->form->fill
([
'plant_id' => $plantId,
'scan_serial_no' => $serialNo,
'scan_serial_no' => null,
'scan_pallet_no' => null,
'scan_locator_no' => $scanLocator,
'scan_locator_no' => null,
'pallet_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
]);
return;
}
else if (strlen($serialNo) < 9)
else if (strlen($serialNo) < 9 || strlen($serialNo) > 20)
{
Notification::make()
->title("Serial number '$serialNo' must be at least 9 digits.")
->title("Serial number should contain minimum 9 digits and maximum 20 digits.")
->danger()
->duration(1200)
->send();
@@ -1738,9 +1777,9 @@ class LocatorValidation extends Page implements HasForms
$this->form->fill
([
'plant_id' => $plantId,
'scan_serial_no' => $serialNo,
'scan_serial_no' => null,
'scan_pallet_no' => null,
'scan_locator_no' => $scanLocator,
'scan_locator_no' => null,
'pallet_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
@@ -1759,9 +1798,9 @@ class LocatorValidation extends Page implements HasForms
$this->form->fill
([
'plant_id' => $plantId,
'scan_serial_no' => $serialNo,
'scan_serial_no' => null,
'scan_pallet_no' => null,
'scan_locator_no' => $scanLocator,
'scan_locator_no' => null,
'pallet_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
@@ -1775,11 +1814,10 @@ class LocatorValidation extends Page implements HasForms
->first();
$invoiceNo = $invoicesnoexists?->invoice_number;
if ($invoicesnoexists)
{
Notification::make()
->title("Serial number '$serialNo' already exists in invoice number '$invoiceNo' and completed the scanning process.")
->title("Serial number '$serialNo' already exists in invoice number '$invoiceNo' and completed the scanning process..!")
->danger()
->duration(1200)
->send();
@@ -1788,9 +1826,9 @@ class LocatorValidation extends Page implements HasForms
$this->form->fill
([
'plant_id' => $plantId,
'scan_serial_no' => $serialNo,
'scan_serial_no' => null,
'scan_pallet_no' => null,
'scan_locator_no' => $scanLocator,
'scan_locator_no' => null,
'pallet_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
@@ -1804,7 +1842,7 @@ class LocatorValidation extends Page implements HasForms
if (!$exists) {
Notification::make()
->title("Serial number '{$serialNo}' does not exist in the pallet table to remove.")
->title("Serial number '{$serialNo}' doesn't exist in the pallet table to remove.<br>Add serial number to proceed...")
->danger()
->duration(1200)
->send();
@@ -1840,9 +1878,9 @@ class LocatorValidation extends Page implements HasForms
$this->form->fill
([
'plant_id' => $plantId,
'scan_serial_no' => $serialNo,
'scan_serial_no' => null,
'scan_pallet_no' => null,
'scan_locator_no' => $scanLocator,
'scan_locator_no' => null,
'pallet_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
@@ -1869,7 +1907,7 @@ class LocatorValidation extends Page implements HasForms
'plant_id' => $plantId,
'scan_serial_no' => $serialNo,
'scan_pallet_no' => null,
'scan_locator_no' => $scanLocator,
'scan_locator_no' => null,
'pallet_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,
@@ -1890,7 +1928,7 @@ class LocatorValidation extends Page implements HasForms
Notification::make()
->title("Scanned serial number '{$serialNo}' removed from locator number '$scanLocator' successfully.")
->success()
->duration(1000)
->duration(500)
->send();
$this->dispatch('loadLocator', $scanLocator, $plantId);
@@ -1907,7 +1945,7 @@ class LocatorValidation extends Page implements HasForms
else
{
Notification::make()
->title("No matching record found for serial number '{$serialNo}'.")
->title("Serial number failed to remove from locator number '$scanLocator'.")
->danger()
->duration(1200)
->send();
@@ -1916,9 +1954,9 @@ class LocatorValidation extends Page implements HasForms
$this->form->fill
([
'plant_id' => $plantId,
'scan_serial_no' => $serialNo,
'scan_serial_no' => null,
'scan_pallet_no' => null,
'scan_locator_no' => $scanLocator,
'scan_locator_no' => null,
'pallet_quantity' => 0,
'created_by' => $operatorName,
'scanned_by' => $operatorName,