Merge pull request 'ranjith-dev' (#1158) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 26s
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 26s
Reviewed-on: #1158
This commit was merged in pull request #1158.
This commit is contained in:
@@ -28,16 +28,18 @@ class TestingPanelReadingExporter extends Exporter
|
|||||||
->label('PLANT CODE'),
|
->label('PLANT CODE'),
|
||||||
ExportColumn::make('line.name')
|
ExportColumn::make('line.name')
|
||||||
->label('LINE NAME'),
|
->label('LINE NAME'),
|
||||||
ExportColumn::make('machine.name')
|
ExportColumn::make('machine.workGroupMaster.name')
|
||||||
->label('MACHINE NAME'),
|
->label('GROUP WORK CENTER'),
|
||||||
|
ExportColumn::make('machine.work_center')
|
||||||
|
->label('WORK CENTER'),
|
||||||
ExportColumn::make('motorTestingMaster.item.code')
|
ExportColumn::make('motorTestingMaster.item.code')
|
||||||
->label('ITEM CODE'),
|
->label('ITEM CODE'),
|
||||||
ExportColumn::make('motorTestingMaster.item.description')
|
ExportColumn::make('motorTestingMaster.item.description')
|
||||||
->label('MODEL DESCRIPTION'),
|
->label('MODEL DESCRIPTION'),
|
||||||
ExportColumn::make('output')
|
ExportColumn::make('output')
|
||||||
->label('OUTPUT NAME'),
|
->label('OUTPUT ID'),
|
||||||
ExportColumn::make('serial_number')
|
ExportColumn::make('serial_number')
|
||||||
->label('SERIAL NUMBER'),
|
->label('MOTOR SERIAL NUMBER'),
|
||||||
ExportColumn::make('winded_serial_number')
|
ExportColumn::make('winded_serial_number')
|
||||||
->label('WINDED SERIAL NUMBER'),
|
->label('WINDED SERIAL NUMBER'),
|
||||||
ExportColumn::make('motorTestingMaster.kw')
|
ExportColumn::make('motorTestingMaster.kw')
|
||||||
@@ -51,7 +53,7 @@ class TestingPanelReadingExporter extends Exporter
|
|||||||
ExportColumn::make('motorTestingMaster.isi_model')
|
ExportColumn::make('motorTestingMaster.isi_model')
|
||||||
->label('ISI MODEL'),
|
->label('ISI MODEL'),
|
||||||
ExportColumn::make('before_fr_volt')
|
ExportColumn::make('before_fr_volt')
|
||||||
->label('BEFORE FR VOLT'),
|
->label('BEFORE FR VOLTAGE'),
|
||||||
ExportColumn::make('before_fr_cur')
|
ExportColumn::make('before_fr_cur')
|
||||||
->label('BEFORE FR CURRENT'),
|
->label('BEFORE FR CURRENT'),
|
||||||
ExportColumn::make('before_fr_pow')
|
ExportColumn::make('before_fr_pow')
|
||||||
@@ -75,7 +77,7 @@ class TestingPanelReadingExporter extends Exporter
|
|||||||
ExportColumn::make('before_fr_speed')
|
ExportColumn::make('before_fr_speed')
|
||||||
->label('BEFORE FR SPEED'),
|
->label('BEFORE FR SPEED'),
|
||||||
ExportColumn::make('after_fr_vol')
|
ExportColumn::make('after_fr_vol')
|
||||||
->label('AFTER FR VOLT'),
|
->label('AFTER FR VOLTAGE'),
|
||||||
ExportColumn::make('after_fr_cur')
|
ExportColumn::make('after_fr_cur')
|
||||||
->label('AFTER FR CURRENT'),
|
->label('AFTER FR CURRENT'),
|
||||||
ExportColumn::make('after_fr_pow')
|
ExportColumn::make('after_fr_pow')
|
||||||
@@ -103,13 +105,13 @@ class TestingPanelReadingExporter extends Exporter
|
|||||||
ExportColumn::make('after_fr_leak_cur')
|
ExportColumn::make('after_fr_leak_cur')
|
||||||
->label('AFTER FR LEAK CURRENT'),
|
->label('AFTER FR LEAK CURRENT'),
|
||||||
ExportColumn::make('locked_rt_volt')
|
ExportColumn::make('locked_rt_volt')
|
||||||
->label('LOCKED RT VOLT'),
|
->label('LOCKED RT VOLTAGE'),
|
||||||
ExportColumn::make('locked_rt_cur')
|
ExportColumn::make('locked_rt_cur')
|
||||||
->label('LOCKED RT CURRENT'),
|
->label('LOCKED RT CURRENT'),
|
||||||
ExportColumn::make('locked_rt_pow')
|
ExportColumn::make('locked_rt_pow')
|
||||||
->label('LOCKED RT POWER'),
|
->label('LOCKED RT POWER'),
|
||||||
ExportColumn::make('no_load_pickup_volt')
|
ExportColumn::make('no_load_pickup_volt')
|
||||||
->label('NO LOAD PICKUP VOLT'),
|
->label('NO LOAD PICKUP VOLTAGE'),
|
||||||
ExportColumn::make('room_temperature')
|
ExportColumn::make('room_temperature')
|
||||||
->label('ROOM TEMPERATURE'),
|
->label('ROOM TEMPERATURE'),
|
||||||
ExportColumn::make('hv_test')
|
ExportColumn::make('hv_test')
|
||||||
@@ -124,6 +126,8 @@ class TestingPanelReadingExporter extends Exporter
|
|||||||
->label('REMARK'),
|
->label('REMARK'),
|
||||||
ExportColumn::make('rework_count')
|
ExportColumn::make('rework_count')
|
||||||
->label('REWORK COUNT'),
|
->label('REWORK COUNT'),
|
||||||
|
ExportColumn::make('rework_winded')
|
||||||
|
->label('REWORK WINDED STATUS'),
|
||||||
ExportColumn::make('update_count')
|
ExportColumn::make('update_count')
|
||||||
->label('UPDATED COUNT'),
|
->label('UPDATED COUNT'),
|
||||||
ExportColumn::make('output_flag')
|
ExportColumn::make('output_flag')
|
||||||
|
|||||||
@@ -14,88 +14,283 @@ class TestingPanelReadingImporter extends Importer
|
|||||||
public static function getColumns(): array
|
public static function getColumns(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
ImportColumn::make('machine')
|
ImportColumn::make('plant')
|
||||||
->requiredMapping()
|
->requiredMapping()
|
||||||
|
->label('PLANT CODE')
|
||||||
|
->exampleHeader('PLANT CODE')
|
||||||
|
->example(['1000'])
|
||||||
|
->relationship(resolveUsing: 'code')
|
||||||
|
->rules(['required']),
|
||||||
|
ImportColumn::make('line')
|
||||||
|
->requiredMapping()
|
||||||
|
->label('LINE NAME')
|
||||||
|
->exampleHeader('LINE NAME')
|
||||||
|
->example(['4 inch pump line'])
|
||||||
|
->relationship(resolveUsing: 'name')
|
||||||
|
->rules(['required']),
|
||||||
|
ImportColumn::make('machine.workGroupMaster.name')
|
||||||
|
->requiredMapping()
|
||||||
|
->label('GROUP WORK CENTER')
|
||||||
|
->exampleHeader('GROUP WORK CENTER')
|
||||||
|
->example('TESTGMG01')
|
||||||
->relationship()
|
->relationship()
|
||||||
->rules(['required']),
|
->rules(['required']),
|
||||||
|
ImportColumn::make('machine.work_center')
|
||||||
|
->requiredMapping()
|
||||||
|
->label('WORK CENTER')
|
||||||
|
->exampleHeader('WORK CENTER')
|
||||||
|
->example('TESTIMG01')
|
||||||
|
->relationship() // resolveUsing: 'work_center'
|
||||||
|
->rules(['required']),
|
||||||
ImportColumn::make('motorTestingMaster.item.code')
|
ImportColumn::make('motorTestingMaster.item.code')
|
||||||
->requiredMapping()
|
->requiredMapping()
|
||||||
|
->label('ITEM CODE')
|
||||||
|
->exampleHeader('ITEM CODE')
|
||||||
|
->example('ITEM001')
|
||||||
->relationship()
|
->relationship()
|
||||||
->rules(['required']),
|
->rules(['required']),
|
||||||
ImportColumn::make('output')
|
ImportColumn::make('output')
|
||||||
->requiredMapping()
|
->requiredMapping()
|
||||||
|
->label('OUTPUT ID')
|
||||||
|
->exampleHeader('OUTPUT ID')
|
||||||
|
->example('Output1')
|
||||||
->rules(['required']),
|
->rules(['required']),
|
||||||
ImportColumn::make('serial_number')
|
ImportColumn::make('serial_number')
|
||||||
->requiredMapping()
|
->requiredMapping()
|
||||||
|
->label('MOTOR SERIAL NUMBER')
|
||||||
|
->exampleHeader('MOTOR SERIAL NUMBER')
|
||||||
|
->example('12345678901234')
|
||||||
->rules(['required']),
|
->rules(['required']),
|
||||||
ImportColumn::make('winded_serial_number')
|
ImportColumn::make('winded_serial_number')
|
||||||
->requiredMapping()
|
->requiredMapping()
|
||||||
|
->label('WINDED SERIAL NUMBER')
|
||||||
|
->exampleHeader('WINDED SERIAL NUMBER')
|
||||||
|
->example('98765432101234')
|
||||||
|
->rules(['required']),
|
||||||
|
ImportColumn::make('before_fr_volt')
|
||||||
|
->requiredMapping()
|
||||||
|
->label('BEFORE FR VOLTAGE')
|
||||||
|
->exampleHeader('BEFORE FR VOLTAGE')
|
||||||
|
->example('0'),
|
||||||
|
ImportColumn::make('before_fr_cur')
|
||||||
|
->requiredMapping()
|
||||||
|
->label('BEFORE FR CURRENT')
|
||||||
|
->exampleHeader('BEFORE FR CURRENT')
|
||||||
|
->example('0'),
|
||||||
|
ImportColumn::make('before_fr_pow')
|
||||||
|
->requiredMapping()
|
||||||
|
->label('BEFORE FR POWER')
|
||||||
|
->exampleHeader('BEFORE FR POWER')
|
||||||
|
->example('0'),
|
||||||
|
ImportColumn::make('before_fr_res_ry')
|
||||||
|
->requiredMapping()
|
||||||
|
->label('BEFORE FR RESISTANCE RY')
|
||||||
|
->exampleHeader('BEFORE FR RESISTANCE RY')
|
||||||
|
->example('0'),
|
||||||
|
ImportColumn::make('before_fr_res_yb')
|
||||||
|
->requiredMapping()
|
||||||
|
->label('BEFORE FR RESISTANCE YB')
|
||||||
|
->exampleHeader('BEFORE FR RESISTANCE YB')
|
||||||
|
->example('0'),
|
||||||
|
ImportColumn::make('before_fr_res_br')
|
||||||
|
->requiredMapping()
|
||||||
|
->label('BEFORE FR RESISTANCE BR')
|
||||||
|
->exampleHeader('BEFORE FR RESISTANCE BR')
|
||||||
|
->example('0'),
|
||||||
|
ImportColumn::make('before_fr_ir')
|
||||||
|
->requiredMapping()
|
||||||
|
->label('BEFORE FR IR')
|
||||||
|
->exampleHeader('BEFORE FR IR')
|
||||||
|
->example('0'),
|
||||||
|
ImportColumn::make('before_fr_ir_r')
|
||||||
|
->requiredMapping()
|
||||||
|
->label('BEFORE FR IR R')
|
||||||
|
->exampleHeader('BEFORE FR IR R')
|
||||||
|
->example('0'),
|
||||||
|
ImportColumn::make('before_fr_ir_y')
|
||||||
|
->requiredMapping()
|
||||||
|
->label('BEFORE FR IR Y')
|
||||||
|
->exampleHeader('BEFORE FR IR Y')
|
||||||
|
->example('0'),
|
||||||
|
ImportColumn::make('before_fr_ir_b')
|
||||||
|
->requiredMapping()
|
||||||
|
->label('BEFORE FR IR B')
|
||||||
|
->exampleHeader('BEFORE FR IR B')
|
||||||
|
->example('0'),
|
||||||
|
ImportColumn::make('before_fr_freq')
|
||||||
|
->requiredMapping()
|
||||||
|
->label('BEFORE FR FREQUENCY')
|
||||||
|
->exampleHeader('BEFORE FR FREQUENCY')
|
||||||
|
->example('0'),
|
||||||
|
ImportColumn::make('before_fr_speed')
|
||||||
|
->requiredMapping()
|
||||||
|
->label('BEFORE FR SPEED')
|
||||||
|
->exampleHeader('BEFORE FR SPEED')
|
||||||
|
->example('0'),
|
||||||
|
ImportColumn::make('after_fr_vol')
|
||||||
|
->requiredMapping()
|
||||||
|
->label('AFTER FR VOLTAGE')
|
||||||
|
->exampleHeader('AFTER FR VOLTAGE')
|
||||||
|
->example('0'),
|
||||||
|
ImportColumn::make('after_fr_cur')
|
||||||
|
->requiredMapping()
|
||||||
|
->label('AFTER FR CURRENT')
|
||||||
|
->exampleHeader('AFTER FR CURRENT')
|
||||||
|
->example('0'),
|
||||||
|
ImportColumn::make('after_fr_pow')
|
||||||
|
->requiredMapping()
|
||||||
|
->label('AFTER FR POWER')
|
||||||
|
->exampleHeader('AFTER FR POWER')
|
||||||
|
->example('0'),
|
||||||
|
ImportColumn::make('after_fr_ir_hot')
|
||||||
|
->requiredMapping()
|
||||||
|
->label('AFTER FR IR HOT')
|
||||||
|
->exampleHeader('AFTER FR IR HOT')
|
||||||
|
->example('0'),
|
||||||
|
ImportColumn::make('after_fr_ir_hot_r')
|
||||||
|
->requiredMapping()
|
||||||
|
->label('AFTER FR IR HOT R')
|
||||||
|
->exampleHeader('AFTER FR IR HOT R')
|
||||||
|
->example('0'),
|
||||||
|
ImportColumn::make('after_fr_ir_hot_y')
|
||||||
|
->requiredMapping()
|
||||||
|
->label('AFTER FR IR HOT Y')
|
||||||
|
->exampleHeader('AFTER FR IR HOT Y')
|
||||||
|
->example('0'),
|
||||||
|
ImportColumn::make('after_fr_ir_hot_b')
|
||||||
|
->requiredMapping()
|
||||||
|
->label('AFTER FR IR HOT B')
|
||||||
|
->exampleHeader('AFTER FR IR HOT B')
|
||||||
|
->example('0'),
|
||||||
|
ImportColumn::make('after_fr_ir_cool')
|
||||||
|
->requiredMapping()
|
||||||
|
->label('AFTER FR IR COOL')
|
||||||
|
->exampleHeader('AFTER FR IR COOL')
|
||||||
|
->example('0'),
|
||||||
|
ImportColumn::make('after_fr_ir_cool_r')
|
||||||
|
->requiredMapping()
|
||||||
|
->label('AFTER FR IR COOL R')
|
||||||
|
->exampleHeader('AFTER FR IR COOL R')
|
||||||
|
->example('0'),
|
||||||
|
ImportColumn::make('after_fr_ir_cool_y')
|
||||||
|
->requiredMapping()
|
||||||
|
->label('AFTER FR IR COOL Y')
|
||||||
|
->exampleHeader('AFTER FR IR COOL Y')
|
||||||
|
->example('0'),
|
||||||
|
ImportColumn::make('after_fr_ir_cool_b')
|
||||||
|
->requiredMapping()
|
||||||
|
->label('AFTER FR IR COOL B')
|
||||||
|
->exampleHeader('AFTER FR IR COOL B')
|
||||||
|
->example('0'),
|
||||||
|
ImportColumn::make('after_fr_freq')
|
||||||
|
->requiredMapping()
|
||||||
|
->label('AFTER FR FREQUENCY')
|
||||||
|
->exampleHeader('AFTER FR FREQUENCY')
|
||||||
|
->example('0'),
|
||||||
|
ImportColumn::make('after_fr_speed')
|
||||||
|
->requiredMapping()
|
||||||
|
->label('AFTER FR SPEED')
|
||||||
|
->exampleHeader('AFTER FR SPEED')
|
||||||
|
->example('0'),
|
||||||
|
ImportColumn::make('after_fr_leak_cur')
|
||||||
|
->requiredMapping()
|
||||||
|
->label('AFTER FR LEAK CURRENT')
|
||||||
|
->exampleHeader('AFTER FR LEAK CURRENT')
|
||||||
|
->example('0'),
|
||||||
|
ImportColumn::make('locked_rt_volt')
|
||||||
|
->requiredMapping()
|
||||||
|
->label('LOCKED RT VOLTAGE')
|
||||||
|
->exampleHeader('LOCKED RT VOLTAGE')
|
||||||
|
->example('0'),
|
||||||
|
ImportColumn::make('locked_rt_cur')
|
||||||
|
->requiredMapping()
|
||||||
|
->label('LOCKED RT CURRENT')
|
||||||
|
->exampleHeader('LOCKED RT CURRENT')
|
||||||
|
->example('0'),
|
||||||
|
ImportColumn::make('locked_rt_pow')
|
||||||
|
->requiredMapping()
|
||||||
|
->label('LOCKED RT POWER')
|
||||||
|
->exampleHeader('LOCKED RT POWER')
|
||||||
|
->example('0'),
|
||||||
|
ImportColumn::make('no_load_pickup_volt')
|
||||||
|
->requiredMapping()
|
||||||
|
->label('NO LOAD PICKUP VOLTAGE')
|
||||||
|
->exampleHeader('NO LOAD PICKUP VOLTAGE')
|
||||||
|
->example('0'),
|
||||||
|
ImportColumn::make('room_temperature')
|
||||||
|
->requiredMapping()
|
||||||
|
->label('ROOM TEMPERATURE')
|
||||||
|
->exampleHeader('ROOM TEMPERATURE')
|
||||||
|
->example('0'),
|
||||||
|
ImportColumn::make('hv_test')
|
||||||
|
->requiredMapping()
|
||||||
|
->label('HIGH VOLTAGE TEST')
|
||||||
|
->exampleHeader('HIGH VOLTAGE TEST')
|
||||||
|
->example('Not With Stood')
|
||||||
|
->rules(['required']),
|
||||||
|
ImportColumn::make('batch_number')
|
||||||
|
->requiredMapping()
|
||||||
|
->label('BATCH NUMBER')
|
||||||
|
->exampleHeader('BATCH NUMBER')
|
||||||
|
->example('261231B001')
|
||||||
->rules(['required']),
|
->rules(['required']),
|
||||||
ImportColumn::make('before_fr_volt'),
|
|
||||||
ImportColumn::make('before_fr_cur'),
|
|
||||||
ImportColumn::make('before_fr_pow'),
|
|
||||||
ImportColumn::make('before_fr_res_ry'),
|
|
||||||
ImportColumn::make('before_fr_res_yb'),
|
|
||||||
ImportColumn::make('before_fr_res_br'),
|
|
||||||
ImportColumn::make('before_fr_ir'),
|
|
||||||
ImportColumn::make('before_fr_ir_r'),
|
|
||||||
ImportColumn::make('before_fr_ir_y'),
|
|
||||||
ImportColumn::make('before_fr_ir_b'),
|
|
||||||
ImportColumn::make('before_fr_freq'),
|
|
||||||
ImportColumn::make('before_fr_speed'),
|
|
||||||
ImportColumn::make('after_fr_vol'),
|
|
||||||
ImportColumn::make('after_fr_cur'),
|
|
||||||
ImportColumn::make('after_fr_pow'),
|
|
||||||
ImportColumn::make('after_fr_ir_hot'),
|
|
||||||
ImportColumn::make('after_fr_ir_hot_r'),
|
|
||||||
ImportColumn::make('after_fr_ir_hot_y'),
|
|
||||||
ImportColumn::make('after_fr_ir_hot_b'),
|
|
||||||
ImportColumn::make('after_fr_ir_cool'),
|
|
||||||
ImportColumn::make('after_fr_ir_cool_r'),
|
|
||||||
ImportColumn::make('after_fr_ir_cool_y'),
|
|
||||||
ImportColumn::make('after_fr_ir_cool_b'),
|
|
||||||
ImportColumn::make('after_fr_freq'),
|
|
||||||
ImportColumn::make('after_fr_speed'),
|
|
||||||
ImportColumn::make('after_fr_leak_cur'),
|
|
||||||
ImportColumn::make('locked_rt_volt'),
|
|
||||||
ImportColumn::make('locked_rt_cur'),
|
|
||||||
ImportColumn::make('locked_rt_pow'),
|
|
||||||
ImportColumn::make('no_load_pickup_volt'),
|
|
||||||
ImportColumn::make('room_temperature'),
|
|
||||||
ImportColumn::make('hv_test'),
|
|
||||||
ImportColumn::make('batch_number'),
|
|
||||||
ImportColumn::make('batch_count')
|
ImportColumn::make('batch_count')
|
||||||
->requiredMapping()
|
->requiredMapping()
|
||||||
|
->label('BATCH COUNT')
|
||||||
|
->exampleHeader('BATCH COUNT')
|
||||||
|
->example('1')
|
||||||
->rules(['required']),
|
->rules(['required']),
|
||||||
ImportColumn::make('result'),
|
ImportColumn::make('result')
|
||||||
ImportColumn::make('remark'),
|
->requiredMapping()
|
||||||
|
->label('RESULT')
|
||||||
|
->exampleHeader('RESULT')
|
||||||
|
->example('FAIL')
|
||||||
|
->rules(['required']),
|
||||||
|
ImportColumn::make('remark')
|
||||||
|
->requiredMapping()
|
||||||
|
->label('REMARK')
|
||||||
|
->exampleHeader('REMARK')
|
||||||
|
->example('Testing Remark'),
|
||||||
ImportColumn::make('rework_count')
|
ImportColumn::make('rework_count')
|
||||||
->requiredMapping()
|
->requiredMapping()
|
||||||
|
->label('REWORK COUNT')
|
||||||
|
->exampleHeader('REWORK COUNT')
|
||||||
|
->example('0')
|
||||||
|
->rules(['required']),
|
||||||
|
ImportColumn::make('rework_winded')
|
||||||
|
->requiredMapping()
|
||||||
|
->label('REWORK WINDED STATUS')
|
||||||
|
->exampleHeader('REWORK WINDED STATUS')
|
||||||
|
->example('0')
|
||||||
->rules(['required']),
|
->rules(['required']),
|
||||||
ImportColumn::make('update_count')
|
ImportColumn::make('update_count')
|
||||||
->requiredMapping()
|
->requiredMapping()
|
||||||
|
->label('UPDATED COUNT')
|
||||||
|
->exampleHeader('UPDATED COUNT')
|
||||||
|
->example('0')
|
||||||
->rules(['required']),
|
->rules(['required']),
|
||||||
ImportColumn::make('output_flag')
|
ImportColumn::make('output_flag')
|
||||||
->requiredMapping()
|
->requiredMapping()
|
||||||
|
->label('OUTPUT FLAG')
|
||||||
|
->exampleHeader('OUTPUT FLAG')
|
||||||
|
->example('0')
|
||||||
->rules(['required']),
|
->rules(['required']),
|
||||||
ImportColumn::make('line')
|
ImportColumn::make('tested_by')
|
||||||
->requiredMapping()
|
->requiredMapping()
|
||||||
->relationship(resolveUsing: 'name')
|
->label('TESTED BY')
|
||||||
->exampleHeader('Line Name')
|
->exampleHeader('TESTED BY')
|
||||||
->example(['4 inch pump line'])
|
->example('RAW01234')
|
||||||
->label('Line Name')
|
|
||||||
->rules(['required']),
|
->rules(['required']),
|
||||||
ImportColumn::make('plant')
|
ImportColumn::make('updated_by')
|
||||||
->requiredMapping()
|
->requiredMapping()
|
||||||
->relationship(resolveUsing: 'code')
|
->label('UPDATED BY')
|
||||||
->exampleHeader('Plant Code')
|
->exampleHeader('UPDATED BY')
|
||||||
->example(['1000'])
|
->example('RAW01234'),
|
||||||
->label('Plant Code')
|
|
||||||
->rules(['required']),
|
|
||||||
ImportColumn::make('tested_by'),
|
|
||||||
ImportColumn::make('updated_by'),
|
|
||||||
ImportColumn::make('scanned_at')
|
ImportColumn::make('scanned_at')
|
||||||
->requiredMapping()
|
->requiredMapping()
|
||||||
|
->label('SCANNED AT')
|
||||||
|
->exampleHeader('SCANNED AT')
|
||||||
|
->example('01-01-2026 00:08:00')
|
||||||
->rules(['required']),
|
->rules(['required']),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ use App\Models\Line;
|
|||||||
use App\Models\Machine;
|
use App\Models\Machine;
|
||||||
use App\Models\MotorTestingMaster;
|
use App\Models\MotorTestingMaster;
|
||||||
use App\Models\Plant;
|
use App\Models\Plant;
|
||||||
|
use Closure;
|
||||||
use Filament\Facades\Filament;
|
use Filament\Facades\Filament;
|
||||||
use Filament\Forms;
|
use Filament\Forms;
|
||||||
use Filament\Forms\Components\DateTimePicker;
|
use Filament\Forms\Components\DateTimePicker;
|
||||||
@@ -26,6 +27,7 @@ use Filament\Tables\Filters\Filter;
|
|||||||
use Filament\Tables\Table;
|
use Filament\Tables\Table;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||||
|
use Illuminate\Support\Str;
|
||||||
|
|
||||||
class BeforeTestReadingResource extends Resource
|
class BeforeTestReadingResource extends Resource
|
||||||
{
|
{
|
||||||
@@ -47,33 +49,29 @@ class BeforeTestReadingResource extends Resource
|
|||||||
->label('Plant Name')
|
->label('Plant Name')
|
||||||
->relationship('plant', 'name')
|
->relationship('plant', 'name')
|
||||||
->columnSpan(1) // (['default' => 1, 'sm' => 2])
|
->columnSpan(1) // (['default' => 1, 'sm' => 2])
|
||||||
->searchable()
|
|
||||||
->required()
|
|
||||||
->reactive()
|
->reactive()
|
||||||
|
->searchable()
|
||||||
->options(function (callable $get) {
|
->options(function (callable $get) {
|
||||||
$userHas = Filament::auth()->user()->plant_id;
|
$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();
|
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
|
||||||
})
|
})
|
||||||
->default(function () {
|
|
||||||
return optional(BeforeTestReading::latest()->first())->plant_id ?? null;
|
|
||||||
})
|
|
||||||
->disabled(fn (Get $get) => ! empty($get('id')))
|
->disabled(fn (Get $get) => ! empty($get('id')))
|
||||||
|
->default(function () {
|
||||||
|
$userHas = Filament::auth()->user()->plant_id;
|
||||||
|
|
||||||
|
return ($userHas && strlen($userHas) > 0) ? $userHas : optional(BeforeTestReading::latest()->first())->plant_id ?? null;
|
||||||
|
})
|
||||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
$plantId = $get('plant_id');
|
$plantId = $get('plant_id');
|
||||||
if (! $plantId) {
|
if (! $plantId) {
|
||||||
$set('line_id', null);
|
|
||||||
$set('motor_testing_master_id', null);
|
|
||||||
$set('machine_id', null);
|
|
||||||
$set('tPrError', 'Please select a plant first.');
|
$set('tPrError', 'Please select a plant first.');
|
||||||
|
|
||||||
return;
|
|
||||||
} else {
|
} else {
|
||||||
$set('line_id', null);
|
|
||||||
$set('motor_testing_master_id', null);
|
|
||||||
$set('machine_id', null);
|
|
||||||
$set('tPrError', null);
|
$set('tPrError', null);
|
||||||
}
|
}
|
||||||
|
$set('line_id', null);
|
||||||
|
$set('motor_testing_master_id', null);
|
||||||
|
$set('machine_id', null);
|
||||||
|
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
})
|
})
|
||||||
@@ -81,10 +79,12 @@ class BeforeTestReadingResource extends Resource
|
|||||||
'class' => $get('tPrError') ? 'border-red-500' : '',
|
'class' => $get('tPrError') ? 'border-red-500' : '',
|
||||||
])
|
])
|
||||||
->hint(fn ($get) => $get('tPrError') ? $get('tPrError') : null)
|
->hint(fn ($get) => $get('tPrError') ? $get('tPrError') : null)
|
||||||
->hintColor('danger'),
|
->hintColor('danger')
|
||||||
|
->required(),
|
||||||
Forms\Components\Select::make('line_id')
|
Forms\Components\Select::make('line_id')
|
||||||
->label('Line Name')
|
->label('Line Name')
|
||||||
// ->relationship('line', 'name')
|
// ->relationship('line', 'name')
|
||||||
|
->columnSpan(1)
|
||||||
->searchable()
|
->searchable()
|
||||||
->options(function (callable $get) {
|
->options(function (callable $get) {
|
||||||
$plantId = $get('plant_id');
|
$plantId = $get('plant_id');
|
||||||
@@ -92,24 +92,29 @@ class BeforeTestReadingResource extends Resource
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
return Line::where('plant_id', $plantId)
|
return Line::where('plant_id', $plantId)->pluck('name', 'id')->toArray();
|
||||||
->pluck('name', 'id')
|
|
||||||
->toArray();
|
|
||||||
})
|
|
||||||
->default(function () {
|
|
||||||
return optional(BeforeTestReading::latest()->first())->line_id ?? null;
|
|
||||||
})
|
})
|
||||||
->disabled(fn (Get $get) => ! empty($get('id')))
|
->disabled(fn (Get $get) => ! empty($get('id')))
|
||||||
->required()
|
->default(function (callable $get) {
|
||||||
|
$plantId = $get('plant_id');
|
||||||
|
if (empty($plantId)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return BeforeTestReading::where('plant_id', $plantId)->latest()->first()->line_id ?? null;
|
||||||
|
})
|
||||||
->reactive()
|
->reactive()
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('motor_testing_master_id', null);
|
$set('motor_testing_master_id', null);
|
||||||
$set('machine_id', null);
|
$set('machine_id', null);
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
})
|
||||||
|
->required(),
|
||||||
Forms\Components\Select::make('machine_id')
|
Forms\Components\Select::make('machine_id')
|
||||||
->label('Work Center')
|
->label('Work Center')
|
||||||
// ->relationship('machine', 'work_center')
|
// ->relationship('machine', 'work_center')
|
||||||
|
->columnSpan(1)
|
||||||
|
->reactive()
|
||||||
->searchable()
|
->searchable()
|
||||||
->options(function (callable $get) {
|
->options(function (callable $get) {
|
||||||
$lineId = $get('line_id');
|
$lineId = $get('line_id');
|
||||||
@@ -118,34 +123,39 @@ class BeforeTestReadingResource extends Resource
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Only show machines for the selected line
|
// Only show machines for the selected line
|
||||||
return Machine::where('line_id', $lineId)
|
return Machine::where('line_id', $lineId)->pluck('work_center', 'id')->toArray();
|
||||||
->pluck('work_center', 'id')
|
|
||||||
->toArray();
|
|
||||||
})
|
|
||||||
->default(function () {
|
|
||||||
return optional(BeforeTestReading::latest()->first())->machine_id ?? null;
|
|
||||||
})
|
})
|
||||||
->disabled(fn (Get $get) => ! empty($get('id')))
|
->disabled(fn (Get $get) => ! empty($get('id')))
|
||||||
->required()
|
->default(function (callable $get) {
|
||||||
->reactive()
|
$plantId = $get('plant_id');
|
||||||
|
if (empty($plantId)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return BeforeTestReading::where('plant_id', $plantId)->latest()->first()->machine_id ?? null;
|
||||||
|
})
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
})
|
||||||
|
->required(),
|
||||||
Forms\Components\Select::make('motor_testing_master_id')
|
Forms\Components\Select::make('motor_testing_master_id')
|
||||||
->label('Item Code')
|
->label('Item Code')
|
||||||
// ->relationship('motorTestingMaster', 'item.code')
|
// ->relationship('motorTestingMaster', 'item.code')
|
||||||
// ->options(function (callable $get) {
|
->columnSpan(1)
|
||||||
// $plantId = $get('plant_id');
|
// ->options(function (callable $get) {
|
||||||
// if (!$plantId) {
|
// $plantId = $get('plant_id');
|
||||||
// return [];
|
// if (!$plantId) {
|
||||||
// }
|
// return [];
|
||||||
// return MotorTestingMaster::with('item')
|
// }
|
||||||
// ->where('plant_id', $plantId)
|
// return MotorTestingMaster::with('item')
|
||||||
// ->get()
|
// ->where('plant_id', $plantId)
|
||||||
// //->filter(fn ($mtm) => $mtm->item)
|
// ->get()
|
||||||
// ->pluck('item.code', 'id')
|
// //->filter(fn ($mtm) => $mtm->item)
|
||||||
// ->toArray();
|
// ->pluck('item.code', 'id')
|
||||||
// })
|
// ->toArray();
|
||||||
|
// })
|
||||||
|
->reactive()
|
||||||
|
->searchable()
|
||||||
->options(function (callable $get) {
|
->options(function (callable $get) {
|
||||||
$plantId = $get('plant_id');
|
$plantId = $get('plant_id');
|
||||||
if (! $plantId) {
|
if (! $plantId) {
|
||||||
@@ -159,42 +169,83 @@ class BeforeTestReadingResource extends Resource
|
|||||||
->pluck('items.code', 'motor_testing_masters.id')
|
->pluck('items.code', 'motor_testing_masters.id')
|
||||||
->toArray();
|
->toArray();
|
||||||
})
|
})
|
||||||
// ->getOptionLabelUsing(fn ($value) =>
|
->disabled(fn (Get $get) => ! empty($get('id')))
|
||||||
// MotorTestingMaster::with('item')->find($value)?->item?->code
|
// ->getOptionLabelUsing(fn ($value) =>
|
||||||
// )
|
// MotorTestingMaster::with('item')->find($value)?->item?->code
|
||||||
->required()
|
// )
|
||||||
->searchable()
|
|
||||||
->reactive()
|
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
})
|
||||||
|
->required(),
|
||||||
Forms\Components\TextInput::make('serial_number')
|
Forms\Components\TextInput::make('serial_number')
|
||||||
->label('Serial Number')
|
->label('Serial Number')
|
||||||
->required()
|
->columnSpan(1)
|
||||||
|
->reactive()
|
||||||
|
->readOnly(fn (Get $get) => $get('id'))
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
})
|
||||||
|
->rule(function (callable $get) {
|
||||||
|
return function (string $attribute, $value, Closure $fail) use ($get) {
|
||||||
|
|
||||||
|
$plantId = $get('plant_id');
|
||||||
|
$lineId = $get('line_id');
|
||||||
|
$machineId = $get('machine_id');
|
||||||
|
$itemId = $get('motor_testing_master_id');
|
||||||
|
$serialNumber = trim($value);
|
||||||
|
// $currentId = $get('id'); // current editing record id
|
||||||
|
|
||||||
|
if (! $plantId || ! $lineId || ! $machineId || ! $itemId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($serialNumber == null || $serialNumber == '' || ! $serialNumber) {
|
||||||
|
$fail("Serial number can't be empty!");
|
||||||
|
} elseif (Str::length($serialNumber) < 9) {
|
||||||
|
$fail('Serial number should contain minimum 9 digits!');
|
||||||
|
} elseif (! ctype_alnum($serialNumber)) {
|
||||||
|
$fail('Serial number should contain only alpha-numeric values!');
|
||||||
|
} elseif (! preg_match('/^[1-9][a-zA-Z0-9]{8,}$/', $serialNumber)) {
|
||||||
|
$fail("Serial number should not begin with '0' or letter!");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
})
|
||||||
|
->required(),
|
||||||
Forms\Components\TextInput::make('before_fr_res_ry')
|
Forms\Components\TextInput::make('before_fr_res_ry')
|
||||||
->label('Before FR Resistance RY')
|
->label('Before FR Resistance RY')
|
||||||
|
->columnSpan(1)
|
||||||
|
->reactive()
|
||||||
|
->readOnly(fn (Get $get) => $get('id'))
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('before_fr_res_yb')
|
Forms\Components\TextInput::make('before_fr_res_yb')
|
||||||
->label('Before FR Resistance YB')
|
->label('Before FR Resistance YB')
|
||||||
|
->columnSpan(1)
|
||||||
|
->reactive()
|
||||||
|
->readOnly(fn (Get $get) => $get('id'))
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('before_fr_res_br')
|
Forms\Components\TextInput::make('before_fr_res_br')
|
||||||
->label('Before FR Resistance BR')
|
->label('Before FR Resistance BR')
|
||||||
|
->columnSpan(1)
|
||||||
|
->reactive()
|
||||||
|
->readOnly(fn (Get $get) => $get('id'))
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('before_fr_ir')
|
Forms\Components\TextInput::make('before_fr_ir')
|
||||||
->label('Before FR IR')
|
->label('Before FR IR')
|
||||||
|
->columnSpan(1)
|
||||||
|
->reactive()
|
||||||
|
->readOnly(fn (Get $get) => $get('id'))
|
||||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
Forms\Components\TextInput::make('tested_by')
|
Forms\Components\TextInput::make('tested_by')
|
||||||
|
->label('Tested By')
|
||||||
|
->columnSpan(1)
|
||||||
->default(fn () => Filament::auth()->user()?->name)
|
->default(fn () => Filament::auth()->user()?->name)
|
||||||
->readOnly()
|
->readOnly()
|
||||||
->required(),
|
->required(),
|
||||||
@@ -232,6 +283,9 @@ class BeforeTestReadingResource extends Resource
|
|||||||
Tables\Columns\TextColumn::make('line.name')
|
Tables\Columns\TextColumn::make('line.name')
|
||||||
->label('Line Name')
|
->label('Line Name')
|
||||||
->alignCenter(),
|
->alignCenter(),
|
||||||
|
Tables\Columns\TextColumn::make('machine.workGroupMaster.name')
|
||||||
|
->label('Group Work Center')
|
||||||
|
->alignCenter(),
|
||||||
Tables\Columns\TextColumn::make('machine.work_center')
|
Tables\Columns\TextColumn::make('machine.work_center')
|
||||||
->label('Work Center')
|
->label('Work Center')
|
||||||
->alignCenter(),
|
->alignCenter(),
|
||||||
@@ -244,9 +298,20 @@ class BeforeTestReadingResource extends Resource
|
|||||||
Tables\Columns\TextColumn::make('motorTestingMaster.item.description')
|
Tables\Columns\TextColumn::make('motorTestingMaster.item.description')
|
||||||
->label('Model')
|
->label('Model')
|
||||||
->alignCenter(),
|
->alignCenter(),
|
||||||
|
Tables\Columns\TextColumn::make('motorTestingMaster.item.category')
|
||||||
|
->label('Category')
|
||||||
|
->default('-')
|
||||||
|
->alignCenter()
|
||||||
|
->toggleable(isToggledHiddenByDefault: true),
|
||||||
|
Tables\Columns\TextColumn::make('motorTestingMaster.item.uom')
|
||||||
|
->label('Unit of Measure')
|
||||||
|
->default('-')
|
||||||
|
->alignCenter()
|
||||||
|
->toggleable(isToggledHiddenByDefault: true),
|
||||||
Tables\Columns\TextColumn::make('serial_number')
|
Tables\Columns\TextColumn::make('serial_number')
|
||||||
->label('Serial Number')
|
->label('Serial Number')
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
|
->searchable()
|
||||||
->sortable(),
|
->sortable(),
|
||||||
Tables\Columns\TextColumn::make('motorTestingMaster.kw')
|
Tables\Columns\TextColumn::make('motorTestingMaster.kw')
|
||||||
->label('KW')
|
->label('KW')
|
||||||
@@ -288,8 +353,7 @@ class BeforeTestReadingResource extends Resource
|
|||||||
->sortable(),
|
->sortable(),
|
||||||
Tables\Columns\TextColumn::make('tested_by')
|
Tables\Columns\TextColumn::make('tested_by')
|
||||||
->label('Tested By')
|
->label('Tested By')
|
||||||
->alignCenter()
|
->alignCenter(),
|
||||||
->numeric(),
|
|
||||||
Tables\Columns\TextColumn::make('updated_at')
|
Tables\Columns\TextColumn::make('updated_at')
|
||||||
->label('Updated At')
|
->label('Updated At')
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
@@ -297,8 +361,7 @@ class BeforeTestReadingResource extends Resource
|
|||||||
->dateTime(),
|
->dateTime(),
|
||||||
Tables\Columns\TextColumn::make('updated_by')
|
Tables\Columns\TextColumn::make('updated_by')
|
||||||
->label('Updated By')
|
->label('Updated By')
|
||||||
->alignCenter()
|
->alignCenter(),
|
||||||
->numeric(),
|
|
||||||
Tables\Columns\TextColumn::make('deleted_at')
|
Tables\Columns\TextColumn::make('deleted_at')
|
||||||
->label('Deleted At')
|
->label('Deleted At')
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
@@ -306,6 +369,7 @@ class BeforeTestReadingResource extends Resource
|
|||||||
->dateTime()
|
->dateTime()
|
||||||
->toggleable(isToggledHiddenByDefault: true),
|
->toggleable(isToggledHiddenByDefault: true),
|
||||||
])
|
])
|
||||||
|
->searchPlaceholder('Search by Serial Number')
|
||||||
->filters([
|
->filters([
|
||||||
Tables\Filters\TrashedFilter::make(),
|
Tables\Filters\TrashedFilter::make(),
|
||||||
Filter::make('advanced_filters')
|
Filter::make('advanced_filters')
|
||||||
@@ -313,8 +377,9 @@ class BeforeTestReadingResource extends Resource
|
|||||||
->form([
|
->form([
|
||||||
Select::make('Plant')
|
Select::make('Plant')
|
||||||
->label('Search by Plant Name')
|
->label('Search by Plant Name')
|
||||||
->searchable()
|
|
||||||
->nullable()
|
->nullable()
|
||||||
|
->searchable()
|
||||||
|
->reactive()
|
||||||
->options(function () {
|
->options(function () {
|
||||||
// return Plant::pluck('name', 'id');
|
// return Plant::pluck('name', 'id');
|
||||||
$userHas = Filament::auth()->user()->plant_id;
|
$userHas = Filament::auth()->user()->plant_id;
|
||||||
@@ -329,7 +394,6 @@ class BeforeTestReadingResource extends Resource
|
|||||||
|
|
||||||
// return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
|
// 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) {
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
$set('Line', null);
|
$set('Line', null);
|
||||||
$set('item_code', null);
|
$set('item_code', null);
|
||||||
@@ -337,26 +401,25 @@ class BeforeTestReadingResource extends Resource
|
|||||||
}),
|
}),
|
||||||
Select::make('Line')
|
Select::make('Line')
|
||||||
->label('Search by Line Name')
|
->label('Search by Line Name')
|
||||||
->searchable()
|
|
||||||
->nullable()
|
->nullable()
|
||||||
|
->searchable()
|
||||||
|
->reactive()
|
||||||
->options(function (callable $get) {
|
->options(function (callable $get) {
|
||||||
$plantId = $get('Plant');
|
$plantId = $get('Plant');
|
||||||
if (! $plantId) {
|
if (! $plantId) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
return Line::where('plant_id', $plantId)
|
return Line::where('plant_id', $plantId)->pluck('name', 'id')->toArray();
|
||||||
->pluck('name', 'id')
|
|
||||||
->toArray();
|
|
||||||
})
|
})
|
||||||
->reactive()
|
|
||||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
$set('item_code', null);
|
$set('item_code', null);
|
||||||
}),
|
}),
|
||||||
Select::make('machine_name')
|
Select::make('machine_name')
|
||||||
->label('Search by Work Center')
|
->label('Search by Work Center')
|
||||||
->searchable()
|
|
||||||
->nullable()
|
->nullable()
|
||||||
|
->searchable()
|
||||||
|
->reactive()
|
||||||
->options(function (callable $get) {
|
->options(function (callable $get) {
|
||||||
$plantId = $get('Plant');
|
$plantId = $get('Plant');
|
||||||
$lineId = $get('Line');
|
$lineId = $get('Line');
|
||||||
@@ -365,31 +428,26 @@ class BeforeTestReadingResource extends Resource
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
return Machine::where('plant_id', $plantId)
|
return Machine::where('plant_id', $plantId)->where('line_id', $lineId)->pluck('work_center', 'id')->toArray();
|
||||||
->where('line_id', $lineId)
|
}),
|
||||||
->pluck('work_center', 'id')
|
|
||||||
->toArray();
|
|
||||||
})
|
|
||||||
->reactive(),
|
|
||||||
Select::make('item_code')
|
Select::make('item_code')
|
||||||
->label('Search by Item Code')
|
->label('Search by Item Code')
|
||||||
->searchable()
|
|
||||||
->nullable()
|
->nullable()
|
||||||
|
->searchable()
|
||||||
|
->reactive()
|
||||||
->options(function (callable $get) {
|
->options(function (callable $get) {
|
||||||
$plantId = $get('Plant');
|
$plantId = $get('Plant');
|
||||||
if ($plantId) {
|
|
||||||
return Item::where('plant_id', $plantId)
|
if (empty($plantId)) {
|
||||||
->whereHas('motorTestingMasters')
|
|
||||||
->pluck('code', 'id')
|
|
||||||
->toArray();
|
|
||||||
} else {
|
|
||||||
return [];
|
return [];
|
||||||
// return Item::whereHas('motorTestingMasters')
|
|
||||||
// ->pluck('code', 'id')
|
|
||||||
// ->toArray();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return Item::whereHas('motorTestingMasters', function ($query) use ($plantId) {
|
||||||
|
if ($plantId) {
|
||||||
|
$query->where('plant_id', $plantId);
|
||||||
|
}
|
||||||
|
})->pluck('code', 'id')->toArray();
|
||||||
})
|
})
|
||||||
->reactive()
|
|
||||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
$set('item_description', null);
|
$set('item_description', null);
|
||||||
}),
|
}),
|
||||||
@@ -399,57 +457,52 @@ class BeforeTestReadingResource extends Resource
|
|||||||
->placeholder('Enter Serial Number'),
|
->placeholder('Enter Serial Number'),
|
||||||
Select::make('subassembly_code')
|
Select::make('subassembly_code')
|
||||||
->label('Search by Subassembly Code')
|
->label('Search by Subassembly Code')
|
||||||
->searchable()
|
|
||||||
->nullable()
|
->nullable()
|
||||||
|
->searchable()
|
||||||
|
->reactive()
|
||||||
->options(function (callable $get) {
|
->options(function (callable $get) {
|
||||||
$plantId = $get('Plant');
|
$plantId = $get('Plant');
|
||||||
if ($plantId) {
|
|
||||||
return MotorTestingMaster::whereHas('beforeTestReadings', function ($query) {
|
if (empty($plantId)) {
|
||||||
$query->whereNotNull('id');
|
|
||||||
})->whereNotNull('subassembly_code')->orderBy('subassembly_code')->pluck('subassembly_code', 'id');
|
|
||||||
} else {
|
|
||||||
return [];
|
return [];
|
||||||
// return Item::whereHas('motorTestingMasters')
|
|
||||||
// ->pluck('code', 'id')
|
|
||||||
// ->toArray();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return MotorTestingMaster::whereHas('beforeTestReadings', function ($query) use ($plantId) {
|
||||||
|
if ($plantId) {
|
||||||
|
$query->where('plant_id', $plantId);
|
||||||
|
}
|
||||||
|
$query->whereNotNull('id');
|
||||||
|
})->whereNotNull('subassembly_code')->orderBy('subassembly_code')->pluck('subassembly_code', 'id');
|
||||||
})
|
})
|
||||||
->reactive()
|
|
||||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
$set('item_description', null);
|
$set('item_description', null);
|
||||||
}),
|
}),
|
||||||
Select::make('item_description')
|
Select::make('item_description')
|
||||||
->label('Search by Model')
|
->label('Search by Model')
|
||||||
|
->nullable()
|
||||||
->searchable()
|
->searchable()
|
||||||
|
->reactive()
|
||||||
->options(function (callable $get) {
|
->options(function (callable $get) {
|
||||||
$plantId = $get('Plant');
|
$plantId = $get('Plant');
|
||||||
|
|
||||||
// $query = Item::query();
|
if (empty($plantId)) {
|
||||||
// if ($plantId) {
|
|
||||||
// $query->where('plant_id', $plantId);
|
|
||||||
// }
|
|
||||||
|
|
||||||
$plantId = $get('Plant');
|
|
||||||
if ($plantId) {
|
|
||||||
return Item::where('plant_id', $plantId)
|
|
||||||
->whereHas('motorTestingMasters')
|
|
||||||
->pluck('description', 'id')
|
|
||||||
->toArray();
|
|
||||||
} else {
|
|
||||||
return [];
|
return [];
|
||||||
// return Item::whereHas('motorTestingMasters')
|
|
||||||
// ->pluck('description', 'id')
|
|
||||||
// ->toArray();
|
|
||||||
}
|
}
|
||||||
// return $query->pluck('description', 'description')->toArray();
|
|
||||||
|
return Item::whereHas('motorTestingMasters', function ($query) use ($plantId) {
|
||||||
|
if ($plantId) {
|
||||||
|
$query->where('plant_id', $plantId);
|
||||||
|
}
|
||||||
|
})->pluck('description', 'id')->toArray();
|
||||||
})
|
})
|
||||||
->reactive()
|
|
||||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
$set('item_code', null);
|
$set('item_code', null);
|
||||||
}),
|
}),
|
||||||
Select::make('connection')
|
Select::make('connection')
|
||||||
->label('Connection')
|
->label('Connection')
|
||||||
->required()
|
->nullable()
|
||||||
|
->reactive()
|
||||||
|
->selectablePlaceholder(false)
|
||||||
->default('Star')
|
->default('Star')
|
||||||
->options(function (callable $get) {
|
->options(function (callable $get) {
|
||||||
$plantId = $get('Plant');
|
$plantId = $get('Plant');
|
||||||
@@ -466,11 +519,12 @@ class BeforeTestReadingResource extends Resource
|
|||||||
->toArray();
|
->toArray();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
->selectablePlaceholder(false)
|
->required(),
|
||||||
->reactive(),
|
|
||||||
Select::make('tested_by')
|
Select::make('tested_by')
|
||||||
->label('Tested By')
|
->label('Tested By')
|
||||||
->nullable()
|
->nullable()
|
||||||
|
->searchable()
|
||||||
|
->reactive()
|
||||||
->options(function (callable $get) {
|
->options(function (callable $get) {
|
||||||
$plantId = $get('Plant');
|
$plantId = $get('Plant');
|
||||||
if (! $plantId) {
|
if (! $plantId) {
|
||||||
@@ -478,22 +532,22 @@ class BeforeTestReadingResource extends Resource
|
|||||||
} else {
|
} else {
|
||||||
return BeforeTestReading::where('plant_id', $plantId)->whereNotNull('tested_by')->select('tested_by')->distinct()->pluck('tested_by', 'tested_by');
|
return BeforeTestReading::where('plant_id', $plantId)->whereNotNull('tested_by')->select('tested_by')->distinct()->pluck('tested_by', 'tested_by');
|
||||||
}
|
}
|
||||||
})
|
}),
|
||||||
->searchable()
|
DateTimePicker::make('created_from')
|
||||||
->reactive(),
|
|
||||||
DateTimePicker::make(name: 'created_from')
|
|
||||||
->label('Created From')
|
->label('Created From')
|
||||||
->placeholder(placeholder: 'Select From DateTime')
|
->placeholder('Select From DateTime')
|
||||||
->reactive()
|
->reactive()
|
||||||
->native(false),
|
->native(false),
|
||||||
DateTimePicker::make('created_to')
|
DateTimePicker::make('created_to')
|
||||||
->label('Created To')
|
->label('Created To')
|
||||||
->placeholder(placeholder: 'Select To DateTime')
|
->placeholder('Select To DateTime')
|
||||||
->reactive()
|
->reactive()
|
||||||
->native(false),
|
->native(false),
|
||||||
Select::make('updated_by')
|
Select::make('updated_by')
|
||||||
->label('Updated By')
|
->label('Updated By')
|
||||||
->nullable()
|
->nullable()
|
||||||
|
->searchable()
|
||||||
|
->reactive()
|
||||||
->options(function (callable $get) {
|
->options(function (callable $get) {
|
||||||
$plantId = $get('Plant');
|
$plantId = $get('Plant');
|
||||||
if (! $plantId) {
|
if (! $plantId) {
|
||||||
@@ -501,17 +555,15 @@ class BeforeTestReadingResource extends Resource
|
|||||||
} else {
|
} else {
|
||||||
return BeforeTestReading::where('plant_id', $plantId)->whereNotNull('updated_by')->select('updated_by')->distinct()->pluck('updated_by', 'updated_by');
|
return BeforeTestReading::where('plant_id', $plantId)->whereNotNull('updated_by')->select('updated_by')->distinct()->pluck('updated_by', 'updated_by');
|
||||||
}
|
}
|
||||||
})
|
}),
|
||||||
->searchable()
|
DateTimePicker::make('updated_from')
|
||||||
->reactive(),
|
|
||||||
DateTimePicker::make(name: 'updated_from')
|
|
||||||
->label('Updated From')
|
->label('Updated From')
|
||||||
->placeholder(placeholder: 'Select From DateTime')
|
->placeholder('Select From DateTime')
|
||||||
->reactive()
|
->reactive()
|
||||||
->native(false),
|
->native(false),
|
||||||
DateTimePicker::make('updated_to')
|
DateTimePicker::make('updated_to')
|
||||||
->label('Updated To')
|
->label('Updated To')
|
||||||
->placeholder(placeholder: 'Select To DateTime')
|
->placeholder('Select To DateTime')
|
||||||
->reactive()
|
->reactive()
|
||||||
->native(false),
|
->native(false),
|
||||||
])
|
])
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -48,21 +48,67 @@ class TestingPanelController extends Controller
|
|||||||
|
|
||||||
$data = $request->all();
|
$data = $request->all();
|
||||||
|
|
||||||
if ($data['plant_code'] == null || $data['plant_code'] == '') {
|
$plantCode = $data['plant_code'] ?? null;
|
||||||
// return response("ERROR: Please provide a valid plant code.", 400)
|
$groupWorkCenter = $data['line_name'] ?? null;
|
||||||
// ->header('Content-Type', 'text/plain');
|
$workCenter = $data['machine_name'] ?? null;
|
||||||
|
|
||||||
|
if ($plantCode == null || $plantCode == '' || ! $plantCode) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status_code' => 'ERROR',
|
'status_code' => 'ERROR',
|
||||||
'status_description' => "Plant code can't be empty!",
|
'status_description' => "Plant code can't be empty!",
|
||||||
], 404);
|
], 400);
|
||||||
} elseif (Str::length($data['plant_code']) < 4 || ! is_numeric($data['plant_code']) || ! preg_match('/^[1-9]\d{3,}$/', $data['plant_code'])) {// !ctype_digit($data['plant_code'])
|
} elseif (! is_numeric($plantCode)) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status_code' => 'ERROR',
|
'status_code' => 'ERROR',
|
||||||
'status_description' => 'Invalid plant code found!',
|
'status_description' => "Plant code '{$plantCode}' should contain only numeric values!",
|
||||||
|
], 400);
|
||||||
|
} elseif (Str::length($plantCode) < 4 || Str::length($plantCode) > 7) {
|
||||||
|
return response()->json([
|
||||||
|
'status_code' => 'ERROR',
|
||||||
|
'status_description' => "Plant code '{$plantCode}' must be between 4 and 7 digits only!",
|
||||||
|
], 400);
|
||||||
|
} elseif (! preg_match('/^[1-9]\d{3,6}$/', $plantCode)) {
|
||||||
|
return response()->json([
|
||||||
|
'status_code' => 'ERROR',
|
||||||
|
'status_description' => "Invalid plant code '{$plantCode}' found!",
|
||||||
|
], 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($groupWorkCenter == null || $groupWorkCenter == '' || ! $groupWorkCenter) {
|
||||||
|
return response()->json([
|
||||||
|
'status_code' => 'ERROR',
|
||||||
|
'status_description' => "Group work center can't be empty!",
|
||||||
|
], 404);
|
||||||
|
} elseif (Str::length($groupWorkCenter) < 6) {
|
||||||
|
return response()->json([
|
||||||
|
'status_code' => 'ERROR',
|
||||||
|
'status_description' => "Group work center '{$groupWorkCenter}' should contain minimum 6 characters!",
|
||||||
|
], 404);
|
||||||
|
} elseif (! ctype_alnum($groupWorkCenter)) {
|
||||||
|
return response()->json([
|
||||||
|
'status_code' => 'ERROR',
|
||||||
|
'status_description' => "Group work center '{$groupWorkCenter}' should contain only alpha-numeric values!",
|
||||||
], 404);
|
], 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$plant = Plant::where('code', $data['plant_code'])->first();
|
if ($workCenter == null || $workCenter == '' || ! $workCenter) {
|
||||||
|
return response()->json([
|
||||||
|
'status_code' => 'ERROR',
|
||||||
|
'status_description' => "Work center can't be empty!",
|
||||||
|
], 404);
|
||||||
|
} elseif (Str::length($workCenter) < 6) {
|
||||||
|
return response()->json([
|
||||||
|
'status_code' => 'ERROR',
|
||||||
|
'status_description' => "Work center '{$workCenter}' should contain minimum 6 characters!",
|
||||||
|
], 404);
|
||||||
|
} elseif (! ctype_alnum($workCenter)) {
|
||||||
|
return response()->json([
|
||||||
|
'status_code' => 'ERROR',
|
||||||
|
'status_description' => "Work center '{$workCenter}' should contain only alpha-numeric values!",
|
||||||
|
], 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
$plant = Plant::where('code', $plantCode)->first();
|
||||||
if (! $plant) {
|
if (! $plant) {
|
||||||
// return response("Plant not found.", 400)->header('Content-Type', 'text/plain');
|
// return response("Plant not found.", 400)->header('Content-Type', 'text/plain');
|
||||||
return response()->json([
|
return response()->json([
|
||||||
@@ -74,19 +120,7 @@ class TestingPanelController extends Controller
|
|||||||
$plantId = $plant->id;
|
$plantId = $plant->id;
|
||||||
$plantName = $plant->name;
|
$plantName = $plant->name;
|
||||||
|
|
||||||
if ($data['line_name'] == null || $data['line_name'] == '') {
|
$gWorkCenter = WorkGroupMaster::where('name', $groupWorkCenter)->first();
|
||||||
return response()->json([
|
|
||||||
'status_code' => 'ERROR',
|
|
||||||
'status_description' => "Group work center can't be empty!",
|
|
||||||
], 404);
|
|
||||||
} elseif (Str::length($data['line_name']) < 0) {
|
|
||||||
return response()->json([
|
|
||||||
'status_code' => 'ERROR',
|
|
||||||
'status_description' => 'Invalid group work center found!',
|
|
||||||
], 404);
|
|
||||||
}
|
|
||||||
|
|
||||||
$gWorkCenter = WorkGroupMaster::where('name', $data['line_name'])->first();
|
|
||||||
if (! $gWorkCenter) {
|
if (! $gWorkCenter) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status_code' => 'ERROR',
|
'status_code' => 'ERROR',
|
||||||
@@ -94,30 +128,18 @@ class TestingPanelController extends Controller
|
|||||||
], 404);
|
], 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$gWorkCenter = WorkGroupMaster::where('name', $data['line_name'])->where('plant_id', $plantId)->first();
|
$gWorkCenter = WorkGroupMaster::where('name', $groupWorkCenter)->where('plant_id', $plantId)->first();
|
||||||
if (! $gWorkCenter) {
|
if (! $gWorkCenter) {
|
||||||
// return response( "Line not found for the specified plant : {$data['plant_code']}",400)->header('Content-Type', 'text/plain');
|
// return response( "Line not found for the specified plant : {$plantCode}",400)->header('Content-Type', 'text/plain');
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status_code' => 'ERROR',
|
'status_code' => 'ERROR',
|
||||||
'status_description' => "Group work center not found for the specified plant : '{$data['plant_code']}'!",
|
'status_description' => "Group work center not found for the specified plant : '{$plantCode}'!",
|
||||||
], 404);
|
], 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$gWorkCenterId = $gWorkCenter->id;
|
$gWorkCenterId = $gWorkCenter->id;
|
||||||
|
|
||||||
if ($data['machine_name'] == null || $data['machine_name'] == '') {
|
$machine = Machine::where('work_center', $workCenter)->first();
|
||||||
return response()->json([
|
|
||||||
'status_code' => 'ERROR',
|
|
||||||
'status_description' => "Work center can't be empty!",
|
|
||||||
], 404);
|
|
||||||
} elseif (Str::length($data['machine_name']) < 0) {
|
|
||||||
return response()->json([
|
|
||||||
'status_code' => 'ERROR',
|
|
||||||
'status_description' => 'Invalid work center found!',
|
|
||||||
], 404);
|
|
||||||
}
|
|
||||||
|
|
||||||
$machine = Machine::where('work_center', $data['machine_name'])->first();
|
|
||||||
if (! $machine) {
|
if (! $machine) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status_code' => 'ERROR',
|
'status_code' => 'ERROR',
|
||||||
@@ -125,29 +147,29 @@ class TestingPanelController extends Controller
|
|||||||
], 404);
|
], 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$machine = Machine::where('work_center', $data['machine_name'])->where('plant_id', $plantId)->first();
|
$machine = Machine::where('work_center', $workCenter)->where('plant_id', $plantId)->first();
|
||||||
if (! $machine) {
|
if (! $machine) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status_code' => 'ERROR',
|
'status_code' => 'ERROR',
|
||||||
'status_description' => "Work center not found for the specified plant : '{$data['plant_code']}'!",
|
'status_description' => "Work center not found for the specified plant : '{$plantCode}'!",
|
||||||
], 404);
|
], 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$machine = Machine::where('work_center', $data['machine_name'])->where('work_group_master_id', $gWorkCenterId)->first();
|
$machine = Machine::where('work_center', $workCenter)->where('work_group_master_id', $gWorkCenterId)->first();
|
||||||
if (! $machine) {
|
if (! $machine) {
|
||||||
// return response("Machine not found for the specified line : {$data['line_name']}", 400)->header('Content-Type', 'text/plain');
|
// return response("Machine not found for the specified line : {$groupWorkCenter}", 400)->header('Content-Type', 'text/plain');
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status_code' => 'ERROR',
|
'status_code' => 'ERROR',
|
||||||
'status_description' => "Work center not found for the specified Group work center : '{$data['line_name']}'!",
|
'status_description' => "Work center not found for the specified Group work center : '{$groupWorkCenter}'!",
|
||||||
], 404);
|
], 404);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$machine = Machine::where('work_center', $data['machine_name'])->where('plant_id', $plantId)->where('work_group_master_id', $gWorkCenterId)->first();
|
$machine = Machine::where('work_center', $workCenter)->where('plant_id', $plantId)->where('work_group_master_id', $gWorkCenterId)->first();
|
||||||
if (! $machine) {
|
if (! $machine) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status_code' => 'ERROR',
|
'status_code' => 'ERROR',
|
||||||
'status_description' => "Work center not found for the specified Plant : '{$data['plant_code']}' and Group work center : '{$data['line_name']}'!",
|
'status_description' => "Work center not found for the specified Plant : '{$plantCode}' and Group work center : '{$groupWorkCenter}'!",
|
||||||
], 404);
|
], 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -255,7 +277,7 @@ class TestingPanelController extends Controller
|
|||||||
|
|
||||||
$newUpdateCount = ($lastUpdateCount == null || $lastUpdateCount == '') ? 0 : (int) $lastUpdateCount?->update_count + 1; // $maxUpdateCount?->update_count
|
$newUpdateCount = ($lastUpdateCount == null || $lastUpdateCount == '') ? 0 : (int) $lastUpdateCount?->update_count + 1; // $maxUpdateCount?->update_count
|
||||||
|
|
||||||
$updateCountString = (string) $newUpdateCount;
|
// $updateCountString = (string) $newUpdateCount;
|
||||||
|
|
||||||
$row = [
|
$row = [
|
||||||
'plant_id' => $plantId,
|
'plant_id' => $plantId,
|
||||||
@@ -302,13 +324,14 @@ class TestingPanelController extends Controller
|
|||||||
'result' => $serial['result'] ?? null,
|
'result' => $serial['result'] ?? null,
|
||||||
'remark' => $serial['remark'] ?? null,
|
'remark' => $serial['remark'] ?? null,
|
||||||
'rework_count' => $serial['rework_count'] ?? 0,
|
'rework_count' => $serial['rework_count'] ?? 0,
|
||||||
|
'rework_winded' => $serial['rework_winded'] ?? 0,
|
||||||
'output_flag' => $serial['output_flag'] ?? 0,
|
'output_flag' => $serial['output_flag'] ?? 0,
|
||||||
'tested_by' => $serial['tested_by'] ?? null,
|
'tested_by' => (($serial['tested_by'] == 'jothi') ? 'Admin' : $serial['tested_by']) ?? null,
|
||||||
'updated_by' => $serial['updated_by'] ?? null,
|
'updated_by' => (($serial['updated_by'] == 'jothi') ? 'Admin' : $serial['updated_by']) ?? null,
|
||||||
'created_at' => $serial['created_at'] ?? null,
|
'created_at' => $serial['created_at'] ?? null,
|
||||||
'updated_at' => $serial['updated_at'] ?? $serial['created_at'],
|
'updated_at' => $serial['updated_at'] ?? $serial['created_at'],
|
||||||
'scanned_at' => $serial['scanned_at'] ?? null,
|
'scanned_at' => $serial['scanned_at'] ?? null,
|
||||||
'update_count' => $updateCountString,
|
'update_count' => (string) $newUpdateCount,
|
||||||
];
|
];
|
||||||
|
|
||||||
// Insert the new record
|
// Insert the new record
|
||||||
@@ -365,9 +388,9 @@ class TestingPanelController extends Controller
|
|||||||
|
|
||||||
$data = $request->all();
|
$data = $request->all();
|
||||||
|
|
||||||
$plantCode = $data['plant_code'] ?? '';
|
$plantCode = $data['plant_code'] ?? null;
|
||||||
$itemCode = $data['item_code'] ?? '';
|
$itemCode = $data['item_code'] ?? null;
|
||||||
$serialNumber = $data['serial_number'] ?? '';
|
$serialNumber = $data['serial_number'] ?? null;
|
||||||
$testStatus = $data['test_status'] ?? 'F';
|
$testStatus = $data['test_status'] ?? 'F';
|
||||||
|
|
||||||
if ($plantCode == null || $plantCode == '' || ! $plantCode) {
|
if ($plantCode == null || $plantCode == '' || ! $plantCode) {
|
||||||
@@ -686,22 +709,67 @@ class TestingPanelController extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
$data = $request->all();
|
$data = $request->all();
|
||||||
|
$plantCode = $data['plant_code'] ?? null;
|
||||||
|
$groupWorkCenter = $data['line_name'] ?? null;
|
||||||
|
$workCenter = $data['machine_name'] ?? null;
|
||||||
|
|
||||||
if ($data['plant_code'] == null || $data['plant_code'] == '') {
|
if ($plantCode == null || $plantCode == '' || ! $plantCode) {
|
||||||
// return response("ERROR: Please provide a valid plant code.", 400)
|
|
||||||
// ->header('Content-Type', 'text/plain');
|
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status_code' => 'ERROR',
|
'status_code' => 'ERROR',
|
||||||
'status_description' => "Plant code can't be empty!",
|
'status_description' => "Plant code can't be empty!",
|
||||||
], 404);
|
], 400);
|
||||||
} elseif (Str::length($data['plant_code']) < 4 || ! is_numeric($data['plant_code']) || ! preg_match('/^[1-9]\d{3,}$/', $data['plant_code'])) {// !ctype_digit($data['plant_code'])
|
} elseif (! is_numeric($plantCode)) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status_code' => 'ERROR',
|
'status_code' => 'ERROR',
|
||||||
'status_description' => 'Invalid plant code found!',
|
'status_description' => "Plant code '{$plantCode}' should contain only numeric values!",
|
||||||
|
], 400);
|
||||||
|
} elseif (Str::length($plantCode) < 4 || Str::length($plantCode) > 7) {
|
||||||
|
return response()->json([
|
||||||
|
'status_code' => 'ERROR',
|
||||||
|
'status_description' => "Plant code '{$plantCode}' must be between 4 and 7 digits only!",
|
||||||
|
], 400);
|
||||||
|
} elseif (! preg_match('/^[1-9]\d{3,6}$/', $plantCode)) {
|
||||||
|
return response()->json([
|
||||||
|
'status_code' => 'ERROR',
|
||||||
|
'status_description' => "Invalid plant code '{$plantCode}' found!",
|
||||||
|
], 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($groupWorkCenter == null || $groupWorkCenter == '' || ! $groupWorkCenter) {
|
||||||
|
return response()->json([
|
||||||
|
'status_code' => 'ERROR',
|
||||||
|
'status_description' => "Group work center can't be empty!",
|
||||||
|
], 404);
|
||||||
|
} elseif (Str::length($groupWorkCenter) < 6) {
|
||||||
|
return response()->json([
|
||||||
|
'status_code' => 'ERROR',
|
||||||
|
'status_description' => "Group work center '{$groupWorkCenter}' should contain minimum 6 characters!",
|
||||||
|
], 404);
|
||||||
|
} elseif (! ctype_alnum($groupWorkCenter)) {
|
||||||
|
return response()->json([
|
||||||
|
'status_code' => 'ERROR',
|
||||||
|
'status_description' => "Group work center '{$groupWorkCenter}' should contain only alpha-numeric values!",
|
||||||
], 404);
|
], 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$plant = Plant::where('code', $data['plant_code'])->first();
|
if ($workCenter == null || $workCenter == '' || ! $workCenter) {
|
||||||
|
return response()->json([
|
||||||
|
'status_code' => 'ERROR',
|
||||||
|
'status_description' => "Work center can't be empty!",
|
||||||
|
], 404);
|
||||||
|
} elseif (Str::length($workCenter) < 6) {
|
||||||
|
return response()->json([
|
||||||
|
'status_code' => 'ERROR',
|
||||||
|
'status_description' => "Work center '{$workCenter}' should contain minimum 6 characters!",
|
||||||
|
], 404);
|
||||||
|
} elseif (! ctype_alnum($workCenter)) {
|
||||||
|
return response()->json([
|
||||||
|
'status_code' => 'ERROR',
|
||||||
|
'status_description' => "Work center '{$workCenter}' should contain only alpha-numeric values!",
|
||||||
|
], 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
$plant = Plant::where('code', $plantCode)->first();
|
||||||
if (! $plant) {
|
if (! $plant) {
|
||||||
// return response("Plant not found.", 400)->header('Content-Type', 'text/plain');
|
// return response("Plant not found.", 400)->header('Content-Type', 'text/plain');
|
||||||
return response()->json([
|
return response()->json([
|
||||||
@@ -713,19 +781,7 @@ class TestingPanelController extends Controller
|
|||||||
$plantId = $plant->id;
|
$plantId = $plant->id;
|
||||||
$plantName = $plant->name;
|
$plantName = $plant->name;
|
||||||
|
|
||||||
if ($data['line_name'] == null || $data['line_name'] == '') {
|
$gWorkCenter = WorkGroupMaster::where('name', $groupWorkCenter)->first();
|
||||||
return response()->json([
|
|
||||||
'status_code' => 'ERROR',
|
|
||||||
'status_description' => "Group work center can't be empty!",
|
|
||||||
], 404);
|
|
||||||
} elseif (Str::length($data['line_name']) < 0) {
|
|
||||||
return response()->json([
|
|
||||||
'status_code' => 'ERROR',
|
|
||||||
'status_description' => 'Invalid group work center found!',
|
|
||||||
], 404);
|
|
||||||
}
|
|
||||||
|
|
||||||
$gWorkCenter = WorkGroupMaster::where('name', $data['line_name'])->first();
|
|
||||||
if (! $gWorkCenter) {
|
if (! $gWorkCenter) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status_code' => 'ERROR',
|
'status_code' => 'ERROR',
|
||||||
@@ -733,30 +789,18 @@ class TestingPanelController extends Controller
|
|||||||
], 404);
|
], 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$gWorkCenter = WorkGroupMaster::where('name', $data['line_name'])->where('plant_id', $plantId)->first();
|
$gWorkCenter = WorkGroupMaster::where('name', $groupWorkCenter)->where('plant_id', $plantId)->first();
|
||||||
if (! $gWorkCenter) {
|
if (! $gWorkCenter) {
|
||||||
// return response( "Line not found for the specified plant : {$data['plant_code']}",400)->header('Content-Type', 'text/plain');
|
// return response( "Line not found for the specified plant : {$plantCode}",400)->header('Content-Type', 'text/plain');
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status_code' => 'ERROR',
|
'status_code' => 'ERROR',
|
||||||
'status_description' => "Group work center not found for the specified plant : '{$data['plant_code']}'!",
|
'status_description' => "Group work center not found for the specified plant : '{$plantCode}'!",
|
||||||
], 404);
|
], 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$gWorkCenterId = $gWorkCenter->id;
|
$gWorkCenterId = $gWorkCenter->id;
|
||||||
|
|
||||||
if ($data['machine_name'] == null || $data['machine_name'] == '') {
|
$machine = Machine::where('work_center', $workCenter)->first();
|
||||||
return response()->json([
|
|
||||||
'status_code' => 'ERROR',
|
|
||||||
'status_description' => "Work center can't be empty!",
|
|
||||||
], 404);
|
|
||||||
} elseif (Str::length($data['machine_name']) < 0) {
|
|
||||||
return response()->json([
|
|
||||||
'status_code' => 'ERROR',
|
|
||||||
'status_description' => 'Invalid work center found!',
|
|
||||||
], 404);
|
|
||||||
}
|
|
||||||
|
|
||||||
$machine = Machine::where('work_center', $data['machine_name'])->first();
|
|
||||||
if (! $machine) {
|
if (! $machine) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status_code' => 'ERROR',
|
'status_code' => 'ERROR',
|
||||||
@@ -764,29 +808,29 @@ class TestingPanelController extends Controller
|
|||||||
], 404);
|
], 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$machine = Machine::where('work_center', $data['machine_name'])->where('plant_id', $plantId)->first();
|
$machine = Machine::where('work_center', $workCenter)->where('plant_id', $plantId)->first();
|
||||||
if (! $machine) {
|
if (! $machine) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status_code' => 'ERROR',
|
'status_code' => 'ERROR',
|
||||||
'status_description' => "Work center not found for the specified plant : '{$data['plant_code']}'!",
|
'status_description' => "Work center not found for the specified plant : '{$plantCode}'!",
|
||||||
], 404);
|
], 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$machine = Machine::where('work_center', $data['machine_name'])->where('work_group_master_id', $gWorkCenterId)->first();
|
$machine = Machine::where('work_center', $workCenter)->where('work_group_master_id', $gWorkCenterId)->first();
|
||||||
if (! $machine) {
|
if (! $machine) {
|
||||||
// return response("Machine not found for the specified line : {$data['line_name']}", 400)->header('Content-Type', 'text/plain');
|
// return response("Machine not found for the specified line : {$groupWorkCenter}", 400)->header('Content-Type', 'text/plain');
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status_code' => 'ERROR',
|
'status_code' => 'ERROR',
|
||||||
'status_description' => "Work center not found for the specified Group work center : '{$data['line_name']}'!",
|
'status_description' => "Work center not found for the specified Group work center : '{$groupWorkCenter}'!",
|
||||||
], 404);
|
], 404);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$machine = Machine::where('work_center', $data['machine_name'])->where('plant_id', $plantId)->where('work_group_master_id', $gWorkCenterId)->first();
|
$machine = Machine::where('work_center', $workCenter)->where('plant_id', $plantId)->where('work_group_master_id', $gWorkCenterId)->first();
|
||||||
if (! $machine) {
|
if (! $machine) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status_code' => 'ERROR',
|
'status_code' => 'ERROR',
|
||||||
'status_description' => "Work center not found for the specified Plant : '{$data['plant_code']}' and Group work center : '{$data['line_name']}'!",
|
'status_description' => "Work center not found for the specified Plant : '{$plantCode}' and Group work center : '{$groupWorkCenter}'!",
|
||||||
], 404);
|
], 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1478,7 +1522,7 @@ class TestingPanelController extends Controller
|
|||||||
'flow_reading' => $entry['flow_reading'] ?? '0',
|
'flow_reading' => $entry['flow_reading'] ?? '0',
|
||||||
'current' => $entry['current'] ?? '0',
|
'current' => $entry['current'] ?? '0',
|
||||||
'watt' => $entry['watt'] ?? '0',
|
'watt' => $entry['watt'] ?? '0',
|
||||||
'tested_by' => $entry['created_by'] ?? $userName,
|
'tested_by' => (($entry['created_by'] == 'Admin') ? 'jothi' : $entry['created_by']) ?? $userName,
|
||||||
'created_datetime' => ! empty($entry['created_at']) ? Carbon::parse($entry['created_at'])->setTimezone('Asia/Kolkata')->format('Y-m-d H:i:s') : now('Asia/Kolkata')->format('Y-m-d H:i:s'),
|
'created_datetime' => ! empty($entry['created_at']) ? Carbon::parse($entry['created_at'])->setTimezone('Asia/Kolkata')->format('Y-m-d H:i:s') : now('Asia/Kolkata')->format('Y-m-d H:i:s'),
|
||||||
];
|
];
|
||||||
}, $pumpTestingEntries ?? []),
|
}, $pumpTestingEntries ?? []),
|
||||||
@@ -1704,8 +1748,7 @@ class TestingPanelController extends Controller
|
|||||||
$flow_reading = $entry['flow_reading'] ?? '0';
|
$flow_reading = $entry['flow_reading'] ?? '0';
|
||||||
$current = $entry['current'] ?? '0';
|
$current = $entry['current'] ?? '0';
|
||||||
$watt = $entry['watt'] ?? '0';
|
$watt = $entry['watt'] ?? '0';
|
||||||
$tested_by = $entry['tested_by'] ?? $userName;
|
$tested_by = (($entry['tested_by'] == 'jothi') ? 'Admin' : $entry['tested_by']) ?? $userName;
|
||||||
$tested_by = ($tested_by == 'jothi') ? 'Admin' : $tested_by;
|
|
||||||
// $pendingExists = PumpTestingEntry::where('plant_id', $plantId)->where('pump_serial_number', $pumpSerial)->where('pump_testing_master_id', $pumpMasterId)->where('tested_type', $testedType)->where('sl_no', $sl_no)->first();
|
// $pendingExists = PumpTestingEntry::where('plant_id', $plantId)->where('pump_serial_number', $pumpSerial)->where('pump_testing_master_id', $pumpMasterId)->where('tested_type', $testedType)->where('sl_no', $sl_no)->first();
|
||||||
|
|
||||||
$cnt++;
|
$cnt++;
|
||||||
@@ -1780,8 +1823,7 @@ class TestingPanelController extends Controller
|
|||||||
$flow_reading = $entry['flow_reading'] ?? '0';
|
$flow_reading = $entry['flow_reading'] ?? '0';
|
||||||
$current = $entry['current'] ?? '0';
|
$current = $entry['current'] ?? '0';
|
||||||
$watt = $entry['watt'] ?? '0';
|
$watt = $entry['watt'] ?? '0';
|
||||||
$tested_by = $entry['tested_by'] ?? $userName;
|
$tested_by = (($entry['tested_by'] == 'jothi') ? 'Admin' : $entry['tested_by']) ?? $userName;
|
||||||
$tested_by = ($tested_by == 'jothi') ? 'Admin' : $tested_by;
|
|
||||||
|
|
||||||
$createdRows++;
|
$createdRows++;
|
||||||
PumpTestingEntry::create([
|
PumpTestingEntry::create([
|
||||||
@@ -2043,7 +2085,7 @@ class TestingPanelController extends Controller
|
|||||||
'flow_reading' => $result['discharge'] ?? '0',
|
'flow_reading' => $result['discharge'] ?? '0',
|
||||||
'current' => $result['current'] ?? '0',
|
'current' => $result['current'] ?? '0',
|
||||||
'watt' => (string) (($result['watt'] ?? '0') * 1000),
|
'watt' => (string) (($result['watt'] ?? '0') * 1000),
|
||||||
'tested_by' => $result['created_by'] ?? $userName,
|
'tested_by' => (($result['created_by'] == 'Admin') ? 'jothi' : $result['created_by']) ?? $userName,
|
||||||
'created_datetime' => ! empty($result['created_at']) ? Carbon::parse($result['created_at'])->setTimezone('Asia/Kolkata')->format('Y-m-d H:i:s') : now('Asia/Kolkata')->format('Y-m-d H:i:s'),
|
'created_datetime' => ! empty($result['created_at']) ? Carbon::parse($result['created_at'])->setTimezone('Asia/Kolkata')->format('Y-m-d H:i:s') : now('Asia/Kolkata')->format('Y-m-d H:i:s'),
|
||||||
];
|
];
|
||||||
}, $pumpTestingResults ?? []),
|
}, $pumpTestingResults ?? []),
|
||||||
@@ -2277,8 +2319,7 @@ class TestingPanelController extends Controller
|
|||||||
$power_p2 = $result['power_p2'] ?? '0';
|
$power_p2 = $result['power_p2'] ?? '0';
|
||||||
$overall_efficiency = $result['overall_efficiency'] ?? '0';
|
$overall_efficiency = $result['overall_efficiency'] ?? '0';
|
||||||
$pump_efficiency = $result['pump_efficiency'] ?? '0';
|
$pump_efficiency = $result['pump_efficiency'] ?? '0';
|
||||||
$tested_by = $result['tested_by'] ?? $userName;
|
$tested_by = (($result['tested_by'] == 'jothi') ? 'Admin' : $result['tested_by']) ?? $userName;
|
||||||
$tested_by = ($tested_by == 'jothi') ? 'Admin' : $tested_by;
|
|
||||||
// $pendingExists = PumpTestingResult::where('plant_id', $plantId)->where('pump_serial_number', $pumpSerial)->where('pump_testing_master_id', $pumpMasterId)->where('tested_type', $testedType)->where('sl_no', $sl_no)->first();
|
// $pendingExists = PumpTestingResult::where('plant_id', $plantId)->where('pump_serial_number', $pumpSerial)->where('pump_testing_master_id', $pumpMasterId)->where('tested_type', $testedType)->where('sl_no', $sl_no)->first();
|
||||||
|
|
||||||
$cnt++;
|
$cnt++;
|
||||||
@@ -2368,8 +2409,7 @@ class TestingPanelController extends Controller
|
|||||||
$power_p2 = $result['power_p2'] ?? '0';
|
$power_p2 = $result['power_p2'] ?? '0';
|
||||||
$overall_efficiency = $result['overall_efficiency'] ?? '0';
|
$overall_efficiency = $result['overall_efficiency'] ?? '0';
|
||||||
$pump_efficiency = $result['pump_efficiency'] ?? '0';
|
$pump_efficiency = $result['pump_efficiency'] ?? '0';
|
||||||
$tested_by = $result['tested_by'] ?? $userName;
|
$tested_by = (($result['tested_by'] == 'jothi') ? 'Admin' : $result['tested_by']) ?? $userName;
|
||||||
$tested_by = ($tested_by == 'jothi') ? 'Admin' : $tested_by;
|
|
||||||
|
|
||||||
$createdRows++;
|
$createdRows++;
|
||||||
PumpTestingResult::create([
|
PumpTestingResult::create([
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ class TestingPanelReading extends Model
|
|||||||
'result',
|
'result',
|
||||||
'remark',
|
'remark',
|
||||||
'rework_count',
|
'rework_count',
|
||||||
|
'rework_winded',
|
||||||
'update_count',
|
'update_count',
|
||||||
'output_flag',
|
'output_flag',
|
||||||
'tested_by',
|
'tested_by',
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*/
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
$sql1 = <<<'SQL'
|
||||||
|
ALTER TABLE testing_panel_readings
|
||||||
|
ADD COLUMN rework_winded TEXT DEFAULT '0'
|
||||||
|
SQL;
|
||||||
|
|
||||||
|
DB::statement($sql1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
// Schema::table('testing_panel_readings', function (Blueprint $table) {
|
||||||
|
// //
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user