Changed logic in production quantity page #182

Merged
jothi merged 1 commits from ranjith-dev into master 2026-02-16 06:59:15 +00:00

View File

@@ -8,6 +8,7 @@ use App\Models\Machine;
use App\Models\Plant; use App\Models\Plant;
use App\Models\ProductionQuantity; use App\Models\ProductionQuantity;
use App\Models\Shift; use App\Models\Shift;
use App\Models\Block;
use Carbon\Carbon; use Carbon\Carbon;
use Filament\Facades\Filament; use Filament\Facades\Filament;
use Filament\Forms\Components\Hidden; use Filament\Forms\Components\Hidden;
@@ -1296,6 +1297,8 @@ class ProductionQuantityPage extends Page implements HasForms
$machine = Machine::where('work_center', $this->mId)->where('plant_id', $this->pId)->first(); $machine = Machine::where('work_center', $this->mId)->where('plant_id', $this->pId)->first();
$workCenter = $this->mId;
if (!$machine) { if (!$machine) {
Notification::make() Notification::make()
->title('Unknown Machine') ->title('Unknown Machine')
@@ -1350,13 +1353,21 @@ class ProductionQuantityPage extends Page implements HasForms
$this->iId = null; $this->iId = null;
// Get line + block in one shot
$line = Line::with('block')->find($lineId);
$lineName = $line?->name;
$blockName = $line?->block?->name;
$shiftName = $shift?->name;
// after success insertion // after success insertion
$this->form->fill([ $this->form->fill([
'plant_id'=> $this->pId, 'plant_id'=> $this->pId,
'block_name'=> $this->bId, 'machine_id'=> $workCenter,
'shift_id'=> $this->sId, 'block_name'=> $blockName,
'line_id'=> $this->lId, 'shift_id'=> $shiftName,
'line_id'=> $lineName,
'item_id'=> null, 'item_id'=> null,
//'item_code'=> null, //'item_code'=> null,
'serial_number'=> null, 'serial_number'=> null,