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'];
$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];