Compare commits
9 Commits
master
...
ranjith-de
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6f93f2bd92 | ||
|
|
d19b8120e2 | ||
|
|
8fb42203c3 | ||
|
|
bb2f5082b1 | ||
|
|
3215cd39ad | ||
|
|
7755d15741 | ||
|
|
4586fc0d60 | ||
|
|
65fc5202a4 | ||
|
|
770f0c9af3 |
@@ -34,6 +34,8 @@ class SendInvoiceReport extends Command
|
|||||||
// $scheduleType = $this->argument('scheduleType');
|
// $scheduleType = $this->argument('scheduleType');
|
||||||
$plantIdArg = (int) $this->argument('plant'); // can be 0 for all plants
|
$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');
|
$mailRules = \App\Models\AlertMailRule::where('module', 'InvoiceValidation')->get()->groupBy('rule_name');
|
||||||
|
|
||||||
// $startDate = now()->setTime(8, 0, 0);
|
// $startDate = now()->setTime(8, 0, 0);
|
||||||
|
|||||||
@@ -59,7 +59,6 @@ class ProcessOrderExporter extends Exporter
|
|||||||
ExportColumn::make('deleted_at')
|
ExportColumn::make('deleted_at')
|
||||||
->enabledByDefault(false)
|
->enabledByDefault(false)
|
||||||
->label('DELETED AT'),
|
->label('DELETED AT'),
|
||||||
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ class InvoiceValidationImporter extends Importer
|
|||||||
ImportColumn::make('operator_id')
|
ImportColumn::make('operator_id')
|
||||||
->requiredMapping()
|
->requiredMapping()
|
||||||
->exampleHeader('OPERATOR ID')
|
->exampleHeader('OPERATOR ID')
|
||||||
->example('USER1')
|
->example('USER00001')
|
||||||
->label('OPERATOR ID')
|
->label('OPERATOR ID')
|
||||||
->rules(['required']),
|
->rules(['required']),
|
||||||
ImportColumn::make('created_at')
|
ImportColumn::make('created_at')
|
||||||
@@ -122,19 +122,19 @@ class InvoiceValidationImporter extends Importer
|
|||||||
ImportColumn::make('created_by')
|
ImportColumn::make('created_by')
|
||||||
->requiredMapping()
|
->requiredMapping()
|
||||||
->exampleHeader('CREATED BY')
|
->exampleHeader('CREATED BY')
|
||||||
->example('USER1')
|
->example('USER00001')
|
||||||
->label('CREATED BY')
|
->label('CREATED BY')
|
||||||
->rules(['required']),
|
->rules(['required']),
|
||||||
ImportColumn::make('updated_at')
|
ImportColumn::make('updated_at')
|
||||||
->requiredMapping()
|
->requiredMapping()
|
||||||
->exampleHeader('UPDATED AT')
|
->exampleHeader('UPDATED AT')
|
||||||
->example('USER1')
|
->example('')
|
||||||
->label('UPDATED AT')
|
->label('UPDATED AT')
|
||||||
->rules(['required']),
|
->rules(['required']),
|
||||||
ImportColumn::make('updated_by')
|
ImportColumn::make('updated_by')
|
||||||
->requiredMapping()
|
->requiredMapping()
|
||||||
->exampleHeader('UPDATED BY')
|
->exampleHeader('UPDATED BY')
|
||||||
->example('')
|
->example('USER00001')
|
||||||
->label('UPDATED BY')
|
->label('UPDATED BY')
|
||||||
->rules(['required']),
|
->rules(['required']),
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -2,10 +2,17 @@
|
|||||||
|
|
||||||
namespace App\Filament\Imports;
|
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 App\Models\ProductionCharacteristic;
|
||||||
|
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 Filament\Facades\Filament;
|
||||||
|
use Str;
|
||||||
|
|
||||||
class ProductionCharacteristicImporter extends Importer
|
class ProductionCharacteristicImporter extends Importer
|
||||||
{
|
{
|
||||||
@@ -16,40 +23,170 @@ class ProductionCharacteristicImporter extends Importer
|
|||||||
return [
|
return [
|
||||||
ImportColumn::make('plant')
|
ImportColumn::make('plant')
|
||||||
->requiredMapping()
|
->requiredMapping()
|
||||||
->relationship()
|
->exampleHeader('PLANT CODE')
|
||||||
|
->example('1200')
|
||||||
|
->label('PLANT CODE')
|
||||||
|
->relationship(resolveUsing: 'code')
|
||||||
->rules(['required']),
|
->rules(['required']),
|
||||||
ImportColumn::make('line')
|
ImportColumn::make('line')
|
||||||
->requiredMapping()
|
->exampleHeader('LINE NAME')
|
||||||
->relationship()
|
->example('Poly Wrapped Wire SFG')
|
||||||
->rules(['required']),
|
->label('LINE NAME')
|
||||||
|
->relationship(resolveUsing: 'name'),
|
||||||
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_name')
|
||||||
->requiredMapping()
|
->requiredMapping()
|
||||||
->relationship()
|
->exampleHeader('MACHINE NAME')
|
||||||
|
->example('RMI001234')
|
||||||
|
->label('MACHINE NAME')
|
||||||
|
// ->relationship(resolveUsing: 'work_center')
|
||||||
->rules(['required']),
|
->rules(['required']),
|
||||||
ImportColumn::make('production_order'),
|
ImportColumn::make('production_order')
|
||||||
ImportColumn::make('serial_number'),
|
->requiredMapping()
|
||||||
ImportColumn::make('characteristic_name'),
|
->exampleHeader('PRODUCTION ORDER')
|
||||||
ImportColumn::make('observed_value'),
|
->example('1880231')
|
||||||
ImportColumn::make('status'),
|
->label('PRODUCTION ORDER')
|
||||||
ImportColumn::make('inspection_status'),
|
->rules(['required']),
|
||||||
ImportColumn::make('remark'),
|
ImportColumn::make('serial_number')
|
||||||
ImportColumn::make('created_by'),
|
->requiredMapping()
|
||||||
ImportColumn::make('updated_by'),
|
->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
|
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
|
public static function getCompletedNotificationBody(Import $import): string
|
||||||
|
|||||||
@@ -291,7 +291,6 @@ class ProductionQuantityPage extends Page implements HasForms
|
|||||||
$machineId = $get('machine_id');
|
$machineId = $get('machine_id');
|
||||||
|
|
||||||
$this->mNam = $machineId;
|
$this->mNam = $machineId;
|
||||||
|
|
||||||
})
|
})
|
||||||
->extraAttributes(fn ($get) => [
|
->extraAttributes(fn ($get) => [
|
||||||
// 'class' => $get('pqLineError') ? 'border-red-500' : '',
|
// 'class' => $get('pqLineError') ? 'border-red-500' : '',
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ use Filament\Notifications\Notification;
|
|||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
use Maatwebsite\Excel\Facades\Excel;
|
use Maatwebsite\Excel\Facades\Excel;
|
||||||
|
// use PhpOffice\PhpSpreadsheet\IOFactory;
|
||||||
|
|
||||||
class ImportTransitResource extends Resource
|
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
|
try
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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();
|
// 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) {
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
$set('Item', null);
|
|
||||||
$set('Line', null);
|
$set('Line', null);
|
||||||
|
$set('Item', null);
|
||||||
|
$set('Machine', null);
|
||||||
}),
|
}),
|
||||||
Select::make('Line')
|
Select::make('Line')
|
||||||
->label('Search by Line Name')
|
->label('Search by Line Name')
|
||||||
@@ -361,7 +362,7 @@ class ProductionCharacteristicResource extends Resource
|
|||||||
})->pluck('name', 'id');
|
})->pluck('name', 'id');
|
||||||
})
|
})
|
||||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
$set('process_order', null);
|
$set('Machine', null);
|
||||||
}),
|
}),
|
||||||
Select::make('Item')
|
Select::make('Item')
|
||||||
->label('Search by Item Code')
|
->label('Search by Item Code')
|
||||||
|
|||||||
@@ -203,7 +203,6 @@ class ProductionOrderResource extends Resource
|
|||||||
->label('Production Order')
|
->label('Production Order')
|
||||||
->readOnly()
|
->readOnly()
|
||||||
->visible(fn ($get) => $get('quantity') > 0),
|
->visible(fn ($get) => $get('quantity') > 0),
|
||||||
// ->visible(fn ($get) => $get('show_extra_fields')),
|
|
||||||
Forms\Components\TextInput::make('from_serial_number')
|
Forms\Components\TextInput::make('from_serial_number')
|
||||||
->label('From Serial Number')
|
->label('From Serial Number')
|
||||||
->readOnly()
|
->readOnly()
|
||||||
|
|||||||
@@ -245,7 +245,6 @@ class CreateProductionOrder extends CreateRecord
|
|||||||
} else {
|
} else {
|
||||||
return redirect()->route('production-orders.printpanel', ['production_order' => $pOrder, 'plant_code' => $plantCode]);
|
return redirect()->route('production-orders.printpanel', ['production_order' => $pOrder, 'plant_code' => $plantCode]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getFormActions(): array
|
protected function getFormActions(): array
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ class QualityValidationResource extends Resource
|
|||||||
Forms\Components\Hidden::make('plant')
|
Forms\Components\Hidden::make('plant')
|
||||||
->default(fn () => session('last_selected_plant_id'))
|
->default(fn () => session('last_selected_plant_id'))
|
||||||
->afterStateHydrated(function ($state, $set) {
|
->afterStateHydrated(function ($state, $set) {
|
||||||
if (!$state && request()->has('plant_id')) {
|
if (! $state && request()->has('plant_id')) {
|
||||||
$set('plant_id', request()->get('plant_id'));
|
$set('plant_id', request()->get('plant_id'));
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
@@ -136,7 +136,7 @@ class QualityValidationResource extends Resource
|
|||||||
Forms\Components\Hidden::make('line')
|
Forms\Components\Hidden::make('line')
|
||||||
->default(fn () => session('last_selected_line'))
|
->default(fn () => session('last_selected_line'))
|
||||||
->afterStateHydrated(function ($state, $set) {
|
->afterStateHydrated(function ($state, $set) {
|
||||||
if (!$state && request()->has('line_id')) {
|
if (! $state && request()->has('line_id')) {
|
||||||
$set('line_id', request()->get('line_id'));
|
$set('line_id', request()->get('line_id'));
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
@@ -178,7 +178,7 @@ class QualityValidationResource extends Resource
|
|||||||
Forms\Components\Hidden::make('production')
|
Forms\Components\Hidden::make('production')
|
||||||
->default(fn () => session('last_selected_production'))
|
->default(fn () => session('last_selected_production'))
|
||||||
->afterStateHydrated(function ($state, $set) {
|
->afterStateHydrated(function ($state, $set) {
|
||||||
if (!$state && request()->has('production_order')) {
|
if (! $state && request()->has('production_order')) {
|
||||||
$set('production_order', request()->get('production_order'));
|
$set('production_order', request()->get('production_order'));
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
@@ -2423,7 +2423,6 @@ class QualityValidationResource extends Resource
|
|||||||
$emails = $mailData['emails'];
|
$emails = $mailData['emails'];
|
||||||
$mUserName = Filament::auth()->user()->name;
|
$mUserName = Filament::auth()->user()->name;
|
||||||
|
|
||||||
|
|
||||||
if (! empty($emails)) {
|
if (! empty($emails)) {
|
||||||
// Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
|
// Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
|
||||||
Mail::to($emails)->send(
|
Mail::to($emails)->send(
|
||||||
@@ -2519,7 +2518,6 @@ class QualityValidationResource extends Resource
|
|||||||
$emails = $mailData['emails'];
|
$emails = $mailData['emails'];
|
||||||
$mUserName = Filament::auth()->user()->name;
|
$mUserName = Filament::auth()->user()->name;
|
||||||
|
|
||||||
|
|
||||||
if (! empty($emails)) {
|
if (! empty($emails)) {
|
||||||
// Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
|
// Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
|
||||||
Mail::to($emails)->send(
|
Mail::to($emails)->send(
|
||||||
@@ -2711,7 +2709,6 @@ class QualityValidationResource extends Resource
|
|||||||
$emails = $mailData['emails'];
|
$emails = $mailData['emails'];
|
||||||
$mUserName = Filament::auth()->user()->name;
|
$mUserName = Filament::auth()->user()->name;
|
||||||
|
|
||||||
|
|
||||||
if (! empty($emails)) {
|
if (! empty($emails)) {
|
||||||
// Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
|
// Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
|
||||||
Mail::to($emails)->send(
|
Mail::to($emails)->send(
|
||||||
@@ -2864,16 +2861,6 @@ class QualityValidationResource extends Resource
|
|||||||
'showChecklist' => $livewire->showChecklist,
|
'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([
|
->filters([
|
||||||
|
|
||||||
Tables\Filters\TrashedFilter::make(),
|
Tables\Filters\TrashedFilter::make(),
|
||||||
Filter::make('advanced_filters')
|
Filter::make('advanced_filters')
|
||||||
->label('Advanced Filters')
|
->label('Advanced Filters')
|
||||||
|
|||||||
@@ -630,7 +630,7 @@ class TestingPanelReadingResource extends Resource
|
|||||||
->options(function () {
|
->options(function () {
|
||||||
// return Plant::pluck('name', 'id');
|
// return Plant::pluck('name', 'id');
|
||||||
$userHas = Filament::auth()->user()->plant_id;
|
$userHas = Filament::auth()->user()->plant_id;
|
||||||
|
|
||||||
if ($userHas && strlen($userHas) > 0) {
|
if ($userHas && strlen($userHas) > 0) {
|
||||||
return Plant::where('id', $userHas)->pluck('name', 'id')->toArray();
|
return Plant::where('id', $userHas)->pluck('name', 'id')->toArray();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ class PalletPrintController extends Controller
|
|||||||
|
|
||||||
$index = $completedPallets->search($pallet);
|
$index = $completedPallets->search($pallet);
|
||||||
|
|
||||||
$currentPalletNo = ($index != false) ? $index + 1 : 0;
|
$currentPalletNo = ($index !== false) ? $index + 1 : 0;
|
||||||
|
|
||||||
$boxLabel = $currentPalletNo.'/'.$totalBoxes;
|
$boxLabel = $currentPalletNo.'/'.$totalBoxes;
|
||||||
|
|
||||||
|
|||||||
@@ -4,28 +4,42 @@ namespace App\Mail;
|
|||||||
|
|
||||||
use DateTime;
|
use DateTime;
|
||||||
use Illuminate\Bus\Queueable;
|
use Illuminate\Bus\Queueable;
|
||||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
|
||||||
use Illuminate\Mail\Mailable;
|
use Illuminate\Mail\Mailable;
|
||||||
use Illuminate\Mail\Mailables\Content;
|
use Illuminate\Mail\Mailables\Content;
|
||||||
use Illuminate\Mail\Mailables\Envelope;
|
use Illuminate\Mail\Mailables\Envelope;
|
||||||
use Illuminate\Queue\SerializesModels;
|
use Illuminate\Queue\SerializesModels;
|
||||||
|
|
||||||
|
// use App\Exports\ProductionExport;
|
||||||
|
// use Illuminate\Mail\Mailables\Attachment;
|
||||||
|
// use Maatwebsite\Excel\Facades\Excel;
|
||||||
|
|
||||||
class ProductionMail extends Mailable
|
class ProductionMail extends Mailable
|
||||||
{
|
{
|
||||||
use Queueable, SerializesModels;
|
use Queueable, SerializesModels;
|
||||||
|
|
||||||
public $tableData;
|
public $tableData;
|
||||||
|
|
||||||
public $scheduleType;
|
public $scheduleType;
|
||||||
|
// public $excelData;
|
||||||
|
// public $dates;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new message instance.
|
* Create a new message instance.
|
||||||
*/
|
*/
|
||||||
public function __construct($scheduleType,$tableData = [])
|
public function __construct($scheduleType, $tableData = [])
|
||||||
{
|
{
|
||||||
$this->scheduleType = $scheduleType;
|
$this->scheduleType = $scheduleType;
|
||||||
$this->tableData = $tableData ?? [];
|
$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.
|
* Get the message envelope.
|
||||||
*/
|
*/
|
||||||
@@ -52,13 +66,14 @@ class ProductionMail extends Mailable
|
|||||||
// ],
|
// ],
|
||||||
// );
|
// );
|
||||||
// }
|
// }
|
||||||
|
|
||||||
public function content(): Content
|
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,";
|
$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') {
|
if ($this->scheduleType == 'Daily') {
|
||||||
$fromDate = (new DateTime('yesterday 08:00'))->format('d/m/Y H:i') . ':000';
|
$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';
|
$toDate = (new DateTime('today 07:59'))->format('d/m/Y H:i').':999';
|
||||||
$reportPeriod = "The following report presents results from: $fromDate to $toDate.";
|
$reportPeriod = "The following report presents results from: $fromDate to $toDate.";
|
||||||
$greeting .= $reportPeriod;
|
$greeting .= $reportPeriod;
|
||||||
}
|
}
|
||||||
@@ -74,22 +89,21 @@ class ProductionMail extends Mailable
|
|||||||
if ($this->scheduleType == 'Live') {
|
if ($this->scheduleType == 'Live') {
|
||||||
$now = now();
|
$now = now();
|
||||||
$fromMinute = $now->copy()->subMinute()->format('d/m/Y H:i:s');
|
$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.";
|
$greeting .= "The following report presents results from: $fromMinute to $toMinute.";
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Content(
|
return new Content(
|
||||||
view: 'mail.production_report',
|
view: 'mail.production_report',
|
||||||
with: [
|
with: [
|
||||||
'company' => "CRI Digital Manufacturing Solutions",
|
'company' => 'CRI Digital Manufacturing Solutions',
|
||||||
'greeting' => $greeting,
|
'greeting' => $greeting,
|
||||||
'tableData' => $this->tableData,
|
'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.
|
* Get the attachments for the message.
|
||||||
*
|
*
|
||||||
@@ -98,5 +112,19 @@ class ProductionMail extends Mailable
|
|||||||
public function attachments(): array
|
public function attachments(): array
|
||||||
{
|
{
|
||||||
return [];
|
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'
|
||||||
|
// ),
|
||||||
|
// ];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -210,7 +210,20 @@ class PermissionSeeder extends Seeder
|
|||||||
Permission::updateOrCreate(['name' => 'view import temp class characteristic']);
|
Permission::updateOrCreate(['name' => 'view import temp class characteristic']);
|
||||||
Permission::updateOrCreate(['name' => 'view export 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() {
|
async verifyPhoto() {
|
||||||
if (!this.capturedPhoto) {
|
if (!this.capturedPhoto) {
|
||||||
alert("Please capture a photo first!");
|
alert("Please capture a photo first!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.isWorkerReady) {
|
if (!this.isWorkerReady) {
|
||||||
alert("OCR worker not ready yet!");
|
alert("OCR worker not ready yet!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const img = new Image();
|
const img = new Image();
|
||||||
img.src = this.capturedPhoto;
|
img.src = this.capturedPhoto;
|
||||||
|
|
||||||
img.onload = async () => {
|
img.onload = async () => {
|
||||||
|
|
||||||
// Reuse the same temp canvas (no memory leak)
|
// Reuse the same temp canvas (no memory leak)
|
||||||
this.tempCanvas.width = img.width;
|
this.tempCanvas.width = img.width;
|
||||||
this.tempCanvas.height = img.height;
|
this.tempCanvas.height = img.height;
|
||||||
this.tempCtx.drawImage(img, 0, 0);
|
this.tempCtx.drawImage(img, 0, 0);
|
||||||
|
|
||||||
// Worker OCR — much faster
|
// Worker OCR — much faster
|
||||||
const result = await this.ocrWorker.recognize(this.tempCanvas);
|
const result = await this.ocrWorker.recognize(this.tempCanvas);
|
||||||
|
|
||||||
const detectedText = result.data.text.trim();
|
const detectedText = result.data.text.trim();
|
||||||
console.log("Detected Text:", detectedText);
|
console.log("Detected Text:", detectedText);
|
||||||
|
|
||||||
// -------------------------------------------------------
|
const serialWithLabelRegex = /Serial\s*No[:\-]?\s*([A-Za-z0-9]+)/i;
|
||||||
// SERIAL EXTRACTION LOGIC — SAME AS YOUR ORIGINAL
|
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]) {
|
if (match && match[1]) {
|
||||||
// "Serial No: XXXXX"
|
this.serialNumbers = [match[1].trim()];
|
||||||
this.serialNumbers = [match[1].trim()];
|
console.log("Serial with Label:", this.serialNumbers[0]);
|
||||||
console.log("Serial with Label:", this.serialNumbers[0]);
|
}
|
||||||
} else {
|
else
|
||||||
// Extract first 4 alphanumeric sequences of 4+ chars
|
{
|
||||||
const generalNums = detectedText.match(/[A-Za-z0-9]{4,}/g) || [];
|
const generalNums = detectedText.match(/[A-Za-z0-9]{4,}/g) || [];
|
||||||
this.serialNumbers = generalNums.slice(0, 4);
|
this.serialNumbers = generalNums.slice(0, 4);
|
||||||
|
|
||||||
if (this.serialNumbers.length === 0) {
|
if (this.serialNumbers.length == 0) {
|
||||||
alert("No serial numbers detected!");
|
alert("No serial numbers detected!");
|
||||||
return;
|
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() {
|
startDetection() {
|
||||||
if (this.textDetectionInterval) {
|
if (this.textDetectionInterval) {
|
||||||
|
|||||||
@@ -101,7 +101,7 @@
|
|||||||
if (!scanInput) return;
|
if (!scanInput) return;
|
||||||
|
|
||||||
scanInput.addEventListener('keydown', function (event) {
|
scanInput.addEventListener('keydown', function (event) {
|
||||||
if (event.key === 'Enter') {
|
if (event.key == 'Enter') {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
|
|
||||||
const value = scanInput.value.trim();
|
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"
|
<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;">
|
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;">
|
<div style="max-height:250px; overflow-y:auto; border:1px solid #ccc;">
|
||||||
|
|
||||||
{{-- <table class="min-w-full border"> --}}
|
{{-- <table class="min-w-full border"> --}}
|
||||||
|
|||||||
@@ -106,7 +106,6 @@
|
|||||||
-
|
-
|
||||||
@endif
|
@endif
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
{{-- <td>{{ $row['lr_bl_aw_date'] }}</td> --}}
|
{{-- <td>{{ $row['lr_bl_aw_date'] }}</td> --}}
|
||||||
<td>{{ $row['transit_days'] }}</td>
|
<td>{{ $row['transit_days'] }}</td>
|
||||||
<td>{{ $row['status'] }}</td>
|
<td>{{ $row['status'] }}</td>
|
||||||
|
|||||||
Reference in New Issue
Block a user