diff --git a/app/Filament/Imports/ProductionPlanImporter.php b/app/Filament/Imports/ProductionPlanImporter.php index ce391fb3..eb35bfb0 100644 --- a/app/Filament/Imports/ProductionPlanImporter.php +++ b/app/Filament/Imports/ProductionPlanImporter.php @@ -16,6 +16,7 @@ use Filament\Actions\Imports\Importer; use Filament\Actions\Imports\Models\Import; use Filament\Facades\Filament; use Str; +use Illuminate\Support\Facades\Log; class ProductionPlanImporter extends Importer { @@ -152,36 +153,6 @@ class ProductionPlanImporter extends Importer if (! empty($warnMsg)) { throw new RowImportFailedException(implode(', ', $warnMsg)); - } else { - - $productionPlan = ProductionPlan::where('plant_id', $plant->id) - ->where('line_id', $line) - ->where('item_id', $itemAgaPlant->id) - ->latest() - ->first(); - - if ($productionPlan) { - - $recordDate = now(); - $month = $recordDate->month; - $year = $recordDate->year; - - $previousRecord = ProductionPlan::where('plant_id', $plant->id) - ->whereMonth('created_at', $month) - ->whereYear('created_at', $year) - ->first(); - - $workingDays = $previousRecord?->working_days ?? null; - - $productionPlan->update([ - 'plan_quantity' => $this->data['plan_quantity'], - 'working_days' => $workingDays, - 'operator_id' => $operatorName, - ]); - $productionPlan->save(); - - return null; - } } $recordDate = now(); @@ -198,8 +169,8 @@ class ProductionPlanImporter extends Importer $productionPlan1 = ProductionPlan::where('plant_id', $plant->id) ->where('line_id', $line) ->where('item_id', $itemAgaPlant->id) - ->whereYear('created_at', now()->year) - ->whereMonth('created_at', now()->month) + ->whereYear('created_at', $recordDate->year) + ->whereMonth('created_at', $recordDate->month) ->first(); if ($productionPlan1) {