Added all validations in process order
This commit is contained in:
@@ -79,16 +79,40 @@ class ProcessOrderImporter extends Importer
|
||||
$warnMsg[] = "Item Code not found";
|
||||
}
|
||||
|
||||
$processOrder = trim($this->data['process_order'] ?? '');
|
||||
|
||||
if ($processOrder == '') {
|
||||
$warnMsg[] = "Process Order cannot be empty";
|
||||
}
|
||||
|
||||
$coilNo = trim($this->data['coil_number'] ?? '');
|
||||
|
||||
if ($coilNo == '') {
|
||||
$warnMsg[] = "Coil Number cannot be empty";
|
||||
}
|
||||
|
||||
$ordQuan = trim($this->data['order_quantity'] ?? '');
|
||||
|
||||
if ($ordQuan == '') {
|
||||
$warnMsg[] = "Order Quantity cannot be empty";
|
||||
}
|
||||
|
||||
$recQuan = trim($this->data['received_quantity'] ?? '');
|
||||
|
||||
if ($recQuan == '') {
|
||||
$warnMsg[] = "Received Quantity cannot be empty";
|
||||
}
|
||||
|
||||
$user = User::where('name', $this->data['created_by'])->first();
|
||||
if (!$user) {
|
||||
$warnMsg[] = "User not found";
|
||||
}
|
||||
|
||||
if (!empty($warnMsg)) {
|
||||
if (!empty($warnMsg)) {
|
||||
throw new RowImportFailedException(implode(', ', $warnMsg));
|
||||
}
|
||||
|
||||
return ProcessOrder::create([
|
||||
return ProcessOrder::create([
|
||||
'plant_id' => $plant->id,
|
||||
'item_id' => $itemCode->id,
|
||||
'process_order' => trim($this->data['process_order']),
|
||||
|
||||
Reference in New Issue
Block a user