Compare commits
19 Commits
31b56ae9b2
...
renovate/v
| Author | SHA1 | Date | |
|---|---|---|---|
| 63e7f1a344 | |||
| f0ef2dda8e | |||
|
|
c43bc208b8 | ||
| 968d67d808 | |||
|
|
a1974ce78c | ||
| 2342c6003d | |||
|
|
151c563c4b | ||
| 290d218a0d | |||
|
|
e4223e28be | ||
| c455c76715 | |||
|
|
030013f914 | ||
| a1abe537c3 | |||
|
|
750f8520f5 | ||
| c65265e68e | |||
|
|
3b0eeda209 | ||
| 3da016ae49 | |||
|
|
1bc14aac38 | ||
| ea17636670 | |||
|
|
19b44a6705 |
@@ -24,8 +24,8 @@ class ItemExporter extends Exporter
|
||||
// Increment and return the row number
|
||||
return ++$rowNumber;
|
||||
}),
|
||||
ExportColumn::make('plant.name')
|
||||
->label('PLANT'),
|
||||
ExportColumn::make('plant.code')
|
||||
->label('PLANT CODE'),
|
||||
ExportColumn::make('category')
|
||||
->label('CATEGORY'),
|
||||
ExportColumn::make('code')
|
||||
|
||||
@@ -8,7 +8,8 @@ use Filament\Actions\Imports\Exceptions\RowImportFailedException;
|
||||
use Filament\Actions\Imports\ImportColumn;
|
||||
use Filament\Actions\Imports\Importer;
|
||||
use Filament\Actions\Imports\Models\Import;
|
||||
use Str;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class ItemImporter extends Importer
|
||||
{
|
||||
@@ -48,10 +49,10 @@ class ItemImporter extends Importer
|
||||
->label('Unit of Measure'),
|
||||
ImportColumn::make('plant')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Plant Name')
|
||||
->example('Ransar Industries-I')
|
||||
->label('Plant Name')
|
||||
->relationship(resolveUsing: 'name')
|
||||
->exampleHeader('Plant Code')
|
||||
->example('1000')
|
||||
->label('Plant Code')
|
||||
->relationship(resolveUsing: 'code') // Lookup Plant by code column
|
||||
->rules(['required']),
|
||||
];
|
||||
}
|
||||
@@ -59,36 +60,46 @@ class ItemImporter extends Importer
|
||||
public function resolveRecord(): ?Item
|
||||
{
|
||||
$warnMsg = [];
|
||||
$plantCod = $this->data['plant'];
|
||||
$plant = null;
|
||||
Log::info('ResolveRecord triggered', $this->data);
|
||||
$iCode = trim($this->data['code']);
|
||||
$description = trim($this->data['description']);
|
||||
$plant = Plant::where('name', $this->data['plant'])->first();
|
||||
if (!$plant) {
|
||||
$warnMsg[] = "Plant not found"; // '" . $this->data['plant'] . "'
|
||||
|
||||
if (Str::length($plantCod) < 4 || ! is_numeric($plantCod) || ! preg_match('/^[1-9]\d{3,}$/', $plantCod)) {
|
||||
$warnMsg[] = 'Invalid plant code found';
|
||||
} else {
|
||||
$plant = Plant::where('code', $plantCod)->first();
|
||||
if (! $plant) {
|
||||
$warnMsg[] = 'Plant not found'; // '" . $plantCod . "'
|
||||
}
|
||||
}
|
||||
if (Str::length($iCode) < 6 || !ctype_alnum($iCode)) {
|
||||
$warnMsg[] = "Invalid item code found";
|
||||
|
||||
if (Str::length($iCode) < 6 || ! ctype_alnum($iCode)) {
|
||||
$warnMsg[] = 'Invalid item code found';
|
||||
}
|
||||
// if (Str::length($this->data['uom']) <= 0) {
|
||||
// $warnMsg[] = "Invalid unit of measure found";
|
||||
// }
|
||||
if (Str::length($description) < 5) {
|
||||
$warnMsg[] = "Invalid description found";
|
||||
$warnMsg[] = 'Invalid description found';
|
||||
}
|
||||
if (Str::length($this->data['hourly_quantity']) < 0 || !is_numeric($this->data['hourly_quantity']) || $this->data['hourly_quantity'] <= 0) {
|
||||
$warnMsg[] = "Invalid hourly quantity found";
|
||||
if (Str::length($this->data['hourly_quantity']) < 0 || ! is_numeric($this->data['hourly_quantity']) || $this->data['hourly_quantity'] <= 0) {
|
||||
$warnMsg[] = 'Invalid hourly quantity found';
|
||||
}
|
||||
if (!empty($warnMsg)) {
|
||||
if (! empty($warnMsg)) {
|
||||
throw new RowImportFailedException(implode(', ', $warnMsg));
|
||||
}
|
||||
|
||||
return Item::updateOrCreate([
|
||||
'code' => $iCode,
|
||||
'plant_id' => $plant->id
|
||||
],
|
||||
'code' => $iCode,
|
||||
'plant_id' => $plant->id,
|
||||
],
|
||||
[
|
||||
'category' => trim($this->data['category']),
|
||||
'description' => $description,
|
||||
'hourly_quantity' => $this->data['hourly_quantity'],
|
||||
'uom' => trim($this->data['uom'])
|
||||
'uom' => trim($this->data['uom']),
|
||||
]
|
||||
);
|
||||
// return new Item;
|
||||
|
||||
@@ -976,7 +976,9 @@ class StickerReprint extends Page implements HasForms
|
||||
]);
|
||||
}
|
||||
|
||||
if (!preg_match('/^[a-zA-Z0-9]{6,}+\|[1-9][a-zA-Z0-9]{8,}+(\|)?$/', $formQRData)) {
|
||||
// if (!preg_match('/^[a-zA-Z0-9]{6,}+\|[1-9][a-zA-Z0-9]{8,}+(\|)?$/', $formQRData))
|
||||
// {
|
||||
if (!preg_match('/^[A-Za-z0-9]{6,}\|[1-9][A-Za-z0-9]{7,}(\/[A-Za-z0-9]*)?(\|)?$/', $formQRData)) {
|
||||
if (strpos($formQRData, '|') === false) {
|
||||
$this->form->fill([
|
||||
'plant_id'=> $this->pId,
|
||||
@@ -1004,7 +1006,14 @@ class StickerReprint extends Page implements HasForms
|
||||
{
|
||||
$splits = explode('|', $formQRData);
|
||||
$iCode = trim($splits[0]);
|
||||
$sNumber = isset($splits[1]) ? trim($splits[1]) : null;
|
||||
$sNumberRaw = isset($splits[1]) ? trim($splits[1]) : null;
|
||||
|
||||
if ($sNumberRaw !== null) {
|
||||
$sNumber = preg_replace('/\/.*/', '', $sNumberRaw);
|
||||
$sNumber = trim($sNumber);
|
||||
} else {
|
||||
$sNumber = null;
|
||||
}
|
||||
|
||||
if (!ctype_alnum($iCode)) {
|
||||
$this->form->fill([
|
||||
@@ -1052,6 +1061,7 @@ class StickerReprint extends Page implements HasForms
|
||||
->send();
|
||||
return;
|
||||
}
|
||||
|
||||
else if (!ctype_alnum($sNumber)) {
|
||||
$this->form->fill([
|
||||
'plant_id'=> $this->pId,
|
||||
@@ -1145,9 +1155,18 @@ class StickerReprint extends Page implements HasForms
|
||||
// Only search when all parent IDs are selected
|
||||
$parts = explode('|', $formQRData);
|
||||
$itemCode = trim($parts[0]);
|
||||
$serialNumber = isset($parts[1]) ? trim($parts[1]) : null;
|
||||
$serialNumberRaw = isset($parts[1]) ? trim($parts[1]) : null;
|
||||
|
||||
// Remove slash and everything after it
|
||||
if ($serialNumberRaw != null) {
|
||||
$serialNumber = preg_replace('/\/.*/', '', $serialNumberRaw);
|
||||
$serialNumber = trim($serialNumber);
|
||||
} else {
|
||||
$serialNumber = null;
|
||||
}
|
||||
$item = Item::where('code', $itemCode)->first();
|
||||
|
||||
|
||||
if (!$item) {
|
||||
// Handle unknown item code
|
||||
$this->form->fill([
|
||||
@@ -1364,6 +1383,15 @@ class StickerReprint extends Page implements HasForms
|
||||
$itemCode = trim($parts[0]);
|
||||
$this->sNoId = isset($parts[1]) ? trim($parts[1]) : null;
|
||||
|
||||
if ($this->sNoId != null) {
|
||||
$this->sNoId = preg_replace('/\/.*/', '', $serialNumberRaw);
|
||||
$this->sNoId = trim($this->sNoId);
|
||||
} else {
|
||||
$this->sNoId = null;
|
||||
}
|
||||
|
||||
$this->qrData = preg_replace('/\/.*/', '', $this->qrData);
|
||||
|
||||
ProductionQuantity::create([
|
||||
'plant_id'=> $this->pId,
|
||||
'shift_id'=> $this->sId,
|
||||
@@ -1418,11 +1446,16 @@ class StickerReprint extends Page implements HasForms
|
||||
// Save the form data to the database or perform other operations
|
||||
// For example:
|
||||
$model = ProductionQuantity::create($formValues);
|
||||
// $formValues['serial_number'] = $this->serialNumber;
|
||||
|
||||
// ProductionQuantity::create($formValues);
|
||||
|
||||
// dd('Production Updated Event Dispatched');
|
||||
|
||||
$this->dispatch('productionUpdated');
|
||||
|
||||
|
||||
|
||||
// // Optionally, you can emit an event or perform a redirect after saving
|
||||
// $this->emit('formSaved', $model->id);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ use App\Filament\Exports\QualityValidationExporter;
|
||||
use App\Filament\Imports\QualityValidationImporter;
|
||||
use App\Filament\Resources\QualityValidationResource\Pages;
|
||||
use App\Filament\Resources\QualityValidationResource\RelationManagers;
|
||||
// use App\Jobs\SendInvalidQualityMailJob;
|
||||
use App\Mail\InvalidQualityMail;
|
||||
use App\Models\AlertMailRule;
|
||||
use App\Models\Item;
|
||||
@@ -13,6 +14,8 @@ use App\Models\Line;
|
||||
use App\Models\Plant;
|
||||
use App\Models\QualityValidation;
|
||||
use App\Models\StickerMaster;
|
||||
// use App\Models\User;
|
||||
// use App\Notifications\StatusUpdated;
|
||||
use Carbon\Carbon;
|
||||
use Closure;
|
||||
use Filament\Facades\Filament;
|
||||
@@ -45,6 +48,7 @@ class QualityValidationResource extends Resource
|
||||
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||
|
||||
protected static ?string $navigationGroup = 'Display';
|
||||
|
||||
public $isSubmitted = false;
|
||||
public $data = [];
|
||||
|
||||
@@ -706,7 +710,6 @@ class QualityValidationResource extends Resource
|
||||
$fileName = "{$value}.png";
|
||||
|
||||
$imageUrl = route('part.validation.image', [
|
||||
'plant' => $plantCode1,
|
||||
'filename' => $fileName
|
||||
]);
|
||||
|
||||
@@ -1731,6 +1734,17 @@ class QualityValidationResource extends Resource
|
||||
|
||||
$set('tube_sticker_motor_error', null);
|
||||
|
||||
// $mPorder = $get('production_order');
|
||||
|
||||
// $mPlantId = $get('plant_id');
|
||||
//$plant = Plant::find($mPlantId);
|
||||
// $plantCodePart4 = $plant?->code;
|
||||
|
||||
// $mlineId = $get('line_id');
|
||||
|
||||
// $mLine = Line::find($mlineId);
|
||||
// $mLinePart = $mLine?->name;
|
||||
|
||||
if (empty($state)) {
|
||||
$set('tube_sticker_motor_error', null);
|
||||
return;
|
||||
@@ -1832,6 +1846,24 @@ class QualityValidationResource extends Resource
|
||||
if (!$isMatch)
|
||||
{
|
||||
$set('tube_sticker_motor_error', 'Serial number does not match.');
|
||||
|
||||
// $mailData = \App\Filament\Resources\QualityValidationResource::getMailData($mPlantId);
|
||||
|
||||
// $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 InvalidQualityMail($state, $mPorder, $mPlantName,$mLinePart, $mUserName, 'InvalidTubeStickerMotor')
|
||||
// );
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// \Log::warning("No recipients found for plant {$mPlantName}, module Serial, rule invalid_serial.");
|
||||
// }
|
||||
$set('tube_sticker_motor_qr', null);
|
||||
return;
|
||||
}
|
||||
@@ -1856,10 +1888,32 @@ class QualityValidationResource extends Resource
|
||||
->default('')
|
||||
->required()
|
||||
->reactive()
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state) {
|
||||
->afterStateUpdated(function (callable $set, callable $get, ?string $state, $livewire) {
|
||||
|
||||
$set('tube_sticker_pump_error', null);
|
||||
|
||||
// $mPorder = $get('production_order');
|
||||
|
||||
// $mPlantId = $get('plant_id');
|
||||
// $plant = Plant::find($mPlantId);
|
||||
// $mPlantName = $plant?->name;
|
||||
|
||||
// $mlineId = $get('line_id');
|
||||
|
||||
// $mLine = Line::find($mlineId);
|
||||
// $mLinePart = $mLine?->name;
|
||||
|
||||
// $mPorder = $get('production_order');
|
||||
// $mPlantId = $get('plant_id');
|
||||
// $mlineId = $get('line_id');
|
||||
// $mUserName = Filament::auth()->user()?->name ?? 'Unknown';
|
||||
|
||||
// $mailData = \App\Filament\Resources\QualityValidationResource::getMailData($mPlantId);
|
||||
|
||||
// $mPlantName = $mailData['plant_name'];
|
||||
// $emails = $mailData['emails'];
|
||||
//$mUserName = Filament::auth()->user()->name;
|
||||
|
||||
if (empty($state)) {
|
||||
$set('tube_sticker_pump_error', null);
|
||||
return;
|
||||
@@ -1941,14 +1995,14 @@ class QualityValidationResource extends Resource
|
||||
// ]);
|
||||
$visibleSerialNumber = $get('serial_number');
|
||||
|
||||
$expectedItemCode = trim((string) $get('item_id'));
|
||||
$expectedItemCode = trim((string) $get('item_id'));
|
||||
|
||||
if ($itemCode != $expectedItemCode) {
|
||||
$set('tube_sticker_pump_error', 'Item code does not match.');
|
||||
return;
|
||||
}
|
||||
if ($itemCode != $expectedItemCode) {
|
||||
$set('tube_sticker_pump_error', 'Item code does not match.');
|
||||
return;
|
||||
}
|
||||
|
||||
$set('tube_sticker_pump_error', $serialNumber);
|
||||
$set('tube_sticker_pump_error', $serialNumber);
|
||||
|
||||
// $isMatch = in_array($serialNumber, $visibleSerialNumbers, true);
|
||||
$isMatch = ($visibleSerialNumber == $serialNumber);
|
||||
@@ -1962,6 +2016,62 @@ class QualityValidationResource extends Resource
|
||||
{
|
||||
$set('tube_sticker_pump_error', 'Serial number does not match.');
|
||||
$set('tube_sticker_pump_qr', null);
|
||||
// $user = User::where('name', $mUserName)->first();
|
||||
|
||||
// if ($user) {
|
||||
// $user->notify(new StatusUpdated($state));
|
||||
// }
|
||||
|
||||
|
||||
// $currentUser = Filament::auth()->user();
|
||||
|
||||
// if ($currentUser) {
|
||||
// $currentUser->notify(new StatusUpdated($state)); // standard Laravel DB notification
|
||||
|
||||
// // refresh Filament bell
|
||||
// $livewire->dispatch('refreshFilamentNotifications');
|
||||
// }
|
||||
|
||||
|
||||
// Notification::make()
|
||||
// ->title('Status Updated')
|
||||
// ->body("Serial number scanned: $state")
|
||||
// ->danger()
|
||||
// ->sendToDatabase($currentUser);
|
||||
|
||||
//$user->notify(new StatusUpdated($state));
|
||||
|
||||
//Notification::send($user, new StatusUpdated($state));
|
||||
|
||||
|
||||
//dd($user);
|
||||
// $user->notify(new StatusUpdated($state));
|
||||
// Inside a Filament page or resource
|
||||
//$this->notify('success', "Serial number scanned: $state");
|
||||
|
||||
// dispatch(new SendInvalidQualityMailJob(
|
||||
// $state, $mPorder, $mPlantId, $mlineId, $mUserName, 'InvalidTubeStickerPump'
|
||||
// ))->afterResponse();
|
||||
|
||||
|
||||
// $mailData = \App\Filament\Resources\QualityValidationResource::getMailData($mPlantId);
|
||||
|
||||
// $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)->queue(
|
||||
// new InvalidQualityMail($state, $mPorder, $mPlantName,$mLinePart, $mUserName, 'InvalidTubeStickerPumpset')
|
||||
// );
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// \Log::warning("No recipients found for plant {$mPlantName}, module Serial, rule invalid_serial.");
|
||||
// }
|
||||
|
||||
return;
|
||||
}
|
||||
else {
|
||||
@@ -1989,6 +2099,17 @@ class QualityValidationResource extends Resource
|
||||
|
||||
$set('tube_sticker_pumpset_error', null);
|
||||
|
||||
$mPorder = $get('production_order');
|
||||
|
||||
$mPlantId = $get('plant_id');
|
||||
//$plant = Plant::find($mPlantId);
|
||||
// $plantCodePart4 = $plant?->code;
|
||||
|
||||
$mlineId = $get('line_id');
|
||||
|
||||
$mLine = Line::find($mlineId);
|
||||
$mLinePart = $mLine?->name;
|
||||
|
||||
if (empty($state)) {
|
||||
$set('tube_sticker_pumpset_error', null);
|
||||
return;
|
||||
@@ -2092,6 +2213,23 @@ class QualityValidationResource extends Resource
|
||||
if (!$isMatch)
|
||||
{
|
||||
$set('tube_sticker_pumpset_error', 'Serial number does not match.');
|
||||
// $mailData = \App\Filament\Resources\QualityValidationResource::getMailData($mPlantId);
|
||||
|
||||
// $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 InvalidQualityMail($state, $mPorder, $mPlantName,$mLinePart, $mUserName, 'InvalidTubeStickerPumpset')
|
||||
// );
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// \Log::warning("No recipients found for plant {$mPlantName}, module Serial, rule invalid_serial.");
|
||||
// }
|
||||
$set('tube_sticker_pumpset_qr', null);
|
||||
return;
|
||||
}
|
||||
@@ -2305,7 +2443,7 @@ class QualityValidationResource extends Resource
|
||||
$set('part_validation1', null);
|
||||
|
||||
$fileName = $expectedValue . ".png"; // or .jpg based on your file
|
||||
$fullPath = storage_path("app/private/uploads/PartValidation/{$plantCodePart1}/{$fileName}");
|
||||
$fullPath = storage_path("app/private/uploads/PartValidation/{$fileName}");
|
||||
|
||||
// dd($fullPath);
|
||||
|
||||
@@ -2316,7 +2454,7 @@ class QualityValidationResource extends Resource
|
||||
// ]);
|
||||
if (file_exists($fullPath)) {
|
||||
$imageUrl = route('part.validation.image', [
|
||||
'plant' => $plantCodePart1,
|
||||
// 'plant' => $plantCodePart1,
|
||||
'filename' => $fileName
|
||||
]);
|
||||
} else {
|
||||
@@ -2607,7 +2745,7 @@ class QualityValidationResource extends Resource
|
||||
'filename' => $fileName
|
||||
]);
|
||||
|
||||
$set('part_validation2_error_image', $imageUrl);
|
||||
$set('part_validation4_error_image', $imageUrl);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -2771,34 +2909,6 @@ class QualityValidationResource extends Resource
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
// public function getMail(){
|
||||
// //$plantId = $this->form->getState()['plant_id'];
|
||||
// $plantId = $this->data['plant_id'] ?? null;
|
||||
// //$this->plantId = $plantId;
|
||||
// dd($plantId);
|
||||
// $mInvoiceType = 'Serial';
|
||||
// $mPlantName = Plant::where('id', $plantId)->value('name');
|
||||
// $emails = AlertMailRule::where('plant', $plantId)
|
||||
// //->where('plant', $plantName)
|
||||
// ->where('module', 'InvoiceValidation')
|
||||
// ->where('rule_name', 'InvoiceMail')
|
||||
// ->where(function ($query) {
|
||||
// $query->whereNull('schedule_type')
|
||||
// ->orWhere('schedule_type', '');
|
||||
// })
|
||||
// ->pluck('email')
|
||||
// ->toArray();
|
||||
|
||||
// return [
|
||||
// 'plant_id' => $plantId,
|
||||
// 'plant_name' => $mPlantName,
|
||||
// 'invoice_type' => $mInvoiceType,
|
||||
// 'emails' => $emails,
|
||||
// ];
|
||||
// }
|
||||
|
||||
|
||||
public static function table(Table $table): Table
|
||||
{
|
||||
return $table
|
||||
|
||||
@@ -844,50 +844,56 @@ class StickerMasterResource extends Resource
|
||||
|
||||
$plantCode = $plant->code;
|
||||
|
||||
$sticker = StickerMaster::where('plant_id', $plantId)
|
||||
->where('item_id', $itemId)
|
||||
->first();
|
||||
// $sticker = StickerMaster::where('plant_id', $plantId)
|
||||
// ->where('item_id', $itemId)
|
||||
// ->first();
|
||||
|
||||
if (! $sticker) {
|
||||
Notification::make()
|
||||
->title('Unknown Sticker Master')
|
||||
->body('Sticker Master data not found.')
|
||||
->danger()
|
||||
->seconds(2)
|
||||
->send();
|
||||
}
|
||||
// if (! $sticker) {
|
||||
// Notification::make()
|
||||
// ->title('Unknown Sticker Master')
|
||||
// ->body('Sticker Master data not found.')
|
||||
// ->danger()
|
||||
// ->seconds(2)
|
||||
// ->send();
|
||||
// }
|
||||
|
||||
$value = $sticker->{$column};
|
||||
// $value = $sticker->{$column};
|
||||
|
||||
if (empty($value)) {
|
||||
Notification::make()
|
||||
->title('Unknown Part validation')
|
||||
->body("Selected validation '$column' has no value.")
|
||||
->danger()
|
||||
->seconds(2)
|
||||
->send();
|
||||
}
|
||||
// if (empty($value)) {
|
||||
// Notification::make()
|
||||
// ->title('Unknown Part validation')
|
||||
// ->body("Selected validation '$column' has no value.")
|
||||
// ->danger()
|
||||
// ->seconds(2)
|
||||
// ->send();
|
||||
// }
|
||||
|
||||
$newFileName = $value.'.png';
|
||||
// $newFileName = $value.'.png';
|
||||
|
||||
$directory = "uploads/PartValidation/{$plantCode}";
|
||||
$originalName = $uploadedFile->getClientOriginalName();
|
||||
$directory = 'uploads/PartValidation';
|
||||
|
||||
$disk = Storage::disk('local');
|
||||
if (! $disk->exists($directory)) {
|
||||
$disk->makeDirectory($directory, 0755, true);
|
||||
}
|
||||
|
||||
// $fullPath = Storage::disk('local')->path($directory);
|
||||
|
||||
// $directory = "uploads/PartValidation/{$plantCode}";
|
||||
|
||||
// $disk = Storage::disk('local');
|
||||
// if (! $disk->exists($directory)) {
|
||||
// $disk->makeDirectory($directory, 0755, true);
|
||||
// }
|
||||
|
||||
// $path = $uploadedFile->storeAs(
|
||||
// $directory,
|
||||
// $newFileName,
|
||||
// 'local'
|
||||
// );
|
||||
try {
|
||||
$path = $uploadedFile->storeAs(
|
||||
$directory,
|
||||
$newFileName,
|
||||
'local'
|
||||
);
|
||||
$path = $disk->putFileAs($directory, $uploadedFile, $originalName);
|
||||
} catch (\Exception $e) {
|
||||
Notification::make()
|
||||
->title('Upload Failed')
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\CharacteristicValue;
|
||||
use App\Models\ClassCharacteristic;
|
||||
use App\Models\Item;
|
||||
use App\Models\Line;
|
||||
@@ -497,7 +498,7 @@ class CharacteristicsController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
$col = ['marked_by', 'man_marked_by'];
|
||||
$col = ['marked_by', 'man_marked_by', 'motor_marked_by', 'pump_marked_by'];
|
||||
$missingUsers = [];
|
||||
$missingUsersPlant = [];
|
||||
$missingUsersRight = [];
|
||||
@@ -556,25 +557,148 @@ 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)
|
||||
@@ -585,6 +709,14 @@ 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)
|
||||
@@ -1338,7 +1470,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', 'pump_marked_status', 'motor_pump_pumpset_status', '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', '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'];
|
||||
|
||||
$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'];
|
||||
|
||||
@@ -1391,6 +1523,8 @@ 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);
|
||||
@@ -1520,7 +1654,7 @@ class CharacteristicsController extends Controller
|
||||
->get();
|
||||
|
||||
$remFields = [
|
||||
'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',
|
||||
'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',
|
||||
];
|
||||
|
||||
$filteredData = $characteristicsData->map(function ($char) use ($remFields) {
|
||||
@@ -1539,6 +1673,8 @@ 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) {
|
||||
@@ -1725,7 +1861,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_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_logo_cp', 'zmm_logo_ce', 'zmm_logo_nsf', 'zmm_laser_name'];
|
||||
|
||||
$characteristicsData = ClassCharacteristic::where('aufnr', $jobNumber)
|
||||
->where('plant_id', $plantId)
|
||||
@@ -1976,13 +2112,18 @@ class CharacteristicsController extends Controller
|
||||
'ZMM_HEADING' => $serialExists->zmm_heading ?? '',
|
||||
'MARK_STATUS' => $serialExists->mark_status ?? '',
|
||||
'MARKED_DATETIME' => $serialExists->marked_datetime,
|
||||
'MARKED_BY' => $serialExists->marked_by ?? '',
|
||||
'MARKED_BY' => ($serialExists->marked_by == 'Admin') ? 'jothi' : $serialExists->marked_by ?? '',
|
||||
'MAN_MARKED_STATUS' => $serialExists->man_marked_status ?? '',
|
||||
'MAN_MARKED_DATETIME' => $serialExists->man_marked_datetime ?? '',
|
||||
'MAN_MARKED_BY' => $serialExists->man_marked_by ?? '',
|
||||
'MAN_MARKED_BY' => ($serialExists->man_marked_by == 'Admin') ? 'jothi' : $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);
|
||||
}
|
||||
}
|
||||
@@ -2137,6 +2278,221 @@ 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.
|
||||
*/
|
||||
|
||||
@@ -20,191 +20,18 @@ class ProductionStickerReprintController extends Controller
|
||||
//
|
||||
}
|
||||
|
||||
// public function downloadQrPdf($palletNo)
|
||||
// {
|
||||
|
||||
// $parts = explode('|', $palletNo);
|
||||
// $itemCode = trim($parts[0]);
|
||||
// $serial = isset($parts[1]) ? trim($parts[1]) : null;
|
||||
|
||||
// // Retrieve the item record by item code
|
||||
// $item = Item::where('code', $itemCode)->first();
|
||||
|
||||
// if (!$item) {
|
||||
// abort(404, "Item with code {$itemCode} not found.");
|
||||
// }
|
||||
|
||||
// $itemId = $item->id;
|
||||
|
||||
// $production = ProductionQuantity::where('item_id', $itemId)
|
||||
// ->where('serial_number', $serial)
|
||||
// ->first();
|
||||
|
||||
// if (!$production) {
|
||||
// abort(404, "Production data for item code '{$itemCode}' with serial '{$serial}' not found.");
|
||||
// }
|
||||
|
||||
// $productionOrder = $production->production_order;
|
||||
|
||||
// $qrCode = new QrCode($palletNo);
|
||||
// $output = new Output\Png();
|
||||
// $qrBinary = $output->output($qrCode, 100);
|
||||
// $qrBase64 = base64_encode($qrBinary);
|
||||
|
||||
// $sticker = StickerMaster::where('item_id', $itemId)->first();
|
||||
|
||||
// // Decide number of copies
|
||||
// $copies = 1;
|
||||
|
||||
// if ($sticker) {
|
||||
// if ($sticker->serial_number_pump == 1) {
|
||||
// // If pump is selected (regardless of motor), 2 copies
|
||||
// $copies = 2;
|
||||
// } elseif ($sticker->serial_number_motor == 1) {
|
||||
// // Only motor selected, 1 copy
|
||||
// $copies = 1;
|
||||
// }
|
||||
// }
|
||||
// return '
|
||||
// <html>
|
||||
// <head>
|
||||
// <style>
|
||||
// body {
|
||||
// margin: 0;
|
||||
// padding: 0;
|
||||
// width: 100mm;
|
||||
// height: 14mm;
|
||||
// font-size: 10pt;
|
||||
// font-family: Arial Narrow, Arial, sans-serif;
|
||||
// }
|
||||
|
||||
// .sticker-table {
|
||||
// width: 100mm;
|
||||
// height: 14mm;
|
||||
// }
|
||||
|
||||
// .text-cell {
|
||||
// margin: 0;
|
||||
// padding: 0;
|
||||
// text-align: left;
|
||||
// font-size: 14pt;
|
||||
// font-weight: normal;
|
||||
// line-height: 1.2;
|
||||
// }
|
||||
|
||||
// .text-row {
|
||||
// font-weight: bold;
|
||||
// font-size: 9pt;
|
||||
// }
|
||||
|
||||
// .serial {
|
||||
// text-align: left;
|
||||
// }
|
||||
|
||||
// .po-number {
|
||||
// text-align: right;
|
||||
// white-space: nowrap;
|
||||
// }
|
||||
|
||||
// .desc-row {
|
||||
// font-weight: normal;
|
||||
// font-size: 8pt;
|
||||
// }
|
||||
|
||||
// .qr-cell {
|
||||
// width: 14mm;
|
||||
// text-align: left;
|
||||
// padding-left: 0mm;
|
||||
// padding-top: 0mm;
|
||||
// }
|
||||
|
||||
// img.qr {
|
||||
// width: 20mm;
|
||||
// height: 20mm;
|
||||
// }
|
||||
// </style>
|
||||
// </head>
|
||||
// <body>
|
||||
// <div id="print-container"></div>
|
||||
// <script>
|
||||
// const copies = ' . $copies . ';
|
||||
// const htmlBlock = `
|
||||
// <table class="sticker-table">
|
||||
// <tr>
|
||||
// <td class="qr-cell">
|
||||
// <img class="qr" src="data:image/png;base64,' . $qrBase64 . '" alt="QR" />
|
||||
// </td>
|
||||
// <td class="text-cell">
|
||||
// <div class="text-row">
|
||||
// <pre><span class="serial">' . htmlspecialchars($serial) . '</span> <span class="po-number">' . htmlspecialchars($productionOrder) . '</span></pre>
|
||||
// </div>
|
||||
// <div class="desc-row">
|
||||
// ' . htmlspecialchars($item->description) . '
|
||||
// </div>
|
||||
// </td>
|
||||
// </tr>
|
||||
// </table>
|
||||
// `;
|
||||
|
||||
// const container = document.getElementById("print-container");
|
||||
// for (let i = 0; i < copies; i++) {
|
||||
// container.insertAdjacentHTML("beforeend", htmlBlock);
|
||||
// }
|
||||
|
||||
// window.onload = function () {
|
||||
// window.print();
|
||||
// setTimeout(function () {
|
||||
// window.close();
|
||||
// }, 500);
|
||||
// };
|
||||
// </script>
|
||||
// </body>
|
||||
// </html>
|
||||
// ';
|
||||
|
||||
|
||||
// //Get sticker master data
|
||||
// // $sticker = StickerMaster::where('item_id', $itemId)->first();
|
||||
|
||||
// // //Decide number of copies
|
||||
// // $copies = 1; // default
|
||||
// // if ($sticker) {
|
||||
// // if ($sticker->serial_number_motor == 1) {
|
||||
// // $copies = 1;
|
||||
// // } elseif (is_null($sticker->serial_number_motor) && $sticker->serial_number_pump == 1) {
|
||||
// // $copies = 2;
|
||||
// // }
|
||||
// // }
|
||||
|
||||
// // $mpdf = new Mpdf([
|
||||
// // 'mode' => 'utf-8',
|
||||
// // 'format' => [60, 14],
|
||||
// // 'margin_left' => 0,
|
||||
// // 'margin_right' => 0,
|
||||
// // 'margin_top' => 0,
|
||||
// // 'margin_bottom' => 0,
|
||||
// // ]);
|
||||
|
||||
// // for ($i = 0; $i < $copies; $i++) {
|
||||
// // $mpdf->WriteHTML($html);
|
||||
// // if ($i < $copies - 1) {
|
||||
// // $mpdf->AddPage();
|
||||
// // }
|
||||
// // }
|
||||
|
||||
// // $mpdf->Output('qr-label.pdf', 'I');
|
||||
// // exit;
|
||||
// }
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
|
||||
public function downloadQrPdf($palletNo)
|
||||
{
|
||||
$parts = explode('|', $palletNo);
|
||||
$itemCode = trim($parts[0]);
|
||||
$serial = isset($parts[1]) ? trim($parts[1]) : null;
|
||||
$serialNumberRaw = isset($parts[1]) ? trim($parts[1]) : null;
|
||||
|
||||
if ($serialNumberRaw != null) {
|
||||
$serial = preg_replace('/\/.*/', '', $serialNumberRaw);
|
||||
$serial = trim($serial);
|
||||
} else {
|
||||
$serial = null;
|
||||
}
|
||||
|
||||
$item = Item::where('code', $itemCode)->first();
|
||||
$itemId= $item->id;
|
||||
|
||||
@@ -83,7 +83,100 @@ class InvoiceDataTable extends Component
|
||||
// $this->showCapacitorInput = false;
|
||||
}
|
||||
|
||||
public function loadData($invoiceNumber, $plantId, $onCapFocus)
|
||||
// public function loadData($invoiceNumber, $plantId, $onCapFocus)
|
||||
// {
|
||||
// $this->plantId = $plantId;
|
||||
// $this->invoiceNumber = $invoiceNumber;
|
||||
// $this->completedInvoice = false;
|
||||
// $this->isSerial = true;
|
||||
// $this->onCapFocus = $onCapFocus;
|
||||
// $this->emptyInvoice = false;
|
||||
// $this->hasSearched = true;
|
||||
// $this->materialInvoice = false;
|
||||
// // $this->showCapacitorInput = false;
|
||||
|
||||
// // ->where('serial_number', '!=', '')
|
||||
// $this->invoiceData = InvoiceValidation::where('invoice_number', $this->invoiceNumber)
|
||||
// ->where('plant_id', $plantId)->where('scanned_status', null)
|
||||
// ->get()
|
||||
// ->map(function ($record) {
|
||||
// return [
|
||||
// 'sticker_master_id' => $record->sticker_master_id,
|
||||
// 'serial_number' => $record->serial_number,
|
||||
// 'motor_scanned_status' => $record->motor_scanned_status ?? '',
|
||||
// 'pump_scanned_status' => $record->pump_scanned_status ?? '',
|
||||
// 'capacitor_scanned_status' => $record->capacitor_scanned_status ?? '',
|
||||
// 'scanned_status_set' => $record->scanned_status_set ?? '',
|
||||
// 'scanned_status' => $record->scanned_status ?? '',
|
||||
// 'panel_box_supplier' => $record->panel_box_supplier ?? '',
|
||||
// 'panel_box_serial_number' => $record->panel_box_serial_number ?? '',
|
||||
// 'created_at' => $record->created_at,
|
||||
// 'operator_id' => $record->operator_id,
|
||||
// ];
|
||||
// })
|
||||
// ->toArray();
|
||||
|
||||
// $this->packageCount = 0;
|
||||
|
||||
// // Loop through and replace 'code' using related StickerMaster > Item > code
|
||||
// foreach ($this->invoiceData as &$row) {
|
||||
// $stickCount = 0;
|
||||
// $scannedCount = 0;
|
||||
|
||||
// // $stickerMaster = \App\Models\StickerMaster::with('item')->find($row['sticker_master_id'] ?? null);
|
||||
// $row['code'] = StickerMaster::with('item')->find($row['sticker_master_id'] ?? null)?->item?->code ?? 'N/A';
|
||||
// $curStick = StickerMaster::where('id', $row['sticker_master_id'])->first();
|
||||
// if ($curStick) {
|
||||
// if (Str::length($curStick->panel_box_code) > 0) {
|
||||
// $stickCount++;
|
||||
// }
|
||||
// if ($curStick->tube_sticker_motor == 1 || $curStick->tube_sticker_pump == 1 || $curStick->tube_sticker_pumpset == 1) {
|
||||
// if ($curStick->tube_sticker_motor == 1) {
|
||||
// $stickCount++;
|
||||
// }
|
||||
// if ($curStick->tube_sticker_pump == 1 || ($curStick->tube_sticker_pumpset != 1 && $curStick->tube_sticker_pump != 1 && $curStick->pack_slip_pump == 1)) {
|
||||
// $stickCount++;
|
||||
// }
|
||||
// if ($curStick->tube_sticker_pumpset == 1) {
|
||||
// $stickCount++;
|
||||
// }
|
||||
// } elseif ($curStick->pack_slip_motor == 1 || $curStick->pack_slip_pump == 1 || $curStick->pack_slip_pumpset == 1) {
|
||||
// if ($curStick->pack_slip_motor == 1) {
|
||||
// $stickCount++;
|
||||
// }
|
||||
// if ($curStick->pack_slip_pump == 1) {
|
||||
// $stickCount++;
|
||||
// }
|
||||
// if ($curStick->pack_slip_pumpset == 1) {
|
||||
// $stickCount++;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// if ($row['motor_scanned_status'] == 1) {
|
||||
// $scannedCount++;
|
||||
// }
|
||||
// if ($row['pump_scanned_status'] == 1) {
|
||||
// $scannedCount++;
|
||||
// }
|
||||
// if ($row['capacitor_scanned_status'] == 1) {
|
||||
// $scannedCount++;
|
||||
// }
|
||||
// if ($row['scanned_status_set'] == 1) {
|
||||
// $scannedCount++;
|
||||
// }
|
||||
|
||||
// $this->packageCount += $stickCount - $scannedCount;
|
||||
// }
|
||||
|
||||
// if ($onCapFocus) {
|
||||
// $this->dispatch('focus-capacitor-input');
|
||||
// } else {
|
||||
// $this->dispatch('focus-serial-number');
|
||||
// }
|
||||
// }
|
||||
|
||||
public function loadData($invoiceNumber, $plantId, $onCapFocus = false)
|
||||
{
|
||||
$this->plantId = $plantId;
|
||||
$this->invoiceNumber = $invoiceNumber;
|
||||
@@ -93,80 +186,70 @@ class InvoiceDataTable extends Component
|
||||
$this->emptyInvoice = false;
|
||||
$this->hasSearched = true;
|
||||
$this->materialInvoice = false;
|
||||
// $this->showCapacitorInput = false;
|
||||
|
||||
// ->where('serial_number', '!=', '')
|
||||
$this->invoiceData = InvoiceValidation::where('invoice_number', $this->invoiceNumber)
|
||||
->where('plant_id', $plantId)->where('scanned_status', null)
|
||||
->get()
|
||||
->map(function ($record) {
|
||||
return [
|
||||
'sticker_master_id' => $record->sticker_master_id,
|
||||
'serial_number' => $record->serial_number,
|
||||
'motor_scanned_status' => $record->motor_scanned_status ?? '',
|
||||
'pump_scanned_status' => $record->pump_scanned_status ?? '',
|
||||
'capacitor_scanned_status' => $record->capacitor_scanned_status ?? '',
|
||||
'scanned_status_set' => $record->scanned_status_set ?? '',
|
||||
'scanned_status' => $record->scanned_status ?? '',
|
||||
'panel_box_supplier' => $record->panel_box_supplier ?? '',
|
||||
'panel_box_serial_number' => $record->panel_box_serial_number ?? '',
|
||||
'created_at' => $record->created_at,
|
||||
'operator_id' => $record->operator_id,
|
||||
];
|
||||
})
|
||||
->toArray();
|
||||
// Eager load stickerMasterRelation and item
|
||||
$invoiceRecords = InvoiceValidation::with('stickerMasterRelation.item')
|
||||
->where('invoice_number', $invoiceNumber)
|
||||
->where('plant_id', $plantId)
|
||||
->whereNull('scanned_status')
|
||||
->get();
|
||||
|
||||
$this->invoiceData = [];
|
||||
$this->packageCount = 0;
|
||||
|
||||
// Loop through and replace 'code' using related StickerMaster > Item > code
|
||||
foreach ($this->invoiceData as &$row) {
|
||||
foreach ($invoiceRecords as $record) {
|
||||
$sm = $record->stickerMasterRelation;
|
||||
|
||||
// Compute code
|
||||
$rowCode = $sm?->item?->code ?? 'N/A';
|
||||
|
||||
$stickCount = 0;
|
||||
$scannedCount = 0;
|
||||
|
||||
// $stickerMaster = \App\Models\StickerMaster::with('item')->find($row['sticker_master_id'] ?? null);
|
||||
$row['code'] = StickerMaster::with('item')->find($row['sticker_master_id'] ?? null)?->item?->code ?? 'N/A';
|
||||
$curStick = StickerMaster::where('id', $row['sticker_master_id'])->first();
|
||||
if ($curStick) {
|
||||
if (Str::length($curStick->panel_box_code) > 0) {
|
||||
if ($sm) {
|
||||
// Panel box code
|
||||
if (Str::length($sm->panel_box_code) > 0) {
|
||||
$stickCount++;
|
||||
}
|
||||
if ($curStick->tube_sticker_motor == 1 || $curStick->tube_sticker_pump == 1 || $curStick->tube_sticker_pumpset == 1) {
|
||||
if ($curStick->tube_sticker_motor == 1) {
|
||||
$stickCount++;
|
||||
}
|
||||
if ($curStick->tube_sticker_pump == 1 || ($curStick->tube_sticker_pumpset != 1 && $curStick->tube_sticker_pump != 1 && $curStick->pack_slip_pump == 1)) {
|
||||
$stickCount++;
|
||||
}
|
||||
if ($curStick->tube_sticker_pumpset == 1) {
|
||||
$stickCount++;
|
||||
}
|
||||
} elseif ($curStick->pack_slip_motor == 1 || $curStick->pack_slip_pump == 1 || $curStick->pack_slip_pumpset == 1) {
|
||||
if ($curStick->pack_slip_motor == 1) {
|
||||
$stickCount++;
|
||||
}
|
||||
if ($curStick->pack_slip_pump == 1) {
|
||||
$stickCount++;
|
||||
}
|
||||
if ($curStick->pack_slip_pumpset == 1) {
|
||||
$stickCount++;
|
||||
}
|
||||
|
||||
// Tube stickers logic
|
||||
if ($sm->tube_sticker_motor == 1 || $sm->tube_sticker_pump == 1 || $sm->tube_sticker_pumpset == 1) {
|
||||
if ($sm->tube_sticker_motor == 1) $stickCount++;
|
||||
if ($sm->tube_sticker_pump == 1 || ($sm->tube_sticker_pumpset != 1 && $sm->tube_sticker_pump != 1 && $sm->pack_slip_pump == 1)) $stickCount++;
|
||||
if ($sm->tube_sticker_pumpset == 1) $stickCount++;
|
||||
}
|
||||
// Pack slip logic (only if tube sticker block didn't apply)
|
||||
elseif ($sm->pack_slip_motor == 1 || $sm->pack_slip_pump == 1 || $sm->pack_slip_pumpset == 1) {
|
||||
if ($sm->pack_slip_motor == 1) $stickCount++;
|
||||
if ($sm->pack_slip_pump == 1) $stickCount++;
|
||||
if ($sm->pack_slip_pumpset == 1) $stickCount++;
|
||||
}
|
||||
}
|
||||
|
||||
if ($row['motor_scanned_status'] == 1) {
|
||||
$scannedCount++;
|
||||
}
|
||||
if ($row['pump_scanned_status'] == 1) {
|
||||
$scannedCount++;
|
||||
}
|
||||
if ($row['capacitor_scanned_status'] == 1) {
|
||||
$scannedCount++;
|
||||
}
|
||||
if ($row['scanned_status_set'] == 1) {
|
||||
$scannedCount++;
|
||||
}
|
||||
// Count already scanned
|
||||
$scannedCount += ($record->motor_scanned_status == 1) ? 1 : 0;
|
||||
$scannedCount += ($record->pump_scanned_status == 1) ? 1 : 0;
|
||||
$scannedCount += ($record->capacitor_scanned_status == 1) ? 1 : 0;
|
||||
$scannedCount += ($record->scanned_status_set == 1) ? 1 : 0;
|
||||
|
||||
$this->packageCount += $stickCount - $scannedCount;
|
||||
// Increment packageCount
|
||||
$this->packageCount += max($stickCount - $scannedCount, 0);
|
||||
|
||||
$this->invoiceData[] = [
|
||||
'sticker_master_id' => $record->sticker_master_id,
|
||||
'serial_number' => $record->serial_number,
|
||||
'motor_scanned_status' => $record->motor_scanned_status ?? '',
|
||||
'pump_scanned_status' => $record->pump_scanned_status ?? '',
|
||||
'capacitor_scanned_status' => $record->capacitor_scanned_status ?? '',
|
||||
'scanned_status_set' => $record->scanned_status_set ?? '',
|
||||
'scanned_status' => $record->scanned_status ?? '',
|
||||
'panel_box_supplier' => $record->panel_box_supplier ?? '',
|
||||
'panel_box_serial_number' => $record->panel_box_serial_number ?? '',
|
||||
'created_at' => $record->created_at,
|
||||
'operator_id' => $record->operator_id,
|
||||
'code' => $rowCode,
|
||||
'stickCount' => $stickCount,
|
||||
];
|
||||
}
|
||||
|
||||
if ($onCapFocus) {
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
<?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
|
||||
{
|
||||
// received_quantity → NUMERIC(10,6)
|
||||
|
||||
DB::statement(<<<SQL
|
||||
ALTER TABLE process_orders
|
||||
ALTER COLUMN received_quantity TYPE NUMERIC(10,6)
|
||||
USING received_quantity::NUMERIC(10,6);
|
||||
SQL);
|
||||
|
||||
// order_quantity → NUMERIC(10,6)
|
||||
|
||||
DB::statement(<<<SQL
|
||||
ALTER TABLE process_orders
|
||||
ALTER COLUMN order_quantity TYPE NUMERIC(10,6)
|
||||
USING order_quantity::NUMERIC(10,6);
|
||||
SQL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('process_orders', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,38 @@
|
||||
<?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
|
||||
{
|
||||
DB::statement(<<<SQL
|
||||
ALTER TABLE process_orders
|
||||
ALTER COLUMN received_quantity TYPE NUMERIC(10,3)
|
||||
USING received_quantity::NUMERIC(10,3);
|
||||
SQL);
|
||||
|
||||
// order_quantity → NUMERIC(10,6)
|
||||
|
||||
DB::statement(<<<SQL
|
||||
ALTER TABLE process_orders
|
||||
ALTER COLUMN order_quantity TYPE NUMERIC(10,3)
|
||||
USING order_quantity::NUMERIC(10,3);
|
||||
SQL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('process_orders', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -13,6 +13,6 @@
|
||||
"laravel-vite-plugin": "^1.2.0",
|
||||
"postcss": "^8.4.47",
|
||||
"tailwindcss": "^3.4.13",
|
||||
"vite": "^6.0.11"
|
||||
"vite": "^7.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Http\Request;
|
||||
use thiagoalessio\TesseractOCR\TesseractOCR;
|
||||
use App\Filament\Pages\CustomLogin;
|
||||
|
||||
|
||||
Route::get('/', function () {
|
||||
return redirect('/admin');
|
||||
@@ -25,8 +25,8 @@ use App\Filament\Pages\CustomLogin;
|
||||
]);
|
||||
});
|
||||
|
||||
Route::get('/part-validation-image/{plant}/{filename}', function ($plant, $filename) {
|
||||
$path = storage_path("app/private/uploads/PartValidation/{$plant}/{$filename}");
|
||||
Route::get('/part-validation-image/{filename}', function ($filename) {
|
||||
$path = storage_path("app/private/uploads/PartValidation/{$filename}");
|
||||
|
||||
if (!file_exists($path)) {
|
||||
abort(404, 'Image not found');
|
||||
|
||||
Reference in New Issue
Block a user