diff --git a/app/Console/Commands/Scheduler.php b/app/Console/Commands/Scheduler.php
index e2de398..c7af09e 100644
--- a/app/Console/Commands/Scheduler.php
+++ b/app/Console/Commands/Scheduler.php
@@ -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) {
diff --git a/app/Filament/Resources/LineResource.php b/app/Filament/Resources/LineResource.php
index f94fd0c..6705de1 100644
--- a/app/Filament/Resources/LineResource.php
+++ b/app/Filament/Resources/LineResource.php
@@ -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',
diff --git a/app/Filament/Resources/SerialValidationResource/Pages/CreateSerialValidation.php b/app/Filament/Resources/SerialValidationResource/Pages/CreateSerialValidation.php
index 312b0af..8a2f3eb 100644
--- a/app/Filament/Resources/SerialValidationResource/Pages/CreateSerialValidation.php
+++ b/app/Filament/Resources/SerialValidationResource/Pages/CreateSerialValidation.php
@@ -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.
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';
diff --git a/app/Http/Controllers/InvoiceValidationController.php b/app/Http/Controllers/InvoiceValidationController.php
index 5f84992..30ab9bd 100644
--- a/app/Http/Controllers/InvoiceValidationController.php
+++ b/app/Http/Controllers/InvoiceValidationController.php
@@ -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']);
+ // }
}
diff --git a/app/Http/Controllers/MachineController.php b/app/Http/Controllers/MachineController.php
index a7a2b63..69d0fa9 100644
--- a/app/Http/Controllers/MachineController.php
+++ b/app/Http/Controllers/MachineController.php
@@ -33,29 +33,28 @@ class MachineController extends Controller
public function get_all_data(Request $request)
{
$expectedUser = env('API_AUTH_USER');
- $expectedPw = env('API_AUTH_PW');
- $header_auth = $request->header('Authorization');
- $expectedToken = $expectedUser . ':' . $expectedPw;
+ $expectedPw = env('API_AUTH_PW');
+ $header_auth = $request->header('Authorization');
+ $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,
]);
}
@@ -65,80 +64,70 @@ class MachineController extends Controller
public function get_data(Request $request)
{
$expectedUser = env('API_AUTH_USER');
- $expectedPw = env('API_AUTH_PW');
- $header_auth = $request->header('Authorization');
- $expectedToken = $expectedUser . ':' . $expectedPw;
+ $expectedPw = env('API_AUTH_PW');
+ $header_auth = $request->header('Authorization');
+ $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 ?? "",
- 'work_centers' => Machine::where('plant_id', $plantId)->where('work_group_master_id', $curWorkGroupId)->orderBy('work_center')->pluck('work_center')->toArray() ?? [],
+ '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();
diff --git a/app/Http/Controllers/PalletController.php b/app/Http/Controllers/PalletController.php
index 3126fb8..ceaffc1 100644
--- a/app/Http/Controllers/PalletController.php
+++ b/app/Http/Controllers/PalletController.php
@@ -2,6 +2,7 @@
namespace App\Http\Controllers;
+use Filament\Notifications\Notification;
use Illuminate\Http\Request;
use Mpdf\Mpdf;
use Mpdf\QrCode\Output;
@@ -20,11 +21,11 @@ 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);
- return '
+ return '
|
+ D/T: '.htmlspecialchars($nowDT).' + OP ID: '.htmlspecialchars($user).' + PO NO: '.htmlspecialchars($process_order).' + M/C: '.htmlspecialchars($itCode).' + DES: '.htmlspecialchars($itemDescription).' + WGT: '.htmlspecialchars($receivedQuantity).' KGS + MAC: '.htmlspecialchars($machineName).' + |
+
+ |
+
|
- |
- ' . htmlspecialchars($palletNo) . ' + '.htmlspecialchars($palletNo).' |