Compare commits
19 Commits
6a87067387
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| bbecb86dc3 | |||
|
|
fdc0aed31c | ||
| a3cec9db06 | |||
|
|
947aacb074 | ||
| 0c6331282e | |||
|
|
b7b5db068b | ||
| 7d8b2d8632 | |||
|
|
d42ae70e46 | ||
|
|
be2e7b00d7 | ||
| 7276765aa4 | |||
|
|
1ce7995105 | ||
| 164a1becac | |||
|
|
d5cd1437fe | ||
| 6ad91c8c96 | |||
|
|
d4d101c5c9 | ||
| a6496b59c1 | |||
|
|
b8cb0aa237 | ||
| 027bacbce8 | |||
|
|
eef42d9736 |
@@ -39,8 +39,6 @@ class ProductionCharacteristicExporter extends Exporter
|
|||||||
->label('OBSERVED VALUE'),
|
->label('OBSERVED VALUE'),
|
||||||
ExportColumn::make('status')
|
ExportColumn::make('status')
|
||||||
->label('STATUS'),
|
->label('STATUS'),
|
||||||
ExportColumn::make('inspection_status')
|
|
||||||
->label('INSPECTION STATUS'),
|
|
||||||
ExportColumn::make('remark')
|
ExportColumn::make('remark')
|
||||||
->label('REMARK'),
|
->label('REMARK'),
|
||||||
ExportColumn::make('created_at')
|
ExportColumn::make('created_at')
|
||||||
|
|||||||
@@ -128,7 +128,8 @@ class CycleCount extends Page
|
|||||||
$operatorName = $user->name;
|
$operatorName = $user->name;
|
||||||
|
|
||||||
$pattern1 = '/^[^#]*#[^#]*#[^#]*#[^#]*#$/';
|
$pattern1 = '/^[^#]*#[^#]*#[^#]*#[^#]*#$/';
|
||||||
$pattern2 = '/^[^|]*\|[^|]*\|[^|]*$/';
|
// $pattern2 = '/^[^|]*\|[^|]*\|[^|]*$/';
|
||||||
|
$pattern2 = '/^[^|]+\|[^|]+(?:\|[^|]*)?$/';
|
||||||
$pattern3 = '/^([a-zA-Z0-9]{6,})\|([1-9][a-zA-Z0-9]{8,})(?:\/[MmPp])?\|?$/';
|
$pattern3 = '/^([a-zA-Z0-9]{6,})\|([1-9][a-zA-Z0-9]{8,})(?:\/[MmPp])?\|?$/';
|
||||||
|
|
||||||
// $pattern2 = '/^[^|]+\|[^|]+\|[^|]+\|?$/'; Optional Pipeline at end
|
// $pattern2 = '/^[^|]+\|[^|]+\|[^|]+\|?$/'; Optional Pipeline at end
|
||||||
@@ -678,7 +679,7 @@ class CycleCount extends Page
|
|||||||
$stock->update([
|
$stock->update([
|
||||||
'bin' => $bin,
|
'bin' => $bin,
|
||||||
'batch' => $this->batch,
|
'batch' => $this->batch,
|
||||||
// 'doc_no' =>$this->docNo,
|
'doc_no' =>$this->docNo,
|
||||||
'scanned_quantity' => $newScannedQty,
|
'scanned_quantity' => $newScannedQty,
|
||||||
'scanned_status' => $status,
|
'scanned_status' => $status,
|
||||||
]);
|
]);
|
||||||
@@ -721,6 +722,13 @@ class CycleCount extends Page
|
|||||||
$parts = explode('|', $value);
|
$parts = explode('|', $value);
|
||||||
|
|
||||||
$this->itemCode = $parts[0] ?? null;
|
$this->itemCode = $parts[0] ?? null;
|
||||||
|
|
||||||
|
if (count($parts) == 2) {
|
||||||
|
// Format: itemcode|serialnumber
|
||||||
|
$this->sNo = $parts[1];
|
||||||
|
$this->batch = null;
|
||||||
|
} else {
|
||||||
|
// Format: itemcode|value1|value2
|
||||||
if (strlen($parts[1]) > strlen($parts[2])) {
|
if (strlen($parts[1]) > strlen($parts[2])) {
|
||||||
$this->sNo = $parts[1];
|
$this->sNo = $parts[1];
|
||||||
$this->batch = $parts[2];
|
$this->batch = $parts[2];
|
||||||
@@ -728,6 +736,14 @@ class CycleCount extends Page
|
|||||||
$this->batch = $parts[1];
|
$this->batch = $parts[1];
|
||||||
$this->sNo = $parts[2];
|
$this->sNo = $parts[2];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
// if (strlen($parts[1]) > strlen($parts[2])) {
|
||||||
|
// $this->sNo = $parts[1];
|
||||||
|
// $this->batch = $parts[2];
|
||||||
|
// } else {
|
||||||
|
// $this->batch = $parts[1];
|
||||||
|
// $this->sNo = $parts[2];
|
||||||
|
// }
|
||||||
|
|
||||||
if (strlen($this->itemCode) < 6) {
|
if (strlen($this->itemCode) < 6) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
@@ -759,7 +775,7 @@ class CycleCount extends Page
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
} elseif (strlen($this->batch) < 5) {
|
} elseif (count($parts) !== 2 && strlen($this->batch) < 5) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Unknown Batch')
|
->title('Unknown Batch')
|
||||||
->body("Batch should contain minimum 5 digits '$this->batch'")
|
->body("Batch should contain minimum 5 digits '$this->batch'")
|
||||||
@@ -927,7 +943,7 @@ class CycleCount extends Page
|
|||||||
'bin' => $bin,
|
'bin' => $bin,
|
||||||
'serial_number' => $this->sNo,
|
'serial_number' => $this->sNo,
|
||||||
'stickerMasterId' => $stickerMasterId,
|
'stickerMasterId' => $stickerMasterId,
|
||||||
'batch' => $this->batch,
|
'batch' => $this->batch ?? null,
|
||||||
'docNo' => $this->docNo,
|
'docNo' => $this->docNo,
|
||||||
'quantity' => $this->quantity,
|
'quantity' => $this->quantity,
|
||||||
]),
|
]),
|
||||||
@@ -1240,7 +1256,7 @@ class CycleCount extends Page
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($serialAgaPlant->batch != '' || $serialAgaPlant->batch != null) {
|
if (count($parts) !== 2 && ($serialAgaPlant->batch != '' || $serialAgaPlant->batch != null)){
|
||||||
|
|
||||||
if ($serialAgaPlant->batch != $this->batch) {
|
if ($serialAgaPlant->batch != $this->batch) {
|
||||||
|
|
||||||
@@ -1396,7 +1412,7 @@ class CycleCount extends Page
|
|||||||
'bin' => $bin,
|
'bin' => $bin,
|
||||||
'serial_number' => $this->sNo,
|
'serial_number' => $this->sNo,
|
||||||
'stickerMasterId' => $stickerMasterId,
|
'stickerMasterId' => $stickerMasterId,
|
||||||
'batch' => $this->batch,
|
'batch' => $this->batch ?? null,
|
||||||
'docNo' => $this->docNo,
|
'docNo' => $this->docNo,
|
||||||
'quantity' => $this->quantity,
|
'quantity' => $this->quantity,
|
||||||
]),
|
]),
|
||||||
@@ -1415,8 +1431,8 @@ class CycleCount extends Page
|
|||||||
|
|
||||||
$serial->update([
|
$serial->update([
|
||||||
'bin' => $bin ?? null,
|
'bin' => $bin ?? null,
|
||||||
'batch' => $this->batch ?? null,
|
'batch' => count($parts) !== 2 ? $this->batch : $serial->batch,
|
||||||
'doc_no' => $this->docNo ?? null,
|
// 'doc_no' => $this->docNo ?? null,
|
||||||
'scanned_status' => 'Scanned',
|
'scanned_status' => 'Scanned',
|
||||||
'scanned_quantity' => '1',
|
'scanned_quantity' => '1',
|
||||||
'updated_at' => now(),
|
'updated_at' => now(),
|
||||||
@@ -2132,6 +2148,7 @@ class CycleCount extends Page
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getHeaderActions(): array
|
protected function getHeaderActions(): array
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ use Filament\Facades\Filament;
|
|||||||
use Filament\Forms;
|
use Filament\Forms;
|
||||||
use Filament\Forms\Components\Actions\Action;
|
use Filament\Forms\Components\Actions\Action;
|
||||||
use Filament\Forms\Form;
|
use Filament\Forms\Form;
|
||||||
|
use Filament\Forms\Get;
|
||||||
use Filament\Notifications\Notification;
|
use Filament\Notifications\Notification;
|
||||||
use Filament\Resources\Resource;
|
use Filament\Resources\Resource;
|
||||||
use Filament\Tables;
|
use Filament\Tables;
|
||||||
@@ -39,18 +40,32 @@ class EquipmentMasterResource extends Resource
|
|||||||
return $form
|
return $form
|
||||||
->schema([
|
->schema([
|
||||||
Forms\Components\Select::make('plant_id')
|
Forms\Components\Select::make('plant_id')
|
||||||
->label('Plant')
|
->label('Plant Name')
|
||||||
->reactive()
|
|
||||||
->relationship('plant', 'name')
|
->relationship('plant', 'name')
|
||||||
|
->required()
|
||||||
|
->searchable()
|
||||||
|
->reactive()
|
||||||
->options(function (callable $get) {
|
->options(function (callable $get) {
|
||||||
$userHas = Filament::auth()->user()->plant_id;
|
$userHas = Filament::auth()->user()->plant_id;
|
||||||
|
|
||||||
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
|
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
|
||||||
})
|
})
|
||||||
->required(),
|
->disabled(fn (Get $get) => ! empty($get('id')))
|
||||||
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
|
$set('machine_id', null);
|
||||||
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
|
})
|
||||||
|
->default(function () {
|
||||||
|
|
||||||
|
$userHas = Filament::auth()->user()->plant_id;
|
||||||
|
|
||||||
|
return ($userHas && strlen($userHas) > 0) ? $userHas : optional(EquipmentMaster::latest()->first())->plant_id;
|
||||||
|
}),
|
||||||
Forms\Components\Select::make('machine_id')
|
Forms\Components\Select::make('machine_id')
|
||||||
// ->relationship('machine', 'name')
|
// ->relationship('machine', 'name')
|
||||||
->label('Work Center')
|
->label('Work Center')
|
||||||
|
->required()
|
||||||
|
->searchable()
|
||||||
->reactive()
|
->reactive()
|
||||||
->options(function (callable $get) {
|
->options(function (callable $get) {
|
||||||
$plantId = $get('plant_id');
|
$plantId = $get('plant_id');
|
||||||
@@ -60,15 +75,30 @@ class EquipmentMasterResource extends Resource
|
|||||||
|
|
||||||
return \App\Models\Machine::where('plant_id', $plantId)->pluck('work_center', 'id');
|
return \App\Models\Machine::where('plant_id', $plantId)->pluck('work_center', 'id');
|
||||||
})
|
})
|
||||||
->required(),
|
->disabled(fn (Get $get) => ! empty($get('id')))
|
||||||
|
->afterStateUpdated(function ($state, callable $set) {
|
||||||
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
|
}),
|
||||||
Forms\Components\TextInput::make('name')
|
Forms\Components\TextInput::make('name')
|
||||||
->label('Name'),
|
->label('Name')
|
||||||
|
->afterStateUpdated(function ($state, callable $set) {
|
||||||
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
|
}),
|
||||||
Forms\Components\TextInput::make('description')
|
Forms\Components\TextInput::make('description')
|
||||||
->label('Description'),
|
->label('Description')
|
||||||
|
->afterStateUpdated(function ($state, callable $set) {
|
||||||
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
|
}),
|
||||||
Forms\Components\TextInput::make('make')
|
Forms\Components\TextInput::make('make')
|
||||||
->label('Make'),
|
->label('Make')
|
||||||
|
->afterStateUpdated(function ($state, callable $set) {
|
||||||
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
|
}),
|
||||||
Forms\Components\TextInput::make('model')
|
Forms\Components\TextInput::make('model')
|
||||||
->label('Model'),
|
->label('Model')
|
||||||
|
->afterStateUpdated(function ($state, callable $set) {
|
||||||
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
|
}),
|
||||||
Forms\Components\TextInput::make('equipment_number')
|
Forms\Components\TextInput::make('equipment_number')
|
||||||
->label('Equipment Number')
|
->label('Equipment Number')
|
||||||
->reactive()
|
->reactive()
|
||||||
@@ -82,6 +112,8 @@ class EquipmentMasterResource extends Resource
|
|||||||
];
|
];
|
||||||
})
|
})
|
||||||
->afterStateUpdated(function ($state, callable $set) {
|
->afterStateUpdated(function ($state, callable $set) {
|
||||||
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
|
|
||||||
if (! $state) {
|
if (! $state) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -108,7 +140,10 @@ class EquipmentMasterResource extends Resource
|
|||||||
// }
|
// }
|
||||||
// }),
|
// }),
|
||||||
Forms\Components\TextInput::make('instrument_serial_number')
|
Forms\Components\TextInput::make('instrument_serial_number')
|
||||||
->label('Instrument Serial Number'),
|
->label('Instrument Serial Number')
|
||||||
|
->afterStateUpdated(function ($state, callable $set) {
|
||||||
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
|
}),
|
||||||
// Forms\Components\DateTimePicker::make('calibrated_on')
|
// Forms\Components\DateTimePicker::make('calibrated_on')
|
||||||
// ->label('Calibrated On')
|
// ->label('Calibrated On')
|
||||||
// ->required(),
|
// ->required(),
|
||||||
@@ -128,6 +163,7 @@ class EquipmentMasterResource extends Resource
|
|||||||
$frequency = $get('frequency') ?? '1';
|
$frequency = $get('frequency') ?? '1';
|
||||||
$nextDate = self::calculateNextCalibrationDate($state, $frequency);
|
$nextDate = self::calculateNextCalibrationDate($state, $frequency);
|
||||||
$set('next_calibration_date', $nextDate);
|
$set('next_calibration_date', $nextDate);
|
||||||
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
// ->afterStateUpdated(function ($state, callable $get, callable $set) {
|
// ->afterStateUpdated(function ($state, callable $get, callable $set) {
|
||||||
// $frequency = (int) $get('frequency');
|
// $frequency = (int) $get('frequency');
|
||||||
@@ -152,6 +188,7 @@ class EquipmentMasterResource extends Resource
|
|||||||
$calibratedOn = $get('calibrated_on');
|
$calibratedOn = $get('calibrated_on');
|
||||||
$nextDate = self::calculateNextCalibrationDate($calibratedOn, $state);
|
$nextDate = self::calculateNextCalibrationDate($calibratedOn, $state);
|
||||||
$set('next_calibration_date', $nextDate);
|
$set('next_calibration_date', $nextDate);
|
||||||
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
// ->afterStateUpdated(function ($state, callable $get, callable $set) {
|
// ->afterStateUpdated(function ($state, callable $get, callable $set) {
|
||||||
// $calibratedOn = $get('calibrated_on');
|
// $calibratedOn = $get('calibrated_on');
|
||||||
@@ -171,12 +208,21 @@ class EquipmentMasterResource extends Resource
|
|||||||
Forms\Components\DateTimePicker::make('next_calibration_date')
|
Forms\Components\DateTimePicker::make('next_calibration_date')
|
||||||
->label('Next Calibration Date')
|
->label('Next Calibration Date')
|
||||||
->readOnly()
|
->readOnly()
|
||||||
->required(),
|
->required()
|
||||||
|
->afterStateUpdated(function ($state, callable $set) {
|
||||||
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
|
}),
|
||||||
|
|
||||||
Forms\Components\TextInput::make('calibrated_by')
|
Forms\Components\TextInput::make('calibrated_by')
|
||||||
->label('Calibrated By'),
|
->label('Calibrated By')
|
||||||
|
->afterStateUpdated(function ($state, callable $set) {
|
||||||
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
|
}),
|
||||||
Forms\Components\Textarea::make('calibration_certificate')
|
Forms\Components\Textarea::make('calibration_certificate')
|
||||||
->label('Calibration Certificate'),
|
->label('Calibration Certificate')
|
||||||
|
->afterStateUpdated(function ($state, callable $set) {
|
||||||
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
|
}),
|
||||||
|
|
||||||
Forms\Components\FileUpload::make('attachment')
|
Forms\Components\FileUpload::make('attachment')
|
||||||
->label('PDF Upload')
|
->label('PDF Upload')
|
||||||
@@ -185,7 +231,10 @@ class EquipmentMasterResource extends Resource
|
|||||||
->disk('local')
|
->disk('local')
|
||||||
->directory('uploads/temp')
|
->directory('uploads/temp')
|
||||||
->preserveFilenames()
|
->preserveFilenames()
|
||||||
->reactive(),
|
->reactive()
|
||||||
|
->afterStateUpdated(function ($state, callable $set) {
|
||||||
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
|
}),
|
||||||
|
|
||||||
// Forms\Components\Actions::make([
|
// Forms\Components\Actions::make([
|
||||||
// Action::make('uploadNow')
|
// Action::make('uploadNow')
|
||||||
@@ -341,7 +390,11 @@ class EquipmentMasterResource extends Resource
|
|||||||
->label('Created By')
|
->label('Created By')
|
||||||
->default(Filament::auth()->user()?->name),
|
->default(Filament::auth()->user()?->name),
|
||||||
Forms\Components\Hidden::make('updated_by')
|
Forms\Components\Hidden::make('updated_by')
|
||||||
->label('Updated By'),
|
->label('Updated By')
|
||||||
|
->default(Filament::auth()->user()?->name),
|
||||||
|
Forms\Components\TextInput::make('id')
|
||||||
|
->hidden()
|
||||||
|
->readOnly(),
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -359,7 +412,7 @@ class EquipmentMasterResource extends Resource
|
|||||||
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
|
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
|
||||||
}),
|
}),
|
||||||
Tables\Columns\TextColumn::make('plant.name')
|
Tables\Columns\TextColumn::make('plant.name')
|
||||||
->label('Plant')
|
->label('Plant Name')
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
->sortable(),
|
->sortable(),
|
||||||
Tables\Columns\TextColumn::make('machine.work_center')
|
Tables\Columns\TextColumn::make('machine.work_center')
|
||||||
@@ -413,24 +466,30 @@ class EquipmentMasterResource extends Resource
|
|||||||
->alignCenter()
|
->alignCenter()
|
||||||
->sortable(),
|
->sortable(),
|
||||||
Tables\Columns\TextColumn::make('created_by')
|
Tables\Columns\TextColumn::make('created_by')
|
||||||
->label('Created Bys')
|
->label('Created By')
|
||||||
->alignCenter()
|
|
||||||
->sortable(),
|
|
||||||
Tables\Columns\TextColumn::make('updated_by')
|
|
||||||
->label('Updated By')
|
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
->sortable(),
|
->sortable(),
|
||||||
Tables\Columns\TextColumn::make('created_at')
|
Tables\Columns\TextColumn::make('created_at')
|
||||||
->label('Created At')
|
->label('Created At')
|
||||||
->dateTime()
|
->dateTime()
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
|
->sortable(),
|
||||||
|
Tables\Columns\TextColumn::make('updated_by')
|
||||||
|
->label('Updated By')
|
||||||
|
->alignCenter()
|
||||||
->sortable()
|
->sortable()
|
||||||
->toggleable(isToggledHiddenByDefault: true),
|
->toggleable(isToggledHiddenByDefault: false),
|
||||||
Tables\Columns\TextColumn::make('updated_at')
|
Tables\Columns\TextColumn::make('updated_at')
|
||||||
->label('Updated At')
|
->label('Updated At')
|
||||||
->dateTime()
|
->dateTime()
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
->sortable()
|
->sortable()
|
||||||
|
->toggleable(isToggledHiddenByDefault: false),
|
||||||
|
Tables\Columns\TextColumn::make('deleted_at')
|
||||||
|
->label('Deleted At')
|
||||||
|
->dateTime()
|
||||||
|
->alignCenter()
|
||||||
|
->sortable()
|
||||||
->toggleable(isToggledHiddenByDefault: true),
|
->toggleable(isToggledHiddenByDefault: true),
|
||||||
])
|
])
|
||||||
->filters([
|
->filters([
|
||||||
|
|||||||
@@ -167,6 +167,16 @@ class PalletPrintController extends Controller
|
|||||||
->where('wire_packing_number', $pallet)
|
->where('wire_packing_number', $pallet)
|
||||||
->value('customer_po_master_id');
|
->value('customer_po_master_id');
|
||||||
|
|
||||||
|
$masterIds = WireMasterPacking::where('plant_id', $plant)
|
||||||
|
->where('wire_packing_number', $pallet)
|
||||||
|
->pluck('customer_po_master_id');
|
||||||
|
|
||||||
|
$customerPo = CustomerPoMaster::whereIn('id', $masterIds)
|
||||||
|
->value('customer_po');
|
||||||
|
|
||||||
|
$customerPoMasterIds = CustomerPoMaster::where('customer_po', $customerPo)
|
||||||
|
->pluck('id');
|
||||||
|
|
||||||
$items = WireMasterPacking::with('item')
|
$items = WireMasterPacking::with('item')
|
||||||
->where('plant_id', $plant)
|
->where('plant_id', $plant)
|
||||||
->where('wire_packing_number', $pallet)
|
->where('wire_packing_number', $pallet)
|
||||||
@@ -185,8 +195,18 @@ class PalletPrintController extends Controller
|
|||||||
$customerCode = $customer->customer_po ?? '';
|
$customerCode = $customer->customer_po ?? '';
|
||||||
$customerName = $customer->customer_name ?? '';
|
$customerName = $customer->customer_name ?? '';
|
||||||
|
|
||||||
|
// $totalBoxes = WireMasterPacking::where('plant_id', $plant)
|
||||||
|
// ->where('customer_po_master_id', $customerPoMasterId)
|
||||||
|
// ->select('wire_packing_number')
|
||||||
|
// ->groupBy('wire_packing_number')
|
||||||
|
// ->havingRaw(
|
||||||
|
// 'COUNT(*) = COUNT(CASE WHEN wire_packing_status = ? THEN 1 END)',
|
||||||
|
// ['Completed']
|
||||||
|
// )
|
||||||
|
// ->count();
|
||||||
|
|
||||||
$totalBoxes = WireMasterPacking::where('plant_id', $plant)
|
$totalBoxes = WireMasterPacking::where('plant_id', $plant)
|
||||||
->where('customer_po_master_id', $customerPoMasterId)
|
->whereIn('customer_po_master_id', $customerPoMasterIds)
|
||||||
->select('wire_packing_number')
|
->select('wire_packing_number')
|
||||||
->groupBy('wire_packing_number')
|
->groupBy('wire_packing_number')
|
||||||
->havingRaw(
|
->havingRaw(
|
||||||
@@ -195,8 +215,20 @@ class PalletPrintController extends Controller
|
|||||||
)
|
)
|
||||||
->count();
|
->count();
|
||||||
|
|
||||||
|
// $completedPallets = WireMasterPacking::where('plant_id', $plant)
|
||||||
|
// ->where('customer_po_master_id', $customerPoMasterId)
|
||||||
|
// ->select('wire_packing_number')
|
||||||
|
// ->groupBy('wire_packing_number')
|
||||||
|
// ->havingRaw(
|
||||||
|
// 'COUNT(*) = COUNT(CASE WHEN wire_packing_status = ? THEN 1 END)',
|
||||||
|
// ['Completed']
|
||||||
|
// )
|
||||||
|
// ->orderBy('wire_packing_number')
|
||||||
|
// ->pluck('wire_packing_number')
|
||||||
|
// ->values();
|
||||||
|
|
||||||
$completedPallets = WireMasterPacking::where('plant_id', $plant)
|
$completedPallets = WireMasterPacking::where('plant_id', $plant)
|
||||||
->where('customer_po_master_id', $customerPoMasterId)
|
->whereIn('customer_po_master_id', $customerPoMasterIds)
|
||||||
->select('wire_packing_number')
|
->select('wire_packing_number')
|
||||||
->groupBy('wire_packing_number')
|
->groupBy('wire_packing_number')
|
||||||
->havingRaw(
|
->havingRaw(
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Models\Item;
|
||||||
use App\Models\Plant;
|
use App\Models\Plant;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
|
||||||
@@ -56,6 +57,78 @@ class PlantController extends Controller
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getItemCode(Request $request){
|
||||||
|
$expectedUser = env('API_AUTH_USER');
|
||||||
|
$expectedPw = env('API_AUTH_PW');
|
||||||
|
$header_auth = $request->header('Authorization');
|
||||||
|
$expectedToken = $expectedUser.':'.$expectedPw;
|
||||||
|
|
||||||
|
if ('Bearer '.$expectedToken != $header_auth) {
|
||||||
|
return response()->json([
|
||||||
|
'status_code' => 'ERROR',
|
||||||
|
'status_description' => 'Invalid authorization token!',
|
||||||
|
], 403);
|
||||||
|
}
|
||||||
|
|
||||||
|
$plantCode = $request->header('plant-code');
|
||||||
|
|
||||||
|
$itemCode = $request->header('item-code');
|
||||||
|
|
||||||
|
if (! $plantCode) {
|
||||||
|
return response()->json([
|
||||||
|
'status_code' => 'ERROR',
|
||||||
|
'status_description' => "Plant Code value can't be empty",
|
||||||
|
], 404);
|
||||||
|
} elseif (! $itemCode) {
|
||||||
|
return response()->json([
|
||||||
|
'status_code' => 'ERROR',
|
||||||
|
'status_description' => 'Item code cannot be empty!',
|
||||||
|
], 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
$plant = Plant::where('code', $plantCode)->first();
|
||||||
|
$plantId = $plant->id;
|
||||||
|
|
||||||
|
if (! $plant) {
|
||||||
|
return response()->json([
|
||||||
|
'status_code' => 'ERROR',
|
||||||
|
'status_description' => "Plant Code '{$plantCode}' not found!",
|
||||||
|
], 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
$itemCodeExist = Item::where('code', $itemCode)->first();
|
||||||
|
|
||||||
|
if (! $itemCodeExist) {
|
||||||
|
return response()->json([
|
||||||
|
'status_code' => 'ERROR',
|
||||||
|
'status_description' => 'Item code not found',
|
||||||
|
], 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
$itemCodePlantExist = Item::where('code', $itemCode)->where('plant_id', $plantId)->first();
|
||||||
|
|
||||||
|
if (! $itemCodePlantExist) {
|
||||||
|
return response()->json([
|
||||||
|
'status_code' => 'ERROR',
|
||||||
|
'status_description' => "Item code not found against plant code '$plantCode'",
|
||||||
|
], 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (empty(trim($itemCodePlantExist->description ?? ''))) {
|
||||||
|
return response()->json([
|
||||||
|
'status_code' => 'ERROR',
|
||||||
|
'status_description' => "Description is empty in Item Master against item code '$itemCode'.",
|
||||||
|
], 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'status_code' => 'SUCCESS',
|
||||||
|
'status_description' => [
|
||||||
|
'description' => $itemCodePlantExist->description,
|
||||||
|
],
|
||||||
|
], 200);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the specified resource in storage.
|
* Update the specified resource in storage.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -83,6 +83,15 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td style="border:1px solid #d1d5db;font-weight:bold;">
|
||||||
|
No of Person
|
||||||
|
</td>
|
||||||
|
<td style="border:1px solid #d1d5db;">
|
||||||
|
{{ $visitor->number_of_person }}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td style="border:1px solid #d1d5db;font-weight:bold;">
|
<td style="border:1px solid #d1d5db;font-weight:bold;">
|
||||||
Visit Time
|
Visit Time
|
||||||
|
|||||||
@@ -234,3 +234,7 @@ Route::post('file/store', [SapFileController::class, 'store'])->name('file.store
|
|||||||
Route::get('/print-pallet/{pallet}/{plant}', [PalletPrintController::class, 'print'])->name('print.pallet');
|
Route::get('/print-pallet/{pallet}/{plant}', [PalletPrintController::class, 'print'])->name('print.pallet');
|
||||||
|
|
||||||
Route::post('vehicle/entry', [VehicleController::class, 'storeVehicleEntry']);
|
Route::post('vehicle/entry', [VehicleController::class, 'storeVehicleEntry']);
|
||||||
|
|
||||||
|
//..Item Code
|
||||||
|
|
||||||
|
Route::get('item-code', [PlantController::class, 'getItemCode']);
|
||||||
|
|||||||
Reference in New Issue
Block a user