Double scanning issue updation

This commit is contained in:
dhanabalan
2025-04-19 19:24:15 +05:30
parent 8980429b52
commit 2cec2cb822

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