Updated warning message against tube_sticker and pack_slip master data
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 12s
Gemini PR Review / review (pull_request) Failing after 29s
Laravel Pint / pint (pull_request) Successful in 2m16s
Laravel Larastan / larastan (pull_request) Failing after 3m17s
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 12s
Gemini PR Review / review (pull_request) Failing after 29s
Laravel Pint / pint (pull_request) Successful in 2m16s
Laravel Larastan / larastan (pull_request) Failing after 3m17s
This commit is contained in:
@@ -3270,7 +3270,7 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
$hasPumpSetQr = $record->stickerMasterRelation->tube_sticker_pumpset ?? null;
|
||||
$hasCapacitorQr = $record->stickerMasterRelation->panel_box_code ?? null;
|
||||
|
||||
if (! $hasMotorQr && ! $hasPumpQr && ! $hasPumpSetQr && ! $hasCapacitorQr) {
|
||||
if (! $hasMotorQr && ! $hasPumpQr && ! $hasPumpSetQr) {// && ! $hasCapacitorQr
|
||||
$hasMotorQr = $record->stickerMasterRelation->pack_slip_motor ?? null;
|
||||
$hasPumpQr = $record->stickerMasterRelation->pack_slip_pump ?? null;
|
||||
$hasPumpSetQr = $record->stickerMasterRelation->pack_slip_pumpset ?? null;
|
||||
@@ -3278,12 +3278,21 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
$hasPumpQr = $record->stickerMasterRelation->pack_slip_pump ?? null;
|
||||
}
|
||||
|
||||
$invalidPackage = false;
|
||||
$hasTubeMotorQr = $record->stickerMasterRelation->tube_sticker_motor ?? null;
|
||||
$hasPackMotorQr = $record->stickerMasterRelation->pack_slip_motor ?? null;
|
||||
$hasTubePumpSetQr = $record->stickerMasterRelation->tube_sticker_pumpset ?? null;
|
||||
$hasPackPumpSetQr = $record->stickerMasterRelation->pack_slip_pumpset ?? null;
|
||||
if ($hasTubeMotorQr != $hasPackMotorQr || $hasTubePumpSetQr != $hasPackPumpSetQr) {
|
||||
$invalidPackage = true;
|
||||
}
|
||||
|
||||
$hadMotorQr = $record->motor_scanned_status ?? null;
|
||||
$hadPumpQr = $record->pump_scanned_status ?? null;
|
||||
$hadPumpSetQr = $record->scanned_status_set ?? null;
|
||||
$hadCapacitorQr = $record->capacitor_scanned_status ?? null;
|
||||
|
||||
if (! $hasMotorQr && ! $hasPumpQr && ! $hasPumpSetQr && ! $hasCapacitorQr) {
|
||||
if ((! $hasMotorQr && ! $hasPumpQr && ! $hasPumpSetQr && ! $hasCapacitorQr) || $invalidPackage) {
|
||||
Notification::make()
|
||||
->title('Invalid: Item Code')
|
||||
->body("Scanned 'Item Code' doesn't have valid package type to proceed!")
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace App\Livewire;
|
||||
|
||||
use App\Filament\Resources\InvoiceValidationResource\Pages\CreateInvoiceValidation;
|
||||
use App\Models\InvoiceValidation;
|
||||
use App\Models\StickerMaster;
|
||||
use Filament\Facades\Filament;
|
||||
@@ -34,14 +33,14 @@ class InvoiceDataTable extends Component
|
||||
|
||||
public bool $showCapacitorInput = false;
|
||||
|
||||
// protected $listeners = ['refreshInvoiceData' => 'loadData',];
|
||||
// protected $listeners = ['refreshInvoiceData' => 'loadData',];
|
||||
|
||||
protected $listeners = [
|
||||
'refreshCompletedInvoice' => 'loadCompletedData',
|
||||
'refreshEmptyInvoice' => 'loadEmptyData',
|
||||
'refreshInvoiceData' => 'loadData',
|
||||
'refreshMaterialInvoiceData' => 'loadMaterialData',
|
||||
'openCapacitorModal' => 'showCapacitorInputBox'
|
||||
'openCapacitorModal' => 'showCapacitorInputBox',
|
||||
];
|
||||
|
||||
public $capacitorInput = '';
|
||||
@@ -96,101 +95,83 @@ class InvoiceDataTable extends Component
|
||||
$this->materialInvoice = false;
|
||||
// $this->showCapacitorInput = false;
|
||||
|
||||
//->where('serial_number', '!=', '')
|
||||
// ->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();
|
||||
->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
|
||||
// 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);
|
||||
// $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 ($curStick->tube_sticker_motor == 1 || $curStick->tube_sticker_pump == 1 || $curStick->tube_sticker_pumpset == 1 || Str::length($curStick->panel_box_code) > 0)
|
||||
{
|
||||
if ($curStick->tube_sticker_motor == 1)
|
||||
{
|
||||
$stickCount++;
|
||||
}
|
||||
if ($curStick->tube_sticker_pump == 1)
|
||||
{
|
||||
$stickCount++;
|
||||
}
|
||||
if ($curStick->tube_sticker_pumpset == 1)
|
||||
{
|
||||
$stickCount++;
|
||||
}
|
||||
if (Str::length($curStick->panel_box_code) > 0)
|
||||
{
|
||||
$stickCount++;
|
||||
}
|
||||
if ($curStick) {
|
||||
if (Str::length($curStick->panel_box_code) > 0) {
|
||||
$stickCount++;
|
||||
}
|
||||
else if ($curStick->pack_slip_motor == 1 || $curStick->pack_slip_pump == 1 || $curStick->pack_slip_pumpset == 1)
|
||||
{
|
||||
if ($curStick->pack_slip_motor == 1)
|
||||
{
|
||||
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->pack_slip_pump == 1)
|
||||
{
|
||||
if ($curStick->tube_sticker_pump == 1 || ($curStick->tube_sticker_pumpset != 1 && $curStick->tube_sticker_pump != 1 && $curStick->pack_slip_pump == 1)) {
|
||||
$stickCount++;
|
||||
}
|
||||
if ($curStick->pack_slip_pumpset == 1)
|
||||
{
|
||||
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)
|
||||
{
|
||||
if ($row['motor_scanned_status'] == 1) {
|
||||
$scannedCount++;
|
||||
}
|
||||
if ($row['pump_scanned_status'] == 1)
|
||||
{
|
||||
if ($row['pump_scanned_status'] == 1) {
|
||||
$scannedCount++;
|
||||
}
|
||||
if ($row['capacitor_scanned_status'] == 1)
|
||||
{
|
||||
if ($row['capacitor_scanned_status'] == 1) {
|
||||
$scannedCount++;
|
||||
}
|
||||
if ($row['scanned_status_set'] == 1)
|
||||
{
|
||||
if ($row['scanned_status_set'] == 1) {
|
||||
$scannedCount++;
|
||||
}
|
||||
|
||||
$this->packageCount += $stickCount - $scannedCount;
|
||||
}
|
||||
|
||||
if ($onCapFocus)
|
||||
{
|
||||
if ($onCapFocus) {
|
||||
$this->dispatch('focus-capacitor-input');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$this->dispatch('focus-serial-number');
|
||||
}
|
||||
}
|
||||
@@ -207,43 +188,36 @@ class InvoiceDataTable extends Component
|
||||
$this->materialInvoice = true;
|
||||
// $this->showCapacitorInput = false;
|
||||
|
||||
//->where('serial_number', '!=', '')
|
||||
// ->where('serial_number', '!=', '')
|
||||
$this->invoiceData = InvoiceValidation::where('invoice_number', $this->invoiceNumber)->where('plant_id', $plantId)->where('serial_number', null)
|
||||
->get()
|
||||
->map(function ($record) {
|
||||
return [
|
||||
'sticker_master_id' => $record->sticker_master_id,
|
||||
// 'material_type' => StickerMaster::where('id', $record->sticker_master_id)->first()->material_type ?? '',
|
||||
'quantity' => $record->quantity ?? '',
|
||||
'serial_number' => $record->serial_number ?? '',
|
||||
'batch_number' => $record->batch_number ?? '',
|
||||
'created_at' => $record->created_at,
|
||||
'operator_id' => $record->operator_id,
|
||||
];
|
||||
})
|
||||
->toArray();
|
||||
->get()
|
||||
->map(function ($record) {
|
||||
return [
|
||||
'sticker_master_id' => $record->sticker_master_id,
|
||||
// 'material_type' => StickerMaster::where('id', $record->sticker_master_id)->first()->material_type ?? '',
|
||||
'quantity' => $record->quantity ?? '',
|
||||
'serial_number' => $record->serial_number ?? '',
|
||||
'batch_number' => $record->batch_number ?? '',
|
||||
'created_at' => $record->created_at,
|
||||
'operator_id' => $record->operator_id,
|
||||
];
|
||||
})
|
||||
->toArray();
|
||||
|
||||
//Loop through and replace 'code' using related StickerMaster > Item > code
|
||||
// Loop through and replace 'code' using related StickerMaster > Item > code
|
||||
foreach ($this->invoiceData as &$row) {
|
||||
// $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';
|
||||
$matType = StickerMaster::where('id', $row['sticker_master_id'] ?? null)->first()->material_type ?? '';
|
||||
if ($matType === 1)
|
||||
{
|
||||
// $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';
|
||||
$matType = StickerMaster::where('id', $row['sticker_master_id'] ?? null)->first()->material_type ?? '';
|
||||
if ($matType === 1) {
|
||||
$row['material_type'] = 'Individual';
|
||||
}
|
||||
else if ($matType === 2)
|
||||
{
|
||||
} elseif ($matType === 2) {
|
||||
$row['material_type'] = 'Bundle';
|
||||
}
|
||||
else if ($matType === 3)
|
||||
{
|
||||
} elseif ($matType === 3) {
|
||||
$row['material_type'] = 'Quantity';
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$row['material_type'] = 'N/A';
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->dispatch('focus-serial-number');
|
||||
}
|
||||
@@ -275,11 +249,11 @@ class InvoiceDataTable extends Component
|
||||
$user = Filament::auth()->user();
|
||||
$operatorName = $user->name;
|
||||
|
||||
if (!$this->capacitorInput) {
|
||||
if (! $this->capacitorInput) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!preg_match('/^[^\/]+\/[^\/]+\/.+$/', $this->capacitorInput)) {
|
||||
if (! preg_match('/^[^\/]+\/[^\/]+\/.+$/', $this->capacitorInput)) {
|
||||
Notification::make()
|
||||
->title('Invalid Panel Box QR Format:')
|
||||
->body('Scan the valid panel box QR code to proceed!')
|
||||
@@ -287,6 +261,7 @@ class InvoiceDataTable extends Component
|
||||
// ->duration(3000)
|
||||
->seconds(2)
|
||||
->send();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -298,9 +273,9 @@ class InvoiceDataTable extends Component
|
||||
$existsInStickerMaster = StickerMaster::where('panel_box_code', $itemCode)->where('plant_id', $this->plantId)->whereHas('item', function ($query) {
|
||||
$query->where('code', $this->currentItemCode);
|
||||
})
|
||||
->exists();
|
||||
->exists();
|
||||
|
||||
if (!$existsInStickerMaster) {
|
||||
if (! $existsInStickerMaster) {
|
||||
Notification::make()
|
||||
->title('Unknown: Panel Box Code')
|
||||
->body("Unknown panel box code: $itemCode found for item code: $this->currentItemCode")
|
||||
@@ -309,12 +284,12 @@ class InvoiceDataTable extends Component
|
||||
->seconds(2)
|
||||
->send();
|
||||
$this->capacitorInput = '';
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($this->invoiceData as &$row) {
|
||||
if (($row['code'] ?? '') === $this->currentItemCode && ($row['serial_number'] ?? '') === $this->currentSerialNumber)
|
||||
{
|
||||
if (($row['code'] ?? '') === $this->currentItemCode && ($row['serial_number'] ?? '') === $this->currentSerialNumber) {
|
||||
$row['panel_box_supplier'] = $supplier;
|
||||
$row['panel_box_item_code'] = $itemCode;
|
||||
$row['panel_box_serial_number'] = $serialNumber;
|
||||
@@ -343,47 +318,41 @@ class InvoiceDataTable extends Component
|
||||
$packCnt = 1;
|
||||
$scanCnt = 1;
|
||||
// if ($hadMotorQr === $hasMotorQr && $hadPumpQr === $hasPumpQr && $hadPumpSetQr === $hasPumpSetQr)
|
||||
if ($hasMotorQr || $hasPumpQr || $hasPumpSetQr)
|
||||
{
|
||||
if ($hasMotorQr || $hasPumpQr || $hasPumpSetQr) {
|
||||
$packCnt = $hasMotorQr ? $packCnt + 1 : $packCnt;
|
||||
$packCnt = $hasPumpQr ? $packCnt + 1 : $packCnt;
|
||||
$packCnt = $hasPumpSetQr ? $packCnt + 1 : $packCnt;
|
||||
|
||||
$scanCnt = $hadMotorQr ? $scanCnt + 1: $scanCnt;
|
||||
$scanCnt = $hadPumpQr ? $scanCnt + 1: $scanCnt;
|
||||
$scanCnt = $hadPumpSetQr ? $scanCnt + 1: $scanCnt;
|
||||
$scanCnt = $hadMotorQr ? $scanCnt + 1 : $scanCnt;
|
||||
$scanCnt = $hadPumpQr ? $scanCnt + 1 : $scanCnt;
|
||||
$scanCnt = $hadPumpSetQr ? $scanCnt + 1 : $scanCnt;
|
||||
|
||||
if ($packCnt === $scanCnt)
|
||||
{
|
||||
if ($packCnt === $scanCnt) {
|
||||
$matchingValidation->update([
|
||||
'panel_box_supplier' => $supplier,
|
||||
'panel_box_item_code' => $itemCode,
|
||||
'panel_box_serial_number' => $serialNumber,
|
||||
'capacitor_scanned_status' => 1,
|
||||
'scanned_status' => 'Scanned',
|
||||
'operator_id'=> $operatorName,
|
||||
'operator_id' => $operatorName,
|
||||
]);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$matchingValidation->update([
|
||||
'panel_box_supplier' => $supplier,
|
||||
'panel_box_item_code' => $itemCode,
|
||||
'panel_box_serial_number' => $serialNumber,
|
||||
'capacitor_scanned_status' => 1,
|
||||
'operator_id'=> $operatorName,
|
||||
'operator_id' => $operatorName,
|
||||
]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$matchingValidation->update([
|
||||
'panel_box_supplier' => $supplier,
|
||||
'panel_box_item_code' => $itemCode,
|
||||
'panel_box_serial_number' => $serialNumber,
|
||||
'capacitor_scanned_status' => 1,
|
||||
'scanned_status' => 'Scanned',
|
||||
'operator_id'=> $operatorName,
|
||||
'operator_id' => $operatorName,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -398,15 +367,14 @@ class InvoiceDataTable extends Component
|
||||
$totalQuantity = InvoiceValidation::where('invoice_number', $matchingValidation->invoice_number)->where('plant_id', $this->plantId)->count();
|
||||
$scannedQuantity = InvoiceValidation::where('invoice_number', $matchingValidation->invoice_number)->where('plant_id', $this->plantId)->where('scanned_status', 'Scanned')->count();
|
||||
// $this->form->fill([
|
||||
// 'plant_id' => $matchingValidation->plant_id,
|
||||
// 'invoice_number' => $matchingValidation->invoice_number,
|
||||
// 'serial_number' => null,
|
||||
// 'total_quantity' => $totalQuantity,
|
||||
// 'scanned_quantity'=> $scannedQuantity,
|
||||
// ]);
|
||||
// 'plant_id' => $matchingValidation->plant_id,
|
||||
// 'invoice_number' => $matchingValidation->invoice_number,
|
||||
// 'serial_number' => null,
|
||||
// 'total_quantity' => $totalQuantity,
|
||||
// 'scanned_quantity'=> $scannedQuantity,
|
||||
// ]);
|
||||
|
||||
if ($totalQuantity === $scannedQuantity)
|
||||
{
|
||||
if ($totalQuantity === $scannedQuantity) {
|
||||
Notification::make()
|
||||
->title('Completed: Serial Invoice')
|
||||
->body("Serial invoice '$matchingValidation->invoice_number' completed the scanning process.<br>Scan the next 'Serial Invoice' to proceed!")
|
||||
@@ -414,9 +382,7 @@ class InvoiceDataTable extends Component
|
||||
->seconds(2)
|
||||
->send();
|
||||
$this->loadCompletedData($matchingValidation->invoice_number, $matchingValidation->plant_id, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$this->loadData($matchingValidation->invoice_number, $matchingValidation->plant_id, false);
|
||||
}
|
||||
}
|
||||
@@ -427,7 +393,7 @@ class InvoiceDataTable extends Component
|
||||
$this->showCapacitorInput = false;
|
||||
$this->capacitorInput = '';
|
||||
$this->dispatch('updateScannedQuantity');
|
||||
//$this->loadData($this->invoiceNumber, $this->plantId);
|
||||
// $this->loadData($this->invoiceNumber, $this->plantId);
|
||||
$this->dispatch('focus-serial-number');
|
||||
}
|
||||
|
||||
@@ -435,5 +401,4 @@ class InvoiceDataTable extends Component
|
||||
{
|
||||
return view('livewire.invoice-data-table');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user