ranjith-dev #268

Merged
jothi merged 14 commits from ranjith-dev into master 2026-01-28 11:38:46 +00:00
15 changed files with 938 additions and 272 deletions

View File

@@ -39,7 +39,7 @@ class Scheduler extends Command
public function handle()
{
// $this->call('approval:trigger-mails');
$this->call('approval:trigger-mails');
// --- Production Rules ---
$productionRules = AlertMailRule::where('module', 'ProductionQuantities')
@@ -112,6 +112,7 @@ class Scheduler extends Command
break;
}
}
// foreach ($invoiceRules as $rule) {
// switch ($rule->schedule_type) {

View File

@@ -156,6 +156,9 @@ class LineResource extends Resource
'Base FG Line' => 'Base FG Line',
'SFG Line' => 'SFG Line',
'FG Line' => 'FG Line',
'Process Base FG Line' => 'Process Base FG Line',
'Process SFG Line' => 'Process SFG Line',
'Process FG Line' => 'Process FG Line',
'Machining Cell' => 'Machining Cell',
'Blanking Cell' => 'Blanking Cell',
'Forming Cell' => 'Forming Cell',

View File

@@ -15,6 +15,9 @@ use Storage;
use Maatwebsite\Excel\Facades\Excel;
use Livewire\Livewire;
use Str;
use Livewire\Attributes\On;
use App\Services\SmbService;
use Illuminate\Support\Facades\Log;
class CreateSerialValidation extends CreateRecord
{
@@ -61,10 +64,13 @@ class CreateSerialValidation extends CreateRecord
return $this->getResource()::getUrl('create');
}
public function processInvoice($invoiceNumber)
{
$invoiceNumber = trim($invoiceNumber);
$fileName = $invoiceNumber . '.txt';
$this->showCapacitorInput = false;
$user = Filament::auth()->user();
@@ -88,6 +94,187 @@ class CreateSerialValidation extends CreateRecord
//..GET SERIAL INVOICE API
$content = SmbService::readTextFile($fileName);
if ($content == '') {
Notification::make()
->title('File Not Found')
->body("Unable to locate file: {$fileName}")
->danger()
->send();
return;
}
$lines = preg_split("/\r\n|\n|\r/", trim($content));
$insertData = [];
$missingItemCodes = [];
$InvalidLenSno = [];
$InvalidSno = [];
$InvalidLenItem = [];
$InvalidItem = [];
foreach ($lines as $line)
{
$line = trim($line);
if ($line == '') {
continue;
}
$parts = array_map('trim', explode(',', $line));
if (count($parts) != 2) {
Notification::make()
->title("Invalid data found inside the file.")
->danger()
->seconds(1)
->send();
return;
}
[$itemCode, $serialNumber] = $parts;
$sticker = StickerMaster::where('plant_id', $plantId)
->whereHas('item', function ($query) use ($itemCode, $plantId) {
$query->where('plant_id', $plantId)
->where('code', $itemCode);
})
->first();
if (Str::length($itemCode) < 6)
{
$InvalidLenItem [] = $itemCode;
continue;
}
else if(!is_numeric($itemCode)){
$InvalidItem [] = $itemCode;
continue;
}
if (Str::length($serialNumber) < 9)
{
$InvalidLenSno [] = $serialNumber;
continue;
}
else if(!ctype_alnum($serialNumber)){
$InvalidSno [] = $serialNumber;
continue;
}
if (!$sticker) {
$missingItemCodes[] = $itemCode;
continue;
}
$insertData[] = [
'plant_id' => $plantId,
'sticker_master_id' => $sticker->id,
'invoice_number' => $invoiceNumber,
'serial_number' => $serialNumber,
'created_at' => now(),
'operator_id' => $operatorName,
'updated_at' => now(),
];
}
if (!empty($InvalidLenItem))
{
$count = count($InvalidLenItem);
if ($count <= 10) {
$body = 'Item Code should contain minimum 6 digits: ' . implode(', ', $InvalidLenItem);
} else {
$body = "{$count} item codes contain minimum 6 digits.";
}
Notification::make()
->title("Invalid Item Code.")
->body("$body")
->danger()
->seconds(1)
->send();
return;
}
else if (!empty($InvalidItem))
{
$count = count($InvalidItem);
if ($count <= 10) {
$body = 'Item code must be in numeric values: ' . implode(', ', $InvalidSno);
} else {
$body = "{$count} item codes must be in numeric values.";
}
Notification::make()
->title("Invalid Item Code.")
->body("$body")
->danger()
->seconds(1)
->send();
return;
}
else if (!empty($InvalidLenSno))
{
$count = count($InvalidLenSno);
if ($count <= 10) {
$body = 'Serial number should be minimum 9 digits: ' . implode(', ', $InvalidLenSno);
} else {
$body = "{$count} serial number should be minimum 9 digits.";
}
Notification::make()
->title("Invalid Serial Number.")
->body("$body")
->danger()
->seconds(1)
->send();
return;
}
else if (!empty($InvalidSno))
{
$count = count($InvalidSno);
if ($count <= 10) {
$body = 'Serial number should be conatin alpha numeric values: ' . implode(', ', $InvalidSno);
} else {
$body = "{$count} serial number should be conatin alpha numeric values.";
}
Notification::make()
->title("Invalid Serial Number.")
->body("$body")
->danger()
->seconds(1)
->send();
return;
}
else if (!empty($missingItemCodes))
{
$count = count($missingItemCodes);
if ($count <= 10) {
$body = 'Item codes not found in sticker master: ' . implode(', ', $missingItemCodes);
} else {
$body = "{$count} item codes not found in sticker master table.";
}
Notification::make()
->title("Unknown Item Code.")
->body("$body")
->danger()
->seconds(1)
->send();
return;
}
if (!empty($insertData)) {
SerialValidation::insert($insertData);
}
else{
Notification::make()
->title("Insert Failed.")
->body("Data insertion failed")
->danger()
->seconds(1)
->send();
return;
}
//..
@@ -2311,8 +2498,9 @@ class CreateSerialValidation extends CreateRecord
}
}
public function processSerialNumber($serNo)
public function processSer($serNo)
{
$serNo = trim($serNo);
$user = Filament::auth()->user();
$operatorName = $user->name;
@@ -2795,24 +2983,28 @@ class CreateSerialValidation extends CreateRecord
return;
}
$this->dispatch('openCapacitorModal', itemCode: $itemCode, serialNumber: $serialNumber, plantId: $plantId);
// $this->dispatch('openCapacitorModal', itemCode: $itemCode, serialNumber: $serialNumber, plantId: $plantId);
//$this->dispatch('focusCapacitor', invoiceNumber: $invoiceNumber, plantId: $plantId);
$scannedQuantity = SerialValidation::where('invoice_number', $invoiceNumber)->where('scanned_status', 'Scanned')->where('plant_id', $plantId)->count();
$this->dispatch('focusCapacitor', itemCode: $itemCode);
$totQuan = SerialValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->count();
$scanSQuan = SerialValidation::where('invoice_number', $invoiceNumber)->where('scanned_status', 'Scanned')->where('plant_id', $plantId)->count();
$totMQuan = SerialValidation::where('invoice_number', $invoiceNumber)->whereNotNull('quantity')->where('plant_id', $plantId)->count(); //->where('quantity', '!=', '')
$scanMQuan = SerialValidation::where('invoice_number', $invoiceNumber)->whereNotNull('serial_number')->where('serial_number', '!=', '')->where('plant_id', $plantId)->count();
$this->form->fill([
'plant_id' => $plantId,
'invoice_number' => $invoiceNumber,
'serial_number' => null,
'total_quantity' => $totQuan,
'update_invoice' => false,
'scanned_quantity'=> $scannedQuantity,
]);
$this->dispatch( 'refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId);
//$scannedQuantity = SerialValidation::where('invoice_number', $invoiceNumber)->where('scanned_status', 'Scanned')->where('plant_id', $plantId)->count();
// $totQuan = SerialValidation::where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->count();
// $scanSQuan = SerialValidation::where('invoice_number', $invoiceNumber)->where('scanned_status', 'Scanned')->where('plant_id', $plantId)->count();
// $totMQuan = SerialValidation::where('invoice_number', $invoiceNumber)->whereNotNull('quantity')->where('plant_id', $plantId)->count(); //->where('quantity', '!=', '')
// $scanMQuan = SerialValidation::where('invoice_number', $invoiceNumber)->whereNotNull('serial_number')->where('serial_number', '!=', '')->where('plant_id', $plantId)->count();
// $this->form->fill([
// 'plant_id' => $plantId,
// 'invoice_number' => $invoiceNumber,
// 'serial_number' => $serNo,
// 'total_quantity' => $totQuan,
// 'update_invoice' => false,
// 'scanned_quantity'=> $scanSQuan,
// ]);
// $this->dispatch( 'refreshInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId);
return;
}
else if ($isMarkPs)
@@ -2958,6 +3150,173 @@ class CreateSerialValidation extends CreateRecord
}
}
#[On('process-scan')]
public function processSerial($serial)
{
$this->processSer($serial);
}
public function processCapacitor($serial, $itemCode)
{
$user = Filament::auth()->user();
$operatorName = $user->name;
$this->currentItemCode = $itemCode;
if (!$serial) {
return;
}
if (!preg_match('/^[^\/]+\/[^\/]+\/.+$/', $serial)) {
Notification::make()
->title('Invalid Panel Box QR Format:')
->body('Scan the valid panel box QR code to proceed!')
->danger()
// ->duration(3000)
->seconds(2)
->send();
return;
}
$parts = explode('/', $serial);
$supplier = $parts[0];
$itemCode = $parts[1];
$serialNumber = implode('/', array_slice($parts, 2)); // Keep rest of the string
$existsInStickerMaster = StickerMaster::where('panel_box_code', $itemCode)->where('plant_id', $this->plantId)->whereHas('item', function ($query) {
$query->where('code', $this->currentItemCode);
})
->exists();
if (!$existsInStickerMaster) {
Notification::make()
->title('Unknown: Panel Box Code')
->body("Unknown panel box code: $itemCode found for item code: $this->currentItemCode")
->danger()
// ->duration(4000)
->seconds(2)
->send();
return;
}
foreach ($this->invoiceData as &$row) {
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;
$row['capacitor_scanned_status'] = 1;
// $row['scanned_status_set'] = true;
$matchingValidation = SerialValidation::with('stickerMaster.item')
->where('serial_number', $this->currentSerialNumber)
->where('plant_id', $this->plantId)
->get()
->first(function ($validation) {
return $validation->stickerMaster?->item?->code === $this->currentItemCode;
});
if ($matchingValidation) {
$hasMotorQr = $matchingValidation->stickerMasterRelation->tube_sticker_motor ?? null;
$hasPumpQr = $matchingValidation->stickerMasterRelation->tube_sticker_pump ?? null;
$hasPumpSetQr = $matchingValidation->stickerMasterRelation->tube_sticker_pumpset ?? null;
// $hasCapacitorQr = $matchingValidation->stickerMasterRelation->panel_box_code ?? null;
$hadMotorQr = $matchingValidation->motor_scanned_status ?? null;
$hadPumpQr = $matchingValidation->pump_scanned_status ?? null;
$hadPumpSetQr = $matchingValidation->scanned_status_set ?? null;
// $hadCapacitorQr = $matchingValidation->capacitor_scanned_status ?? null;
$packCnt = 1;
$scanCnt = 1;
// if($hadMotorQr === $hasMotorQr && $hadPumpQr === $hasPumpQr && $hadPumpSetQr === $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;
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,
]);
}
else
{
$matchingValidation->update([
'panel_box_supplier' => $supplier,
'panel_box_item_code' => $itemCode,
'panel_box_serial_number' => $serialNumber,
'capacitor_scanned_status' => 1,
'operator_id'=> $operatorName,
]);
}
}
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,
]);
}
// Notification::make()
// ->title('Success: Capacitor QR')
// // ->title("Panel box code scanned: $itemCode")
// ->body("'Capacitor' QR scanned status updated, Scan next QR.")
// ->success() // commented
// ->seconds(2)
// ->send();
$totalQuantity = SerialValidation::where('invoice_number', $matchingValidation->invoice_number)->where('plant_id', $this->plantId)->count();
$scannedQuantity = SerialValidation::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,
// ]);
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!")
->success()
->seconds(2)
->send();
$this->loadCompletedData($matchingValidation->invoice_number, $matchingValidation->plant_id, true);
}
else
{
$this->loadData($matchingValidation->invoice_number, $matchingValidation->plant_id);
}
}
break;
}
}
$this->showCapacitorInput = false;
$this->dispatch('focus-serial-number');
}
public function getHeading(): string
{
return 'Scan Serial Validation';

View File

@@ -808,4 +808,29 @@ class InvoiceValidationController extends Controller
{
//
}
// public function handle(Request $request)
// {
// $invoice = InvoiceValidation::withCount([
// 'serialNumbers as scanned_count' => function ($q) {
// $q->where('is_scanned', 1);
// }
// ])->find($request->invoice_id);
// if (!$invoice) {
// return response()->json(['error' => 'Invoice not found'], 404);
// }
// if ($invoice->scanned_count < $invoice->total_serials) {
// Mail::to('alerts@example.com')->send(
// new \App\Mail\IncompleteInvoiceMail(
// $invoice,
// $invoice->scanned_count,
// $invoice->total_serials
// )
// );
// }
// return response()->json(['status' => 'ok']);
// }
}

