Compare commits
31 Commits
0903c60316
...
ranjith-de
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cd3598d67e | ||
|
|
3b9d94552b | ||
|
|
ba55567aed | ||
|
|
d32408bebd | ||
|
|
854330caf2 | ||
|
|
4309003fbd | ||
|
|
c500759f52 | ||
|
|
0a07e4b6e6 | ||
|
|
21b40b499a | ||
|
|
447c0a73a0 | ||
|
|
2431f73571 | ||
|
|
62259d4afe | ||
|
|
ec831f0fb9 | ||
|
|
e09f6582e9 | ||
|
|
7e543b30c3 | ||
|
|
8b9901c27d | ||
|
|
adfce88a3e | ||
|
|
fb12e2fb48 | ||
|
|
52cee81573 | ||
|
|
0bd910c6d0 | ||
|
|
a74aa3bde5 | ||
|
|
6f93f2bd92 | ||
|
|
d19b8120e2 | ||
|
|
8fb42203c3 | ||
|
|
bb2f5082b1 | ||
|
|
3215cd39ad | ||
|
|
7755d15741 | ||
|
|
4586fc0d60 | ||
|
|
65fc5202a4 | ||
|
|
770f0c9af3 | ||
|
|
47a0cf31d2 |
@@ -34,6 +34,8 @@ class SendInvoiceReport extends Command
|
||||
// $scheduleType = $this->argument('scheduleType');
|
||||
$plantIdArg = (int) $this->argument('plant'); // can be 0 for all plants
|
||||
|
||||
// $mailRules = \App\Models\AlertMailRule::where('module', 'InvoiceValidation')->get()->groupBy('rule_name');
|
||||
|
||||
$mailRules = \App\Models\AlertMailRule::where('module', 'InvoiceValidation')->get()->groupBy('rule_name');
|
||||
|
||||
// $startDate = now()->setTime(8, 0, 0);
|
||||
|
||||
@@ -34,6 +34,8 @@ class InvoiceValidationExporter extends Exporter
|
||||
->label('ITEM CODE'),
|
||||
ExportColumn::make('stickerMaster.item.description')
|
||||
->label('ITEM DESCRIPTION'),
|
||||
ExportColumn::make('stickerMaster.item.uom')
|
||||
->label('UNIT OF MEASURE'),
|
||||
ExportColumn::make('motor_scanned_status')
|
||||
->label('MOTOR SCANNED STATUS'),
|
||||
ExportColumn::make('pump_scanned_status')
|
||||
|
||||
@@ -59,7 +59,6 @@ class ProcessOrderExporter extends Exporter
|
||||
ExportColumn::make('deleted_at')
|
||||
->enabledByDefault(false)
|
||||
->label('DELETED AT'),
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ class InvoiceValidationImporter extends Importer
|
||||
ImportColumn::make('operator_id')
|
||||
->requiredMapping()
|
||||
->exampleHeader('OPERATOR ID')
|
||||
->example('USER1')
|
||||
->example('USER00001')
|
||||
->label('OPERATOR ID')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('created_at')
|
||||
@@ -122,19 +122,19 @@ class InvoiceValidationImporter extends Importer
|
||||
ImportColumn::make('created_by')
|
||||
->requiredMapping()
|
||||
->exampleHeader('CREATED BY')
|
||||
->example('USER1')
|
||||
->example('USER00001')
|
||||
->label('CREATED BY')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('updated_at')
|
||||
->requiredMapping()
|
||||
->exampleHeader('UPDATED AT')
|
||||
->example('USER1')
|
||||
->example('')
|
||||
->label('UPDATED AT')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('updated_by')
|
||||
->requiredMapping()
|
||||
->exampleHeader('UPDATED BY')
|
||||
->example('')
|
||||
->example('USER00001')
|
||||
->label('UPDATED BY')
|
||||
->rules(['required']),
|
||||
];
|
||||
|
||||
@@ -82,7 +82,7 @@ class PlantImporter extends Importer
|
||||
$warnMsg[] = 'Name should contain at least 5 characters!';
|
||||
}
|
||||
if ($wareHouseNo == null || $wareHouseNo == '' || ! $wareHouseNo) {
|
||||
$warnMsg[] = "Warehouse number can't be empty!";
|
||||
// $warnMsg[] = "Warehouse number can't be empty!";
|
||||
} elseif (! is_numeric($wareHouseNo)) {
|
||||
$warnMsg[] = 'Warehouse number should contain only numeric values!';
|
||||
} elseif (Str::length($wareHouseNo) == 3) {
|
||||
|
||||
@@ -102,7 +102,6 @@ class ProductCharacteristicsMasterImporter extends Importer
|
||||
|
||||
public function resolveRecord(): ?ProductCharacteristicsMaster
|
||||
{
|
||||
|
||||
$warnMsg = [];
|
||||
$plantCod = trim($this->data['plant']) ?? null;
|
||||
$itemCod = trim($this->data['item']) ?? null;
|
||||
|
||||
@@ -2,10 +2,17 @@
|
||||
|
||||
namespace App\Filament\Imports;
|
||||
|
||||
use App\Models\Item;
|
||||
use App\Models\Line;
|
||||
use App\Models\Machine;
|
||||
use App\Models\Plant;
|
||||
use App\Models\ProductionCharacteristic;
|
||||
use Filament\Actions\Imports\Exceptions\RowImportFailedException;
|
||||
use Filament\Actions\Imports\ImportColumn;
|
||||
use Filament\Actions\Imports\Importer;
|
||||
use Filament\Actions\Imports\Models\Import;
|
||||
use Filament\Facades\Filament;
|
||||
use Str;
|
||||
|
||||
class ProductionCharacteristicImporter extends Importer
|
||||
{
|
||||
@@ -16,40 +23,170 @@ class ProductionCharacteristicImporter extends Importer
|
||||
return [
|
||||
ImportColumn::make('plant')
|
||||
->requiredMapping()
|
||||
->relationship()
|
||||
->exampleHeader('PLANT CODE')
|
||||
->example('1200')
|
||||
->label('PLANT CODE')
|
||||
->relationship(resolveUsing: 'code')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('line')
|
||||
->requiredMapping()
|
||||
->relationship()
|
||||
->rules(['required']),
|
||||
->exampleHeader('LINE NAME')
|
||||
->example('Poly Wrapped Wire SFG')
|
||||
->label('LINE NAME')
|
||||
->relationship(resolveUsing: 'name'),
|
||||
ImportColumn::make('item')
|
||||
->requiredMapping()
|
||||
->relationship()
|
||||
->exampleHeader('ITEM CODE')
|
||||
->example('123456')
|
||||
->label('ITEM CODE')
|
||||
->relationship(resolveUsing: 'code')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('machine')
|
||||
ImportColumn::make('machine_name')
|
||||
->requiredMapping()
|
||||
->relationship()
|
||||
->exampleHeader('MACHINE NAME')
|
||||
->example('RMI001234')
|
||||
->label('MACHINE NAME')
|
||||
// ->relationship(resolveUsing: 'work_center')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('production_order'),
|
||||
ImportColumn::make('serial_number'),
|
||||
ImportColumn::make('characteristic_name'),
|
||||
ImportColumn::make('observed_value'),
|
||||
ImportColumn::make('status'),
|
||||
ImportColumn::make('inspection_status'),
|
||||
ImportColumn::make('remark'),
|
||||
ImportColumn::make('created_by'),
|
||||
ImportColumn::make('updated_by'),
|
||||
ImportColumn::make('production_order')
|
||||
->requiredMapping()
|
||||
->exampleHeader('PRODUCTION ORDER')
|
||||
->example('1880231')
|
||||
->label('PRODUCTION ORDER')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('serial_number')
|
||||
->requiredMapping()
|
||||
->exampleHeader('SERIAL NUMBER')
|
||||
->example('20001202121')
|
||||
->label('SERIAL NUMBER')
|
||||
->rules(['required']),
|
||||
ImportColumn::make('characteristic_name')
|
||||
->requiredMapping()
|
||||
->exampleHeader('CHARACTERISTIC NAME')
|
||||
->example('Voltage')
|
||||
->label('CHARACTERISTIC NAME'),
|
||||
ImportColumn::make('observed_value')
|
||||
->exampleHeader('OBSERVED VALUE')
|
||||
->example('0')
|
||||
->label('OBSERVED VALUE'),
|
||||
ImportColumn::make('status')
|
||||
->exampleHeader('STATUS')
|
||||
->example('Ok')
|
||||
->label('STATUS'),
|
||||
ImportColumn::make('remark')
|
||||
->exampleHeader('REMARK')
|
||||
->example('Issue')
|
||||
->label('REMARK'),
|
||||
];
|
||||
}
|
||||
|
||||
public function resolveRecord(): ?ProductionCharacteristic
|
||||
{
|
||||
// return ProductionCharacteristic::firstOrNew([
|
||||
// // Update existing records, matching them by `$this->data['column_name']`
|
||||
// 'email' => $this->data['email'],
|
||||
// ]);
|
||||
|
||||
return new ProductionCharacteristic();
|
||||
$warnMsg = [];
|
||||
$plant = null;
|
||||
$plantCod = trim($this->data['plant']) ?? '';
|
||||
$plantId = null;
|
||||
$iCode = trim($this->data['item']) ?? '';
|
||||
$itemId = null;
|
||||
$lineNam = trim($this->data['line']) ?? '';
|
||||
$lineId = null;
|
||||
$machineName = trim($this->data['machine_name'] ?? '');
|
||||
$pOrder = trim($this->data['production_order'] ?? '');
|
||||
$sNo = trim($this->data['serial_number'] ?? '');
|
||||
$charName = trim($this->data['characteristic_name'] ?? '');
|
||||
$obsValue = trim($this->data['observed_value'] ?? '');
|
||||
$status = trim($this->data['status'] ?? '');
|
||||
$remark = trim($this->data['remark'] ?? '');
|
||||
|
||||
if ($plantCod == null || $plantCod == '') {
|
||||
$warnMsg[] = "Plant code can't be empty!";
|
||||
} elseif (Str::length($plantCod) < 4 || ! is_numeric($plantCod) || ! preg_match('/^[1-9]\d{3,}$/', $plantCod)) {
|
||||
$warnMsg[] = 'Invalid plant code found';
|
||||
}
|
||||
if ($iCode == null || $iCode == '') {
|
||||
$warnMsg[] = "Item code can't be empty!";
|
||||
} elseif (Str::length($iCode) < 6 || ! ctype_alnum($iCode)) {
|
||||
$warnMsg[] = 'Invalid item code found!';
|
||||
}
|
||||
if ($machineName != null && $machineName != '' && Str::length($machineName) > 18) {
|
||||
$warnMsg[] = 'Invalid machine name found!';
|
||||
}
|
||||
|
||||
$plant = Plant::where('code', $plantCod)->first();
|
||||
if (! $plant) {
|
||||
$warnMsg[] = 'Plant not found!';
|
||||
} else {
|
||||
$plantId = $plant->id;
|
||||
}
|
||||
|
||||
$itemCode = Item::where('code', $iCode)->first();
|
||||
if (! $itemCode) {
|
||||
$warnMsg[] = 'Item code not found!';
|
||||
} else {
|
||||
if ($plantId) {
|
||||
$itemCode = Item::where('code', $iCode)->where('plant_id', $plantId)->first();
|
||||
if (! $itemCode) {
|
||||
$warnMsg[] = 'Item code not found for the given plant!';
|
||||
} else {
|
||||
$itemId = $itemCode->id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$lineExists = Line::where('name', $lineNam)->first();
|
||||
if (! $lineExists) {
|
||||
$warnMsg[] = 'Line name not found!';
|
||||
} else {
|
||||
if ($plantId) {
|
||||
$lineAgainstPlant = Line::where('name', $lineNam)->where('plant_id', $plantId)->first();
|
||||
if (! $lineAgainstPlant) {
|
||||
$warnMsg[] = 'Line name not found for the given plant!';
|
||||
} else {
|
||||
$lineId = $lineAgainstPlant->id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$machineExists = Machine::where('work_center', $machineName)->first();
|
||||
if (! $machineExists) {
|
||||
$warnMsg[] = 'Machine not found!';
|
||||
} else {
|
||||
if ($plantId) {
|
||||
$machineAgainstPlant = Machine::where('work_center', $machineName)->where('plant_id', $plantId)->first();
|
||||
if (! $machineAgainstPlant) {
|
||||
$warnMsg[] = 'Machine not found for the given plant!';
|
||||
} else {
|
||||
$machineId = $machineAgainstPlant->id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($warnMsg)) {
|
||||
throw new RowImportFailedException(implode(', ', $warnMsg));
|
||||
}
|
||||
|
||||
ProductionCharacteristic::Create(
|
||||
[
|
||||
'plant_id' => $plantId,
|
||||
'line_id' => $lineId,
|
||||
'item_id' => $itemId,
|
||||
'machine_id' => $machineId,
|
||||
'production_order' => $pOrder,
|
||||
'serial_number' => $sNo,
|
||||
'characteristic_name' => $charName,
|
||||
'observed_value' => $obsValue,
|
||||
'status' => $status,
|
||||
'remark' => $remark,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
'created_by' => Filament::auth()->user()->name,
|
||||
'updated_by' => Filament::auth()->user()->name,
|
||||
]
|
||||
);
|
||||
|
||||
return null;
|
||||
|
||||
// return new ProductionCharacteristic();
|
||||
}
|
||||
|
||||
public static function getCompletedNotificationBody(Import $import): string
|
||||
|
||||
@@ -23,6 +23,8 @@ class Dashboard extends \Filament\Pages\Dashboard
|
||||
|
||||
protected static string $view = 'filament.pages.dashboard';
|
||||
|
||||
protected static ?string $slug = 'welcome';
|
||||
|
||||
// public function mount(): void
|
||||
// {
|
||||
// session()->forget(['selected_plant']);
|
||||
|
||||
@@ -291,7 +291,6 @@ class ProductionQuantityPage extends Page implements HasForms
|
||||
$machineId = $get('machine_id');
|
||||
|
||||
$this->mNam = $machineId;
|
||||
|
||||
})
|
||||
->extraAttributes(fn ($get) => [
|
||||
// 'class' => $get('pqLineError') ? 'border-red-500' : '',
|
||||
|
||||
@@ -22,6 +22,7 @@ use Filament\Notifications\Notification;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
// use PhpOffice\PhpSpreadsheet\IOFactory;
|
||||
|
||||
class ImportTransitResource extends Resource
|
||||
{
|
||||
@@ -446,6 +447,20 @@ class ImportTransitResource extends Resource
|
||||
|
||||
}
|
||||
|
||||
// $spreadsheet = IOFactory::load($fullPath);
|
||||
|
||||
// foreach ($spreadsheet->getAllSheets() as $sheet) {
|
||||
// $state = $sheet->getSheetState();
|
||||
// if ($state == \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::SHEETSTATE_HIDDEN ||
|
||||
// $state == \PhpOffice\PhpSpreadsheet\Worksheet\Worksheet::SHEETSTATE_VERYHIDDEN) {
|
||||
// Notification::make()
|
||||
// ->title('Import Failed')
|
||||
// ->body("Hidden sheet found: \"{$sheet->getTitle()}\". Please remove all hidden sheets and try again.")
|
||||
// ->danger()
|
||||
// ->send();
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
@@ -61,6 +61,7 @@ class InvoiceValidationResource extends Resource
|
||||
Section::make('')
|
||||
->schema([
|
||||
Forms\Components\Select::make('plant_id')
|
||||
->label('Plant Name')
|
||||
->relationship('plant', 'name')
|
||||
->required()
|
||||
// ->preload()
|
||||
@@ -278,6 +279,11 @@ class InvoiceValidationResource extends Resource
|
||||
->alignCenter()
|
||||
->sortable() // ->searchable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('stickerMaster.item.uom')
|
||||
->label('Unit of Measure')
|
||||
->alignCenter()
|
||||
->sortable() // ->searchable()
|
||||
->toggleable(isToggledHiddenByDefault: true),
|
||||
Tables\Columns\TextColumn::make('serial_number')
|
||||
->label('Serial Number')
|
||||
->alignCenter()
|
||||
@@ -323,7 +329,7 @@ class InvoiceValidationResource extends Resource
|
||||
->alignCenter()
|
||||
->numeric(),
|
||||
Tables\Columns\TextColumn::make('plant.name')
|
||||
->label('Plant')
|
||||
->label('Plant Name')
|
||||
->alignCenter()
|
||||
->sortable(),
|
||||
Tables\Columns\TextColumn::make('created_by')
|
||||
@@ -381,7 +387,7 @@ class InvoiceValidationResource extends Resource
|
||||
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
|
||||
})
|
||||
->searchable()
|
||||
->label('Select Plant')
|
||||
->label('Search by Plant Name')
|
||||
->required()
|
||||
->default(function () {
|
||||
return optional(InvoiceValidation::latest()->first())->plant_id;
|
||||
@@ -404,7 +410,7 @@ class InvoiceValidationResource extends Resource
|
||||
->reactive(),
|
||||
|
||||
FileUpload::make('invoice_serial_number')
|
||||
->label('Invoice Serial Number')
|
||||
->label('Choose Serial Invoice')
|
||||
->required()
|
||||
->acceptedFileTypes([
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||
@@ -732,7 +738,7 @@ class InvoiceValidationResource extends Resource
|
||||
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
|
||||
})
|
||||
->searchable()
|
||||
->label('Select Plant')
|
||||
->label('Search by Plant Name')
|
||||
->required()
|
||||
->default(function () {
|
||||
return optional(InvoiceValidation::latest()->first())->plant_id;
|
||||
@@ -755,7 +761,7 @@ class InvoiceValidationResource extends Resource
|
||||
->reactive(),
|
||||
|
||||
FileUpload::make('invoice_material')
|
||||
->label('Invoice Material')
|
||||
->label('Choose Material Invoice')
|
||||
->required()
|
||||
->acceptedFileTypes([
|
||||
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
||||
|
||||
@@ -10,6 +10,8 @@ use App\Models\InvoiceValidation;
|
||||
use App\Models\Item;
|
||||
use App\Models\Plant;
|
||||
use App\Models\StickerMaster;
|
||||
use App\Models\WireMasterPacking;
|
||||
use DB;
|
||||
use Filament\Facades\Filament;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Pages\Concerns\ExposesTableToWidgets;
|
||||
@@ -174,17 +176,15 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
}
|
||||
|
||||
if (isset($matches[1])) {
|
||||
$invoiceNumber = $matches[1];
|
||||
$invoiceNumber = strtoupper($matches[1]);
|
||||
}
|
||||
} else {
|
||||
$invoiceNumber = strtoupper($invoiceNumber);
|
||||
}
|
||||
|
||||
// dd($invoiceNumber);
|
||||
|
||||
// ..
|
||||
|
||||
$updateStatus = $this->form->getState()['update_invoice'] ?? null;
|
||||
|
||||
$this->invoiceNumber = trim($this->form->getState()['invoice_number']) ?? $invoiceNumber;
|
||||
$this->invoiceNumber = strtoupper(trim($this->form->getState()['invoice_number'])) ?? $invoiceNumber;
|
||||
|
||||
$invoiceType = null;
|
||||
// $this->invoiceNumber = $this->invoiceNumber ?? $invoiceNumber;
|
||||
@@ -2317,7 +2317,7 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
protected function refreshInvoiceTable()
|
||||
{
|
||||
$this->plantId = $this->form->getState()['plant_id'] ?? '';
|
||||
$this->invoiceNumber = $this->form->getState()['invoice_number'] ?? '';
|
||||
$this->invoiceNumber = strtoupper(trim($this->form->getState()['invoice_number'])) ?? '';
|
||||
|
||||
if (! empty($this->invoiceNumber)) {
|
||||
$hasInvoice = InvoiceValidation::where('invoice_number', $this->invoiceNumber)->where('plant_id', $this->plantId)->first();
|
||||
@@ -2378,7 +2378,7 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
$serialNumber = null;
|
||||
$plantId = $this->form->getState()['plant_id'];
|
||||
$this->plantId = $plantId;
|
||||
$invoiceNumber = $this->form->getState()['invoice_number'];
|
||||
$invoiceNumber = strtoupper(trim($this->form->getState()['invoice_number']));
|
||||
$this->invoiceNumber = $invoiceNumber;
|
||||
|
||||
$plant = Plant::find($plantId);
|
||||
@@ -2455,14 +2455,65 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
$this->dispatch('refreshMaterialInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId);
|
||||
}
|
||||
|
||||
$pattern0 = '/^(?<item_code>[^|]+)\|(?<batch_id>[^|]+)\|(?<batch_count>[^|]+)\|(?<batch_quantity>[0-9]+(?:\.[0-9]+)?)kg$/i';
|
||||
$pattern1 = '/^(?<item_code>[^|]+)\|(?<batch_number>[^|]+)\|(?<batch_id>[^|]+)\|(?<batch_count>[^|]+)\/(?<batch_quantity>.+)$/i';
|
||||
$pattern2 = '/^(?<item_code>[^|]+)\|(?<batch_number>[^|]+)\|(?<batch_id>[^|]+)\|(?<batch_count>.+)$/i';
|
||||
$pattern3 = '/^(?<item_code>[^|]+)\|(?<batch_id>[^|]+)-(?<batch_count>.+)$/i';
|
||||
$pattern4 = '/^MP-(?<code>.+)$/i';
|
||||
$itemCode = '';
|
||||
$batchNumber = '';
|
||||
$curScanQty = '';
|
||||
$wirePallet = '';
|
||||
$curMaterialQty = '';
|
||||
$curMaterialSer = '';
|
||||
|
||||
if (preg_match($pattern1, $serNo, $matches)) {
|
||||
if (preg_match($pattern0, $serNo, $matches)) {
|
||||
$itemCode = $matches['item_code'];
|
||||
$this->currentItemCode = $itemCode;
|
||||
$curScanQty = $matches['batch_quantity'];
|
||||
$serialNumber = $matches['batch_id'].'-'.$matches['batch_count'];
|
||||
$serNo = null;
|
||||
|
||||
if (empty($matches['batch_id']) || ! $matches['batch_id']) {
|
||||
Notification::make()
|
||||
->danger()
|
||||
->title('Invalid Material QR Format')
|
||||
->body('Scan valid Material QR code to proceed!<br>Sample formats are:<br>123456|123456789|001|5kg (or)<br>123456|12345|12345678|1/1 (or)<br>123456|12345|12345678|1 (or)<br>123456|12345678-1')
|
||||
->seconds(2)
|
||||
->send();
|
||||
$this->dispatch('playWarnSound');
|
||||
|
||||
$this->form->fill([
|
||||
'plant_id' => $plantId,
|
||||
'invoice_number' => $invoiceNumber,
|
||||
'serial_number' => null,
|
||||
'total_quantity' => $totQuan,
|
||||
'update_invoice' => false,
|
||||
'scanned_quantity' => $scanMQuan,
|
||||
]);
|
||||
|
||||
return;
|
||||
} elseif (empty($matches['batch_count']) || ! $matches['batch_count']) {
|
||||
Notification::make()
|
||||
->danger()
|
||||
->title('Invalid Material QR Format')
|
||||
->body('Scan valid Material QR code to proceed!<br>Sample formats are:<br>123456|123456789|001|5kg (or)<br>123456|12345|12345678|1/1 (or)<br>123456|12345|12345678|1 (or)<br>123456|12345678-1')
|
||||
->seconds(2)
|
||||
->send();
|
||||
$this->dispatch('playWarnSound');
|
||||
|
||||
$this->form->fill([
|
||||
'plant_id' => $plantId,
|
||||
'invoice_number' => $invoiceNumber,
|
||||
'serial_number' => null,
|
||||
'total_quantity' => $totQuan,
|
||||
'update_invoice' => false,
|
||||
'scanned_quantity' => $scanMQuan,
|
||||
]);
|
||||
|
||||
return;
|
||||
}
|
||||
} elseif (preg_match($pattern1, $serNo, $matches)) {
|
||||
$itemCode = $matches['item_code'];
|
||||
$this->currentItemCode = $itemCode;
|
||||
$batchNumber = $matches['batch_number'];
|
||||
@@ -2470,11 +2521,45 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
$curScanQty = $matches['batch_quantity'];
|
||||
$serNo = null;
|
||||
|
||||
if (empty($matches['batch_id']) || ! $matches['batch_id']) {
|
||||
if (empty($matches['batch_number']) || ! $matches['batch_number']) {
|
||||
Notification::make()
|
||||
->danger()
|
||||
->title('Invalid Material QR Format')
|
||||
->body('Scan valid Material QR code proceed!<br>Sample formats are:<br>123456|12345|12345678|1/1 (or)<br>123456|12345|12345678|1 (or)<br>123456|12345678-1')
|
||||
->body('Scan valid Material QR code to proceed!<br>Sample formats are:<br>123456|123456789|001|5kg (or)<br>123456|12345|12345678|1/1 (or)<br>123456|12345|12345678|1 (or)<br>123456|12345678-1')
|
||||
->seconds(2)
|
||||
->send();
|
||||
$this->dispatch('playWarnSound');
|
||||
|
||||
// .Mail
|
||||
|
||||
// $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, 'InvalidMaterialFormat')
|
||||
// );
|
||||
// } else {
|
||||
// \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
||||
// }
|
||||
|
||||
$this->form->fill([
|
||||
'plant_id' => $plantId,
|
||||
'invoice_number' => $invoiceNumber,
|
||||
'serial_number' => null,
|
||||
'total_quantity' => $totQuan,
|
||||
'update_invoice' => false,
|
||||
'scanned_quantity' => $scanMQuan,
|
||||
]);
|
||||
|
||||
return;
|
||||
} elseif (empty($matches['batch_id']) || ! $matches['batch_id']) {
|
||||
Notification::make()
|
||||
->danger()
|
||||
->title('Invalid Material QR Format')
|
||||
->body('Scan valid Material QR code to proceed!<br>Sample formats are:<br>123456|123456789|001|5kg (or)<br>123456|12345|12345678|1/1 (or)<br>123456|12345|12345678|1 (or)<br>123456|12345678-1')
|
||||
->seconds(2)
|
||||
->send();
|
||||
$this->dispatch('playWarnSound');
|
||||
@@ -2508,42 +2593,7 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
Notification::make()
|
||||
->danger()
|
||||
->title('Invalid Material QR Format')
|
||||
->body('Scan valid Material QR code proceed!<br>Sample formats are:<br>123456|12345|12345678|1/1 (or)<br>123456|12345|12345678|1 (or)<br>123456|12345678-1')
|
||||
->seconds(2)
|
||||
->send();
|
||||
$this->dispatch('playWarnSound');
|
||||
|
||||
// .Mail
|
||||
|
||||
// $mailData = $this->getMail();
|
||||
// $mPlantName = $mailData['plant_name'];
|
||||
// $emails = $mailData['emails'];
|
||||
// $mInvoiceType = 'Material';
|
||||
|
||||
// if (! empty($emails)) {
|
||||
// // Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
|
||||
// Mail::to($emails)->send(
|
||||
// new InvalidSerialMail($mSerNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'InvalidMaterialFormat')
|
||||
// );
|
||||
// } else {
|
||||
// \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
||||
// }
|
||||
|
||||
$this->form->fill([
|
||||
'plant_id' => $plantId,
|
||||
'invoice_number' => $invoiceNumber,
|
||||
'serial_number' => null,
|
||||
'total_quantity' => $totQuan,
|
||||
'update_invoice' => false,
|
||||
'scanned_quantity' => $scanMQuan,
|
||||
]);
|
||||
|
||||
return;
|
||||
} elseif (! is_numeric($curScanQty)) {
|
||||
Notification::make()
|
||||
->danger()
|
||||
->title('Invalid Material QR Format')
|
||||
->body('Scan valid Material QR code proceed!<br>Sample formats are:<br>123456|12345|12345678|1/1 (or)<br>123456|12345|12345678|1 (or)<br>123456|12345678-1')
|
||||
->body('Scan valid Material QR code to proceed!<br>Sample formats are:<br>123456|123456789|001|5kg (or)<br>123456|12345|12345678|1/1 (or)<br>123456|12345|12345678|1 (or)<br>123456|12345678-1')
|
||||
->seconds(2)
|
||||
->send();
|
||||
$this->dispatch('playWarnSound');
|
||||
@@ -2580,13 +2630,48 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
$this->currentItemCode = $itemCode;
|
||||
$batchNumber = $matches['batch_number'];
|
||||
$serialNumber = $matches['batch_id'].'-'.$matches['batch_count'];
|
||||
$curMaterialSer = $matches['batch_number'].'-'.$matches['batch_id'];
|
||||
$curMaterialQty = $matches['batch_count'];
|
||||
$serNo = null;
|
||||
|
||||
if (empty($matches['batch_id']) || ! $matches['batch_id']) {
|
||||
if (empty($matches['batch_number']) || ! $matches['batch_number']) {
|
||||
Notification::make()
|
||||
->danger()
|
||||
->title('Invalid Material QR Format')
|
||||
->body('Scan valid Material QR code proceed!<br>Sample formats are:<br>123456|12345|12345678|1/1 (or)<br>123456|12345|12345678|1 (or)<br>123456|12345678-1')
|
||||
->body('Scan valid Material QR code to proceed!<br>Sample formats are:<br>123456|123456789|001|5kg (or)<br>123456|12345|12345678|1/1 (or)<br>123456|12345|12345678|1 (or)<br>123456|12345678-1')
|
||||
->seconds(2)
|
||||
->send();
|
||||
$this->dispatch('playWarnSound');
|
||||
// .Mail
|
||||
|
||||
// $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, 'InvalidMaterialFormat')
|
||||
// );
|
||||
// } else {
|
||||
// \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
|
||||
// }
|
||||
|
||||
$this->form->fill([
|
||||
'plant_id' => $plantId,
|
||||
'invoice_number' => $invoiceNumber,
|
||||
'serial_number' => null,
|
||||
'total_quantity' => $totQuan,
|
||||
'update_invoice' => false,
|
||||
'scanned_quantity' => $scanMQuan,
|
||||
]);
|
||||
|
||||
return;
|
||||
} elseif (empty($matches['batch_id']) || ! $matches['batch_id']) {
|
||||
Notification::make()
|
||||
->danger()
|
||||
->title('Invalid Material QR Format')
|
||||
->body('Scan valid Material QR code to proceed!<br>Sample formats are:<br>123456|123456789|001|5kg (or)<br>123456|12345|12345678|1/1 (or)<br>123456|12345|12345678|1 (or)<br>123456|12345678-1')
|
||||
->seconds(2)
|
||||
->send();
|
||||
$this->dispatch('playWarnSound');
|
||||
@@ -2619,7 +2704,7 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
Notification::make()
|
||||
->danger()
|
||||
->title('Invalid Material QR Format')
|
||||
->body('Scan valid Material QR code proceed!<br>Sample formats are:<br>123456|12345|12345678|1/1 (or)<br>123456|12345|12345678|1 (or)<br>123456|12345678-1')
|
||||
->body('Scan valid Material QR code to proceed!<br>Sample formats are:<br>123456|123456789|001|5kg (or)<br>123456|12345|12345678|1/1 (or)<br>123456|12345|12345678|1 (or)<br>123456|12345678-1')
|
||||
->seconds(2)
|
||||
->send();
|
||||
$this->dispatch('playWarnSound');
|
||||
@@ -2659,7 +2744,7 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
Notification::make()
|
||||
->danger()
|
||||
->title('Invalid Material QR Format')
|
||||
->body('Scan valid Material QR code proceed!<br>Sample formats are:<br>123456|12345|12345678|1/1 (or)<br>123456|12345|12345678|1 (or)<br>123456|12345678-1')
|
||||
->body('Scan valid Material QR code to proceed!<br>Sample formats are:<br>123456|123456789|001|5kg (or)<br>123456|12345|12345678|1/1 (or)<br>123456|12345|12345678|1 (or)<br>123456|12345678-1')
|
||||
->seconds(2)
|
||||
->send();
|
||||
$this->dispatch('playWarnSound');
|
||||
@@ -2693,7 +2778,7 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
Notification::make()
|
||||
->danger()
|
||||
->title('Invalid Material QR Format')
|
||||
->body('Scan valid Material QR code proceed!<br>Sample formats are:<br>123456|12345|12345678|1/1 (or)<br>123456|12345|12345678|1 (or)<br>123456|12345678-1')
|
||||
->body('Scan valid Material QR code to proceed!<br>Sample formats are:<br>123456|123456789|001|5kg (or)<br>123456|12345|12345678|1/1 (or)<br>123456|12345|12345678|1 (or)<br>123456|12345678-1')
|
||||
->seconds(2)
|
||||
->send();
|
||||
$this->dispatch('playWarnSound');
|
||||
@@ -2723,6 +2808,294 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
|
||||
return;
|
||||
}
|
||||
} elseif (preg_match($pattern4, $serNo, $matches)) {
|
||||
$wirePallet = 'MP-'.$matches['code'];
|
||||
$wirePattern = '/^MP-(?<code>\d+)$/i';
|
||||
|
||||
if (! preg_match($wirePattern, $serNo, $matches)) {
|
||||
Notification::make()
|
||||
->title('Invalid Master Packing QR Format')
|
||||
->body("Scan valid Master Packing QR code proceed!<br>Sample format : 'MP-2601001'")
|
||||
->danger()
|
||||
->seconds(1)
|
||||
->send();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$wireMaster = WireMasterPacking::where('plant_id', $plantId)->where('wire_packing_number', $wirePallet)->first();
|
||||
|
||||
if (! $wireMaster) {
|
||||
Notification::make()
|
||||
->title('Master Pallet Not Found')
|
||||
->body("No record found for this Master Packing QR $wirePallet")
|
||||
->danger()
|
||||
->seconds(2)
|
||||
->send();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$wireItemCodes = WireMasterPacking::join('items', 'items.id', '=', 'wire_master_packings.item_id')
|
||||
->where('wire_master_packings.plant_id', $plantId)
|
||||
->where('wire_master_packings.wire_packing_number', $wirePallet)
|
||||
->pluck('items.code')
|
||||
->unique()
|
||||
->toArray();
|
||||
|
||||
$invoiceItemCodes = InvoiceValidation::join(
|
||||
'sticker_masters',
|
||||
'sticker_masters.id',
|
||||
'=',
|
||||
'invoice_validations.sticker_master_id'
|
||||
)
|
||||
->join(
|
||||
'items',
|
||||
'items.id',
|
||||
'=',
|
||||
'sticker_masters.item_id'
|
||||
)
|
||||
->where('invoice_validations.plant_id', $plantId)
|
||||
->where('invoice_validations.invoice_number', $this->invoiceNumber)
|
||||
->pluck('items.code')
|
||||
->unique()
|
||||
->toArray();
|
||||
|
||||
$missedCodes = array_diff($wireItemCodes, $invoiceItemCodes);
|
||||
|
||||
if (! empty($missedCodes)) {
|
||||
|
||||
Notification::make()
|
||||
->title('Items Missing in Invoice')
|
||||
->body('Item codes are missing in invoice: '.implode(', ', $missedCodes))
|
||||
->danger()
|
||||
->seconds(3)
|
||||
->send();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$duplicateSerial = [];
|
||||
$weightExceeded = [];
|
||||
$processedItems = [];
|
||||
$invalidMaterialItems = [];
|
||||
|
||||
$wireItems1 = WireMasterPacking::join('items', 'items.id', '=', 'wire_master_packings.item_id')
|
||||
->where('wire_master_packings.plant_id', $plantId)
|
||||
->where('wire_master_packings.wire_packing_number', $wirePallet)
|
||||
->select(
|
||||
'items.code as item_code',
|
||||
'wire_master_packings.process_order',
|
||||
DB::raw('SUM(wire_master_packings.weight::numeric) as pallet_weight')
|
||||
)
|
||||
->groupBy('items.code', 'wire_master_packings.process_order')
|
||||
->get();
|
||||
|
||||
foreach ($wireItems1 as $wireItem) {
|
||||
$processOrder = $wireItem->process_order;
|
||||
$palletWeight = $wireItem->pallet_weight;
|
||||
$itemCode = $wireItem->item_code;
|
||||
|
||||
$processedItems[] = $itemCode;
|
||||
|
||||
$duplicate = InvoiceValidation::where('plant_id', $this->plantId)
|
||||
->where('invoice_number', $this->invoiceNumber)
|
||||
->where('serial_number', $processOrder)
|
||||
->exists();
|
||||
|
||||
if ($duplicate) {
|
||||
$duplicateSerial[] = $processOrder;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$materialType = StickerMaster::where('item_id', function ($q) use ($itemCode) {
|
||||
$q->select('id')->from('items')->where('code', $itemCode);
|
||||
})->value('material_type');
|
||||
|
||||
if ($materialType != 3) {
|
||||
if (! in_array($itemCode, $invalidMaterialItems)) {
|
||||
$invalidMaterialItems[] = $itemCode;
|
||||
}
|
||||
}
|
||||
|
||||
$scannedQty = InvoiceValidation::join('sticker_masters', 'sticker_masters.id', '=', 'invoice_validations.sticker_master_id')
|
||||
->join('items', 'items.id', '=', 'sticker_masters.item_id')
|
||||
->where('invoice_validations.plant_id', $plantId)
|
||||
->where('invoice_validations.invoice_number', $this->invoiceNumber)
|
||||
->where('items.code', $itemCode)
|
||||
->sum(DB::raw('invoice_validations.quantity::numeric'));
|
||||
|
||||
if ($palletWeight > $scannedQty) {
|
||||
$weightExceeded[] = $itemCode;
|
||||
}
|
||||
}
|
||||
|
||||
if (! empty($invalidMaterialItems)) {
|
||||
$uniqueInvalidItems = array_unique($invalidMaterialItems);
|
||||
Notification::make()
|
||||
->title('Invalid Material Type')
|
||||
->body(implode(', ', $uniqueInvalidItems)."<br>Invalid material type found for the invoice '$invoiceNumber'.")
|
||||
->danger()
|
||||
->seconds(4)
|
||||
->send();
|
||||
|
||||
return;
|
||||
} elseif (! empty($weightExceeded)) {
|
||||
Notification::make()
|
||||
->title('Item Code Limit')
|
||||
->body(implode(', ', $weightExceeded)."<br>Master pallet weight exceeds the remaining quantity in invoice '$invoiceNumber'.")
|
||||
->danger()
|
||||
->seconds(4)
|
||||
->send();
|
||||
|
||||
return;
|
||||
} elseif (! empty($duplicateSerial)) {
|
||||
Notification::make()
|
||||
->title('Duplicate Serial Number')
|
||||
->body(implode(', ', $duplicateSerial)."<br>Duplicate Serial numbers found for the invoice '$invoiceNumber'.")
|
||||
->danger()
|
||||
->seconds(4)
|
||||
->send();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$itemExceeded = [];
|
||||
|
||||
$invoiceRows = InvoiceValidation::where('plant_id', $plantId)
|
||||
->where('invoice_number', $invoiceNumber)
|
||||
->whereNull('serial_number')
|
||||
->get();
|
||||
|
||||
$palletItems = WireMasterPacking::where('wire_master_packings.plant_id', $plantId)
|
||||
->where('wire_master_packings.wire_packing_number', $wirePallet)
|
||||
->join('items', 'items.id', '=', 'wire_master_packings.item_id')
|
||||
->select(
|
||||
'items.code as item_code',
|
||||
DB::raw('SUM(wire_master_packings.weight::numeric) as pallet_weight')
|
||||
)
|
||||
->groupBy('items.code')
|
||||
->get();
|
||||
|
||||
foreach ($invoiceRows as $row) {
|
||||
$itemCode = $row->stickerMaster->item->code ?? null;
|
||||
|
||||
if (! $itemCode) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$pallet = $palletItems->firstWhere('item_code', $itemCode);
|
||||
$palletWeight = $pallet->pallet_weight ?? 0;
|
||||
|
||||
$remainingQty = $row->quantity;
|
||||
|
||||
if ($palletWeight > $remainingQty) {
|
||||
$itemExceeded[] = $itemCode;
|
||||
}
|
||||
}
|
||||
|
||||
$items = implode(', ', $itemExceeded);
|
||||
|
||||
if (! empty($itemExceeded)) {
|
||||
Notification::make()
|
||||
->title('Item Code Limit')
|
||||
->body("Pallet weight exceeds remaining quantity for invoice number '$invoiceNumber'for below item codes <br>$items")
|
||||
->danger()
|
||||
->seconds(5)
|
||||
->send();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$wireItems = WireMasterPacking::join('items', 'items.id', '=', 'wire_master_packings.item_id')
|
||||
->where('wire_master_packings.wire_packing_number', $wirePallet)
|
||||
->select(
|
||||
'items.code as item_code',
|
||||
'wire_master_packings.process_order',
|
||||
'wire_master_packings.weight as pallet_weight'
|
||||
// DB::raw('(wire_master_packings.weight::numeric) as pallet_weight')
|
||||
)
|
||||
->get();
|
||||
|
||||
foreach ($wireItems as $wireItem) {
|
||||
|
||||
$itemCode = $wireItem->item_code;
|
||||
$palletWeight = $wireItem->pallet_weight;
|
||||
$processOrder = $wireItem->process_order;
|
||||
|
||||
if (! $processOrder || $palletWeight <= 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$records = InvoiceValidation::join('sticker_masters', 'sticker_masters.id', '=', 'invoice_validations.sticker_master_id')
|
||||
->join('items', 'items.id', '=', 'sticker_masters.item_id')
|
||||
->where('invoice_validations.invoice_number', $invoiceNumber)
|
||||
->where('invoice_validations.plant_id', $plantId)
|
||||
->where('items.code', $itemCode)
|
||||
->whereNull('invoice_validations.serial_number')
|
||||
->where('invoice_validations.quantity', '>', 0)
|
||||
->orderBy('invoice_validations.created_at')
|
||||
->select('invoice_validations.*')
|
||||
->get();
|
||||
|
||||
if ($records->isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
foreach ($records as $record) {
|
||||
|
||||
if ($palletWeight <= 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
$usedQty = min($record->quantity, $palletWeight);
|
||||
|
||||
$record->quantity -= $usedQty;
|
||||
|
||||
if ($usedQty == $record->quantity + $usedQty) {
|
||||
$record->serial_number = $processOrder;
|
||||
$record->quantity = $palletWeight;
|
||||
$record->save();
|
||||
} else {
|
||||
$record->save();
|
||||
|
||||
InvoiceValidation::create([
|
||||
'sticker_master_id' => $record->sticker_master_id,
|
||||
'plant_id' => $plantId,
|
||||
'invoice_number' => $invoiceNumber,
|
||||
'serial_number' => $processOrder,
|
||||
'quantity' => $usedQty,
|
||||
'operator_id' => $operatorName,
|
||||
'created_by' => $operatorName,
|
||||
'updated_by' => $operatorName,
|
||||
]);
|
||||
}
|
||||
|
||||
$palletWeight -= $usedQty;
|
||||
|
||||
// if ($record->quantity <= 0) {
|
||||
// $records->forget($key);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
$this->dispatch('refreshMaterialInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId);
|
||||
|
||||
$totQuan = InvoiceValidation::where('plant_id', $plantId)->where('invoice_number', $invoiceNumber)->count();
|
||||
|
||||
$scanMQuan = InvoiceValidation::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' => $scanMQuan,
|
||||
]);
|
||||
|
||||
return;
|
||||
} else {
|
||||
$itemCode = null;
|
||||
$this->currentItemCode = '';
|
||||
@@ -2733,7 +3106,7 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
Notification::make()
|
||||
->danger()
|
||||
->title('Invalid Material QR Format')
|
||||
->body('Scan valid Material QR code proceed!<br>Sample formats are:<br>123456|12345|12345678|1/1 (or)<br>123456|12345|12345678|1 (or)<br>123456|12345678-1')
|
||||
->body('Scan valid Material QR code to proceed!<br>Sample formats are:<br>123456|123456789|001|5kg (or)<br>123456|12345|12345678|1/1 (or)<br>123456|12345|12345678|1 (or)<br>123456|12345678-1')
|
||||
->seconds(1)
|
||||
->send();
|
||||
|
||||
@@ -2866,6 +3239,12 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
|
||||
$hasQuanTyp = ($record->material_type == 3) ? true : false;
|
||||
|
||||
if ($hasQuanTyp && $curMaterialSer && $curMaterialQty) {
|
||||
$batchNumber = null;
|
||||
$serialNumber = $curMaterialSer;
|
||||
$curScanQty = $curMaterialQty;
|
||||
}
|
||||
|
||||
$record = InvoiceValidation::where('invoice_number', $invoiceNumber)
|
||||
->where('plant_id', $plantId)
|
||||
->whereHas('stickerMasterRelation.item', function ($query) use ($itemCode) {
|
||||
@@ -2948,7 +3327,7 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
Notification::make()
|
||||
->danger()
|
||||
->title('Invalid Quantity Material QR Format')
|
||||
->body('Scan valid Quantity Material QR code proceed!<br>Ex:123456|12345|12345678|1/1')
|
||||
->body('Scan valid Quantity Material QR code to proceed!<br>Sample formats are:<br>123456|123456789|001|5kg (or)<br>123456|12345|12345678|1/1 (or)<br>123456|12345|12345678|1')
|
||||
->seconds(2)
|
||||
->send();
|
||||
$this->dispatch('playWarnSound');
|
||||
@@ -2994,8 +3373,8 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
$record->serial_number = $serialNumber;
|
||||
$record->batch_number = $batchNumber;
|
||||
$record->operator_id = $operatorName;
|
||||
// $record->updated_by = $operatorName;
|
||||
// $record->updated_at = now();
|
||||
$record->updated_by = $operatorName;
|
||||
$record->updated_at = now();
|
||||
$record->save();
|
||||
|
||||
// InvoiceValidation::create([
|
||||
@@ -3231,7 +3610,6 @@ class CreateInvoiceValidation extends CreateRecord
|
||||
}
|
||||
|
||||
$record = InvoiceValidation::where('serial_number', $serialNumber)->where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->first();
|
||||
// $invoiceNumber = $this->form->getState()['invoice_number'];
|
||||
|
||||
if (! $record) {
|
||||
Notification::make()
|
||||
|
||||
@@ -132,7 +132,7 @@ class PlantResource extends Resource
|
||||
->hint(fn ($get) => $get('pNameError') ? $get('pNameError') : null)
|
||||
->hintColor('danger'),
|
||||
Forms\Components\TextInput::make('warehouse_number')
|
||||
->required()
|
||||
// ->required()
|
||||
->label('Warehouse Number')
|
||||
->placeholder('Scan the valid warehouse number')
|
||||
->unique(ignoreRecord: true)
|
||||
|
||||
@@ -339,8 +339,9 @@ class ProductionCharacteristicResource extends Resource
|
||||
// return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
|
||||
})
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('Item', null);
|
||||
$set('Line', null);
|
||||
$set('Item', null);
|
||||
$set('Machine', null);
|
||||
}),
|
||||
Select::make('Line')
|
||||
->label('Search by Line Name')
|
||||
@@ -361,7 +362,7 @@ class ProductionCharacteristicResource extends Resource
|
||||
})->pluck('name', 'id');
|
||||
})
|
||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||
$set('process_order', null);
|
||||
$set('Machine', null);
|
||||
}),
|
||||
Select::make('Item')
|
||||
->label('Search by Item Code')
|
||||
|
||||
@@ -203,7 +203,6 @@ class ProductionOrderResource extends Resource
|
||||
->label('Production Order')
|
||||
->readOnly()
|
||||
->visible(fn ($get) => $get('quantity') > 0),
|
||||
// ->visible(fn ($get) => $get('show_extra_fields')),
|
||||
Forms\Components\TextInput::make('from_serial_number')
|
||||
->label('From Serial Number')
|
||||
->readOnly()
|
||||
|
||||
@@ -245,7 +245,6 @@ class CreateProductionOrder extends CreateRecord
|
||||
} else {
|
||||
return redirect()->route('production-orders.printpanel', ['production_order' => $pOrder, 'plant_code' => $plantCode]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected function getFormActions(): array
|
||||
|
||||
@@ -94,7 +94,7 @@ class QualityValidationResource extends Resource
|
||||
Forms\Components\Hidden::make('plant')
|
||||
->default(fn () => session('last_selected_plant_id'))
|
||||
->afterStateHydrated(function ($state, $set) {
|
||||
if (!$state && request()->has('plant_id')) {
|
||||
if (! $state && request()->has('plant_id')) {
|
||||
$set('plant_id', request()->get('plant_id'));
|
||||
}
|
||||
}),
|
||||
@@ -136,7 +136,7 @@ class QualityValidationResource extends Resource
|
||||
Forms\Components\Hidden::make('line')
|
||||
->default(fn () => session('last_selected_line'))
|
||||
->afterStateHydrated(function ($state, $set) {
|
||||
if (!$state && request()->has('line_id')) {
|
||||
if (! $state && request()->has('line_id')) {
|
||||
$set('line_id', request()->get('line_id'));
|
||||
}
|
||||
}),
|
||||
@@ -178,7 +178,7 @@ class QualityValidationResource extends Resource
|
||||
Forms\Components\Hidden::make('production')
|
||||
->default(fn () => session('last_selected_production'))
|
||||
->afterStateHydrated(function ($state, $set) {
|
||||
if (!$state && request()->has('production_order')) {
|
||||
if (! $state && request()->has('production_order')) {
|
||||
$set('production_order', request()->get('production_order'));
|
||||
}
|
||||
}),
|
||||
@@ -2423,7 +2423,6 @@ class QualityValidationResource extends Resource
|
||||
$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(
|
||||
@@ -2519,7 +2518,6 @@ class QualityValidationResource extends Resource
|
||||
$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(
|
||||
@@ -2711,7 +2709,6 @@ class QualityValidationResource extends Resource
|
||||
$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(
|
||||
@@ -2864,16 +2861,6 @@ class QualityValidationResource extends Resource
|
||||
'showChecklist' => $livewire->showChecklist,
|
||||
]),
|
||||
|
||||
// Forms\Components\View::make('components.production-checklist-wrapper')
|
||||
// ->statePath('checklist')
|
||||
// ->key('checklist-view')
|
||||
// ->viewData(fn ($livewire) => [
|
||||
// 'existingRecords' => is_array($livewire->existingRecords)
|
||||
// ? $livewire->existingRecords
|
||||
// : $livewire->existingRecords->toArray(),
|
||||
// 'showChecklist' => $livewire->showChecklist,
|
||||
// ]),
|
||||
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -3066,7 +3053,6 @@ class QualityValidationResource extends Resource
|
||||
])
|
||||
|
||||
->filters([
|
||||
|
||||
Tables\Filters\TrashedFilter::make(),
|
||||
Filter::make('advanced_filters')
|
||||
->label('Advanced Filters')
|
||||
|
||||
@@ -630,7 +630,7 @@ class TestingPanelReadingResource extends Resource
|
||||
->options(function () {
|
||||
// return Plant::pluck('name', 'id');
|
||||
$userHas = Filament::auth()->user()->plant_id;
|
||||
|
||||
|
||||
if ($userHas && strlen($userHas) > 0) {
|
||||
return Plant::where('id', $userHas)->pluck('name', 'id')->toArray();
|
||||
} else {
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Filament\Resources\WireMasterPackingResource\Pages;
|
||||
|
||||
use App\Filament\Resources\WireMasterPackingResource;
|
||||
use App\Models\CustomerPoMaster;
|
||||
use App\Models\Item;
|
||||
use App\Models\Plant;
|
||||
use App\Models\WireMasterPacking;
|
||||
@@ -81,7 +82,9 @@ class CreateWireMasterPacking extends CreateRecord
|
||||
return;
|
||||
}
|
||||
|
||||
$pattern = '/^([^|]+)\|([^|]+)\|(\d+(\.\d+)?)$/';
|
||||
// $pattern = '/^([^|]+)\|([^|]+)\|(\d+(\.\d+)?)$/';
|
||||
// $pattern = '/^([^|]+)\|([^|]+)\|([^|]+)\|(\d+(\.\d+)?)$/';
|
||||
$pattern = '/^([^|]+)\|([^|]+)\|([^|]+)\|(\d+(\.\d+)?)(kg)?$/i';
|
||||
|
||||
if (!preg_match($pattern, $processOrder, $matches))
|
||||
{
|
||||
@@ -106,7 +109,8 @@ class CreateWireMasterPacking extends CreateRecord
|
||||
|
||||
$materialCode = $matches[1];
|
||||
$processOrderId = $matches[2];
|
||||
$weight = $matches[3];
|
||||
$coilNo = $matches[3];
|
||||
$weight = $matches[4];
|
||||
|
||||
$icode = Item::where('code', $materialCode)->first();
|
||||
|
||||
@@ -160,7 +164,34 @@ class CreateWireMasterPacking extends CreateRecord
|
||||
return;
|
||||
}
|
||||
|
||||
$processOrderAgaPlant = WireMasterPacking::where('process_order', $processOrderId)->where('plant_id', $plantId)->first();
|
||||
$itemId = Item::where('code', $materialCode)
|
||||
->where('plant_id', $plantId)
|
||||
->value('id');
|
||||
|
||||
$icodeAgaCPoPlant = CustomerPoMaster::where('item_id', $itemId)->where('plant_id', $plantId)->first();
|
||||
|
||||
if(!$icodeAgaCPoPlant)
|
||||
{
|
||||
Notification::make()
|
||||
->title("Unknown Item Code in Customer PO")
|
||||
->body("Item Code '$materialCode' not found in any active Customer PO against Plant Code '$plantcode'")
|
||||
->danger()
|
||||
->duration(5000)
|
||||
->send();
|
||||
|
||||
$this->form->fill([
|
||||
'process_order' => null,
|
||||
'plant_id' => $plantId,
|
||||
'customer_po_master_id' => $customerPo,
|
||||
'wire_packing_number' => $wirePackNo,
|
||||
'Sno_quantity' => 0,
|
||||
'created_by' => $operatorName,
|
||||
'scanned_by' => $operatorName,
|
||||
]);
|
||||
return;
|
||||
}
|
||||
|
||||
$processOrderAgaPlant = WireMasterPacking::where('process_order', $processOrderId . '-' . $coilNo)->where('plant_id', $plantId)->first();
|
||||
|
||||
if($processOrderAgaPlant)
|
||||
{
|
||||
@@ -182,6 +213,68 @@ class CreateWireMasterPacking extends CreateRecord
|
||||
]);
|
||||
return;
|
||||
}
|
||||
|
||||
$customerPoRecord = CustomerPoMaster::where('id', $customerPo)
|
||||
->where('plant_id', $plantId)
|
||||
->first();
|
||||
|
||||
$customerPoName = $customerPoRecord->customer_po;
|
||||
|
||||
if ($customerPoRecord) {
|
||||
$customerPoName = $customerPoRecord->customer_po;
|
||||
} else {
|
||||
$customerPoName = null;
|
||||
}
|
||||
|
||||
if(!$customerPoRecord)
|
||||
{
|
||||
Notification::make()
|
||||
->title("PO Not Found")
|
||||
->body("Customer PO '$customerPoName' for Item '$materialCode' not found against Plant '$plantcode'")
|
||||
->danger()
|
||||
->duration(5000)
|
||||
->send();
|
||||
|
||||
$this->form->fill([
|
||||
'process_order' => null,
|
||||
'plant_id' => $plantId,
|
||||
'customer_po_master_id' => $customerPo,
|
||||
'wire_packing_number' => $wirePackNo,
|
||||
'Sno_quantity' => 0,
|
||||
'created_by' => $operatorName,
|
||||
'scanned_by' => $operatorName,
|
||||
]);
|
||||
return;
|
||||
}
|
||||
|
||||
$alreadyScannedQty = WireMasterPacking::where('customer_po_master_id', $customerPo)
|
||||
->where('plant_id', $plantId)
|
||||
->where('item_id', $itemId)
|
||||
->selectRaw('SUM(CAST(weight AS NUMERIC)) as total_weight')
|
||||
->value('total_weight');
|
||||
|
||||
$totalQty = (float)$alreadyScannedQty + (float)$weight;
|
||||
|
||||
if($totalQty > (float)$customerPoRecord->quantity)
|
||||
{
|
||||
Notification::make()
|
||||
->title("Scanned Weight Exceeds PO Quantity")
|
||||
->body("Scanned weight '$weight' and already scanned weight '$alreadyScannedQty' exceeds allowed quantity '{$customerPoRecord->quantity}' for PO '$customerPoName' and Item '$materialCode'")
|
||||
->danger()
|
||||
->duration(5000)
|
||||
->send();
|
||||
|
||||
$this->form->fill([
|
||||
'process_order' => null,
|
||||
'plant_id' => $plantId,
|
||||
'customer_po_master_id' => $customerPo,
|
||||
'wire_packing_number' => $wirePackNo,
|
||||
'Sno_quantity' => 0,
|
||||
'created_by' => $operatorName,
|
||||
'scanned_by' => $operatorName,
|
||||
]);
|
||||
return;
|
||||
}
|
||||
try
|
||||
{
|
||||
$existingPallet = WireMasterPacking::where('plant_id', $plantId)
|
||||
@@ -200,7 +293,7 @@ class CreateWireMasterPacking extends CreateRecord
|
||||
'plant_id' => $plantId,
|
||||
'item_id' => $itemId,
|
||||
'wire_packing_number' => $wirePackNo,
|
||||
'process_order' => $processOrderId,
|
||||
'process_order' => $processOrderId . '-' . $coilNo,
|
||||
'customer_po_master_id' => $customerPo,
|
||||
'weight' => $weight,
|
||||
'created_by' => $createdBy,
|
||||
@@ -590,6 +683,33 @@ class CreateWireMasterPacking extends CreateRecord
|
||||
return;
|
||||
}
|
||||
|
||||
$pattern = '/^([^|]+)\|([^|]+)\|([^|]+)\|(\d+(\.\d+)?)(kg)?$/i';
|
||||
|
||||
if (!preg_match($pattern, $processOrder, $matches))
|
||||
{
|
||||
Notification::make()
|
||||
->title("Scan Valid Qr code ")
|
||||
->body("Expected Format : (MaterialCode|Process Order|Id|Weight)")
|
||||
->danger()
|
||||
->duration(5000)
|
||||
->send();
|
||||
|
||||
$this->form->fill([
|
||||
'process_order' => null,
|
||||
'plant_id' => $plantId,
|
||||
'customer_po_master_id' => $customerPo,
|
||||
'Sno_quantity' => 0,
|
||||
'created_by' => $operatorName,
|
||||
'scanned_by' => $operatorName,
|
||||
]);
|
||||
return;
|
||||
}
|
||||
|
||||
$materialCode = $matches[1];
|
||||
$processOrderId = $matches[2];
|
||||
$coilNo = $matches[3];
|
||||
$weight = $matches[4];
|
||||
|
||||
$count = WireMasterPacking::where('plant_id', $plantId)
|
||||
->where('wire_packing_number', $palletNumber)
|
||||
->count('wire_packing_number');
|
||||
@@ -618,7 +738,7 @@ class CreateWireMasterPacking extends CreateRecord
|
||||
|
||||
|
||||
$processOrderexist = WireMasterPacking::where('plant_id', $plantId)
|
||||
->where('process_order', $processOrder)
|
||||
->where('process_order', $processOrderId . '-' . $coilNo)
|
||||
->first();
|
||||
if (!$processOrderexist)
|
||||
{
|
||||
@@ -643,7 +763,7 @@ class CreateWireMasterPacking extends CreateRecord
|
||||
}
|
||||
|
||||
$palletExist = WireMasterPacking::where('plant_id', $plantId)
|
||||
->where('process_order', $processOrder)
|
||||
->where('process_order', $processOrderId . '-' . $coilNo)
|
||||
->where('wire_packing_number', '!=', '')
|
||||
->where('wire_packing_number', '!=', null)
|
||||
->first();
|
||||
@@ -673,7 +793,7 @@ class CreateWireMasterPacking extends CreateRecord
|
||||
|
||||
$deleted = WireMasterPacking::where('plant_id', $plantId)
|
||||
->where('wire_packing_number', $palletNumber)
|
||||
->where('process_order', $processOrder)
|
||||
->where('process_order', $processOrderId . '-' . $coilNo)
|
||||
->forceDelete();
|
||||
|
||||
if ($deleted)
|
||||
|
||||
@@ -520,9 +520,9 @@ class CharacteristicsController extends Controller
|
||||
|
||||
if (Str::contains($modelHeading, 'PRESSURE BOOSTER SYSTEM', ignoreCase: true)) {
|
||||
$typesToCreate = ['MOTOR', 'PUMP', 'NAME_PLATE'];
|
||||
} elseif (Str::contains($modelHeading, 'PUMPSET', ignoreCase: true)) {
|
||||
} elseif (Str::contains($modelHeading, 'PUMPS', ignoreCase: true) || Str::contains($modelHeading, 'PUMPSET', ignoreCase: true)) {
|
||||
$typesToCreate = ['MOTOR', 'PUMP'];
|
||||
} elseif (Str::contains($modelHeading, 'PUMP', ignoreCase: true) && ! Str::contains($modelHeading, 'PUMP SET', ignoreCase: true) && ! Str::contains($modelHeading, 'PUMPSET', ignoreCase: true)) {
|
||||
} elseif (Str::contains($modelHeading, 'PUMP', ignoreCase: true) && ! Str::contains($modelHeading, 'PUMP SET', ignoreCase: true) && ! Str::contains($modelHeading, 'PUMPSET', ignoreCase: true) && ! Str::contains($modelHeading, 'PUMPS', ignoreCase: true)) {
|
||||
$typesToCreate = ['PUMP'];
|
||||
} elseif (Str::contains($modelHeading, 'MOTOR', ignoreCase: true)) {
|
||||
$typesToCreate = ['MOTOR'];
|
||||
@@ -649,7 +649,7 @@ class CharacteristicsController extends Controller
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Serial number '{$serialNumber}' doesn't have name plate model to proceed!",
|
||||
], 404);
|
||||
} elseif (Str::contains($curHead, 'PUMP', ignoreCase: true) && ! Str::contains($curHead, 'PUMP SET', ignoreCase: true) && ! Str::contains($curHead, 'PUMPSET', ignoreCase: true)) {
|
||||
} elseif (Str::contains($curHead, 'PUMP', ignoreCase: true) && ! Str::contains($curHead, 'PUMP SET', ignoreCase: true) && ! Str::contains($curHead, 'PUMPSET', ignoreCase: true) && ! Str::contains($curHead, 'PUMPS', ignoreCase: true)) {
|
||||
if ($modelType == 'MOTOR') {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
@@ -673,7 +673,7 @@ class CharacteristicsController extends Controller
|
||||
// 'status_description' => "Serial number '{$serialNumber}' doesn't have pumpset model to proceed!",
|
||||
// ], 404);
|
||||
}
|
||||
} elseif (! Str::contains($curHead, 'PUMPSET', ignoreCase: true)) {
|
||||
} elseif (! Str::contains($curHead, 'PUMPS', ignoreCase: true) && ! Str::contains($curHead, 'PUMPSET', ignoreCase: true)) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Serial number '{$serialNumber}' doesn't have valid model type to proceed!",
|
||||
@@ -794,6 +794,7 @@ class CharacteristicsController extends Controller
|
||||
|
||||
if ($char['motor_pump_pumpset_status'] == '3') {
|
||||
if ($modelType == 'MOTOR') {
|
||||
$curMMach = $char['motor_machine_name'] ?? $curMMach;
|
||||
$motPhysiCnt = $motPhysiCnt + 1;
|
||||
$motExpecTim = $motExpecTim + $expectedTime;
|
||||
if ($motPhysiCnt >= $mvhsCnt) {
|
||||
@@ -801,6 +802,7 @@ class CharacteristicsController extends Controller
|
||||
}
|
||||
$curMotorMarkBy = ($char['motor_marked_by'] == 'jothi') ? 'Admin' : $char['motor_marked_by'] ?? $curMotorMarkBy;
|
||||
} elseif ($modelType == 'PUMP') {
|
||||
$curPMach = $char['pump_machine_name'] ?? $curPMach;
|
||||
$pumPhysiCnt = $pumPhysiCnt + 1;
|
||||
$pumExpecTim = $pumExpecTim + $expectedTime;
|
||||
if ($pumPhysiCnt >= $mvhsCnt) {
|
||||
@@ -808,6 +810,7 @@ class CharacteristicsController extends Controller
|
||||
}
|
||||
$curPumpMarkBy = ($char['pump_marked_by'] == 'jothi') ? 'Admin' : $char['pump_marked_by'] ?? $curPumpMarkBy;
|
||||
} elseif ($modelType == 'NAME_PLATE') {
|
||||
$curNpMach = $char['name_plate_machine_name'] ?? $curNpMach;
|
||||
$napExpecTim = $napExpecTim + $expectedTime;
|
||||
$curNamePlateMarkStat = 'Marked';
|
||||
$curNamePlateMarkBy = ($char['name_plate_marked_by'] == 'jothi') ? 'Admin' : $char['name_plate_marked_by'] ?? $curNamePlateMarkBy;
|
||||
@@ -840,9 +843,9 @@ class CharacteristicsController extends Controller
|
||||
'name_plate_marked_by' => $curNamePlateMarkBy,
|
||||
'motor_pump_pumpset_status' => '3',
|
||||
'winded_serial_number' => $char['winded_serial_number'] ?? $curWindNo,
|
||||
'motor_machine_name' => $char['motor_machine_name'] ?? $curMMach,
|
||||
'pump_machine_name' => $char['pump_machine_name'] ?? $curPMach,
|
||||
'name_plate_machine_name' => $char['name_plate_machine_name'] ?? $curNpMach,
|
||||
'motor_machine_name' => $curMMach,
|
||||
'pump_machine_name' => $curPMach,
|
||||
'name_plate_machine_name' => $curNpMach,
|
||||
'part_validation_1' => $char['part_validation_1'] ?? $curPart1,
|
||||
'part_validation_2' => $char['part_validation_2'] ?? $curPart2,
|
||||
'samlight_logged_name' => $char['samlight_logged_name'] ?? $slUser,
|
||||
@@ -874,10 +877,10 @@ class CharacteristicsController extends Controller
|
||||
'name_plate_expected_time' => (string) $napExpecTim,
|
||||
'name_plate_marked_by' => $curNamePlateMarkBy,
|
||||
'motor_pump_pumpset_status' => '3',
|
||||
// 'winded_serial_number' => $char['winded_serial_number'] ?? $curWindNo,
|
||||
'winded_serial_number' => $char['winded_serial_number'] ?? $curWindNo,
|
||||
'name_plate_machine_name' => $char['name_plate_machine_name'] ?? $curNpMach,
|
||||
// 'part_validation_1' => $char['part_validation_1'] ?? $curPart1,
|
||||
// 'part_validation_2' => $char['part_validation_2'] ?? $curPart2,
|
||||
'part_validation_1' => $char['part_validation_1'] ?? $curPart1,
|
||||
'part_validation_2' => $char['part_validation_2'] ?? $curPart2,
|
||||
'samlight_logged_name' => $char['samlight_logged_name'] ?? $slUser,
|
||||
'pending_released_status' => $char['pending_released_status'] ?? 0,
|
||||
'has_work_flow_id' => $char['has_work_flow_id'] ?? $curWorkFlow,
|
||||
@@ -913,10 +916,10 @@ class CharacteristicsController extends Controller
|
||||
'pump_expected_time' => (string) $pumExpecTim,
|
||||
'pump_marked_by' => $curPumpMarkBy,
|
||||
'motor_pump_pumpset_status' => '3',
|
||||
// 'winded_serial_number' => $char['winded_serial_number'] ?? $curWindNo,
|
||||
'winded_serial_number' => $char['winded_serial_number'] ?? $curWindNo,
|
||||
'pump_machine_name' => $char['pump_machine_name'] ?? $curPMach,
|
||||
// 'part_validation_1' => $char['part_validation_1'] ?? $curPart1,
|
||||
// 'part_validation_2' => $char['part_validation_2'] ?? $curPart2,
|
||||
'part_validation_1' => $char['part_validation_1'] ?? $curPart1,
|
||||
'part_validation_2' => $char['part_validation_2'] ?? $curPart2,
|
||||
'samlight_logged_name' => $char['samlight_logged_name'] ?? $slUser,
|
||||
'pending_released_status' => $char['pending_released_status'] ?? 0,
|
||||
'has_work_flow_id' => $char['has_work_flow_id'] ?? $curWorkFlow,
|
||||
@@ -964,6 +967,7 @@ class CharacteristicsController extends Controller
|
||||
// $values = array_merge($values1 ?? [], $values2 ?? [], $values3 ?? [], $values4 ?? [], $values5 ?? []);
|
||||
} elseif ($hasMvhs == true) {
|
||||
if ($modelType == 'MOTOR') {
|
||||
$curMMach = $char['motor_machine_name'] ?? $curMMach;
|
||||
$motPhysiCnt = $motPhysiCnt + 1;
|
||||
$motExpecTim = $motExpecTim + $expectedTime;
|
||||
if ($motPhysiCnt >= $mvhsCnt) {
|
||||
@@ -971,6 +975,7 @@ class CharacteristicsController extends Controller
|
||||
}
|
||||
$curMotorMarkBy = ($char['motor_marked_by'] == 'jothi') ? 'Admin' : $char['motor_marked_by'] ?? $curMotorMarkBy;
|
||||
} elseif ($modelType == 'PUMP') {
|
||||
$curPMach = $char['pump_machine_name'] ?? $curPMach;
|
||||
$pumPhysiCnt = $pumPhysiCnt + 1;
|
||||
$pumExpecTim = $pumExpecTim + $expectedTime;
|
||||
if ($pumPhysiCnt >= $mvhsCnt) {
|
||||
@@ -978,6 +983,7 @@ class CharacteristicsController extends Controller
|
||||
}
|
||||
$curPumpMarkBy = ($char['pump_marked_by'] == 'jothi') ? 'Admin' : $char['pump_marked_by'] ?? $curPumpMarkBy;
|
||||
} elseif ($modelType == 'NAME_PLATE') {
|
||||
$curNpMach = $char['name_plate_machine_name'] ?? $curNpMach;
|
||||
$napExpecTim = $napExpecTim + $expectedTime;
|
||||
$curNamePlateMarkStat = 'Marked';
|
||||
$curNamePlateMarkBy = ($char['name_plate_marked_by'] == 'jothi') ? 'Admin' : $char['name_plate_marked_by'] ?? $curNamePlateMarkBy;
|
||||
@@ -1008,9 +1014,9 @@ class CharacteristicsController extends Controller
|
||||
'name_plate_marked_by' => $curNamePlateMarkBy,
|
||||
'motor_pump_pumpset_status' => null,
|
||||
'winded_serial_number' => $char['winded_serial_number'] ?? $curWindNo,
|
||||
'motor_machine_name' => $char['motor_machine_name'] ?? $curMMach,
|
||||
'pump_machine_name' => $char['pump_machine_name'] ?? $curPMach,
|
||||
'name_plate_machine_name' => $char['name_plate_machine_name'] ?? $curNpMach,
|
||||
'motor_machine_name' => $curMMach,
|
||||
'pump_machine_name' => $curPMach,
|
||||
'name_plate_machine_name' => $curNpMach,
|
||||
'part_validation_1' => $char['part_validation_1'] ?? $curPart1,
|
||||
'part_validation_2' => $char['part_validation_2'] ?? $curPart2,
|
||||
'samlight_logged_name' => $char['samlight_logged_name'] ?? $slUser,
|
||||
@@ -1021,6 +1027,7 @@ class CharacteristicsController extends Controller
|
||||
// $values = array_merge($values1 ?? [], $values2 ?? [], $values3 ?? [], $values4 ?? [], $values5 ?? []);
|
||||
} else {
|
||||
if ($modelType == 'MOTOR') {
|
||||
$curMMach = $char['motor_machine_name'] ?? $curMMach;
|
||||
$motPhysiCnt = $motPhysiCnt + 1;
|
||||
$motExpecTim = $motExpecTim + $expectedTime;
|
||||
if ($motPhysiCnt >= $mvhsCnt) {
|
||||
@@ -1028,6 +1035,7 @@ class CharacteristicsController extends Controller
|
||||
}
|
||||
$curMotorMarkBy = ($char['motor_marked_by'] == 'jothi') ? 'Admin' : $char['motor_marked_by'] ?? $curMotorMarkBy;
|
||||
} elseif ($modelType == 'PUMP') {
|
||||
$curPMach = $char['pump_machine_name'] ?? $curPMach;
|
||||
$pumPhysiCnt = $pumPhysiCnt + 1;
|
||||
$pumExpecTim = $pumExpecTim + $expectedTime;
|
||||
if ($pumPhysiCnt >= $mvhsCnt) {
|
||||
@@ -1040,7 +1048,7 @@ class CharacteristicsController extends Controller
|
||||
|
||||
if ($curMotorMarkStat == 'Marked' && $curPumpMarkStat == 'Marked') {
|
||||
$curMarkStat = 'Marked';
|
||||
} elseif (Str::contains($curHead, 'PUMP', ignoreCase: true) && ! Str::contains($curHead, 'PUMP SET', ignoreCase: true) && ! Str::contains($curHead, 'PUMPSET', ignoreCase: true)) {
|
||||
} elseif (Str::contains($curHead, 'PUMP', ignoreCase: true) && ! Str::contains($curHead, 'PUMP SET', ignoreCase: true) && ! Str::contains($curHead, 'PUMPSET', ignoreCase: true) && ! Str::contains($curHead, 'PUMPS', ignoreCase: true)) {
|
||||
if ($modelType == 'PUMP' && $pumPhysiCnt >= $mvhsCnt) {
|
||||
$curMarkStat = 'Marked';
|
||||
}
|
||||
@@ -1069,8 +1077,8 @@ class CharacteristicsController extends Controller
|
||||
'name_plate_marked_by' => $curNamePlateMarkBy,
|
||||
'motor_pump_pumpset_status' => null,
|
||||
'winded_serial_number' => $char['winded_serial_number'] ?? $curWindNo,
|
||||
'motor_machine_name' => $char['motor_machine_name'] ?? $curMMach,
|
||||
'pump_machine_name' => $char['pump_machine_name'] ?? $curPMach,
|
||||
'motor_machine_name' => $curMMach,
|
||||
'pump_machine_name' => $curPMach,
|
||||
'name_plate_machine_name' => $char['name_plate_machine_name'] ?? $curNpMach,
|
||||
'part_validation_1' => $char['part_validation_1'] ?? $curPart1,
|
||||
'part_validation_2' => $char['part_validation_2'] ?? $curPart2,
|
||||
@@ -1110,6 +1118,14 @@ class CharacteristicsController extends Controller
|
||||
// ], 404);
|
||||
}
|
||||
|
||||
if ($modelType == 'MOTOR') {
|
||||
$curMMach = $char['motor_machine_name'] ?? $curMMach;
|
||||
} elseif ($modelType == 'PUMP') {
|
||||
$curPMach = $char['pump_machine_name'] ?? $curPMach;
|
||||
} elseif ($modelType == 'NAME_PLATE') {
|
||||
$curNpMach = $char['name_plate_machine_name'] ?? $curNpMach;
|
||||
}
|
||||
|
||||
$manStat = (intval($curStat->man_marked_status ?? 0) ?: 0) + 1;
|
||||
// $manStat = ($curStat->man_marked_status == null || $curStat->man_marked_status == '' || $curStat->man_marked_status == '0') ? 0 : (int) $curStat->man_marked_status;
|
||||
$values = [
|
||||
@@ -1117,6 +1133,9 @@ class CharacteristicsController extends Controller
|
||||
'man_marked_datetime' => $char['man_marked_datetime'] ?? now(),
|
||||
'man_marked_by' => ($char['man_marked_by'] == 'jothi') ? 'Admin' : $char['man_marked_by'] ?? $curManualMarkBy,
|
||||
'winded_serial_number' => $char['winded_serial_number'] ?? $curWindNo,
|
||||
'motor_machine_name' => $curMMach,
|
||||
'pump_machine_name' => $curPMach,
|
||||
'name_plate_machine_name' => $curNpMach,
|
||||
'part_validation_1' => $char['part_validation_1'] ?? $curPart1,
|
||||
'part_validation_2' => $char['part_validation_2'] ?? $curPart2,
|
||||
'samlight_logged_name' => $char['samlight_logged_name'] ?? $slUser,
|
||||
@@ -1543,9 +1562,9 @@ class CharacteristicsController extends Controller
|
||||
|
||||
if (Str::contains($modelHeading, 'PRESSURE BOOSTER SYSTEM', ignoreCase: true)) {
|
||||
$typesToCreate = ['MOTOR', 'PUMP', 'NAME_PLATE'];
|
||||
} elseif (Str::contains($modelHeading, 'PUMPSET', ignoreCase: true)) {
|
||||
} elseif (Str::contains($modelHeading, 'PUMPS', ignoreCase: true) || Str::contains($modelHeading, 'PUMPSET', ignoreCase: true)) {
|
||||
$typesToCreate = ['MOTOR', 'PUMP'];
|
||||
} elseif (Str::contains($modelHeading, 'PUMP', ignoreCase: true) && ! Str::contains($modelHeading, 'PUMP SET', ignoreCase: true) && ! Str::contains($modelHeading, 'PUMPSET', ignoreCase: true)) {
|
||||
} elseif (Str::contains($modelHeading, 'PUMP', ignoreCase: true) && ! Str::contains($modelHeading, 'PUMP SET', ignoreCase: true) && ! Str::contains($modelHeading, 'PUMPSET', ignoreCase: true) && ! Str::contains($modelHeading, 'PUMPS', ignoreCase: true)) {
|
||||
$typesToCreate = ['PUMP'];
|
||||
} elseif (Str::contains($modelHeading, 'MOTOR', ignoreCase: true)) {
|
||||
$typesToCreate = ['MOTOR'];
|
||||
@@ -1922,9 +1941,9 @@ class CharacteristicsController extends Controller
|
||||
|
||||
if (Str::contains($modelHeading, 'PRESSURE BOOSTER SYSTEM', ignoreCase: true)) {
|
||||
$typesToCreate = ['MOTOR', 'PUMP', 'NAME_PLATE'];
|
||||
} elseif (Str::contains($modelHeading, 'PUMPSET', ignoreCase: true)) {
|
||||
} elseif (Str::contains($modelHeading, 'PUMPS', ignoreCase: true) || Str::contains($modelHeading, 'PUMPSET', ignoreCase: true)) {
|
||||
$typesToCreate = ['MOTOR', 'PUMP'];
|
||||
} elseif (Str::contains($modelHeading, 'PUMP', ignoreCase: true) && ! Str::contains($modelHeading, 'PUMP SET', ignoreCase: true) && ! Str::contains($modelHeading, 'PUMPSET', ignoreCase: true)) {
|
||||
} elseif (Str::contains($modelHeading, 'PUMP', ignoreCase: true) && ! Str::contains($modelHeading, 'PUMP SET', ignoreCase: true) && ! Str::contains($modelHeading, 'PUMPSET', ignoreCase: true) && ! Str::contains($modelHeading, 'PUMPS', ignoreCase: true)) {
|
||||
$typesToCreate = ['PUMP'];
|
||||
} elseif (Str::contains($modelHeading, 'MOTOR', ignoreCase: true)) {
|
||||
$typesToCreate = ['MOTOR'];
|
||||
@@ -2356,7 +2375,7 @@ class CharacteristicsController extends Controller
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Serial number '{$serialNumber}' doesn't have name plate model to proceed!",
|
||||
], 404);
|
||||
} elseif (Str::contains($curHead, 'PUMP', ignoreCase: true) && ! Str::contains($curHead, 'PUMP SET', ignoreCase: true) && ! Str::contains($curHead, 'PUMPSET', ignoreCase: true)) {
|
||||
} elseif (Str::contains($curHead, 'PUMP', ignoreCase: true) && ! Str::contains($curHead, 'PUMP SET', ignoreCase: true) && ! Str::contains($curHead, 'PUMPSET', ignoreCase: true) && ! Str::contains($curHead, 'PUMPS', ignoreCase: true)) {
|
||||
if ($modelType == 'MOTOR') {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
@@ -2380,7 +2399,7 @@ class CharacteristicsController extends Controller
|
||||
// 'status_description' => "Serial number '{$serialNumber}' doesn't have pumpset model to proceed!",
|
||||
// ], 404);
|
||||
}
|
||||
} elseif (! Str::contains($curHead, 'PUMPSET', ignoreCase: true)) {
|
||||
} elseif (! Str::contains($curHead, 'PUMPS', ignoreCase: true) && ! Str::contains($curHead, 'PUMPSET', ignoreCase: true)) {
|
||||
return response()->json([
|
||||
'status_code' => 'ERROR',
|
||||
'status_description' => "Serial number '{$serialNumber}' doesn't have valid model type to proceed!",
|
||||
@@ -3647,9 +3666,9 @@ class CharacteristicsController extends Controller
|
||||
|
||||
if (Str::contains($modelHeading, 'PRESSURE BOOSTER SYSTEM', ignoreCase: true)) {
|
||||
$typesToCreate = ['MOTOR', 'PUMP', 'NAME_PLATE'];
|
||||
} elseif (Str::contains($modelHeading, 'PUMPSET', ignoreCase: true)) {
|
||||
} elseif (Str::contains($modelHeading, 'PUMPS', ignoreCase: true) || Str::contains($modelHeading, 'PUMPSET', ignoreCase: true)) {
|
||||
$typesToCreate = ['MOTOR', 'PUMP'];
|
||||
} elseif (Str::contains($modelHeading, 'PUMP', ignoreCase: true) && ! Str::contains($modelHeading, 'PUMP SET', ignoreCase: true) && ! Str::contains($modelHeading, 'PUMPSET', ignoreCase: true)) {
|
||||
} elseif (Str::contains($modelHeading, 'PUMP', ignoreCase: true) && ! Str::contains($modelHeading, 'PUMP SET', ignoreCase: true) && ! Str::contains($modelHeading, 'PUMPSET', ignoreCase: true) && ! Str::contains($modelHeading, 'PUMPS', ignoreCase: true)) {
|
||||
$typesToCreate = ['PUMP'];
|
||||
} elseif (Str::contains($modelHeading, 'MOTOR', ignoreCase: true)) {
|
||||
$typesToCreate = ['MOTOR'];
|
||||
@@ -4682,9 +4701,9 @@ class CharacteristicsController extends Controller
|
||||
|
||||
if (Str::contains($modelHeading, 'PRESSURE BOOSTER SYSTEM', ignoreCase: true)) {
|
||||
$typesToCreate = ['MOTOR', 'PUMP', 'NAME_PLATE'];
|
||||
} elseif (Str::contains($modelHeading, 'PUMPSET', ignoreCase: true)) {
|
||||
} elseif (Str::contains($modelHeading, 'PUMPS', ignoreCase: true) || Str::contains($modelHeading, 'PUMPSET', ignoreCase: true)) {
|
||||
$typesToCreate = ['MOTOR', 'PUMP'];
|
||||
} elseif (Str::contains($modelHeading, 'PUMP', ignoreCase: true) && ! Str::contains($modelHeading, 'PUMP SET', ignoreCase: true) && ! Str::contains($modelHeading, 'PUMPSET', ignoreCase: true)) {
|
||||
} elseif (Str::contains($modelHeading, 'PUMP', ignoreCase: true) && ! Str::contains($modelHeading, 'PUMP SET', ignoreCase: true) && ! Str::contains($modelHeading, 'PUMPSET', ignoreCase: true) && ! Str::contains($modelHeading, 'PUMPS', ignoreCase: true)) {
|
||||
$typesToCreate = ['PUMP'];
|
||||
} elseif (Str::contains($modelHeading, 'MOTOR', ignoreCase: true)) {
|
||||
$typesToCreate = ['MOTOR'];
|
||||
|
||||
@@ -107,7 +107,7 @@ class PalletPrintController extends Controller
|
||||
|
||||
$index = $completedPallets->search($pallet);
|
||||
|
||||
$currentPalletNo = ($index != false) ? $index + 1 : 0;
|
||||
$currentPalletNo = ($index !== false) ? $index + 1 : 0;
|
||||
|
||||
$boxLabel = $currentPalletNo.'/'.$totalBoxes;
|
||||
|
||||
@@ -143,8 +143,10 @@ class PalletPrintController extends Controller
|
||||
'customerName' => $customerName,
|
||||
'masterBox' => $boxLabel,
|
||||
'items' => $items,
|
||||
'grossWeight' => $grossWeight,
|
||||
'netWeight' => $grossWeight - 3.05,
|
||||
'grossWeight' => $grossWeight + 3.050,
|
||||
'netWeight' => $grossWeight,
|
||||
// 'grossWeight' => $grossWeight,
|
||||
// 'netWeight' => $grossWeight - 3.05,
|
||||
'pallet' => $pallet,
|
||||
])->setPaper([0, 0, $widthPt, $heightPt], 'portrait');
|
||||
|
||||
|
||||
@@ -4,28 +4,42 @@ namespace App\Mail;
|
||||
|
||||
use DateTime;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Mail\Mailable;
|
||||
use Illuminate\Mail\Mailables\Content;
|
||||
use Illuminate\Mail\Mailables\Envelope;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
// use App\Exports\ProductionExport;
|
||||
// use Illuminate\Mail\Mailables\Attachment;
|
||||
// use Maatwebsite\Excel\Facades\Excel;
|
||||
|
||||
class ProductionMail extends Mailable
|
||||
{
|
||||
use Queueable, SerializesModels;
|
||||
|
||||
public $tableData;
|
||||
|
||||
public $scheduleType;
|
||||
// public $excelData;
|
||||
// public $dates;
|
||||
|
||||
/**
|
||||
* Create a new message instance.
|
||||
*/
|
||||
public function __construct($scheduleType,$tableData = [])
|
||||
public function __construct($scheduleType, $tableData = [])
|
||||
{
|
||||
$this->scheduleType = $scheduleType;
|
||||
$this->tableData = $tableData ?? [];
|
||||
$this->scheduleType = $scheduleType;
|
||||
$this->tableData = $tableData ?? [];
|
||||
}
|
||||
|
||||
// public function __construct($scheduleType,$tableData = [],$excelData = [],$dates = [])
|
||||
// {
|
||||
// $this->scheduleType = $scheduleType;
|
||||
// $this->tableData = $tableData;
|
||||
// $this->excelData = $excelData;
|
||||
// $this->dates = $dates;
|
||||
// }
|
||||
|
||||
/**
|
||||
* Get the message envelope.
|
||||
*/
|
||||
@@ -52,13 +66,14 @@ class ProductionMail extends Mailable
|
||||
// ],
|
||||
// );
|
||||
// }
|
||||
|
||||
public function content(): Content
|
||||
{
|
||||
$greeting = "Dear Sir/Madam,<br><br>Kindly find the attached production report status details for the 'Target Quantity' and 'Production Quantity' count,";
|
||||
|
||||
if ($this->scheduleType == 'Daily') {
|
||||
$fromDate = (new DateTime('yesterday 08:00'))->format('d/m/Y H:i') . ':000';
|
||||
$toDate = (new DateTime('today 07:59'))->format('d/m/Y H:i') . ':999';
|
||||
$fromDate = (new DateTime('yesterday 08:00'))->format('d/m/Y H:i').':000';
|
||||
$toDate = (new DateTime('today 07:59'))->format('d/m/Y H:i').':999';
|
||||
$reportPeriod = "The following report presents results from: $fromDate to $toDate.";
|
||||
$greeting .= $reportPeriod;
|
||||
}
|
||||
@@ -74,22 +89,21 @@ class ProductionMail extends Mailable
|
||||
if ($this->scheduleType == 'Live') {
|
||||
$now = now();
|
||||
$fromMinute = $now->copy()->subMinute()->format('d/m/Y H:i:s');
|
||||
$toMinute = $now->format('d/m/Y H:i:s');
|
||||
$toMinute = $now->format('d/m/Y H:i:s');
|
||||
$greeting .= "The following report presents results from: $fromMinute to $toMinute.";
|
||||
}
|
||||
|
||||
return new Content(
|
||||
view: 'mail.production_report',
|
||||
with: [
|
||||
'company' => "CRI Digital Manufacturing Solutions",
|
||||
'company' => 'CRI Digital Manufacturing Solutions',
|
||||
'greeting' => $greeting,
|
||||
'tableData' => $this->tableData,
|
||||
'wishes' => "Thanks & Regards,<br>CRI Digital Manufacturing Solutions"
|
||||
'wishes' => 'Thanks & Regards,<br>CRI Digital Manufacturing Solutions',
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get the attachments for the message.
|
||||
*
|
||||
@@ -98,5 +112,19 @@ class ProductionMail extends Mailable
|
||||
public function attachments(): array
|
||||
{
|
||||
return [];
|
||||
// return [
|
||||
// Attachment::fromData(
|
||||
// fn () => Excel::raw(
|
||||
// new ProductionExport(
|
||||
// $this->excelData,
|
||||
// $this->dates
|
||||
// ),
|
||||
// \Maatwebsite\Excel\Excel::XLSX
|
||||
// ),
|
||||
// 'production_plan_data.xlsx'
|
||||
// )->withMime(
|
||||
// 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
|
||||
// ),
|
||||
// ];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
DB::statement(<<<SQL
|
||||
ALTER TABLE invoice_validations
|
||||
ALTER COLUMN quantity TYPE NUMERIC(10,3)
|
||||
USING quantity::NUMERIC(10,3);
|
||||
SQL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
// Schema::table('invoice_validations', function (Blueprint $table) {
|
||||
// //
|
||||
// });
|
||||
}
|
||||
};
|
||||
@@ -21,7 +21,7 @@ class AdminSeeder extends Seeder
|
||||
// Data to update/create
|
||||
[
|
||||
'name' => 'Admin',
|
||||
'password' => Hash::make('jOtHi#9000'),
|
||||
'password' => Hash::make('jOtHi$9000'),
|
||||
'updated_at' => now(),
|
||||
'created_at' => now(),
|
||||
]
|
||||
|
||||
@@ -210,7 +210,20 @@ class PermissionSeeder extends Seeder
|
||||
Permission::updateOrCreate(['name' => 'view import temp class characteristic']);
|
||||
Permission::updateOrCreate(['name' => 'view export temp class characteristic']);
|
||||
|
||||
Permission::updateOrCreate(['name' => 'view import production temp']);
|
||||
Permission::updateOrCreate(['name' => 'view export production temp']);
|
||||
|
||||
Permission::updateOrCreate(['name' => 'view import production orders']);
|
||||
Permission::updateOrCreate(['name' => 'view export production orders']);
|
||||
|
||||
Permission::updateOrCreate(['name' => 'view import transit']);
|
||||
Permission::updateOrCreate(['name' => 'view export import transit']);
|
||||
|
||||
Permission::updateOrCreate(['name' => 'view reprint production order']);
|
||||
Permission::updateOrCreate(['name' => 'create osp production sticker reprint page']);
|
||||
|
||||
Permission::updateOrCreate(['name' => 'view print production order button']);
|
||||
Permission::updateOrCreate(['name' => 'view save production order button']);
|
||||
Permission::updateOrCreate(['name' => 'view print panel production order button']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -948,84 +948,80 @@ function cameraCapture() {
|
||||
|
||||
|
||||
async verifyPhoto() {
|
||||
if (!this.capturedPhoto) {
|
||||
alert("Please capture a photo first!");
|
||||
return;
|
||||
}
|
||||
if (!this.capturedPhoto) {
|
||||
alert("Please capture a photo first!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!this.isWorkerReady) {
|
||||
alert("OCR worker not ready yet!");
|
||||
return;
|
||||
}
|
||||
if (!this.isWorkerReady) {
|
||||
alert("OCR worker not ready yet!");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
const img = new Image();
|
||||
img.src = this.capturedPhoto;
|
||||
try {
|
||||
const img = new Image();
|
||||
img.src = this.capturedPhoto;
|
||||
|
||||
img.onload = async () => {
|
||||
img.onload = async () => {
|
||||
|
||||
// Reuse the same temp canvas (no memory leak)
|
||||
this.tempCanvas.width = img.width;
|
||||
this.tempCanvas.height = img.height;
|
||||
this.tempCtx.drawImage(img, 0, 0);
|
||||
// Reuse the same temp canvas (no memory leak)
|
||||
this.tempCanvas.width = img.width;
|
||||
this.tempCanvas.height = img.height;
|
||||
this.tempCtx.drawImage(img, 0, 0);
|
||||
|
||||
// Worker OCR — much faster
|
||||
const result = await this.ocrWorker.recognize(this.tempCanvas);
|
||||
// Worker OCR — much faster
|
||||
const result = await this.ocrWorker.recognize(this.tempCanvas);
|
||||
|
||||
const detectedText = result.data.text.trim();
|
||||
console.log("Detected Text:", detectedText);
|
||||
const detectedText = result.data.text.trim();
|
||||
console.log("Detected Text:", detectedText);
|
||||
|
||||
// -------------------------------------------------------
|
||||
// SERIAL EXTRACTION LOGIC — SAME AS YOUR ORIGINAL
|
||||
// -------------------------------------------------------
|
||||
const serialWithLabelRegex = /Serial\s*No[:\-]?\s*([A-Za-z0-9]+)/i;
|
||||
const match = detectedText.match(serialWithLabelRegex);
|
||||
const serialWithLabelRegex = /Serial\s*No[:\-]?\s*([A-Za-z0-9]+)/i;
|
||||
const match = detectedText.match(serialWithLabelRegex);
|
||||
|
||||
if (match && match[1]) {
|
||||
// "Serial No: XXXXX"
|
||||
this.serialNumbers = [match[1].trim()];
|
||||
console.log("Serial with Label:", this.serialNumbers[0]);
|
||||
} else {
|
||||
// Extract first 4 alphanumeric sequences of 4+ chars
|
||||
const generalNums = detectedText.match(/[A-Za-z0-9]{4,}/g) || [];
|
||||
this.serialNumbers = generalNums.slice(0, 4);
|
||||
if (match && match[1]) {
|
||||
this.serialNumbers = [match[1].trim()];
|
||||
console.log("Serial with Label:", this.serialNumbers[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
const generalNums = detectedText.match(/[A-Za-z0-9]{4,}/g) || [];
|
||||
this.serialNumbers = generalNums.slice(0, 4);
|
||||
|
||||
if (this.serialNumbers.length === 0) {
|
||||
alert("No serial numbers detected!");
|
||||
return;
|
||||
if (this.serialNumbers.length == 0) {
|
||||
alert("No serial numbers detected!");
|
||||
return;
|
||||
}
|
||||
|
||||
console.log("Serial Numbers List:", this.serialNumbers);
|
||||
}
|
||||
|
||||
console.log("Serial Numbers List:", this.serialNumbers);
|
||||
// Save into hidden input (your original logic)
|
||||
this.$refs.hiddenInputSerials.value = JSON.stringify(this.serialNumbers);
|
||||
|
||||
alert("Serial numbers:\n" + this.$refs.hiddenInputSerials.value);
|
||||
|
||||
fetch('/save-serials-to-session', {
|
||||
method: 'POST',
|
||||
credentials: 'same-origin',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').content,
|
||||
},
|
||||
body: JSON.stringify({
|
||||
serial_numbers: this.serialNumbers,
|
||||
}),
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
console.log("Session Updated:", data);
|
||||
alert("✅ Serial numbers saved to session!");
|
||||
});
|
||||
};
|
||||
} catch (err) {
|
||||
console.error("OCR verify error:", err);
|
||||
alert("OCR verify failed:\n" + (err.message || err));
|
||||
}
|
||||
|
||||
// Save into hidden input (your original logic)
|
||||
this.$refs.hiddenInputSerials.value = JSON.stringify(this.serialNumbers);
|
||||
|
||||
alert("Serial numbers:\n" + this.$refs.hiddenInputSerials.value);
|
||||
|
||||
fetch('/save-serials-to-session', {
|
||||
method: 'POST',
|
||||
credentials: 'same-origin',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').content,
|
||||
},
|
||||
body: JSON.stringify({
|
||||
serial_numbers: this.serialNumbers,
|
||||
}),
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(data => {
|
||||
console.log("Session Updated:", data);
|
||||
alert("✅ Serial numbers saved to session!");
|
||||
});
|
||||
};
|
||||
|
||||
} catch (err) {
|
||||
console.error("OCR verify error:", err);
|
||||
alert("OCR verify failed:\n" + (err.message || err));
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
startDetection() {
|
||||
if (this.textDetectionInterval) {
|
||||
|
||||
@@ -101,7 +101,7 @@
|
||||
if (!scanInput) return;
|
||||
|
||||
scanInput.addEventListener('keydown', function (event) {
|
||||
if (event.key === 'Enter') {
|
||||
if (event.key == 'Enter') {
|
||||
event.preventDefault();
|
||||
|
||||
const value = scanInput.value.trim();
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
<div class="bg-white max-h-[80vh] overflow-hidden p-6 rounded-lg shadow-lg pointer-events-auto"
|
||||
style="width:30vw !important; max-width:none !important;">
|
||||
|
||||
@if($records && $records->count())
|
||||
{{-- @if($records && $records->count()) --}}
|
||||
@if(!empty($records) && count($records))
|
||||
<div style="max-height:250px; overflow-y:auto; border:1px solid #ccc;">
|
||||
|
||||
{{-- <table class="min-w-full border"> --}}
|
||||
|
||||
@@ -106,7 +106,6 @@
|
||||
-
|
||||
@endif
|
||||
</td>
|
||||
|
||||
{{-- <td>{{ $row['lr_bl_aw_date'] }}</td> --}}
|
||||
<td>{{ $row['transit_days'] }}</td>
|
||||
<td>{{ $row['status'] }}</td>
|
||||
|
||||
Reference in New Issue
Block a user