Merge pull request 'changed logic in production order importer' (#1558) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 18s
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 18s
Reviewed-on: #1558
This commit was merged in pull request #1558.
This commit is contained in:
@@ -251,10 +251,20 @@ class ProductionOrderImporter extends Importer
|
||||
$prodOrd = $prefix.$nextSeq;
|
||||
}
|
||||
|
||||
$prefixSerial = $plantCod.$year.$month;
|
||||
$wareHouseNo = $plant->warehouse_number ?? null;
|
||||
|
||||
$prefixSerial = $plantCod.$wareHouseNo.$year.$month;
|
||||
|
||||
$last = ProductionOrder::where('to_serial_number', 'like', "{$prefixSerial}%")->orderByDesc('to_serial_number')->first();
|
||||
|
||||
if (!$last && !empty($wareHouseNo)) {
|
||||
$oldPrefixSerial = $plantCod . $year . $month;
|
||||
|
||||
$last = ProductionOrder::where('to_serial_number', 'like', "{$oldPrefixSerial}%")
|
||||
->orderByDesc('to_serial_number')
|
||||
->first();
|
||||
}
|
||||
|
||||
if ($last) {
|
||||
$lastSeq = (int) substr($last->to_serial_number, -6);
|
||||
$startSeq = str_pad(($lastSeq + 1), 6, '0', STR_PAD_LEFT);
|
||||
|
||||
Reference in New Issue
Block a user