View File

@@ -35,27 +35,26 @@ class MachineController extends Controller
$expectedUser = env('API_AUTH_USER');
$expectedPw = env('API_AUTH_PW');
$header_auth = $request->header('Authorization');
$expectedToken = $expectedUser . ':' . $expectedPw;
$expectedToken = $expectedUser.':'.$expectedPw;
if ("Bearer " . $expectedToken != $header_auth)
{
if ('Bearer '.$expectedToken != $header_auth) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Invalid authorization token!'
'status_description' => 'Invalid authorization token!',
], 403);
}
$machines = Machine::with('plant')->with('workGroupMaster')->orderBy('plant_id')->get();
$machinesData = $machines->map(function($machine) {
$machinesData = $machines->map(function ($machine) {
return [
'plant_code' => $machine->plant ? (String)$machine->plant->code : "",
'group_work_center' => $machine->workGroupMaster ? (String)$machine->workGroupMaster->name : "",
'work_center' => $machine->work_center ?? "",
'plant_code' => $machine->plant ? (string) $machine->plant->code : '',
'group_work_center' => $machine->workGroupMaster ? (string) $machine->workGroupMaster->name : '',
'work_center' => $machine->work_center ?? '',
];
});
return response()->json([
'machines' => $machinesData
'machines' => $machinesData,
]);
}
@@ -67,78 +66,68 @@ class MachineController extends Controller
$expectedUser = env('API_AUTH_USER');
$expectedPw = env('API_AUTH_PW');
$header_auth = $request->header('Authorization');
$expectedToken = $expectedUser . ':' . $expectedPw;
$expectedToken = $expectedUser.':'.$expectedPw;
if ("Bearer " . $expectedToken != $header_auth)
{
if ('Bearer '.$expectedToken != $header_auth) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Invalid authorization token!'
'status_description' => 'Invalid authorization token!',
], 403);
}
$plantCode = $request->header('plant-code');
$lineName = $request->header('line-name');
if ($plantCode == null || $plantCode == '')
{
if ($plantCode == null || $plantCode == '') {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Plant code can't be empty!"
'status_description' => "Plant code can't be empty!",
], 400);
}
else if (Str::length($plantCode) < 4 || !is_numeric($plantCode) || !preg_match('/^[1-9]\d{3,}$/', $plantCode))
{
} elseif (Str::length($plantCode) < 4 || ! is_numeric($plantCode) || ! preg_match('/^[1-9]\d{3,}$/', $plantCode)) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Invalid plant code found!"
'status_description' => 'Invalid plant code found!',
], 400);
}
else if ($lineName == null || $lineName == '' || Str::length($lineName) <= 0)
{
} elseif ($lineName == null || $lineName == '' || Str::length($lineName) <= 0) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Line name can't be empty!"
'status_description' => "Line name can't be empty!",
], 400);
}
$plant = Plant::where('code', $plantCode)->first();
if (!$plant)
{
if (! $plant) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Plant Code '{$plantCode}' not found!"
'status_description' => "Plant Code '{$plantCode}' not found!",
], 400);
}
$plantId = $plant->id;
$line = Line::where('name', $lineName)->first();
if (!$line)
{
if (! $line) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Line Name '{$lineName}' not found!"
'status_description' => "Line Name '{$lineName}' not found!",
], 400);
}
$line = Line::where('name', $lineName)->where('plant_id', $plantId)->first();
if (!$line)
{
if (! $line) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Line Name '{$lineName}' not found for the plant!"
'status_description' => "Line Name '{$lineName}' not found for the plant!",
], 400);
}
$lineId = $line->id;//no_of_operation
$lineId = $line->id; // no_of_operation
$lineWorkGroup1Id = $line->work_group1_id;
$lineWorkGroup2Id = $line->work_group2_id;
if ($line->no_of_operation == null || $line->no_of_operation == '' || $line->no_of_operation == 0 || !is_numeric($line->no_of_operation))
{
if ($line->no_of_operation == null || $line->no_of_operation == '' || $line->no_of_operation == 0 || ! is_numeric($line->no_of_operation)) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => "Group work center not found for the plant & line!"
'status_description' => 'Group work center not found for the plant & line!',
], 400);
}
@@ -146,26 +135,22 @@ class MachineController extends Controller
$lineWorkGroupIds = [];
for ($i = 1; $i <= $line->no_of_operation; $i++) {
$curWorkGroupId = $line->{"work_group{$i}_id"};
if (in_array($curWorkGroupId, $lineWorkGroupIds))
{
if (in_array($curWorkGroupId, $lineWorkGroupIds)) {
continue;
}
else
{
} else {
$lineWorkGroupIds[] = $curWorkGroupId;
}
$test[] = [
'group_work_center' => WorkGroupMaster::where('id', $curWorkGroupId)->first()->name ?? "",
'operation_number' => WorkGroupMaster::where('id', $curWorkGroupId)->first()->operation_number ?? "",
'group_work_center' => WorkGroupMaster::where('id', $curWorkGroupId)->first()->name ?? '',
'operation_number' => WorkGroupMaster::where('id', $curWorkGroupId)->first()->operation_number ?? '',
'work_centers' => Machine::where('plant_id', $plantId)->where('work_group_master_id', $curWorkGroupId)->orderBy('work_center')->pluck('work_center')->toArray() ?? [],
];
}
if($lineWorkGroupIds)
{
if ($lineWorkGroupIds) {
return response()->json([
'machines' => $test
'machines' => $test,
]);
}
// $machines = Machine::with('plant')->with('workGroupMaster')->orderBy('plant_id')->get();

View File

@@ -2,6 +2,7 @@
namespace App\Http\Controllers;
use Filament\Notifications\Notification;
use Illuminate\Http\Request;
use Mpdf\Mpdf;
use Mpdf\QrCode\Output;
@@ -20,7 +21,7 @@ class PalletController extends Controller
public function downloadReprintQrPdf($palletNo)
{
$qrCode = new QrCode($palletNo);
$output = new Output\Png();
$output = new Output\Png;
$qrBinary = $output->output($qrCode, 100);
$qrBase64 = base64_encode($qrBinary);
@@ -39,10 +40,10 @@ class PalletController extends Controller
<table class="sticker-table">
<tr>
<td class="qr-cell">
<img class="qr" src="data:image/png;base64,' . $qrBase64 . '" alt="QR" />
<img class="qr" src="data:image/png;base64,'.$qrBase64.'" alt="QR" />
</td>
<td class="text-cell">
' . htmlspecialchars($palletNo) . '
'.htmlspecialchars($palletNo).'
</td>
</tr>
</table>
@@ -73,10 +74,166 @@ class PalletController extends Controller
// $mpdf->Output('qr-label.pdf', 'I');
}
public function downloadReprintProcess($plant, $item, $process_order, $coil_number, $name)
{
// dd($plant,$item,$process_order,$coil_number);
$processOrder = \App\Models\ProcessOrder::where('plant_id', $plant)
->where('item_id', $item)
->where('process_order', $process_order)
->where('coil_number', $coil_number)
->first();
if (! $processOrder) {
return response()->json(['error' => 'Process order not found'], 404);
}
$receivedQuantity = $processOrder->received_quantity;
$machineName = $processOrder->machine_name;
$user = $processOrder->created_by;
$icode = \App\Models\Item::find($item);
$pCode = \App\Models\Plant::find($plant);
$plCode = $pCode->code;
if (! $plCode) {
Notification::make()
->title('Unknown Plant')
->body('Plant not found.')
->warning()
->send();
}
if (! $icode) {
Notification::make()
->title('Unknown Item')
->body('Item not found.')
->warning()
->send();
}
$itCode = $icode->code;
$itemAgaPlant = \App\Models\Item::where('code', $itCode)
->where('plant_id', $plant)
->first();
if (! $itemAgaPlant) {
Notification::make()
->title('Unknown Item')
->body("Item not found against plant code $plCode.")
->warning()
->send();
} else {
$itemDescription = $itemAgaPlant->description;
}
$nowDT = now()->format('d-m-Y H:i:s');
// Build QR content
$qrContent = "{$receivedQuantity}|{$itCode}|{$process_order}-{$coil_number}";
$qrCode = new QrCode($qrContent);
$output = new Output\Png;
$qrBinary = $output->output($qrCode, 100);
$qrBase64 = base64_encode($qrBinary);
return '
<html>
<head>
<style>
@page {
size: 60mm 30mm;
margin: 0;
}
body {
margin: 0;
padding: 0;
width: 60mm;
font-size: 9pt;
font-family: "DejaVu Sans Condensed", "FreeSans", sans-serif;
}
.sticker-table {
width: 60mm;
border-collapse: collapse;
page-break-inside: avoid;
}
.text-cell {
text-align: left;
vertical-align: top;
font-size: 9pt;
padding-left: 2mm;
padding-top: 2mm; /* was 6mm ❌ */
font-weight: bold;
line-height: 1.1; /* IMPORTANT */
white-space: nowrap;
width: 40mm;
}
.qr-cell {
width: 20mm;
text-align: center;
vertical-align: middle;
}
.lbl {
display: inline-block;
width: 11mm;
font-weight: bold;
}
.text-cell b {
font-size: 10pt; /* was 12pt ❌ */
font-weight: bold;
}
img.qr {
width: 12mm;
height: 12mm;
display: block;
margin: auto;
}
</style>
</head>
<body>
<table class="sticker-table">
<tr>
<td class="text-cell">
<span class="lbl">D/T</span>: '.htmlspecialchars($nowDT).'<br>
<span class="lbl">OP ID</span>: '.htmlspecialchars($user).'<br>
<span class="lbl">PO NO</span>: '.htmlspecialchars($process_order).'<br>
<span class="lbl">M/C</span>: '.htmlspecialchars($itCode).'<br>
<span class="lbl">DES</span>: '.htmlspecialchars($itemDescription).'<br>
<span class="lbl">WGT</span>: <b>'.htmlspecialchars($receivedQuantity).' KGS</b><br>
<span class="lbl">MAC</span>: '.htmlspecialchars($machineName).'
</td>
<td class="qr-cell">
<img class="qr" src="data:image/png;base64,'.$qrBase64.'" alt="QR" />
</td>
</tr>
</table>
<script>
window.onload = function () {
window.print();
setTimeout(function () { window.close(); }, 500);
};
</script>
</body>
</html>
';
}
public function downloadQrPdf($palletNo)
{
$qrCode = new QrCode($palletNo);
$output = new Output\Png();
$output = new Output\Png;
$qrBinary = $output->output($qrCode, 100);
$qrBase64 = base64_encode($qrBinary);
@@ -84,10 +241,10 @@ class PalletController extends Controller
<table class="sticker-table">
<tr>
<td class="qr-cell">
<img class="qr" src="data:image/png;base64,' . $qrBase64 . '" alt="QR" />
<img class="qr" src="data:image/png;base64,'.$qrBase64.'" alt="QR" />
</td>
<td class="text-cell">
' . htmlspecialchars($palletNo) . '
'.htmlspecialchars($palletNo).'
</td>
</tr>
</table>';
@@ -104,7 +261,7 @@ class PalletController extends Controller
</style>
</head>
<body>
' . $htmlBlock . $htmlBlock . '
'.$htmlBlock.$htmlBlock.'
<script>
window.onload = function () {
window.print();

View File

@@ -2,6 +2,8 @@
namespace App\Http\Controllers;
use App\Models\DriverMaster;
use App\Models\VehicleMaster;
use Illuminate\Http\Request;
use Str;
use Illuminate\Support\Facades\Schema;
@@ -19,10 +21,21 @@ class SapFileController extends Controller
/**
* Store a newly created resource in storage.
*/
// public function store(Request $request)
// {
// //
// }
public function store(Request $request)
{
$request->validate([
'name' => 'required|string',
'identification1' => 'nullable|string',
'identification2' => 'nullable|string',
'identification3' => 'nullable|string',
'contact_number' => 'nullable|string',
'alternate_number' => 'nullable|string',
]);
DriverMaster::create($request->all());
return response()->json(['success' => true]);
}
public function getSapData(Request $request)
{
@@ -145,40 +158,6 @@ class SapFileController extends Controller
], 500);
}
// $table = 'class_characteristics';
// $columns = Schema::getColumnListing($table); // returns lowercase column names
// $rows = [];
// foreach ($lines as $line) {
// $values = str_getcsv($line); // split by comma
// $row = [];
// foreach ($columns as $index => $column) {
// $value = $values[$index] ?? null; // if missing, set null
// if ($value === '') $value = null; // empty string -> null
// $row[$column] = $value;
// }
// $rows[] = $row;
// }
// return response()->json([
// 'status' => 'DEBUG_ROWS',
// 'rows_sample' => array_slice($rows, 0, 5),
// ]);
// Insert into database
// foreach ($rows as $row) {
// \App\Models\ClassCharacteristic::create($row);
// }
// return response()->json([
// 'status' => 'SUCCESS',
// 'rows_imported' => count($rows),
// ]);
// Prepare arrays
// $serialNumbers = [];
// $remainingRows = [];
@@ -251,7 +230,7 @@ class SapFileController extends Controller
if (!empty($invalidSerials)) {
return response()->json([
'status' => 'ERROR',
'status_description' => 'Some serial numbers are invalid (less than 13 characters)',
'status_description' => 'serial numbers are invalid (less than 13 characters)',
'invalid_serials' => $invalidSerials
], 400);
}

View File

@@ -4,7 +4,7 @@ namespace App\Http\Controllers;
use App\Models\Plant;
use App\Models\User;
//use Carbon\Carbon;
// use Carbon\Carbon;
use Hash;
use Illuminate\Http\Request;
@@ -29,7 +29,7 @@ class UserController extends Controller
/**
* Display the specified resource.
*/
//show(string $id)
// show(string $id)
public function get_testing_data(Request $request)
{
$expectedUser = env('API_AUTH_USER');
@@ -37,64 +37,57 @@ class UserController extends Controller
$header_auth = $request->header('Authorization');
$header_user = $request->header('User-Name');
$header_pass = $request->header('User-Pass');
$expectedToken = $expectedUser . ':' . $expectedPw;
$expectedToken = $expectedUser.':'.$expectedPw;
if ("Bearer " . $expectedToken != $header_auth)
{
if ('Bearer '.$expectedToken != $header_auth) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Invalid authorization token!'
'status_description' => 'Invalid authorization token!',
], 403);
}
if (!$header_user)
{
if (! $header_user) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Invalid user name found!'
'status_description' => 'Invalid user name found!',
], 400);
}
else if (!$header_pass)
{
} elseif (! $header_pass) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Invalid password found!'
'status_description' => 'Invalid password found!',
], 400);
}
$existUser = User::where('name', $header_user)->first();
$existPlant = "All Plants";
$existPlant = 'All Plants';
if (!$existUser)
{
if (! $existUser) {
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Unknown user name found!'
'status_description' => 'Unknown user name found!',
], 400);
}
else {
} else {
$codeExist = Plant::where('id', $existUser->plant_id)->first();
if ($codeExist) {
$existPlant = $codeExist->code;
}
}
// Retrieve the user by email
//$user = User::where('email', $email)->first();
// $user = User::where('email', $email)->first();
if (Hash::check($header_pass, $existUser->password)) {
return response()->json([
'created_at' => $existUser->created_at->format('Y-m-d H:i:s') ?? "",
'updated_at' => $existUser->updated_at->format('Y-m-d H:i:s') ?? "",
'requested_at' => now()->format('Y-m-d H:i:s') ?? "", //Carbon::now(config('app.timezone'))->format('Y-m-d H:i:s') ?? "",
'plant' => (String)$existPlant ?? "",
'email' => $existUser->email ?? "",
'roles' => $existUser->roles()->pluck('name')->toArray()
'created_at' => $existUser->created_at->format('Y-m-d H:i:s') ?? '',
'updated_at' => $existUser->updated_at->format('Y-m-d H:i:s') ?? '',
'requested_at' => now()->format('Y-m-d H:i:s') ?? '', // Carbon::now(config('app.timezone'))->format('Y-m-d H:i:s') ?? "",
'plant' => (string) $existPlant ?? '',
'email' => $existUser->email ?? '',
'roles' => $existUser->roles()->pluck('name')->toArray(),
], 200);
} else {
return response()->json([
'status_code' => 'ERROR',
'status_description' => 'Password does not match!'
'status_description' => 'Password does not match!',
], 400);
}

