From 110b8b2e927985eb3d47ab97a7bd9f4cb965b415 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Thu, 8 Oct 2026 09:59:45 +0530 Subject: [PATCH 1/4] Refactored form design, validation and Added items - description, category, uom in resource files --- .../RequestCharacteristicResource.php | 21 +++++++++ .../TempClassCharacteristicResource.php | 21 +++++++++ .../TempStopCharacteristicResource.php | 44 ++++++++++++++----- .../WindedSerialValidationErrorResource.php | 24 ++++++---- 4 files changed, 91 insertions(+), 19 deletions(-) diff --git a/app/Filament/Resources/RequestCharacteristicResource.php b/app/Filament/Resources/RequestCharacteristicResource.php index 8eb837e3..9533443b 100644 --- a/app/Filament/Resources/RequestCharacteristicResource.php +++ b/app/Filament/Resources/RequestCharacteristicResource.php @@ -1049,6 +1049,27 @@ class RequestCharacteristicResource extends Resource ->alignCenter() ->searchable() ->sortable(), + Tables\Columns\TextColumn::make('item.description') + ->label('Description') + ->default('-') + ->searchable() + ->alignCenter() + ->sortable() + ->toggleable(isToggledHiddenByDefault: true), + Tables\Columns\TextColumn::make('item.category') + ->label('Category') + ->default('-') + ->searchable() + ->alignCenter() + ->sortable() + ->toggleable(isToggledHiddenByDefault: true), + Tables\Columns\TextColumn::make('item.uom') + ->label('Unit of Measure') + ->default('-') + ->searchable() + ->alignCenter() + ->sortable() + ->toggleable(isToggledHiddenByDefault: true), Tables\Columns\TextColumn::make('aufnr') ->label('Job Number') ->alignCenter() diff --git a/app/Filament/Resources/TempClassCharacteristicResource.php b/app/Filament/Resources/TempClassCharacteristicResource.php index f57b9df9..a79b3677 100644 --- a/app/Filament/Resources/TempClassCharacteristicResource.php +++ b/app/Filament/Resources/TempClassCharacteristicResource.php @@ -1183,6 +1183,27 @@ class TempClassCharacteristicResource extends Resource ->alignCenter() ->searchable() ->sortable(), + Tables\Columns\TextColumn::make('item.description') + ->label('DESCRIPTION') + ->default('-') + ->searchable() + ->alignCenter() + ->sortable() + ->toggleable(isToggledHiddenByDefault: true), + Tables\Columns\TextColumn::make('item.category') + ->label('CATEGORY') + ->default('-') + ->searchable() + ->alignCenter() + ->sortable() + ->toggleable(isToggledHiddenByDefault: true), + Tables\Columns\TextColumn::make('item.uom') + ->label('UNIT OF MEASURE') + ->default('-') + ->searchable() + ->alignCenter() + ->sortable() + ->toggleable(isToggledHiddenByDefault: true), Tables\Columns\TextColumn::make('model_type') ->label('MODEL TYPE') ->alignCenter() diff --git a/app/Filament/Resources/TempStopCharacteristicResource.php b/app/Filament/Resources/TempStopCharacteristicResource.php index 896da557..b2bc7070 100644 --- a/app/Filament/Resources/TempStopCharacteristicResource.php +++ b/app/Filament/Resources/TempStopCharacteristicResource.php @@ -128,7 +128,7 @@ class TempStopCharacteristicResource extends Resource $set('updated_by', Filament::auth()->user()?->name); }) ->required() - ->disabled(fn (Get $get) => ! empty($get('id'))), + ->readonly(fn (Get $get) => ! empty($get('id'))), Forms\Components\TextInput::make('aufnr') ->label('Job Number') ->reactive() @@ -152,18 +152,16 @@ class TempStopCharacteristicResource extends Resource return ($userHas && strlen($userHas) > 0) ? null : optional(TempStopCharacteristic::latest()->first())->aufnr ?? null; }) - ->readOnly(fn ($get) => ($get('item_id') == null)) - ->disabled(fn (Get $get) => ! empty($get('id'))), + ->readonly(fn (Get $get) => ! empty($get('id')) || ! $get('item_id')), Forms\Components\TextInput::make('gernr') ->label('Serial Number') ->reactive() ->minLength(13) - ->readOnly(fn (callable $get) => ! $get('aufnr')) ->afterStateUpdated(function ($state, callable $set, callable $get) { $set('updated_by', Filament::auth()->user()?->name); }) ->required() - ->disabled(fn (Get $get) => ! empty($get('id'))), + ->readonly(fn (Get $get) => ! empty($get('id')) || ! $get('aufnr')), Forms\Components\TextInput::make('zmm_heading') ->label('Zmm Heading') ->reactive() @@ -172,7 +170,7 @@ class TempStopCharacteristicResource extends Resource $set('updated_by', Filament::auth()->user()?->name); }) ->required() - ->disabled(fn (Get $get) => ! empty($get('id'))), + ->readonly(fn (Get $get) => ! empty($get('id'))), Forms\Components\Select::make('model_type') ->label('Model Type') ->reactive() @@ -200,7 +198,7 @@ class TempStopCharacteristicResource extends Resource $set('updated_by', Filament::auth()->user()?->name); }) ->required() - ->disabled(fn (Get $get) => ! empty($get('id'))), + ->readonly(fn (Get $get) => ! empty($get('id'))), Forms\Components\TextInput::make('samlight_logged_name') ->label('SAMLight Logged Name') ->reactive() @@ -208,7 +206,7 @@ class TempStopCharacteristicResource extends Resource ->afterStateUpdated(function ($state, callable $set, callable $get) { $set('updated_by', Filament::auth()->user()?->name); }) - ->disabled(fn (Get $get) => ! empty($get('id'))), + ->readonly(fn (Get $get) => ! empty($get('id'))), Forms\Components\DateTimePicker::make('stopped_at') ->label('Stopped At') ->default(now()) @@ -216,7 +214,8 @@ class TempStopCharacteristicResource extends Resource ->afterStateUpdated(function ($state, callable $set, callable $get) { $set('updated_by', Filament::auth()->user()?->name); }) - ->required(), + ->required() + ->disabled(fn (Get $get) => ! empty($get('id'))), Forms\Components\TextInput::make('stopped_by') ->label('Stopped By') ->reactive() @@ -224,7 +223,8 @@ class TempStopCharacteristicResource extends Resource ->afterStateUpdated(function ($state, callable $set, callable $get) { $set('updated_by', Filament::auth()->user()?->name); }) - ->required(), + ->required() + ->readonly(fn (Get $get) => ! empty($get('id'))), Forms\Components\TextInput::make('has_stop_flow_id') ->label('Has Stop Flow ID') ->reactive() @@ -236,7 +236,8 @@ class TempStopCharacteristicResource extends Resource } $set('updated_by', Filament::auth()->user()?->name); }) - ->required(), + ->required() + ->readonly(fn (Get $get) => ! empty($get('id'))), Forms\Components\Hidden::make('created_by') ->label('Created By') ->default(Filament::auth()->user()?->name), @@ -284,6 +285,27 @@ class TempStopCharacteristicResource extends Resource ->alignCenter() ->searchable() ->sortable(), + Tables\Columns\TextColumn::make('item.description') + ->label('Description') + ->default('-') + ->searchable() + ->alignCenter() + ->sortable() + ->toggleable(isToggledHiddenByDefault: true), + Tables\Columns\TextColumn::make('item.category') + ->label('Category') + ->default('-') + ->searchable() + ->alignCenter() + ->sortable() + ->toggleable(isToggledHiddenByDefault: true), + Tables\Columns\TextColumn::make('item.uom') + ->label('Unit of Measure') + ->default('-') + ->searchable() + ->alignCenter() + ->sortable() + ->toggleable(isToggledHiddenByDefault: true), Tables\Columns\TextColumn::make('aufnr') ->label('Job Number') ->alignCenter() diff --git a/app/Filament/Resources/WindedSerialValidationErrorResource.php b/app/Filament/Resources/WindedSerialValidationErrorResource.php index cc8ab431..7ab06165 100644 --- a/app/Filament/Resources/WindedSerialValidationErrorResource.php +++ b/app/Filament/Resources/WindedSerialValidationErrorResource.php @@ -141,7 +141,8 @@ class WindedSerialValidationErrorResource extends Resource ->reactive() ->afterStateUpdated(function ($state, callable $set) { $set('updated_by', Filament::auth()->user()?->name); - }), + }) + ->readOnly(fn (Get $get) => $get('id')), Forms\Components\TextInput::make('aufnr') ->label('AUFNR') ->placeholder('Scan the AUFNR') @@ -150,7 +151,8 @@ class WindedSerialValidationErrorResource extends Resource ->reactive() ->afterStateUpdated(function ($state, callable $set) { $set('updated_by', Filament::auth()->user()?->name); - }), + }) + ->readOnly(fn (Get $get) => $get('id')), Forms\Components\TextInput::make('gernr') ->label('GERNR') ->placeholder('Scan the GERNR') @@ -159,7 +161,8 @@ class WindedSerialValidationErrorResource extends Resource ->reactive() ->afterStateUpdated(function ($state, callable $set) { $set('updated_by', Filament::auth()->user()?->name); - }), + }) + ->readOnly(fn (Get $get) => $get('id')), Forms\Components\TextInput::make('model_type') ->label('Model Type') ->placeholder('Scan the Model Type') @@ -168,7 +171,8 @@ class WindedSerialValidationErrorResource extends Resource ->reactive() ->afterStateUpdated(function ($state, callable $set) { $set('updated_by', Filament::auth()->user()?->name); - }), + }) + ->readOnly(fn (Get $get) => $get('id')), Forms\Components\TextInput::make('winded_qr') ->label('Winded QR') ->placeholder('Scan the Winded QR') @@ -176,7 +180,8 @@ class WindedSerialValidationErrorResource extends Resource ->reactive() ->afterStateUpdated(function ($state, callable $set) { $set('updated_by', Filament::auth()->user()?->name); - }), + }) + ->readOnly(fn (Get $get) => $get('id')), Forms\Components\TextInput::make('winded_code') ->label('Winded Code') ->placeholder('Scan the Winded Code') @@ -184,7 +189,8 @@ class WindedSerialValidationErrorResource extends Resource ->reactive() ->afterStateUpdated(function ($state, callable $set) { $set('updated_by', Filament::auth()->user()?->name); - }), + }) + ->readOnly(fn (Get $get) => $get('id')), Forms\Components\TextInput::make('winded_serial_number') ->label('Winded Serial Number') ->placeholder('Scan the Winded Serial Number') @@ -192,7 +198,8 @@ class WindedSerialValidationErrorResource extends Resource ->reactive() ->afterStateUpdated(function ($state, callable $set) { $set('updated_by', Filament::auth()->user()?->name); - }), + }) + ->readOnly(fn (Get $get) => $get('id')), Forms\Components\TextInput::make('winded_status') ->label('Winded Status') ->placeholder('Scan the Winded Status') @@ -201,7 +208,8 @@ class WindedSerialValidationErrorResource extends Resource ->reactive() ->afterStateUpdated(function ($state, callable $set) { $set('updated_by', Filament::auth()->user()?->name); - }), + }) + ->readOnly(fn (Get $get) => $get('id')), Forms\Components\TextInput::make('created_by') ->default(fn () => Filament::auth()->user()?->name) ->readOnly() -- 2.49.1 From 00b3c0d6e5daee7ccb29fef1af91e373cc3ce2fa Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Thu, 8 Oct 2026 10:06:24 +0530 Subject: [PATCH 2/4] Refactored exporter form design and Added items - description, category, uom on export --- .../Exports/RequestCharacteristicExporter.php | 19 +++++++++++++++---- .../TempClassCharacteristicExporter.php | 9 +++++++++ .../TempStopCharacteristicExporter.php | 19 +++++++++++++++---- 3 files changed, 39 insertions(+), 8 deletions(-) diff --git a/app/Filament/Exports/RequestCharacteristicExporter.php b/app/Filament/Exports/RequestCharacteristicExporter.php index 8b80f092..2b44efaa 100644 --- a/app/Filament/Exports/RequestCharacteristicExporter.php +++ b/app/Filament/Exports/RequestCharacteristicExporter.php @@ -34,6 +34,15 @@ class RequestCharacteristicExporter extends Exporter ->label('MACHINE NAME'), ExportColumn::make('item.code') ->label('ITEM CODE'), + ExportColumn::make('item.description') + ->label('DESCRIPTION') + ->enabledByDefault(false), + ExportColumn::make('item.category') + ->label('CATEGORY') + ->enabledByDefault(false), + ExportColumn::make('item.uom') + ->label('UNIT OF MEASURE') + ->enabledByDefault(false), ExportColumn::make('aufnr') ->label('JOB NUMBER'), ExportColumn::make('gernr') @@ -95,12 +104,14 @@ class RequestCharacteristicExporter extends Exporter ExportColumn::make('created_by') ->label('CREATED BY'), ExportColumn::make('updated_at') - ->label('UPDATED AT'), + ->label('UPDATED AT') + ->enabledByDefault(true), ExportColumn::make('updated_by') - ->label('UPDATED BY'), + ->label('UPDATED BY') + ->enabledByDefault(true), ExportColumn::make('deleted_at') - ->enabledByDefault(false) - ->label('DELETED AT'), + ->label('DELETED AT') + ->enabledByDefault(false), ]; } diff --git a/app/Filament/Exports/TempClassCharacteristicExporter.php b/app/Filament/Exports/TempClassCharacteristicExporter.php index 54b6a805..acee8a8d 100644 --- a/app/Filament/Exports/TempClassCharacteristicExporter.php +++ b/app/Filament/Exports/TempClassCharacteristicExporter.php @@ -28,6 +28,15 @@ class TempClassCharacteristicExporter extends Exporter ->label('WORK CENTER'), ExportColumn::make('item.code') ->label('ITEM CODE'), + ExportColumn::make('item.description') + ->label('DESCRIPTION') + ->enabledByDefault(false), + ExportColumn::make('item.category') + ->label('CATEGORY') + ->enabledByDefault(false), + ExportColumn::make('item.uom') + ->label('UNIT OF MEASURE') + ->enabledByDefault(false), ExportColumn::make('aufnr') ->label('AUFNR'), ExportColumn::make('class') diff --git a/app/Filament/Exports/TempStopCharacteristicExporter.php b/app/Filament/Exports/TempStopCharacteristicExporter.php index 0537df51..ce02363f 100644 --- a/app/Filament/Exports/TempStopCharacteristicExporter.php +++ b/app/Filament/Exports/TempStopCharacteristicExporter.php @@ -32,6 +32,15 @@ class TempStopCharacteristicExporter extends Exporter ->label('HAS STOP FLOW ID'), ExportColumn::make('item.code') ->label('ITEM CODE'), + ExportColumn::make('item.description') + ->label('DESCRIPTION') + ->enabledByDefault(false), + ExportColumn::make('item.category') + ->label('CATEGORY') + ->enabledByDefault(false), + ExportColumn::make('item.uom') + ->label('UNIT OF MEASURE') + ->enabledByDefault(false), ExportColumn::make('aufnr') ->label('JOB NUMBER'), ExportColumn::make('gernr') @@ -55,12 +64,14 @@ class TempStopCharacteristicExporter extends Exporter ExportColumn::make('created_by') ->label('CREATED BY'), ExportColumn::make('updated_at') - ->label('UPDATED AT'), + ->label('UPDATED AT') + ->enabledByDefault(true), ExportColumn::make('updated_by') - ->label('UPDATED BY'), + ->label('UPDATED BY') + ->enabledByDefault(true), ExportColumn::make('deleted_at') - ->enabledByDefault(false) - ->label('DELETED AT'), + ->label('DELETED AT') + ->enabledByDefault(false), ]; } -- 2.49.1 From b902ea83f0d39cd6082cca46f68cd4318550f915 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Thu, 8 Oct 2026 11:07:54 +0530 Subject: [PATCH 3/4] Updated item example value as 'TEST001' in importer --- app/Filament/Imports/RequestCharacteristicImporter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Filament/Imports/RequestCharacteristicImporter.php b/app/Filament/Imports/RequestCharacteristicImporter.php index b13b970c..a7a8a82c 100644 --- a/app/Filament/Imports/RequestCharacteristicImporter.php +++ b/app/Filament/Imports/RequestCharacteristicImporter.php @@ -31,7 +31,7 @@ class RequestCharacteristicImporter extends Importer ImportColumn::make('item') ->requiredMapping() ->exampleHeader('ITEM CODE') - ->example('630214') + ->example('TEST001') ->label('ITEM CODE') ->relationship(resolveUsing: 'code') ->rules(['required']), -- 2.49.1 From e8066f97b001b89ab3daa8556485fdaebedae1e2 Mon Sep 17 00:00:00 2001 From: dhanabalan Date: Thu, 8 Oct 2026 13:07:13 +0530 Subject: [PATCH 4/4] Added item characteristic importer logic --- .../Imports/ItemCharacteristicImporter.php | 335 ++++++++++++++++-- 1 file changed, 313 insertions(+), 22 deletions(-) diff --git a/app/Filament/Imports/ItemCharacteristicImporter.php b/app/Filament/Imports/ItemCharacteristicImporter.php index 8b4b43c5..c4649232 100644 --- a/app/Filament/Imports/ItemCharacteristicImporter.php +++ b/app/Filament/Imports/ItemCharacteristicImporter.php @@ -2,10 +2,14 @@ namespace App\Filament\Imports; +use App\Models\Item; use App\Models\ItemCharacteristic; +use App\Models\Plant; use Filament\Actions\Imports\ImportColumn; use Filament\Actions\Imports\Importer; use Filament\Actions\Imports\Models\Import; +use Filament\Notifications\Notification; +use Illuminate\Support\Str; class ItemCharacteristicImporter extends Importer { @@ -560,34 +564,321 @@ class ItemCharacteristicImporter extends Importer ->label('ZMM MRP') ->exampleHeader('ZMM MRP') ->example(''), - ImportColumn::make('zmm_1'), - ImportColumn::make('zmm_2'), - ImportColumn::make('zmm_3'), - ImportColumn::make('zmm_4'), - ImportColumn::make('zmm_5'), - ImportColumn::make('zmm_6'), - ImportColumn::make('zmm_7'), - ImportColumn::make('zmm_8'), - ImportColumn::make('zmm_9'), - ImportColumn::make('zmm_10'), - ImportColumn::make('zmm_11'), - ImportColumn::make('zmm_12'), - ImportColumn::make('zmm_13'), - ImportColumn::make('zmm_14'), - ImportColumn::make('zmm_15'), - ImportColumn::make('created_by'), - ImportColumn::make('updated_by'), ]; } public function resolveRecord(): ?ItemCharacteristic { - // return ItemCharacteristic::firstOrNew([ - // // Update existing records, matching them by `$this->data['column_name']` - // 'email' => $this->data['email'], - // ]); + $warnMsg = []; + $plantId = null; - return new ItemCharacteristic; + $plantCod = $this->data['plant']; + $iCode = $this->data['item']; + $class = $this->data['class']; + $zz1CnBillOrd = $this->data['zz1_cn_bill_ord']; + $zmmAmps = $this->data['zmm_amps']; + $zmmBrand = $this->data['zmm_brand']; + $zmmDegreeOfProtection = $this->data['zmm_degreeofprotection']; + $zmmDelivery = $this->data['zmm_delivery']; + $zmmDirRot = $this->data['zmm_dir_rot']; + $zmmDischarge = $this->data['zmm_discharge']; + $zmmDischargeMax = $this->data['zmm_discharge_max']; + $zmmDischargeMin = $this->data['zmm_discharge_min']; + $zmmDuty = $this->data['zmm_duty']; + $zmmEffMotor = $this->data['zmm_eff_motor']; + $zmmEffPump = $this->data['zmm_eff_pump']; + $zmmEffFrequency = $this->data['zmm_frequency']; + $zmmHead = $this->data['zmm_head']; + $zmmHeading = $this->data['zmm_heading']; + $zmmHeadMax = $this->data['zmm_head_max']; + $zmmHeadMin = $this->data['zmm_head_minimum']; + $zmmIdxEffMtr = $this->data['zmm_idx_eff_mtr']; + $zmmIdxEffPump = $this->data['zmm_idx_eff_pump']; + $zmmKvaCode = $this->data['zmm_kvacode']; + $zmmMaxAmbTemp = $this->data['zmm_maxambtemp']; + $zmmMinCoolingFlow = $this->data['zmm_mincoolingflow']; + $zmmMotorSeries = $this->data['zmm_motorseries']; + $zmmMotorModel = $this->data['zmm_motor_model']; + $zmmOutLet = $this->data['zmm_outlet']; + $zmmPhase = $this->data['zmm_phase']; + $zmmPressure = $this->data['zmm_pressure']; + $zmmPumpFlowType = $this->data['zmm_pumpflowtype']; + $zmmPumpSeries = $this->data['zmm_pumpseries']; + $zmmPumpModel = $this->data['zmm_pump_model']; + $zmmRatedPower = $this->data['zmm_ratedpower']; + $zmmRegion = $this->data['zmm_region']; + $zmmServiceFactor = $this->data['zmm_servicefactor']; + $zmmServiceFactorMaxAmps = $this->data['zmm_servicefactormaximumamps']; + $zmmSpeed = $this->data['zmm_speed']; + $zmmSuction = $this->data['zmm_suction']; + $zmmSuctionXDelivery = $this->data['zmm_suctionxdelivery']; + $zmmSupplySource = $this->data['zmm_supplysource']; + $zmmTemperature = $this->data['zmm_temperature']; + $zmmThrustLoad = $this->data['zmm_thrustload']; + $zmmVolts = $this->data['zmm_volts']; + $zmmWire = $this->data['zmm_wire']; + $zmmPackage = $this->data['zmm_package']; + $zmmPvarrayRating = $this->data['zmm_pvarrayrating']; + $zmmIsI = $this->data['zmm_isi']; + $zmmIsIMotor = $this->data['zmm_isimotor']; + $zmmIsIPump = $this->data['zmm_isipump']; + $zmmIsIPumpSet = $this->data['zmm_isipumpset']; + $zmmPumpSetModel = $this->data['zmm_pumpset_model']; + $zmmStages = $this->data['zmm_stages']; + $zmmHeadRange = $this->data['zmm_headrange']; + $zmmOverAllEff = $this->data['zmm_overall_efficiency']; + $zmmConnection = $this->data['zmm_connection']; + $zmmMinBoreSize = $this->data['zmm_min_bore_size']; + $zmmIsiRef = $this->data['zmm_isireference']; + $zmmCategory = $this->data['zmm_category']; + $zmmSubMergence = $this->data['zmm_submergence']; + $zmmCapStart = $this->data['zmm_capacitorstart']; + $zmmCapRun = $this->data['zmm_capacitorrun']; + $zmmInch = $this->data['zmm_inch']; + $zmmMotorType = $this->data['zmm_motor_type']; + $zmmDismantleDirection = $this->data['zmm_dismantle_direction']; + $zmmEffOverall = $this->data['zmm_eff_ovrall']; + $zmmBodyMoc = $this->data['zmm_bodymoc']; + $zmmRotorMoc = $this->data['zmm_rotormoc']; + $zmmDlWl = $this->data['zmm_dlwl']; + $zmmInputPower = $this->data['zmm_inputpower']; + $zmmImpOd = $this->data['zmm_imp_od']; + $zmmAmbTemp = $this->data['zmm_ambtemp']; + $zmmDe = $this->data['zmm_de']; + $zmmDischargeRange = $this->data['zmm_dischargerange']; + $zmmEffClass = $this->data['zmm_efficiency_class']; + $zmmFrameSize = $this->data['zmm_framesize']; + $zmmImpDia = $this->data['zmm_impellerdiameter']; + $zmmInsulationClass = $this->data['zmm_insulationclass']; + $zmmMaxFlow = $this->data['zmm_maxflow']; + $zmmMinHead = $this->data['zmm_minhead']; + $zmmMtrlOfConst = $this->data['zmm_mtrlofconst']; + $zmmNde = $this->data['zmm_nde']; + $zmmPowerFactor = $this->data['zmm_powerfactor']; + $zmmTagno = $this->data['zmm_tagno']; + $zmmYear = $this->data['zmm_year']; + $zmmLaserName = $this->data['zmm_laser_name']; + $zmmBeeNote = $this->data['zmm_beenote']; + $zmmBeeNumber = $this->data['zmm_beenumber']; + $zmmBeeStar = $this->data['zmm_beestar']; + $zmmLogoCe = $this->data['zmm_logo_ce']; + $zmmCodeClass = $this->data['zmm_codeclass']; + $zmmColour = $this->data['zmm_colour']; + $zmmLogoCp = $this->data['zmm_logo_cp']; + $zmmGrade = $this->data['zmm_grade']; + $zmmGrwtPset = $this->data['zmm_grwt_pset']; + $zmmGrwtCable = $this->data['zmm_grwt_cable']; + $zmmGrwtMotor = $this->data['zmm_grwt_motor']; + $zmmGrwtPf = $this->data['zmm_grwt_pf']; + $zmmGrwtPump = $this->data['zmm_grwt_pump']; + $zmmIsiValve = $this->data['zmm_isivalve']; + $zmmIsiWc = $this->data['zmm_isi_wc']; + $zmmLabelPeriod = $this->data['zmm_labelperiod']; + $zmmLength = $this->data['zmm_length']; + $zmmLicenseCmlNo = $this->data['zmm_license_cml_no']; + $zmmMfgmonyr = $this->data['zmm_mfgmonyr']; + $zmmModelYear = $this->data['zmm_modelyear']; + $zmmMotorIdentification = $this->data['zmm_motoridentification']; + $zmmNewtPset = $this->data['zmm_newt_pset']; + $zmmNewtCable = $this->data['zmm_newt_cable']; + $zmmNewtMotor = $this->data['zmm_newt_motor']; + $zmmNewtPf = $this->data['zmm_newt_pf']; + $zmmNewtPump = $this->data['zmm_newt_pump']; + $zmmLogoNsf = $this->data['zmm_logo_nsf']; + $zmmPackType = $this->data['zmm_packtype']; + $zmmPanel = $this->data['zmm_panel']; + $zmmPerformanceFactor = $this->data['zmm_performance_factor']; + $zmmPumpIden = $this->data['zmm_pumpidentification']; + $zmmPsetType = $this->data['zmm_psettype']; + $zmmSize = $this->data['zmm_size']; + $zmmEffTtl = $this->data['zmm_eff_ttl']; + $zmmType = $this->data['zmm_type']; + $zmmUsp = $this->data['zmm_usp']; + $zmmOperatingRange = $this->data['zmm_operating_range']; + $zmmIntakeAir = $this->data['zmm_intake_air']; + $zmmOxygenTransferRate = $this->data['zmm_oxygen_transfer_rate']; + $zmmAirInletPipeSize = $this->data['zmm_air_inlet_pipesize']; + $zmmSumpDepth = $this->data['zmm_sump_depth']; + $zmmPoles = $this->data['zmm_poles']; + $zmmMotorHeading = $this->data['zmm_motor_heading']; + $zmmMotorSpeed = $this->data['zmm_motor_speed']; + $zmmQty = $this->data['zqmm_qty']; + $zmmLogoEac = $this->data['zmm_logo_eac']; + $zmmOperTemp = $this->data['zmm_operating_temperature']; + $zmmAxialForce = $this->data['zmm_axial_force']; + $zmmMrp = $this->data['zmm_mrp']; + + if (Str::length($plantCod) < 4 || ! is_numeric($plantCod) || ! preg_match('/^[1-9]\d{3,}$/', $plantCod)) { + $warnMsg[] = 'Invalid plant code found'; + } else { + $plant = Plant::where('code', $plantCod)->first(); + if (! $plant) { + $warnMsg[] = 'Plant not found'; + } + } + + if (Str::length($iCode) < 6 || ! ctype_alnum($iCode)) { + $warnMsg[] = 'Invalid item code found'; + } + + if(!empty($iCode)){ + $item = Item::where('plant_id',$plant->id)->where('code', $iCode)->first(); + + if (! $item) { + $warnMsg[] = 'Item Code not found'; + } + } + + $itemCharacteristic = ItemCharacteristic::updateOrCreate([ + 'plant_id' => $plant->id, + 'item_id' => $item->id, + ], + [ + 'class' => $this->data['class'], + 'zz1_cn_bill_ord' => $this->data['zz1_cn_bill_ord'], + 'zmm_amps' => $this->data['zmm_amps'], + 'zmm_brand' => $this->data['zmm_brand'], + 'zmm_degreeofprotection' => $this->data['zmm_degreeofprotection'], + 'zmm_delivery' => $this->data['zmm_delivery'], + 'zmm_dir_rot' => $this->data['zmm_dir_rot'], + 'zmm_discharge' => $this->data['zmm_discharge'], + 'zmm_discharge_max' => $this->data['zmm_discharge_max'], + 'zmm_discharge_min' => $this->data['zmm_discharge_min'], + 'zmm_duty' => $this->data['zmm_duty'], + 'zmm_eff_motor' => $this->data['zmm_eff_motor'], + 'zmm_eff_pump' => $this->data['zmm_eff_pump'], + 'zmm_frequency' => $this->data['zmm_frequency'], + 'zmm_head' => $this->data['zmm_head'], + 'zmm_heading' => $this->data['zmm_heading'], + 'zmm_head_max' => $this->data['zmm_head_max'], + 'zmm_head_minimum' => $this->data['zmm_head_minimum'], + 'zmm_idx_eff_mtr' => $this->data['zmm_idx_eff_mtr'], + 'zmm_idx_eff_pump' => $this->data['zmm_idx_eff_pump'], + 'zmm_kvacode' => $this->data['zmm_kvacode'], + 'zmm_maxambtemp' => $this->data['zmm_maxambtemp'], + 'zmm_mincoolingflow' => $this->data['zmm_mincoolingflow'], + 'zmm_motorseries' => $this->data['zmm_motorseries'], + 'zmm_motor_model' => $this->data['zmm_motor_model'], + 'zmm_outlet' => $this->data['zmm_outlet'], + 'zmm_phase' => $this->data['zmm_phase'], + 'zmm_pressure' => $this->data['zmm_pressure'], + 'zmm_pumpflowtype' => $this->data['zmm_pumpflowtype'], + 'zmm_pumpseries' => $this->data['zmm_pumpseries'], + 'zmm_pump_model' => $this->data['zmm_pump_model'], + 'zmm_ratedpower' => $this->data['zmm_ratedpower'], + 'zmm_region' => $this->data['zmm_region'], + 'zmm_servicefactor' => $this->data['zmm_servicefactor'], + 'zmm_servicefactormaximumamps' => $this->data['zmm_servicefactormaximumamps'], + 'zmm_speed' => $this->data['zmm_speed'], + 'zmm_suction' => $this->data['zmm_suction'], + 'zmm_suctionxdelivery' => $this->data['zmm_suctionxdelivery'], + 'zmm_supplysource' => $this->data['zmm_supplysource'], + 'zmm_temperature' => $this->data['zmm_temperature'], + 'zmm_thrustload' => $this->data['zmm_thrustload'], + 'zmm_volts' => $this->data['zmm_volts'], + 'zmm_wire' => $this->data['zmm_wire'], + 'zmm_package' => $this->data['zmm_package'], + 'zmm_pvarrayrating' => $this->data['zmm_pvarrayrating'], + 'zmm_isi' => $this->data['zmm_isi'], + 'zmm_isimotor' => $this->data['zmm_isimotor'], + 'zmm_isipump' => $this->data['zmm_isipump'], + 'zmm_isipumpset' => $this->data['zmm_isipumpset'], + 'zmm_pumpset_model' => $this->data['zmm_pumpset_model'], + 'zmm_stages' => $this->data['zmm_stages'], + 'zmm_headrange' => $this->data['zmm_headrange'], + 'zmm_overall_efficiency' => $this->data['zmm_overall_efficiency'], + 'zmm_connection' => $this->data['zmm_connection'], + 'zmm_min_bore_size' => $this->data['zmm_min_bore_size'], + 'zmm_isireference' => $this->data['zmm_isireference'], + 'zmm_category' => $this->data['zmm_category'], + 'zmm_submergence' => $this->data['zmm_submergence'], + 'zmm_capacitorstart' => $this->data['zmm_capacitorstart'], + 'zmm_capacitorrun' => $this->data['zmm_capacitorrun'], + 'zmm_inch' => $this->data['zmm_inch'], + 'zmm_motor_type' => $this->data['zmm_motor_type'], + 'zmm_dismantle_direction' => $this->data['zmm_dismantle_direction'], + 'zmm_eff_ovrall' => $this->data['zmm_eff_ovrall'], + 'zmm_bodymoc' => $this->data['zmm_bodymoc'], + 'zmm_rotormoc' => $this->data['zmm_rotormoc'], + 'zmm_dlwl' => $this->data['zmm_dlwl'], + 'zmm_inputpower' => $this->data['zmm_inputpower'], + 'zmm_imp_od' => $this->data['zmm_imp_od'], + 'zmm_ambtemp' => $this->data['zmm_ambtemp'], + 'zmm_de' => $this->data['zmm_de'], + 'zmm_dischargerange' => $this->data['zmm_dischargerange'], + 'zmm_efficiency_class' => $this->data['zmm_efficiency_class'], + 'zmm_framesize' => $this->data['zmm_framesize'], + 'zmm_impellerdiameter' => $this->data['zmm_impellerdiameter'], + 'zmm_insulationclass' => $this->data['zmm_insulationclass'], + 'zmm_maxflow' => $this->data['zmm_maxflow'], + 'zmm_minhead' => $this->data['zmm_minhead'], + 'zmm_mtrlofconst' => $this->data['zmm_mtrlofconst'], + 'zmm_nde' => $this->data['zmm_nde'], + 'zmm_powerfactor' => $this->data['zmm_powerfactor'], + 'zmm_tagno' => $this->data['zmm_tagno'], + 'zmm_year' => $this->data['zmm_year'], + 'zmm_laser_name' => $this->data['zmm_laser_name'], + 'zmm_beenote' => $this->data['zmm_beenote'], + 'zmm_beenumber' => $this->data['zmm_beenumber'], + 'zmm_beestar' => $this->data['zmm_beestar'], + 'zmm_logo_ce' => $this->data['zmm_logo_ce'], + 'zmm_codeclass' => $this->data['zmm_codeclass'], + 'zmm_colour' => $this->data['zmm_colour'], + 'zmm_logo_cp' => $this->data['zmm_logo_cp'], + 'zmm_grade' => $this->data['zmm_grade'], + 'zmm_grwt_pset' => $this->data['zmm_grwt_pset'], + 'zmm_grwt_cable' => $this->data['zmm_grwt_cable'], + 'zmm_grwt_motor' => $this->data['zmm_grwt_motor'], + 'zmm_grwt_pf' => $this->data['zmm_grwt_pf'], + 'zmm_grwt_pump' => $this->data['zmm_grwt_pump'], + 'zmm_isivalve' => $this->data['zmm_isivalve'], + 'zmm_isi_wc' => $this->data['zmm_isi_wc'], + 'zmm_labelperiod' => $this->data['zmm_labelperiod'], + 'zmm_length' => $this->data['zmm_length'], + 'zmm_license_cml_no' => $this->data['zmm_license_cml_no'], + 'zmm_mfgmonyr' => $this->data['zmm_mfgmonyr'], + 'zmm_modelyear' => $this->data['zmm_modelyear'], + 'zmm_motoridentification' => $this->data['zmm_motoridentification'], + 'zmm_newt_pset' => $this->data['zmm_newt_pset'], + 'zmm_newt_cable' => $this->data['zmm_newt_cable'], + 'zmm_newt_motor' => $this->data['zmm_newt_motor'], + 'zmm_newt_pf' => $this->data['zmm_newt_pf'], + 'zmm_newt_pump' => $this->data['zmm_newt_pump'], + 'zmm_logo_nsf' => $this->data['zmm_logo_nsf'], + 'zmm_packtype' => $this->data['zmm_packtype'], + 'zmm_panel' => $this->data['zmm_panel'], + 'zmm_performance_factor' => $this->data['zmm_performance_factor'], + 'zmm_pumpidentification' => $this->data['zmm_pumpidentification'], + 'zmm_psettype' => $this->data['zmm_psettype'], + 'zmm_size' => $this->data['zmm_size'], + 'zmm_eff_ttl' => $this->data['zmm_eff_ttl'], + 'zmm_type' => $this->data['zmm_type'], + 'zmm_usp' => $this->data['zmm_usp'], + 'zmm_operating_range' => $this->data['zmm_operating_range'], + 'zmm_intake_air' => $this->data['zmm_intake_air'], + 'zmm_oxygen_transfer_rate' => $this->data['zmm_oxygen_transfer_rate'], + 'zmm_air_inlet_pipesize' => $this->data['zmm_air_inlet_pipesize'], + 'zmm_sump_depth' => $this->data['zmm_sump_depth'], + 'zmm_poles' => $this->data['zmm_poles'], + 'zmm_motor_heading' => $this->data['zmm_motor_heading'], + 'zmm_motor_speed' => $this->data['zmm_motor_speed'], + 'zqmm_qty' => $this->data['zqmm_qty'], + 'zmm_logo_eac' => $this->data['zmm_logo_eac'], + 'zmm_operating_temperature' => $this->data['zmm_operating_temperature'], + 'zmm_axial_force' => $this->data['zmm_axial_force'], + 'zmm_mrp' => $this->data['zmm_mrp'], + ] + ); + + if($itemCharacteristic){ + Notification::make() + ->title('Success') + ->body('Item characteristic saved successfully.') + ->success() + ->send(); + } + + return $itemCharacteristic; } public static function getCompletedNotificationBody(Import $import): string -- 2.49.1