Updated import validation (get block_id if plant exist otherwise ignore)

This commit is contained in:
dhanabalan
2025-05-10 11:28:18 +05:30
parent 0ea9d49ead
commit 0b82f33837

View File

@@ -89,15 +89,19 @@ class ProductionPlanImporter extends Importer
{ {
$warnMsg = []; $warnMsg = [];
$plant = Plant::where('name', $this->data['plant'])->first(); $plant = Plant::where('name', $this->data['plant'])->first();
$line = null;
$block = null;
if (!$plant) { if (!$plant) {
$warnMsg[] = "Plant not found"; $warnMsg[] = "Plant not found";
} }
else {
$line = Line::where('name', $this->data['line'])->where('plant_id', $plant->id)->first(); $line = Line::where('name', $this->data['line'])->where('plant_id', $plant->id)->first();
//block_reference
$block = Block::where('name', $this->data['block_reference'])->where('plant_id', $plant->id)->first();
}
if (!$line) { if (!$line) {
$warnMsg[] = "Line not found"; $warnMsg[] = "Line not found";
} }
//block_reference
$block = Block::where('name', $this->data['block_reference'])->where('plant_id', $plant->id)->first();
$shift = null; $shift = null;
if (!$block) { if (!$block) {
$warnMsg[] = "Block not found"; $warnMsg[] = "Block not found";