View File

@@ -114,6 +114,7 @@ class InvoicePendingReasonImport implements ToCollection
continue;
}
// dd($row['document_number'], bin2hex($row['document_number']));
$this->validRows[] = [
'plant_id' => $plantId,

View File

@@ -0,0 +1,51 @@
<?php
namespace App\Jobs;
use App\Mail\CharacteristicApprovalMail;
use App\Models\CharacteristicApproverMaster;
use App\Models\RequestCharacteristic;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Queue\Queueable;
use Illuminate\Support\Facades\Mail;
class SendApprover1MailJob implements ShouldQueue
{
use Queueable;
/**
* Create a new job instance.
*/
public function __construct(public RequestCharacteristic $request) {
}
/**
* Execute the job.
*/
public function handle()
{
// Already approved? stop
if (!is_null($this->request->approver_status1)) return;
if ($this->request->approver1_mail_sent) return;
$approver = CharacteristicApproverMaster::where('plant_id', $this->request->plant_id)
->where('machine_id', $this->request->machine_id)
->first();
if (! $approver || ! $approver->mail1) return;
Mail::to($approver->mail1)
->queue(new CharacteristicApprovalMail(
$this->request,
$approver->name1,
1
));
$this->request->update(['approver1_mail_sent' => 1]);
SendApprover2MailJob::dispatch($this->request)
->delay(now()->addMinutes(5));
}
}

View File

@@ -0,0 +1,58 @@
<?php
namespace App\Jobs;
use App\Mail\CharacteristicApprovalMail;
use App\Models\CharacteristicApproverMaster;
use App\Models\RequestCharacteristic;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Queue\Queueable;
use Illuminate\Support\Facades\Mail;
class SendApprover2MailJob implements ShouldQueue
{
use Queueable;
/**
* Create a new job instance.
*/
// public function __construct()
// {
// //
// }
/**
* Execute the job.
*/
public function __construct(public RequestCharacteristic $request) {}
public function handle()
{
// If approver-1 approved → STOP
if (!is_null($this->request->approver_status1)) return;
// If approver-2 already approved → STOP
if (!is_null($this->request->approver_status2)) return;
if ($this->request->approver2_mail_sent) return;
$approver = CharacteristicApproverMaster::where('plant_id', $this->request->plant_id)
->where('machine_id', $this->request->machine_id)
->first();
if (! $approver || ! $approver->mail2) return;
Mail::to($approver->mail2)
->queue(new CharacteristicApprovalMail(
$this->request,
$approver->name2,
2
));
$this->request->update(['approver2_mail_sent' => 1]);
// Schedule Approver-3 after 5 minutes
SendApprover3MailJob::dispatch($this->request)
->delay(now()->addMinutes(5));
}
}

View File

@@ -0,0 +1,56 @@
<?php
namespace App\Jobs;
use App\Mail\CharacteristicApprovalMail;
use App\Models\CharacteristicApproverMaster;
use App\Models\RequestCharacteristic;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Queue\Queueable;
use Illuminate\Support\Facades\Mail;
class SendApprover3MailJob implements ShouldQueue
{
use Queueable;
/**
* Create a new job instance.
*/
// public function __construct()
// {
// //
// }
/**
* Execute the job.
*/
public function __construct(public RequestCharacteristic $request) {}
public function handle()
{
if (
!is_null($this->request->approver_status1) ||
!is_null($this->request->approver_status2) ||
!is_null($this->request->approver_status3)
) {
return;
}
if ($this->request->approver3_mail_sent) return;
$approver = CharacteristicApproverMaster::where('plant_id', $this->request->plant_id)
->where('machine_id', $this->request->machine_id)
->first();
if (! $approver || ! $approver->mail3) return;
Mail::to($approver->mail3)
->queue(new CharacteristicApprovalMail(
$this->request,
$approver->name3,
3
));
$this->request->update(['approver3_mail_sent' => 1]);
}
}

View File

@@ -13,23 +13,41 @@ class GuardPatrolEntryDataTable extends Component
// public $date;
public $newNameFound;
public $guardName;
public $checkPointName;
public $startTime;
public $endTime;
public $start;
public $finish;
public $begin;
public $end;
public $labTime;
public $minDiff;
public $seqNoCnt = 0;
public $seqNo = 0;
public $isSequenced = true;
public $sequences = [];
public $seqTime;
public $seqTimes = [];
public $startSeqCheckPoints = [];
public $records = [];
protected $listeners = [
@@ -61,9 +79,9 @@ class GuardPatrolEntryDataTable extends Component
$this->seqTimes = [];
$this->startSeqCheckPoints = [];
if (!$plantId || !$date)
{
if (! $plantId || ! $date) {
$this->records = [];
return;
}
@@ -73,20 +91,19 @@ class GuardPatrolEntryDataTable extends Component
$this->startSeqCheckPoints[$i] = CheckPointTime::with('checkPointNames1')->with('checkPointNames2')->where('sequence_number', $i)->where('plant_id', $plantId)->first();
}
$this->sequences = array_fill(1, $this->seqNoCnt, "X");
$this->sequences = array_fill(1, $this->seqNoCnt, 'X');
$this->seqTimes = array_fill(1, $this->seqNoCnt, null);
$hasSingleGuard = GuardPatrolEntry::whereDate('patrol_time', $date)->where('plant_id', $plantId)->orderBy('patrol_time', 'asc')->get();
$checking = 0;
$records = GuardPatrolEntry::with('guardNames')->with('checkPointNames')->whereDate('patrol_time', $date)->where('plant_id', $plantId)->orderBy('patrol_time', 'asc')->get(); //desc Carbon::parse($record->patrol_time)->toTimeString()
foreach ($records as $index => $record) { //foreach ($startSeqCheckPoints as $seq => $checkpoint)
$records = GuardPatrolEntry::with('guardNames')->with('checkPointNames')->whereDate('patrol_time', $date)->where('plant_id', $plantId)->orderBy('patrol_time', 'asc')->get(); // desc Carbon::parse($record->patrol_time)->toTimeString()
foreach ($records as $index => $record) { // foreach ($startSeqCheckPoints as $seq => $checkpoint)
$checking++;
$guardName = $record->guardNames ? $record->guardNames->name : null;
$checkPointName = $record->checkPointNames ? $record->checkPointNames->name : null;
if ($this->guardName != $guardName || $this->newNameFound) {//if ($this->newNameFound) {
if ($this->guardName)
{
if ($this->guardName != $guardName || $this->newNameFound) {// if ($this->newNameFound) {
if ($this->guardName) {
$recordData = [
'guard_name' => $this->guardName,
'start_time' => $this->startTime,
@@ -105,27 +122,25 @@ class GuardPatrolEntryDataTable extends Component
$this->seqTimes = array_fill(1, $this->seqNoCnt, null);
$this->guardName = $guardName;
$this->startTime = Carbon::parse($record->patrol_time)->toTimeString(); //"2025-06-01 00:07:12"
$this->startTime = Carbon::parse($record->patrol_time)->toTimeString(); // "2025-06-01 00:07:12"
$this->start = Carbon::parse($record->patrol_time);
$this->endTime = Carbon::parse($record->patrol_time)->toTimeString(); //"2025-06-01 00:07:12"
$this->endTime = Carbon::parse($record->patrol_time)->toTimeString(); // "2025-06-01 00:07:12"
$this->finish = Carbon::parse($record->patrol_time);
$this->begin = Carbon::parse($record->patrol_time);
$this->end = Carbon::parse($record->patrol_time);
$this->labTime = (int)$this->start->diffInMinutes($this->finish);
$this->minDiff = (int)$this->begin->diffInMinutes($this->end);
$this->seqTime = $this->begin->toTimeString(). " - " . $this->end->toTimeString();
$this->labTime = (int) $this->start->diffInMinutes($this->finish);
$this->minDiff = (int) $this->begin->diffInMinutes($this->end);
$this->seqTime = $this->begin->toTimeString().' - '.$this->end->toTimeString();
$this->seqNo = 0;
$this->newNameFound = false;
$this->isSequenced = true;
}
else if ($this->guardName == $guardName && $this->start && $this->begin)
{
$this->endTime = Carbon::parse($record->patrol_time)->toTimeString(); //"2025-06-01 00:07:12"
} elseif ($this->guardName == $guardName && $this->start && $this->begin) {
$this->endTime = Carbon::parse($record->patrol_time)->toTimeString(); // "2025-06-01 00:07:12"
$this->finish = Carbon::parse($record->patrol_time);
$this->end = Carbon::parse($record->patrol_time);
$this->labTime = (int)$this->start->diffInMinutes($this->finish);
$this->minDiff = (int)$this->begin->diffInMinutes($this->end);
$this->seqTime = $this->begin->toTimeString(). " - " . $this->end->toTimeString();
$this->labTime = (int) $this->start->diffInMinutes($this->finish);
$this->minDiff = (int) $this->begin->diffInMinutes($this->end);
$this->seqTime = $this->begin->toTimeString().' - '.$this->end->toTimeString();
$this->begin = Carbon::parse($record->patrol_time);
// $this->seqNo = 0;
}
@@ -133,19 +148,16 @@ class GuardPatrolEntryDataTable extends Component
$this->seqNo++;
if ($this->seqNo == 1) {
if ($checkPointName == $this->startSeqCheckPoints[$this->seqNo]->checkPointNames1->name) {//"STP BACKSIDE"
if ($checkPointName == $this->startSeqCheckPoints[$this->seqNo]->checkPointNames1->name) {// "STP BACKSIDE"
$this->isSequenced = true;
$this->sequences = array_fill(1, $this->seqNoCnt, "X");
}
else {
$this->sequences = array_fill(1, $this->seqNoCnt, 'X');
} else {
$this->isSequenced = false;
$this->sequences = array_fill(1, $this->seqNoCnt, "X");
$this->sequences = array_fill(1, $this->seqNoCnt, 'X');
}
if (($index+1) == count($hasSingleGuard))
{
if ($this->guardName)
{
if (($index + 1) == count($hasSingleGuard)) {
if ($this->guardName) {
$recordData = [
'guard_name' => $this->guardName,
'start_time' => $this->startTime,
@@ -161,26 +173,37 @@ class GuardPatrolEntryDataTable extends Component
$this->records[] = $recordData;
}
}
}
else if ($this->seqNo >= ($this->seqNoCnt+1)) {
$this->seqTimes[$this->seqNo-1] = $this->seqTime;
if ($checkPointName == $this->startSeqCheckPoints[$this->seqNo-1]->checkPointNames2->name) {//"D 72 END"
} elseif ($this->seqNo >= ($this->seqNoCnt + 1)) {
$this->seqTimes[$this->seqNo - 1] = $this->seqTime;
if ($checkPointName == $this->startSeqCheckPoints[$this->seqNo - 1]->checkPointNames2->name) {// "D 72 END"
if ($this->isSequenced) {
$this->sequences[$this->seqNo-1] = $this->minDiff;
$this->sequences[$this->seqNo - 1] = $this->minDiff;
}
}
else {
} else {
$this->isSequenced = false;
}
$this->newNameFound = true;
if ($hasSingleGuard->unique('guard_name_id')->count() == 1)
{
if (($this->seqNoCnt+1) == count($hasSingleGuard))
{
//dd("Has 1 Guard and single patrol round (".($this->seqNoCnt+1).") is present");
if ($this->guardName)
{
if ($hasSingleGuard->unique('guard_name_id')->count() == 1) {
if (($this->seqNoCnt + 1) == count($hasSingleGuard)) {
// dd("Has 1 Guard and single patrol round (".($this->seqNoCnt+1).") is present");
if ($this->guardName) {
$recordData = [
'guard_name' => $this->guardName,
'start_time' => $this->startTime,
'end_time' => $this->endTime,
'lap_time' => $this->labTime,
];
for ($i = 1; $i <= $this->seqNoCnt; $i++) {
$recordData["Sequence_$i"] = $this->sequences[$i];
$recordData["Sequence_Time_$i"] = $this->seqTimes[$i];
}
$this->records[] = $recordData;
}
} elseif (($index + 1) == count($hasSingleGuard)) {
if ($this->guardName) {
$recordData = [
'guard_name' => $this->guardName,
'start_time' => $this->startTime,
@@ -196,10 +219,8 @@ class GuardPatrolEntryDataTable extends Component
$this->records[] = $recordData;
}
}
else if (($index+1) == count($hasSingleGuard))
{
if ($this->guardName)
{
} elseif (($index + 1) == count($hasSingleGuard)) {
if ($this->guardName) {
$recordData = [
'guard_name' => $this->guardName,
'start_time' => $this->startTime,
@@ -215,46 +236,36 @@ class GuardPatrolEntryDataTable extends Component
$this->records[] = $recordData;
}
}
}
else if (($index+1) == count($hasSingleGuard))
{
if ($this->guardName)
{
$recordData = [
'guard_name' => $this->guardName,
'start_time' => $this->startTime,
'end_time' => $this->endTime,
'lap_time' => $this->labTime,
];
for ($i = 1; $i <= $this->seqNoCnt; $i++) {
$recordData["Sequence_$i"] = $this->sequences[$i];
$recordData["Sequence_Time_$i"] = $this->seqTimes[$i];
}
$this->records[] = $recordData;
}
}
}
else // if ($this->seqNo >= 2) {
{
$this->seqTimes[$this->seqNo-1] = $this->seqTime;
if ($checkPointName == $this->startSeqCheckPoints[$this->seqNo]->checkPointNames1->name) {//"CANTEEN"
} else { // if ($this->seqNo >= 2) {
$this->seqTimes[$this->seqNo - 1] = $this->seqTime;
if ($checkPointName == $this->startSeqCheckPoints[$this->seqNo]->checkPointNames1->name) {// "CANTEEN"
if ($this->isSequenced) {
$this->sequences[$this->seqNo-1] = $this->minDiff;
$this->sequences[$this->seqNo - 1] = $this->minDiff;
}
}
else {
} else {
$this->isSequenced = false;
}
if ($hasSingleGuard->unique('guard_name_id')->count() == 1)
{
if ($this->seqNo == count($hasSingleGuard))
{
//dd("Has 1 Guard and single patrol round (".($this->seqNoCnt+1).") is present");
if ($this->guardName)
{
if ($hasSingleGuard->unique('guard_name_id')->count() == 1) {
if ($this->seqNo == count($hasSingleGuard)) {
// dd("Has 1 Guard and single patrol round (".($this->seqNoCnt+1).") is present");
if ($this->guardName) {
$recordData = [
'guard_name' => $this->guardName,
'start_time' => $this->startTime,
'end_time' => $this->endTime,
'lap_time' => $this->labTime,
];
for ($i = 1; $i <= $this->seqNoCnt; $i++) {
$recordData["Sequence_$i"] = $this->sequences[$i];
$recordData["Sequence_Time_$i"] = $this->seqTimes[$i];
}
$this->records[] = $recordData;
}
} elseif (($index + 1) == count($hasSingleGuard)) {
if ($this->guardName) {
$recordData = [
'guard_name' => $this->guardName,
'start_time' => $this->startTime,
@@ -270,30 +281,8 @@ class GuardPatrolEntryDataTable extends Component
$this->records[] = $recordData;
}
}
else if (($index+1) == count($hasSingleGuard))
{
if ($this->guardName)
{
$recordData = [
'guard_name' => $this->guardName,
'start_time' => $this->startTime,
'end_time' => $this->endTime,
'lap_time' => $this->labTime,
];
for ($i = 1; $i <= $this->seqNoCnt; $i++) {
$recordData["Sequence_$i"] = $this->sequences[$i];
$recordData["Sequence_Time_$i"] = $this->seqTimes[$i];
}
$this->records[] = $recordData;
}
}
}
else if (($index+1) == count($hasSingleGuard))
{
if ($this->guardName)
{
} elseif (($index + 1) == count($hasSingleGuard)) {
if ($this->guardName) {
$recordData = [
'guard_name' => $this->guardName,
'start_time' => $this->startTime,

View File

@@ -37,7 +37,8 @@ class SerialValidationData extends Component
'refreshEmptyInvoice' => 'loadEmptyData',
'refreshInvoiceData' => 'loadData',
'refreshMaterialInvoiceData' => 'loadMaterialData',
'openCapacitorModal' => 'showCapacitorInputBox',
'focusCapacitor' => 'focusCapacitorInput'
//'openCapacitorModal' => 'showCapacitorInputBox',
];
public $capacitorInput = '';
@@ -48,6 +49,8 @@ class SerialValidationData extends Component
public $panel_box_serial_number;
public $itemcode;
public string $currentItemCode = '';
public string $currentSerialNumber = '';
@@ -64,6 +67,11 @@ class SerialValidationData extends Component
// // $this->showCapacitorInput = false;
// }
public function focusCapacitorInput($itemCode)
{
$this->dispatch('focus-capacitor-input', itemCode: $itemCode);
}
public function loadCompletedData($invoiceNumber, $plantId, $isSerial)
{

View File

@@ -9,26 +9,27 @@ use Illuminate\Database\Eloquent\SoftDeletes;
class InvoiceDataValidation extends Model
{
use SoftDeletes;
protected $dates = ['deleted_at'];
protected $fillable = [
"plant_id",
"distribution_channel_desc",
"customer_code",
"document_number",
"document_date",
"customer_trade_name",
"customer_location",
"location",
"created_at",
"created_by",
"updated_by",
"updated_at"
'plant_id',
'distribution_channel_desc',
'customer_code',
'document_number',
'document_date',
'customer_trade_name',
'customer_location',
'location',
'remark',
'created_at',
'created_by',
'updated_by',
'updated_at',
];
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
}