Changed logic in cycle count
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 15s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 17s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 14s
Laravel Pint / pint (pull_request) Successful in 2m22s
Laravel Larastan / larastan (pull_request) Failing after 3m44s
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 15s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 17s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 14s
Laravel Pint / pint (pull_request) Successful in 2m22s
Laravel Larastan / larastan (pull_request) Failing after 3m44s
This commit is contained in:
@@ -128,7 +128,8 @@ class CycleCount extends Page
|
||||
$operatorName = $user->name;
|
||||
|
||||
$pattern1 = '/^[^#]*#[^#]*#[^#]*#[^#]*#$/';
|
||||
$pattern2 = '/^[^|]*\|[^|]*\|[^|]*$/';
|
||||
// $pattern2 = '/^[^|]*\|[^|]*\|[^|]*$/';
|
||||
$pattern2 = '/^[^|]+\|[^|]+(?:\|[^|]*)?$/';
|
||||
$pattern3 = '/^([a-zA-Z0-9]{6,})\|([1-9][a-zA-Z0-9]{8,})(?:\/[MmPp])?\|?$/';
|
||||
|
||||
// $pattern2 = '/^[^|]+\|[^|]+\|[^|]+\|?$/'; Optional Pipeline at end
|
||||
@@ -721,13 +722,28 @@ class CycleCount extends Page
|
||||
$parts = explode('|', $value);
|
||||
|
||||
$this->itemCode = $parts[0] ?? null;
|
||||
if (strlen($parts[1]) > strlen($parts[2])) {
|
||||
|
||||
if (count($parts) == 2) {
|
||||
// Format: itemcode|serialnumber
|
||||
$this->sNo = $parts[1];
|
||||
$this->batch = $parts[2];
|
||||
$this->batch = null;
|
||||
} else {
|
||||
$this->batch = $parts[1];
|
||||
$this->sNo = $parts[2];
|
||||
// Format: itemcode|value1|value2
|
||||
if (strlen($parts[1]) > strlen($parts[2])) {
|
||||
$this->sNo = $parts[1];
|
||||
$this->batch = $parts[2];
|
||||
} else {
|
||||
$this->batch = $parts[1];
|
||||
$this->sNo = $parts[2];
|
||||
}
|
||||
}
|
||||
// if (strlen($parts[1]) > strlen($parts[2])) {
|
||||
// $this->sNo = $parts[1];
|
||||
// $this->batch = $parts[2];
|
||||
// } else {
|
||||
// $this->batch = $parts[1];
|
||||
// $this->sNo = $parts[2];
|
||||
// }
|
||||
|
||||
if (strlen($this->itemCode) < 6) {
|
||||
Notification::make()
|
||||
@@ -759,7 +775,7 @@ class CycleCount extends Page
|
||||
]);
|
||||
|
||||
return;
|
||||
} elseif (strlen($this->batch) < 5) {
|
||||
} elseif (count($parts) !== 2 && strlen($this->batch) < 5) {
|
||||
Notification::make()
|
||||
->title('Unknown Batch')
|
||||
->body("Batch should contain minimum 5 digits '$this->batch'")
|
||||
@@ -927,7 +943,7 @@ class CycleCount extends Page
|
||||
'bin' => $bin,
|
||||
'serial_number' => $this->sNo,
|
||||
'stickerMasterId' => $stickerMasterId,
|
||||
'batch' => $this->batch,
|
||||
'batch' => $this->batch ?? null,
|
||||
'docNo' => $this->docNo,
|
||||
'quantity' => $this->quantity,
|
||||
]),
|
||||
@@ -1240,7 +1256,7 @@ class CycleCount extends Page
|
||||
return;
|
||||
}
|
||||
|
||||
if ($serialAgaPlant->batch != '' || $serialAgaPlant->batch != null) {
|
||||
if (count($parts) !== 2 && ($serialAgaPlant->batch != '' || $serialAgaPlant->batch != null)){
|
||||
|
||||
if ($serialAgaPlant->batch != $this->batch) {
|
||||
|
||||
@@ -1396,7 +1412,7 @@ class CycleCount extends Page
|
||||
'bin' => $bin,
|
||||
'serial_number' => $this->sNo,
|
||||
'stickerMasterId' => $stickerMasterId,
|
||||
'batch' => $this->batch,
|
||||
'batch' => $this->batch ?? null,
|
||||
'docNo' => $this->docNo,
|
||||
'quantity' => $this->quantity,
|
||||
]),
|
||||
@@ -1416,7 +1432,7 @@ class CycleCount extends Page
|
||||
$serial->update([
|
||||
'bin' => $bin ?? null,
|
||||
'batch' => $this->batch ?? null,
|
||||
'doc_no' => $this->docNo ?? null,
|
||||
// 'doc_no' => $this->docNo ?? null,
|
||||
'scanned_status' => 'Scanned',
|
||||
'scanned_quantity' => '1',
|
||||
'updated_at' => now(),
|
||||
@@ -2132,6 +2148,7 @@ class CycleCount extends Page
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
|
||||
Reference in New Issue
Block a user