Compare commits
6 Commits
renovate/t
...
8c062505c9
| Author | SHA1 | Date | |
|---|---|---|---|
| 8c062505c9 | |||
|
|
87fd2df0f4 | ||
| 9411d0b33b | |||
|
|
7d5e02f491 | ||
| ab3a2047bb | |||
|
|
810c40b81b |
@@ -3,9 +3,16 @@
|
||||
namespace App\Filament\Imports;
|
||||
|
||||
use App\Models\CharacteristicValue;
|
||||
use App\Models\Item;
|
||||
use App\Models\Line;
|
||||
use App\Models\Machine;
|
||||
use App\Models\Plant;
|
||||
use App\Models\ProcessOrder;
|
||||
use Filament\Actions\Imports\Exceptions\RowImportFailedException;
|
||||
use Filament\Actions\Imports\ImportColumn;
|
||||
use Filament\Actions\Imports\Importer;
|
||||
use Filament\Actions\Imports\Models\Import;
|
||||
use Str;
|
||||
|
||||
class CharacteristicValueImporter extends Importer
|
||||
{
|
||||
@@ -16,25 +23,52 @@ class CharacteristicValueImporter extends Importer
|
||||
return [
|
||||
ImportColumn::make('plant')
|
||||
->requiredMapping()
|
||||
->relationship()
|
||||
->exampleHeader('Plant Code')
|
||||
->example('1000')
|
||||
->label('Plant Code')
|
||||
->relationship(resolveUsing: 'code')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('line')
|
||||
->requiredMapping()
|
||||
->relationship()
|
||||
->exampleHeader('Line Name')
|
||||
->example('4 inch pump line')
|
||||
->label('Line Name')
|
||||
->relationship(resolveUsing: 'name')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('item')
|
||||
->requiredMapping()
|
||||
->relationship()
|
||||
->exampleHeader('Item Code')
|
||||
->example('123456')
|
||||
->label('Item Code')
|
||||
->relationship(resolveUsing: 'code')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('machine')
|
||||
->requiredMapping()
|
||||
->relationship()
|
||||
->exampleHeader('Work Center')
|
||||
->example('RMGS09745')
|
||||
->label('Work Center')
|
||||
->relationship(resolveUsing: 'work_center')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('process_order'),
|
||||
ImportColumn::make('coil_number'),
|
||||
ImportColumn::make('status'),
|
||||
ImportColumn::make('created_by'),
|
||||
ImportColumn::make('updated_by'),
|
||||
ImportColumn::make('process_order')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Process Order')
|
||||
->example('23455256352')
|
||||
->label('Process Order'),
|
||||
ImportColumn::make('coil_number')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Coil Number')
|
||||
->example('0')
|
||||
->label('Coil Number'),
|
||||
ImportColumn::make('status')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Status')
|
||||
->example('Ok')
|
||||
->label('Status'),
|
||||
ImportColumn::make('created_by')
|
||||
->requiredMapping()
|
||||
->exampleHeader('Created By')
|
||||
->example('RAW01234')
|
||||
->label('Created By'),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -45,15 +79,180 @@ class CharacteristicValueImporter extends Importer
|
||||
// 'email' => $this->data['email'],
|
||||
// ]);
|
||||
|
||||
return new CharacteristicValue();
|
||||
$warnMsg = [];
|
||||
$plantId = null;
|
||||
$itemId = null;
|
||||
$LineId = null;
|
||||
$machineId = null;
|
||||
$itemAgainstPlant = null;
|
||||
|
||||
$plantCode = $this->data['plant'];
|
||||
$processOrder = trim($this->data['process_order'] ?? '');
|
||||
$iCode = trim($this->data['item']);
|
||||
$workCenter = trim($this->data['machine']);
|
||||
$lineName = trim($this->data['line']);
|
||||
$status = trim($this->data['status']);
|
||||
$createdBy = trim($this->data['created_by']);
|
||||
$coilNo = trim($this->data['coil_number']);
|
||||
|
||||
if ($plantCode == null || $plantCode == '') {
|
||||
$warnMsg[] = 'Plant code cannot be empty';
|
||||
} elseif ($iCode == null || $iCode == '') {
|
||||
$warnMsg[] = 'Process Order cannot be empty';
|
||||
} elseif ($workCenter == null || $workCenter == '') {
|
||||
$warnMsg[] = 'Work center cannot be empty';
|
||||
} elseif ($lineName == null || $lineName == '') {
|
||||
$warnMsg[] = 'Line cannot be empty';
|
||||
}
|
||||
|
||||
if (Str::length($plantCode) < 4 || ! is_numeric($plantCode) || ! preg_match('/^[1-9]\d{3,}$/', $plantCode)) {
|
||||
$warnMsg[] = 'Invalid plant code found';
|
||||
} else {
|
||||
$plant = Plant::where('code', $plantCode)->first();
|
||||
if (! $plant) {
|
||||
$warnMsg[] = 'Plant not found';
|
||||
} else {
|
||||
$plantId = $plant->id;
|
||||
}
|
||||
}
|
||||
|
||||
if (Str::length($iCode) < 6 || ! ctype_alnum($iCode)) {
|
||||
$warnMsg[] = 'Invalid item code found';
|
||||
} else {
|
||||
$itemCode = Item::where('code', $iCode)->first();
|
||||
if (! $itemCode) {
|
||||
$warnMsg[] = 'Item code not found';
|
||||
} else {
|
||||
if ($plantId) {
|
||||
$itemAgainstPlant = Item::where('code', $iCode)->where('plant_id', $plantId)->first();
|
||||
if (! $itemAgainstPlant) {
|
||||
$warnMsg[] = 'Item code not found for the given plant';
|
||||
} else {
|
||||
$itemId = $itemAgainstPlant->id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$lineExists = Line::where('name', $lineName)->first();
|
||||
if (! $lineExists) {
|
||||
$warnMsg[] = 'Line name not found';
|
||||
} else {
|
||||
if ($plantId) {
|
||||
$lineAgainstPlant = Line::where('name', $lineName)->where('plant_id', $plantId)->first();
|
||||
if (! $lineAgainstPlant) {
|
||||
$warnMsg[] = 'Line name not found for the given plant';
|
||||
} else {
|
||||
$LineId = $lineAgainstPlant->id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$workCenterExist = Machine::where('work_center', $workCenter)->first();
|
||||
if (! $workCenterExist) {
|
||||
$warnMsg[] = 'Work Center not found';
|
||||
}
|
||||
|
||||
// $workCenterAgainstPlant = Machine::where('work_center', $workCenter)
|
||||
// ->where('plant_id', $plantId)
|
||||
// ->first();
|
||||
|
||||
// if (!$workCenterAgainstPlant) {
|
||||
// $warnMsg[] = 'Work center not found for the given plant';
|
||||
// } else {
|
||||
// $MachineId = $workCenterAgainstPlant->id;
|
||||
// }
|
||||
|
||||
if ($plantId != null && $LineId != null) {
|
||||
$machineAgaPlantLine = Machine::where('plant_id', $plantId)
|
||||
->where('line_id', $LineId)
|
||||
->where('work_center', $workCenter)
|
||||
->first();
|
||||
|
||||
if (! $machineAgaPlantLine) {
|
||||
$warnMsg[] = 'Work center not found for the given plant and line';
|
||||
} else {
|
||||
$machineId = $machineAgaPlantLine->id;
|
||||
}
|
||||
}
|
||||
|
||||
if ($processOrder == null || $processOrder == '') {
|
||||
$warnMsg[] = 'Process Order cannot be empty';
|
||||
}
|
||||
|
||||
if ($coilNo == null || $coilNo == '') {
|
||||
$warnMsg[] = 'Coil No cannot be empty';
|
||||
} elseif (! is_numeric($coilNo)) {
|
||||
$warnMsg[] = 'Coil number should contain only numeric values!';
|
||||
}
|
||||
|
||||
if ($status == null || $status == '' || ! $status) {
|
||||
$warnMsg[] = 'Status cannot be empty';
|
||||
} elseif (! in_array($status, ['Ok', 'NotOk'], true)) {
|
||||
$warnMsg[] = "Status must be either 'Ok' or 'NotOk'!";
|
||||
}
|
||||
|
||||
if ($createdBy == null || $createdBy == '' || ! $createdBy) {
|
||||
$warnMsg[] = 'Created By cannot be empty';
|
||||
}
|
||||
|
||||
// $existing = CharacteristicValue::where('plant_id', $plantId)
|
||||
// ->where('process_order', $processOrder)
|
||||
// ->where('coil_number', $coilNo)
|
||||
// ->first();
|
||||
|
||||
// if ($existing) {
|
||||
// $warnMsg[] = "Process order '{$processOrder}' with coil number '{$coilNo}' already exist for the plant code '{$plantCode}'!";
|
||||
// }
|
||||
|
||||
if ($plantId && $processOrder) {
|
||||
$existing = CharacteristicValue::where('plant_id', $plantId)
|
||||
->where('process_order', $processOrder)
|
||||
->where('coil_number', $coilNo)
|
||||
->first();
|
||||
|
||||
if ($existing) {
|
||||
$warnMsg[] = "Coil number '{$coilNo}' already exists for Plant '{$plantCode}' and Process Order '{$processOrder}'.";
|
||||
}
|
||||
}
|
||||
|
||||
if ($plant && $itemCode && $processOrder != '') {
|
||||
|
||||
$existingOrder = ProcessOrder::where('plant_id', $plant->id)
|
||||
->where('process_order', $processOrder)
|
||||
->first();
|
||||
|
||||
if ($existingOrder && $existingOrder->item_id !== ($itemCode->id ?? null)) {
|
||||
$warnMsg[] = 'Same Process Order already exists for this Plant with a different Item Code';
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($warnMsg)) {
|
||||
throw new RowImportFailedException(implode(', ', $warnMsg));
|
||||
}
|
||||
|
||||
return CharacteristicValue::create([
|
||||
'plant_id' => $plantId,
|
||||
'item_id' => $itemId,
|
||||
'line_id' => $LineId,
|
||||
'machine_id' => $machineId,
|
||||
'process_order' => trim($this->data['process_order']),
|
||||
'coil_number' => trim($this->data['coil_number']),
|
||||
'status' => trim($this->data['status']),
|
||||
'created_by' => trim($this->data['created_by']),
|
||||
]);
|
||||
|
||||
// return null;
|
||||
|
||||
// return new CharacteristicValue;
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Import $import): string
|
||||
{
|
||||
$body = 'Your characteristic value import has completed and ' . number_format($import->successful_rows) . ' ' . str('row')->plural($import->successful_rows) . ' imported.';
|
||||
$body = 'Your characteristic value import has completed and '.number_format($import->successful_rows).' '.str('row')->plural($import->successful_rows).' imported.';
|
||||
|
||||
if ($failedRowsCount = $import->getFailedRowsCount()) {
|
||||
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to import.';
|
||||
$body .= ' '.number_format($failedRowsCount).' '.str('row')->plural($failedRowsCount).' failed to import.';
|
||||
}
|
||||
|
||||
return $body;
|
||||
|
||||
@@ -1155,12 +1155,27 @@ class StickerReprint extends Page implements HasForms
|
||||
// Only search when all parent IDs are selected
|
||||
$parts = explode('|', $formQRData);
|
||||
$itemCode = trim($parts[0]);
|
||||
|
||||
|
||||
$serialNumberRaw = isset($parts[1]) ? trim($parts[1]) : null;
|
||||
|
||||
// Remove slash and everything after it
|
||||
// // Remove slash and everything after it
|
||||
// if ($serialNumberRaw != null) {
|
||||
// $serialNumber = preg_replace('/\/.*/', '', $serialNumberRaw);
|
||||
// $serialNumber = trim($serialNumber);
|
||||
// } else {
|
||||
// $serialNumber = null;
|
||||
// }
|
||||
if ($serialNumberRaw != null) {
|
||||
$serialNumber = preg_replace('/\/.*/', '', $serialNumberRaw);
|
||||
if (strpos($serialNumberRaw, '/') !== false) {
|
||||
$serialNumber = strstr($serialNumberRaw, '/', true); // gets text before slash
|
||||
} else {
|
||||
$serialNumber = $serialNumberRaw; // keep original
|
||||
|
||||
}
|
||||
|
||||
$serialNumber = trim($serialNumber);
|
||||
|
||||
} else {
|
||||
$serialNumber = null;
|
||||
}
|
||||
@@ -1383,6 +1398,33 @@ class StickerReprint extends Page implements HasForms
|
||||
$itemCode = trim($parts[0]);
|
||||
$this->sNoId = isset($parts[1]) ? trim($parts[1]) : null;
|
||||
|
||||
$originalQR = $this->qrData;
|
||||
|
||||
if (strpos($originalQR, '/') != false)
|
||||
{
|
||||
// Allowed endings
|
||||
$allowed = ['/m', '/M', '/p', '/P'];
|
||||
|
||||
$foundValidEnding = false;
|
||||
|
||||
foreach ($allowed as $end) {
|
||||
if (str_ends_with($originalQR, $end)) {
|
||||
$foundValidEnding = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$foundValidEnding) {
|
||||
Notification::make()
|
||||
->title('Invalid QR Code')
|
||||
->body("Invalid QR format: '$originalQR'")
|
||||
->danger()
|
||||
->send();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->sNoId != null) {
|
||||
$this->sNoId = preg_replace('/\/.*/', '', $serialNumberRaw);
|
||||
$this->sNoId = trim($this->sNoId);
|
||||
@@ -1390,7 +1432,7 @@ class StickerReprint extends Page implements HasForms
|
||||
$this->sNoId = null;
|
||||
}
|
||||
|
||||
$this->qrData = preg_replace('/\/.*/', '', $this->qrData);
|
||||
//$this->qrData = preg_replace('/\/.*/', '', $this->qrData);
|
||||
|
||||
ProductionQuantity::create([
|
||||
'plant_id'=> $this->pId,
|
||||
@@ -1406,7 +1448,6 @@ class StickerReprint extends Page implements HasForms
|
||||
|
||||
// after success insertion
|
||||
$this->form->fill([
|
||||
|
||||
'plant_id'=> $this->pId,
|
||||
'block_name'=> $this->bId,
|
||||
'shift_id'=> $this->sId,
|
||||
@@ -1429,7 +1470,7 @@ class StickerReprint extends Page implements HasForms
|
||||
->duration(1000)
|
||||
->send();
|
||||
|
||||
$url = route('download-qr1-pdf', ['palletNo' => $this->qrData]);
|
||||
$url = route('download-qr1-pdf', ['palletNo' => urlencode($originalQR)]);
|
||||
$this->js(<<<JS
|
||||
window.dispatchEvent(new CustomEvent('open-pdf', {
|
||||
detail: {
|
||||
|
||||
@@ -53,6 +53,7 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
public bool $showCapacitorInput = false;
|
||||
|
||||
public $excel_file;
|
||||
public $mInvoiceNo;
|
||||
|
||||
public function getFormActions(): array
|
||||
{
|
||||
@@ -103,6 +104,8 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
{
|
||||
$invoiceNumber = trim($invoiceNumber);
|
||||
|
||||
$parts = explode('.', $invoiceNumber);
|
||||
|
||||
$this->showCapacitorInput = false;
|
||||
|
||||
$user = Filament::auth()->user();
|
||||
@@ -118,6 +121,62 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
|
||||
// ..GET SERIAL INVOICE API
|
||||
|
||||
if(strlen($invoiceNumber) > 15)
|
||||
{
|
||||
|
||||
$payloadJson = base64_decode(strtr($parts[1], '-_', '+/'));
|
||||
|
||||
if (empty($payloadJson)) {
|
||||
Notification::make()
|
||||
->title('Invalid payload for scanned qr code.')
|
||||
->danger()
|
||||
->seconds(1)
|
||||
->send();
|
||||
return;
|
||||
}
|
||||
|
||||
$payload = json_decode($payloadJson, true);
|
||||
|
||||
|
||||
if (!isset($payload['data'])) {
|
||||
Notification::make()
|
||||
->title('Invalid payload for scanned qr code.')
|
||||
->info()
|
||||
->seconds(1)
|
||||
->send();
|
||||
return;
|
||||
}
|
||||
|
||||
$documentData = $payload['data'];
|
||||
|
||||
if($documentData == '' || $documentData == ''){
|
||||
Notification::make()
|
||||
->title('Invalid payload for scanned qr code.')
|
||||
->info()
|
||||
->seconds(1)
|
||||
->send();
|
||||
return;
|
||||
}
|
||||
|
||||
// Extract DocNo
|
||||
preg_match('/"DocNo"\s*:\s*"([^"]+)"/', $documentData, $matches);
|
||||
|
||||
if (!isset($matches[1])) {
|
||||
Notification::make()
|
||||
->title('Invoice number not found.')
|
||||
->info()
|
||||
->seconds(1)
|
||||
->send();
|
||||
return;
|
||||
}
|
||||
|
||||
if (isset($matches[1])) {
|
||||
$invoiceNumber = $matches[1];
|
||||
}
|
||||
}
|
||||
|
||||
//dd($invoiceNumber);
|
||||
|
||||
// ..
|
||||
|
||||
$updateStatus = $this->form->getState()['update_invoice'] ?? null;
|
||||
@@ -2742,19 +2801,6 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
->send();
|
||||
$this->dispatch('playWarnSound');
|
||||
|
||||
// $mailData = $this->getMail();
|
||||
// $mPlantName = $mailData['plant_name'];
|
||||
// $emails = $mailData['emails'];
|
||||
// $mInvoiceType = 'Material';
|
||||
|
||||
// if (! empty($emails)) {
|
||||
// Mail::to($emails)->send(
|
||||
// new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'ItemNotValidMaterialType')
|
||||
// );
|
||||
// } else {
|
||||
// \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
||||
// }
|
||||
|
||||
$this->form->fill([
|
||||
'plant_id' => $plantId,
|
||||
'invoice_number' => $invoiceNumber,
|
||||
@@ -2784,19 +2830,6 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
->send();
|
||||
$this->dispatch('playWarnSound');
|
||||
|
||||
// $mailData = $this->getMail();
|
||||
// $mPlantName = $mailData['plant_name'];
|
||||
// $emails = $mailData['emails'];
|
||||
// $mInvoiceType = 'Material';
|
||||
|
||||
// if (! empty($emails)) {
|
||||
// Mail::to($emails)->send(
|
||||
// new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'ItemNotInvoice')
|
||||
// );
|
||||
// } else {
|
||||
// \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
||||
// }
|
||||
|
||||
$this->form->fill([
|
||||
'plant_id' => $plantId,
|
||||
'invoice_number' => $invoiceNumber,
|
||||
@@ -2825,19 +2858,6 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
->send();
|
||||
$this->dispatch('playWarnSound');
|
||||
|
||||
// $mailData = $this->getMail();
|
||||
// $mPlantName = $mailData['plant_name'];
|
||||
// $emails = $mailData['emails'];
|
||||
// $mInvoiceType = 'Material';
|
||||
|
||||
// if (! empty($emails)) {
|
||||
// Mail::to($emails)->send(
|
||||
// new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'Item')
|
||||
// );
|
||||
// } else {
|
||||
// \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
||||
// }
|
||||
|
||||
$this->form->fill([
|
||||
'plant_id' => $plantId,
|
||||
'invoice_number' => $invoiceNumber,
|
||||
@@ -3381,19 +3401,6 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
->send();
|
||||
$this->dispatch('playNotificationSound');
|
||||
|
||||
// $mInvoiceType = 'Serial';
|
||||
// $mailData = $this->getMail();
|
||||
// $mPlantName = $mailData['plant_name'];
|
||||
// $emails = $mailData['emails'];
|
||||
|
||||
// if (! empty($emails)) {
|
||||
// Mail::to($emails)->send(
|
||||
// new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'CompletedSerialInvoice')
|
||||
// );
|
||||
// } else {
|
||||
// \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
||||
// }
|
||||
|
||||
$filename = $invoiceNumber.'.xlsx';
|
||||
$directory = 'uploads/temp';
|
||||
$disk = Storage::disk('local');
|
||||
@@ -3511,20 +3518,6 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
|
||||
$this->dispatch('playNotificationSound');
|
||||
|
||||
// $mInvoiceType = 'Serial';
|
||||
// $mailData = $this->getMail();
|
||||
// $mPlantName = $mailData['plant_name'];
|
||||
// $emails = $mailData['emails'];
|
||||
|
||||
// if (! empty($emails)) {
|
||||
// // Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
|
||||
// Mail::to($emails)->send(
|
||||
// new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'CSerialInvoice')
|
||||
// );
|
||||
// } else {
|
||||
// \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
||||
// }
|
||||
|
||||
$filename = $invoiceNumber.'.xlsx';
|
||||
$directory = 'uploads/temp';
|
||||
$disk = Storage::disk('local');
|
||||
@@ -3584,22 +3577,6 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
|
||||
$this->dispatch('playWarnSound');
|
||||
|
||||
// $mInvoiceType = 'Serial';
|
||||
// $mailData = $this->getMail();
|
||||
// $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 InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, $mUserName, 'DuplicateCapacitorQR')
|
||||
// );
|
||||
// } else {
|
||||
// \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
||||
// }
|
||||
|
||||
$this->form->fill([
|
||||
'plant_id' => $plantId,
|
||||
'invoice_number' => $invoiceNumber,
|
||||
|
||||
@@ -22,6 +22,8 @@ class ProductionStickerReprintController extends Controller
|
||||
|
||||
public function downloadQrPdf($palletNo)
|
||||
{
|
||||
$palletNo = urldecode($palletNo);
|
||||
|
||||
$parts = explode('|', $palletNo);
|
||||
$itemCode = trim($parts[0]);
|
||||
$serialNumberRaw = isset($parts[1]) ? trim($parts[1]) : null;
|
||||
@@ -50,14 +52,30 @@ class ProductionStickerReprintController extends Controller
|
||||
|
||||
$productionOrder = $production->production_order ?? '';
|
||||
|
||||
if ($item->category == 'Submersible Motor')
|
||||
{
|
||||
$copies = 1;
|
||||
if(!preg_match('/\//', $palletNo)){
|
||||
if ($item->category == 'Submersible Motor')
|
||||
{
|
||||
$copies = 1;
|
||||
}
|
||||
elseif ($item->category == 'Submersible Pump')
|
||||
{
|
||||
$copies = 2;
|
||||
}
|
||||
}
|
||||
elseif ($item->category == 'Submersible Pump')
|
||||
else
|
||||
{
|
||||
$copies = 2;
|
||||
if ($item->category == 'Submersible Motor')
|
||||
{
|
||||
$copies = 1;
|
||||
}
|
||||
elseif ($item->category == 'Submersible Pump')
|
||||
{
|
||||
$copies = 1;
|
||||
}
|
||||
}
|
||||
|
||||
$palletNo = preg_replace('/\/.*/', '', $palletNo);
|
||||
|
||||
// 5. Generate QR Code (base64)
|
||||
$qrCode = new QrCode($palletNo);
|
||||
$output = new Output\Png();
|
||||
|
||||
Reference in New Issue
Block a user