resolved bug in production plan importer
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 14s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 16s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 13s
Laravel Pint / pint (pull_request) Successful in 6m57s
Laravel Larastan / larastan (pull_request) Failing after 9m14s

This commit is contained in:
dhanabalan
2026-10-06 11:11:31 +05:30
parent 3bf96c8ddb
commit a7c4a023d7

View File

@@ -132,24 +132,28 @@ class ProductionPlanImporter extends Importer
if(!$itemAgaPlant){ if(!$itemAgaPlant){
$warnMsg[] = 'Item not found against plant code'; $warnMsg[] = 'Item not found against plant code';
} }
else {
$line = $itemAgaPlant->line_id;
$line = $itemAgaPlant->line_id; if (!$line) {
$warnMsg[] = 'Line not mapped for that item code';
if(!$line){ }
$warnMsg[] = 'Line not mapped for that item code';
} }
$user = Filament::auth()->user(); $user = Filament::auth()->user();
$operatorName = $user->name; $operatorName = $user->name;
if (Str::length($this->data['plan_quantity']) < 0 || ! is_numeric($this->data['plan_quantity']) || $this->data['plan_quantity'] <= 0) { if (!empty($this->data['plan_quantity'])) {
$warnMsg[] = 'Invalid plan quantity found'; if (Str::length($this->data['plan_quantity']) < 0 || ! is_numeric($this->data['plan_quantity']) || $this->data['plan_quantity'] <= 0) {
$warnMsg[] = 'Invalid plan quantity found';
}
} }
if (! empty($warnMsg)) { if (! empty($warnMsg)) {
throw new RowImportFailedException(implode(', ', $warnMsg)); throw new RowImportFailedException(implode(', ', $warnMsg));
} else { } else {
$productionPlan = ProductionPlan::where('plant_id', $plant->id) $productionPlan = ProductionPlan::where('plant_id', $plant->id)
->where('line_id', $line) ->where('line_id', $line)
->where('item_id', $itemAgaPlant->id) ->where('item_id', $itemAgaPlant->id)