Commented item_id load functionality on resource page and process order import only if it has characteristics master #494

Merged
jothi merged 1 commits from ranjith-dev into master 2026-03-25 08:42:18 +00:00
2 changed files with 14 additions and 13 deletions

View File

@@ -240,17 +240,17 @@ class ProcessOrderImporter extends Importer
$warnMsg[] = 'Same Process Order already exists for this Plant with a different Item Code!';
}
$masterExist = ProductCharacteristicsMaster::where('plant_id', $plantId)->where('item_id', $itemId)->first();
// $masterExist = ProductCharacteristicsMaster::where('plant_id', $plantId)->where('item_id', $itemId)->first();
if (! $masterExist) {
$warnMsg[] = 'Characteristics master not found for the given plant!';
} else {
$masterExist = ProductCharacteristicsMaster::where('plant_id', $plantId)->where('line_id', $lineId)->where('item_id', $itemId)->first();
// if (! $masterExist) {
// $warnMsg[] = 'Characteristics master not found for the given plant!';
// } else {
// $masterExist = ProductCharacteristicsMaster::where('plant_id', $plantId)->where('line_id', $lineId)->where('item_id', $itemId)->first();
if (! $masterExist) {
$warnMsg[] = 'Characteristics master not found for the given line!';
}
}
// if (! $masterExist) {
// $warnMsg[] = 'Characteristics master not found for the given line!';
// }
// }
}
// $user = User::where('name', $this->data['created_by'])->first();

View File

@@ -131,14 +131,15 @@ class ProcessOrderResource extends Resource
->reactive()
->options(function (callable $get) {
$plantId = $get('plant_id');
$lineId = $get('line_id');
if (empty($plantId) || empty($lineId)) {
// $lineId = $get('line_id');
if (empty($plantId)) {// || empty($lineId)
return [];
}
$availItems = ProductCharacteristicsMaster::where('plant_id', $plantId)->where('line_id', $lineId)->pluck('item_id', 'item_id')->toArray();
// $availItems = ProductCharacteristicsMaster::where('plant_id', $plantId)->where('line_id', $lineId)->pluck('item_id', 'item_id')->toArray();
return Item::where('plant_id', $plantId)->whereIn('id', $availItems)->pluck('code', 'id'); // return Item::where('plant_id', $plantId)->pluck('code', 'id');
// return Item::where('plant_id', $plantId)->whereIn('id', $availItems)->pluck('code', 'id');
return Item::where('plant_id', $plantId)->pluck('code', 'id');
})
->disabled(fn (Get $get) => ! empty($get('id')))
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {