Updated process order import function for testing purpose only. #428
@@ -133,9 +133,9 @@ class ProcessOrderImporter extends Importer
|
|||||||
if ($processOrder == null || $processOrder == '') {
|
if ($processOrder == null || $processOrder == '') {
|
||||||
$warnMsg[] = "Process order can't be empty!";
|
$warnMsg[] = "Process order can't be empty!";
|
||||||
}
|
}
|
||||||
if ($lineNam == null || $lineNam == '') {
|
// if ($lineNam == null || $lineNam == '') {
|
||||||
$warnMsg[] = "Line name can't be empty!";
|
// $warnMsg[] = "Line name can't be empty!";
|
||||||
}
|
// }
|
||||||
if ($orderQuan == null || $orderQuan == '') {
|
if ($orderQuan == null || $orderQuan == '') {
|
||||||
$warnMsg[] = "Order quantity can't be empty!";
|
$warnMsg[] = "Order quantity can't be empty!";
|
||||||
} elseif ($orderQuan == 0 || $orderQuan == '0') {
|
} elseif ($orderQuan == 0 || $orderQuan == '0') {
|
||||||
@@ -171,6 +171,18 @@ class ProcessOrderImporter extends Importer
|
|||||||
$plantId = $plant->id;
|
$plantId = $plant->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$existing = ProcessOrder::where('plant_id', $plantId)->where('process_order', $processOrder)->first();
|
||||||
|
|
||||||
|
if ($existing) {
|
||||||
|
$warnMsg[] = 'Process Order already exists!';
|
||||||
|
} else {
|
||||||
|
$warnMsg[] = 'New process order found!';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($warnMsg)) {
|
||||||
|
throw new RowImportFailedException(implode(', ', $warnMsg));
|
||||||
|
}
|
||||||
|
|
||||||
$itemCode = Item::where('code', $iCode)->first();
|
$itemCode = Item::where('code', $iCode)->first();
|
||||||
if (! $itemCode) {
|
if (! $itemCode) {
|
||||||
$warnMsg[] = 'Item code not found!';
|
$warnMsg[] = 'Item code not found!';
|
||||||
@@ -221,14 +233,6 @@ class ProcessOrderImporter extends Importer
|
|||||||
$updatedBy = Filament::auth()->user()->name;
|
$updatedBy = Filament::auth()->user()->name;
|
||||||
}
|
}
|
||||||
|
|
||||||
$existing = ProcessOrder::where('plant_id', $plantId)->where('process_order', $processOrder)->first();
|
|
||||||
|
|
||||||
if ($existing) {
|
|
||||||
$warnMsg[] = 'Process Order already exists!';
|
|
||||||
} else {
|
|
||||||
$warnMsg[] = 'New process order found!';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! empty($warnMsg)) {
|
if (! empty($warnMsg)) {
|
||||||
throw new RowImportFailedException(implode(', ', $warnMsg));
|
throw new RowImportFailedException(implode(', ', $warnMsg));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user