Merge pull request 'solved issue in production plan importer' (#1185) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 14s
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 14s
Reviewed-on: #1185
This commit was merged in pull request #1185.
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user