changed logic in production order importer #1558
@@ -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