Compare commits
10 Commits
renovate/v
...
cd45e6658a
| Author | SHA1 | Date | |
|---|---|---|---|
| cd45e6658a | |||
|
|
574e244e2f | ||
| 0b221c5eae | |||
|
|
9d8388c221 | ||
| 8c062505c9 | |||
|
|
87fd2df0f4 | ||
| 9411d0b33b | |||
|
|
7d5e02f491 | ||
| ab3a2047bb | |||
|
|
810c40b81b |
@@ -13,30 +13,49 @@ class CharacteristicValueExporter extends Exporter
|
|||||||
|
|
||||||
public static function getColumns(): array
|
public static function getColumns(): array
|
||||||
{
|
{
|
||||||
|
static $rowNumber = 0;
|
||||||
return [
|
return [
|
||||||
ExportColumn::make('id')
|
ExportColumn::make('no')
|
||||||
->label('ID'),
|
->label('NO')
|
||||||
ExportColumn::make('plant.name'),
|
->state(function ($record) use (&$rowNumber) {
|
||||||
ExportColumn::make('line.name'),
|
// Increment and return the row number
|
||||||
ExportColumn::make('item.id'),
|
return ++$rowNumber;
|
||||||
ExportColumn::make('machine.name'),
|
}),
|
||||||
ExportColumn::make('process_order'),
|
ExportColumn::make('plant.code')
|
||||||
ExportColumn::make('coil_number'),
|
->label('PLANT CODE'),
|
||||||
ExportColumn::make('status'),
|
ExportColumn::make('line.name')
|
||||||
ExportColumn::make('created_at'),
|
->label('LINE NAME'),
|
||||||
ExportColumn::make('updated_at'),
|
ExportColumn::make('item.code')
|
||||||
ExportColumn::make('created_by'),
|
->label('ITEM CODE'),
|
||||||
ExportColumn::make('updated_by'),
|
ExportColumn::make('machine.name')
|
||||||
ExportColumn::make('deleted_at'),
|
->label('WORK CENTER'),
|
||||||
|
ExportColumn::make('process_order')
|
||||||
|
->label('PROCESS ORDER'),
|
||||||
|
ExportColumn::make('coil_number')
|
||||||
|
->label('COIL NUMBER'),
|
||||||
|
ExportColumn::make('status')
|
||||||
|
->label('STATUS'),
|
||||||
|
ExportColumn::make('created_at')
|
||||||
|
->label('CREATED AT'),
|
||||||
|
ExportColumn::make('updated_at')
|
||||||
|
->label('UPDATED AT'),
|
||||||
|
ExportColumn::make('created_by')
|
||||||
|
->label('CREATED BY'),
|
||||||
|
ExportColumn::make('updated_by')
|
||||||
|
->label('UPDATED BY'),
|
||||||
|
ExportColumn::make('deleted_at')
|
||||||
|
->enabledByDefault(false)
|
||||||
|
->label('DELETED AT'),
|
||||||
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getCompletedNotificationBody(Export $export): string
|
public static function getCompletedNotificationBody(Export $export): string
|
||||||
{
|
{
|
||||||
$body = 'Your characteristic value export has completed and ' . number_format($export->successful_rows) . ' ' . str('row')->plural($export->successful_rows) . ' exported.';
|
$body = 'Your characteristic value export has completed and '.number_format($export->successful_rows).' '.str('row')->plural($export->successful_rows).' exported.';
|
||||||
|
|
||||||
if ($failedRowsCount = $export->getFailedRowsCount()) {
|
if ($failedRowsCount = $export->getFailedRowsCount()) {
|
||||||
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to export.';
|
$body .= ' '.number_format($failedRowsCount).' '.str('row')->plural($failedRowsCount).' failed to export.';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $body;
|
return $body;
|
||||||
|
|||||||
@@ -3,9 +3,16 @@
|
|||||||
namespace App\Filament\Imports;
|
namespace App\Filament\Imports;
|
||||||
|
|
||||||
use App\Models\CharacteristicValue;
|
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\ImportColumn;
|
||||||
use Filament\Actions\Imports\Importer;
|
use Filament\Actions\Imports\Importer;
|
||||||
use Filament\Actions\Imports\Models\Import;
|
use Filament\Actions\Imports\Models\Import;
|
||||||
|
use Str;
|
||||||
|
|
||||||
class CharacteristicValueImporter extends Importer
|
class CharacteristicValueImporter extends Importer
|
||||||
{
|
{
|
||||||
@@ -16,25 +23,52 @@ class CharacteristicValueImporter extends Importer
|
|||||||
return [
|
return [
|
||||||
ImportColumn::make('plant')
|
ImportColumn::make('plant')
|
||||||
->requiredMapping()
|
->requiredMapping()
|
||||||
->relationship()
|
->exampleHeader('Plant Code')
|
||||||
|
->example('1000')
|
||||||
|
->label('Plant Code')
|
||||||
|
->relationship(resolveUsing: 'code')
|
||||||
->rules(['required']),
|
->rules(['required']),
|
||||||
ImportColumn::make('line')
|
ImportColumn::make('line')
|
||||||
->requiredMapping()
|
->requiredMapping()
|
||||||
->relationship()
|
->exampleHeader('Line Name')
|
||||||
|
->example('4 inch pump line')
|
||||||
|
->label('Line Name')
|
||||||
|
->relationship(resolveUsing: 'name')
|
||||||
->rules(['required']),
|
->rules(['required']),
|
||||||
ImportColumn::make('item')
|
ImportColumn::make('item')
|
||||||
->requiredMapping()
|
->requiredMapping()
|
||||||
->relationship()
|
->exampleHeader('Item Code')
|
||||||
|
->example('123456')
|
||||||
|
->label('Item Code')
|
||||||
|
->relationship(resolveUsing: 'code')
|
||||||
->rules(['required']),
|
->rules(['required']),
|
||||||
ImportColumn::make('machine')
|
ImportColumn::make('machine')
|
||||||
->requiredMapping()
|
->requiredMapping()
|
||||||
->relationship()
|
->exampleHeader('Work Center')
|
||||||
|
->example('RMGS09745')
|
||||||
|
->label('Work Center')
|
||||||
|
->relationship(resolveUsing: 'work_center')
|
||||||
->rules(['required']),
|
->rules(['required']),
|
||||||
ImportColumn::make('process_order'),
|
ImportColumn::make('process_order')
|
||||||
ImportColumn::make('coil_number'),
|
->requiredMapping()
|
||||||
ImportColumn::make('status'),
|
->exampleHeader('Process Order')
|
||||||
ImportColumn::make('created_by'),
|
->example('23455256352')
|
||||||
ImportColumn::make('updated_by'),
|
->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'],
|
// '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
|
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()) {
|
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;
|
return $body;
|
||||||
|
|||||||
@@ -1155,12 +1155,27 @@ class StickerReprint extends Page implements HasForms
|
|||||||
// Only search when all parent IDs are selected
|
// Only search when all parent IDs are selected
|
||||||
$parts = explode('|', $formQRData);
|
$parts = explode('|', $formQRData);
|
||||||
$itemCode = trim($parts[0]);
|
$itemCode = trim($parts[0]);
|
||||||
|
|
||||||
|
|
||||||
$serialNumberRaw = isset($parts[1]) ? trim($parts[1]) : null;
|
$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) {
|
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);
|
$serialNumber = trim($serialNumber);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$serialNumber = null;
|
$serialNumber = null;
|
||||||
}
|
}
|
||||||
@@ -1383,6 +1398,33 @@ class StickerReprint extends Page implements HasForms
|
|||||||
$itemCode = trim($parts[0]);
|
$itemCode = trim($parts[0]);
|
||||||
$this->sNoId = isset($parts[1]) ? trim($parts[1]) : null;
|
$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) {
|
if ($this->sNoId != null) {
|
||||||
$this->sNoId = preg_replace('/\/.*/', '', $serialNumberRaw);
|
$this->sNoId = preg_replace('/\/.*/', '', $serialNumberRaw);
|
||||||
$this->sNoId = trim($this->sNoId);
|
$this->sNoId = trim($this->sNoId);
|
||||||
@@ -1390,7 +1432,7 @@ class StickerReprint extends Page implements HasForms
|
|||||||
$this->sNoId = null;
|
$this->sNoId = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->qrData = preg_replace('/\/.*/', '', $this->qrData);
|
//$this->qrData = preg_replace('/\/.*/', '', $this->qrData);
|
||||||
|
|
||||||
ProductionQuantity::create([
|
ProductionQuantity::create([
|
||||||
'plant_id'=> $this->pId,
|
'plant_id'=> $this->pId,
|
||||||
@@ -1406,7 +1448,6 @@ class StickerReprint extends Page implements HasForms
|
|||||||
|
|
||||||
// after success insertion
|
// after success insertion
|
||||||
$this->form->fill([
|
$this->form->fill([
|
||||||
|
|
||||||
'plant_id'=> $this->pId,
|
'plant_id'=> $this->pId,
|
||||||
'block_name'=> $this->bId,
|
'block_name'=> $this->bId,
|
||||||
'shift_id'=> $this->sId,
|
'shift_id'=> $this->sId,
|
||||||
@@ -1429,7 +1470,7 @@ class StickerReprint extends Page implements HasForms
|
|||||||
->duration(1000)
|
->duration(1000)
|
||||||
->send();
|
->send();
|
||||||
|
|
||||||
$url = route('download-qr1-pdf', ['palletNo' => $this->qrData]);
|
$url = route('download-qr1-pdf', ['palletNo' => urlencode($originalQR)]);
|
||||||
$this->js(<<<JS
|
$this->js(<<<JS
|
||||||
window.dispatchEvent(new CustomEvent('open-pdf', {
|
window.dispatchEvent(new CustomEvent('open-pdf', {
|
||||||
detail: {
|
detail: {
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
public bool $showCapacitorInput = false;
|
public bool $showCapacitorInput = false;
|
||||||
|
|
||||||
public $excel_file;
|
public $excel_file;
|
||||||
|
public $mInvoiceNo;
|
||||||
|
|
||||||
public function getFormActions(): array
|
public function getFormActions(): array
|
||||||
{
|
{
|
||||||
@@ -103,6 +104,8 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
{
|
{
|
||||||
$invoiceNumber = trim($invoiceNumber);
|
$invoiceNumber = trim($invoiceNumber);
|
||||||
|
|
||||||
|
$parts = explode('.', $invoiceNumber);
|
||||||
|
|
||||||
$this->showCapacitorInput = false;
|
$this->showCapacitorInput = false;
|
||||||
|
|
||||||
$user = Filament::auth()->user();
|
$user = Filament::auth()->user();
|
||||||
@@ -118,6 +121,62 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
|
|
||||||
// ..GET SERIAL INVOICE API
|
// ..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;
|
$updateStatus = $this->form->getState()['update_invoice'] ?? null;
|
||||||
@@ -2742,19 +2801,6 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
->send();
|
->send();
|
||||||
$this->dispatch('playWarnSound');
|
$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([
|
$this->form->fill([
|
||||||
'plant_id' => $plantId,
|
'plant_id' => $plantId,
|
||||||
'invoice_number' => $invoiceNumber,
|
'invoice_number' => $invoiceNumber,
|
||||||
@@ -2784,19 +2830,6 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
->send();
|
->send();
|
||||||
$this->dispatch('playWarnSound');
|
$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([
|
$this->form->fill([
|
||||||
'plant_id' => $plantId,
|
'plant_id' => $plantId,
|
||||||
'invoice_number' => $invoiceNumber,
|
'invoice_number' => $invoiceNumber,
|
||||||
@@ -2825,19 +2858,6 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
->send();
|
->send();
|
||||||
$this->dispatch('playWarnSound');
|
$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([
|
$this->form->fill([
|
||||||
'plant_id' => $plantId,
|
'plant_id' => $plantId,
|
||||||
'invoice_number' => $invoiceNumber,
|
'invoice_number' => $invoiceNumber,
|
||||||
@@ -3381,19 +3401,6 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
->send();
|
->send();
|
||||||
$this->dispatch('playNotificationSound');
|
$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';
|
$filename = $invoiceNumber.'.xlsx';
|
||||||
$directory = 'uploads/temp';
|
$directory = 'uploads/temp';
|
||||||
$disk = Storage::disk('local');
|
$disk = Storage::disk('local');
|
||||||
@@ -3511,20 +3518,6 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
|
|
||||||
$this->dispatch('playNotificationSound');
|
$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';
|
$filename = $invoiceNumber.'.xlsx';
|
||||||
$directory = 'uploads/temp';
|
$directory = 'uploads/temp';
|
||||||
$disk = Storage::disk('local');
|
$disk = Storage::disk('local');
|
||||||
@@ -3584,22 +3577,6 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
|
|
||||||
$this->dispatch('playWarnSound');
|
$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([
|
$this->form->fill([
|
||||||
'plant_id' => $plantId,
|
'plant_id' => $plantId,
|
||||||
'invoice_number' => $invoiceNumber,
|
'invoice_number' => $invoiceNumber,
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ class ProductionStickerReprintController extends Controller
|
|||||||
|
|
||||||
public function downloadQrPdf($palletNo)
|
public function downloadQrPdf($palletNo)
|
||||||
{
|
{
|
||||||
|
$palletNo = urldecode($palletNo);
|
||||||
|
|
||||||
$parts = explode('|', $palletNo);
|
$parts = explode('|', $palletNo);
|
||||||
$itemCode = trim($parts[0]);
|
$itemCode = trim($parts[0]);
|
||||||
$serialNumberRaw = isset($parts[1]) ? trim($parts[1]) : null;
|
$serialNumberRaw = isset($parts[1]) ? trim($parts[1]) : null;
|
||||||
@@ -50,14 +52,30 @@ class ProductionStickerReprintController extends Controller
|
|||||||
|
|
||||||
$productionOrder = $production->production_order ?? '';
|
$productionOrder = $production->production_order ?? '';
|
||||||
|
|
||||||
if ($item->category == 'Submersible Motor')
|
if(!preg_match('/\//', $palletNo)){
|
||||||
{
|
if ($item->category == 'Submersible Motor')
|
||||||
$copies = 1;
|
{
|
||||||
|
$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)
|
// 5. Generate QR Code (base64)
|
||||||
$qrCode = new QrCode($palletNo);
|
$qrCode = new QrCode($palletNo);
|
||||||
$output = new Output\Png();
|
$output = new Output\Png();
|
||||||
|
|||||||
@@ -13,6 +13,6 @@
|
|||||||
"laravel-vite-plugin": "^1.2.0",
|
"laravel-vite-plugin": "^1.2.0",
|
||||||
"postcss": "^8.4.47",
|
"postcss": "^8.4.47",
|
||||||
"tailwindcss": "^3.4.13",
|
"tailwindcss": "^3.4.13",
|
||||||
"vite": "^7.0.0"
|
"vite": "^6.0.11"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,14 +9,9 @@ Artisan::command('inspire', function () {
|
|||||||
$this->comment(Inspiring::quote());
|
$this->comment(Inspiring::quote());
|
||||||
})->purpose('Display an inspiring quote');
|
})->purpose('Display an inspiring quote');
|
||||||
|
|
||||||
|
|
||||||
Artisan::command('auto:scheduler', function () {
|
Artisan::command('auto:scheduler', function () {
|
||||||
$this->call('custom:scheduler');
|
$this->call('custom:scheduler');
|
||||||
})->everyMinute();
|
})->everyMinute()->withoutOverlapping();
|
||||||
|
|
||||||
|
|
||||||
// Schedule::command('send:invoice-report');
|
|
||||||
// Schedule::command('send:production-report');
|
|
||||||
|
|
||||||
// app()->booted(function () {
|
// app()->booted(function () {
|
||||||
// $schedule = app(Schedule::class);
|
// $schedule = app(Schedule::class);
|
||||||
|
|||||||
Reference in New Issue
Block a user