Changed logic in cycle count #830
@@ -128,7 +128,8 @@ class CycleCount extends Page
|
|||||||
$operatorName = $user->name;
|
$operatorName = $user->name;
|
||||||
|
|
||||||
$pattern1 = '/^[^#]*#[^#]*#[^#]*#[^#]*#$/';
|
$pattern1 = '/^[^#]*#[^#]*#[^#]*#[^#]*#$/';
|
||||||
$pattern2 = '/^[^|]*\|[^|]*\|[^|]*$/';
|
// $pattern2 = '/^[^|]*\|[^|]*\|[^|]*$/';
|
||||||
|
$pattern2 = '/^[^|]+\|[^|]+(?:\|[^|]*)?$/';
|
||||||
$pattern3 = '/^([a-zA-Z0-9]{6,})\|([1-9][a-zA-Z0-9]{8,})(?:\/[MmPp])?\|?$/';
|
$pattern3 = '/^([a-zA-Z0-9]{6,})\|([1-9][a-zA-Z0-9]{8,})(?:\/[MmPp])?\|?$/';
|
||||||
|
|
||||||
// $pattern2 = '/^[^|]+\|[^|]+\|[^|]+\|?$/'; Optional Pipeline at end
|
// $pattern2 = '/^[^|]+\|[^|]+\|[^|]+\|?$/'; Optional Pipeline at end
|
||||||
@@ -721,6 +722,13 @@ class CycleCount extends Page
|
|||||||
$parts = explode('|', $value);
|
$parts = explode('|', $value);
|
||||||
|
|
||||||
$this->itemCode = $parts[0] ?? null;
|
$this->itemCode = $parts[0] ?? null;
|
||||||
|
|
||||||
|
if (count($parts) == 2) {
|
||||||
|
// Format: itemcode|serialnumber
|
||||||
|
$this->sNo = $parts[1];
|
||||||
|
$this->batch = null;
|
||||||
|
} else {
|
||||||
|
// Format: itemcode|value1|value2
|
||||||
if (strlen($parts[1]) > strlen($parts[2])) {
|
if (strlen($parts[1]) > strlen($parts[2])) {
|
||||||
$this->sNo = $parts[1];
|
$this->sNo = $parts[1];
|
||||||
$this->batch = $parts[2];
|
$this->batch = $parts[2];
|
||||||
@@ -728,6 +736,14 @@ class CycleCount extends Page
|
|||||||
$this->batch = $parts[1];
|
$this->batch = $parts[1];
|
||||||
$this->sNo = $parts[2];
|
$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) {
|
if (strlen($this->itemCode) < 6) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
@@ -759,7 +775,7 @@ class CycleCount extends Page
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
} elseif (strlen($this->batch) < 5) {
|
} elseif (count($parts) !== 2 && strlen($this->batch) < 5) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Unknown Batch')
|
->title('Unknown Batch')
|
||||||
->body("Batch should contain minimum 5 digits '$this->batch'")
|
->body("Batch should contain minimum 5 digits '$this->batch'")
|
||||||
@@ -927,7 +943,7 @@ class CycleCount extends Page
|
|||||||
'bin' => $bin,
|
'bin' => $bin,
|
||||||
'serial_number' => $this->sNo,
|
'serial_number' => $this->sNo,
|
||||||
'stickerMasterId' => $stickerMasterId,
|
'stickerMasterId' => $stickerMasterId,
|
||||||
'batch' => $this->batch,
|
'batch' => $this->batch ?? null,
|
||||||
'docNo' => $this->docNo,
|
'docNo' => $this->docNo,
|
||||||
'quantity' => $this->quantity,
|
'quantity' => $this->quantity,
|
||||||
]),
|
]),
|
||||||
@@ -1240,7 +1256,7 @@ class CycleCount extends Page
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($serialAgaPlant->batch != '' || $serialAgaPlant->batch != null) {
|
if (count($parts) !== 2 && ($serialAgaPlant->batch != '' || $serialAgaPlant->batch != null)){
|
||||||
|
|
||||||
if ($serialAgaPlant->batch != $this->batch) {
|
if ($serialAgaPlant->batch != $this->batch) {
|
||||||
|
|
||||||
@@ -1396,7 +1412,7 @@ class CycleCount extends Page
|
|||||||
'bin' => $bin,
|
'bin' => $bin,
|
||||||
'serial_number' => $this->sNo,
|
'serial_number' => $this->sNo,
|
||||||
'stickerMasterId' => $stickerMasterId,
|
'stickerMasterId' => $stickerMasterId,
|
||||||
'batch' => $this->batch,
|
'batch' => $this->batch ?? null,
|
||||||
'docNo' => $this->docNo,
|
'docNo' => $this->docNo,
|
||||||
'quantity' => $this->quantity,
|
'quantity' => $this->quantity,
|
||||||
]),
|
]),
|
||||||
@@ -1416,7 +1432,7 @@ class CycleCount extends Page
|
|||||||
$serial->update([
|
$serial->update([
|
||||||
'bin' => $bin ?? null,
|
'bin' => $bin ?? null,
|
||||||
'batch' => $this->batch ?? null,
|
'batch' => $this->batch ?? null,
|
||||||
'doc_no' => $this->docNo ?? null,
|
// 'doc_no' => $this->docNo ?? null,
|
||||||
'scanned_status' => 'Scanned',
|
'scanned_status' => 'Scanned',
|
||||||
'scanned_quantity' => '1',
|
'scanned_quantity' => '1',
|
||||||
'updated_at' => now(),
|
'updated_at' => now(),
|
||||||
@@ -2132,6 +2148,7 @@ class CycleCount extends Page
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getHeaderActions(): array
|
protected function getHeaderActions(): array
|
||||||
|
|||||||
Reference in New Issue
Block a user