3 Commits

Author SHA1 Message Date
dhanabalan
1073a7cb0b Clear invoice, serial, quantities on change plant 2025-04-19 19:25:19 +05:30
dhanabalan
700f4715f7 Rule 'datetime' removed 2025-04-19 19:24:43 +05:30
dhanabalan
2cec2cb822 Double scanning issue updation 2025-04-19 19:24:15 +05:30
3 changed files with 13 additions and 12 deletions

View File

@@ -18,12 +18,12 @@ class ProductionLineStopImporter extends Importer
->requiredMapping()
->exampleHeader('From DateTime')
->label('From DateTime')
->rules(['required', 'datetime']),
->rules(['required']),
ImportColumn::make('to_datetime')
->requiredMapping()
->exampleHeader('To DateTime')
->label('To DateTime')
->rules(['required', 'datetime']),
->rules(['required']),
ImportColumn::make('stop_hour')
->requiredMapping()
->exampleHeader('Stop Hour')

View File

@@ -31,9 +31,6 @@ use Maatwebsite\Excel\Facades\Excel;
use Livewire\Livewire;
use Str;
class InvoiceValidationResource extends Resource
{
protected static ?string $model = InvoiceValidation::class;
@@ -44,8 +41,6 @@ class InvoiceValidationResource extends Resource
public $invoiceNumber;
public static function form(Form $form): Form
{
return $form
@@ -74,6 +69,10 @@ class InvoiceValidationResource extends Resource
$set('update_invoice', null);
// Ensure `linestop_id` is not cleared
if (!$plantId) {
$set('invoice_number', null);
$set('serial_number', null);
$set('total_quantity', null);
$set('scanned_quantity', null);
$set('ivPlantError', 'Please select a plant first.');
return;
}

View File

@@ -1024,8 +1024,9 @@ class CreateInvoiceValidation extends CreateRecord
}
}
public function processSerialNumber($serialNumber)
public function processSerialNumber($serNo)
{
$serialNumber = null;
$plantId = $this->form->getState()['plant_id'];
$this->plantId = $plantId;
$invoiceNumber = $this->form->getState()['invoice_number'];
@@ -1104,7 +1105,7 @@ class CreateInvoiceValidation extends CreateRecord
$itemCode = '';
$batchNumber = '';
if (preg_match($pattern1, $serialNumber, $matches)) {
if (preg_match($pattern1, $serNo, $matches)) {
$itemCode = $matches['item_code'];
$this->currentItemCode = $itemCode;
$batchNumber = $matches['batch_number'];
@@ -1144,7 +1145,7 @@ class CreateInvoiceValidation extends CreateRecord
]);
return;
}
} elseif (preg_match($pattern2, $serialNumber, $matches)) {
} elseif (preg_match($pattern2, $serNo, $matches)) {
$itemCode = $matches['item_code'];
$this->currentItemCode = $itemCode;
$batchNumber = null; // batch_number not present in this pattern
@@ -1187,6 +1188,7 @@ class CreateInvoiceValidation extends CreateRecord
} else {
$itemCode = null;
$batchNumber = null;
$serNo = null;
$serialNumber = null;
Notification::make()
@@ -1412,7 +1414,7 @@ class CreateInvoiceValidation extends CreateRecord
$this->dispatch( 'refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId);
}
if (!preg_match('/^([a-zA-Z0-9]{6,})\|([a-zA-Z0-9]{8,})(?:\/[MmPpCc])?$/', $serialNumber, $matches)) {
if (!preg_match('/^([a-zA-Z0-9]{6,})\|([a-zA-Z0-9]{8,})(?:\/[MmPpCc])?$/', $serNo, $matches)) {
Notification::make()
->danger()
->title('Invalid Serial QR Format')
@@ -1429,7 +1431,7 @@ class CreateInvoiceValidation extends CreateRecord
return;
}
if (preg_match('/^([a-zA-Z0-9]+)\|([a-zA-Z0-9]+(?:\/[MmPpCc]?)?)$/', $serialNumber, $matches))
if (preg_match('/^([a-zA-Z0-9]+)\|([a-zA-Z0-9]+(?:\/[MmPpCc]?)?)$/', $serNo, $matches))
{
$itemCode = $matches[1];
$serialNumber = $matches[2];