diff --git a/app/Filament/Imports/ProductionPlanImporter.php b/app/Filament/Imports/ProductionPlanImporter.php index 8df1e8907..a71fe7bd6 100644 --- a/app/Filament/Imports/ProductionPlanImporter.php +++ b/app/Filament/Imports/ProductionPlanImporter.php @@ -89,15 +89,19 @@ class ProductionPlanImporter extends Importer { $warnMsg = []; $plant = Plant::where('name', $this->data['plant'])->first(); + $line = null; + $block = null; if (!$plant) { $warnMsg[] = "Plant not found"; } - $line = Line::where('name', $this->data['line'])->where('plant_id', $plant->id)->first(); + else { + $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) { $warnMsg[] = "Line not found"; } - //block_reference - $block = Block::where('name', $this->data['block_reference'])->where('plant_id', $plant->id)->first(); $shift = null; if (!$block) { $warnMsg[] = "Block not found";