5 Commits

Author SHA1 Message Date
82c100162d Merge pull request 'ranjith-dev' (#415) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 15s
Reviewed-on: #415
2026-02-26 15:45:10 +00:00
dhanabalan
fe54de7ac8 Added hasMany relation on model file and item description on exporter file and commented unwanted warning msg, added disabled function on edit for plant, line, item columns in resource file
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 13s
Gemini PR Review / Gemini PR Review (pull_request) Failing after 20s
Laravel Pint / pint (pull_request) Successful in 3m7s
Laravel Larastan / larastan (pull_request) Failing after 3m53s
2026-02-26 21:14:02 +05:30
dhanabalan
1704761844 Updated rule parameters on unique item and setting default value and removed visible hide function
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
2026-02-26 20:18:18 +05:30
dhanabalan
0f29c0071c Updated validation logic for Product Characteristics Master import and setting default values
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
2026-02-26 20:13:38 +05:30
dhanabalan
5aec248632 Updated getCharMaster function validation on response
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
2026-02-26 19:02:57 +05:30
6 changed files with 164 additions and 94 deletions

View File

@@ -28,6 +28,8 @@ class ProcessOrderExporter extends Exporter
->label('LINE NAME'),
ExportColumn::make('item.code')
->label('ITEM CODE'),
ExportColumn::make('item.description')
->label('ITEM DESCRIPTION'),
ExportColumn::make('process_order')
->label('PROCESS ORDER'),
ExportColumn::make('coil_number')

View File

@@ -110,7 +110,7 @@ class ProductCharacteristicsMasterImporter extends Importer
$groupWorkCenter = trim($this->data['work_group_master_id']) ?? null;
$workCenter = trim($this->data['machine']) ?? null;
$charTyp = trim($this->data['characteristics_type']) ?? null;
$charName = trim($this->data['name']) ?? null;
$charNam = trim($this->data['name']) ?? null;
$inspectTyp = trim($this->data['inspection_type']) ?? null;
$lower = trim($this->data['lower']) ?? null;
$middle = trim($this->data['middle']) ?? null;
@@ -123,6 +123,7 @@ class ProductCharacteristicsMasterImporter extends Importer
$lineId = null;
$workGroupMasterId = null;
$machineId = null;
if ($plantCod == null || $plantCod == '') {
$warnMsg[] = "Plant code can't be empty!";
} elseif (Str::length($plantCod) < 4 || ! is_numeric($plantCod) || ! preg_match('/^[1-9]\d{3,}$/', $plantCod)) {
@@ -142,23 +143,19 @@ class ProductCharacteristicsMasterImporter extends Importer
if ($workCenter == null || $workCenter == '') {
$warnMsg[] = "Work center can't be empty!";
}
if ($charTyp == null || $charTyp == '') {
$warnMsg[] = "Characteristics type can't be empty!";
if ($charTyp != 'Product' && $charTyp != 'Process') {
$warnMsg[] = "Characteristics type must be either 'Product' or 'Process'!";
}
if ($charName == null || $charName == '') {
if ($charNam == null || $charNam == '') {
$warnMsg[] = "Characteristics name can't be empty!";
}
if ($inspectTyp == null || $inspectTyp == '') {
$warnMsg[] = "Inspection type can't be empty!";
if ($inspectTyp != 'Visual' && $inspectTyp != 'Value') {
$warnMsg[] = "Inspection type must be either 'Visual' or 'Value'!";
}
if ($lower == null || $lower == '') {
$warnMsg[] = "Lower value can't be empty!";
}
if ($middle == null || $middle == '') {
$warnMsg[] = "Middle value can't be empty!";
}
if ($upper == null || $upper == '') {
$warnMsg[] = "Upper value can't be empty!";
if ($lower == null || $lower == '' || $middle == null || $middle == '' || $upper == null || $upper == '' || $upper == 0 || $upper == '0') {
$lower = 0;
$middle = 0;
$upper = 0;
}
if (! empty($warnMsg)) {
@@ -229,12 +226,12 @@ class ProductCharacteristicsMasterImporter extends Importer
$machine = Machine::where('work_center', $workCenter)->where('plant_id', $plantId)->where('line_id', $lineId)->first();
if (! $machine) {
$warnMsg[] = 'Work center not found for the given line!';
$warnMsg[] = "Work center '{$workCenter}' is not mapped for the given line!";
} else {
$machine = Machine::where('work_center', $workCenter)->where('plant_id', $plantId)->where('line_id', $lineId)->where('work_group_master_id', $workGroupMasterId)->first();
if (! $machine) {
$warnMsg[] = 'Work center not found for the given group work center!';
$warnMsg[] = "Work center '{$workCenter}' is not mapped for the given group work center!";
} else {
$machineId = $machine->id;
}
@@ -259,17 +256,22 @@ class ProductCharacteristicsMasterImporter extends Importer
$warnMsg[] = 'Upper, Lower, and Middle values are required.';
} elseif (! is_numeric($upper) || ! is_numeric($lower) || ! is_numeric($middle)) {
$warnMsg[] = 'Upper, Lower, and Middle values must be numeric.';
} elseif ($lower == $upper) {
if ($lower != $middle) {
$warnMsg[] = "For 'Value' inspection type, values must satisfy: Lower = Middle = Upper.";
} else {
$lower = (float) $lower;
$middle = (float) $middle;
$upper = (float) $upper;
if ($lower == $upper) {
if ($lower != $middle) {
$warnMsg[] = "For 'Value' inspection type, values must satisfy: Lower = Middle = Upper.";
}
} elseif (! ($lower < $middle && $middle < $upper)) {
$warnMsg[] = "For 'Value' inspection type, values must satisfy: Lower < Middle < Upper.";
}
} elseif (! ($lower < $middle && $middle < $upper)) {
$warnMsg[] = "For 'Value' inspection type, values must satisfy: Lower < Middle < Upper.";
}
} else {
$lower = null;
$middle = null;
$upper = null;
$lower = 0;
$middle = 0;
$upper = 0;
}
}
@@ -278,10 +280,9 @@ class ProductCharacteristicsMasterImporter extends Importer
}
if ($machineId) {
$record = ProductCharacteristicsMaster::where('plant_id', $plantId)->where('line_id', $lineId)->where('work_group_master_id', $workGroupMasterId)->where('machine_id', $machineId)->where('item_id', $itemId)->first();
// ->where('characteristics_type', $get('characteristics_type'))
$record = ProductCharacteristicsMaster::where('plant_id', $plantId)->where('line_id', $lineId)->where('work_group_master_id', $workGroupMasterId)->where('machine_id', $machineId)->where('item_id', $itemId)->where('characteristics_type', $charTyp)->where('name', $charNam)->first();
if ($record) {
$createdBy = $record->created_by;
$createdBy = $record->created_by ?? $createdBy;
}
ProductCharacteristicsMaster::updateOrCreate(
@@ -291,11 +292,10 @@ class ProductCharacteristicsMasterImporter extends Importer
'line_id' => $lineId,
'work_group_master_id' => $workGroupMasterId,
'machine_id' => $machineId,
// 'characteristics_type' => $charTyp,
'characteristics_type' => $charTyp,
'name' => $charNam,
],
[
'name' => $charName,
'characteristics_type' => $charTyp,
'inspection_type' => $inspectTyp,
'lower' => $lower,
'middle' => $middle,

View File

@@ -50,14 +50,15 @@ class ProcessOrderResource extends Resource
return $form
->schema([
Forms\Components\Select::make('plant_id')
->label('Plant')
->searchable()
->label('Plant Name')
->relationship('plant', 'name')
->searchable()
->options(function (callable $get) {
$userHas = Filament::auth()->user()->plant_id;
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
})
->disabled(fn (Get $get) => ! empty($get('id')))
->default(function () {
$userHas = Filament::auth()->user()->plant_id;
@@ -93,7 +94,8 @@ class ProcessOrderResource extends Resource
->hintColor('danger')
->required(),
Forms\Components\Select::make('line_id')
->label('Line')
->label('Line Name')
->reactive()
->searchable()
->options(function (callable $get) {
$plantId = $get('plant_id');
@@ -103,7 +105,7 @@ class ProcessOrderResource extends Resource
return Line::where('plant_id', $plantId)->pluck('name', 'id');
})
->reactive()
->disabled(fn (Get $get) => ! empty($get('id')))
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
$set('item_id', null);
$set('item_description', null);
@@ -123,6 +125,7 @@ class ProcessOrderResource extends Resource
// ->relationship('item', 'id')
// ->required(),
->searchable()
->reactive()
->options(function (callable $get) {
$plantId = $get('plant_id');
if (empty($plantId)) {
@@ -131,7 +134,7 @@ class ProcessOrderResource extends Resource
return Item::where('plant_id', $plantId)->pluck('code', 'id');
})
->reactive()
->disabled(fn (Get $get) => ! empty($get('id')))
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
$plantId = $get('plant_id');
$itemId = $get('item_id');
@@ -166,9 +169,8 @@ class ProcessOrderResource extends Resource
$set('updated_by', Filament::auth()->user()?->name);
})
->required(),
Forms\Components\TextInput::make('item_description')
->label('Description')
->label('Item Description')
->readOnly()
->required()
->reactive()
@@ -187,7 +189,7 @@ class ProcessOrderResource extends Resource
$set('updated_by', Filament::auth()->user()?->name);
}),
Forms\Components\TextInput::make('item_uom')
->label('UOM')
->label('Item UOM')
->readOnly()
->required()
->reactive()
@@ -262,12 +264,11 @@ class ProcessOrderResource extends Resource
->first();
if ($existing) {
Notification::make()
->title('Duplicate Process Order!')
->body("Process Order '{$value}' is already exist with item code '{$existing->item->code}'.")
->danger()
->send();
// Notification::make()
// ->title('Duplicate Process Order!')
// ->body("Process Order '{$value}' is already exist with item code '{$existing->item->code}'.")
// ->danger()
// ->send();
$fail("process order already exists for this plant and item code '{$existing->item->code}'.");
}
};
@@ -445,7 +446,7 @@ class ProcessOrderResource extends Resource
->hint(fn ($get) => $get('sfgNumberError') ? $get('sfgNumberError') : null)
->hintColor('danger'),
Forms\Components\TextInput::make('machine_name')
->label('Machine ID')
->label('Machine Name')
->reactive()
->readOnly(fn ($get) => ($get('process_order') == null))
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
@@ -680,27 +681,27 @@ class ProcessOrderResource extends Resource
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
}),
Tables\Columns\TextColumn::make('plant.name')
->label('Plant')
->label('Plant Name')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('line.name')
->label('Line')
->label('Line Name')
->searchable()
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('item.code')
->label('Item')
->label('Item Code')
->searchable()
->alignCenter()
->sortable(),
Tables\Columns\TextColumn::make('item.description')
->label('Description')
->label('Item Description')
->alignCenter()
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('item.uom')
->label('Uom')
->label('Item UOM')
->alignCenter()
->searchable()
->sortable(),
@@ -735,7 +736,7 @@ class ProcessOrderResource extends Resource
->searchable()
->sortable(),
Tables\Columns\TextColumn::make('machine_name')
->label('Machine ID')
->label('Machine Name')
->alignCenter()
->searchable()
->sortable(),
@@ -778,16 +779,35 @@ class ProcessOrderResource extends Resource
->label('Advanced Filters')
->form([
Select::make('Plant')
->label('Select Plant Name')
->label('Search by Plant Name')
->nullable()
->searchable()
->reactive()
->options(function (callable $get) {
$userHas = Filament::auth()->user()->plant_id;
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
})
->reactive()
->afterStateUpdated(function ($state, callable $set, callable $get) {
$set('Item', null);
$set('Line', null);
}),
Select::make('Line')
->label('Search by Line Name')
->nullable()
->searchable()
->reactive()
->options(function (callable $get) {
$plantId = $get('Plant');
return Line::whereHas('processOrders', function ($query) use ($plantId) {
if ($plantId) {
$query->where('plant_id', $plantId);
}
})->pluck('name', 'id');
})
->afterStateUpdated(function ($state, callable $set, callable $get) {
$set('process_order', null);
}),
Select::make('Item')
->label('Search by Item Code')
@@ -847,7 +867,7 @@ class ProcessOrderResource extends Resource
])
->query(function ($query, array $data) {
// Hide all records initially if no filters are applied
if (empty($data['Plant']) && empty($data['Item']) && empty($data['process_order']) && Str::length($data['coil_number']) <= 0 && empty($data['sfg_number']) && empty($data['machine_name']) && ($data['rework_status'] == null || $data['rework_status'] == '') && empty($data['created_from']) && empty($data['created_to'])) {
if (empty($data['Plant']) && empty($data['Line']) && empty($data['Item']) && empty($data['process_order']) && Str::length($data['coil_number']) <= 0 && empty($data['sfg_number']) && empty($data['machine_name']) && ($data['rework_status'] == null || $data['rework_status'] == '') && empty($data['created_from']) && empty($data['created_to'])) {
return $query->whereRaw('1 = 0');
}
@@ -861,6 +881,10 @@ class ProcessOrderResource extends Resource
}
}
if (! empty($data['Line'])) {
$query->where('line_id', $data['Line']);
}
if (! empty($data['Item'])) {
$query->where('item_id', $data['Item']);
}
@@ -905,12 +929,16 @@ class ProcessOrderResource extends Resource
$userHas = Filament::auth()->user()->plant_id;
if ($userHas && strlen($userHas) > 0) {
return 'Plant: Choose plant to filter records.';
return 'Plant Name: Choose plant to filter records.';
}
}
if (! empty($data['Line'])) {
$indicators[] = 'Line Name: '.Line::where('id', $data['Line'])->value('name');
}
if (! empty($data['Item'])) {
$indicators[] = 'Item: '.Item::where('id', $data['Item'])->value('code');
$indicators[] = 'Item Code: '.Item::where('id', $data['Item'])->value('code');
}
if (! empty($data['process_order'])) {

View File

@@ -86,7 +86,8 @@ class ProductCharacteristicsMasterResource extends Resource
->where('line_id', $get('line_id'))
->where('work_group_master_id', $get('work_group_master_id'))
->where('machine_id', $get('machine_id'))
// ->where('characteristics_type', $get('characteristics_type'))
->where('characteristics_type', $get('characteristics_type'))
->where('name', $get('name'))
->ignore($get('id'));
},
// function (callable $get): Closure {
@@ -227,6 +228,11 @@ class ProductCharacteristicsMasterResource extends Resource
// ->preload()
->disabled(fn (Get $get) => ! empty($get('id') && ! Filament::auth()->user()->hasRole('Super Admin')))
->afterStateUpdated(function ($state, callable $set) {
if ($state == 'Visual') {
$set('lower', 0);
$set('middle', 0);
$set('upper', 0);
}
$set('updated_by', Filament::auth()->user()?->name);
})
->required(),
@@ -259,7 +265,8 @@ class ProductCharacteristicsMasterResource extends Resource
$set('middle', ($state + $get('upper')) / 2);
$set('updated_by', Filament::auth()->user()?->name);
})
->visible(fn (callable $get) => $get('inspection_type') == 'Value'),
// ->visible(fn (callable $get) => $get('inspection_type') == 'Value')
->readOnly(fn (callable $get) => $get('inspection_type') != 'Value'),
Forms\Components\TextInput::make('upper')
->label('Upper')
->numeric()
@@ -272,7 +279,8 @@ class ProductCharacteristicsMasterResource extends Resource
$set('middle', ($get('lower') + $state) / 2);
$set('updated_by', Filament::auth()->user()?->name);
})
->visible(fn (callable $get) => $get('inspection_type') == 'Value'),
// ->visible(fn (callable $get) => $get('inspection_type') == 'Value')
->readOnly(fn (callable $get) => $get('inspection_type') != 'Value'),
Forms\Components\TextInput::make('middle')
->label('Middle')
->readOnly()
@@ -295,8 +303,8 @@ class ProductCharacteristicsMasterResource extends Resource
->dehydrateStateUsing(fn ($state, Get $get) => ($get('lower') + $get('upper')) / 2)
->afterStateUpdated(function ($state, callable $set) {
$set('updated_by', Filament::auth()->user()?->name);
})
->visible(fn (callable $get) => $get('inspection_type') == 'Value'),
}),
// ->visible(fn (callable $get) => $get('inspection_type') == 'Value'),
Forms\Components\Hidden::make('created_by')
->label('Created By')
->default(Filament::auth()->user()?->name),

