diff --git a/app/Filament/Imports/LocatorInvoiceValidationImporter.php b/app/Filament/Imports/LocatorInvoiceValidationImporter.php index 7b701c9..5817365 100644 --- a/app/Filament/Imports/LocatorInvoiceValidationImporter.php +++ b/app/Filament/Imports/LocatorInvoiceValidationImporter.php @@ -129,7 +129,7 @@ class LocatorInvoiceValidationImporter extends Importer if (Str::length($invoiceNo) < 5 || !ctype_alnum($invoiceNo)) { $warnMsg[] = "Invalid invoice number found"; } - if (Str::length($serialNo) < 9 || !ctype_alnum($serialNo)) { + if (Str::length($serialNo) < 9 || Str::length($serialNo) > 20 || !ctype_alnum($serialNo)) { $warnMsg[] = "Invalid serial number found"; } if (Str::length($palletNo) > 0 && Str::length($palletNo) < 10) { diff --git a/app/Filament/Imports/PalletValidationImporter.php b/app/Filament/Imports/PalletValidationImporter.php index 1b400f6..d961e64 100644 --- a/app/Filament/Imports/PalletValidationImporter.php +++ b/app/Filament/Imports/PalletValidationImporter.php @@ -122,7 +122,7 @@ class PalletValidationImporter extends Importer } else { - if (Str::length($serialNo) < 9 || !ctype_alnum($serialNo)) { + if (Str::length($serialNo) < 9 || Str::length($serialNo) > 20 || !ctype_alnum($serialNo)) { $warnMsg[] = "Invalid serial number found"; } if (Str::length($palletNo) > 0 && Str::length($palletNo) < 10) { diff --git a/app/Filament/Imports/ReworkLocatorInvoiceValidationImporter.php b/app/Filament/Imports/ReworkLocatorInvoiceValidationImporter.php index b365952..730c225 100644 --- a/app/Filament/Imports/ReworkLocatorInvoiceValidationImporter.php +++ b/app/Filament/Imports/ReworkLocatorInvoiceValidationImporter.php @@ -148,7 +148,7 @@ class ReworkLocatorInvoiceValidationImporter extends Importer if (Str::length($invoiceNo) < 5 || !ctype_alnum($invoiceNo)) { $warnMsg[] = "Invalid invoice number found"; } - if (Str::length($serialNo) < 9 || !ctype_alnum($serialNo)) { + if (Str::length($serialNo) < 9 || Str::length($serialNo) > 20 || !ctype_alnum($serialNo)) { $warnMsg[] = "Invalid serial number found"; } if (Str::length($palletNo) > 0 && Str::length($palletNo) < 10) { diff --git a/app/Filament/Pages/LocatorValidation.php b/app/Filament/Pages/LocatorValidation.php index 203939d..0f7064c 100644 --- a/app/Filament/Pages/LocatorValidation.php +++ b/app/Filament/Pages/LocatorValidation.php @@ -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.
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, diff --git a/app/Filament/Pages/PalletFromLocator.php b/app/Filament/Pages/PalletFromLocator.php index 391006c..abb3edb 100644 --- a/app/Filament/Pages/PalletFromLocator.php +++ b/app/Filament/Pages/PalletFromLocator.php @@ -3,6 +3,7 @@ namespace App\Filament\Pages; use App\Models\Locator; +use App\Models\LocatorInvoiceValidation; use App\Models\PalletValidation; use App\Models\Plant; use Filament\Facades\Filament; @@ -399,7 +400,7 @@ class PalletFromLocator extends Page implements HasForms ->title('Add: Locator Serial Number') ->body("Scanned locator serial number '$serialNo' successfully added into 'PALLET DATA' table.") ->success() - ->duration(1000) + ->duration(500) ->send(); $this->dispatch('loadData', $this->records, $plantId); @@ -422,7 +423,7 @@ class PalletFromLocator extends Page implements HasForms ->title('Remove: Locator Serial Number') ->body("Scanned locator serial number '$removeserial' removed successfully from 'PALLET DATA' table.") ->success() - ->duration(1000) + ->duration(500) ->send(); $this->dispatch('loadData', $this->records, $plantId); @@ -461,7 +462,7 @@ class PalletFromLocator extends Page implements HasForms ->title('Add: Locator Serial Numbers') ->body("Scanned locator number '$locatorNo' has '$serialLocator' locator serial numbers!
Successfully added into 'PALLET DATA' table.") ->success() - ->duration(1000) + ->duration(500) ->send(); $this->dispatch('loadData', $this->records, $plantId); @@ -567,11 +568,11 @@ class PalletFromLocator extends Page implements HasForms ]); return; } - else if (strlen($serialNo) < 9) + else if (strlen($serialNo) < 9 || strlen($serialNo) > 20) { Notification::make() ->title('Invalid: Serial Number') - ->body("Serial number '$serialNo' must be at least 9 digits.") + ->body("Serial number should contain minimum 9 digits and maximum 20 digits.") ->danger() ->duration(1200) ->send(); @@ -619,23 +620,53 @@ class PalletFromLocator extends Page implements HasForms if ($serialLocator == '' || $serialLocator == null) { - Notification::make() - ->title('Unknown: Serial Number') - ->body("Scanned serial number: '$serialNo' doesn't exist in pallet table.
Scan the valid exist locator-serial number to proceed..!") - ->danger() - ->duration(1200) - ->send(); + $invoicesnoexists = LocatorInvoiceValidation::where('plant_id', $plantId) + ->where('serial_number', $serialNo) + ->where('scanned_status', '=','Scanned') + ->first(); - $this->dispatch('loadData', $this->records, $plantId); - $this->form->fill([ - 'plant_id' => $plantId, - 'plant' => $plantId, - 'scan_locator_number' => null, - 'scan_serial_number' => null, - 'scan_remove_sno' => null, - 'sno_quantity' => null, - ]); - return; + $invoiceNo = $invoicesnoexists?->invoice_number; + + if ($invoicesnoexists) + { + Notification::make() + ->title('Invalid: Serial Number') + ->body("Serial number '$serialNo' already exists in invoice number '$invoiceNo' and completed the scanning process..!") + ->danger() + ->duration(1200) + ->send(); + + $this->dispatch('loadData', $this->records, $plantId); + $this->form->fill([ + 'plant_id' => $plantId, + 'plant' => $plantId, + 'scan_locator_number' => null, + 'scan_serial_number' => null, + 'scan_remove_sno' => null, + 'sno_quantity' => $count, + ]); + return; + } + else + { + Notification::make() + ->title('Unknown: Serial Number') + ->body("Scanned serial number: '$serialNo' doesn't exist in pallet table.
Scan the valid exist locator-serial number to proceed..!") + ->danger() + ->duration(1200) + ->send(); + + $this->dispatch('loadData', $this->records, $plantId); + $this->form->fill([ + 'plant_id' => $plantId, + 'plant' => $plantId, + 'scan_locator_number' => null, + 'scan_serial_number' => null, + 'scan_remove_sno' => null, + 'sno_quantity' => $count, + ]); + return; + } } elseif ($serialLocator->pallet_number != '' && $serialLocator->pallet_number != null) { @@ -653,7 +684,7 @@ class PalletFromLocator extends Page implements HasForms 'scan_locator_number' => null, 'scan_serial_number' => null, 'scan_remove_sno' => null, - 'sno_quantity' => null, + 'sno_quantity' => $count, ]); return; } @@ -770,16 +801,16 @@ class PalletFromLocator extends Page implements HasForms ->title('Success: Pallet Generated') ->body("Pallet number '$newPalletNumber' completed the master packing successfully!") ->success() - ->duration(1000) + ->duration(600) ->send(); $this->dispatch('loadData', $this->records, $plantId); $this->form->fill([ 'plant_id' => $plantId, 'plant' => $plantId, - 'scan_locator_number' => $locatorNo, - 'scan_serial_number' => $serialNo, - 'scan_remove_sno' => $removeSerial, + 'scan_locator_number' => null, + 'scan_serial_number' => null, + 'scan_remove_sno' => null, 'sno_quantity' => 0, ]); return; @@ -798,9 +829,9 @@ class PalletFromLocator extends Page implements HasForms $this->form->fill([ 'plant_id' => $plantId, 'plant' => $plantId, - 'scan_locator_number' => $locatorNo, - 'scan_serial_number' => $serialNo, - 'scan_remove_sno' => $removeSerial, + 'scan_locator_number' => null, + 'scan_serial_number' => null, + 'scan_remove_sno' => null, 'sno_quantity' => 0, ]); return; @@ -905,11 +936,11 @@ class PalletFromLocator extends Page implements HasForms ]); return; } - else if (strlen($removeSno) < 9) + else if (strlen($removeSno) < 9 || strlen($removeSno) > 20) { Notification::make() ->title('Invalid: Serial Number') - ->body("Serial number '$removeSno' must be at least 9 digits.") + ->body("Serial number should contain minimum 9 digits and maximum 20 digits.") ->danger() ->duration(1200) ->send(); diff --git a/app/Filament/Pages/UploadSerialLocator.php b/app/Filament/Pages/UploadSerialLocator.php index add0fd9..812f016 100644 --- a/app/Filament/Pages/UploadSerialLocator.php +++ b/app/Filament/Pages/UploadSerialLocator.php @@ -234,7 +234,7 @@ class UploadSerialLocator extends Page implements HasForms if ($serialNumber) { $excelSerials[] = $serialNumber; - if (strlen($serialNumber) < 9) { + if (strlen($serialNumber) < 9 || strlen($serialNumber) > 20) { $invalidSerial[] = $serialNumber; } elseif (!ctype_alnum($serialNumber)) { $invalidSerial[] = $serialNumber; @@ -253,7 +253,7 @@ class UploadSerialLocator extends Page implements HasForms if (count($uniqueInvalidSerial) > 0) { Notification::make() ->title('Invalid Serial Numbers Found') - ->body('The following serial numbers are invalid, length should contain minimum of 9 digits alpha numeric values:
' . implode(', ', $uniqueInvalidSerial)) + ->body('The following serial numbers are invalid, length should contain minimum of 9 digits (and maximum 20 digits) alpha numeric values:
' . implode(', ', $uniqueInvalidSerial)) ->danger() ->duration(1200) ->send(); @@ -607,7 +607,6 @@ class UploadSerialLocator extends Page implements HasForms } } - Storage::delete($fullPath); if ($insertedCount > 0) { @@ -910,8 +909,8 @@ class UploadSerialLocator extends Page implements HasForms $this->form->fill ([ 'plant_id' => $plantId, - 'scan_serial_number' => $scanSno, - 'scan_locator' => $scanLocator, + 'scan_serial_number' => null, + 'scan_locator' => null, 'upload_serial_locator' => null, ]); return; @@ -929,16 +928,16 @@ class UploadSerialLocator extends Page implements HasForms $this->form->fill ([ 'plant_id' => $plantId, - 'scan_serial_number' => $scanSno, + 'scan_serial_number' => null, 'scan_locator' => $scanLocator, 'upload_serial_locator' => null, ]); return; } - else if (strlen($scanSno) < 9) + else if (strlen($scanSno) < 9 || strlen($scanSno) > 20) { Notification::make() - ->title("Serial number '$scanSno' must be at least 9 digits.") + ->title("Serial number should contain minimum 9 digits and maximum 20 digits.") ->danger() ->duration(1200) ->send(); @@ -947,7 +946,7 @@ class UploadSerialLocator extends Page implements HasForms $this->form->fill ([ 'plant_id' => $plantId, - 'scan_serial_number' => $scanSno, + 'scan_serial_number' => null, 'scan_locator' => $scanLocator, 'upload_serial_locator' => null, ]); @@ -965,7 +964,7 @@ class UploadSerialLocator extends Page implements HasForms $this->form->fill ([ 'plant_id' => $plantId, - 'scan_serial_number' => $scanSno, + 'scan_serial_number' => null, 'scan_locator' => $scanLocator, 'upload_serial_locator' => null, ]); @@ -985,7 +984,7 @@ class UploadSerialLocator extends Page implements HasForms ([ 'plant_id' => $plantId, 'scan_serial_number' => $scanSno, - 'scan_locator' => $scanLocator, + 'scan_locator' => null, 'upload_serial_locator' => null, ]); return; @@ -1002,7 +1001,7 @@ class UploadSerialLocator extends Page implements HasForms ([ 'plant_id' => $plantId, 'scan_serial_number' => $scanSno, - 'scan_locator' => $scanLocator, + 'scan_locator' => null, 'upload_serial_locator' => null, ]); return; @@ -1025,7 +1024,7 @@ class UploadSerialLocator extends Page implements HasForms ([ 'plant_id' => $plantId, 'scan_serial_number' => $scanSno, - 'scan_locator' => $scanLocator, + 'scan_locator' => null, 'upload_serial_locator' => null, ]); return; @@ -1044,7 +1043,7 @@ class UploadSerialLocator extends Page implements HasForms ([ 'plant_id' => $plantId, 'scan_serial_number' => $scanSno, - 'scan_locator' => $scanLocator, + 'scan_locator' => null, 'upload_serial_locator' => null, ]); return; @@ -1070,7 +1069,7 @@ class UploadSerialLocator extends Page implements HasForms $this->form->fill ([ 'plant_id' => $plantId, - 'scan_serial_number' => $scanSno, + 'scan_serial_number' => null, 'scan_locator' => $scanLocator, 'upload_serial_locator' => null, ]); @@ -1088,7 +1087,7 @@ class UploadSerialLocator extends Page implements HasForms $this->form->fill ([ 'plant_id' => $plantId, - 'scan_serial_number' => $scanSno, + 'scan_serial_number' => null, 'scan_locator' => $scanLocator, 'upload_serial_locator' => null, ]); @@ -1106,7 +1105,7 @@ class UploadSerialLocator extends Page implements HasForms $this->form->fill ([ 'plant_id' => $plantId, - 'scan_serial_number' => $scanSno, + 'scan_serial_number' => null, 'scan_locator' => $scanLocator, 'upload_serial_locator' => null, ]); @@ -1134,7 +1133,7 @@ class UploadSerialLocator extends Page implements HasForms $this->form->fill ([ 'plant_id' => $plantId, - 'scan_serial_number' => $scanSno, + 'scan_serial_number' => null, 'scan_locator' => $scanLocator, 'upload_serial_locator' => null, ]); @@ -1142,6 +1141,7 @@ class UploadSerialLocator extends Page implements HasForms } } } + $locatorQuantity = Locator::where('plant_id',$plantId)->where('locator_number', $scanLocator)->first(); $userName = Filament::auth()->user()->name; @@ -1170,8 +1170,8 @@ class UploadSerialLocator extends Page implements HasForms $this->form->fill ([ 'plant_id' => $plantId, - 'scan_serial_number' => $scanSno, - 'scan_locator' => $scanLocator, + 'scan_serial_number' => null, + 'scan_locator' => null, 'upload_serial_locator' => null, ]); } @@ -1196,8 +1196,6 @@ class UploadSerialLocator extends Page implements HasForms $this->dispatch('loadData', $scanLocator, $scanSno, $plantId); } - - public function viewLocator() { $plantId = $this->filters['plant_id'] ?? null; @@ -1243,9 +1241,9 @@ class UploadSerialLocator extends Page implements HasForms } else if ($scanSno && $scanLocator) { - if (strlen($scanSno) < 9) { + if (strlen($scanSno) < 9 || strlen($scanSno) > 20) { Notification::make() - ->title("Serial number '$scanSno' must be at least 9 digits.") + ->title("Serial number should contain minimum 9 digits and maximum 20 digits.") ->danger() ->duration(1200) ->send(); @@ -1254,7 +1252,7 @@ class UploadSerialLocator extends Page implements HasForms $this->form->fill ([ 'plant_id' => $plantId, - 'scan_serial_number' => $scanSno, + 'scan_serial_number' => null, 'scan_locator' => $scanLocator, 'upload_serial_locator' => null, ]); @@ -1272,7 +1270,7 @@ class UploadSerialLocator extends Page implements HasForms $this->form->fill ([ 'plant_id' => $plantId, - 'scan_serial_number' => $scanSno, + 'scan_serial_number' => null, 'scan_locator' => $scanLocator, 'upload_serial_locator' => null, ]); @@ -1291,7 +1289,7 @@ class UploadSerialLocator extends Page implements HasForms ([ 'plant_id' => $plantId, 'scan_serial_number' => $scanSno, - 'scan_locator' => $scanLocator, + 'scan_locator' => null, 'upload_serial_locator' => null, ]); return; @@ -1313,7 +1311,7 @@ class UploadSerialLocator extends Page implements HasForms ([ 'plant_id' => $plantId, 'scan_serial_number' => $scanSno, - 'scan_locator' => $scanLocator, + 'scan_locator' => null, 'upload_serial_locator' => null, ]); return; @@ -1338,7 +1336,7 @@ class UploadSerialLocator extends Page implements HasForms $this->form->fill ([ 'plant_id' => $plantId, - 'scan_serial_number' => $scanSno, + 'scan_serial_number' => null, 'scan_locator' => $scanLocator, 'upload_serial_locator' => null, ]); @@ -1361,8 +1359,8 @@ class UploadSerialLocator extends Page implements HasForms $this->form->fill ([ 'plant_id' => $plantId, - 'scan_serial_number' => $scanSno, - 'scan_locator' => $scanLocator, + 'scan_serial_number' => null, + 'scan_locator' => null, 'upload_serial_locator' => null, ]); return; @@ -1381,8 +1379,8 @@ class UploadSerialLocator extends Page implements HasForms $this->form->fill ([ 'plant_id' => $plantId, - 'scan_serial_number' => $scanSno, - 'scan_locator' => $scanLocator, + 'scan_serial_number' => null, + 'scan_locator' => null, 'upload_serial_locator' => null, ]); return; @@ -1399,8 +1397,8 @@ class UploadSerialLocator extends Page implements HasForms $this->form->fill ([ 'plant_id' => $plantId, - 'scan_serial_number' => $scanSno, - 'scan_locator' => $scanLocator, + 'scan_serial_number' => null, + 'scan_locator' => null, 'upload_serial_locator' => null, ]); return; @@ -1409,9 +1407,9 @@ class UploadSerialLocator extends Page implements HasForms } else if ($scanSno) { - if (strlen($scanSno) < 9) { + if (strlen($scanSno) < 9 || strlen($scanSno) > 20) { Notification::make() - ->title("Serial number '$scanSno' must be at least 9 digits.") + ->title("Serial number should contain minimum 9 digits and maximum 20 digits.") ->danger() ->duration(1200) ->send(); @@ -1420,7 +1418,7 @@ class UploadSerialLocator extends Page implements HasForms $this->form->fill ([ 'plant_id' => $plantId, - 'scan_serial_number' => $scanSno, + 'scan_serial_number' => null, 'scan_locator' => $scanLocator, 'upload_serial_locator' => null, ]); @@ -1438,7 +1436,7 @@ class UploadSerialLocator extends Page implements HasForms $this->form->fill ([ 'plant_id' => $plantId, - 'scan_serial_number' => $scanSno, + 'scan_serial_number' => null, 'scan_locator' => $scanLocator, 'upload_serial_locator' => null, ]); @@ -1464,8 +1462,8 @@ class UploadSerialLocator extends Page implements HasForms $this->form->fill ([ 'plant_id' => $plantId, - 'scan_serial_number' => $scanSno, - 'scan_locator' => $scanLocator, + 'scan_serial_number' => null, + 'scan_locator' => null, 'upload_serial_locator' => null, ]); return; @@ -1482,8 +1480,8 @@ class UploadSerialLocator extends Page implements HasForms $this->form->fill ([ 'plant_id' => $plantId, - 'scan_serial_number' => $scanSno, - 'scan_locator' => $scanLocator, + 'scan_serial_number' => null, + 'scan_locator' => null, 'upload_serial_locator' => null, ]); return; @@ -1500,8 +1498,8 @@ class UploadSerialLocator extends Page implements HasForms $this->form->fill ([ 'plant_id' => $plantId, - 'scan_serial_number' => $scanSno, - 'scan_locator' => $scanLocator, + 'scan_serial_number' => null, + 'scan_locator' => null, 'upload_serial_locator' => null, ]); return; @@ -1528,7 +1526,7 @@ class UploadSerialLocator extends Page implements HasForms $this->form->fill ([ 'plant_id' => $plantId, - 'scan_serial_number' => $scanSno, + 'scan_serial_number' => null, 'scan_locator' => $scanLocator, 'upload_serial_locator' => null, ]); @@ -1546,7 +1544,7 @@ class UploadSerialLocator extends Page implements HasForms $this->form->fill ([ 'plant_id' => $plantId, - 'scan_serial_number' => $scanSno, + 'scan_serial_number' => null, 'scan_locator' => $scanLocator, 'upload_serial_locator' => null, ]); @@ -1568,7 +1566,7 @@ class UploadSerialLocator extends Page implements HasForms ([ 'plant_id' => $plantId, 'scan_serial_number' => $scanSno, - 'scan_locator' => $scanLocator, + 'scan_locator' => null, 'upload_serial_locator' => null, ]); return; @@ -1590,7 +1588,7 @@ class UploadSerialLocator extends Page implements HasForms ([ 'plant_id' => $plantId, 'scan_serial_number' => $scanSno, - 'scan_locator' => $scanLocator, + 'scan_locator' => null, 'upload_serial_locator' => null, ]); return; @@ -1611,7 +1609,7 @@ class UploadSerialLocator extends Page implements HasForms ([ 'plant_id' => $plantId, 'scan_serial_number' => $scanSno, - 'scan_locator' => $scanLocator, + 'scan_locator' => null, 'upload_serial_locator' => null, ]); return; @@ -1620,16 +1618,16 @@ class UploadSerialLocator extends Page implements HasForms { Notification::make() ->title("Locator number '$scanLocator' exist in pallet table.") - ->danger() - ->duration(1200) + ->success() + ->duration(1000) ->send(); $this->dispatch('loadData', $scanLocator, $scanSno, $plantId); $this->form->fill ([ 'plant_id' => $plantId, - 'scan_serial_number' => $scanSno, - 'scan_locator' => $scanLocator, + 'scan_serial_number' => null, + 'scan_locator' => null, 'upload_serial_locator' => null, ]); return; @@ -1675,8 +1673,8 @@ class UploadSerialLocator extends Page implements HasForms $this->form->fill ([ 'plant_id' => $plantId, - 'scan_serial_number' => $scanSno, - 'scan_locator' => $scanLocator, + 'scan_serial_number' => null, + 'scan_locator' => null, 'upload_serial_locator' => null, ]); return; @@ -1693,15 +1691,15 @@ class UploadSerialLocator extends Page implements HasForms $this->form->fill ([ 'plant_id' => $plantId, - 'scan_serial_number' => $scanSno, + 'scan_serial_number' => null, 'scan_locator' => $scanLocator, 'upload_serial_locator' => null, ]); return; } - else if (strlen($scanSno) < 9) { + else if (strlen($scanSno) < 9 || strlen($scanSno) > 20) { Notification::make() - ->title("Serial number '$scanSno' must be at least 9 digits.") + ->title("Serial number should contain minimum 9 digits and maximum 20 digits.") ->danger() ->duration(1200) ->send(); @@ -1710,7 +1708,7 @@ class UploadSerialLocator extends Page implements HasForms $this->form->fill ([ 'plant_id' => $plantId, - 'scan_serial_number' => $scanSno, + 'scan_serial_number' => null, 'scan_locator' => $scanLocator, 'upload_serial_locator' => null, ]); @@ -1728,7 +1726,7 @@ class UploadSerialLocator extends Page implements HasForms $this->form->fill ([ 'plant_id' => $plantId, - 'scan_serial_number' => $scanSno, + 'scan_serial_number' => null, 'scan_locator' => $scanLocator, 'upload_serial_locator' => null, ]); @@ -1747,7 +1745,7 @@ class UploadSerialLocator extends Page implements HasForms ([ 'plant_id' => $plantId, 'scan_serial_number' => $scanSno, - 'scan_locator' => $scanLocator, + 'scan_locator' => null, 'upload_serial_locator' => null, ]); return; @@ -1765,7 +1763,7 @@ class UploadSerialLocator extends Page implements HasForms ([ 'plant_id' => $plantId, 'scan_serial_number' => $scanSno, - 'scan_locator' => $scanLocator, + 'scan_locator' => null, 'upload_serial_locator' => null, ]); return; @@ -1785,7 +1783,7 @@ class UploadSerialLocator extends Page implements HasForms ([ 'plant_id' => $plantId, 'scan_serial_number' => $scanSno, - 'scan_locator' => $scanLocator, + 'scan_locator' => null, 'upload_serial_locator' => null, ]); return; @@ -1810,7 +1808,7 @@ class UploadSerialLocator extends Page implements HasForms $this->form->fill ([ 'plant_id' => $plantId, - 'scan_serial_number' => $scanSno, + 'scan_serial_number' => null, 'scan_locator' => $scanLocator, 'upload_serial_locator' => null, ]); @@ -1836,7 +1834,7 @@ class UploadSerialLocator extends Page implements HasForms $this->form->fill ([ 'plant_id' => $plantId, - 'scan_serial_number' => $scanSno, + 'scan_serial_number' => null, 'scan_locator' => $scanLocator, 'upload_serial_locator' => null, ]); @@ -1859,8 +1857,8 @@ class UploadSerialLocator extends Page implements HasForms $this->form->fill ([ 'plant_id' => $plantId, - 'scan_serial_number' => $scanSno, - 'scan_locator' => $scanLocator, + 'scan_serial_number' => null, + 'scan_locator' => null, 'upload_serial_locator' => null, ]); return; diff --git a/app/Filament/Resources/LocatorInvoiceValidationResource.php b/app/Filament/Resources/LocatorInvoiceValidationResource.php index 377ded1..a6bfe50 100644 --- a/app/Filament/Resources/LocatorInvoiceValidationResource.php +++ b/app/Filament/Resources/LocatorInvoiceValidationResource.php @@ -468,16 +468,16 @@ class LocatorInvoiceValidationResource extends Resource ->label('Import Invoice') ->form([ Select::make('plant_id') - ->options(Plant::pluck('name', 'id')->toArray()) - ->label('Select Plant') - ->required() - ->default(function () { - return optional(InvoiceValidation::latest()->first())->plant_id; - }) - ->afterStateUpdated(function ($state, callable $set, callable $get) { - $set('invoice_serial_number', null); - }) - ->reactive(), + ->options(Plant::pluck('name', 'id')->toArray()) + ->label('Select Plant') + ->required() + ->default(function () { + return optional(InvoiceValidation::latest()->first())->plant_id; + }) + ->afterStateUpdated(function ($state, callable $set, callable $get) { + $set('invoice_serial_number', null); + }) + ->reactive(), FileUpload::make('invoice_serial_number') ->label('Invoice Serial Number') @@ -554,7 +554,7 @@ class LocatorInvoiceValidationResource extends Resource } else { - if(Str::length($serialNumber) < 9 || !ctype_alnum($serialNumber)) + if(Str::length($serialNumber) < 9 || Str::length($serialNumber) > 20 || !ctype_alnum($serialNumber)) { $invalidSerialCodes[] = $serialNumber; } @@ -577,7 +577,7 @@ class LocatorInvoiceValidationResource extends Resource if (!empty($uniqueSerialCodes)) { Notification::make() ->title('Invalid Serial Numbers Found') - ->body('The following serial numbers should contain minimum 9 digit alpha numeric values:
' . implode(', ', $uniqueSerialCodes)) + ->body('The following serial numbers should contain minimum 9 digit (and maximum 20 digit) alpha numeric values:
' . implode(', ', $uniqueSerialCodes)) ->danger() ->duration(1200) ->send(); diff --git a/app/Filament/Resources/LocatorInvoiceValidationResource/Pages/CreateLocatorInvoiceValidation.php b/app/Filament/Resources/LocatorInvoiceValidationResource/Pages/CreateLocatorInvoiceValidation.php index 8d77280..15c3580 100644 --- a/app/Filament/Resources/LocatorInvoiceValidationResource/Pages/CreateLocatorInvoiceValidation.php +++ b/app/Filament/Resources/LocatorInvoiceValidationResource/Pages/CreateLocatorInvoiceValidation.php @@ -215,7 +215,7 @@ class CreateLocatorInvoiceValidation extends CreateRecord } else { - if(Str::length($serialNumber) < 9 || !ctype_alnum($serialNumber)) + if(Str::length($serialNumber) < 9 || Str::length($serialNumber) > 20 || !ctype_alnum($serialNumber)) { $invalidSerialCodes[] = $serialNumber; } @@ -238,7 +238,7 @@ class CreateLocatorInvoiceValidation extends CreateRecord if (!empty($uniqueSerialCodes)) { Notification::make() ->title('Invalid Serial Numbers Found') - ->body('The following serial numbers should contain minimum 9 digit alpha numeric values:
' . implode(', ', $uniqueSerialCodes)) + ->body('The following serial numbers should contain minimum 9 digit (and maximum 20 digit) alpha numeric values:
' . implode(', ', $uniqueSerialCodes)) ->danger() ->duration(1200) ->send(); @@ -398,12 +398,12 @@ class CreateLocatorInvoiceValidation extends CreateRecord Notification::make() ->title('Success: Invoice inserted successfully.') ->success() - ->duration(800) + ->duration(500) ->send(); Notification::make() ->title("Start the scanning process for imported invoice number '$invoiceNumber'!") ->info() - ->duration(1000) + ->duration(800) ->send(); if ($disk->exists($filePath)) { @@ -527,7 +527,7 @@ class CreateLocatorInvoiceValidation extends CreateRecord } else { - if(Str::length($serialNumber) < 9 || !ctype_alnum($serialNumber)) + if(Str::length($serialNumber) < 9 || Str::length($serialNumber) > 20 || !ctype_alnum($serialNumber)) { $invalidSerialCodes[] = $serialNumber; } @@ -550,7 +550,7 @@ class CreateLocatorInvoiceValidation extends CreateRecord if (!empty($uniqueSerialCodes)) { Notification::make() ->title('Invalid Serial Numbers Found') - ->body('The following serial numbers should contain minimum 9 digit alpha numeric values:
' . implode(', ', $uniqueSerialCodes)) + ->body('The following serial numbers should contain minimum 9 digit (and maximum 20 digit) alpha numeric values:
' . implode(', ', $uniqueSerialCodes)) ->danger() ->duration(1200) ->send(); @@ -690,12 +690,12 @@ class CreateLocatorInvoiceValidation extends CreateRecord Notification::make() ->title('Success: Invoice updated successfully.') ->success() - ->duration(800) + ->duration(500) ->send(); Notification::make() ->title("Start the scanning process for updated invoice number '$invoiceNumber'!") ->info() - ->duration(1000) + ->duration(800) ->send(); if ($disk->exists($filePath)) { @@ -1110,7 +1110,7 @@ class CreateLocatorInvoiceValidation extends CreateRecord Notification::make() ->title("All Serial numbers are moved into invoice from the pallet number '$palletNumber'.
Scan the next exist pallet number to start the scanning process..!") ->success() - ->duration(800) + ->duration(500) ->send(); $records = LocatorInvoiceValidation::where('plant_id', $plantId) @@ -1200,7 +1200,7 @@ class CreateLocatorInvoiceValidation extends CreateRecord Notification::make() ->title($succMsgStr) ->success() - ->duration(800) + ->duration(500) ->send(); $records = LocatorInvoiceValidation::where('plant_id', $plantId) @@ -1349,6 +1349,7 @@ class CreateLocatorInvoiceValidation extends CreateRecord } } + $snoCount = LocatorInvoiceValidation::where('plant_id', $plantId)->where('invoice_number', $invoiceNumber)->count(); if ($serialNumber == '' || $serialNumber == null) { Notification::make() @@ -1358,7 +1359,6 @@ class CreateLocatorInvoiceValidation extends CreateRecord ->duration(1200) ->send(); - $snoCount = LocatorInvoiceValidation::where('plant_id', $plantId)->where('invoice_number', $invoiceNumber)->count(); $this->dispatch('loadData', $invoiceNumber, $plantId); $this->form->fill([ 'plant_id' => $plantId, @@ -1373,13 +1373,11 @@ class CreateLocatorInvoiceValidation extends CreateRecord ]); return; } - - $snoCount = LocatorInvoiceValidation::where('plant_id', $plantId)->where('invoice_number', $invoiceNumber)->count(); - if (strlen($serialNumber) < 9) + else if (strlen($serialNumber) < 9 || strlen($serialNumber) > 20) { Notification::make() ->title("Invalid: Serial Number") - ->body('Serial number should contain minimum 9 digits.') + ->body('Serial number should contain minimum 9 digits and maximum 20 digits.') ->danger() ->duration(1200) ->send(); @@ -1402,7 +1400,6 @@ class CreateLocatorInvoiceValidation extends CreateRecord Notification::make() ->title("Invalid: Serial Number") ->body('Serial number must contain alpha-numeric values only.') - // ->body("Serial number '$serialNumber' must be at least 9 digits and alpha-numeric value only allowed!") ->danger() ->duration(1200) ->send(); @@ -1586,7 +1583,7 @@ class CreateLocatorInvoiceValidation extends CreateRecord Notification::make() ->title($succMsg) ->success() - ->duration(800) + ->duration(500) ->send(); $records = LocatorInvoiceValidation::where('plant_id', $plantId)->where('invoice_number', $invoiceNumber)->get(); @@ -1642,7 +1639,7 @@ class CreateLocatorInvoiceValidation extends CreateRecord { Notification::make() ->title("Failed to check Serial number '{$serialNumber}' existence.
Scan the valid serial number to proceed...") - ->success() + ->danger() ->duration(1200) ->send(); diff --git a/app/Filament/Resources/PalletValidationResource/Pages/CreatePalletValidation.php b/app/Filament/Resources/PalletValidationResource/Pages/CreatePalletValidation.php index f8d8e8e..d426f0d 100644 --- a/app/Filament/Resources/PalletValidationResource/Pages/CreatePalletValidation.php +++ b/app/Filament/Resources/PalletValidationResource/Pages/CreatePalletValidation.php @@ -64,6 +64,7 @@ class CreatePalletValidation extends CreateRecord ->danger() ->duration(1200) ->send(); + $this->form->fill([ 'serial_number' => null, 'plant_id' => $plantId, @@ -86,6 +87,7 @@ class CreatePalletValidation extends CreateRecord ->danger() ->duration(1200) ->send(); + $this->dispatch('loadData', $palletNumber, $plantId); $this->form->fill([ 'serial_number' => null, @@ -98,13 +100,14 @@ class CreatePalletValidation extends CreateRecord ]); return; } - else if (strlen($serialNumber) < 9) + else if (strlen($serialNumber) < 9 || strlen($serialNumber) > 20) { Notification::make() - ->title('Serial number should contain minimum 9 digits.') + ->title('Serial number should contain minimum 9 digits and maximum 20 digits.') ->danger() ->duration(1200) ->send(); + $this->dispatch('loadData', $palletNumber, $plantId); $this->form->fill([ 'serial_number' => null, @@ -124,6 +127,7 @@ class CreatePalletValidation extends CreateRecord ->danger() ->duration(1200) ->send(); + $this->dispatch('loadData', $palletNumber, $plantId); $this->form->fill([ 'serial_number' => null, @@ -150,6 +154,7 @@ class CreatePalletValidation extends CreateRecord ->danger() ->duration(1200) ->send(); + $this->dispatch('loadData', $palletNumber, $plantId); $this->form->fill([ 'serial_number' => null, @@ -532,10 +537,10 @@ class CreatePalletValidation extends CreateRecord ]); return; } - else if (strlen($serialNumber) < 9) + else if (strlen($serialNumber) < 9 || strlen($serialNumber) > 20) { Notification::make() - ->title('Serial number should contain minimum 9 digits.') + ->title('Serial number should contain minimum 9 digits and maximum 20 digits.') ->danger() ->duration(1200) ->send(); diff --git a/app/Filament/Resources/ReworkLocatorInvoiceValidationResource/Pages/CreateReworkLocatorInvoiceValidation.php b/app/Filament/Resources/ReworkLocatorInvoiceValidationResource/Pages/CreateReworkLocatorInvoiceValidation.php index b64ef48..2c4e236 100644 --- a/app/Filament/Resources/ReworkLocatorInvoiceValidationResource/Pages/CreateReworkLocatorInvoiceValidation.php +++ b/app/Filament/Resources/ReworkLocatorInvoiceValidationResource/Pages/CreateReworkLocatorInvoiceValidation.php @@ -148,11 +148,11 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord ]); return; } - else if (strlen($serialNo) > 0 && strlen($serialNo) < 9) + else if (strlen($serialNo) > 0 && (strlen($serialNo) < 9 || strlen($serialNo) > 20)) { Notification::make() ->title("Invalid: Serial Number") - ->body("Serial number '$serialNo' must be at least 9 digits.") + ->body("Serial number should contain minimum 9 digits and maximum 20 digits.") ->danger() ->duration(1200) ->send(); @@ -518,11 +518,11 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord return; } - if (strlen($serialNo) > 0 && strlen($serialNo) < 9) + if (strlen($serialNo) > 0 && (strlen($serialNo) < 9 || strlen($serialNo) > 20)) { Notification::make() ->title("Invalid: Serial Number") - ->body("Serial number '$serialNo' must be at least 9 digits.") + ->body("Serial number should contain minimum 9 digits and maximum 20 digits.") ->danger() ->duration(1200) ->send(); @@ -599,7 +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'.

Please, scan the next pallet number to proceed..!") ->success() - ->duration(800) + ->duration(500) ->send(); $InvoiceSerialNumbers = LocatorInvoiceValidation::where('plant_id', $plantId)->where('invoice_number', $invoiceNo)->first(); @@ -609,7 +609,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord Notification::make() ->title("All available serial numbers are successfully moved into rework invoice table from invoice number '$invoiceNo'.

Please, scan the next invoice number to proceed..!") ->success() - ->duration(1000) + ->duration(800) ->send(); $this->dispatch('loadData', '', '', $plantId, $reworkType); @@ -794,11 +794,11 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord } else { - if (strlen($serialNo) > 0 && strlen($serialNo) < 9) + if (strlen($serialNo) > 0 && (strlen($serialNo) < 9 || strlen($serialNo) > 20)) { Notification::make() ->title("Invalid: Serial Number") - ->body("Serial number '$serialNo' must be at least 9 digits.") + ->body("Serial number should contain minimum 9 digits and maximum 20 digits.") ->danger() ->duration(1200) ->send(); @@ -1109,11 +1109,11 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord ]); return; } - else if (strlen($serialNo) < 9) + else if (strlen($serialNo) < 9 || strlen($serialNo) > 20) { Notification::make() ->title("Invalid: Serial Number") - ->body("Serial number '$serialNo' must be at least 9 digits.") + ->body("Serial number should contain minimum 9 digits and maximum 20 digits.") ->danger() ->duration(1200) ->send(); @@ -1218,7 +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'.

Please, scan the next serial number to proceed..!") ->success() - ->duration(800) + ->duration(500) ->send(); $InvoiceSerialNumbers = LocatorInvoiceValidation::where('plant_id', $plantId)->where('invoice_number', $invoiceNo)->first(); @@ -1228,7 +1228,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord Notification::make() ->title("All available serial numbers are successfully moved into rework invoice table from invoice number '$invoiceNo'.

Please, scan the next invoice number to proceed..!") ->success() - ->duration(1000) + ->duration(800) ->send(); $this->dispatch('loadData', '', '', $plantId, $reworkType); @@ -1439,11 +1439,11 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord ]); return; } - else if (strlen($serialNo) < 9) + else if (strlen($serialNo) < 9 || strlen($serialNo) > 20) { Notification::make() ->title("Invalid: Serial Number") - ->body("Serial number '$serialNo' must be at least 9 digits.") + ->body("Serial number should contain minimum 9 digits and maximum 20 digits.") ->danger() ->duration(1200) ->send(); @@ -1520,9 +1520,10 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord foreach ($records as $row) { - if ($PalletSerialNumbers->serial_number != null && $PalletSerialNumbers->serial_number != '' && $PalletSerialNumbers->serial_number != $serialNo) + if ($row->serial_number != null && $row->serial_number != '' && $row->serial_number == $serialNo) { $row->forceDelete(); + continue; } $row->pallet_status = null; @@ -1535,7 +1536,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord ->title('Completed: Rework Serial from Pallet') ->body("Scanned serial number '$serialNo' successfully removed from pallet number '$palletNo'.

Please, scan the next pallet number to re-master packing..!") ->success() - ->duration(800) + ->duration(500) ->send(); $PalletSerialNumbers = PalletValidation::where('plant_id', $plantId)->where('pallet_number', $palletNo)->first(); @@ -1545,7 +1546,7 @@ class CreateReworkLocatorInvoiceValidation extends CreateRecord Notification::make() ->title("Pallet number '$palletNo' successfully re-master packed.

Please, scan the next pallet number to re-master packing..!") ->success() - ->duration(1000) + ->duration(800) ->send(); $this->dispatch('loadData', '', '', $plantId, $reworkType); diff --git a/resources/views/livewire/serial-locator-data-table.blade.php b/resources/views/livewire/serial-locator-data-table.blade.php index bf48ddd..6f64db2 100644 --- a/resources/views/livewire/serial-locator-data-table.blade.php +++ b/resources/views/livewire/serial-locator-data-table.blade.php @@ -32,13 +32,8 @@ @empty - - No records found. - - - @if ($hasSearched) - - + @if ($hasSearched) + @if ($locatorNumber && $serialNumber) Serial Number "{{ $serialNumber }}" and Locator Number "{{ $locatorNumber }}" not found. @elseif ($locatorNumber) @@ -49,8 +44,12 @@ No records found. @endif - - @endif + @else + + No records found. + + @endif + @endforelse