Compare commits
1 Commits
master
...
renovate/p
| Author | SHA1 | Date | |
|---|---|---|---|
| 5f9c1d4c16 |
@@ -1,44 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Exports;
|
||||
|
||||
use App\Models\CharacteristicValue;
|
||||
use Filament\Actions\Exports\ExportColumn;
|
||||
use Filament\Actions\Exports\Exporter;
|
||||
use Filament\Actions\Exports\Models\Export;
|
||||
|
||||
class CharacteristicValueExporter extends Exporter
|
||||
{
|
||||
protected static ?string $model = CharacteristicValue::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
return [
|
||||
ExportColumn::make('id')
|
||||
->label('ID'),
|
||||
ExportColumn::make('plant.name'),
|
||||
ExportColumn::make('line.name'),
|
||||
ExportColumn::make('item.id'),
|
||||
ExportColumn::make('machine.name'),
|
||||
ExportColumn::make('process_order'),
|
||||
ExportColumn::make('coil_number'),
|
||||
ExportColumn::make('status'),
|
||||
ExportColumn::make('created_at'),
|
||||
ExportColumn::make('updated_at'),
|
||||
ExportColumn::make('created_by'),
|
||||
ExportColumn::make('updated_by'),
|
||||
ExportColumn::make('deleted_at'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Export $export): string
|
||||
{
|
||||
$body = 'Your characteristic value export has completed and ' . number_format($export->successful_rows) . ' ' . str('row')->plural($export->successful_rows) . ' exported.';
|
||||
|
||||
if ($failedRowsCount = $export->getFailedRowsCount()) {
|
||||
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to export.';
|
||||
}
|
||||
|
||||
return $body;
|
||||
}
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Imports;
|
||||
|
||||
use App\Models\CharacteristicValue;
|
||||
use Filament\Actions\Imports\ImportColumn;
|
||||
use Filament\Actions\Imports\Importer;
|
||||
use Filament\Actions\Imports\Models\Import;
|
||||
|
||||
class CharacteristicValueImporter extends Importer
|
||||
{
|
||||
protected static ?string $model = CharacteristicValue::class;
|
||||
|
||||
public static function getColumns(): array
|
||||
{
|
||||
return [
|
||||
ImportColumn::make('plant')
|
||||
->requiredMapping()
|
||||
->relationship()
|
||||
->rules(['required']),
|
||||
ImportColumn::make('line')
|
||||
->requiredMapping()
|
||||
->relationship()
|
||||
->rules(['required']),
|
||||
ImportColumn::make('item')
|
||||
->requiredMapping()
|
||||
->relationship()
|
||||
->rules(['required']),
|
||||
ImportColumn::make('machine')
|
||||
->requiredMapping()
|
||||
->relationship()
|
||||
->rules(['required']),
|
||||
ImportColumn::make('process_order'),
|
||||
ImportColumn::make('coil_number'),
|
||||
ImportColumn::make('status'),
|
||||
ImportColumn::make('created_by'),
|
||||
ImportColumn::make('updated_by'),
|
||||
];
|
||||
}
|
||||
|
||||
public function resolveRecord(): ?CharacteristicValue
|
||||
{
|
||||
// return CharacteristicValue::firstOrNew([
|
||||
// // Update existing records, matching them by `$this->data['column_name']`
|
||||
// 'email' => $this->data['email'],
|
||||
// ]);
|
||||
|
||||
return new CharacteristicValue();
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Import $import): string
|
||||
{
|
||||
$body = 'Your characteristic value import has completed and ' . number_format($import->successful_rows) . ' ' . str('row')->plural($import->successful_rows) . ' imported.';
|
||||
|
||||
if ($failedRowsCount = $import->getFailedRowsCount()) {
|
||||
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to import.';
|
||||
}
|
||||
|
||||
return $body;
|
||||
}
|
||||
}
|
||||
@@ -1,516 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources;
|
||||
|
||||
use App\Filament\Exports\CharacteristicValueExporter;
|
||||
use App\Filament\Imports\CharacteristicValueImporter;
|
||||
use App\Filament\Resources\CharacteristicValueResource\Pages;
|
||||
use App\Filament\Resources\CharacteristicValueResource\RelationManagers;
|
||||
use App\Models\CharacteristicValue;
|
||||
use App\Models\Item;
|
||||
use App\Models\Line;
|
||||
use App\Models\Machine;
|
||||
use App\Models\Plant;
|
||||
use Filament\Forms;
|
||||
use Filament\Forms\Form;
|
||||
use Filament\Resources\Resource;
|
||||
use Filament\Tables;
|
||||
use Filament\Tables\Table;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Forms\Components\DateTimePicker;
|
||||
use Filament\Tables\Filters\Filter;
|
||||
use Filament\Forms\Components\Select;
|
||||
use Filament\Forms\Components\TextInput;
|
||||
use Filament\Tables\Actions\ExportAction;
|
||||
use Filament\Tables\Actions\ImportAction;
|
||||
|
||||
class CharacteristicValueResource extends Resource
|
||||
{
|
||||
protected static ?string $model = CharacteristicValue::class;
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
protected static ?string $navigationGroup = 'Process Order';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
->schema([
|
||||
Forms\Components\Select::make('plant_id')
|
||||
->label('Plant')
|
||||
->relationship('plant', 'name')
|
||||
->options(function (callable $get) {
|
||||
$userHas = Filament::auth()->user()->plant_id;
|
||||
|
||||
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
|
||||
})
|
||||
->reactive()
|
||||
->afterStateUpdated(function ($state, $set, callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
$set('item_id', null);
|
||||
$set('line_id', null);
|
||||
$set('machine_id', null);
|
||||
if (! $plantId) {
|
||||
$set('poPlantError', 'Please select a plant first.');
|
||||
}
|
||||
})
|
||||
->extraAttributes(fn ($get) => [
|
||||
'class' => $get('poPlantError') ? 'border-red-500' : '',
|
||||
])
|
||||
->hint(fn ($get) => $get('poPlantError') ? $get('poPlantError') : null)
|
||||
->hintColor('danger')
|
||||
->required(),
|
||||
Forms\Components\Select::make('line_id')
|
||||
->label('Line')
|
||||
->options(function (callable $get) {
|
||||
if (!$get('plant_id')) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return Line::where('plant_id', $get('plant_id'))
|
||||
->pluck('name', 'id')
|
||||
->toArray();
|
||||
})
|
||||
->afterStateUpdated(function ($state, $set, callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
$set('item_id', null);
|
||||
$set('machine_id', null);
|
||||
if (! $plantId) {
|
||||
$set('poPlantError', 'Please select a plant first.');
|
||||
}
|
||||
})
|
||||
->reactive()
|
||||
->required(),
|
||||
Forms\Components\Select::make('item_id')
|
||||
->label('Item')
|
||||
->options(function (callable $get) {
|
||||
if (!$get('plant_id') || !$get('line_id')) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return Item::where('plant_id', $get('plant_id'))
|
||||
->pluck('code', 'id')
|
||||
->toArray();
|
||||
})
|
||||
->afterStateUpdated(function ($state, $set, callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
$set('machine_id', null);
|
||||
if (! $plantId) {
|
||||
$set('poPlantError', 'Please select a plant first.');
|
||||
}
|
||||
})
|
||||
->reactive()
|
||||
->required()
|
||||
->searchable(),
|
||||
Forms\Components\Select::make('machine_id')
|
||||
->label('Machine')
|
||||
->options(function (callable $get) {
|
||||
if (!$get('plant_id') || !$get('line_id') || !$get('item_id')) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return Machine::where('plant_id', $get('plant_id'))
|
||||
->where('line_id', $get('line_id'))
|
||||
->pluck('work_center', 'id')
|
||||
->toArray();
|
||||
})
|
||||
->afterStateUpdated(function ($state, $set, callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
$set('process_order', null);
|
||||
$set('coil_number', null);
|
||||
$set('status', null);
|
||||
if (! $plantId) {
|
||||
$set('poPlantError', 'Please select a plant first.');
|
||||
}
|
||||
})
|
||||
->reactive()
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('process_order')
|
||||
->label('Process Order')
|
||||
->reactive()
|
||||
->afterStateUpdated(function ($state, $set, callable $get) {
|
||||
$plantId = $get('plant_id');
|
||||
$set('coil_number', null);
|
||||
$set('status', null);
|
||||
if (! $plantId) {
|
||||
$set('poPlantError', 'Please select a plant first.');
|
||||
}
|
||||
})
|
||||
->required(),
|
||||
Forms\Components\TextInput::make('coil_number')
|
||||
->label('Coil Number')
|
||||
// ->reactive()
|
||||
// ->afterStateUpdated(function ($state, $set, callable $get) {
|
||||
// $plantId = $get('plant_id');
|
||||
// $set('status', null);
|
||||
// if (! $plantId) {
|
||||
// $set('poPlantError', 'Please select a plant first.');
|
||||
// }
|
||||
// })
|
||||
// ->required(),
|
||||
->label('Coil Number')
|
||||
->default('0')
|
||||
->reactive()
|
||||
->afterStateUpdated(function ($state, $set, callable $get, $livewire) {
|
||||
$plantId = $get('plant_id');
|
||||
$processOrder = $get('process_order');
|
||||
$coilNo = $get('coil_number');
|
||||
if (! $plantId) {
|
||||
$set('poPlantError', 'Please select a plant first.');
|
||||
} elseif (! $processOrder) {
|
||||
$set('coil_number', null);
|
||||
$set('poPlantError', null);
|
||||
} elseif ($coilNo || $coilNo == '0') {
|
||||
$existing = CharacteristicValue::where('plant_id', $plantId)
|
||||
->where('process_order', $processOrder)
|
||||
->where('coil_number', $coilNo)
|
||||
->first();
|
||||
|
||||
if ($existing) {
|
||||
$set('poPlantError', null);
|
||||
$set('coil_number', null);
|
||||
$set('coilNumberError', "Duplicate Coil : '{$coilNo}' found!");
|
||||
} else {
|
||||
$set('poPlantError', null);
|
||||
$set('coilNumberError', null);
|
||||
}
|
||||
}
|
||||
})
|
||||
->extraAttributes(fn ($get) => [
|
||||
'class' => $get('coilNumberError') ? 'border-red-500' : '',
|
||||
])
|
||||
->hint(fn ($get) => $get('coilNumberError') ? $get('coilNumberError') : null)
|
||||
->hintColor('danger')
|
||||
->required(),
|
||||
Forms\Components\Select::make('status')
|
||||
->label('Status')
|
||||
->options([
|
||||
'Ok' => 'OK',
|
||||
'NotOk' => 'Not Ok'
|
||||
])
|
||||
->reactive()
|
||||
->required(),
|
||||
Forms\Components\Hidden::make('created_by')
|
||||
->label('Created By')
|
||||
->default(Filament::auth()->user()?->name),
|
||||
Forms\Components\Hidden::make('updated_by')
|
||||
->label('Updated By')
|
||||
->default(Filament::auth()->user()?->name),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
->columns([
|
||||
Tables\Columns\TextColumn::make('No.')
|
||||
->label('No.')
|
||||
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
|
||||
$paginator = $livewire->getTableRecords();
|
||||
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
|
||||
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
|
||||
|
||||
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
|
||||
}),
|
||||
Tables\Columns\TextColumn::make('plant.name')
|
||||
->label('Plant')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('line.name')
|
||||
->label('Line')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('item.code')
|
||||
->label('Item')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('machine.work_center')
|
||||
->label('Machine')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('process_order')
|
||||
->label('Process Order')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('coil_number')
|
||||
->label('Coil Number')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('status')
|
||||
->label('Status')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('created_by')
|
||||
->label('Created By')
|
||||
->searchable()
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('created_at')
|
||||
->label('Created At')
|
||||
->alignCenter()
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('updated_at')
|
||||
->label('Updated At')
|
||||
->alignCenter()
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('deleted_at')
|
||||
->label('Deleted At')
|
||||
->alignCenter()
|
||||
->dateTime()
|
||||
->sortable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
])
|
||||
// ->filters([
|
||||
// Tables\Filters\TrashedFilter::make(),
|
||||
// ])
|
||||
->filters([
|
||||
|
||||
Tables\Filters\TrashedFilter::make(),
|
||||
Filter::make('advanced_filters')
|
||||
->label('Advanced Filters')
|
||||
->form([
|
||||
Select::make('Plant')
|
||||
->label('Select Plant')
|
||||
->nullable()
|
||||
->options(function (callable $get) {
|
||||
$userHas = Filament::auth()->user()->plant_id;
|
||||
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
|
||||
})
|
||||
->reactive()
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('Item', null);
|
||||
}),
|
||||
Select::make('Line')
|
||||
->label('Select Line')
|
||||
->nullable()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('Plant');
|
||||
|
||||
if(empty($plantId)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return Line::where('plant_id', $plantId)->pluck('name', 'id');
|
||||
|
||||
//return $plantId ? Item::where('plant_id', $plantId)->pluck('code', 'id') : [];
|
||||
})
|
||||
->reactive()
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('Item', null);
|
||||
}),
|
||||
Select::make('Item')
|
||||
->label('Item Code')
|
||||
->nullable()
|
||||
->searchable()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('Plant');
|
||||
|
||||
if(empty($plantId)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return Item::where('plant_id', $plantId)->pluck('code', 'id');
|
||||
|
||||
//return $plantId ? Item::where('plant_id', $plantId)->pluck('code', 'id') : [];
|
||||
})
|
||||
->reactive()
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('process_order', null);
|
||||
}),
|
||||
Select::make('Machine')
|
||||
->label('Select Machine')
|
||||
->nullable()
|
||||
->options(function (callable $get) {
|
||||
$plantId = $get('Plant');
|
||||
$lineId = $get('Line');
|
||||
|
||||
if(empty($plantId) || empty($lineId)) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return Machine::where('plant_id', $plantId)->where('line_id', $lineId)->pluck('work_center', 'id');
|
||||
|
||||
//return $plantId ? Item::where('plant_id', $plantId)->pluck('code', 'id') : [];
|
||||
})
|
||||
->reactive()
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('process_order', null);
|
||||
}),
|
||||
TextInput::make('process_order')
|
||||
->label('Process Order')
|
||||
->placeholder('Enter Process Order'),
|
||||
TextInput::make('coil_number')
|
||||
->label('Coil Number')
|
||||
->placeholder(placeholder: 'Enter Coil Number'),
|
||||
Select::make('status')
|
||||
->label('Status')
|
||||
->options([
|
||||
'Ok' => 'OK',
|
||||
'NotOk' => 'Not Ok'
|
||||
]),
|
||||
DateTimePicker::make(name: 'created_from')
|
||||
->label('Created From')
|
||||
->placeholder(placeholder: 'Select From DateTime')
|
||||
->reactive()
|
||||
->native(false),
|
||||
DateTimePicker::make('created_to')
|
||||
->label('Created To')
|
||||
->placeholder(placeholder: 'Select To DateTime')
|
||||
->reactive()
|
||||
->native(false),
|
||||
])
|
||||
->query(function ($query, array $data) {
|
||||
// Hide all records initially if no filters are applied
|
||||
if (empty($data['Plant']) && empty($data['Line']) && empty($data['Item']) && empty($data['Machine']) && empty($data['process_order']) && empty($data['coil_number']) && empty($data['status']) && empty($data['created_from']) && empty($data['created_to'])) {
|
||||
return $query->whereRaw('1 = 0');
|
||||
}
|
||||
|
||||
if (!empty($data['Plant'])) {
|
||||
$query->where('plant_id', $data['Plant']);
|
||||
}
|
||||
|
||||
if (!empty($data['Line'])) {
|
||||
$query->where('line_id', $data['Line']);
|
||||
}
|
||||
|
||||
if (!empty($data['Item'])) {
|
||||
$query->where('item_id', $data['Item']);
|
||||
}
|
||||
|
||||
if (!empty($data['Machine'])) {
|
||||
$query->where('machine_id', $data['Machine']);
|
||||
}
|
||||
|
||||
if (!empty($data['process_order'])) {
|
||||
$query->where('process_order', $data['process_order']);
|
||||
}
|
||||
|
||||
if (!empty($data['coil_number'])) {
|
||||
$query->where('coil_number', $data['coil_number']);
|
||||
}
|
||||
|
||||
if (!empty($data['status'])) {
|
||||
$query->where('status', $data['status']);
|
||||
}
|
||||
|
||||
if (!empty($data['created_from'])) {
|
||||
$query->where('created_at', '>=', $data['created_from']);
|
||||
}
|
||||
|
||||
if (!empty($data['created_to'])) {
|
||||
$query->where('created_at', '<=', $data['created_to']);
|
||||
}
|
||||
|
||||
|
||||
//$query->orderBy('created_at', 'asc');
|
||||
})
|
||||
->indicateUsing(function (array $data) {
|
||||
$indicators = [];
|
||||
|
||||
if (!empty($data['Plant'])) {
|
||||
$indicators[] = 'Plant: ' . Plant::where('id', $data['Plant'])->value('name');
|
||||
}
|
||||
|
||||
if (!empty($data['Line'])) {
|
||||
$indicators[] = 'Line: ' . Line::where('id', $data['Line'])->value('name');
|
||||
}
|
||||
|
||||
if (!empty($data['Item'])) {
|
||||
$indicators[] = 'Item: ' . Item::where('id', $data['Item'])->value('code');
|
||||
}
|
||||
|
||||
if (!empty($data['Machine'])) {
|
||||
$indicators[] = 'Machine: ' . Machine::where('id', $data['Machine'])->value('work_center');
|
||||
}
|
||||
|
||||
if (!empty($data['process_order'])) {
|
||||
$indicators[] = 'Process Order: ' . $data['process_order'];
|
||||
}
|
||||
|
||||
if (!empty($data['coil_number'])) {
|
||||
$indicators[] = 'Coil Number: ' . $data['coil_number'];
|
||||
}
|
||||
|
||||
if (!empty($data['status'])) {
|
||||
$indicators[] = 'Status: ' . $data['status'];
|
||||
}
|
||||
|
||||
if (!empty($data['created_from'])) {
|
||||
$indicators[] = 'From: ' . $data['created_from'];
|
||||
}
|
||||
|
||||
if (!empty($data['created_to'])) {
|
||||
$indicators[] = 'To: ' . $data['created_to'];
|
||||
}
|
||||
|
||||
return $indicators;
|
||||
})
|
||||
])
|
||||
->filtersFormMaxHeight('280px')
|
||||
->actions([
|
||||
Tables\Actions\ViewAction::make(),
|
||||
Tables\Actions\EditAction::make(),
|
||||
])
|
||||
->bulkActions([
|
||||
Tables\Actions\BulkActionGroup::make([
|
||||
Tables\Actions\DeleteBulkAction::make(),
|
||||
Tables\Actions\ForceDeleteBulkAction::make(),
|
||||
Tables\Actions\RestoreBulkAction::make(),
|
||||
]),
|
||||
])
|
||||
->headerActions([
|
||||
ImportAction::make()
|
||||
->importer(CharacteristicValueImporter::class)
|
||||
->label('Import Characteristic Value')
|
||||
->color('warning')
|
||||
->visible(function () {
|
||||
return Filament::auth()->user()->can('view import characteristic value');
|
||||
}),
|
||||
ExportAction::make()
|
||||
->exporter(CharacteristicValueExporter::class)
|
||||
->label('Export Characteristic Value')
|
||||
->color('warning')
|
||||
->visible(function () {
|
||||
return Filament::auth()->user()->can('view export characteristic value');
|
||||
}),
|
||||
]);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => Pages\ListCharacteristicValues::route('/'),
|
||||
'create' => Pages\CreateCharacteristicValue::route('/create'),
|
||||
'view' => Pages\ViewCharacteristicValue::route('/{record}'),
|
||||
'edit' => Pages\EditCharacteristicValue::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
|
||||
public static function getEloquentQuery(): Builder
|
||||
{
|
||||
return parent::getEloquentQuery()
|
||||
->withoutGlobalScopes([
|
||||
SoftDeletingScope::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\CharacteristicValueResource\Pages;
|
||||
|
||||
use App\Filament\Resources\CharacteristicValueResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
|
||||
class CreateCharacteristicValue extends CreateRecord
|
||||
{
|
||||
protected static string $resource = CharacteristicValueResource::class;
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\CharacteristicValueResource\Pages;
|
||||
|
||||
use App\Filament\Resources\CharacteristicValueResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
|
||||
class EditCharacteristicValue extends EditRecord
|
||||
{
|
||||
protected static string $resource = CharacteristicValueResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\ViewAction::make(),
|
||||
Actions\DeleteAction::make(),
|
||||
Actions\ForceDeleteAction::make(),
|
||||
Actions\RestoreAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\CharacteristicValueResource\Pages;
|
||||
|
||||
use App\Filament\Resources\CharacteristicValueResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ListRecords;
|
||||
|
||||
class ListCharacteristicValues extends ListRecords
|
||||
{
|
||||
protected static string $resource = CharacteristicValueResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\CreateAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Resources\CharacteristicValueResource\Pages;
|
||||
|
||||
use App\Filament\Resources\CharacteristicValueResource;
|
||||
use Filament\Actions;
|
||||
use Filament\Resources\Pages\ViewRecord;
|
||||
|
||||
class ViewCharacteristicValue extends ViewRecord
|
||||
{
|
||||
protected static string $resource = CharacteristicValueResource::class;
|
||||
|
||||
protected function getHeaderActions(): array
|
||||
{
|
||||
return [
|
||||
Actions\EditAction::make(),
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -136,23 +136,23 @@ class InvoiceValidationResource extends Resource
|
||||
->reactive()
|
||||
->readOnly(fn (callable $get) => empty($get('invoice_number')))
|
||||
->disabled(fn (Get $get) => empty($get('invoice_number')))
|
||||
// ->extraAttributes([
|
||||
// 'id' => 'serial_number_input',
|
||||
// 'x-data' => '{ value: "" }',
|
||||
// 'x-model' => 'value',
|
||||
// 'wire:keydown.enter.prevent' => 'processSerial(value)', // Using wire:keydown
|
||||
// ])
|
||||
->dehydrated(false) // Do not trigger Livewire syncing
|
||||
->extraAttributes([
|
||||
'id' => 'serial_number_input',
|
||||
'x-on:keydown.enter.prevent' => "
|
||||
let serial = \$event.target.value;
|
||||
if (serial.trim() != '') {
|
||||
\$wire.dispatch('process-scan', serial);
|
||||
\$event.target.value = '';
|
||||
}
|
||||
",
|
||||
'x-data' => '{ value: "" }',
|
||||
'x-model' => 'value',
|
||||
'wire:keydown.enter.prevent' => 'processSerial(value)', // Using wire:keydown
|
||||
])
|
||||
// ->dehydrated(false) // Do not trigger Livewire syncing
|
||||
// ->extraAttributes([
|
||||
// 'id' => 'serial_number_input',
|
||||
// 'x-on:keydown.enter.prevent' => "
|
||||
// let serial = \$event.target.value;
|
||||
// if (serial.trim() != '') {
|
||||
// \$wire.dispatch('process-scan', serial);
|
||||
// \$event.target.value = '';
|
||||
// }
|
||||
// ",
|
||||
// ])
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get, callable $livewire) {
|
||||
$set('update_invoice', 0);
|
||||
// $this->dispatch('focus-serial-number');
|
||||
|
||||
@@ -2261,7 +2261,7 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
];
|
||||
}
|
||||
|
||||
public function processSer($serNo)
|
||||
public function processSerial($serNo)
|
||||
{
|
||||
$serNo = trim($serNo);
|
||||
$mSerNo = $serNo;
|
||||
@@ -3171,11 +3171,9 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
$mPlantName = $mailData['plant_name'];
|
||||
$emails = $mailData['emails'];
|
||||
|
||||
$mUserName = Filament::auth()->user()->name;
|
||||
|
||||
if (! empty($emails)) {
|
||||
Mail::to($emails)->send(
|
||||
new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode,$mUserName,'NotFoundInvoice')
|
||||
new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'NotFoundInvoice')
|
||||
);
|
||||
} else {
|
||||
\Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
||||
@@ -3381,18 +3379,18 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
->send();
|
||||
$this->dispatch('playNotificationSound');
|
||||
|
||||
// $mInvoiceType = 'Serial';
|
||||
// $mailData = $this->getMail();
|
||||
// $mPlantName = $mailData['plant_name'];
|
||||
// $emails = $mailData['emails'];
|
||||
$mInvoiceType = 'Serial';
|
||||
$mailData = $this->getMail();
|
||||
$mPlantName = $mailData['plant_name'];
|
||||
$emails = $mailData['emails'];
|
||||
|
||||
// if (! empty($emails)) {
|
||||
// Mail::to($emails)->send(
|
||||
// new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'CompletedSerialInvoice')
|
||||
// );
|
||||
// } else {
|
||||
// \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
||||
// }
|
||||
if (! empty($emails)) {
|
||||
Mail::to($emails)->send(
|
||||
new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'CompletedSerialInvoice')
|
||||
);
|
||||
} else {
|
||||
\Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
||||
}
|
||||
|
||||
$filename = $invoiceNumber.'.xlsx';
|
||||
$directory = 'uploads/temp';
|
||||
@@ -3511,19 +3509,19 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
|
||||
$this->dispatch('playNotificationSound');
|
||||
|
||||
// $mInvoiceType = 'Serial';
|
||||
// $mailData = $this->getMail();
|
||||
// $mPlantName = $mailData['plant_name'];
|
||||
// $emails = $mailData['emails'];
|
||||
$mInvoiceType = 'Serial';
|
||||
$mailData = $this->getMail();
|
||||
$mPlantName = $mailData['plant_name'];
|
||||
$emails = $mailData['emails'];
|
||||
|
||||
// if (! empty($emails)) {
|
||||
// // Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
|
||||
// Mail::to($emails)->send(
|
||||
// new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'CSerialInvoice')
|
||||
// );
|
||||
// } else {
|
||||
// \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
||||
// }
|
||||
if (! empty($emails)) {
|
||||
// Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
|
||||
Mail::to($emails)->send(
|
||||
new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'CSerialInvoice')
|
||||
);
|
||||
} else {
|
||||
\Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
||||
}
|
||||
|
||||
$filename = $invoiceNumber.'.xlsx';
|
||||
$directory = 'uploads/temp';
|
||||
@@ -3584,21 +3582,19 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
|
||||
$this->dispatch('playWarnSound');
|
||||
|
||||
// $mInvoiceType = 'Serial';
|
||||
// $mailData = $this->getMail();
|
||||
// $mPlantName = $mailData['plant_name'];
|
||||
// $emails = $mailData['emails'];
|
||||
$mInvoiceType = 'Serial';
|
||||
$mailData = $this->getMail();
|
||||
$mPlantName = $mailData['plant_name'];
|
||||
$emails = $mailData['emails'];
|
||||
|
||||
// $mUserName = Filament::auth()->user()->name;
|
||||
|
||||
// if (! empty($emails)) {
|
||||
// // Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
|
||||
// Mail::to($emails)->send(
|
||||
// new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, $mUserName, 'DuplicateCapacitorQR')
|
||||
// );
|
||||
// } else {
|
||||
// \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
||||
// }
|
||||
if (! empty($emails)) {
|
||||
// Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
|
||||
Mail::to($emails)->send(
|
||||
new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'DuplicateCapacitorQR')
|
||||
);
|
||||
} else {
|
||||
\Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
||||
}
|
||||
|
||||
$this->form->fill([
|
||||
'plant_id' => $plantId,
|
||||
@@ -3723,19 +3719,19 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
|
||||
$this->dispatch('playNotificationSound');
|
||||
|
||||
// $mInvoiceType = 'Serial';
|
||||
// $mailData = $this->getMail();
|
||||
// $mPlantName = $mailData['plant_name'];
|
||||
// $emails = $mailData['emails'];
|
||||
$mInvoiceType = 'Serial';
|
||||
$mailData = $this->getMail();
|
||||
$mPlantName = $mailData['plant_name'];
|
||||
$emails = $mailData['emails'];
|
||||
|
||||
// if (! empty($emails)) {
|
||||
// // Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
|
||||
// Mail::to($emails)->send(
|
||||
// new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'ComSerInv')
|
||||
// );
|
||||
// } else {
|
||||
// \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
||||
// }
|
||||
if (! empty($emails)) {
|
||||
// Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
|
||||
Mail::to($emails)->send(
|
||||
new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'ComSerInv')
|
||||
);
|
||||
} else {
|
||||
\Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
||||
}
|
||||
|
||||
$filename = $invoiceNumber.'.xlsx';
|
||||
$directory = 'uploads/temp';
|
||||
@@ -3769,11 +3765,11 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
}
|
||||
}
|
||||
|
||||
#[On('process-scan')]
|
||||
public function processSerial($serial)
|
||||
{
|
||||
$this->processSer($serial);
|
||||
}
|
||||
// #[On('process-scan')]
|
||||
// public function processSerial($serial)
|
||||
// {
|
||||
// $this->processSer($serial); // Your duplicate check + mail logic
|
||||
// }
|
||||
|
||||
public function getHeading(): string
|
||||
{
|
||||
|
||||
@@ -27,8 +27,6 @@ class ProductCharacteristicsMasterResource extends Resource
|
||||
{
|
||||
protected static ?string $model = ProductCharacteristicsMaster::class;
|
||||
|
||||
protected static ?string $navigationGroup = 'Process Order';
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
|
||||
@@ -26,8 +26,6 @@ class StickerPrintingResource extends Resource
|
||||
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
protected static ?string $navigationGroup = 'Sticker Reprint';
|
||||
|
||||
public static function form(Form $form): Form
|
||||
{
|
||||
return $form
|
||||
@@ -40,6 +38,7 @@ class StickerPrintingResource extends Resource
|
||||
->relationship('plant', 'name')
|
||||
->options(function (callable $get) {
|
||||
$userHas = Filament::auth()->user()->plant_id;
|
||||
|
||||
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
|
||||
})
|
||||
->required()
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\CharacteristicValue;
|
||||
use App\Models\ClassCharacteristic;
|
||||
use App\Models\Item;
|
||||
use App\Models\Line;
|
||||
@@ -498,7 +497,7 @@ class CharacteristicsController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
$col = ['marked_by', 'man_marked_by', 'motor_marked_by', 'pump_marked_by'];
|
||||
$col = ['marked_by', 'man_marked_by'];
|
||||
$missingUsers = [];
|
||||
$missingUsersPlant = [];
|
||||
$missingUsersRight = [];
|
||||
@@ -557,148 +556,25 @@ class CharacteristicsController extends Controller
|
||||
$isAuto = false;
|
||||
|
||||
foreach ($data['characteristics'] as $char) {
|
||||
|
||||
// $values = [
|
||||
// 'mark_status' => $char['mark_status'] ?? null,
|
||||
// 'marked_datetime' => $char['marked_datetime'] ?? null,
|
||||
// 'marked_by' => ($char['marked_by'] == 'jothi') ? 'Admin' : $char['marked_by'] ?? null,
|
||||
// 'man_marked_status' => $char['man_marked_status'] ?? null,
|
||||
// 'man_marked_datetime' => $char['man_marked_datetime'] ?? null,
|
||||
// 'man_marked_by' => ($char['man_marked_by'] == 'jothi') ? 'Admin' : $char['man_marked_by'] ?? null,
|
||||
// 'motor_marked_status' => $char['motor_marked_status'] ?? null,
|
||||
// 'pump_marked_status' => $char['pump_marked_status'] ?? null,
|
||||
// 'motor_pump_pumpset_status' => $char['motor_pump_pumpset_status'] ?? null,
|
||||
// 'part_validation_1' => $char['part_validation_1'] ?? null,
|
||||
// 'part_validation_2' => $char['part_validation_2'] ?? null,
|
||||
// 'samlight_logged_name' => $char['samlight_logged_name'] ?? null,
|
||||
// 'pending_released_status' => $char['pending_released_status'] ?? null,
|
||||
// 'expected_time' => $char['expected_time'] ?? null,
|
||||
// 'updated_by' => $userName ?? null,
|
||||
// ];
|
||||
$values = [
|
||||
'mark_status' => $char['mark_status'] ?? null,
|
||||
'marked_datetime' => $char['marked_datetime'] ?? null,
|
||||
'marked_by' => ($char['marked_by'] == 'jothi') ? 'Admin' : $char['marked_by'] ?? null,
|
||||
'man_marked_status' => $char['man_marked_status'] ?? null,
|
||||
'man_marked_datetime' => $char['man_marked_datetime'] ?? null,
|
||||
'man_marked_by' => ($char['man_marked_by'] == 'jothi') ? 'Admin' : $char['man_marked_by'] ?? null,
|
||||
'motor_marked_status' => $char['motor_marked_status'] ?? null,
|
||||
'pump_marked_status' => $char['pump_marked_status'] ?? null,
|
||||
'motor_pump_pumpset_status' => $char['motor_pump_pumpset_status'] ?? null,
|
||||
'part_validation_1' => $char['part_validation_1'] ?? null,
|
||||
'part_validation_2' => $char['part_validation_2'] ?? null,
|
||||
'samlight_logged_name' => $char['samlight_logged_name'] ?? null,
|
||||
'pending_released_status' => $char['pending_released_status'] ?? null,
|
||||
'expected_time' => $char['expected_time'] ?? null,
|
||||
'updated_by' => $userName ?? null,
|
||||
];
|
||||
|
||||
if ($jobNo != null && $jobNo != '' && $jobNo) {
|
||||
$curStat = ClassCharacteristic::where('plant_id', $plantId)
|
||||
->where('machine_id', $machineId)
|
||||
->where('aufnr', $jobNo)
|
||||
->where('gernr', $serialNumber)
|
||||
->where('item_id', $itemId)
|
||||
->first();
|
||||
|
||||
if ($char['mark_status'] == 'Stopped') {
|
||||
$values = [
|
||||
'mark_status' => $char['mark_status'] ?? null,
|
||||
'marked_datetime' => $char['marked_datetime'] ?? null,
|
||||
'marked_by' => ($char['marked_by'] == 'jothi') ? 'Admin' : $char['marked_by'] ?? null,
|
||||
'updated_by' => $userName ?? null,
|
||||
];
|
||||
} elseif ($char['motor_pump_pumpset_status'] == '3') {
|
||||
$values = [
|
||||
'mark_status' => $char['mark_status'] ?? null,
|
||||
'marked_datetime' => $char['marked_datetime'] ?? null,
|
||||
'marked_by' => ($char['marked_by'] == 'jothi') ? 'Admin' : $char['marked_by'] ?? null,
|
||||
'motor_marked_status' => $char['motor_marked_status'] ?? null,
|
||||
'motor_marked_by' => ($char['motor_marked_by'] == 'jothi') ? 'Admin' : $char['motor_marked_by'] ?? null,
|
||||
'pump_marked_status' => $char['pump_marked_status'] ?? null,
|
||||
'pump_marked_by' => ($char['pump_marked_by'] == 'jothi') ? 'Admin' : $char['pump_marked_by'] ?? null,
|
||||
'motor_pump_pumpset_status' => '3',
|
||||
'pumpset_machine_name' => $char['pumpset_machine_name'] ?? null,
|
||||
'part_validation_1' => $char['part_validation_1'] ?? null,
|
||||
'part_validation_2' => $char['part_validation_2'] ?? null,
|
||||
'samlight_logged_name' => $char['samlight_logged_name'] ?? null,
|
||||
// 'pending_released_status' => $char['pending_released_status'] ?? null,
|
||||
'expected_time' => $char['expected_time'] ?? null,
|
||||
'updated_by' => $userName ?? null,
|
||||
];
|
||||
} elseif ($char['motor_pump_pumpset_status'] == '2') {
|
||||
if ($curStat->motor_marked_status == null || $curStat->motor_marked_status == '') {
|
||||
$values = [
|
||||
// 'mark_status' => $char['mark_status'] ?? null,
|
||||
'marked_datetime' => $char['marked_datetime'] ?? null,
|
||||
// 'marked_by' => ($char['marked_by'] == 'jothi') ? 'Admin' : $char['marked_by'] ?? null,
|
||||
'pump_marked_status' => $char['pump_marked_status'] ?? null,
|
||||
'pump_marked_by' => ($char['pump_marked_by'] == 'jothi') ? 'Admin' : $char['pump_marked_by'] ?? null,
|
||||
'motor_pump_pumpset_status' => '3',
|
||||
'pump_machine_name' => $char['pump_machine_name'] ?? null,
|
||||
'part_validation_1' => $char['part_validation_1'] ?? null,
|
||||
'part_validation_2' => $char['part_validation_2'] ?? null,
|
||||
'samlight_logged_name' => $char['samlight_logged_name'] ?? null,
|
||||
// 'pending_released_status' => $char['pending_released_status'] ?? null,
|
||||
'expected_time' => $char['expected_time'] ?? null,
|
||||
'updated_by' => $userName ?? null,
|
||||
];
|
||||
} else {
|
||||
$values = [
|
||||
'mark_status' => $char['mark_status'] ?? null,
|
||||
'marked_datetime' => $char['marked_datetime'] ?? null,
|
||||
'marked_by' => ($char['marked_by'] == 'jothi') ? 'Admin' : $char['marked_by'] ?? null,
|
||||
'pump_marked_status' => $char['pump_marked_status'] ?? null,
|
||||
'pump_marked_by' => ($char['pump_marked_by'] == 'jothi') ? 'Admin' : $char['pump_marked_by'] ?? null,
|
||||
'motor_pump_pumpset_status' => '3',
|
||||
'pump_machine_name' => $char['pump_machine_name'] ?? null,
|
||||
'part_validation_1' => $char['part_validation_1'] ?? null,
|
||||
'part_validation_2' => $char['part_validation_2'] ?? null,
|
||||
'samlight_logged_name' => $char['samlight_logged_name'] ?? null,
|
||||
// 'pending_released_status' => $char['pending_released_status'] ?? null,
|
||||
'expected_time' => $char['expected_time'] ?? null,
|
||||
'updated_by' => $userName ?? null,
|
||||
];
|
||||
}
|
||||
} elseif ($char['motor_pump_pumpset_status'] == '1') {
|
||||
if ($curStat->pump_marked_status == null || $curStat->pump_marked_status == '') {
|
||||
$values = [
|
||||
// 'mark_status' => $char['mark_status'] ?? null,
|
||||
'marked_datetime' => $char['marked_datetime'] ?? null,
|
||||
// 'marked_by' => ($char['marked_by'] == 'jothi') ? 'Admin' : $char['marked_by'] ?? null,
|
||||
'motor_marked_status' => $char['motor_marked_status'] ?? null,
|
||||
'motor_marked_by' => ($char['motor_marked_by'] == 'jothi') ? 'Admin' : $char['motor_marked_by'] ?? null,
|
||||
'motor_pump_pumpset_status' => '3',
|
||||
'motor_machine_name' => $char['motor_machine_name'] ?? null,
|
||||
'part_validation_1' => $char['part_validation_1'] ?? null,
|
||||
'part_validation_2' => $char['part_validation_2'] ?? null,
|
||||
'samlight_logged_name' => $char['samlight_logged_name'] ?? null,
|
||||
// 'pending_released_status' => $char['pending_released_status'] ?? null,
|
||||
'expected_time' => $char['expected_time'] ?? null,
|
||||
'updated_by' => $userName ?? null,
|
||||
];
|
||||
} else {
|
||||
$values = [
|
||||
'mark_status' => $char['mark_status'] ?? null,
|
||||
'marked_datetime' => $char['marked_datetime'] ?? null,
|
||||
'marked_by' => ($char['marked_by'] == 'jothi') ? 'Admin' : $char['marked_by'] ?? null,
|
||||
'motor_marked_status' => $char['motor_marked_status'] ?? null,
|
||||
'motor_marked_by' => ($char['motor_marked_by'] == 'jothi') ? 'Admin' : $char['motor_marked_by'] ?? null,
|
||||
'motor_pump_pumpset_status' => '3',
|
||||
'motor_machine_name' => $char['motor_machine_name'] ?? null,
|
||||
'part_validation_1' => $char['part_validation_1'] ?? null,
|
||||
'part_validation_2' => $char['part_validation_2'] ?? null,
|
||||
'samlight_logged_name' => $char['samlight_logged_name'] ?? null,
|
||||
// 'pending_released_status' => $char['pending_released_status'] ?? null,
|
||||
'expected_time' => $char['expected_time'] ?? null,
|
||||
'updated_by' => $userName ?? null,
|
||||
];
|
||||
}
|
||||
} else {
|
||||
$values = [
|
||||
'mark_status' => $char['mark_status'] ?? null,
|
||||
'marked_datetime' => $char['marked_datetime'] ?? null,
|
||||
'marked_by' => ($char['marked_by'] == 'jothi') ? 'Admin' : $char['marked_by'] ?? null,
|
||||
'motor_marked_status' => $char['motor_marked_status'] ?? null,
|
||||
'motor_marked_by' => ($char['motor_marked_by'] == 'jothi') ? 'Admin' : $char['motor_marked_by'] ?? null,
|
||||
'pump_marked_status' => $char['pump_marked_status'] ?? null,
|
||||
'pump_marked_by' => ($char['pump_marked_by'] == 'jothi') ? 'Admin' : $char['pump_marked_by'] ?? null,
|
||||
'motor_pump_pumpset_status' => $char['motor_pump_pumpset_status'] ?? null,
|
||||
'motor_machine_name' => $char['motor_machine_name'] ?? null,
|
||||
'pump_machine_name' => $char['pump_machine_name'] ?? null,
|
||||
'pumpset_machine_name' => $char['pumpset_machine_name'] ?? null,
|
||||
'part_validation_1' => $char['part_validation_1'] ?? null,
|
||||
'part_validation_2' => $char['part_validation_2'] ?? null,
|
||||
'samlight_logged_name' => $char['samlight_logged_name'] ?? null,
|
||||
// 'pending_released_status' => $char['pending_released_status'] ?? null,
|
||||
'expected_time' => $char['expected_time'] ?? null,
|
||||
'updated_by' => $userName ?? null,
|
||||
];
|
||||
}
|
||||
|
||||
$isAuto = true;
|
||||
$affected = ClassCharacteristic::where('plant_id', $plantId)
|
||||
->where('machine_id', $machineId)
|
||||
@@ -709,14 +585,6 @@ class CharacteristicsController extends Controller
|
||||
|
||||
$updatedRows += $affected;
|
||||
} else {
|
||||
$values = [
|
||||
'man_marked_status' => $char['man_marked_status'] ?? null,
|
||||
'man_marked_datetime' => $char['man_marked_datetime'] ?? null,
|
||||
'man_marked_by' => ($char['man_marked_by'] == 'jothi') ? 'Admin' : $char['man_marked_by'] ?? null,
|
||||
'samlight_logged_name' => $char['samlight_logged_name'] ?? null,
|
||||
'updated_by' => $userName ?? null,
|
||||
];
|
||||
|
||||
$isAuto = false;
|
||||
$affected = ClassCharacteristic::where('plant_id', $plantId)
|
||||
->where('machine_id', $machineId)
|
||||
@@ -1470,7 +1338,7 @@ class CharacteristicsController extends Controller
|
||||
], 400);
|
||||
}
|
||||
|
||||
$columnsToShow = ['mark_status', 'marked_datetime', 'marked_by', 'man_marked_status', 'man_marked_datetime', 'man_marked_by', 'motor_marked_status', 'motor_marked_by', 'pump_marked_status', 'pump_marked_by', 'motor_pump_pumpset_status', 'motor_machine_name', 'pump_machine_name', 'pumpset_machine_name', 'part_validation_1', 'part_validation_2', 'samlight_logged_name', 'pending_released_status', 'expected_time'];
|
||||
$columnsToShow = ['mark_status', 'marked_datetime', 'marked_by', 'man_marked_status', 'man_marked_datetime', 'man_marked_by', 'motor_marked_status', 'pump_marked_status', 'motor_pump_pumpset_status', 'part_validation_1', 'part_validation_2', 'samlight_logged_name', 'pending_released_status', 'expected_time'];
|
||||
|
||||
$characteristicsColumns = ['class', 'arbid', 'gamng', 'lmnga', 'zz1_cn_bill_ord', 'zmm_amps', 'zmm_brand', 'zmm_degreeofprotection', 'zmm_delivery', 'zmm_dir_rot', 'zmm_discharge', 'zmm_discharge_max', 'zmm_discharge_min', 'zmm_duty', 'zmm_eff_motor', 'zmm_eff_pump', 'zmm_frequency', 'zmm_head', 'zmm_heading', 'zmm_head_max', 'zmm_head_minimum', 'zmm_idx_eff_mtr', 'zmm_idx_eff_pump', 'zmm_kvacode', 'zmm_maxambtemp', 'zmm_mincoolingflow', 'zmm_motorseries', 'zmm_motor_model', 'zmm_outlet', 'zmm_phase', 'zmm_pressure', 'zmm_pumpflowtype', 'zmm_pumpseries', 'zmm_pump_model', 'zmm_ratedpower', 'zmm_region', 'zmm_servicefactor', 'zmm_servicefactormaximumamps', 'zmm_speed', 'zmm_suction', 'zmm_suctionxdelivery', 'zmm_supplysource', 'zmm_temperature', 'zmm_thrustload', 'zmm_volts', 'zmm_wire', 'zmm_package', 'zmm_pvarrayrating', 'zmm_isi', 'zmm_isimotor', 'zmm_isipump', 'zmm_isipumpset', 'zmm_pumpset_model', 'zmm_stages', 'zmm_headrange', 'zmm_overall_efficiency', 'zmm_connection', 'zmm_min_bore_size', 'zmm_isireference', 'zmm_category', 'zmm_submergence', 'zmm_capacitorstart', 'zmm_capacitorrun', 'zmm_inch', 'zmm_motor_type', 'zmm_dismantle_direction', 'zmm_eff_ovrall', 'zmm_bodymoc', 'zmm_rotormoc', 'zmm_dlwl', 'zmm_inputpower', 'zmm_imp_od', 'zmm_ambtemp', 'zmm_de', 'zmm_dischargerange', 'zmm_efficiency_class', 'zmm_framesize', 'zmm_impellerdiameter', 'zmm_insulationclass', 'zmm_maxflow', 'zmm_minhead', 'zmm_mtrlofconst', 'zmm_nde', 'zmm_powerfactor', 'zmm_tagno', 'zmm_year', 'zmm_laser_name'];
|
||||
|
||||
@@ -1523,8 +1391,6 @@ class CharacteristicsController extends Controller
|
||||
|
||||
$otherData['marked_by'] = ($otherData['marked_by'] == 'Admin') ? 'jothi' : $otherData['marked_by'] ?? '';
|
||||
$otherData['man_marked_by'] = ($otherData['man_marked_by'] == 'Admin') ? 'jothi' : $otherData['man_marked_by'] ?? '';
|
||||
$otherData['motor_marked_by'] = ($otherData['motor_marked_by'] == 'Admin') ? 'jothi' : $otherData['motor_marked_by'] ?? '';
|
||||
$otherData['pump_marked_by'] = ($otherData['pump_marked_by'] == 'Admin') ? 'jothi' : $otherData['pump_marked_by'] ?? '';
|
||||
|
||||
// $otherData['pending_released_status'] = (string)$otherData['pending_released_status'] ?? '';
|
||||
return array_merge(['gernr' => $serial->gernr], $otherData);
|
||||
@@ -1654,7 +1520,7 @@ class CharacteristicsController extends Controller
|
||||
->get();
|
||||
|
||||
$remFields = [
|
||||
'id', 'plant_id', 'machine_id', 'item_id', 'gernr', 'zmm_beenote', 'zmm_beenumber', 'zmm_beestar', 'zmm_codeclass', 'zmm_colour', 'zmm_grade', 'zmm_grwt_pset', 'zmm_grwt_cable', 'zmm_grwt_motor', 'zmm_grwt_pf', 'zmm_grwt_pump', 'zmm_isivalve', 'zmm_isi_wc', 'zmm_labelperiod', 'zmm_length', 'zmm_license_cml_no', 'zmm_mfgmonyr', 'zmm_modelyear', 'zmm_motoridentification', 'zmm_newt_pset', 'zmm_newt_cable', 'zmm_newt_motor', 'zmm_newt_pf', 'zmm_newt_pump', 'zmm_packtype', 'zmm_panel', 'zmm_performance_factor', 'zmm_pumpidentification', 'zmm_psettype', 'zmm_size', 'zmm_eff_ttl', 'zmm_type', 'zmm_usp', 'created_at', 'updated_at', 'created_by', 'updated_by', 'deleted_at',
|
||||
'id', 'plant_id', 'machine_id', 'item_id', 'gernr', 'zmm_beenote', 'zmm_beenumber', 'zmm_beestar', 'zmm_logo_ce', 'zmm_codeclass', 'zmm_colour', 'zmm_logo_cp', 'zmm_grade', 'zmm_grwt_pset', 'zmm_grwt_cable', 'zmm_grwt_motor', 'zmm_grwt_pf', 'zmm_grwt_pump', 'zmm_isivalve', 'zmm_isi_wc', 'zmm_labelperiod', 'zmm_length', 'zmm_license_cml_no', 'zmm_mfgmonyr', 'zmm_modelyear', 'zmm_motoridentification', 'zmm_newt_pset', 'zmm_newt_cable', 'zmm_newt_motor', 'zmm_newt_pf', 'zmm_newt_pump', 'zmm_logo_nsf', 'zmm_packtype', 'zmm_panel', 'zmm_performance_factor', 'zmm_pumpidentification', 'zmm_psettype', 'zmm_size', 'zmm_eff_ttl', 'zmm_type', 'zmm_usp', 'created_at', 'updated_at', 'created_by', 'updated_by', 'deleted_at',
|
||||
];
|
||||
|
||||
$filteredData = $characteristicsData->map(function ($char) use ($remFields) {
|
||||
@@ -1673,8 +1539,6 @@ class CharacteristicsController extends Controller
|
||||
|
||||
$charArray['marked_by'] = ($charArray['marked_by'] == 'Admin') ? 'jothi' : $charArray['marked_by'] ?? '';
|
||||
$charArray['man_marked_by'] = ($charArray['man_marked_by'] == 'Admin') ? 'jothi' : $charArray['man_marked_by'] ?? '';
|
||||
$charArray['motor_marked_by'] = ($charArray['motor_marked_by'] == 'Admin') ? 'jothi' : $charArray['motor_marked_by'] ?? '';
|
||||
$charArray['pump_marked_by'] = ($charArray['pump_marked_by'] == 'Admin') ? 'jothi' : $charArray['pump_marked_by'] ?? '';
|
||||
|
||||
foreach ($charArray as $key => $value) {
|
||||
if ($value instanceof \Carbon\Carbon) {
|
||||
@@ -1861,7 +1725,7 @@ class CharacteristicsController extends Controller
|
||||
|
||||
// $columnsToShow = ['mark_status','marked_datetime','marked_by','man_marked_status','man_marked_datetime','man_marked_by','motor_marked_status','pump_marked_status','motor_pump_pumpset_status','part_validation_1','part_validation_2','samlight_logged_name','pending_released_status','expected_time'];
|
||||
|
||||
$characteristicsColumns = ['class', 'arbid', 'gamng', 'lmnga', 'zz1_cn_bill_ord', 'zmm_amps', 'zmm_brand', 'zmm_degreeofprotection', 'zmm_delivery', 'zmm_dir_rot', 'zmm_discharge', 'zmm_discharge_max', 'zmm_discharge_min', 'zmm_duty', 'zmm_eff_motor', 'zmm_eff_pump', 'zmm_frequency', 'zmm_head', 'zmm_heading', 'zmm_head_max', 'zmm_head_minimum', 'zmm_idx_eff_mtr', 'zmm_idx_eff_pump', 'zmm_kvacode', 'zmm_maxambtemp', 'zmm_mincoolingflow', 'zmm_motorseries', 'zmm_motor_model', 'zmm_outlet', 'zmm_phase', 'zmm_pressure', 'zmm_pumpflowtype', 'zmm_pumpseries', 'zmm_pump_model', 'zmm_ratedpower', 'zmm_region', 'zmm_servicefactor', 'zmm_servicefactormaximumamps', 'zmm_speed', 'zmm_suction', 'zmm_suctionxdelivery', 'zmm_supplysource', 'zmm_temperature', 'zmm_thrustload', 'zmm_volts', 'zmm_wire', 'zmm_package', 'zmm_pvarrayrating', 'zmm_isi', 'zmm_isimotor', 'zmm_isipump', 'zmm_isipumpset', 'zmm_pumpset_model', 'zmm_stages', 'zmm_headrange', 'zmm_overall_efficiency', 'zmm_connection', 'zmm_min_bore_size', 'zmm_isireference', 'zmm_category', 'zmm_submergence', 'zmm_capacitorstart', 'zmm_capacitorrun', 'zmm_inch', 'zmm_motor_type', 'zmm_dismantle_direction', 'zmm_eff_ovrall', 'zmm_bodymoc', 'zmm_rotormoc', 'zmm_dlwl', 'zmm_inputpower', 'zmm_imp_od', 'zmm_ambtemp', 'zmm_de', 'zmm_dischargerange', 'zmm_efficiency_class', 'zmm_framesize', 'zmm_impellerdiameter', 'zmm_insulationclass', 'zmm_maxflow', 'zmm_minhead', 'zmm_mtrlofconst', 'zmm_nde', 'zmm_powerfactor', 'zmm_tagno', 'zmm_year', 'zmm_logo_cp', 'zmm_logo_ce', 'zmm_logo_nsf', 'zmm_laser_name'];
|
||||
$characteristicsColumns = ['class', 'arbid', 'gamng', 'lmnga', 'zz1_cn_bill_ord', 'zmm_amps', 'zmm_brand', 'zmm_degreeofprotection', 'zmm_delivery', 'zmm_dir_rot', 'zmm_discharge', 'zmm_discharge_max', 'zmm_discharge_min', 'zmm_duty', 'zmm_eff_motor', 'zmm_eff_pump', 'zmm_frequency', 'zmm_head', 'zmm_heading', 'zmm_head_max', 'zmm_head_minimum', 'zmm_idx_eff_mtr', 'zmm_idx_eff_pump', 'zmm_kvacode', 'zmm_maxambtemp', 'zmm_mincoolingflow', 'zmm_motorseries', 'zmm_motor_model', 'zmm_outlet', 'zmm_phase', 'zmm_pressure', 'zmm_pumpflowtype', 'zmm_pumpseries', 'zmm_pump_model', 'zmm_ratedpower', 'zmm_region', 'zmm_servicefactor', 'zmm_servicefactormaximumamps', 'zmm_speed', 'zmm_suction', 'zmm_suctionxdelivery', 'zmm_supplysource', 'zmm_temperature', 'zmm_thrustload', 'zmm_volts', 'zmm_wire', 'zmm_package', 'zmm_pvarrayrating', 'zmm_isi', 'zmm_isimotor', 'zmm_isipump', 'zmm_isipumpset', 'zmm_pumpset_model', 'zmm_stages', 'zmm_headrange', 'zmm_overall_efficiency', 'zmm_connection', 'zmm_min_bore_size', 'zmm_isireference', 'zmm_category', 'zmm_submergence', 'zmm_capacitorstart', 'zmm_capacitorrun', 'zmm_inch', 'zmm_motor_type', 'zmm_dismantle_direction', 'zmm_eff_ovrall', 'zmm_bodymoc', 'zmm_rotormoc', 'zmm_dlwl', 'zmm_inputpower', 'zmm_imp_od', 'zmm_ambtemp', 'zmm_de', 'zmm_dischargerange', 'zmm_efficiency_class', 'zmm_framesize', 'zmm_impellerdiameter', 'zmm_insulationclass', 'zmm_maxflow', 'zmm_minhead', 'zmm_mtrlofconst', 'zmm_nde', 'zmm_powerfactor', 'zmm_tagno', 'zmm_year', 'zmm_laser_name'];
|
||||
|
||||
$characteristicsData = ClassCharacteristic::where('aufnr', $jobNumber)
|
||||
->where('plant_id', $plantId)
|
||||
@@ -2112,18 +1976,13 @@ class CharacteristicsController extends Controller
|
||||
'ZMM_HEADING' => $serialExists->zmm_heading ?? '',
|
||||
'MARK_STATUS' => $serialExists->mark_status ?? '',
|
||||
'MARKED_DATETIME' => $serialExists->marked_datetime,
|
||||
'MARKED_BY' => ($serialExists->marked_by == 'Admin') ? 'jothi' : $serialExists->marked_by ?? '',
|
||||
'MARKED_BY' => $serialExists->marked_by ?? '',
|
||||
'MAN_MARKED_STATUS' => $serialExists->man_marked_status ?? '',
|
||||
'MAN_MARKED_DATETIME' => $serialExists->man_marked_datetime ?? '',
|
||||
'MAN_MARKED_BY' => ($serialExists->man_marked_by == 'Admin') ? 'jothi' : $serialExists->man_marked_by ?? '',
|
||||
'MAN_MARKED_BY' => $serialExists->man_marked_by ?? '',
|
||||
'MOTOR_MARKED_STATUS' => $serialExists->motor_marked_status ?? '',
|
||||
'MOTOR_MARKED_BY' => ($serialExists->motor_marked_by == 'Admin') ? 'jothi' : $serialExists->motor_marked_by ?? '',
|
||||
'PUMP_MARKED_STATUS' => $serialExists->pump_marked_status ?? '',
|
||||
'PUMP_MARKED_BY' => ($serialExists->pump_marked_by == 'Admin') ? 'jothi' : $serialExists->pump_marked_by ?? '',
|
||||
'MOTOR_PUMP_PUMPSET_STATUS' => $serialExists->motor_pump_pumpset_status ?? '',
|
||||
'MOTOR_MACHINE_NAME' => $serialExists->motor_machine_name ?? '',
|
||||
'PUMP_MACHINE_NAME' => $serialExists->pump_machine_name ?? '',
|
||||
'PUMPSET_MACHINE_NAME' => $serialExists->pumpset_machine_name ?? '',
|
||||
], 200);
|
||||
}
|
||||
}
|
||||
@@ -2278,221 +2137,6 @@ class CharacteristicsController extends Controller
|
||||
return response()->json($output, 200);
|
||||
}
|
||||
|
||||
public function storeCharValues(Request $request)
|
||||
{
|
||||
$expectedUser = env('API_AUTH_USER');
|
||||
$expectedPw = env('API_AUTH_PW');
|
||||
$headerAuth = $request->header('Authorization');
|
||||
$expectedToken = 'Bearer '.$expectedUser.':'.$expectedPw;
|
||||
|
||||
if ($headerAuth !== $expectedToken) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Invalid authorization token!',
|
||||
], 404);
|
||||
}
|
||||
|
||||
$plantCode = $request->header('plant-code');
|
||||
$itemCode = $request->header('item-code');
|
||||
$lineName = $request->header('line-name');
|
||||
$workCenter = $request->header('work-center');
|
||||
|
||||
if ($plantCode == null || $plantCode == '' || ! $plantCode) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Plant code can't be empty!",
|
||||
], 404);
|
||||
} elseif (! is_numeric($plantCode) || Str::length($plantCode) < 4 || ! preg_match('/^[1-9]\d{3,}$/', $plantCode)) { // !ctype_digit($data['plant_code'])
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Invalid plant code found!',
|
||||
], 404);
|
||||
}
|
||||
|
||||
$plant = Plant::where('code', $plantCode)->first();
|
||||
if (! $plant) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Plant code '{$plantCode}' not found!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$plantId = $plant->id;
|
||||
|
||||
if ($lineName == null || $lineName == '') {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Line name can't be empty!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$line = Line::where('name', $lineName)->first();
|
||||
if (! $line) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Line '{$lineName}' not found!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$lineAgaPlant = Line::where('plant_id', $plantId)->where('name', $lineName)->first();
|
||||
if (! $lineAgaPlant) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Line '{$lineName}' not found against plant code '$plantCode'!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$lineId = $lineAgaPlant->id;
|
||||
|
||||
if ($itemCode == null || $itemCode == '') {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Item code can't be empty!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$item = Item::where('code', $itemCode)->first();
|
||||
if (! $item) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Item Code '{$itemCode}' not found!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$itemAgaPlant = Item::where('plant_id', $plantId)->where('code', $itemCode)->first();
|
||||
if (! $itemAgaPlant) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Item code '{$itemCode}' not found against plant code '$plantCode'!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$itemId = $itemAgaPlant->id;
|
||||
|
||||
if ($workCenter == null || $workCenter == '') {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Work center can't be empty!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$machine = Machine::where('work_center', $workCenter)->first();
|
||||
if (! $machine) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Work center '{$workCenter}' not found!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$machineAgaPlant = Machine::where('plant_id', $plantId)->where('work_center', $workCenter)->first();
|
||||
if (! $machineAgaPlant) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Work center '{$workCenter}' not found against plant code '$plantCode'!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$machineAgaPlantLine = Machine::where('plant_id', $plantId)->where('line_id', $lineId)->where('work_center', $workCenter)->first();
|
||||
if (! $machineAgaPlantLine) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Work center '{$workCenter}' not found against plant code '$plantCode' and line name '$lineName'!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$machineId = $machineAgaPlantLine->id;
|
||||
|
||||
$data = $request->all();
|
||||
|
||||
$processOrder = $data['process_order'] ?? '';
|
||||
$coilNo = $data['coil_number'] ?? '';
|
||||
$status = $data['status'] ?? '';
|
||||
$createdBy = $data['created_by'] ?? '';
|
||||
|
||||
if ($processOrder == null || $processOrder == '' || ! $processOrder) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Process order can't be empty!",
|
||||
], 404);
|
||||
} elseif (Str::length($processOrder) < 9) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Process order should contain minimum 9 digits!',
|
||||
], 404);
|
||||
}
|
||||
|
||||
if ($coilNo == null || $coilNo == '' || ! $coilNo) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Coil number can't be empty!",
|
||||
], 404);
|
||||
} elseif (! is_numeric($coilNo)) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => 'Coil number should contain only numeric values!',
|
||||
], 404);
|
||||
}
|
||||
|
||||
if ($status == null || $status == '' || ! $status) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Status can't be empty!",
|
||||
], 404);
|
||||
} elseif (! in_array($status, ['Ok', 'NotOk'], true)) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Status must be either 'Ok' or 'NotOk'!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
if ($createdBy == null || $createdBy == '' || ! $createdBy) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Created by can't be empty!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$existing = CharacteristicValue::where('plant_id', $plantId)
|
||||
->where('process_order', $processOrder)
|
||||
->where('item_id', '!=', $itemId)
|
||||
->first();
|
||||
|
||||
if ($existing) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Process order '{$processOrder}' already has item_code '{$existing->item->code}' for the plant code '{$plantCode}'!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
$existing = CharacteristicValue::where('plant_id', $plantId)
|
||||
->where('process_order', $processOrder)
|
||||
->where('coil_number', $coilNo)
|
||||
->first();
|
||||
|
||||
if ($existing) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Process order '{$processOrder}' with coil number '{$coilNo}' already exist for the plant code '{$plantCode}'!",
|
||||
], 404);
|
||||
}
|
||||
|
||||
CharacteristicValue::create([
|
||||
'plant_id' => $plantId,
|
||||
'line_id' => $lineId,
|
||||
'item_id' => $itemId,
|
||||
'machine_id' => $machineId,
|
||||
'process_order' => $processOrder,
|
||||
'coil_number' => $coilNo,
|
||||
'status' => $status,
|
||||
'created_by' => $createdBy,
|
||||
]);
|
||||
|
||||
return response()->json([
|
||||
'status_code' => 'SUCCESS',
|
||||
'status_description' => 'Characteristics values inserted successfully',
|
||||
], 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*/
|
||||
|
||||
@@ -46,20 +46,20 @@ class InvalidQualityMail extends Mailable
|
||||
// dynamic subject based on mail type
|
||||
switch ($this->mailType) {
|
||||
case 'InvalidPartNumber2':
|
||||
$this->subjectLine = "Quality Part Validation ({$this->mplantName})";
|
||||
$this->subjectLine = "Invalid Part Number 2 Scanned ({$this->mplantName})";
|
||||
break;
|
||||
case 'InvalidPartNumber3':
|
||||
$this->subjectLine = "Quality Part Validation ({$this->mplantName})";
|
||||
$this->subjectLine = "Invalid Part Number 3 Scanned ({$this->mplantName})";
|
||||
break;
|
||||
case 'InvalidPartNumber4':
|
||||
$this->subjectLine = "Quality Part Validation ({$this->mplantName})";
|
||||
$this->subjectLine = "Invalid Part Number 4 Scanned ({$this->mplantName})";
|
||||
break;
|
||||
case 'InvalidPartNumber5':
|
||||
$this->subjectLine = "Quality Part Validation ({$this->mplantName})";
|
||||
$this->subjectLine = "Invalid Part Number 5 Scanned ({$this->mplantName})";
|
||||
break;
|
||||
case 'InvalidPartNumber':
|
||||
default:
|
||||
$this->subjectLine = "Quality Part Validation ({$this->mplantName})";
|
||||
$this->subjectLine = "Invalid Part Number 1 Scanned ({$this->mplantName})";
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -82,14 +82,12 @@ class InvalidSerialMail extends Mailable
|
||||
public $greeting;
|
||||
public $subjectLine;
|
||||
|
||||
public $mUserName;
|
||||
|
||||
public $itemCode;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*/
|
||||
public function __construct($serial, $invoiceNumber, $mplantName, $mInvoiceType, $itemCode, $mUserName, $mailType = 'InvalidFormat')
|
||||
public function __construct($serial, $invoiceNumber, $mplantName, $mInvoiceType, $itemCode, $mailType = 'InvalidFormat')
|
||||
{
|
||||
$this->serial = $serial;
|
||||
$this->invoiceNumber = $invoiceNumber;
|
||||
@@ -97,7 +95,6 @@ class InvalidSerialMail extends Mailable
|
||||
$this->mInvoiceType = $mInvoiceType;
|
||||
$this->mailType = $mailType;
|
||||
$this->itemCode = $itemCode;
|
||||
$this->mUserName = $mUserName;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -113,18 +110,15 @@ class InvalidSerialMail extends Mailable
|
||||
case 'DuplicateCapacitorQR':
|
||||
$this->subjectLine = "Invoice - Second Scanning({$this->mplantName})";
|
||||
break;
|
||||
case 'InvalidPanelBox':
|
||||
case 'CompletedSerialInvoice':
|
||||
$this->subjectLine = "Invoice - Second Scanning({$this->mplantName})";
|
||||
break;
|
||||
case 'CSerialInvoice':
|
||||
$this->subjectLine = "Invoice - Second Scanning({$this->mplantName})";
|
||||
break;
|
||||
case 'ComSerInv':
|
||||
$this->subjectLine = "Invoice - Second Scanning({$this->mplantName})";
|
||||
break;
|
||||
// case 'CompletedSerialInvoice':
|
||||
// $this->subjectLine = "Invoice - Second Scanning({$this->mplantName})";
|
||||
// break;
|
||||
// case 'CSerialInvoice':
|
||||
// $this->subjectLine = "Invoice - Second Scanning({$this->mplantName})";
|
||||
// break;
|
||||
// case 'ComSerInv':
|
||||
// $this->subjectLine = "Invoice - Second Scanning({$this->mplantName})";
|
||||
// break;
|
||||
}
|
||||
|
||||
return new Envelope(
|
||||
@@ -147,20 +141,48 @@ class InvalidSerialMail extends Mailable
|
||||
<b>Invoice Type:</b> {$this->mInvoiceType}<br>
|
||||
<b>Invoice Number:</b> {$this->invoiceNumber}<br>
|
||||
<b>Scanned QR Code:</b> {$this->serial}<br>
|
||||
<b>Employee Code:</b> {$this->mUserName}<br>
|
||||
";
|
||||
break;
|
||||
// case 'DuplicateCapacitorQR':
|
||||
// $this->greeting = "
|
||||
// Dear Sir/Madam,<br><br>
|
||||
// The scanned <b>Capacitor</b> serial number has already completed the scanning process.<br><br>
|
||||
// <b>Plant:</b> {$this->mplantName}<br>
|
||||
// <b>Invoice Type:</b> {$this->mInvoiceType}<br>
|
||||
// <b>Invoice Number:</b> {$this->invoiceNumber}<br>
|
||||
// <b>Scanned QR Code:</b> {$this->serial}<br>
|
||||
// <b>Employee Code:</b> {$this->mUserName}<br>
|
||||
// ";
|
||||
// break;
|
||||
case 'DuplicateCapacitorQR':
|
||||
$this->greeting = "
|
||||
Dear Sir/Madam,<br><br>
|
||||
The scanned <b>Capacitor</b> serial number has already completed the scanning process.<br><br>
|
||||
<b>Plant:</b> {$this->mplantName}<br>
|
||||
<b>Invoice Type:</b> {$this->mInvoiceType}<br>
|
||||
<b>Invoice Number:</b> {$this->invoiceNumber}<br>
|
||||
<b>Scanned QR Code:</b> {$this->serial}<br>
|
||||
";
|
||||
break;
|
||||
case 'CompletedSerialInvoice':
|
||||
$this->greeting = "
|
||||
Dear Sir/Madam,<br><br>
|
||||
Serial invoice <b>'{$this->invoiceNumber}'</b> completed the scanning process.<br>
|
||||
<b>Plant:</b> {$this->mplantName}<br>
|
||||
<b>Invoice Type:</b> {$this->mInvoiceType}<br>
|
||||
<b>Invoice Number:</b> {$this->invoiceNumber}<br>
|
||||
<b>Scanned QR Code:</b> {$this->serial}<br>
|
||||
";
|
||||
break;
|
||||
case 'CSerialInvoice':
|
||||
$this->greeting = "
|
||||
Dear Sir/Madam,<br><br>
|
||||
Serial invoice <b>'{$this->invoiceNumber}'</b> completed the scanning process.<br>
|
||||
<b>Plant:</b> {$this->mplantName}<br>
|
||||
<b>Invoice Type:</b> {$this->mInvoiceType}<br>
|
||||
<b>Invoice Number:</b> {$this->invoiceNumber}<br>
|
||||
<b>Scanned QR Code:</b> {$this->serial}<br>
|
||||
";
|
||||
break;
|
||||
case 'ComSerInv':
|
||||
$this->greeting = "
|
||||
Dear Sir/Madam,<br><br>
|
||||
Serial invoice <b>'{$this->invoiceNumber}'</b> completed the scanning process.<br>
|
||||
<b>Plant:</b> {$this->mplantName}<br>
|
||||
<b>Invoice Type:</b> {$this->mInvoiceType}<br>
|
||||
<b>Invoice Number:</b> {$this->invoiceNumber}<br>
|
||||
<b>Scanned QR Code:</b> {$this->serial}<br>
|
||||
";
|
||||
break;
|
||||
}
|
||||
|
||||
return new Content(
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class CharacteristicValue extends Model
|
||||
{
|
||||
|
||||
use SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'plant_id',
|
||||
'line_id',
|
||||
'item_id',
|
||||
'machine_id',
|
||||
'process_order',
|
||||
'coil_number',
|
||||
'status',
|
||||
'created_at',
|
||||
'updated_at',
|
||||
'created_by',
|
||||
'updated_by',
|
||||
];
|
||||
|
||||
public function plant(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Plant::class);
|
||||
}
|
||||
|
||||
public function line(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Line::class);
|
||||
}
|
||||
|
||||
public function item(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Item::class);
|
||||
}
|
||||
|
||||
public function machine(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Machine::class);
|
||||
}
|
||||
}
|
||||
@@ -1,106 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Policies;
|
||||
|
||||
use Illuminate\Auth\Access\Response;
|
||||
use App\Models\CharacteristicValue;
|
||||
use App\Models\User;
|
||||
|
||||
class CharacteristicValuePolicy
|
||||
{
|
||||
/**
|
||||
* Determine whether the user can view any models.
|
||||
*/
|
||||
public function viewAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('view-any CharacteristicValue');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can view the model.
|
||||
*/
|
||||
public function view(User $user, CharacteristicValue $characteristicvalue): bool
|
||||
{
|
||||
return $user->checkPermissionTo('view CharacteristicValue');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can create models.
|
||||
*/
|
||||
public function create(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('create CharacteristicValue');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can update the model.
|
||||
*/
|
||||
public function update(User $user, CharacteristicValue $characteristicvalue): bool
|
||||
{
|
||||
return $user->checkPermissionTo('update CharacteristicValue');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete the model.
|
||||
*/
|
||||
public function delete(User $user, CharacteristicValue $characteristicvalue): bool
|
||||
{
|
||||
return $user->checkPermissionTo('delete CharacteristicValue');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can delete any models.
|
||||
*/
|
||||
public function deleteAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('delete-any CharacteristicValue');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore the model.
|
||||
*/
|
||||
public function restore(User $user, CharacteristicValue $characteristicvalue): bool
|
||||
{
|
||||
return $user->checkPermissionTo('restore CharacteristicValue');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can restore any models.
|
||||
*/
|
||||
public function restoreAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('restore-any CharacteristicValue');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can replicate the model.
|
||||
*/
|
||||
public function replicate(User $user, CharacteristicValue $characteristicvalue): bool
|
||||
{
|
||||
return $user->checkPermissionTo('replicate CharacteristicValue');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can reorder the models.
|
||||
*/
|
||||
public function reorder(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('reorder CharacteristicValue');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete the model.
|
||||
*/
|
||||
public function forceDelete(User $user, CharacteristicValue $characteristicvalue): bool
|
||||
{
|
||||
return $user->checkPermissionTo('force-delete CharacteristicValue');
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine whether the user can permanently delete any models.
|
||||
*/
|
||||
public function forceDeleteAny(User $user): bool
|
||||
{
|
||||
return $user->checkPermissionTo('force-delete-any CharacteristicValue');
|
||||
}
|
||||
}
|
||||
@@ -42,7 +42,7 @@
|
||||
"laravel/sail": "^1.26",
|
||||
"mockery/mockery": "^1.6",
|
||||
"nunomaduro/collision": "^8.1",
|
||||
"phpunit/phpunit": "^11.0.1"
|
||||
"phpunit/phpunit": "^12.0.0"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
<?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
|
||||
{
|
||||
$sql = <<<'SQL'
|
||||
CREATE TABLE characteristic_values (
|
||||
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||
plant_id BIGINT NOT NULL,
|
||||
line_id BIGINT NOT NULL,
|
||||
item_id BIGINT NOT NULL,
|
||||
machine_id BIGINT NOT NULL,
|
||||
|
||||
process_order TEXT DEFAULT NULL,
|
||||
coil_number TEXT DEFAULT NULL,
|
||||
status TEXT DEFAULT NULL,
|
||||
|
||||
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||
created_by TEXT DEFAULT NULL,
|
||||
updated_by TEXT DEFAULT NULL,
|
||||
deleted_at TIMESTAMP,
|
||||
|
||||
FOREIGN KEY (plant_id) REFERENCES plants (id),
|
||||
FOREIGN KEY (line_id) REFERENCES lines (id),
|
||||
FOREIGN KEY (item_id) REFERENCES items (id),
|
||||
FOREIGN KEY (machine_id) REFERENCES machines (id)
|
||||
);
|
||||
SQL;
|
||||
DB::statement($sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('characteristic_values');
|
||||
}
|
||||
};
|
||||
@@ -43,6 +43,7 @@ use Illuminate\Support\Facades\Route;
|
||||
// return $item;
|
||||
// });
|
||||
|
||||
|
||||
// Route::post('/user/update', function (Request $request) {
|
||||
// // Return the request data as JSON
|
||||
|
||||
@@ -53,6 +54,7 @@ use Illuminate\Support\Facades\Route;
|
||||
// ]);
|
||||
// });
|
||||
|
||||
|
||||
// Route::middleware('auth.basic')->post('/user/update', function (Request $request) {
|
||||
// return response()->json([
|
||||
// 'message' => 'Authenticated via Basic Auth',
|
||||
@@ -61,6 +63,7 @@ use Illuminate\Support\Facades\Route;
|
||||
// ]);
|
||||
// });
|
||||
|
||||
|
||||
Route::post('obd/store-data', [ObdController::class, 'store']);
|
||||
|
||||
Route::get('obd/get-test-datas', [ObdController::class, 'get_test']);
|
||||
@@ -75,11 +78,11 @@ Route::get('/download-qr-pdf/{palletNo}', [PalletController::class, 'downloadQrP
|
||||
|
||||
Route::get('/download-reprint-qr-pdf/{palletNo}', [PalletController::class, 'downloadReprintQrPdf'])->name('download-reprint-qr-pdf');
|
||||
|
||||
// Route::get('/download-reprint-process-pdf/{plant}/{item}/{process_order}/{coil_number}/{name}', [PalletController::class, 'downloadReprintProcess'])->name('download-reprint-process-pdf');
|
||||
//Route::get('/download-reprint-process-pdf/{plant}/{item}/{process_order}/{coil_number}', [PalletController::class, 'downloadReprintProcess'])->name('download-reprint-process-pdf');
|
||||
|
||||
Route::get('/download-qr1-pdf/{palletNo}', [ProductionStickerReprintController::class, 'downloadQrPdf'])->name('download-qr1-pdf');
|
||||
|
||||
// Production Dashboard Controller
|
||||
//Production Dashboard Controller
|
||||
|
||||
Route::get('get/module-name/data', [ModuleController::class, 'get_module']);
|
||||
|
||||
@@ -101,7 +104,7 @@ Route::get('get/module-production-order/data', [ModuleProductionOrderDataControl
|
||||
|
||||
Route::get('get/module-production-linestop/data', [ModuleProductionLineStopController::class, 'get_moduleProductionLineStop']);
|
||||
|
||||
// Invoice Dashboard Controller
|
||||
//Invoice Dashboard Controller
|
||||
|
||||
Route::get('get/module-invoice-type/data', [ModuleInvoiceDataController::class, 'get_invoiceData']);
|
||||
|
||||
@@ -111,7 +114,7 @@ Route::get('get/module-invoice-count/data', [ModuleInvoiceTypeController::class,
|
||||
|
||||
Route::get('get/module-invoice-quantity/data', [ModuleInvoiceQuantityController::class, 'get_invoiceQuantityData']);
|
||||
|
||||
// Guard Dashboard Controller
|
||||
//Guard Dashboard Controller
|
||||
|
||||
Route::get('get/module-guard-day/data', [ModuleGuardDayCountController::class, 'get_guardDay_countData']);
|
||||
|
||||
@@ -119,19 +122,19 @@ Route::get('get/module-guard-hourly/data', [ModuleGuardHourlyCountController::cl
|
||||
|
||||
Route::get('get/module-guard-name/data', [ModuleGuardNameController::class, 'get_guard_name_Data']);
|
||||
|
||||
// Power house controller
|
||||
//Power house controller
|
||||
|
||||
Route::get('get/mfm-parameter/data', [MfmParameterController::class, 'get_mfm_parameter']);
|
||||
|
||||
Route::get('get/mfm-parameterid/data', [MfmParameterController::class, 'get_mfm_parameterid']);
|
||||
|
||||
// Invoice Validation Controller
|
||||
//Invoice Validation Controller
|
||||
|
||||
Route::post('serial-invoice/store-data', [InvoiceValidationController::class, 'serialInvoice']);
|
||||
|
||||
Route::post('material-invoice/store-data', [InvoiceValidationController::class, 'materialInvoice']);
|
||||
|
||||
// Testing panel Controller
|
||||
//Testing panel Controller
|
||||
|
||||
Route::get('testing/user/get-data', [UserController::class, 'get_testing_data']);
|
||||
|
||||
@@ -153,37 +156,25 @@ Route::post('process-order', [PdfController::class, 'storeProcessOrderData']);
|
||||
|
||||
Route::get('sap/files', [SapFileController::class, 'readFiles']);
|
||||
|
||||
// ..Laser Marking - Characteristics
|
||||
//..Laser Marking - Characteristics
|
||||
|
||||
Route::get('laser/item/get-master-data', [StickerMasterController::class, 'get_master']);
|
||||
|
||||
Route::post('laser/route/data', [CharacteristicsController::class, 'test']); // ->withoutMiddleware(VerifyCsrfToken::class)
|
||||
Route::post('laser/route/data', [CharacteristicsController::class, 'test']);//->withoutMiddleware(VerifyCsrfToken::class)
|
||||
|
||||
// //..Part Validation - Characteristics
|
||||
// Route::get('get-characteristics/master-data', [CharacteristicsController::class, 'getCharacteristicsMaster']);
|
||||
|
||||
// // Route::get('get-characteristics/master-data', [CharacteristicsController::class, 'getCharacteristicsMaster']);
|
||||
// Route::get('laser/characteristics/get', [CharacteristicsController::class, 'getClassChar']);
|
||||
|
||||
// // //..Serial or job
|
||||
// Route::get('laser/characteristics/check', [CharacteristicsController::class, 'checkClassChar']);
|
||||
|
||||
// // Route::get('laser/characteristics/get', [CharacteristicsController::class, 'getClassChar']);
|
||||
// Route::post('laser/characteristics/data', [CharacteristicsController::class, 'storeClassChar']);
|
||||
|
||||
// // Route::get('laser/characteristics/check', [CharacteristicsController::class, 'checkClassChar']);
|
||||
|
||||
// // //..Job or Master - Characteristics
|
||||
|
||||
// // Route::post('laser/characteristics/data', [CharacteristicsController::class, 'storeClassChar']);
|
||||
|
||||
// // //..serial auto or manual
|
||||
|
||||
// // Route::post('laser/characteristics/status', [CharacteristicsController::class, 'storeLaserStatus']);
|
||||
|
||||
// ..Product Characteristics
|
||||
// Route::post('laser/characteristics/status', [CharacteristicsController::class, 'storeLaserStatus']);
|
||||
|
||||
Route::get('characteristics/get/master', [CharacteristicsController::class, 'getCharMaster']);
|
||||
|
||||
Route::post('characteristics/values', [CharacteristicsController::class, 'storeCharValues']);
|
||||
|
||||
// GR Master PDF and Serial Number
|
||||
//GR Master PDF and Serial Number
|
||||
|
||||
Route::get('grNumber-pdf', [PdfController::class, 'getGRPdf']);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user