View File

@@ -167,6 +167,7 @@ class CharacteristicsController extends Controller
// ];
// return response()->json($response);
foreach ($characteristics as $char) {
$line = Line::find($char->line_id);
@@ -203,7 +204,6 @@ class CharacteristicsController extends Controller
return response()->json([
'items' => $items,
]);
}
/**
@@ -2231,62 +2231,89 @@ class CharacteristicsController extends Controller
], 404);
}
$lineAgaPlant = Line::where('plant_id', $plantId)->where('name', $lineName)->first();
$line = Line::where('plant_id', $plantId)->where('name', $lineName)->first();
if (! $lineAgaPlant) {
if (! $line) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Line Name not found in lines table for the plant : '$plant->name'!",
], 404);
}
$work = Machine::where('work_center', $workCenter)->first();
$lineId = $line->id;
if (! $work) {
$machine = Machine::where('work_center', $workCenter)->first();
if (! $machine) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Work Center not found in machines table!',
], 404);
}
$workAgaPlant = Machine::where('plant_id', $plantId)->where('work_center', $workCenter)->first();
$machine = Machine::where('plant_id', $plantId)->where('work_center', $workCenter)->first();
if (! $workAgaPlant) {
if (! $machine) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Work center not found in machines table for the plant : '$plant->name'!",
], 404);
}
$machine = Machine::where('plant_id', $plantId)->where('line_id', $lineId)->where('work_center', $workCenter)->first();
if (! $machine) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Work center is not mapped for the given line!',
], 404);
}
$machineId = $machine->id;
// $description = $item ? $item->description : '';
// $uom = $item ? $item->uom : '';
// $category = $item ? $item->category : '';
$charMaster = ProductCharacteristicsMaster::where('plant_id', $plantId)->where('item_id', $ItemId)
->where('line_id', $lineAgaPlant->id)->where('machine_id', $workAgaPlant->id)
->first();
$charMasters = ProductCharacteristicsMaster::with('workGroupMaster')->where('plant_id', $plantId)->where('item_id', $ItemId)->where('line_id', $lineId)->where('machine_id', $machineId)->get(); // ->select(['name', 'characteristics_type', 'inspection_type', 'lower', 'middle', 'upper', 'work_group_master_id'])
if (! $charMaster) {
if (! $charMasters) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Characteristics not found in product master table for the plant : '$plant->name'!",
], 404);
} else {
$output = $charMasters->map(function ($charMast) {
$charMaster = [
'work_group_master' => optional($charMast->workGroupMaster)->name ?? '',
'name' => $charMast?->name ?? '',
'characteristics_type' => $charMast?->characteristics_type ?? '',
'inspection_type' => $charMast?->inspection_type ?? '',
'lower' => (string) $charMast?->lower ?? '',
'middle' => (string) $charMast?->middle ?? '',
'upper' => (string) $charMast?->upper ?? '',
];
return $charMaster;
});
}
$workGroup = WorkGroupMaster::find($charMaster->work_group_master_id);
$workGroupName = $workGroup?->name ?? '';
// $charMasters = ProductCharacteristicsMaster::with('workGroupMaster')->where('plant_id', $plantId)->where('item_id', $ItemId)->where('line_id', $lineId)->where('machine_id', $machineId)->first();
$output = [
'work_group_master' => $workGroupName ?? '',
'name' => $charMaster?->name ?? '',
'characteristics_type' => $charMaster?->characteristics_type ?? '',
'inspection_type' => $charMaster?->inspection_type ?? '',
'lower' => (string) $charMaster?->lower ?? '',
'middle' => (string) $charMaster?->middle ?? '',
'upper' => (string) $charMaster?->upper ?? '',
];
// // $workGroup = WorkGroupMaster::find($charMasters->work_group_master_id);
// // $workGroupName = $workGroup?->name ?? '';
// $output = [
// 'work_group_master' => $charMasters?->workGroupMaster->name ?? '', // $workGroupName ?? '',
// 'name' => $charMasters?->name ?? '',
// 'characteristics_type' => $charMasters?->characteristics_type ?? '',
// 'inspection_type' => $charMasters?->inspection_type ?? '',
// 'lower' => (string) $charMasters?->lower ?? '',
// 'middle' => (string) $charMasters?->middle ?? '',
// 'upper' => (string) $charMasters?->upper ?? '',
// ];
return response()->json($output, 200);
}
@@ -2347,15 +2374,15 @@ class CharacteristicsController extends Controller
], 404);
}
$lineAgaPlant = Line::where('plant_id', $plantId)->where('name', $lineName)->first();
if (! $lineAgaPlant) {
$line = Line::where('plant_id', $plantId)->where('name', $lineName)->first();
if (! $line) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Line '{$lineName}' not found against plant code '$plantCode'!",
], 404);
}
$lineId = $lineAgaPlant->id;
$lineId = $line->id;
if ($itemCode == null || $itemCode == '') {
return response()->json([
@@ -2372,15 +2399,15 @@ class CharacteristicsController extends Controller
], 404);
}
$itemAgaPlant = Item::where('plant_id', $plantId)->where('code', $itemCode)->first();
if (! $itemAgaPlant) {
$item = Item::where('plant_id', $plantId)->where('code', $itemCode)->first();
if (! $item) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Item code '{$itemCode}' not found against plant code '$plantCode'!",
], 404);
}
$itemId = $itemAgaPlant->id;
$itemId = $item->id;
if ($workCenter == null || $workCenter == '') {
return response()->json([
@@ -2397,23 +2424,23 @@ class CharacteristicsController extends Controller
], 404);
}
$machineAgaPlant = Machine::where('plant_id', $plantId)->where('work_center', $workCenter)->first();
if (! $machineAgaPlant) {
$machine = Machine::where('plant_id', $plantId)->where('work_center', $workCenter)->first();
if (! $machine) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Work center '{$workCenter}' not found against plant code '$plantCode'!",
], 404);
}
$machineAgaPlantLine = Machine::where('plant_id', $plantId)->where('line_id', $lineId)->where('work_center', $workCenter)->first();
if (! $machineAgaPlantLine) {
$machine = Machine::where('plant_id', $plantId)->where('line_id', $lineId)->where('work_center', $workCenter)->first();
if (! $machine) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Work center '{$workCenter}' not found against plant code '$plantCode' and line name '$lineName'!",
], 404);
}
$machineId = $machineAgaPlantLine->id;
$machineId = $machine->id;
$data = $request->all();

View File

@@ -51,6 +51,11 @@ class Line extends Model
return $this->belongsTo(WorkGroupMaster::class);
}
public function processOrders()
{
return $this->hasMany(ProcessOrder::class);
}
public function workGroup1()
{
return $this->belongsTo(WorkGroupMaster::class, 'work_group1_id', 'id');