Added validation logic in process order importer
This commit is contained in:
@@ -74,6 +74,17 @@ class ProcessOrderImporter extends Importer
|
||||
$warnMsg[] = "User not found";
|
||||
}
|
||||
|
||||
if ($plant && $processOrder != '') {
|
||||
|
||||
$existingOrder = ProcessOrder::where('plant_id', $plant->id)
|
||||
->where('process_order', $processOrder)
|
||||
->first();
|
||||
|
||||
if ($existingOrder && $existingOrder->item_id !== ($itemCode->id ?? null)) {
|
||||
$warnMsg[] = "Same Process Order already exists for this Plant with a different Item Code";
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($warnMsg)) {
|
||||
throw new RowImportFailedException(implode(', ', $warnMsg));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user