Added all validations in process order

This commit is contained in:
dhanabalan
2025-11-18 10:35:47 +05:30
parent 1f64c3b36d
commit 5f1fcf4be4

View File

@@ -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']),