Compare commits
92 Commits
0dcb155acb
...
ranjith-de
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b7ac7da6ec | ||
|
|
dca5d499be | ||
|
|
d2f4d417ba | ||
|
|
737f062cd4 | ||
|
|
ddc3e2a093 | ||
|
|
d4766a73e9 | ||
|
|
da526c7c0d | ||
|
|
1f3d697b57 | ||
|
|
4a4cf17732 | ||
|
|
fc85f64fbc | ||
|
|
3d0089c3b2 | ||
|
|
800cfbd960 | ||
|
|
4378f3adbd | ||
|
|
68ee079529 | ||
|
|
be85c85e06 | ||
|
|
5ebbf491f6 | ||
|
|
dee8246320 | ||
|
|
9d02be360e | ||
|
|
dd037e7f8a | ||
|
|
f599fdc05b | ||
|
|
0f6276fd76 | ||
|
|
ee898b935b | ||
|
|
6fd005acf9 | ||
|
|
6a1fb39068 | ||
|
|
33635fd9af | ||
|
|
10e493ca51 | ||
|
|
85f1a84321 | ||
|
|
994591da54 | ||
|
|
7aaca611dc | ||
|
|
251ef26c41 | ||
|
|
ebf5e60a00 | ||
|
|
37eed0640f | ||
|
|
143fe85b2e | ||
|
|
bb8000d177 | ||
|
|
2d4f6d8069 | ||
|
|
219279c641 | ||
|
|
2fb7ed7895 | ||
|
|
b4ef782067 | ||
|
|
dc028c91bb | ||
|
|
a42f7c1fae | ||
|
|
ec0fe66874 | ||
|
|
a6ec37fd3d | ||
|
|
f4bfc5c4dc | ||
|
|
2a83033541 | ||
|
|
f8dc95054b | ||
|
|
017f57878d | ||
|
|
561e0b448f | ||
|
|
8eb0985128 | ||
|
|
245c9e1782 | ||
|
|
b8fe29644e | ||
|
|
e09a362c96 | ||
|
|
7d84624843 | ||
|
|
b6519e3bbf | ||
|
|
bceba8db5f | ||
|
|
dd1a884b22 | ||
|
|
5b333621fe | ||
|
|
b52fd57c23 | ||
|
|
6bac832d1f | ||
|
|
8dbdcf4f35 | ||
|
|
115cc912c7 | ||
|
|
544e593d19 | ||
|
|
246b8715ca | ||
|
|
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 |
@@ -77,7 +77,7 @@ class Scheduler extends Command
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- Invoice Validation Rules ---
|
// --- Invoice Validation Rules --- (Invoice Mail)
|
||||||
$invoiceRules = AlertMailRule::where('module', 'InvoiceValidation')
|
$invoiceRules = AlertMailRule::where('module', 'InvoiceValidation')
|
||||||
->where('rule_name', 'InvoiceMail')
|
->where('rule_name', 'InvoiceMail')
|
||||||
->select('plant', 'schedule_type')
|
->select('plant', 'schedule_type')
|
||||||
@@ -104,7 +104,83 @@ class Scheduler extends Command
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'Daily':
|
case 'Daily':
|
||||||
if (now()->format('H:i') == '07:59') {
|
if (now()->format('H:i') == '17:55') {
|
||||||
|
\Artisan::call('send:invoice-report', [
|
||||||
|
'schedule_type' => $rule->schedule_type,
|
||||||
|
'plant' => $rule->plant,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//..SerialInvoice
|
||||||
|
|
||||||
|
$invoiceSerialRules = AlertMailRule::where('module', 'InvoiceValidation')
|
||||||
|
->where('rule_name', 'SerialInvoiceMail')
|
||||||
|
->select('plant', 'schedule_type')
|
||||||
|
->distinct()
|
||||||
|
->get();
|
||||||
|
|
||||||
|
foreach ($invoiceSerialRules as $rule) {
|
||||||
|
|
||||||
|
switch ($rule->schedule_type) {
|
||||||
|
case 'Live':
|
||||||
|
// Run every minute
|
||||||
|
\Artisan::call('send:invoice-report', [
|
||||||
|
'schedule_type' => $rule->schedule_type,
|
||||||
|
'plant' => $rule->plant,
|
||||||
|
]);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'Hourly':
|
||||||
|
if (now()->minute == 0) {
|
||||||
|
\Artisan::call('send:invoice-report', [
|
||||||
|
'schedule_type' => $rule->schedule_type,
|
||||||
|
'plant' => $rule->plant,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'Daily':
|
||||||
|
if (now()->format('H:i') == '17:55') {
|
||||||
|
\Artisan::call('send:invoice-report', [
|
||||||
|
'schedule_type' => $rule->schedule_type,
|
||||||
|
'plant' => $rule->plant,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//..MaterialInvoice
|
||||||
|
|
||||||
|
$invoiceMaterialRules = AlertMailRule::where('module', 'InvoiceValidation')
|
||||||
|
->where('rule_name', 'MaterialInvoiceMail')
|
||||||
|
->select('plant', 'schedule_type')
|
||||||
|
->distinct()
|
||||||
|
->get();
|
||||||
|
|
||||||
|
foreach ($invoiceMaterialRules as $rule) {
|
||||||
|
|
||||||
|
switch ($rule->schedule_type) {
|
||||||
|
case 'Live':
|
||||||
|
// Run every minute
|
||||||
|
\Artisan::call('send:invoice-report', [
|
||||||
|
'schedule_type' => $rule->schedule_type,
|
||||||
|
'plant' => $rule->plant,
|
||||||
|
]);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'Hourly':
|
||||||
|
if (now()->minute == 0) {
|
||||||
|
\Artisan::call('send:invoice-report', [
|
||||||
|
'schedule_type' => $rule->schedule_type,
|
||||||
|
'plant' => $rule->plant,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'Daily':
|
||||||
|
if (now()->format('H:i') == '17:55') {
|
||||||
\Artisan::call('send:invoice-report', [
|
\Artisan::call('send:invoice-report', [
|
||||||
'schedule_type' => $rule->schedule_type,
|
'schedule_type' => $rule->schedule_type,
|
||||||
'plant' => $rule->plant,
|
'plant' => $rule->plant,
|
||||||
@@ -284,6 +360,40 @@ class Scheduler extends Command
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$vehicleReports = AlertMailRule::where('module', 'VehicleReport')
|
||||||
|
->where('rule_name', 'VehicleReportMail')
|
||||||
|
->select('plant', 'schedule_type')
|
||||||
|
->distinct()
|
||||||
|
->get();
|
||||||
|
|
||||||
|
foreach ($vehicleReports as $rule) {
|
||||||
|
switch ($rule->schedule_type) {
|
||||||
|
case 'Live':
|
||||||
|
// Run every minute
|
||||||
|
\Artisan::call('send:vehicle-report', [
|
||||||
|
'schedule_type' => $rule->schedule_type,
|
||||||
|
'plant' => $rule->plant,
|
||||||
|
]);
|
||||||
|
break;
|
||||||
|
case 'Hourly':
|
||||||
|
if (now()->minute == 0) {
|
||||||
|
\Artisan::call('send:vehicle-report', [
|
||||||
|
'schedule_type' => $rule->schedule_type,
|
||||||
|
'plant' => $rule->plant,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'Daily':
|
||||||
|
if (now()->format('H:i') == '07:59') {
|
||||||
|
\Artisan::call('send:vehicle-report', [
|
||||||
|
'schedule_type' => $rule->schedule_type,
|
||||||
|
'plant' => $rule->plant,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
namespace App\Console\Commands;
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
use App\Mail\test;
|
use App\Mail\test;
|
||||||
|
use App\Models\AlertMailRule;
|
||||||
use App\Models\InvoiceValidation;
|
use App\Models\InvoiceValidation;
|
||||||
use App\Models\Plant;
|
use App\Models\Plant;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
@@ -31,23 +32,37 @@ class SendInvoiceReport extends Command
|
|||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
$schedule = $this->argument('schedule_type');
|
$schedule = $this->argument('schedule_type');
|
||||||
// $scheduleType = $this->argument('scheduleType');
|
$plantIdArg = (int) $this->argument('plant');
|
||||||
$plantIdArg = (int) $this->argument('plant'); // can be 0 for all plants
|
|
||||||
|
|
||||||
$mailRules = \App\Models\AlertMailRule::where('module', 'InvoiceValidation')->get()->groupBy('rule_name');
|
$invoiceRules = AlertMailRule::where('module', 'InvoiceValidation')
|
||||||
|
->where('rule_name', 'InvoiceMail')
|
||||||
|
->where('plant', $plantIdArg)
|
||||||
|
->get();
|
||||||
|
|
||||||
// $startDate = now()->setTime(8, 0, 0);
|
$serialRules = AlertMailRule::where('module', 'InvoiceValidation')
|
||||||
// $endDate = now()->copy()->addDay()->setTime(8, 0, 0);
|
->where('rule_name', 'SerialInvoiceMail')
|
||||||
|
->where('plant', $plantIdArg)
|
||||||
|
->get();
|
||||||
|
|
||||||
|
$materialRules = AlertMailRule::where('module', 'InvoiceValidation')
|
||||||
|
->where('rule_name', 'MaterialInvoiceMail')
|
||||||
|
->where('plant', $plantIdArg)
|
||||||
|
->get();
|
||||||
|
|
||||||
|
// $this->info('Invoice Rules: ' . $invoiceRules->toJson());
|
||||||
|
// $this->info('Serial Rules: ' . $serialRules->toJson());
|
||||||
|
// $this->info('Material Rules: ' . $materialRules->toJson());
|
||||||
|
|
||||||
$serialTableData = [];
|
$serialTableData = [];
|
||||||
$materialTableData = [];
|
$materialTableData = [];
|
||||||
$bundleTableData = [];
|
$bundleTableData = [];
|
||||||
|
|
||||||
// Get plant IDs: either one plant or all
|
|
||||||
$plantIds = $plantIdArg == 0
|
$plantIds = $plantIdArg == 0
|
||||||
? InvoiceValidation::select('plant_id')->distinct()->pluck('plant_id')->toArray()
|
? InvoiceValidation::select('plant_id')->distinct()->pluck('plant_id')->toArray()
|
||||||
: [$plantIdArg];
|
: [$plantIdArg];
|
||||||
|
|
||||||
|
$isPlantRun = $plantIdArg != 0;
|
||||||
|
|
||||||
$no = 1;
|
$no = 1;
|
||||||
if (strtolower($schedule) == 'daily') {
|
if (strtolower($schedule) == 'daily') {
|
||||||
$startDate = now()->subDay()->setTime(8, 0, 0);
|
$startDate = now()->subDay()->setTime(8, 0, 0);
|
||||||
@@ -176,71 +191,119 @@ class SendInvoiceReport extends Command
|
|||||||
$no++;
|
$no++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$mail = new test($serialTableData, $materialTableData, $bundleTableData, $schedule);
|
// $mail = new test($serialTableData, $materialTableData, $bundleTableData, $schedule);
|
||||||
$contentVars = $mail->content()->with;
|
// $contentVars = $mail->content()->with;
|
||||||
|
|
||||||
$this->info($contentVars['greeting'] ?? 'Invoice Report');
|
$this->info($contentVars['greeting'] ?? 'Invoice Report');
|
||||||
|
|
||||||
// Send to SerialInvoiceMail recipients
|
// Send to SerialInvoiceMail recipients
|
||||||
if ($mailRules->has('SerialInvoiceMail')) {
|
// if ($mailRules->has('SerialInvoiceMail')) {
|
||||||
// $emails = $mailRules['SerialInvoiceMail']->pluck('email')->unique()->toArray();
|
|
||||||
// foreach ($emails as $email) {
|
|
||||||
// Mail::to($email)->send(new test($serialTableData, [], [], $schedule));
|
|
||||||
// }
|
|
||||||
foreach ($mailRules->get('SerialInvoiceMail') as $rule) {
|
|
||||||
|
|
||||||
$toEmails = collect(explode(',', $rule->email))
|
// foreach ($mailRules->get('SerialInvoiceMail') as $rule) {
|
||||||
->map(fn ($e) => trim($e))
|
|
||||||
->filter()
|
|
||||||
->unique()
|
|
||||||
->values()
|
|
||||||
->toArray();
|
|
||||||
|
|
||||||
$ccEmails = collect(explode(',', $rule->cc_emails ?? ''))
|
// $filteredSerialData = [];
|
||||||
->map(fn ($e) => trim($e))
|
|
||||||
->filter()
|
|
||||||
->unique()
|
|
||||||
->values()
|
|
||||||
->toArray();
|
|
||||||
|
|
||||||
if (empty($toEmails)) {
|
// $toEmails = collect(explode(',', $rule->email))
|
||||||
$this->warn("Skipping rule ID {$rule->id} — no valid To emails found.");
|
// ->map(fn ($e) => trim($e))
|
||||||
|
// ->filter()
|
||||||
|
// ->unique()
|
||||||
|
// ->values()
|
||||||
|
// ->toArray();
|
||||||
|
|
||||||
|
// $ccEmails = collect(explode(',', $rule->cc_emails ?? ''))
|
||||||
|
// ->map(fn ($e) => trim($e))
|
||||||
|
// ->filter()
|
||||||
|
// ->unique()
|
||||||
|
// ->values()
|
||||||
|
// ->toArray();
|
||||||
|
|
||||||
|
// if (empty($toEmails)) {
|
||||||
|
// $this->warn("Skipping rule ID {$rule->id} — no valid To emails found.");
|
||||||
|
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if ($rule->plant == 0) {
|
||||||
|
// $filteredSerialData = $serialTableData;
|
||||||
|
|
||||||
|
// } else {
|
||||||
|
// $filteredSerialData = collect($serialTableData)
|
||||||
|
// ->where('plant_id', $rule->plant)
|
||||||
|
// ->values()
|
||||||
|
// ->toArray();
|
||||||
|
// }
|
||||||
|
|
||||||
|
// if (empty($filteredSerialData)) {
|
||||||
|
// $this->warn("Skipping empty mail for rule {$rule->id}");
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// // \Mail::to($toEmails)
|
||||||
|
// // ->cc($ccEmails)
|
||||||
|
// // ->send(new test(
|
||||||
|
// // $filteredSerialData,
|
||||||
|
// // [],
|
||||||
|
// // [],
|
||||||
|
// // $schedule
|
||||||
|
// // ));
|
||||||
|
|
||||||
|
// $mail = new test(
|
||||||
|
// $filteredSerialData,
|
||||||
|
// [],
|
||||||
|
// [],
|
||||||
|
// $schedule
|
||||||
|
// );
|
||||||
|
|
||||||
|
// \Mail::to($toEmails)
|
||||||
|
// ->cc($ccEmails)
|
||||||
|
// ->send($mail);
|
||||||
|
|
||||||
|
// // \Mail::to($toEmails)->cc($ccEmails)->send(new test($serialTableData, [], [], $schedule));
|
||||||
|
|
||||||
|
// $this->info("Mail sent for rule ID {$rule->id} → To: ".implode(', ', $toEmails).($ccEmails ? ' | CC: '.implode(', ', $ccEmails) : ''));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
if ($serialRules->isNotEmpty()) {
|
||||||
|
|
||||||
|
foreach ($serialRules as $rule) {
|
||||||
|
|
||||||
|
if (
|
||||||
|
$isPlantRun &&
|
||||||
|
$plantIdArg != 0 &&
|
||||||
|
$rule->plant != 0 &&
|
||||||
|
$rule->plant != $plantIdArg
|
||||||
|
) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($rule->plant == 0) {
|
if (
|
||||||
$filteredSerialData = $serialTableData;
|
$plantIdArg == 0 &&
|
||||||
|
$rule->plant != 0
|
||||||
} else {
|
) {
|
||||||
$filteredSerialData = collect($serialTableData)
|
continue;
|
||||||
->where('plant_id', $rule->plant)
|
|
||||||
->values()
|
|
||||||
->toArray();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
\Mail::to($toEmails)
|
$data = collect($serialTableData)
|
||||||
->cc($ccEmails)
|
->when($rule->plant != 0, fn ($q) => $q->where('plant_id', $rule->plant))
|
||||||
->send(new test(
|
->values()
|
||||||
$filteredSerialData,
|
->toArray();
|
||||||
[],
|
|
||||||
[],
|
|
||||||
$schedule
|
|
||||||
));
|
|
||||||
|
|
||||||
// \Mail::to($toEmails)->cc($ccEmails)->send(new test($serialTableData, [], [], $schedule));
|
if (empty($data)) continue;
|
||||||
|
|
||||||
$this->info("Mail sent for rule ID {$rule->id} → To: ".implode(', ', $toEmails).($ccEmails ? ' | CC: '.implode(', ', $ccEmails) : ''));
|
\Mail::to($rule->email)
|
||||||
|
->cc($rule->cc_emails ?? [])
|
||||||
|
->send(new test($data, [], [], $schedule));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send to MaterialInvoiceMail recipients (material + bundle table)
|
// Send to MaterialInvoiceMail recipients (material + bundle table)
|
||||||
if ($mailRules->has('MaterialInvoiceMail')) {
|
if ($materialRules->isNotEmpty()) {
|
||||||
// $emails = $mailRules['MaterialInvoiceMail']->pluck('email')->unique()->toArray();
|
// $emails = $mailRules['MaterialInvoiceMail']->pluck('email')->unique()->toArray();
|
||||||
// foreach ($emails as $email) {
|
// foreach ($emails as $email) {
|
||||||
// Mail::to($email)->send(new test([], $materialTableData, $bundleTableData, $schedule));
|
// Mail::to($email)->send(new test([], $materialTableData, $bundleTableData, $schedule));
|
||||||
// }
|
// }
|
||||||
foreach ($mailRules->get('MaterialInvoiceMail') as $rule) {
|
foreach ($materialRules as $rule) {
|
||||||
|
|
||||||
$toEmails = collect(explode(',', $rule->email))
|
$toEmails = collect(explode(',', $rule->email))
|
||||||
->map(fn ($e) => trim($e))
|
->map(fn ($e) => trim($e))
|
||||||
@@ -296,14 +359,27 @@ class SendInvoiceReport extends Command
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Send to InvoiceMail recipients (all three tables)
|
if ($invoiceRules->isNotEmpty()) {
|
||||||
if ($mailRules->has('InvoiceMail')) {
|
|
||||||
//$emails = $mailRules['InvoiceMail']->pluck('email')->unique()->toArray();
|
foreach ($invoiceRules as $rule) {
|
||||||
// foreach ($emails as $email) {
|
|
||||||
// Mail::to($email)->send(new test($serialTableData, $materialTableData, $bundleTableData, $schedule));
|
// During global run, only execute plant=0 rule
|
||||||
// $this->info("✅ Sent InvoiceMail to: {$email}");
|
if ($plantIdArg == 0 && $rule->plant != 0) {
|
||||||
// }
|
continue;
|
||||||
foreach ($mailRules->get('InvoiceMail') as $rule) {
|
}
|
||||||
|
|
||||||
|
// During plant run, only execute matching rule
|
||||||
|
if (
|
||||||
|
$plantIdArg != 0 &&
|
||||||
|
$rule->plant != 0 &&
|
||||||
|
$rule->plant != $plantIdArg
|
||||||
|
) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$filteredSerialData = [];
|
||||||
|
$filteredMaterialData = [];
|
||||||
|
$filteredBundleData = [];
|
||||||
|
|
||||||
$toEmails = collect(explode(',', $rule->email))
|
$toEmails = collect(explode(',', $rule->email))
|
||||||
->map(fn ($e) => trim($e))
|
->map(fn ($e) => trim($e))
|
||||||
@@ -325,7 +401,6 @@ class SendInvoiceReport extends Command
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// FILTER DATA
|
|
||||||
if ($rule->plant == 0) {
|
if ($rule->plant == 0) {
|
||||||
|
|
||||||
$filteredSerialData = $serialTableData;
|
$filteredSerialData = $serialTableData;
|
||||||
@@ -350,18 +425,45 @@ class SendInvoiceReport extends Command
|
|||||||
->toArray();
|
->toArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Prevent empty mails
|
||||||
|
if (
|
||||||
|
empty($filteredSerialData) &&
|
||||||
|
empty($filteredMaterialData) &&
|
||||||
|
empty($filteredBundleData)
|
||||||
|
) {
|
||||||
|
$this->warn("Skipping empty mail for rule {$rule->id}");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// \Mail::to($toEmails)
|
||||||
|
// ->cc($ccEmails)
|
||||||
|
// ->send(new test(
|
||||||
|
// $filteredSerialData,
|
||||||
|
// $filteredMaterialData,
|
||||||
|
// $filteredBundleData,
|
||||||
|
// $schedule
|
||||||
|
// ));
|
||||||
|
|
||||||
|
$mail = new test(
|
||||||
|
$filteredSerialData,
|
||||||
|
$filteredMaterialData,
|
||||||
|
$filteredBundleData,
|
||||||
|
$schedule
|
||||||
|
);
|
||||||
|
|
||||||
\Mail::to($toEmails)
|
\Mail::to($toEmails)
|
||||||
->cc($ccEmails)
|
->cc($ccEmails)
|
||||||
->send(new test(
|
->send($mail);
|
||||||
$filteredSerialData,
|
|
||||||
$filteredMaterialData,
|
// \Mail::raw('Test mail', function ($message) use ($toEmails, $ccEmails) {
|
||||||
$filteredBundleData,
|
// $message->to($toEmails)
|
||||||
$schedule
|
// ->cc($ccEmails)
|
||||||
));
|
// ->subject('Test');
|
||||||
|
// });
|
||||||
|
|
||||||
// \Mail::to($toEmails)->cc($ccEmails)->send(new test($serialTableData, $materialTableData, $bundleTableData, $schedule));
|
// \Mail::to($toEmails)->cc($ccEmails)->send(new test($serialTableData, $materialTableData, $bundleTableData, $schedule));
|
||||||
|
|
||||||
$this->info("Mail sent for rule ID {$rule->id} → To: ".implode(', ', $toEmails).($ccEmails ? ' | CC: '.implode(', ', $ccEmails) : ''));
|
// $this->info("Mail sent for rule ID {$rule->id} → To: ".implode(', ', $toEmails).($ccEmails ? ' | CC: '.implode(', ', $ccEmails) : ''));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
134
app/Console/Commands/SendVehicleReport.php
Normal file
134
app/Console/Commands/SendVehicleReport.php
Normal file
@@ -0,0 +1,134 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use App\Mail\VehicleEntryMail;
|
||||||
|
use App\Models\AlertMailRule;
|
||||||
|
use App\Models\Plant;
|
||||||
|
use App\Models\VehicleEntry;
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use Mail;
|
||||||
|
|
||||||
|
class SendVehicleReport extends Command
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* The name and signature of the console command.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $signature = 'send:vehicle-report {schedule_type} {plant}';
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The console command description.
|
||||||
|
*
|
||||||
|
* @var string
|
||||||
|
*/
|
||||||
|
protected $description = 'Command description';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute the console command.
|
||||||
|
*/
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
|
||||||
|
$scheduleType = $this->argument('schedule_type');
|
||||||
|
$plantId = (int) $this->argument('plant');
|
||||||
|
|
||||||
|
$mailRules = AlertMailRule::where('module', 'VehicleReport')
|
||||||
|
->where('rule_name', 'VehicleReportMail')
|
||||||
|
->where('schedule_type', $scheduleType)
|
||||||
|
->get();
|
||||||
|
|
||||||
|
$plants = ($plantId == 0)
|
||||||
|
? Plant::all()
|
||||||
|
: Plant::where('id', $plantId)->get();
|
||||||
|
|
||||||
|
if ($plants->isEmpty()) {
|
||||||
|
$this->error('No valid plant(s) found.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strtolower($scheduleType) == 'daily') {
|
||||||
|
$startDate = now()->subDay()->setTime(8, 0, 0);
|
||||||
|
$endDate = now()->setTime(8, 0, 0);
|
||||||
|
} else {
|
||||||
|
$startDate = now()->setTime(8, 0, 0);
|
||||||
|
$endDate = now()->copy()->addDay()->setTime(8, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach ($plants as $plant) {
|
||||||
|
|
||||||
|
$vehicleEntries = VehicleEntry::select([
|
||||||
|
'vehicle_number',
|
||||||
|
'boom_opened',
|
||||||
|
'entry_time',
|
||||||
|
'exit_time',
|
||||||
|
'duration',
|
||||||
|
'type',
|
||||||
|
])
|
||||||
|
->where('plant_id', $plant->id)
|
||||||
|
->whereBetween('created_at', [$startDate, $endDate])
|
||||||
|
->get();
|
||||||
|
|
||||||
|
if ($vehicleEntries->isEmpty()) {
|
||||||
|
$this->warn("No records for {$plant->name}");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$tableData = [];
|
||||||
|
$no = 1;
|
||||||
|
|
||||||
|
foreach ($vehicleEntries as $vehicleEntry) {
|
||||||
|
$tableData[] = [
|
||||||
|
'no' => $no++,
|
||||||
|
'plant' => $plant->name,
|
||||||
|
'vehicleNumber' => strtoupper($vehicleEntry->vehicle_number),
|
||||||
|
'entryTime' => $vehicleEntry->entry_time,
|
||||||
|
'exitTime' => $vehicleEntry->exit_time,
|
||||||
|
'duration' => $vehicleEntry->duration,
|
||||||
|
'type' => $vehicleEntry->type,
|
||||||
|
'boom' => $vehicleEntry->boom_opened,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($plantId == 0) {
|
||||||
|
$rule = $mailRules->first();
|
||||||
|
} else {
|
||||||
|
$rule = $mailRules->where('plant', $plant->id)->first();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$rule) {
|
||||||
|
$this->warn("No mail rule for {$plant->name}");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$toEmails = collect(explode(',', $rule->email))
|
||||||
|
->map(fn($e) => trim($e))
|
||||||
|
->filter()
|
||||||
|
->unique()
|
||||||
|
->values()
|
||||||
|
->toArray();
|
||||||
|
|
||||||
|
$ccEmails = collect(explode(',', $rule->cc_emails))
|
||||||
|
->map(fn($e) => trim($e))
|
||||||
|
->filter()
|
||||||
|
->unique()
|
||||||
|
->values()
|
||||||
|
->toArray();
|
||||||
|
|
||||||
|
$mail = new VehicleEntryMail(
|
||||||
|
$scheduleType,
|
||||||
|
$tableData,
|
||||||
|
'Daily Vehicle Transit Report'
|
||||||
|
);
|
||||||
|
|
||||||
|
Mail::to($toEmails)->cc($ccEmails)->send($mail);
|
||||||
|
|
||||||
|
$this->info("Mail sent for {$plant->name}");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
70
app/Filament/Exports/AsrsItemValidationExporter.php
Normal file
70
app/Filament/Exports/AsrsItemValidationExporter.php
Normal file
@@ -0,0 +1,70 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Exports;
|
||||||
|
|
||||||
|
use App\Models\AsrsItemValidation;
|
||||||
|
use Filament\Actions\Exports\ExportColumn;
|
||||||
|
use Filament\Actions\Exports\Exporter;
|
||||||
|
use Filament\Actions\Exports\Models\Export;
|
||||||
|
|
||||||
|
class AsrsItemValidationExporter extends Exporter
|
||||||
|
{
|
||||||
|
protected static ?string $model = AsrsItemValidation::class;
|
||||||
|
|
||||||
|
public static function getColumns(): array
|
||||||
|
{
|
||||||
|
static $rowNumber = 0;
|
||||||
|
return [
|
||||||
|
ExportColumn::make('no')
|
||||||
|
->label('NO')
|
||||||
|
->state(function ($record) use (&$rowNumber) {
|
||||||
|
// Increment and return the row number
|
||||||
|
return ++$rowNumber;
|
||||||
|
}),
|
||||||
|
ExportColumn::make('plant.code')
|
||||||
|
->label('PLANT'),
|
||||||
|
ExportColumn::make('item_code')
|
||||||
|
->label('ITEM CODE'),
|
||||||
|
ExportColumn::make('item_description')
|
||||||
|
->label('ITEM DESCRIPTION'),
|
||||||
|
ExportColumn::make('uom')
|
||||||
|
->label('UOM'),
|
||||||
|
ExportColumn::make('material_type')
|
||||||
|
->label('MATERIAL TYPE'),
|
||||||
|
ExportColumn::make('material_group')
|
||||||
|
->label('MATERIAL GROUP'),
|
||||||
|
ExportColumn::make('mhe')
|
||||||
|
->label('MHE'),
|
||||||
|
ExportColumn::make('bin_quantity')
|
||||||
|
->label('BIN QUANTITY'),
|
||||||
|
ExportColumn::make('asrs')
|
||||||
|
->label('ASRS'),
|
||||||
|
ExportColumn::make('asrs_category')
|
||||||
|
->label('ASRS CATEGORY'),
|
||||||
|
ExportColumn::make('status')
|
||||||
|
->label('STATUS'),
|
||||||
|
ExportColumn::make('created_at')
|
||||||
|
->label('CREATED AT'),
|
||||||
|
ExportColumn::make('updated_at')
|
||||||
|
->label('UPDATED AT'),
|
||||||
|
ExportColumn::make('created_by')
|
||||||
|
->label('CREATED BY'),
|
||||||
|
ExportColumn::make('updated_by')
|
||||||
|
->label('UPDATED BY'),
|
||||||
|
ExportColumn::make('deleted_at')
|
||||||
|
->label('DELETED AT')
|
||||||
|
->enabledByDefault(false),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getCompletedNotificationBody(Export $export): string
|
||||||
|
{
|
||||||
|
$body = 'Your asrs item validation export has completed and ' . number_format($export->successful_rows) . ' ' . str('row')->plural($export->successful_rows) . ' exported.';
|
||||||
|
|
||||||
|
if ($failedRowsCount = $export->getFailedRowsCount()) {
|
||||||
|
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to export.';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $body;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -34,6 +34,17 @@ class InvoiceValidationExporter extends Exporter
|
|||||||
->label('ITEM CODE'),
|
->label('ITEM CODE'),
|
||||||
ExportColumn::make('stickerMaster.item.description')
|
ExportColumn::make('stickerMaster.item.description')
|
||||||
->label('ITEM DESCRIPTION'),
|
->label('ITEM DESCRIPTION'),
|
||||||
|
ExportColumn::make('stickerMaster.item.uom')
|
||||||
|
->label('UNIT OF MEASURE'),
|
||||||
|
ExportColumn::make('stickerMaster.material_type')
|
||||||
|
->label('MATERIAL TYPE')
|
||||||
|
->formatStateUsing(fn ($state) => match ($state) {
|
||||||
|
1 => 'Individual',
|
||||||
|
2 => 'Bundle',
|
||||||
|
3 => 'Quantity',
|
||||||
|
4 => 'Bundle Individual',
|
||||||
|
default => '-',
|
||||||
|
}),
|
||||||
ExportColumn::make('motor_scanned_status')
|
ExportColumn::make('motor_scanned_status')
|
||||||
->label('MOTOR SCANNED STATUS'),
|
->label('MOTOR SCANNED STATUS'),
|
||||||
ExportColumn::make('pump_scanned_status')
|
ExportColumn::make('pump_scanned_status')
|
||||||
|
|||||||
@@ -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'),
|
||||||
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,8 @@ class ProductCharacteristicsMasterExporter extends Exporter
|
|||||||
->label('CHARACTERISTICS TYPE'),
|
->label('CHARACTERISTICS TYPE'),
|
||||||
ExportColumn::make('name')
|
ExportColumn::make('name')
|
||||||
->label('CHARACTERISTICS NAME'),
|
->label('CHARACTERISTICS NAME'),
|
||||||
|
ExportColumn::make('category')
|
||||||
|
->label('CATEGORY'),
|
||||||
ExportColumn::make('inspection_type')
|
ExportColumn::make('inspection_type')
|
||||||
->label('INSPECTION TYPE'),
|
->label('INSPECTION TYPE'),
|
||||||
ExportColumn::make('lower')
|
ExportColumn::make('lower')
|
||||||
|
|||||||
118
app/Filament/Imports/AsrsItemValidationImporter.php
Normal file
118
app/Filament/Imports/AsrsItemValidationImporter.php
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Imports;
|
||||||
|
|
||||||
|
use App\Models\AsrsItemValidation;
|
||||||
|
use App\Models\Plant;
|
||||||
|
use Filament\Actions\Imports\ImportColumn;
|
||||||
|
use Filament\Actions\Imports\Importer;
|
||||||
|
use Filament\Actions\Imports\Models\Import;
|
||||||
|
use Filament\Facades\Filament;
|
||||||
|
use Str;
|
||||||
|
use Filament\Actions\Imports\Exceptions\RowImportFailedException;
|
||||||
|
|
||||||
|
class AsrsItemValidationImporter extends Importer
|
||||||
|
{
|
||||||
|
protected static ?string $model = AsrsItemValidation::class;
|
||||||
|
|
||||||
|
public static function getColumns(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
ImportColumn::make('plant')
|
||||||
|
->requiredMapping()
|
||||||
|
->exampleHeader('PLANT CODE')
|
||||||
|
->example('1000')
|
||||||
|
->label('PLANT CODE')
|
||||||
|
->relationship(resolveUsing: 'code')
|
||||||
|
->rules(['required']),
|
||||||
|
ImportColumn::make('item_code')
|
||||||
|
->exampleHeader('ITEM CODE')
|
||||||
|
->example('ITEM001')
|
||||||
|
->label('ITEM CODE')
|
||||||
|
->rules(['required']),
|
||||||
|
ImportColumn::make('item_description')
|
||||||
|
->exampleHeader('ITEM DESCRIPTION')
|
||||||
|
->example('Item Description')
|
||||||
|
->label('ITEM DESCRIPTION'),
|
||||||
|
ImportColumn::make('uom')
|
||||||
|
->exampleHeader('UOM')
|
||||||
|
->example('EA')
|
||||||
|
->label('UOM'),
|
||||||
|
ImportColumn::make('material_type')
|
||||||
|
->exampleHeader('MATERIAL TYPE')
|
||||||
|
->example('Material Type')
|
||||||
|
->label('MATERIAL TYPE'),
|
||||||
|
ImportColumn::make('material_group')
|
||||||
|
->exampleHeader('MATERIAL GROUP')
|
||||||
|
->example('Material Group')
|
||||||
|
->label('MATERIAL GROUP'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function resolveRecord(): ?AsrsItemValidation
|
||||||
|
{
|
||||||
|
$warnMsg = [];
|
||||||
|
$plantCod = trim($this->data['plant']) ?? '';
|
||||||
|
$iCode = trim($this->data['item_code']) ?? '';
|
||||||
|
$itemDes = trim($this->data['item_description']) ?? '';
|
||||||
|
$uom = trim($this->data['uom']) ?? '';
|
||||||
|
$materialType = trim($this->data['material_type']) ?? '';
|
||||||
|
$materialGroup = trim($this->data['material_group']) ?? '';
|
||||||
|
$createdBy = Filament::auth()->user()?->name ?? '';
|
||||||
|
$updatedBy = $createdBy;
|
||||||
|
|
||||||
|
$plantId = null;
|
||||||
|
|
||||||
|
if ($plantCod == null || $plantCod == '' || ! $plantCod) {
|
||||||
|
$warnMsg[] = "Plant code can't be empty!";
|
||||||
|
} elseif (! is_numeric($plantCod)) {
|
||||||
|
$warnMsg[] = "Plant code '{$plantCod}' should contain only numeric values!";
|
||||||
|
} elseif (Str::length($plantCod) < 4 || Str::length($plantCod) > 7) {
|
||||||
|
$warnMsg[] = "Plant code '{$plantCod}' must be between 4 and 7 digits only!";
|
||||||
|
} elseif (! preg_match('/^[1-9]\d{3,6}$/', $plantCod)) {
|
||||||
|
$warnMsg[] = "Invalid plant code '{$plantCod}' found!";
|
||||||
|
} else {
|
||||||
|
$plant = Plant::where('code', $plantCod)->first();
|
||||||
|
if (! $plant) {
|
||||||
|
$warnMsg[] = 'Plant not found!';
|
||||||
|
} else {
|
||||||
|
$plantId = $plant->id;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (Str::length($iCode) < 6 || ! ctype_alnum($iCode)) {
|
||||||
|
$warnMsg[] = 'Invalid item code found';
|
||||||
|
}
|
||||||
|
if (Str::length($itemDes) < 5) {
|
||||||
|
$warnMsg[] = 'Invalid description found';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($warnMsg)) {
|
||||||
|
throw new RowImportFailedException(implode(', ', $warnMsg));
|
||||||
|
}
|
||||||
|
|
||||||
|
return AsrsItemValidation::updateOrCreate([
|
||||||
|
'item_code' => $iCode,
|
||||||
|
'plant_id' => $plant->id,
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'item_description' => $itemDes,
|
||||||
|
'uom' => trim($this->data['uom']),
|
||||||
|
'material_type' => $materialType,
|
||||||
|
'material_group' => $materialGroup,
|
||||||
|
'created_by' => $createdBy,
|
||||||
|
'updated_by' => $updatedBy,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getCompletedNotificationBody(Import $import): string
|
||||||
|
{
|
||||||
|
$body = 'Your asrs item validation import has completed and ' . number_format($import->successful_rows) . ' ' . str('row')->plural($import->successful_rows) . ' imported.';
|
||||||
|
|
||||||
|
if ($failedRowsCount = $import->getFailedRowsCount()) {
|
||||||
|
$body .= ' ' . number_format($failedRowsCount) . ' ' . str('row')->plural($failedRowsCount) . ' failed to import.';
|
||||||
|
}
|
||||||
|
|
||||||
|
return $body;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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']),
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ class PlantImporter extends Importer
|
|||||||
$warnMsg[] = 'Name should contain at least 5 characters!';
|
$warnMsg[] = 'Name should contain at least 5 characters!';
|
||||||
}
|
}
|
||||||
if ($wareHouseNo == null || $wareHouseNo == '' || ! $wareHouseNo) {
|
if ($wareHouseNo == null || $wareHouseNo == '' || ! $wareHouseNo) {
|
||||||
$warnMsg[] = "Warehouse number can't be empty!";
|
// $warnMsg[] = "Warehouse number can't be empty!";
|
||||||
} elseif (! is_numeric($wareHouseNo)) {
|
} elseif (! is_numeric($wareHouseNo)) {
|
||||||
$warnMsg[] = 'Warehouse number should contain only numeric values!';
|
$warnMsg[] = 'Warehouse number should contain only numeric values!';
|
||||||
} elseif (Str::length($wareHouseNo) == 3) {
|
} elseif (Str::length($wareHouseNo) == 3) {
|
||||||
|
|||||||
@@ -70,6 +70,11 @@ class ProductCharacteristicsMasterImporter extends Importer
|
|||||||
->exampleHeader('CHARACTERISTICS NAME')
|
->exampleHeader('CHARACTERISTICS NAME')
|
||||||
->example(['TEST01', 'TEST02'])
|
->example(['TEST01', 'TEST02'])
|
||||||
->rules(['required']),
|
->rules(['required']),
|
||||||
|
ImportColumn::make('category')
|
||||||
|
->label('CATEGORY')
|
||||||
|
->requiredMapping()
|
||||||
|
->exampleHeader('CATEGORY')
|
||||||
|
->example(['Open Pump', 'Submersible Pump']),
|
||||||
ImportColumn::make('inspection_type')
|
ImportColumn::make('inspection_type')
|
||||||
->label('INSPECTION TYPE')
|
->label('INSPECTION TYPE')
|
||||||
->requiredMapping()
|
->requiredMapping()
|
||||||
@@ -110,6 +115,7 @@ class ProductCharacteristicsMasterImporter extends Importer
|
|||||||
$workCenter = trim($this->data['machine']) ?? null;
|
$workCenter = trim($this->data['machine']) ?? null;
|
||||||
$charTyp = trim($this->data['characteristics_type']) ?? null;
|
$charTyp = trim($this->data['characteristics_type']) ?? null;
|
||||||
$charNam = trim($this->data['name']) ?? null;
|
$charNam = trim($this->data['name']) ?? null;
|
||||||
|
$category = trim($this->data['category']) ?? null;
|
||||||
$inspectTyp = trim($this->data['inspection_type']) ?? null;
|
$inspectTyp = trim($this->data['inspection_type']) ?? null;
|
||||||
$lower = trim($this->data['lower']) ?? null;
|
$lower = trim($this->data['lower']) ?? null;
|
||||||
$middle = trim($this->data['middle']) ?? null;
|
$middle = trim($this->data['middle']) ?? null;
|
||||||
@@ -295,6 +301,7 @@ class ProductCharacteristicsMasterImporter extends Importer
|
|||||||
'name' => $charNam,
|
'name' => $charNam,
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
'category' => $category,
|
||||||
'inspection_type' => $inspectTyp,
|
'inspection_type' => $inspectTyp,
|
||||||
'lower' => $lower,
|
'lower' => $lower,
|
||||||
'middle' => $middle,
|
'middle' => $middle,
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class ProductionOrderImporter extends Importer
|
|||||||
->requiredMapping()
|
->requiredMapping()
|
||||||
->label('PLANT CODE')
|
->label('PLANT CODE')
|
||||||
->exampleHeader('PLANT CODE')
|
->exampleHeader('PLANT CODE')
|
||||||
->example('1000')
|
->example('TEST007')
|
||||||
->relationship(resolveUsing: 'code')
|
->relationship(resolveUsing: 'code')
|
||||||
->rules(['required']),
|
->rules(['required']),
|
||||||
ImportColumn::make('item')
|
ImportColumn::make('item')
|
||||||
|
|||||||
@@ -273,8 +273,8 @@ class StickerMasterImporter extends Importer
|
|||||||
if (Str::length($this->data['bundle_quantity']) > 0 && (! is_numeric($this->data['bundle_quantity']) || $this->data['bundle_quantity'] <= 1)) {
|
if (Str::length($this->data['bundle_quantity']) > 0 && (! is_numeric($this->data['bundle_quantity']) || $this->data['bundle_quantity'] <= 1)) {
|
||||||
$warnMsg[] = "Bundle quantity must be greater than or equal to '2' or empty";
|
$warnMsg[] = "Bundle quantity must be greater than or equal to '2' or empty";
|
||||||
}
|
}
|
||||||
if (Str::length($this->data['material_type']) > 0 && $this->data['material_type'] != '1' && $this->data['material_type'] != '2' && $this->data['material_type'] != '3') { // ($this->data['material_type'] != null) &&
|
if (Str::length($this->data['material_type']) > 0 && $this->data['material_type'] != '1' && $this->data['material_type'] != '2' && $this->data['material_type'] != '3' && $this->data['material_type'] != '4') { // ($this->data['material_type'] != null) &&
|
||||||
$warnMsg[] = 'Material type must be 1 or 2 or 3 or empty';
|
$warnMsg[] = 'Material type must be 1 or 2 or 3 or 4 or empty';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($warnMsg)) {
|
if (empty($warnMsg)) {
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ class Dashboard extends \Filament\Pages\Dashboard
|
|||||||
|
|
||||||
protected static string $view = 'filament.pages.dashboard';
|
protected static string $view = 'filament.pages.dashboard';
|
||||||
|
|
||||||
|
protected static ?string $slug = 'welcome';
|
||||||
|
|
||||||
// public function mount(): void
|
// public function mount(): void
|
||||||
// {
|
// {
|
||||||
// session()->forget(['selected_plant']);
|
// session()->forget(['selected_plant']);
|
||||||
|
|||||||
@@ -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' : '',
|
||||||
|
|||||||
@@ -59,6 +59,7 @@ class AlertMailRuleResource extends Resource
|
|||||||
'QualityValidation' => 'QualityValidation',
|
'QualityValidation' => 'QualityValidation',
|
||||||
'InvoiceTransit' => 'InvoiceTransit',
|
'InvoiceTransit' => 'InvoiceTransit',
|
||||||
'ImportTransit' => 'ImportTransit',
|
'ImportTransit' => 'ImportTransit',
|
||||||
|
'VehicleReport' => 'VehicleReport',
|
||||||
]),
|
]),
|
||||||
Forms\Components\Select::make('rule_name')
|
Forms\Components\Select::make('rule_name')
|
||||||
->label('Rule Name')
|
->label('Rule Name')
|
||||||
@@ -71,6 +72,7 @@ class AlertMailRuleResource extends Resource
|
|||||||
'QualityMail' => 'Quality Mail',
|
'QualityMail' => 'Quality Mail',
|
||||||
'InvoiceTransitMail' => 'Invoice Transit Mail',
|
'InvoiceTransitMail' => 'Invoice Transit Mail',
|
||||||
'ImportTransitMail' => 'Import Transit Mail',
|
'ImportTransitMail' => 'Import Transit Mail',
|
||||||
|
'VehicleReportMail' => 'Vehicle Report Mail',
|
||||||
])
|
])
|
||||||
->required(),
|
->required(),
|
||||||
Forms\Components\TextInput::make('email')
|
Forms\Components\TextInput::make('email')
|
||||||
|
|||||||
419
app/Filament/Resources/AsrsItemValidationResource.php
Normal file
419
app/Filament/Resources/AsrsItemValidationResource.php
Normal file
@@ -0,0 +1,419 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources;
|
||||||
|
|
||||||
|
use App\Filament\Exports\AsrsItemValidationExporter;
|
||||||
|
use App\Filament\Imports\AsrsItemValidationImporter;
|
||||||
|
use App\Filament\Resources\AsrsItemValidationResource\Pages;
|
||||||
|
use App\Filament\Resources\AsrsItemValidationResource\RelationManagers;
|
||||||
|
use App\Models\AsrsItemValidation;
|
||||||
|
use Filament\Facades\Filament;
|
||||||
|
use Filament\Forms;
|
||||||
|
use Filament\Forms\Form;
|
||||||
|
use Filament\Resources\Resource;
|
||||||
|
use Filament\Tables;
|
||||||
|
use Filament\Tables\Table;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||||
|
use Filament\Tables\Actions\ExportAction;
|
||||||
|
use Filament\Tables\Actions\ImportAction;
|
||||||
|
use Filament\Forms\Get;
|
||||||
|
use App\Models\Item;
|
||||||
|
use Filament\Tables\Filters\Filter;
|
||||||
|
use Filament\Forms\Components\Select;
|
||||||
|
use Filament\Forms\Components\TextInput;
|
||||||
|
use Filament\Forms\Components\DateTimePicker;
|
||||||
|
use App\Models\Plant;
|
||||||
|
|
||||||
|
class AsrsItemValidationResource extends Resource
|
||||||
|
{
|
||||||
|
protected static ?string $model = AsrsItemValidation::class;
|
||||||
|
|
||||||
|
protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';
|
||||||
|
|
||||||
|
public static function form(Form $form): Form
|
||||||
|
{
|
||||||
|
return $form
|
||||||
|
->schema([
|
||||||
|
Forms\Components\Select::make('plant_id')
|
||||||
|
->label('Plant')
|
||||||
|
->relationship('plant', 'name')
|
||||||
|
->required()
|
||||||
|
->disabledOn('edit'),
|
||||||
|
Forms\Components\Select::make('item_code')
|
||||||
|
->label('Item Code')
|
||||||
|
->reactive()
|
||||||
|
->options(function (Get $get) {
|
||||||
|
$plantId = $get('plant_id');
|
||||||
|
|
||||||
|
if (!$plantId) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return AsrsItemValidation::where('plant_id', $plantId)
|
||||||
|
->pluck('item_code', 'item_code');
|
||||||
|
})
|
||||||
|
->searchable()
|
||||||
|
->afterStateUpdated(function (callable $set, $state) {
|
||||||
|
$item = AsrsItemValidation::where('item_code', $state)->first();
|
||||||
|
|
||||||
|
if ($item) {
|
||||||
|
$set('item_description', $item->item_description);
|
||||||
|
$set('uom', $item->uom);
|
||||||
|
} else {
|
||||||
|
$set('item_description', null);
|
||||||
|
$set('uom', null);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
->disabledOn('edit'),
|
||||||
|
Forms\Components\TextInput::make('item_description')
|
||||||
|
->label('Item Description')
|
||||||
|
->readOnly()
|
||||||
|
->reactive()
|
||||||
|
->disabledOn('edit'),
|
||||||
|
Forms\Components\TextInput::make('uom')
|
||||||
|
->label('UOM')
|
||||||
|
->readOnly()
|
||||||
|
->reactive()
|
||||||
|
->disabledOn('edit'),
|
||||||
|
Forms\Components\TextInput::make('material_type')
|
||||||
|
->label('Material Type')
|
||||||
|
->readOnly()
|
||||||
|
->reactive()
|
||||||
|
->disabledOn('edit'),
|
||||||
|
Forms\Components\TextInput::make('material_group')
|
||||||
|
->label('Material Group')
|
||||||
|
->readOnly()
|
||||||
|
->reactive()
|
||||||
|
->disabledOn('edit'),
|
||||||
|
Forms\Components\Select::make('mhe')
|
||||||
|
->label('MHE')
|
||||||
|
->options([
|
||||||
|
'Bin1000*800*750' => 'Bin 1000*800*750',
|
||||||
|
'Bin1000*800*1000' => 'Bin 1000*800*1000',
|
||||||
|
'Pallet' => 'Pallet',
|
||||||
|
'ChinaBin' => 'China Bin',
|
||||||
|
'PalletWithPlasticCrate' => 'Pallet With Plastic Crate',
|
||||||
|
'PlasticCrateBig' => 'Plastic Crate Big',
|
||||||
|
'PlasticCrateSmall' => 'Plastic Crate Small',
|
||||||
|
'OutsideStorage' => 'Outside Storage',
|
||||||
|
]),
|
||||||
|
Forms\Components\TextInput::make('bin_quantity')
|
||||||
|
->label('Bin Quantity'),
|
||||||
|
Forms\Components\Select::make('asrs')
|
||||||
|
->label('ASRS')
|
||||||
|
->options([
|
||||||
|
'ASRS1' => 'ASRS1',
|
||||||
|
'ASRS2' => 'ASRS2',
|
||||||
|
]),
|
||||||
|
Forms\Components\Select::make('asrs_category')
|
||||||
|
->label('ASRS Category')
|
||||||
|
->options([
|
||||||
|
'In' => 'In',
|
||||||
|
'Out' => 'Out',
|
||||||
|
]),
|
||||||
|
// Forms\Components\Select::make('status')
|
||||||
|
// ->label('Status')
|
||||||
|
// ->options([
|
||||||
|
// 'Updated' => 'Updated',
|
||||||
|
// 'NotUpdated' => 'Not Updated',
|
||||||
|
// ]),
|
||||||
|
Forms\Components\Hidden::make('created_by')
|
||||||
|
->label('Created By')
|
||||||
|
->default(Filament::auth()->user()?->name ?? ''),
|
||||||
|
Forms\Components\Hidden::make('updated_by')
|
||||||
|
->label('Updated By')
|
||||||
|
->default(Filament::auth()->user()?->name ?? ''),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function table(Table $table): Table
|
||||||
|
{
|
||||||
|
return $table
|
||||||
|
->columns([
|
||||||
|
Tables\Columns\TextColumn::make('No.')
|
||||||
|
->label('No.')
|
||||||
|
->getStateUsing(function ($record, $livewire, $column, $rowLoop) {
|
||||||
|
$paginator = $livewire->getTableRecords();
|
||||||
|
$perPage = method_exists($paginator, 'perPage') ? $paginator->perPage() : 10;
|
||||||
|
$currentPage = method_exists($paginator, 'currentPage') ? $paginator->currentPage() : 1;
|
||||||
|
return ($currentPage - 1) * $perPage + $rowLoop->iteration;
|
||||||
|
})
|
||||||
|
->alignCenter(),
|
||||||
|
Tables\Columns\TextColumn::make('plant.name')
|
||||||
|
->label('Plant')
|
||||||
|
->alignCenter()
|
||||||
|
->searchable()
|
||||||
|
->sortable(),
|
||||||
|
Tables\Columns\TextColumn::make('item_code')
|
||||||
|
->label('Item Code')
|
||||||
|
->alignCenter()
|
||||||
|
->searchable()
|
||||||
|
->sortable(),
|
||||||
|
Tables\Columns\TextColumn::make('item_description')
|
||||||
|
->label('Item Description')
|
||||||
|
->alignCenter()
|
||||||
|
->searchable(),
|
||||||
|
Tables\Columns\TextColumn::make('uom')
|
||||||
|
->label('UOM')
|
||||||
|
->alignCenter()
|
||||||
|
->searchable(),
|
||||||
|
Tables\Columns\TextColumn::make('material_type')
|
||||||
|
->label('Material Type')
|
||||||
|
->alignCenter()
|
||||||
|
->searchable(),
|
||||||
|
Tables\Columns\TextColumn::make('material_group')
|
||||||
|
->label('Material Group')
|
||||||
|
->alignCenter()
|
||||||
|
->searchable(),
|
||||||
|
Tables\Columns\TextColumn::make('mhe')
|
||||||
|
->label('MHE')
|
||||||
|
->alignCenter()
|
||||||
|
->searchable(),
|
||||||
|
Tables\Columns\TextColumn::make('bin_quantity')
|
||||||
|
->label('Bin Quantity')
|
||||||
|
->alignCenter()
|
||||||
|
->searchable(),
|
||||||
|
Tables\Columns\TextColumn::make('asrs')
|
||||||
|
->label('ASRS')
|
||||||
|
->alignCenter()
|
||||||
|
->searchable(),
|
||||||
|
Tables\Columns\TextColumn::make('asrs_category')
|
||||||
|
->label('ASRS Category')
|
||||||
|
->alignCenter()
|
||||||
|
->searchable(),
|
||||||
|
Tables\Columns\TextColumn::make('status')
|
||||||
|
->label('Status')
|
||||||
|
->alignCenter()
|
||||||
|
->searchable(),
|
||||||
|
Tables\Columns\TextColumn::make('created_at')
|
||||||
|
->dateTime()
|
||||||
|
->sortable()
|
||||||
|
->toggleable(isToggledHiddenByDefault: true),
|
||||||
|
Tables\Columns\TextColumn::make('updated_at')
|
||||||
|
->dateTime()
|
||||||
|
->sortable()
|
||||||
|
->toggleable(isToggledHiddenByDefault: true),
|
||||||
|
Tables\Columns\TextColumn::make('deleted_at')
|
||||||
|
->dateTime()
|
||||||
|
->sortable()
|
||||||
|
->toggleable(isToggledHiddenByDefault: true),
|
||||||
|
])
|
||||||
|
->filters([
|
||||||
|
Tables\Filters\TrashedFilter::make(),
|
||||||
|
Filter::make('advanced_filters')
|
||||||
|
->label('Advanced Filters')
|
||||||
|
->form([
|
||||||
|
Select::make('Plant')
|
||||||
|
->label('Search by Plant Name')
|
||||||
|
->nullable()
|
||||||
|
->searchable()
|
||||||
|
->reactive()
|
||||||
|
->options(function (callable $get) {
|
||||||
|
$userHas = Filament::auth()->user()->plant_id;
|
||||||
|
|
||||||
|
if ($userHas && strlen($userHas) > 0) {
|
||||||
|
return Plant::where('id', $userHas)->pluck('name', 'id')->toArray();
|
||||||
|
} else {
|
||||||
|
return Plant::whereHas('asrsItemValidations', function ($query) {
|
||||||
|
$query->whereNotNull('id');
|
||||||
|
})->orderBy('code')->pluck('name', 'id');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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_code', null);
|
||||||
|
}),
|
||||||
|
Select::make('item_code')
|
||||||
|
->label('Item Code')
|
||||||
|
->reactive()
|
||||||
|
->searchable()
|
||||||
|
->options(function (callable $get) {
|
||||||
|
|
||||||
|
$plantId = $get('Plant');
|
||||||
|
|
||||||
|
if (!$plantId) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return AsrsItemValidation::where('plant_id', $plantId)
|
||||||
|
->pluck('item_code', 'item_code')
|
||||||
|
->toArray();
|
||||||
|
})
|
||||||
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
|
$set('Rework', null);
|
||||||
|
}),
|
||||||
|
Select::make('status')
|
||||||
|
->label('Status')
|
||||||
|
->reactive()
|
||||||
|
->options(function (callable $get) {
|
||||||
|
|
||||||
|
$plantId = $get('Plant');
|
||||||
|
|
||||||
|
if (!$plantId) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
'Updated' => 'Updated',
|
||||||
|
'NotUpdated' => 'Not Updated',
|
||||||
|
];
|
||||||
|
})
|
||||||
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
|
$set('Rework', null);
|
||||||
|
}),
|
||||||
|
DateTimePicker::make('created_from')
|
||||||
|
->label('Created From')
|
||||||
|
->placeholder('Select From DateTime')
|
||||||
|
->reactive()
|
||||||
|
->native(false),
|
||||||
|
DateTimePicker::make('created_to')
|
||||||
|
->label('Created To')
|
||||||
|
->placeholder('Select To DateTime')
|
||||||
|
->reactive()
|
||||||
|
->native(false),
|
||||||
|
])
|
||||||
|
->query(function ($query, array $data) {
|
||||||
|
|
||||||
|
$status = $data['status'] ?? 'NotUpdated';
|
||||||
|
// Hide all records initially if no filters are applied
|
||||||
|
// if (empty($data['Plant']) && empty($data['item_code']) && empty($data['status']) && empty($data['created_from']) && empty($data['created_to'])) {
|
||||||
|
// // return $query->whereRaw('1 = 0');
|
||||||
|
// $query->where('status', 'NotUpdated');
|
||||||
|
// }
|
||||||
|
|
||||||
|
if (
|
||||||
|
empty($data['Plant']) &&
|
||||||
|
empty($data['item_code']) &&
|
||||||
|
empty($data['status']) &&
|
||||||
|
empty($data['created_from']) &&
|
||||||
|
empty($data['created_to'])
|
||||||
|
) {
|
||||||
|
// $query->where('status', 'NotUpdated');
|
||||||
|
$query->where(function ($q) {
|
||||||
|
$q->where('status', 'NotUpdated')
|
||||||
|
->orWhereNull('status')
|
||||||
|
->orWhere('status', '');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($data['Plant'])) {
|
||||||
|
$query->where('plant_id', $data['Plant']);
|
||||||
|
} else {
|
||||||
|
$userHas = Filament::auth()->user()->plant_id;
|
||||||
|
|
||||||
|
if ($userHas && strlen($userHas) > 0) {
|
||||||
|
return $query->whereRaw('1 = 0');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($data['item_code'])) {
|
||||||
|
$query->where('item_code', 'like', '%'.$data['item_code'].'%');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($data['status'])) {
|
||||||
|
|
||||||
|
if ($data['status'] == 'NotUpdated') {
|
||||||
|
$query->where(function ($q) {
|
||||||
|
$q->where('status', 'NotUpdated')
|
||||||
|
->orWhereNull('status')
|
||||||
|
->orWhere('status', '');
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
$query->where('status', $data['status']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($data['created_from'])) {
|
||||||
|
$query->where('created_at', '>=', $data['created_from']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($data['created_to'])) {
|
||||||
|
$query->where('created_at', '<=', $data['created_to']);
|
||||||
|
}
|
||||||
|
// $query->orderBy('created_at', 'asc');
|
||||||
|
})
|
||||||
|
->indicateUsing(function (array $data) {
|
||||||
|
$indicators = [];
|
||||||
|
|
||||||
|
if (! empty($data['Plant'])) {
|
||||||
|
$indicators[] = 'Plant Name: '.Plant::where('id', $data['Plant'])->value('name');
|
||||||
|
} else {
|
||||||
|
$userHas = Filament::auth()->user()->plant_id;
|
||||||
|
|
||||||
|
if ($userHas && strlen($userHas) > 0) {
|
||||||
|
return 'Plant Name: Choose plant to filter records.';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($data['item_code'])) {
|
||||||
|
$indicators[] = 'Item Code: '.$data['item_code'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($data['status'])) {
|
||||||
|
$indicators[] = 'Status: '.$data['status'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($data['created_from'])) {
|
||||||
|
$indicators[] = 'From: '.$data['created_from'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($data['created_to'])) {
|
||||||
|
$indicators[] = 'To: '.$data['created_to'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $indicators;
|
||||||
|
}),
|
||||||
|
])
|
||||||
|
->filtersFormMaxHeight('280px')
|
||||||
|
->actions([
|
||||||
|
Tables\Actions\ViewAction::make(),
|
||||||
|
Tables\Actions\EditAction::make(),
|
||||||
|
])
|
||||||
|
->bulkActions([
|
||||||
|
Tables\Actions\BulkActionGroup::make([
|
||||||
|
Tables\Actions\DeleteBulkAction::make(),
|
||||||
|
Tables\Actions\ForceDeleteBulkAction::make(),
|
||||||
|
Tables\Actions\RestoreBulkAction::make(),
|
||||||
|
]),
|
||||||
|
])
|
||||||
|
->headerActions([
|
||||||
|
ImportAction::make()
|
||||||
|
->importer(AsrsItemValidationImporter::class)
|
||||||
|
->visible(function() {
|
||||||
|
return Filament::auth()->user()->can('view import asrs item validation');
|
||||||
|
}),
|
||||||
|
ExportAction::make()
|
||||||
|
->exporter(AsrsItemValidationExporter::class)
|
||||||
|
->visible(function() {
|
||||||
|
return Filament::auth()->user()->can('view export asrs item validation');
|
||||||
|
}),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getRelations(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
//
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getPages(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
'index' => Pages\ListAsrsItemValidations::route('/'),
|
||||||
|
'create' => Pages\CreateAsrsItemValidation::route('/create'),
|
||||||
|
'view' => Pages\ViewAsrsItemValidation::route('/{record}'),
|
||||||
|
'edit' => Pages\EditAsrsItemValidation::route('/{record}/edit'),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getEloquentQuery(): Builder
|
||||||
|
{
|
||||||
|
return parent::getEloquentQuery()
|
||||||
|
->withoutGlobalScopes([
|
||||||
|
SoftDeletingScope::class,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\AsrsItemValidationResource\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\AsrsItemValidationResource;
|
||||||
|
use Filament\Actions;
|
||||||
|
use Filament\Resources\Pages\CreateRecord;
|
||||||
|
|
||||||
|
class CreateAsrsItemValidation extends CreateRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = AsrsItemValidationResource::class;
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\AsrsItemValidationResource\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\AsrsItemValidationResource;
|
||||||
|
use Filament\Actions;
|
||||||
|
use Filament\Resources\Pages\EditRecord;
|
||||||
|
|
||||||
|
class EditAsrsItemValidation extends EditRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = AsrsItemValidationResource::class;
|
||||||
|
|
||||||
|
protected function mutateFormDataBeforeSave(array $data): array
|
||||||
|
{
|
||||||
|
$data['status'] = 'Updated';
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getRedirectUrl(): string
|
||||||
|
{
|
||||||
|
return $this->getResource()::getUrl(
|
||||||
|
'index',
|
||||||
|
[
|
||||||
|
'tableFilters' => [
|
||||||
|
'advanced_filters' => [
|
||||||
|
'status' => 'NotUpdated',
|
||||||
|
],
|
||||||
|
],
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Actions\ViewAction::make(),
|
||||||
|
Actions\DeleteAction::make(),
|
||||||
|
Actions\ForceDeleteAction::make(),
|
||||||
|
Actions\RestoreAction::make(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\AsrsItemValidationResource\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\AsrsItemValidationResource;
|
||||||
|
use Filament\Actions;
|
||||||
|
use Filament\Resources\Pages\ListRecords;
|
||||||
|
|
||||||
|
class ListAsrsItemValidations extends ListRecords
|
||||||
|
{
|
||||||
|
protected static string $resource = AsrsItemValidationResource::class;
|
||||||
|
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Actions\CreateAction::make(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Resources\AsrsItemValidationResource\Pages;
|
||||||
|
|
||||||
|
use App\Filament\Resources\AsrsItemValidationResource;
|
||||||
|
use Filament\Actions;
|
||||||
|
use Filament\Resources\Pages\ViewRecord;
|
||||||
|
|
||||||
|
class ViewAsrsItemValidation extends ViewRecord
|
||||||
|
{
|
||||||
|
protected static string $resource = AsrsItemValidationResource::class;
|
||||||
|
|
||||||
|
protected function getHeaderActions(): array
|
||||||
|
{
|
||||||
|
return [
|
||||||
|
Actions\EditAction::make(),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2031,9 +2031,6 @@ class ClassCharacteristicResource extends Resource
|
|||||||
TextInput::make('zmm_heading')
|
TextInput::make('zmm_heading')
|
||||||
->label('Heading')
|
->label('Heading')
|
||||||
->placeholder('Enter Heading'),
|
->placeholder('Enter Heading'),
|
||||||
TextInput::make('model_type')
|
|
||||||
->label('Model Type')
|
|
||||||
->placeholder('Enter Model Type'),
|
|
||||||
DateTimePicker::make(name: 'created_from')
|
DateTimePicker::make(name: 'created_from')
|
||||||
->label('Created From')
|
->label('Created From')
|
||||||
->placeholder('Select From DateTime')
|
->placeholder('Select From DateTime')
|
||||||
@@ -2047,7 +2044,7 @@ class ClassCharacteristicResource extends Resource
|
|||||||
])
|
])
|
||||||
->query(function ($query, array $data) {
|
->query(function ($query, array $data) {
|
||||||
// Hide all records initially if no filters are applied
|
// Hide all records initially if no filters are applied
|
||||||
if (empty($data['Plant']) && empty($data['machine']) && empty($data['item_id']) && empty($data['aufnr']) && empty($data['gernr']) && empty($data['zmm_heading']) && empty($data['model_type']) && empty($data['created_from']) && empty($data['created_to'])) {
|
if (empty($data['Plant']) && empty($data['machine']) && empty($data['item_id']) && empty($data['aufnr']) && empty($data['gernr']) && empty($data['zmm_heading']) && empty($data['created_from']) && empty($data['created_to'])) {
|
||||||
return $query->whereRaw('1 = 0');
|
return $query->whereRaw('1 = 0');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2081,10 +2078,6 @@ class ClassCharacteristicResource extends Resource
|
|||||||
$query->where('zmm_heading', 'like', '%'.$data['zmm_heading'].'%');
|
$query->where('zmm_heading', 'like', '%'.$data['zmm_heading'].'%');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($data['model_type'])) {
|
|
||||||
$query->where('model_type', 'like', '%'.$data['model_type'].'%');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! empty($data['created_from'])) {
|
if (! empty($data['created_from'])) {
|
||||||
$query->where('created_at', '>=', $data['created_from']);
|
$query->where('created_at', '>=', $data['created_from']);
|
||||||
}
|
}
|
||||||
@@ -2126,10 +2119,6 @@ class ClassCharacteristicResource extends Resource
|
|||||||
$indicators[] = 'Heading: '.$data['zmm_heading'];
|
$indicators[] = 'Heading: '.$data['zmm_heading'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! empty($data['model_type'])) {
|
|
||||||
$indicators[] = 'Model Type: '.$data['model_type'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! empty($data['created_from'])) {
|
if (! empty($data['created_from'])) {
|
||||||
$indicators[] = 'From: '.$data['created_from'];
|
$indicators[] = 'From: '.$data['created_from'];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
||||||
{
|
{
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -10,6 +10,8 @@ use App\Models\InvoiceValidation;
|
|||||||
use App\Models\Item;
|
use App\Models\Item;
|
||||||
use App\Models\Plant;
|
use App\Models\Plant;
|
||||||
use App\Models\StickerMaster;
|
use App\Models\StickerMaster;
|
||||||
|
use App\Models\WireMasterPacking;
|
||||||
|
use DB;
|
||||||
use Filament\Facades\Filament;
|
use Filament\Facades\Filament;
|
||||||
use Filament\Notifications\Notification;
|
use Filament\Notifications\Notification;
|
||||||
use Filament\Pages\Concerns\ExposesTableToWidgets;
|
use Filament\Pages\Concerns\ExposesTableToWidgets;
|
||||||
@@ -174,17 +176,15 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isset($matches[1])) {
|
if (isset($matches[1])) {
|
||||||
$invoiceNumber = $matches[1];
|
$invoiceNumber = strtoupper($matches[1]);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$invoiceNumber = strtoupper($invoiceNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
// dd($invoiceNumber);
|
|
||||||
|
|
||||||
// ..
|
|
||||||
|
|
||||||
$updateStatus = $this->form->getState()['update_invoice'] ?? null;
|
$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;
|
$invoiceType = null;
|
||||||
// $this->invoiceNumber = $this->invoiceNumber ?? $invoiceNumber;
|
// $this->invoiceNumber = $this->invoiceNumber ?? $invoiceNumber;
|
||||||
@@ -581,7 +581,7 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
$materialType = $sticker->material_type;
|
$materialType = $sticker->material_type;
|
||||||
// $sticker = StickerMaster::where('plant_id', $plantId)->whereHas('item', function ($query) use ($code) { $query->where('plant_id', $this->plantId)->where('code', $code); })->first();
|
// $sticker = StickerMaster::where('plant_id', $plantId)->whereHas('item', function ($query) use ($code) { $query->where('plant_id', $this->plantId)->where('code', $code); })->first();
|
||||||
|
|
||||||
if ($materialType == 1) {
|
if ($materialType == 1 || $materialType == 4) {
|
||||||
$totalExcelQty = 0;
|
$totalExcelQty = 0;
|
||||||
|
|
||||||
foreach ($rows as $index => $row) {
|
foreach ($rows as $index => $row) {
|
||||||
@@ -1765,7 +1765,7 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
$materialType = $sticker->material_type;
|
$materialType = $sticker->material_type;
|
||||||
// $sticker = StickerMaster::where('plant_id', $plantId)->whereHas('item', function ($query) use ($code) { $query->where('plant_id', $this->plantId)->where('code', $code); })->first();
|
// $sticker = StickerMaster::where('plant_id', $plantId)->whereHas('item', function ($query) use ($code) { $query->where('plant_id', $this->plantId)->where('code', $code); })->first();
|
||||||
|
|
||||||
if ($materialType == 1) {
|
if ($materialType == 1 || $materialType == 4) {
|
||||||
$totalExcelQty = 0;
|
$totalExcelQty = 0;
|
||||||
|
|
||||||
foreach ($rows as $index => $row) {
|
foreach ($rows as $index => $row) {
|
||||||
@@ -2317,7 +2317,7 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
protected function refreshInvoiceTable()
|
protected function refreshInvoiceTable()
|
||||||
{
|
{
|
||||||
$this->plantId = $this->form->getState()['plant_id'] ?? '';
|
$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)) {
|
if (! empty($this->invoiceNumber)) {
|
||||||
$hasInvoice = InvoiceValidation::where('invoice_number', $this->invoiceNumber)->where('plant_id', $this->plantId)->first();
|
$hasInvoice = InvoiceValidation::where('invoice_number', $this->invoiceNumber)->where('plant_id', $this->plantId)->first();
|
||||||
@@ -2378,7 +2378,7 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
$serialNumber = null;
|
$serialNumber = null;
|
||||||
$plantId = $this->form->getState()['plant_id'];
|
$plantId = $this->form->getState()['plant_id'];
|
||||||
$this->plantId = $plantId;
|
$this->plantId = $plantId;
|
||||||
$invoiceNumber = $this->form->getState()['invoice_number'];
|
$invoiceNumber = strtoupper(trim($this->form->getState()['invoice_number']));
|
||||||
$this->invoiceNumber = $invoiceNumber;
|
$this->invoiceNumber = $invoiceNumber;
|
||||||
|
|
||||||
$plant = Plant::find($plantId);
|
$plant = Plant::find($plantId);
|
||||||
@@ -2455,14 +2455,65 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
$this->dispatch('refreshMaterialInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId);
|
$this->dispatch('refreshMaterialInvoiceData', invoiceNumber: $invoiceNumber, plantId: $plantId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$pattern0 = '/^(?<item_code>[^|]+)\|(?<batch_id>[^|]+)\|(?<batch_count>[^|]+)\|(?<batch_quantity>[0-9]+(?:\.[0-9]+)?)\s?kg$/i';
|
||||||
$pattern1 = '/^(?<item_code>[^|]+)\|(?<batch_number>[^|]+)\|(?<batch_id>[^|]+)\|(?<batch_count>[^|]+)\/(?<batch_quantity>.+)$/i';
|
$pattern1 = '/^(?<item_code>[^|]+)\|(?<batch_number>[^|]+)\|(?<batch_id>[^|]+)\|(?<batch_count>[^|]+)\/(?<batch_quantity>.+)$/i';
|
||||||
$pattern2 = '/^(?<item_code>[^|]+)\|(?<batch_number>[^|]+)\|(?<batch_id>[^|]+)\|(?<batch_count>.+)$/i';
|
$pattern2 = '/^(?<item_code>[^|]+)\|(?<batch_number>[^|]+)\|(?<batch_id>[^|]+)\|(?<batch_count>.+)$/i';
|
||||||
$pattern3 = '/^(?<item_code>[^|]+)\|(?<batch_id>[^|]+)-(?<batch_count>.+)$/i';
|
$pattern3 = '/^(?<item_code>[^|]+)\|(?<batch_id>[^|]+)-(?<batch_count>.+)$/i';
|
||||||
|
$pattern4 = '/^MP-(?<code>.+)$/i';
|
||||||
$itemCode = '';
|
$itemCode = '';
|
||||||
$batchNumber = '';
|
$batchNumber = '';
|
||||||
$curScanQty = '';
|
$curScanQty = '';
|
||||||
|
$wirePallet = '';
|
||||||
|
$curMaterialQty = '';
|
||||||
|
$curMaterialSer = '';
|
||||||
|
|
||||||
if (preg_match($pattern1, $serNo, $matches)) {
|
if (preg_match($pattern0, $serNo, $matches)) {
|
||||||
|
$itemCode = $matches['item_code'];
|
||||||
|
$this->currentItemCode = $itemCode;
|
||||||
|
$curScanQty = trim($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'];
|
$itemCode = $matches['item_code'];
|
||||||
$this->currentItemCode = $itemCode;
|
$this->currentItemCode = $itemCode;
|
||||||
$batchNumber = $matches['batch_number'];
|
$batchNumber = $matches['batch_number'];
|
||||||
@@ -2470,11 +2521,45 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
$curScanQty = $matches['batch_quantity'];
|
$curScanQty = $matches['batch_quantity'];
|
||||||
$serNo = null;
|
$serNo = null;
|
||||||
|
|
||||||
if (empty($matches['batch_id']) || ! $matches['batch_id']) {
|
if (empty($matches['batch_number']) || ! $matches['batch_number']) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->danger()
|
->danger()
|
||||||
->title('Invalid Material QR Format')
|
->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)
|
->seconds(2)
|
||||||
->send();
|
->send();
|
||||||
$this->dispatch('playWarnSound');
|
$this->dispatch('playWarnSound');
|
||||||
@@ -2508,42 +2593,7 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
Notification::make()
|
Notification::make()
|
||||||
->danger()
|
->danger()
|
||||||
->title('Invalid Material QR Format')
|
->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($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')
|
|
||||||
->seconds(2)
|
->seconds(2)
|
||||||
->send();
|
->send();
|
||||||
$this->dispatch('playWarnSound');
|
$this->dispatch('playWarnSound');
|
||||||
@@ -2580,13 +2630,48 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
$this->currentItemCode = $itemCode;
|
$this->currentItemCode = $itemCode;
|
||||||
$batchNumber = $matches['batch_number'];
|
$batchNumber = $matches['batch_number'];
|
||||||
$serialNumber = $matches['batch_id'].'-'.$matches['batch_count'];
|
$serialNumber = $matches['batch_id'].'-'.$matches['batch_count'];
|
||||||
|
$curMaterialSer = $matches['batch_number'].'-'.$matches['batch_id'];
|
||||||
|
$curMaterialQty = $matches['batch_count'];
|
||||||
$serNo = null;
|
$serNo = null;
|
||||||
|
|
||||||
if (empty($matches['batch_id']) || ! $matches['batch_id']) {
|
if (empty($matches['batch_number']) || ! $matches['batch_number']) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->danger()
|
->danger()
|
||||||
->title('Invalid Material QR Format')
|
->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)
|
->seconds(2)
|
||||||
->send();
|
->send();
|
||||||
$this->dispatch('playWarnSound');
|
$this->dispatch('playWarnSound');
|
||||||
@@ -2619,7 +2704,7 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
Notification::make()
|
Notification::make()
|
||||||
->danger()
|
->danger()
|
||||||
->title('Invalid Material QR Format')
|
->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)
|
->seconds(2)
|
||||||
->send();
|
->send();
|
||||||
$this->dispatch('playWarnSound');
|
$this->dispatch('playWarnSound');
|
||||||
@@ -2659,7 +2744,7 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
Notification::make()
|
Notification::make()
|
||||||
->danger()
|
->danger()
|
||||||
->title('Invalid Material QR Format')
|
->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)
|
->seconds(2)
|
||||||
->send();
|
->send();
|
||||||
$this->dispatch('playWarnSound');
|
$this->dispatch('playWarnSound');
|
||||||
@@ -2693,7 +2778,7 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
Notification::make()
|
Notification::make()
|
||||||
->danger()
|
->danger()
|
||||||
->title('Invalid Material QR Format')
|
->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)
|
->seconds(2)
|
||||||
->send();
|
->send();
|
||||||
$this->dispatch('playWarnSound');
|
$this->dispatch('playWarnSound');
|
||||||
@@ -2723,6 +2808,294 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
|
|
||||||
return;
|
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 {
|
} else {
|
||||||
$itemCode = null;
|
$itemCode = null;
|
||||||
$this->currentItemCode = '';
|
$this->currentItemCode = '';
|
||||||
@@ -2733,7 +3106,7 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
Notification::make()
|
Notification::make()
|
||||||
->danger()
|
->danger()
|
||||||
->title('Invalid Material QR Format')
|
->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)
|
->seconds(1)
|
||||||
->send();
|
->send();
|
||||||
|
|
||||||
@@ -2866,6 +3239,12 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
|
|
||||||
$hasQuanTyp = ($record->material_type == 3) ? true : false;
|
$hasQuanTyp = ($record->material_type == 3) ? true : false;
|
||||||
|
|
||||||
|
if ($hasQuanTyp && $curMaterialSer && $curMaterialQty) {
|
||||||
|
$batchNumber = null;
|
||||||
|
$serialNumber = $curMaterialSer;
|
||||||
|
$curScanQty = $curMaterialQty;
|
||||||
|
}
|
||||||
|
|
||||||
$record = InvoiceValidation::where('invoice_number', $invoiceNumber)
|
$record = InvoiceValidation::where('invoice_number', $invoiceNumber)
|
||||||
->where('plant_id', $plantId)
|
->where('plant_id', $plantId)
|
||||||
->whereHas('stickerMasterRelation.item', function ($query) use ($itemCode) {
|
->whereHas('stickerMasterRelation.item', function ($query) use ($itemCode) {
|
||||||
@@ -2948,7 +3327,7 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
Notification::make()
|
Notification::make()
|
||||||
->danger()
|
->danger()
|
||||||
->title('Invalid Quantity Material QR Format')
|
->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)
|
->seconds(2)
|
||||||
->send();
|
->send();
|
||||||
$this->dispatch('playWarnSound');
|
$this->dispatch('playWarnSound');
|
||||||
@@ -2994,8 +3373,8 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
$record->serial_number = $serialNumber;
|
$record->serial_number = $serialNumber;
|
||||||
$record->batch_number = $batchNumber;
|
$record->batch_number = $batchNumber;
|
||||||
$record->operator_id = $operatorName;
|
$record->operator_id = $operatorName;
|
||||||
// $record->updated_by = $operatorName;
|
$record->updated_by = $operatorName;
|
||||||
// $record->updated_at = now();
|
$record->updated_at = now();
|
||||||
$record->save();
|
$record->save();
|
||||||
|
|
||||||
// InvoiceValidation::create([
|
// 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();
|
$record = InvoiceValidation::where('serial_number', $serialNumber)->where('invoice_number', $invoiceNumber)->where('plant_id', $plantId)->first();
|
||||||
// $invoiceNumber = $this->form->getState()['invoice_number'];
|
|
||||||
|
|
||||||
if (! $record) {
|
if (! $record) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ class PlantResource extends Resource
|
|||||||
->hint(fn ($get) => $get('pNameError') ? $get('pNameError') : null)
|
->hint(fn ($get) => $get('pNameError') ? $get('pNameError') : null)
|
||||||
->hintColor('danger'),
|
->hintColor('danger'),
|
||||||
Forms\Components\TextInput::make('warehouse_number')
|
Forms\Components\TextInput::make('warehouse_number')
|
||||||
->required()
|
// ->required()
|
||||||
->label('Warehouse Number')
|
->label('Warehouse Number')
|
||||||
->placeholder('Scan the valid warehouse number')
|
->placeholder('Scan the valid warehouse number')
|
||||||
->unique(ignoreRecord: true)
|
->unique(ignoreRecord: true)
|
||||||
|
|||||||
@@ -221,6 +221,12 @@ class ProductCharacteristicsMasterResource extends Resource
|
|||||||
->afterStateUpdated(function ($state, callable $set) {
|
->afterStateUpdated(function ($state, callable $set) {
|
||||||
$set('updated_by', Filament::auth()->user()?->name);
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
}),
|
}),
|
||||||
|
Forms\Components\TextInput::make('category')
|
||||||
|
->label('Category')
|
||||||
|
->reactive()
|
||||||
|
->afterStateUpdated(function ($state, callable $set) {
|
||||||
|
$set('updated_by', Filament::auth()->user()?->name);
|
||||||
|
}),
|
||||||
Forms\Components\Select::make('inspection_type')
|
Forms\Components\Select::make('inspection_type')
|
||||||
->label('Inspection Type')
|
->label('Inspection Type')
|
||||||
->searchable()
|
->searchable()
|
||||||
@@ -351,6 +357,11 @@ class ProductCharacteristicsMasterResource extends Resource
|
|||||||
->alignCenter()
|
->alignCenter()
|
||||||
->searchable()
|
->searchable()
|
||||||
->sortable(),
|
->sortable(),
|
||||||
|
Tables\Columns\TextColumn::make('category')
|
||||||
|
->label('Category')
|
||||||
|
->alignCenter()
|
||||||
|
->searchable()
|
||||||
|
->sortable(),
|
||||||
Tables\Columns\TextColumn::make('line.name')
|
Tables\Columns\TextColumn::make('line.name')
|
||||||
->label('Line Name')
|
->label('Line Name')
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
|
|||||||
@@ -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()
|
||||||
@@ -248,6 +247,18 @@ class ProductionOrderResource extends Resource
|
|||||||
->searchable()
|
->searchable()
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
->sortable(),
|
->sortable(),
|
||||||
|
Tables\Columns\TextColumn::make('item.description')
|
||||||
|
->label('Item Description')
|
||||||
|
->searchable()
|
||||||
|
->alignCenter()
|
||||||
|
->sortable()
|
||||||
|
->toggleable(isToggledHiddenByDefault: true),
|
||||||
|
Tables\Columns\TextColumn::make('item.uom')
|
||||||
|
->label('Unit of Measure')
|
||||||
|
->searchable()
|
||||||
|
->alignCenter()
|
||||||
|
->sortable()
|
||||||
|
->toggleable(isToggledHiddenByDefault: true),
|
||||||
Tables\Columns\TextColumn::make('quantity')
|
Tables\Columns\TextColumn::make('quantity')
|
||||||
->label('Quantity')
|
->label('Quantity')
|
||||||
->searchable()
|
->searchable()
|
||||||
|
|||||||
@@ -210,6 +210,41 @@ class CreateProductionOrder extends CreateRecord
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function printItemSerial()
|
||||||
|
{
|
||||||
|
$pOrder = trim($this->form->getState()['production_order'] ?? '') ?? null;
|
||||||
|
|
||||||
|
$plantId = trim($this->form->getState()['plant_id'] ?? '') ?? null;
|
||||||
|
|
||||||
|
$plantCode = Plant::where('id', $plantId)->value('code');
|
||||||
|
|
||||||
|
if (empty($plantId)) {
|
||||||
|
Notification::make()
|
||||||
|
->title('Plant name cannot be empty!')
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
return;
|
||||||
|
} elseif (empty($pOrder)) {
|
||||||
|
Notification::make()
|
||||||
|
->title('Production order cannot be empty!')
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$pOrderExists = ProductionOrder::where('plant_id', $plantId)->where('production_order', $pOrder)->first();
|
||||||
|
|
||||||
|
if (! $pOrderExists) {
|
||||||
|
Notification::make()
|
||||||
|
->title("Production Order '{$pOrder}' does not exist to get print!")
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
return redirect()->route('production-orders.printItemSerial', ['production_order' => $pOrder, 'plant_code' => $plantCode]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function printPanel()
|
public function printPanel()
|
||||||
{
|
{
|
||||||
$pOrder = trim($this->form->getState()['production_order'] ?? '') ?? null;
|
$pOrder = trim($this->form->getState()['production_order'] ?? '') ?? null;
|
||||||
@@ -245,7 +280,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
|
||||||
|
|||||||
@@ -89,6 +89,74 @@ class EditProductionOrder extends EditRecord
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// public function printItemSerial()
|
||||||
|
// {
|
||||||
|
// $pOrder = trim($this->form->getState()['production_order'] ?? '') ?? null;
|
||||||
|
|
||||||
|
// $plantId = trim($this->form->getState()['plant_id'] ?? '') ?? null;
|
||||||
|
// $plantCode = Plant::where('id', $plantId)->value('code');
|
||||||
|
// if (empty($plantId)) {
|
||||||
|
// Notification::make()
|
||||||
|
// ->title('Plant name cannot be empty!')
|
||||||
|
// ->danger()
|
||||||
|
// ->send();
|
||||||
|
// return;
|
||||||
|
// } elseif (empty($pOrder)) {
|
||||||
|
// Notification::make()
|
||||||
|
// ->title('Production order cannot be empty!')
|
||||||
|
// ->danger()
|
||||||
|
// ->send();
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// $pOrderExists = ProductionOrder::where('plant_id', $plantId)->where('production_order', $pOrder)->first();
|
||||||
|
|
||||||
|
// if (! $pOrderExists) {
|
||||||
|
// Notification::make()
|
||||||
|
// ->title("Production Order '{$pOrder}' does not exist to get print!")
|
||||||
|
// ->danger()
|
||||||
|
// ->send();
|
||||||
|
// return;
|
||||||
|
// } else {
|
||||||
|
// return redirect()->route('production-orders.printItemSerial', ['production_order' => $pOrder, 'plant_code' => $plantCode]);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
public function printItemSerial()
|
||||||
|
{
|
||||||
|
$pOrder = trim($this->form->getState()['production_order'] ?? '') ?? null;
|
||||||
|
|
||||||
|
$plantId = trim($this->form->getState()['plant_id'] ?? '') ?? null;
|
||||||
|
|
||||||
|
$plantCode = Plant::where('id', $plantId)->value('code');
|
||||||
|
|
||||||
|
if (empty($plantId)) {
|
||||||
|
Notification::make()
|
||||||
|
->title('Plant name cannot be empty!')
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
return;
|
||||||
|
} elseif (empty($pOrder)) {
|
||||||
|
Notification::make()
|
||||||
|
->title('Production order cannot be empty!')
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$pOrderExists = ProductionOrder::where('plant_id', $plantId)->where('production_order', $pOrder)->first();
|
||||||
|
|
||||||
|
if (! $pOrderExists) {
|
||||||
|
Notification::make()
|
||||||
|
->title("Production Order '{$pOrder}' does not exist to get print!")
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
return redirect()->route('production-orders.printItemSerial', ['production_order' => $pOrder, 'plant_code' => $plantCode]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected function getHeaderActions(): array
|
protected function getHeaderActions(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class ViewProductionOrder extends ViewRecord
|
|||||||
{
|
{
|
||||||
protected static string $resource = ProductionOrderResource::class;
|
protected static string $resource = ProductionOrderResource::class;
|
||||||
|
|
||||||
public function printProductionOrder()
|
public function printProductionOrder()
|
||||||
{
|
{
|
||||||
$pOrder = trim($this->form->getState()['production_order'] ?? '') ?? null;
|
$pOrder = trim($this->form->getState()['production_order'] ?? '') ?? null;
|
||||||
|
|
||||||
@@ -89,6 +89,76 @@ class ViewProductionOrder extends ViewRecord
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// public function printItemSerial()
|
||||||
|
// {
|
||||||
|
// $pOrder = trim($this->form->getState()['production_order'] ?? '') ?? null;
|
||||||
|
|
||||||
|
// $plantId = trim($this->form->getState()['plant_id'] ?? '') ?? null;
|
||||||
|
|
||||||
|
// $plantCode = Plant::where('id', $plantId)->value('code');
|
||||||
|
|
||||||
|
// if (empty($plantId)) {
|
||||||
|
// Notification::make()
|
||||||
|
// ->title('Plant name cannot be empty!')
|
||||||
|
// ->danger()
|
||||||
|
// ->send();
|
||||||
|
// return;
|
||||||
|
// } elseif (empty($pOrder)) {
|
||||||
|
// Notification::make()
|
||||||
|
// ->title('Production order cannot be empty!')
|
||||||
|
// ->danger()
|
||||||
|
// ->send();
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
|
// $pOrderExists = ProductionOrder::where('plant_id', $plantId)->where('production_order', $pOrder)->first();
|
||||||
|
|
||||||
|
// if (! $pOrderExists) {
|
||||||
|
// Notification::make()
|
||||||
|
// ->title("Production Order '{$pOrder}' does not exist to get print!")
|
||||||
|
// ->danger()
|
||||||
|
// ->send();
|
||||||
|
// return;
|
||||||
|
// } else {
|
||||||
|
// return redirect()->route('production-orders.printItemSerial', ['production_order' => $pOrder, 'plant_code' => $plantCode]);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
public function printItemSerial()
|
||||||
|
{
|
||||||
|
$pOrder = trim($this->form->getState()['production_order'] ?? '') ?? null;
|
||||||
|
|
||||||
|
$plantId = trim($this->form->getState()['plant_id'] ?? '') ?? null;
|
||||||
|
|
||||||
|
$plantCode = Plant::where('id', $plantId)->value('code');
|
||||||
|
|
||||||
|
if (empty($plantId)) {
|
||||||
|
Notification::make()
|
||||||
|
->title('Plant name cannot be empty!')
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
return;
|
||||||
|
} elseif (empty($pOrder)) {
|
||||||
|
Notification::make()
|
||||||
|
->title('Production order cannot be empty!')
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$pOrderExists = ProductionOrder::where('plant_id', $plantId)->where('production_order', $pOrder)->first();
|
||||||
|
|
||||||
|
if (! $pOrderExists) {
|
||||||
|
Notification::make()
|
||||||
|
->title("Production Order '{$pOrder}' does not exist to get print!")
|
||||||
|
->danger()
|
||||||
|
->send();
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
return redirect()->route('production-orders.printItemSerial', ['production_order' => $pOrder, 'plant_code' => $plantCode]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected function getHeaderActions(): array
|
protected function getHeaderActions(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
|||||||
@@ -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')
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ class CreateQualityValidation extends CreateRecord
|
|||||||
'checklistUpdated' => 'setChecklist',
|
'checklistUpdated' => 'setChecklist',
|
||||||
'checklist-cancelled' => 'handleChecklistCancel',
|
'checklist-cancelled' => 'handleChecklistCancel',
|
||||||
'checklist-saved' => 'checkListSaved',
|
'checklist-saved' => 'checkListSaved',
|
||||||
'trigger-create' => 'doCreate',
|
// 'trigger-create' => 'doCreate',
|
||||||
];
|
];
|
||||||
|
|
||||||
public function setChecklist($checklist)
|
public function setChecklist($checklist)
|
||||||
@@ -89,13 +89,15 @@ class CreateQualityValidation extends CreateRecord
|
|||||||
->where('plant_id', $plantId)
|
->where('plant_id', $plantId)
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
|
$categoryName = trim($item->category) ?? null;
|
||||||
|
|
||||||
if (!$item) {
|
if (!$item) {
|
||||||
$this->existingRecords = collect();
|
$this->existingRecords = collect();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->existingRecords = ProductCharacteristicsMaster::where('plant_id', $plantId)
|
$this->existingRecords = ProductCharacteristicsMaster::where('plant_id', $plantId)
|
||||||
->where('item_id', $item->id)
|
->where('category', $categoryName)
|
||||||
->where('line_id', $lineId)
|
->where('line_id', $lineId)
|
||||||
->get();
|
->get();
|
||||||
}
|
}
|
||||||
@@ -201,6 +203,7 @@ class CreateQualityValidation extends CreateRecord
|
|||||||
$checklist = $this->data['data']['checklist'] ?? [];
|
$checklist = $this->data['data']['checklist'] ?? [];
|
||||||
|
|
||||||
if (count($this->existingRecords) > 0){
|
if (count($this->existingRecords) > 0){
|
||||||
|
|
||||||
$this->showChecklist = true;
|
$this->showChecklist = true;
|
||||||
$this->halt();
|
$this->halt();
|
||||||
}
|
}
|
||||||
@@ -223,10 +226,11 @@ class CreateQualityValidation extends CreateRecord
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$item_id = $item->id;
|
// $item_id = $item->id;
|
||||||
|
$categoryName = trim($item->category) ?? null;
|
||||||
|
|
||||||
$this->existingRecords = ProductCharacteristicsMaster::where('plant_id', $plant_id)
|
$this->existingRecords = ProductCharacteristicsMaster::where('plant_id', $plant_id)
|
||||||
->where('item_id', $item_id)
|
->where('category', $categoryName)
|
||||||
->where('line_id', $line_id)
|
->where('line_id', $line_id)
|
||||||
->get();
|
->get();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -296,9 +296,10 @@ class StickerMasterResource extends Resource
|
|||||||
Forms\Components\Select::make('material_type')
|
Forms\Components\Select::make('material_type')
|
||||||
->label('Material Type')
|
->label('Material Type')
|
||||||
->options([
|
->options([
|
||||||
'1' => 'Individual',
|
1 => 'Individual',
|
||||||
'2' => 'Bundle',
|
2 => 'Bundle',
|
||||||
'3' => 'Quantity',
|
3 => 'Quantity',
|
||||||
|
4 => 'Bundle Individual',
|
||||||
])
|
])
|
||||||
->reactive()
|
->reactive()
|
||||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
@@ -307,7 +308,7 @@ class StickerMasterResource extends Resource
|
|||||||
$set('load_rate', 0);
|
$set('load_rate', 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($state !== '2') {
|
if ($state != '2' && $state != '4') {
|
||||||
$set('bundle_quantity', null);
|
$set('bundle_quantity', null);
|
||||||
} else {
|
} else {
|
||||||
$set('bundle_quantity', 2);
|
$set('bundle_quantity', 2);
|
||||||
@@ -319,12 +320,12 @@ class StickerMasterResource extends Resource
|
|||||||
Forms\Components\TextInput::make('bundle_quantity')
|
Forms\Components\TextInput::make('bundle_quantity')
|
||||||
->label('Bundle Quantity')
|
->label('Bundle Quantity')
|
||||||
->integer()
|
->integer()
|
||||||
->readOnly(fn (callable $get) => $get('material_type') !== '2')
|
->readOnly(fn (callable $get) => $get('material_type') != 2 && $get('material_type') != 4)
|
||||||
->nullable()
|
->nullable()
|
||||||
->minValue(2)
|
->minValue(2)
|
||||||
->reactive()
|
->reactive()
|
||||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
if ($get('material_type') !== '2') {
|
if ($get('material_type') != 2 && $get('material_type') != 4) {
|
||||||
$set('bundle_quantity', null);
|
$set('bundle_quantity', null);
|
||||||
} elseif ($get('bundle_quantity') < 2) {
|
} elseif ($get('bundle_quantity') < 2) {
|
||||||
$set('bundle_quantity', 2);
|
$set('bundle_quantity', 2);
|
||||||
@@ -655,10 +656,6 @@ class StickerMasterResource extends Resource
|
|||||||
->label('Load Rate')
|
->label('Load Rate')
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
->sortable(),
|
->sortable(),
|
||||||
Tables\Columns\TextColumn::make('bundle_quantity')
|
|
||||||
->label('Bundle Quantity')
|
|
||||||
->default('-')
|
|
||||||
->alignCenter(),
|
|
||||||
Tables\Columns\TextColumn::make('material_type')
|
Tables\Columns\TextColumn::make('material_type')
|
||||||
->label('Material Type')
|
->label('Material Type')
|
||||||
->default('-')
|
->default('-')
|
||||||
@@ -672,9 +669,14 @@ class StickerMasterResource extends Resource
|
|||||||
1 => 'Individual',
|
1 => 'Individual',
|
||||||
2 => 'Bundle',
|
2 => 'Bundle',
|
||||||
3 => 'Quantity',
|
3 => 'Quantity',
|
||||||
|
4 => 'Bundle Individual',
|
||||||
default => '-',
|
default => '-',
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
|
Tables\Columns\TextColumn::make('bundle_quantity')
|
||||||
|
->label('Bundle Quantity')
|
||||||
|
->default('-')
|
||||||
|
->alignCenter(),
|
||||||
Tables\Columns\TextColumn::make('created_by')
|
Tables\Columns\TextColumn::make('created_by')
|
||||||
->label('Created By')
|
->label('Created By')
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
@@ -754,12 +756,13 @@ class StickerMasterResource extends Resource
|
|||||||
->searchable()
|
->searchable()
|
||||||
->reactive(),
|
->reactive(),
|
||||||
Select::make('material_type')
|
Select::make('material_type')
|
||||||
->label('Select Material Type')
|
->label('Search by Material Type')
|
||||||
->nullable()
|
->nullable()
|
||||||
->options([
|
->options([
|
||||||
1 => 'Individual',
|
1 => 'Individual',
|
||||||
2 => 'Bundle',
|
2 => 'Bundle',
|
||||||
3 => 'Quantity',
|
3 => 'Quantity',
|
||||||
|
4 => 'Bundle Individual',
|
||||||
])
|
])
|
||||||
->searchable()
|
->searchable()
|
||||||
->reactive(),
|
->reactive(),
|
||||||
@@ -870,6 +873,8 @@ class StickerMasterResource extends Resource
|
|||||||
$indicators[] = 'Material Type: Bundle';
|
$indicators[] = 'Material Type: Bundle';
|
||||||
} elseif ($data['material_type'] == 3) {
|
} elseif ($data['material_type'] == 3) {
|
||||||
$indicators[] = 'Material Type: Quantity';
|
$indicators[] = 'Material Type: Quantity';
|
||||||
|
} elseif ($data['material_type'] == 4) {
|
||||||
|
$indicators[] = 'Material Type: Bundle Individual';
|
||||||
}
|
}
|
||||||
// $indicators[] = 'Material Type: '.$data['material_type'];
|
// $indicators[] = 'Material Type: '.$data['material_type'];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
namespace App\Filament\Resources;
|
namespace App\Filament\Resources;
|
||||||
|
|
||||||
use App\Filament\Resources\VehicleEntryResource\Pages;
|
use App\Filament\Resources\VehicleEntryResource\Pages;
|
||||||
|
use App\Models\Item;
|
||||||
use App\Models\Plant;
|
use App\Models\Plant;
|
||||||
use App\Models\VehicleEntry;
|
use App\Models\VehicleEntry;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
@@ -14,6 +15,10 @@ use Filament\Tables;
|
|||||||
use Filament\Tables\Table;
|
use Filament\Tables\Table;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||||
|
use Filament\Tables\Filters\Filter;
|
||||||
|
use Filament\Forms\Components\DateTimePicker;
|
||||||
|
use Filament\Forms\Components\Select;
|
||||||
|
use Filament\Forms\Components\TextInput;
|
||||||
|
|
||||||
class VehicleEntryResource extends Resource
|
class VehicleEntryResource extends Resource
|
||||||
{
|
{
|
||||||
@@ -43,6 +48,9 @@ class VehicleEntryResource extends Resource
|
|||||||
Forms\Components\TextInput::make('vehicle_number')
|
Forms\Components\TextInput::make('vehicle_number')
|
||||||
->label('Vehicle Number')
|
->label('Vehicle Number')
|
||||||
->required(),
|
->required(),
|
||||||
|
Forms\Components\TextInput::make('boom_opened')
|
||||||
|
->label('Boom Opened')
|
||||||
|
->required(),
|
||||||
Forms\Components\DateTimePicker::make('entry_time')
|
Forms\Components\DateTimePicker::make('entry_time')
|
||||||
->label('Entry Time')
|
->label('Entry Time')
|
||||||
->required()
|
->required()
|
||||||
@@ -105,15 +113,21 @@ class VehicleEntryResource extends Resource
|
|||||||
->alignCenter()
|
->alignCenter()
|
||||||
->sortable()
|
->sortable()
|
||||||
->searchable(),
|
->searchable(),
|
||||||
Tables\Columns\TextColumn::make('uuid')
|
// Tables\Columns\TextColumn::make('uuid')
|
||||||
->label('UUID')
|
// ->label('UUID')
|
||||||
->alignCenter()
|
// ->alignCenter()
|
||||||
->sortable()
|
// ->sortable()
|
||||||
->searchable(),
|
// ->searchable(),
|
||||||
Tables\Columns\TextColumn::make('vehicle_number')
|
Tables\Columns\TextColumn::make('vehicle_number')
|
||||||
->label('Vehicle Number')
|
->label('Vehicle Number')
|
||||||
->alignCenter()
|
->alignCenter()
|
||||||
->sortable()
|
->sortable()
|
||||||
|
->searchable()
|
||||||
|
->formatStateUsing(fn ($state) => strtoupper($state)),
|
||||||
|
Tables\Columns\TextColumn::make('boom_opened')
|
||||||
|
->label('Boom Opened')
|
||||||
|
->alignCenter()
|
||||||
|
->sortable()
|
||||||
->searchable(),
|
->searchable(),
|
||||||
Tables\Columns\TextColumn::make('entry_time')
|
Tables\Columns\TextColumn::make('entry_time')
|
||||||
->label('Entry Time')
|
->label('Entry Time')
|
||||||
@@ -156,7 +170,106 @@ class VehicleEntryResource extends Resource
|
|||||||
])
|
])
|
||||||
->filters([
|
->filters([
|
||||||
Tables\Filters\TrashedFilter::make(),
|
Tables\Filters\TrashedFilter::make(),
|
||||||
|
Filter::make('advanced_filters')
|
||||||
|
->label('Advanced Filters')
|
||||||
|
->form([
|
||||||
|
Select::make('Plant')
|
||||||
|
->label('Search by Plant Name')
|
||||||
|
->nullable()
|
||||||
|
->searchable()
|
||||||
|
->reactive()
|
||||||
|
->options(function (callable $get) {
|
||||||
|
$userHas = Filament::auth()->user()->plant_id;
|
||||||
|
|
||||||
|
if ($userHas && strlen($userHas) > 0) {
|
||||||
|
return Plant::where('id', $userHas)->pluck('name', 'id')->toArray();
|
||||||
|
} else {
|
||||||
|
return Plant::whereHas('vehicleEntries', function ($query) {
|
||||||
|
$query->whereNotNull('id');
|
||||||
|
})->orderBy('code')->pluck('name', 'id');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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('vehicle_number', null);
|
||||||
|
}),
|
||||||
|
TextInput::make('vehicle_number')
|
||||||
|
->label('Vehicle Number')
|
||||||
|
->reactive()
|
||||||
|
->placeholder('Enter Vehicle Number')
|
||||||
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
|
$set('Rework', null);
|
||||||
|
}),
|
||||||
|
DateTimePicker::make('created_from')
|
||||||
|
->label('Created From')
|
||||||
|
->placeholder('Select From DateTime')
|
||||||
|
->reactive()
|
||||||
|
->native(false),
|
||||||
|
DateTimePicker::make('created_to')
|
||||||
|
->label('Created To')
|
||||||
|
->placeholder('Select To DateTime')
|
||||||
|
->reactive()
|
||||||
|
->native(false),
|
||||||
|
])
|
||||||
|
->query(function ($query, array $data) {
|
||||||
|
// Hide all records initially if no filters are applied
|
||||||
|
if (empty($data['Plant']) && empty($data['vehicle_number']) && empty($data['created_from']) && empty($data['created_to'])) {
|
||||||
|
return $query->whereRaw('1 = 0');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($data['Plant'])) {
|
||||||
|
$query->where('plant_id', $data['Plant']);
|
||||||
|
} else {
|
||||||
|
$userHas = Filament::auth()->user()->plant_id;
|
||||||
|
|
||||||
|
if ($userHas && strlen($userHas) > 0) {
|
||||||
|
return $query->whereRaw('1 = 0');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($data['vehicle_number'])) {
|
||||||
|
$query->where('vehicle_number', 'like', '%'.$data['vehicle_number'].'%');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($data['created_from'])) {
|
||||||
|
$query->where('created_at', '>=', $data['created_from']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($data['created_to'])) {
|
||||||
|
$query->where('created_at', '<=', $data['created_to']);
|
||||||
|
}
|
||||||
|
// $query->orderBy('created_at', 'asc');
|
||||||
|
})
|
||||||
|
->indicateUsing(function (array $data) {
|
||||||
|
$indicators = [];
|
||||||
|
|
||||||
|
if (! empty($data['Plant'])) {
|
||||||
|
$indicators[] = 'Plant Name: '.Plant::where('id', $data['Plant'])->value('name');
|
||||||
|
} else {
|
||||||
|
$userHas = Filament::auth()->user()->plant_id;
|
||||||
|
|
||||||
|
if ($userHas && strlen($userHas) > 0) {
|
||||||
|
return 'Plant Name: Choose plant to filter records.';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($data['vehicle_number'])) {
|
||||||
|
$indicators[] = 'Vehicle Number: '.$data['vehicle_number'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($data['created_from'])) {
|
||||||
|
$indicators[] = 'From: '.$data['created_from'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($data['created_to'])) {
|
||||||
|
$indicators[] = 'To: '.$data['created_to'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $indicators;
|
||||||
|
}),
|
||||||
])
|
])
|
||||||
|
->filtersFormMaxHeight('280px')
|
||||||
->actions([
|
->actions([
|
||||||
Tables\Actions\ViewAction::make(),
|
Tables\Actions\ViewAction::make(),
|
||||||
Tables\Actions\EditAction::make(),
|
Tables\Actions\EditAction::make(),
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ namespace App\Filament\Resources;
|
|||||||
|
|
||||||
use App\Filament\Resources\WireMasterPackingResource\Pages;
|
use App\Filament\Resources\WireMasterPackingResource\Pages;
|
||||||
use App\Models\CustomerPoMaster;
|
use App\Models\CustomerPoMaster;
|
||||||
|
use App\Models\Item;
|
||||||
|
use App\Models\Line;
|
||||||
use App\Models\Plant;
|
use App\Models\Plant;
|
||||||
use App\Models\WireMasterPacking;
|
use App\Models\WireMasterPacking;
|
||||||
use Filament\Facades\Filament;
|
use Filament\Facades\Filament;
|
||||||
@@ -17,6 +19,10 @@ use Filament\Tables;
|
|||||||
use Filament\Tables\Table;
|
use Filament\Tables\Table;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
use Illuminate\Database\Eloquent\SoftDeletingScope;
|
||||||
|
use Filament\Tables\Filters\Filter;
|
||||||
|
use Filament\Forms\Components\Select;
|
||||||
|
use Filament\Forms\Components\DateTimePicker;
|
||||||
|
use Str;
|
||||||
|
|
||||||
class WireMasterPackingResource extends Resource
|
class WireMasterPackingResource extends Resource
|
||||||
{
|
{
|
||||||
@@ -269,7 +275,189 @@ class WireMasterPackingResource extends Resource
|
|||||||
])
|
])
|
||||||
->filters([
|
->filters([
|
||||||
Tables\Filters\TrashedFilter::make(),
|
Tables\Filters\TrashedFilter::make(),
|
||||||
|
Filter::make('advanced_filters')
|
||||||
|
->label('Advanced Filters')
|
||||||
|
->form([
|
||||||
|
Select::make('Plant')
|
||||||
|
->label('Search by Plant Name')
|
||||||
|
->nullable()
|
||||||
|
->searchable()
|
||||||
|
->reactive()
|
||||||
|
->options(function (callable $get) {
|
||||||
|
$userHas = Filament::auth()->user()->plant_id;
|
||||||
|
|
||||||
|
if ($userHas && strlen($userHas) > 0) {
|
||||||
|
return Plant::where('id', $userHas)->pluck('name', 'id')->toArray();
|
||||||
|
} else {
|
||||||
|
return Plant::whereHas('wireMasterPacking', function ($query) {
|
||||||
|
$query->whereNotNull('id');
|
||||||
|
})->orderBy('code')->pluck('name', 'id');
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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);
|
||||||
|
}),
|
||||||
|
Select::make('Item')
|
||||||
|
->label('Search by Item Code')
|
||||||
|
->nullable()
|
||||||
|
->searchable()
|
||||||
|
->reactive()
|
||||||
|
->options(function (callable $get) {
|
||||||
|
$plantId = $get('Plant');
|
||||||
|
|
||||||
|
if (empty($plantId)) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return Item::whereHas('wireMasterPacking', function ($query) use ($plantId) {
|
||||||
|
if ($plantId) {
|
||||||
|
$query->where('plant_id', $plantId);
|
||||||
|
}
|
||||||
|
})->pluck('code', 'id');
|
||||||
|
})
|
||||||
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
|
$set('process_order', null);
|
||||||
|
}),
|
||||||
|
TextInput::make('wire_packing_number')
|
||||||
|
->label('Wire Packing Number')
|
||||||
|
->reactive()
|
||||||
|
->placeholder('Enter Wire Packing Number')
|
||||||
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
|
$set('process_order', null);
|
||||||
|
}),
|
||||||
|
TextInput::make('process_order')
|
||||||
|
->label('Process Order')
|
||||||
|
->reactive()
|
||||||
|
->placeholder('Enter Process Order')
|
||||||
|
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
||||||
|
$set('Rework', null);
|
||||||
|
}),
|
||||||
|
TextInput::make('customer_po_master_id')
|
||||||
|
->label('Customer PO')
|
||||||
|
->reactive()
|
||||||
|
->placeholder('Enter Customer PO'),
|
||||||
|
Select::make('wire_packing_status')
|
||||||
|
->label('Wire Packing Status')
|
||||||
|
->reactive()
|
||||||
|
->options([
|
||||||
|
'Completed' => 'Completed',
|
||||||
|
'Pending' => 'Pending',
|
||||||
|
]),
|
||||||
|
DateTimePicker::make(name: 'created_from')
|
||||||
|
->label('Created From')
|
||||||
|
->placeholder('Select From DateTime')
|
||||||
|
->reactive()
|
||||||
|
->native(false),
|
||||||
|
DateTimePicker::make('created_to')
|
||||||
|
->label('Created To')
|
||||||
|
->placeholder('Select To DateTime')
|
||||||
|
->reactive()
|
||||||
|
->native(false),
|
||||||
|
])
|
||||||
|
->query(function ($query, array $data) {
|
||||||
|
// Hide all records initially if no filters are applied
|
||||||
|
if (empty($data['Plant']) && empty($data['Item']) && empty($data['process_order']) && empty($data['wire_packing_number']) && empty($data['customer_po_master_id']) && empty($data['wire_packing_status']) && empty($data['created_from']) && empty($data['created_to'])) {
|
||||||
|
return $query->whereRaw('1 = 0');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($data['Plant'])) {
|
||||||
|
$query->where('plant_id', $data['Plant']);
|
||||||
|
} else {
|
||||||
|
$userHas = Filament::auth()->user()->plant_id;
|
||||||
|
|
||||||
|
if ($userHas && strlen($userHas) > 0) {
|
||||||
|
return $query->whereRaw('1 = 0');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($data['Item'])) {
|
||||||
|
$query->where('item_id', $data['Item']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($data['process_order'])) {
|
||||||
|
$query->where('process_order', 'like', '%'.$data['process_order'].'%');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($data['wire_packing_number'])) {
|
||||||
|
$query->where('wire_packing_number', 'like', '%'.$data['wire_packing_number'].'%');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($data['customer_po_master_id'])) {
|
||||||
|
|
||||||
|
$customerPoId = CustomerPoMaster::where('customer_po', $data['customer_po_master_id'])
|
||||||
|
->where('plant_id', $data['Plant'])
|
||||||
|
->value('id');
|
||||||
|
|
||||||
|
$query->where('customer_po_master_id', $customerPoId);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($data['wire_packing_status'])) {
|
||||||
|
if ($data['wire_packing_status'] == 'Pending') {
|
||||||
|
$query->where(function ($q) {
|
||||||
|
$q->whereNull('wire_packing_status')
|
||||||
|
->orWhere('wire_packing_status', '');
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
$query->where('wire_packing_status', $data['wire_packing_status']);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($data['created_from'])) {
|
||||||
|
$query->where('created_at', '>=', $data['created_from']);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($data['created_to'])) {
|
||||||
|
$query->where('created_at', '<=', $data['created_to']);
|
||||||
|
}
|
||||||
|
// $query->orderBy('created_at', 'asc');
|
||||||
|
})
|
||||||
|
->indicateUsing(function (array $data) {
|
||||||
|
$indicators = [];
|
||||||
|
|
||||||
|
if (! empty($data['Plant'])) {
|
||||||
|
$indicators[] = 'Plant Name: '.Plant::where('id', $data['Plant'])->value('name');
|
||||||
|
} else {
|
||||||
|
$userHas = Filament::auth()->user()->plant_id;
|
||||||
|
|
||||||
|
if ($userHas && strlen($userHas) > 0) {
|
||||||
|
return 'Plant Name: Choose plant to filter records.';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($data['Item'])) {
|
||||||
|
$indicators[] = 'Item Code: '.Item::where('id', $data['Item'])->value('code');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($data['process_order'])) {
|
||||||
|
$indicators[] = 'Process Order: '.$data['process_order'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($data['wire_packing_number'])) {
|
||||||
|
$indicators[] = 'Wire Packing Number: '.$data['wire_packing_number'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($data['customer_po_master_id'])) {
|
||||||
|
$indicators[] = 'Customer PO: '.$data['customer_po_master_id'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($data['wire_packing_status'])) {
|
||||||
|
$indicators[] = 'Wire Packing Status: '.$data['wire_packing_status'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($data['created_from'])) {
|
||||||
|
$indicators[] = 'From: '.$data['created_from'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! empty($data['created_to'])) {
|
||||||
|
$indicators[] = 'To: '.$data['created_to'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return $indicators;
|
||||||
|
}),
|
||||||
])
|
])
|
||||||
|
->filtersFormMaxHeight('280px')
|
||||||
->actions([
|
->actions([
|
||||||
Tables\Actions\ViewAction::make(),
|
Tables\Actions\ViewAction::make(),
|
||||||
Tables\Actions\EditAction::make(),
|
Tables\Actions\EditAction::make(),
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
namespace App\Filament\Resources\WireMasterPackingResource\Pages;
|
namespace App\Filament\Resources\WireMasterPackingResource\Pages;
|
||||||
|
|
||||||
use App\Filament\Resources\WireMasterPackingResource;
|
use App\Filament\Resources\WireMasterPackingResource;
|
||||||
|
use App\Models\CustomerPoMaster;
|
||||||
use App\Models\Item;
|
use App\Models\Item;
|
||||||
use App\Models\Plant;
|
use App\Models\Plant;
|
||||||
use App\Models\WireMasterPacking;
|
use App\Models\WireMasterPacking;
|
||||||
@@ -81,7 +82,9 @@ class CreateWireMasterPacking extends CreateRecord
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$pattern = '/^([^|]+)\|([^|]+)\|(\d+(\.\d+)?)$/';
|
// $pattern = '/^([^|]+)\|([^|]+)\|(\d+(\.\d+)?)$/';
|
||||||
|
// $pattern = '/^([^|]+)\|([^|]+)\|([^|]+)\|(\d+(\.\d+)?)$/';
|
||||||
|
$pattern = '/^([^|]+)\|([^|]+)\|([^|]+)\|(\d+(\.\d+)?)(kg)?$/i';
|
||||||
|
|
||||||
if (!preg_match($pattern, $processOrder, $matches))
|
if (!preg_match($pattern, $processOrder, $matches))
|
||||||
{
|
{
|
||||||
@@ -106,7 +109,8 @@ class CreateWireMasterPacking extends CreateRecord
|
|||||||
|
|
||||||
$materialCode = $matches[1];
|
$materialCode = $matches[1];
|
||||||
$processOrderId = $matches[2];
|
$processOrderId = $matches[2];
|
||||||
$weight = $matches[3];
|
$coilNo = $matches[3];
|
||||||
|
$weight = $matches[4];
|
||||||
|
|
||||||
$icode = Item::where('code', $materialCode)->first();
|
$icode = Item::where('code', $materialCode)->first();
|
||||||
|
|
||||||
@@ -160,7 +164,34 @@ class CreateWireMasterPacking extends CreateRecord
|
|||||||
return;
|
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)
|
if($processOrderAgaPlant)
|
||||||
{
|
{
|
||||||
@@ -182,6 +213,68 @@ class CreateWireMasterPacking extends CreateRecord
|
|||||||
]);
|
]);
|
||||||
return;
|
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
|
try
|
||||||
{
|
{
|
||||||
$existingPallet = WireMasterPacking::where('plant_id', $plantId)
|
$existingPallet = WireMasterPacking::where('plant_id', $plantId)
|
||||||
@@ -200,7 +293,7 @@ class CreateWireMasterPacking extends CreateRecord
|
|||||||
'plant_id' => $plantId,
|
'plant_id' => $plantId,
|
||||||
'item_id' => $itemId,
|
'item_id' => $itemId,
|
||||||
'wire_packing_number' => $wirePackNo,
|
'wire_packing_number' => $wirePackNo,
|
||||||
'process_order' => $processOrderId,
|
'process_order' => $processOrderId . '-' . $coilNo,
|
||||||
'customer_po_master_id' => $customerPo,
|
'customer_po_master_id' => $customerPo,
|
||||||
'weight' => $weight,
|
'weight' => $weight,
|
||||||
'created_by' => $createdBy,
|
'created_by' => $createdBy,
|
||||||
@@ -590,6 +683,33 @@ class CreateWireMasterPacking extends CreateRecord
|
|||||||
return;
|
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)
|
$count = WireMasterPacking::where('plant_id', $plantId)
|
||||||
->where('wire_packing_number', $palletNumber)
|
->where('wire_packing_number', $palletNumber)
|
||||||
->count('wire_packing_number');
|
->count('wire_packing_number');
|
||||||
@@ -618,7 +738,7 @@ class CreateWireMasterPacking extends CreateRecord
|
|||||||
|
|
||||||
|
|
||||||
$processOrderexist = WireMasterPacking::where('plant_id', $plantId)
|
$processOrderexist = WireMasterPacking::where('plant_id', $plantId)
|
||||||
->where('process_order', $processOrder)
|
->where('process_order', $processOrderId . '-' . $coilNo)
|
||||||
->first();
|
->first();
|
||||||
if (!$processOrderexist)
|
if (!$processOrderexist)
|
||||||
{
|
{
|
||||||
@@ -643,7 +763,7 @@ class CreateWireMasterPacking extends CreateRecord
|
|||||||
}
|
}
|
||||||
|
|
||||||
$palletExist = WireMasterPacking::where('plant_id', $plantId)
|
$palletExist = WireMasterPacking::where('plant_id', $plantId)
|
||||||
->where('process_order', $processOrder)
|
->where('process_order', $processOrderId . '-' . $coilNo)
|
||||||
->where('wire_packing_number', '!=', '')
|
->where('wire_packing_number', '!=', '')
|
||||||
->where('wire_packing_number', '!=', null)
|
->where('wire_packing_number', '!=', null)
|
||||||
->first();
|
->first();
|
||||||
@@ -673,7 +793,7 @@ class CreateWireMasterPacking extends CreateRecord
|
|||||||
|
|
||||||
$deleted = WireMasterPacking::where('plant_id', $plantId)
|
$deleted = WireMasterPacking::where('plant_id', $plantId)
|
||||||
->where('wire_packing_number', $palletNumber)
|
->where('wire_packing_number', $palletNumber)
|
||||||
->where('process_order', $processOrder)
|
->where('process_order', $processOrderId . '-' . $coilNo)
|
||||||
->forceDelete();
|
->forceDelete();
|
||||||
|
|
||||||
if ($deleted)
|
if ($deleted)
|
||||||
|
|||||||
@@ -520,9 +520,9 @@ class CharacteristicsController extends Controller
|
|||||||
|
|
||||||
if (Str::contains($modelHeading, 'PRESSURE BOOSTER SYSTEM', ignoreCase: true)) {
|
if (Str::contains($modelHeading, 'PRESSURE BOOSTER SYSTEM', ignoreCase: true)) {
|
||||||
$typesToCreate = ['MOTOR', 'PUMP', 'NAME_PLATE'];
|
$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'];
|
$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'];
|
$typesToCreate = ['PUMP'];
|
||||||
} elseif (Str::contains($modelHeading, 'MOTOR', ignoreCase: true)) {
|
} elseif (Str::contains($modelHeading, 'MOTOR', ignoreCase: true)) {
|
||||||
$typesToCreate = ['MOTOR'];
|
$typesToCreate = ['MOTOR'];
|
||||||
@@ -649,7 +649,7 @@ class CharacteristicsController extends Controller
|
|||||||
'status_code' => 'ERROR',
|
'status_code' => 'ERROR',
|
||||||
'status_description' => "Serial number '{$serialNumber}' doesn't have name plate model to proceed!",
|
'status_description' => "Serial number '{$serialNumber}' doesn't have name plate model to proceed!",
|
||||||
], 404);
|
], 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') {
|
if ($modelType == 'MOTOR') {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status_code' => 'ERROR',
|
'status_code' => 'ERROR',
|
||||||
@@ -673,7 +673,7 @@ class CharacteristicsController extends Controller
|
|||||||
// 'status_description' => "Serial number '{$serialNumber}' doesn't have pumpset model to proceed!",
|
// 'status_description' => "Serial number '{$serialNumber}' doesn't have pumpset model to proceed!",
|
||||||
// ], 404);
|
// ], 404);
|
||||||
}
|
}
|
||||||
} elseif (! Str::contains($curHead, 'PUMPSET', ignoreCase: true)) {
|
} elseif (! Str::contains($curHead, 'PUMPS', ignoreCase: true) && ! Str::contains($curHead, 'PUMPSET', ignoreCase: true)) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status_code' => 'ERROR',
|
'status_code' => 'ERROR',
|
||||||
'status_description' => "Serial number '{$serialNumber}' doesn't have valid model type to proceed!",
|
'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 ($char['motor_pump_pumpset_status'] == '3') {
|
||||||
if ($modelType == 'MOTOR') {
|
if ($modelType == 'MOTOR') {
|
||||||
|
$curMMach = $char['motor_machine_name'] ?? $curMMach;
|
||||||
$motPhysiCnt = $motPhysiCnt + 1;
|
$motPhysiCnt = $motPhysiCnt + 1;
|
||||||
$motExpecTim = $motExpecTim + $expectedTime;
|
$motExpecTim = $motExpecTim + $expectedTime;
|
||||||
if ($motPhysiCnt >= $mvhsCnt) {
|
if ($motPhysiCnt >= $mvhsCnt) {
|
||||||
@@ -801,6 +802,7 @@ class CharacteristicsController extends Controller
|
|||||||
}
|
}
|
||||||
$curMotorMarkBy = ($char['motor_marked_by'] == 'jothi') ? 'Admin' : $char['motor_marked_by'] ?? $curMotorMarkBy;
|
$curMotorMarkBy = ($char['motor_marked_by'] == 'jothi') ? 'Admin' : $char['motor_marked_by'] ?? $curMotorMarkBy;
|
||||||
} elseif ($modelType == 'PUMP') {
|
} elseif ($modelType == 'PUMP') {
|
||||||
|
$curPMach = $char['pump_machine_name'] ?? $curPMach;
|
||||||
$pumPhysiCnt = $pumPhysiCnt + 1;
|
$pumPhysiCnt = $pumPhysiCnt + 1;
|
||||||
$pumExpecTim = $pumExpecTim + $expectedTime;
|
$pumExpecTim = $pumExpecTim + $expectedTime;
|
||||||
if ($pumPhysiCnt >= $mvhsCnt) {
|
if ($pumPhysiCnt >= $mvhsCnt) {
|
||||||
@@ -808,6 +810,7 @@ class CharacteristicsController extends Controller
|
|||||||
}
|
}
|
||||||
$curPumpMarkBy = ($char['pump_marked_by'] == 'jothi') ? 'Admin' : $char['pump_marked_by'] ?? $curPumpMarkBy;
|
$curPumpMarkBy = ($char['pump_marked_by'] == 'jothi') ? 'Admin' : $char['pump_marked_by'] ?? $curPumpMarkBy;
|
||||||
} elseif ($modelType == 'NAME_PLATE') {
|
} elseif ($modelType == 'NAME_PLATE') {
|
||||||
|
$curNpMach = $char['name_plate_machine_name'] ?? $curNpMach;
|
||||||
$napExpecTim = $napExpecTim + $expectedTime;
|
$napExpecTim = $napExpecTim + $expectedTime;
|
||||||
$curNamePlateMarkStat = 'Marked';
|
$curNamePlateMarkStat = 'Marked';
|
||||||
$curNamePlateMarkBy = ($char['name_plate_marked_by'] == 'jothi') ? 'Admin' : $char['name_plate_marked_by'] ?? $curNamePlateMarkBy;
|
$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,
|
'name_plate_marked_by' => $curNamePlateMarkBy,
|
||||||
'motor_pump_pumpset_status' => '3',
|
'motor_pump_pumpset_status' => '3',
|
||||||
'winded_serial_number' => $char['winded_serial_number'] ?? $curWindNo,
|
'winded_serial_number' => $char['winded_serial_number'] ?? $curWindNo,
|
||||||
'motor_machine_name' => $char['motor_machine_name'] ?? $curMMach,
|
'motor_machine_name' => $curMMach,
|
||||||
'pump_machine_name' => $char['pump_machine_name'] ?? $curPMach,
|
'pump_machine_name' => $curPMach,
|
||||||
'name_plate_machine_name' => $char['name_plate_machine_name'] ?? $curNpMach,
|
'name_plate_machine_name' => $curNpMach,
|
||||||
'part_validation_1' => $char['part_validation_1'] ?? $curPart1,
|
'part_validation_1' => $char['part_validation_1'] ?? $curPart1,
|
||||||
'part_validation_2' => $char['part_validation_2'] ?? $curPart2,
|
'part_validation_2' => $char['part_validation_2'] ?? $curPart2,
|
||||||
'samlight_logged_name' => $char['samlight_logged_name'] ?? $slUser,
|
'samlight_logged_name' => $char['samlight_logged_name'] ?? $slUser,
|
||||||
@@ -874,10 +877,10 @@ class CharacteristicsController extends Controller
|
|||||||
'name_plate_expected_time' => (string) $napExpecTim,
|
'name_plate_expected_time' => (string) $napExpecTim,
|
||||||
'name_plate_marked_by' => $curNamePlateMarkBy,
|
'name_plate_marked_by' => $curNamePlateMarkBy,
|
||||||
'motor_pump_pumpset_status' => '3',
|
'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,
|
'name_plate_machine_name' => $char['name_plate_machine_name'] ?? $curNpMach,
|
||||||
// 'part_validation_1' => $char['part_validation_1'] ?? $curPart1,
|
'part_validation_1' => $char['part_validation_1'] ?? $curPart1,
|
||||||
// 'part_validation_2' => $char['part_validation_2'] ?? $curPart2,
|
'part_validation_2' => $char['part_validation_2'] ?? $curPart2,
|
||||||
'samlight_logged_name' => $char['samlight_logged_name'] ?? $slUser,
|
'samlight_logged_name' => $char['samlight_logged_name'] ?? $slUser,
|
||||||
'pending_released_status' => $char['pending_released_status'] ?? 0,
|
'pending_released_status' => $char['pending_released_status'] ?? 0,
|
||||||
'has_work_flow_id' => $char['has_work_flow_id'] ?? $curWorkFlow,
|
'has_work_flow_id' => $char['has_work_flow_id'] ?? $curWorkFlow,
|
||||||
@@ -913,10 +916,10 @@ class CharacteristicsController extends Controller
|
|||||||
'pump_expected_time' => (string) $pumExpecTim,
|
'pump_expected_time' => (string) $pumExpecTim,
|
||||||
'pump_marked_by' => $curPumpMarkBy,
|
'pump_marked_by' => $curPumpMarkBy,
|
||||||
'motor_pump_pumpset_status' => '3',
|
'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,
|
'pump_machine_name' => $char['pump_machine_name'] ?? $curPMach,
|
||||||
// 'part_validation_1' => $char['part_validation_1'] ?? $curPart1,
|
'part_validation_1' => $char['part_validation_1'] ?? $curPart1,
|
||||||
// 'part_validation_2' => $char['part_validation_2'] ?? $curPart2,
|
'part_validation_2' => $char['part_validation_2'] ?? $curPart2,
|
||||||
'samlight_logged_name' => $char['samlight_logged_name'] ?? $slUser,
|
'samlight_logged_name' => $char['samlight_logged_name'] ?? $slUser,
|
||||||
'pending_released_status' => $char['pending_released_status'] ?? 0,
|
'pending_released_status' => $char['pending_released_status'] ?? 0,
|
||||||
'has_work_flow_id' => $char['has_work_flow_id'] ?? $curWorkFlow,
|
'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 ?? []);
|
// $values = array_merge($values1 ?? [], $values2 ?? [], $values3 ?? [], $values4 ?? [], $values5 ?? []);
|
||||||
} elseif ($hasMvhs == true) {
|
} elseif ($hasMvhs == true) {
|
||||||
if ($modelType == 'MOTOR') {
|
if ($modelType == 'MOTOR') {
|
||||||
|
$curMMach = $char['motor_machine_name'] ?? $curMMach;
|
||||||
$motPhysiCnt = $motPhysiCnt + 1;
|
$motPhysiCnt = $motPhysiCnt + 1;
|
||||||
$motExpecTim = $motExpecTim + $expectedTime;
|
$motExpecTim = $motExpecTim + $expectedTime;
|
||||||
if ($motPhysiCnt >= $mvhsCnt) {
|
if ($motPhysiCnt >= $mvhsCnt) {
|
||||||
@@ -971,6 +975,7 @@ class CharacteristicsController extends Controller
|
|||||||
}
|
}
|
||||||
$curMotorMarkBy = ($char['motor_marked_by'] == 'jothi') ? 'Admin' : $char['motor_marked_by'] ?? $curMotorMarkBy;
|
$curMotorMarkBy = ($char['motor_marked_by'] == 'jothi') ? 'Admin' : $char['motor_marked_by'] ?? $curMotorMarkBy;
|
||||||
} elseif ($modelType == 'PUMP') {
|
} elseif ($modelType == 'PUMP') {
|
||||||
|
$curPMach = $char['pump_machine_name'] ?? $curPMach;
|
||||||
$pumPhysiCnt = $pumPhysiCnt + 1;
|
$pumPhysiCnt = $pumPhysiCnt + 1;
|
||||||
$pumExpecTim = $pumExpecTim + $expectedTime;
|
$pumExpecTim = $pumExpecTim + $expectedTime;
|
||||||
if ($pumPhysiCnt >= $mvhsCnt) {
|
if ($pumPhysiCnt >= $mvhsCnt) {
|
||||||
@@ -978,6 +983,7 @@ class CharacteristicsController extends Controller
|
|||||||
}
|
}
|
||||||
$curPumpMarkBy = ($char['pump_marked_by'] == 'jothi') ? 'Admin' : $char['pump_marked_by'] ?? $curPumpMarkBy;
|
$curPumpMarkBy = ($char['pump_marked_by'] == 'jothi') ? 'Admin' : $char['pump_marked_by'] ?? $curPumpMarkBy;
|
||||||
} elseif ($modelType == 'NAME_PLATE') {
|
} elseif ($modelType == 'NAME_PLATE') {
|
||||||
|
$curNpMach = $char['name_plate_machine_name'] ?? $curNpMach;
|
||||||
$napExpecTim = $napExpecTim + $expectedTime;
|
$napExpecTim = $napExpecTim + $expectedTime;
|
||||||
$curNamePlateMarkStat = 'Marked';
|
$curNamePlateMarkStat = 'Marked';
|
||||||
$curNamePlateMarkBy = ($char['name_plate_marked_by'] == 'jothi') ? 'Admin' : $char['name_plate_marked_by'] ?? $curNamePlateMarkBy;
|
$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,
|
'name_plate_marked_by' => $curNamePlateMarkBy,
|
||||||
'motor_pump_pumpset_status' => null,
|
'motor_pump_pumpset_status' => null,
|
||||||
'winded_serial_number' => $char['winded_serial_number'] ?? $curWindNo,
|
'winded_serial_number' => $char['winded_serial_number'] ?? $curWindNo,
|
||||||
'motor_machine_name' => $char['motor_machine_name'] ?? $curMMach,
|
'motor_machine_name' => $curMMach,
|
||||||
'pump_machine_name' => $char['pump_machine_name'] ?? $curPMach,
|
'pump_machine_name' => $curPMach,
|
||||||
'name_plate_machine_name' => $char['name_plate_machine_name'] ?? $curNpMach,
|
'name_plate_machine_name' => $curNpMach,
|
||||||
'part_validation_1' => $char['part_validation_1'] ?? $curPart1,
|
'part_validation_1' => $char['part_validation_1'] ?? $curPart1,
|
||||||
'part_validation_2' => $char['part_validation_2'] ?? $curPart2,
|
'part_validation_2' => $char['part_validation_2'] ?? $curPart2,
|
||||||
'samlight_logged_name' => $char['samlight_logged_name'] ?? $slUser,
|
'samlight_logged_name' => $char['samlight_logged_name'] ?? $slUser,
|
||||||
@@ -1021,6 +1027,7 @@ class CharacteristicsController extends Controller
|
|||||||
// $values = array_merge($values1 ?? [], $values2 ?? [], $values3 ?? [], $values4 ?? [], $values5 ?? []);
|
// $values = array_merge($values1 ?? [], $values2 ?? [], $values3 ?? [], $values4 ?? [], $values5 ?? []);
|
||||||
} else {
|
} else {
|
||||||
if ($modelType == 'MOTOR') {
|
if ($modelType == 'MOTOR') {
|
||||||
|
$curMMach = $char['motor_machine_name'] ?? $curMMach;
|
||||||
$motPhysiCnt = $motPhysiCnt + 1;
|
$motPhysiCnt = $motPhysiCnt + 1;
|
||||||
$motExpecTim = $motExpecTim + $expectedTime;
|
$motExpecTim = $motExpecTim + $expectedTime;
|
||||||
if ($motPhysiCnt >= $mvhsCnt) {
|
if ($motPhysiCnt >= $mvhsCnt) {
|
||||||
@@ -1028,6 +1035,7 @@ class CharacteristicsController extends Controller
|
|||||||
}
|
}
|
||||||
$curMotorMarkBy = ($char['motor_marked_by'] == 'jothi') ? 'Admin' : $char['motor_marked_by'] ?? $curMotorMarkBy;
|
$curMotorMarkBy = ($char['motor_marked_by'] == 'jothi') ? 'Admin' : $char['motor_marked_by'] ?? $curMotorMarkBy;
|
||||||
} elseif ($modelType == 'PUMP') {
|
} elseif ($modelType == 'PUMP') {
|
||||||
|
$curPMach = $char['pump_machine_name'] ?? $curPMach;
|
||||||
$pumPhysiCnt = $pumPhysiCnt + 1;
|
$pumPhysiCnt = $pumPhysiCnt + 1;
|
||||||
$pumExpecTim = $pumExpecTim + $expectedTime;
|
$pumExpecTim = $pumExpecTim + $expectedTime;
|
||||||
if ($pumPhysiCnt >= $mvhsCnt) {
|
if ($pumPhysiCnt >= $mvhsCnt) {
|
||||||
@@ -1040,7 +1048,7 @@ class CharacteristicsController extends Controller
|
|||||||
|
|
||||||
if ($curMotorMarkStat == 'Marked' && $curPumpMarkStat == 'Marked') {
|
if ($curMotorMarkStat == 'Marked' && $curPumpMarkStat == 'Marked') {
|
||||||
$curMarkStat = '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) {
|
if ($modelType == 'PUMP' && $pumPhysiCnt >= $mvhsCnt) {
|
||||||
$curMarkStat = 'Marked';
|
$curMarkStat = 'Marked';
|
||||||
}
|
}
|
||||||
@@ -1069,8 +1077,8 @@ class CharacteristicsController extends Controller
|
|||||||
'name_plate_marked_by' => $curNamePlateMarkBy,
|
'name_plate_marked_by' => $curNamePlateMarkBy,
|
||||||
'motor_pump_pumpset_status' => null,
|
'motor_pump_pumpset_status' => null,
|
||||||
'winded_serial_number' => $char['winded_serial_number'] ?? $curWindNo,
|
'winded_serial_number' => $char['winded_serial_number'] ?? $curWindNo,
|
||||||
'motor_machine_name' => $char['motor_machine_name'] ?? $curMMach,
|
'motor_machine_name' => $curMMach,
|
||||||
'pump_machine_name' => $char['pump_machine_name'] ?? $curPMach,
|
'pump_machine_name' => $curPMach,
|
||||||
'name_plate_machine_name' => $char['name_plate_machine_name'] ?? $curNpMach,
|
'name_plate_machine_name' => $char['name_plate_machine_name'] ?? $curNpMach,
|
||||||
'part_validation_1' => $char['part_validation_1'] ?? $curPart1,
|
'part_validation_1' => $char['part_validation_1'] ?? $curPart1,
|
||||||
'part_validation_2' => $char['part_validation_2'] ?? $curPart2,
|
'part_validation_2' => $char['part_validation_2'] ?? $curPart2,
|
||||||
@@ -1110,6 +1118,14 @@ class CharacteristicsController extends Controller
|
|||||||
// ], 404);
|
// ], 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 = (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;
|
// $manStat = ($curStat->man_marked_status == null || $curStat->man_marked_status == '' || $curStat->man_marked_status == '0') ? 0 : (int) $curStat->man_marked_status;
|
||||||
$values = [
|
$values = [
|
||||||
@@ -1117,6 +1133,9 @@ class CharacteristicsController extends Controller
|
|||||||
'man_marked_datetime' => $char['man_marked_datetime'] ?? now(),
|
'man_marked_datetime' => $char['man_marked_datetime'] ?? now(),
|
||||||
'man_marked_by' => ($char['man_marked_by'] == 'jothi') ? 'Admin' : $char['man_marked_by'] ?? $curManualMarkBy,
|
'man_marked_by' => ($char['man_marked_by'] == 'jothi') ? 'Admin' : $char['man_marked_by'] ?? $curManualMarkBy,
|
||||||
'winded_serial_number' => $char['winded_serial_number'] ?? $curWindNo,
|
'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_1' => $char['part_validation_1'] ?? $curPart1,
|
||||||
'part_validation_2' => $char['part_validation_2'] ?? $curPart2,
|
'part_validation_2' => $char['part_validation_2'] ?? $curPart2,
|
||||||
'samlight_logged_name' => $char['samlight_logged_name'] ?? $slUser,
|
'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)) {
|
if (Str::contains($modelHeading, 'PRESSURE BOOSTER SYSTEM', ignoreCase: true)) {
|
||||||
$typesToCreate = ['MOTOR', 'PUMP', 'NAME_PLATE'];
|
$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'];
|
$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'];
|
$typesToCreate = ['PUMP'];
|
||||||
} elseif (Str::contains($modelHeading, 'MOTOR', ignoreCase: true)) {
|
} elseif (Str::contains($modelHeading, 'MOTOR', ignoreCase: true)) {
|
||||||
$typesToCreate = ['MOTOR'];
|
$typesToCreate = ['MOTOR'];
|
||||||
@@ -1922,9 +1941,9 @@ class CharacteristicsController extends Controller
|
|||||||
|
|
||||||
if (Str::contains($modelHeading, 'PRESSURE BOOSTER SYSTEM', ignoreCase: true)) {
|
if (Str::contains($modelHeading, 'PRESSURE BOOSTER SYSTEM', ignoreCase: true)) {
|
||||||
$typesToCreate = ['MOTOR', 'PUMP', 'NAME_PLATE'];
|
$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'];
|
$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'];
|
$typesToCreate = ['PUMP'];
|
||||||
} elseif (Str::contains($modelHeading, 'MOTOR', ignoreCase: true)) {
|
} elseif (Str::contains($modelHeading, 'MOTOR', ignoreCase: true)) {
|
||||||
$typesToCreate = ['MOTOR'];
|
$typesToCreate = ['MOTOR'];
|
||||||
@@ -2356,7 +2375,7 @@ class CharacteristicsController extends Controller
|
|||||||
'status_code' => 'ERROR',
|
'status_code' => 'ERROR',
|
||||||
'status_description' => "Serial number '{$serialNumber}' doesn't have name plate model to proceed!",
|
'status_description' => "Serial number '{$serialNumber}' doesn't have name plate model to proceed!",
|
||||||
], 404);
|
], 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') {
|
if ($modelType == 'MOTOR') {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status_code' => 'ERROR',
|
'status_code' => 'ERROR',
|
||||||
@@ -2380,7 +2399,7 @@ class CharacteristicsController extends Controller
|
|||||||
// 'status_description' => "Serial number '{$serialNumber}' doesn't have pumpset model to proceed!",
|
// 'status_description' => "Serial number '{$serialNumber}' doesn't have pumpset model to proceed!",
|
||||||
// ], 404);
|
// ], 404);
|
||||||
}
|
}
|
||||||
} elseif (! Str::contains($curHead, 'PUMPSET', ignoreCase: true)) {
|
} elseif (! Str::contains($curHead, 'PUMPS', ignoreCase: true) && ! Str::contains($curHead, 'PUMPSET', ignoreCase: true)) {
|
||||||
return response()->json([
|
return response()->json([
|
||||||
'status_code' => 'ERROR',
|
'status_code' => 'ERROR',
|
||||||
'status_description' => "Serial number '{$serialNumber}' doesn't have valid model type to proceed!",
|
'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)) {
|
if (Str::contains($modelHeading, 'PRESSURE BOOSTER SYSTEM', ignoreCase: true)) {
|
||||||
$typesToCreate = ['MOTOR', 'PUMP', 'NAME_PLATE'];
|
$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'];
|
$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'];
|
$typesToCreate = ['PUMP'];
|
||||||
} elseif (Str::contains($modelHeading, 'MOTOR', ignoreCase: true)) {
|
} elseif (Str::contains($modelHeading, 'MOTOR', ignoreCase: true)) {
|
||||||
$typesToCreate = ['MOTOR'];
|
$typesToCreate = ['MOTOR'];
|
||||||
@@ -4682,9 +4701,9 @@ class CharacteristicsController extends Controller
|
|||||||
|
|
||||||
if (Str::contains($modelHeading, 'PRESSURE BOOSTER SYSTEM', ignoreCase: true)) {
|
if (Str::contains($modelHeading, 'PRESSURE BOOSTER SYSTEM', ignoreCase: true)) {
|
||||||
$typesToCreate = ['MOTOR', 'PUMP', 'NAME_PLATE'];
|
$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'];
|
$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'];
|
$typesToCreate = ['PUMP'];
|
||||||
} elseif (Str::contains($modelHeading, 'MOTOR', ignoreCase: true)) {
|
} elseif (Str::contains($modelHeading, 'MOTOR', ignoreCase: true)) {
|
||||||
$typesToCreate = ['MOTOR'];
|
$typesToCreate = ['MOTOR'];
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|
||||||
@@ -143,8 +143,10 @@ class PalletPrintController extends Controller
|
|||||||
'customerName' => $customerName,
|
'customerName' => $customerName,
|
||||||
'masterBox' => $boxLabel,
|
'masterBox' => $boxLabel,
|
||||||
'items' => $items,
|
'items' => $items,
|
||||||
'grossWeight' => $grossWeight,
|
'grossWeight' => $grossWeight + 3.050,
|
||||||
'netWeight' => $grossWeight - 3.05,
|
'netWeight' => $grossWeight,
|
||||||
|
// 'grossWeight' => $grossWeight,
|
||||||
|
// 'netWeight' => $grossWeight - 3.05,
|
||||||
'pallet' => $pallet,
|
'pallet' => $pallet,
|
||||||
])->setPaper([0, 0, $widthPt, $heightPt], 'portrait');
|
])->setPaper([0, 0, $widthPt, $heightPt], 'portrait');
|
||||||
|
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ class ProductionOrderController extends Controller
|
|||||||
|
|
||||||
$qrCode = new QrCode($qrData);
|
$qrCode = new QrCode($qrData);
|
||||||
$output = new Output\Png;
|
$output = new Output\Png;
|
||||||
|
// $qrBinary = $output->output($qrCode, 100);
|
||||||
$qrBinary = $output->output($qrCode, 100);
|
$qrBinary = $output->output($qrCode, 100);
|
||||||
$qrBase64 = base64_encode($qrBinary);
|
$qrBase64 = base64_encode($qrBinary);
|
||||||
|
|
||||||
@@ -79,7 +80,8 @@ class ProductionOrderController extends Controller
|
|||||||
|
|
||||||
$wareHouseNo = Plant::where('code', $plantCode)->first();
|
$wareHouseNo = Plant::where('code', $plantCode)->first();
|
||||||
|
|
||||||
$wareNo = $wareHouseNo->warehouse_number;
|
$wareNo = $wareHouseNo->warehouse_number ?? null;
|
||||||
|
|
||||||
|
|
||||||
\Log::info('Plant Data', [
|
\Log::info('Plant Data', [
|
||||||
'plant' => $wareHouseNo ? $wareHouseNo->toArray() : null,
|
'plant' => $wareHouseNo ? $wareHouseNo->toArray() : null,
|
||||||
@@ -134,6 +136,77 @@ class ProductionOrderController extends Controller
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function printitemserial($production_order, $plantCode)
|
||||||
|
{
|
||||||
|
$order = ProductionOrder::where('production_order', $production_order)->first();
|
||||||
|
|
||||||
|
if (!$order) {
|
||||||
|
abort(404, 'Production Order not found');
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$fromSerial = (int) $order->from_serial_number;
|
||||||
|
$toSerial = (int) $order->to_serial_number;
|
||||||
|
$itemCode = $order->item->code ?? '';
|
||||||
|
$itemDes = $order->item->description ?? '';
|
||||||
|
|
||||||
|
$wareHouseNo = Plant::where('code', $plantCode)->first();
|
||||||
|
|
||||||
|
$wareNo = $wareHouseNo->warehouse_number ?? null;
|
||||||
|
|
||||||
|
$now = Carbon::now();
|
||||||
|
$year = $now->format('y');
|
||||||
|
$month = $now->format('m');
|
||||||
|
|
||||||
|
$stickers = [];
|
||||||
|
|
||||||
|
for ($i = $fromSerial; $i <= $toSerial; $i++)
|
||||||
|
{
|
||||||
|
|
||||||
|
$serial = str_pad($i, 6, '0', STR_PAD_LEFT);
|
||||||
|
|
||||||
|
if(!empty($wareNo)){
|
||||||
|
$serial = substr($serial, 0, 4) . $wareNo . substr($serial, 4);
|
||||||
|
$qrData = $itemCode . '|' . $serial;
|
||||||
|
} else {
|
||||||
|
$qrData = $itemCode . '|' . $serial;
|
||||||
|
$serial = str_pad($i, 6, '0', STR_PAD_LEFT);
|
||||||
|
}
|
||||||
|
|
||||||
|
// $qrData = $itemCode . '|' . $serial;
|
||||||
|
|
||||||
|
// $serialCount = substr(str_pad($i, 6, '0', STR_PAD_LEFT), -6);
|
||||||
|
|
||||||
|
// $serialWithWarehouse = substr($serial, 0, 4) . $wareNo . substr($serial, 4);
|
||||||
|
|
||||||
|
// $qrData = $itemCode . '|' . $serialWithWarehouse;
|
||||||
|
|
||||||
|
// $panel = $plantCode . $wareNo . '/' . $itemCode . '/' . $year.$month . '/' . $serialCount;
|
||||||
|
|
||||||
|
// $qrBase64 = base64_encode(
|
||||||
|
// QrCode::format('png')->size(100)->generate($qrData)
|
||||||
|
// );
|
||||||
|
|
||||||
|
$qrCode = new QrCode($qrData);
|
||||||
|
$output = new Output\Png;
|
||||||
|
// $qrBinary = $output->output($qrCode, 100);
|
||||||
|
$qrBinary = $output->output($qrCode, 100);
|
||||||
|
$qrBase64 = base64_encode($qrBinary);
|
||||||
|
|
||||||
|
$stickers[] = [
|
||||||
|
'serial' => $serial,
|
||||||
|
'qr' => 'data:image/png;base64,' . $qrBase64,
|
||||||
|
'production_order' => $itemCode,
|
||||||
|
'description' => $itemDes ?? ''
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
$pdf = Pdf::loadView('production-orders.printItemSerial', compact('stickers'))
|
||||||
|
->setPaper([0, 0, 170, 40]);
|
||||||
|
|
||||||
|
return $pdf->stream('stickers.pdf');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Store a newly created resource in storage.
|
* Store a newly created resource in storage.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -147,12 +147,22 @@ class VehicleController extends Controller
|
|||||||
foreach ($data as $item) {
|
foreach ($data as $item) {
|
||||||
|
|
||||||
$uuid = $item['uuid'] ?? '';
|
$uuid = $item['uuid'] ?? '';
|
||||||
$vehicleNo = trim($item['vehicle_number'] ?? '');
|
// $vehicleNo = strtoupper(trim($item['vehicle_number'] ?? ''));
|
||||||
|
$vehicleNo = strtoupper(
|
||||||
|
str_replace(' ', '', trim($item['vehicle_number'] ?? ''))
|
||||||
|
);
|
||||||
$entryTimeRaw = $item['entry_time'] ?? '';
|
$entryTimeRaw = $item['entry_time'] ?? '';
|
||||||
$exitTimeRaw = $item['exit_time'] ?? '';
|
$exitTimeRaw = $item['exit_time'] ?? '';
|
||||||
$duration = $item['duration'] ?? '';
|
$duration = $item['duration'] ?? '';
|
||||||
$type = $item['type'] ?? '';
|
$type = $item['type'] ?? '';
|
||||||
|
|
||||||
|
$manualVehicles = [
|
||||||
|
'TN01KK0004',
|
||||||
|
'TN01KK0001',
|
||||||
|
];
|
||||||
|
|
||||||
|
$boomOpened = in_array($vehicleNo, $manualVehicles) ? 'Manual' : 'Auto';
|
||||||
|
|
||||||
if(!empty($entryTimeRaw)){
|
if(!empty($entryTimeRaw)){
|
||||||
$entryTime = $entryTimeRaw
|
$entryTime = $entryTimeRaw
|
||||||
? Carbon::createFromFormat('d/m/Y h:i:s A', $entryTimeRaw)
|
? Carbon::createFromFormat('d/m/Y h:i:s A', $entryTimeRaw)
|
||||||
@@ -195,6 +205,7 @@ class VehicleController extends Controller
|
|||||||
],
|
],
|
||||||
[
|
[
|
||||||
'vehicle_number' => $vehicleNo,
|
'vehicle_number' => $vehicleNo,
|
||||||
|
'boom_opened' => $boomOpened,
|
||||||
'entry_time' => $entryTime,
|
'entry_time' => $entryTime,
|
||||||
'exit_time' => $exitTime ?? null,
|
'exit_time' => $exitTime ?? null,
|
||||||
'duration' => $duration ?: null,
|
'duration' => $duration ?: null,
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ class InvoiceDataTable extends Component
|
|||||||
'refreshEmptyInvoice' => 'loadEmptyData',
|
'refreshEmptyInvoice' => 'loadEmptyData',
|
||||||
'refreshInvoiceData' => 'loadData',
|
'refreshInvoiceData' => 'loadData',
|
||||||
'refreshMaterialInvoiceData' => 'loadMaterialData',
|
'refreshMaterialInvoiceData' => 'loadMaterialData',
|
||||||
|
'refreshMaterialInvoiceData1' => 'loadMaterialData1',
|
||||||
'openCapacitorModal' => 'showCapacitorInputBox',
|
'openCapacitorModal' => 'showCapacitorInputBox',
|
||||||
];
|
];
|
||||||
|
|
||||||
@@ -602,6 +603,8 @@ class InvoiceDataTable extends Component
|
|||||||
$row['material_type'] = 'Bundle';
|
$row['material_type'] = 'Bundle';
|
||||||
} elseif ($matType === 3) {
|
} elseif ($matType === 3) {
|
||||||
$row['material_type'] = 'Quantity';
|
$row['material_type'] = 'Quantity';
|
||||||
|
} elseif ($matType === 4) {
|
||||||
|
$row['material_type'] = 'Bundle Individual';
|
||||||
} else {
|
} else {
|
||||||
$row['material_type'] = 'N/A';
|
$row['material_type'] = 'N/A';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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'
|
||||||
|
// ),
|
||||||
|
// ];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
90
app/Mail/VehicleEntryMail.php
Normal file
90
app/Mail/VehicleEntryMail.php
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Mail;
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
class VehicleEntryMail extends Mailable
|
||||||
|
{
|
||||||
|
use Queueable, SerializesModels;
|
||||||
|
|
||||||
|
public $scheduleType;
|
||||||
|
|
||||||
|
public $tableData;
|
||||||
|
|
||||||
|
public $mailSubject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a new message instance.
|
||||||
|
*/
|
||||||
|
public function __construct($scheduleType, $tableData, $mailSubject)
|
||||||
|
{
|
||||||
|
$this->scheduleType = $scheduleType;
|
||||||
|
$this->tableData = $tableData ?? [];
|
||||||
|
$this->mailSubject = $mailSubject ?? 'Vehicle Entry Report';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the message envelope.
|
||||||
|
*/
|
||||||
|
public function envelope(): Envelope
|
||||||
|
{
|
||||||
|
return new Envelope(
|
||||||
|
subject: 'Vehicle Entry Mail',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the message content definition.
|
||||||
|
*/
|
||||||
|
public function content(): Content
|
||||||
|
{
|
||||||
|
$greeting = '<b>Dear Sir</b>';
|
||||||
|
|
||||||
|
//$greeting1 = 'Dear C.R.I Branch Team, <br><br> Please follow and ensure the same';
|
||||||
|
|
||||||
|
if ($this->scheduleType == 'Daily') {
|
||||||
|
$reportPeriod = "";
|
||||||
|
$greeting .= $reportPeriod;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->scheduleType == 'Hourly') {
|
||||||
|
$now = now();
|
||||||
|
$fromHour = $now->copy()->subHour()->format('H:i:s');
|
||||||
|
$toHour = $now->format('H:i:s');
|
||||||
|
$reportDate = $now->format('d/m/Y');
|
||||||
|
$greeting .= "from: $reportDate, $fromHour to $toHour. <br><br>Please arrange to receipt the same immediately.";
|
||||||
|
}
|
||||||
|
|
||||||
|
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');
|
||||||
|
$greeting .= "from: $fromMinute to $toMinute. <br><br>Please arrange to receipt the same immediately.";
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Content(
|
||||||
|
view: 'mail.vehicle_entry_report',
|
||||||
|
with: [
|
||||||
|
'company' => 'CRI Digital Manufacturing Solutions',
|
||||||
|
'greeting' => $greeting,
|
||||||
|
'tableData' => $this->tableData,
|
||||||
|
'wishes' => 'Thanks & Regards,<br>CRI Digital Manufacturing Solutions',
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Get the attachments for the message.
|
||||||
|
*
|
||||||
|
* @return array<int, \Illuminate\Mail\Mailables\Attachment>
|
||||||
|
*/
|
||||||
|
public function attachments(): array
|
||||||
|
{
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
}
|
||||||
35
app/Models/AsrsItemValidation.php
Normal file
35
app/Models/AsrsItemValidation.php
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||||
|
|
||||||
|
class AsrsItemValidation extends Model
|
||||||
|
{
|
||||||
|
use SoftDeletes;
|
||||||
|
|
||||||
|
protected $fillable = [
|
||||||
|
'plant_id',
|
||||||
|
'item_code',
|
||||||
|
'item_description',
|
||||||
|
'uom',
|
||||||
|
'mhe',
|
||||||
|
'bin_quantity',
|
||||||
|
'asrs',
|
||||||
|
'asrs_category',
|
||||||
|
'status',
|
||||||
|
'material_type',
|
||||||
|
'material_group',
|
||||||
|
'created_at',
|
||||||
|
'updated_at',
|
||||||
|
'created_by',
|
||||||
|
'updated_by',
|
||||||
|
];
|
||||||
|
|
||||||
|
public function plant(): BelongsTo
|
||||||
|
{
|
||||||
|
return $this->belongsTo(Plant::class);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -79,6 +79,11 @@ class Item extends Model
|
|||||||
return $this->hasMany(RequestCharacteristic::class, 'item_id', 'id');
|
return $this->hasMany(RequestCharacteristic::class, 'item_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function wireMasterPacking()
|
||||||
|
{
|
||||||
|
return $this->hasMany(WireMasterPacking::class, 'item_id', 'id');
|
||||||
|
}
|
||||||
|
|
||||||
public function productionCharacteristics()
|
public function productionCharacteristics()
|
||||||
{
|
{
|
||||||
return $this->hasMany(ProductionCharacteristic::class, 'item_id', 'id');
|
return $this->hasMany(ProductionCharacteristic::class, 'item_id', 'id');
|
||||||
|
|||||||
@@ -109,6 +109,11 @@ class Plant extends Model
|
|||||||
return $this->hasMany(ProcessOrder::class, 'plant_id', 'id');
|
return $this->hasMany(ProcessOrder::class, 'plant_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function wireMasterPacking()
|
||||||
|
{
|
||||||
|
return $this->hasMany(WireMasterPacking::class, 'plant_id', 'id');
|
||||||
|
}
|
||||||
|
|
||||||
public function productionOrder()
|
public function productionOrder()
|
||||||
{
|
{
|
||||||
return $this->hasMany(ProductionOrder::class, 'plant_id', 'id');
|
return $this->hasMany(ProductionOrder::class, 'plant_id', 'id');
|
||||||
@@ -158,4 +163,13 @@ class Plant extends Model
|
|||||||
{
|
{
|
||||||
return $this->hasMany(User::class, 'plant_id', 'id');
|
return $this->hasMany(User::class, 'plant_id', 'id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function vehicleEntries()
|
||||||
|
{
|
||||||
|
return $this->hasMany(VehicleEntry::class, 'plant_id', 'id');
|
||||||
|
}
|
||||||
|
public function asrsItemValidations()
|
||||||
|
{
|
||||||
|
return $this->hasMany(AsrsItemValidation::class, 'plant_id', 'id');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ class ProductCharacteristicsMaster extends Model
|
|||||||
'machine_id',
|
'machine_id',
|
||||||
'characteristics_type',
|
'characteristics_type',
|
||||||
'name',
|
'name',
|
||||||
|
'category',
|
||||||
'inspection_type',
|
'inspection_type',
|
||||||
'lower',
|
'lower',
|
||||||
'upper',
|
'upper',
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ class VehicleEntry extends Model
|
|||||||
'duration',
|
'duration',
|
||||||
'type',
|
'type',
|
||||||
'uuid',
|
'uuid',
|
||||||
|
'boom_opened',
|
||||||
'created_at',
|
'created_at',
|
||||||
'created_by',
|
'created_by',
|
||||||
'updated_at',
|
'updated_at',
|
||||||
|
|||||||
106
app/Policies/AsrsItemValidationPolicy.php
Normal file
106
app/Policies/AsrsItemValidationPolicy.php
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Policies;
|
||||||
|
|
||||||
|
use Illuminate\Auth\Access\Response;
|
||||||
|
use App\Models\AsrsItemValidation;
|
||||||
|
use App\Models\User;
|
||||||
|
|
||||||
|
class AsrsItemValidationPolicy
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Determine whether the user can view any models.
|
||||||
|
*/
|
||||||
|
public function viewAny(User $user): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('view-any AsrsItemValidation');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can view the model.
|
||||||
|
*/
|
||||||
|
public function view(User $user, AsrsItemValidation $asrsitemvalidation): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('view AsrsItemValidation');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can create models.
|
||||||
|
*/
|
||||||
|
public function create(User $user): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('create AsrsItemValidation');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can update the model.
|
||||||
|
*/
|
||||||
|
public function update(User $user, AsrsItemValidation $asrsitemvalidation): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('update AsrsItemValidation');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can delete the model.
|
||||||
|
*/
|
||||||
|
public function delete(User $user, AsrsItemValidation $asrsitemvalidation): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('delete AsrsItemValidation');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can delete any models.
|
||||||
|
*/
|
||||||
|
public function deleteAny(User $user): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('delete-any AsrsItemValidation');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can restore the model.
|
||||||
|
*/
|
||||||
|
public function restore(User $user, AsrsItemValidation $asrsitemvalidation): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('restore AsrsItemValidation');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can restore any models.
|
||||||
|
*/
|
||||||
|
public function restoreAny(User $user): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('restore-any AsrsItemValidation');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can replicate the model.
|
||||||
|
*/
|
||||||
|
public function replicate(User $user, AsrsItemValidation $asrsitemvalidation): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('replicate AsrsItemValidation');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can reorder the models.
|
||||||
|
*/
|
||||||
|
public function reorder(User $user): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('reorder AsrsItemValidation');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can permanently delete the model.
|
||||||
|
*/
|
||||||
|
public function forceDelete(User $user, AsrsItemValidation $asrsitemvalidation): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('force-delete AsrsItemValidation');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determine whether the user can permanently delete any models.
|
||||||
|
*/
|
||||||
|
public function forceDeleteAny(User $user): bool
|
||||||
|
{
|
||||||
|
return $user->checkPermissionTo('force-delete-any AsrsItemValidation');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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) {
|
||||||
|
// //
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<?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
|
||||||
|
{
|
||||||
|
$sql1 = <<<'SQL'
|
||||||
|
ALTER TABLE product_characteristics_masters
|
||||||
|
ADD COLUMN category TEXT DEFAULT NULL
|
||||||
|
SQL;
|
||||||
|
|
||||||
|
DB::statement($sql1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
// Schema::table('product_characteristics_masters', function (Blueprint $table) {
|
||||||
|
// //
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<?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
|
||||||
|
{
|
||||||
|
$sql1 = <<<'SQL'
|
||||||
|
ALTER TABLE vehicle_entries
|
||||||
|
ADD COLUMN boom_opened TEXT DEFAULT NULL
|
||||||
|
SQL;
|
||||||
|
|
||||||
|
DB::statement($sql1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
// Schema::table('vehicle_entries', function (Blueprint $table) {
|
||||||
|
// //
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
<?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
|
||||||
|
{
|
||||||
|
$sql = <<<'SQL'
|
||||||
|
CREATE TABLE asrs_item_validations (
|
||||||
|
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
|
||||||
|
|
||||||
|
plant_id BIGINT NOT NULL,
|
||||||
|
item_code TEXT DEFAULT NULL,
|
||||||
|
item_description TEXT DEFAULT NULL,
|
||||||
|
uom TEXT DEFAULT NULL,
|
||||||
|
mhe TEXT DEFAULT NULL,
|
||||||
|
bin_quantity TEXT DEFAULT NULL,
|
||||||
|
asrs TEXT DEFAULT NULL,
|
||||||
|
asrs_category TEXT DEFAULT NULL,
|
||||||
|
status TEXT DEFAULT NULL,
|
||||||
|
|
||||||
|
created_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||||
|
updated_at TIMESTAMP NOT NULL DEFAULT NOW(),
|
||||||
|
created_by TEXT DEFAULT NULL,
|
||||||
|
updated_by TEXT DEFAULT NULL,
|
||||||
|
deleted_at TIMESTAMP,
|
||||||
|
|
||||||
|
FOREIGN KEY (plant_id) REFERENCES plants (id)
|
||||||
|
);
|
||||||
|
SQL;
|
||||||
|
DB::statement($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('asrs_item_validations');
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
<?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
|
||||||
|
{
|
||||||
|
$sql1 = <<<'SQL'
|
||||||
|
ALTER TABLE asrs_item_validations
|
||||||
|
ADD COLUMN material_type TEXT DEFAULT NULL
|
||||||
|
SQL;
|
||||||
|
|
||||||
|
DB::statement($sql1);
|
||||||
|
|
||||||
|
$sql2 = <<<'SQL'
|
||||||
|
ALTER TABLE asrs_item_validations
|
||||||
|
ADD COLUMN material_group TEXT DEFAULT NULL
|
||||||
|
SQL;
|
||||||
|
|
||||||
|
DB::statement($sql2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*/
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
// Schema::table('asrs_item_validations', function (Blueprint $table) {
|
||||||
|
// //
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -21,7 +21,7 @@ class AdminSeeder extends Seeder
|
|||||||
// Data to update/create
|
// Data to update/create
|
||||||
[
|
[
|
||||||
'name' => 'Admin',
|
'name' => 'Admin',
|
||||||
'password' => Hash::make('jOtHi#9000'),
|
'password' => Hash::make('jOtHi$9000'),
|
||||||
'updated_at' => now(),
|
'updated_at' => now(),
|
||||||
'created_at' => now(),
|
'created_at' => now(),
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -210,7 +210,24 @@ 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']);
|
||||||
|
|
||||||
|
Permission::updateOrCreate(['name' => 'view import asrs item validation']);
|
||||||
|
Permission::updateOrCreate(['name' => 'view export asrs item validation']);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
|
||||||
|
<div class="flex flex-row gap-2 items-center flex-wrap">
|
||||||
|
@can('view save production order button')
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
wire:click="saveProductionOrder"
|
||||||
|
class="px-2 py-1 border border-primary-500 text-primary-600 rounded hover:bg-primary-50 hover:border-primary-700 transition text-sm"
|
||||||
|
>
|
||||||
|
Save
|
||||||
|
</button>
|
||||||
|
@endcan
|
||||||
|
@can('view print production order button')
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
wire:click="printProductionOrder"
|
||||||
|
class="px-2 py-1 border border-primary-500 text-primary-600 rounded hover:bg-primary-50 hover:border-primary-700 transition text-sm"
|
||||||
|
>
|
||||||
|
Print
|
||||||
|
</button>
|
||||||
|
@endcan
|
||||||
|
@can('view print panel production order button')
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
wire:click="printPanel"
|
||||||
|
class="px-2 py-1 border border-primary-500 text-primary-600 rounded hover:bg-primary-50 hover:border-primary-700 transition text-sm"
|
||||||
|
>
|
||||||
|
Print Panel
|
||||||
|
</button>
|
||||||
|
@endcan
|
||||||
|
@can('view print item serial production order button')
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
wire:click="printItemSerial"
|
||||||
|
class="px-2 py-1 border border-primary-500 text-primary-600 rounded hover:bg-primary-50 hover:border-primary-700 transition text-sm"
|
||||||
|
>
|
||||||
|
Print Item
|
||||||
|
</button>
|
||||||
|
@endcan
|
||||||
|
</div>
|
||||||
|
|
||||||
@@ -243,7 +243,7 @@
|
|||||||
<td class="border px-4 py-2">{{ $row['code'] ?? 'N/A' }}</td>
|
<td class="border px-4 py-2">{{ $row['code'] ?? 'N/A' }}</td>
|
||||||
<td class="border px-4 py-2">{{ $row['material_type'] ?? 'N/A' }}</td>
|
<td class="border px-4 py-2">{{ $row['material_type'] ?? 'N/A' }}</td>
|
||||||
<td class="border px-4 py-2">
|
<td class="border px-4 py-2">
|
||||||
@if(($row['material_type'] ?? '') === 'Individual' || ($row['material_type'] ?? '') === 'Bundle')
|
@if(($row['material_type'] ?? '') == 'Individual' || ($row['material_type'] ?? '') == 'Bundle' || ($row['material_type'] ?? '') == 'Bundle Individual')
|
||||||
{{ number_format((float)($row['quantity'] ?? 0), 0) }}
|
{{ number_format((float)($row['quantity'] ?? 0), 0) }}
|
||||||
@else
|
@else
|
||||||
{{ $row['quantity'] ?? 'N/A' }}
|
{{ $row['quantity'] ?? 'N/A' }}
|
||||||
|
|||||||
@@ -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>
|
||||||
|
|||||||
94
resources/views/mail/vehicle_entry_report.blade.php
Normal file
94
resources/views/mail/vehicle_entry_report.blade.php
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<title>Vehicle Entry Report</title>
|
||||||
|
<style>
|
||||||
|
body {
|
||||||
|
font-family: 'Segoe UI', Arial, sans-serif;
|
||||||
|
background-color: #f9fafb;
|
||||||
|
color: #333;
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
h2 {
|
||||||
|
color: #215c98;
|
||||||
|
text-align: center;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
table {
|
||||||
|
border-collapse: collapse;
|
||||||
|
width: 100%;
|
||||||
|
font-size: 14px;
|
||||||
|
white-space: nowrap !important;
|
||||||
|
}
|
||||||
|
th, td {
|
||||||
|
border: 1px solid #020813da;
|
||||||
|
padding: 8px 10px;
|
||||||
|
text-align: center;
|
||||||
|
white-space: nowrap !important;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
}
|
||||||
|
.td-left {
|
||||||
|
text-align: left !important;
|
||||||
|
}
|
||||||
|
th {
|
||||||
|
background-color: #215c98;
|
||||||
|
color: #fff;
|
||||||
|
white-space: nowrap !important;
|
||||||
|
}
|
||||||
|
tr:nth-child(even) {
|
||||||
|
background-color: #f3f4f6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer {
|
||||||
|
text-align: center;
|
||||||
|
font-size: 13px;
|
||||||
|
color: #6b7280;
|
||||||
|
margin-top: 30px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div style="text-align: center; font-weight: bold;">
|
||||||
|
{{ $company }}
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<p>{!! $greeting !!}</p>
|
||||||
|
<div class="container">
|
||||||
|
@if(empty($tableData))
|
||||||
|
<p style="text-align:center;">No vehicle entry data available.</p>
|
||||||
|
@else
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>No</th>
|
||||||
|
<th>Plant Name</th>
|
||||||
|
<th>Vehicle Number</th>
|
||||||
|
<th>Boom Opened</th>
|
||||||
|
<th>Entry Time</th>
|
||||||
|
<th>Exit Time</th>
|
||||||
|
<th>Duration</th>
|
||||||
|
<th>Type</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
@foreach ($tableData as $row)
|
||||||
|
<tr>
|
||||||
|
<td>{{ $loop->iteration }}</td>
|
||||||
|
<td>{{ $row['plant'] }}</td>
|
||||||
|
<td>{{ $row['vehicleNumber'] }}</td>
|
||||||
|
<td>{{ $row['boom'] }}</td>
|
||||||
|
<td>{{ $row['entryTime'] }}</td>
|
||||||
|
<td>{{ $row['exitTime'] }}</td>
|
||||||
|
<td>{{ $row['duration'] }}</td>
|
||||||
|
<td>{{ $row['type'] }}</td>
|
||||||
|
</tr>
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
@endif
|
||||||
|
<p>{!! $wishes !!}</p>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
119
resources/views/production-orders/printItemSerial.blade.php
Normal file
119
resources/views/production-orders/printItemSerial.blade.php
Normal file
@@ -0,0 +1,119 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<style>
|
||||||
|
@page {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
/* font-family: "Arial Narrow", "DejaVu Sans", sans-serif; */
|
||||||
|
}
|
||||||
|
|
||||||
|
.sticker {
|
||||||
|
width: 170pt;
|
||||||
|
height: 40pt;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sticker:last-child {
|
||||||
|
page-break-after: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
table {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
}
|
||||||
|
|
||||||
|
td {
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
vertical-align: top;
|
||||||
|
}
|
||||||
|
|
||||||
|
.qr {
|
||||||
|
width: 35pt;
|
||||||
|
height: 35pt;
|
||||||
|
padding-top: 3pt;
|
||||||
|
padding-left: 4pt;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* .text {
|
||||||
|
padding-left: 5pt;
|
||||||
|
} */
|
||||||
|
|
||||||
|
.text {
|
||||||
|
position: relative;
|
||||||
|
padding-left: 5pt;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* .serial {
|
||||||
|
font-size: 10pt;
|
||||||
|
font-weight: bold;
|
||||||
|
margin-top: 6pt;
|
||||||
|
} */
|
||||||
|
|
||||||
|
.serial {
|
||||||
|
font-size: 8pt;
|
||||||
|
font-weight: bold;
|
||||||
|
position: relative;
|
||||||
|
top: 8pt;
|
||||||
|
right: 6pt;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* .po {
|
||||||
|
font-size: 8pt;
|
||||||
|
margin-bottom: 6pt;
|
||||||
|
margin-left: 75pt;
|
||||||
|
} */
|
||||||
|
|
||||||
|
.po {
|
||||||
|
font-size: 8pt;
|
||||||
|
font-weight: bold;
|
||||||
|
text-align: left !important;
|
||||||
|
position: absolute;
|
||||||
|
right: 5pt;
|
||||||
|
top: 8pt;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* .desc {
|
||||||
|
font-size: 6pt;
|
||||||
|
margin-left: -5pt;
|
||||||
|
font-weight: bold;
|
||||||
|
padding-top: 10pt;
|
||||||
|
} */
|
||||||
|
.desc {
|
||||||
|
font-family: "Arial Narrow";
|
||||||
|
font-size: 7pt;
|
||||||
|
font-weight: bold;
|
||||||
|
letter-spacing: -0.3px;
|
||||||
|
white-space: nowrap;
|
||||||
|
padding-top: 15pt;
|
||||||
|
margin-left: -5pt;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
@foreach($stickers as $sticker)
|
||||||
|
<div class="sticker">
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<td style="width:40pt;">
|
||||||
|
<img class="qr" src="{{ $sticker['qr'] }}">
|
||||||
|
</td>
|
||||||
|
<td class="text">
|
||||||
|
<div class="serial">{{ $sticker['serial'] }}</div>
|
||||||
|
<div class="po">{{ $sticker['production_order'] }}</div>
|
||||||
|
<div class="desc">{{ $sticker['description'] }}</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
@endforeach
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -1,100 +1,74 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<style>
|
<style>
|
||||||
@page {
|
@page {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body{
|
||||||
margin: 0;
|
margin:0;
|
||||||
padding: 0;
|
padding:0;
|
||||||
/* font-family: "Arial Narrow", "DejaVu Sans", sans-serif; */
|
}
|
||||||
}
|
|
||||||
|
|
||||||
.sticker {
|
.sticker{
|
||||||
width: 113.39pt;
|
width:40mm;
|
||||||
height: 113.39pt;
|
height:40mm;
|
||||||
overflow: hidden;
|
overflow:hidden;
|
||||||
}
|
position:relative;
|
||||||
|
box-sizing:border-box;
|
||||||
|
}
|
||||||
|
|
||||||
.sticker:last-child {
|
.qr{
|
||||||
page-break-after: auto;
|
width:29mm;
|
||||||
}
|
height:29mm;
|
||||||
|
position:absolute;
|
||||||
|
top:-1mm;
|
||||||
|
left:5.8mm;
|
||||||
|
}
|
||||||
|
|
||||||
table {
|
.serial{
|
||||||
width: 100%;
|
position:absolute;
|
||||||
border-collapse: collapse;
|
top:27mm; /* 3 + 22 + 1mm spacing */
|
||||||
}
|
width:100%;
|
||||||
|
text-align:center;
|
||||||
td {
|
/* font-family:Arial, sans-serif; */
|
||||||
padding: 0;
|
font-family: "Arial Narrow", "Roboto Condensed", sans-serif;
|
||||||
margin: 0;
|
font-weight:bold;
|
||||||
vertical-align: top;
|
font-size:3mm;
|
||||||
}
|
letter-spacing:-0.2mm;
|
||||||
|
transform: scaleX(0.85);
|
||||||
.qr {
|
transform-origin:center;
|
||||||
width: 90pt;
|
}
|
||||||
height: 90pt;
|
.desc{
|
||||||
padding-top: 2pt;
|
position:absolute;
|
||||||
/* padding-left: 12pt; */
|
top:31mm;
|
||||||
}
|
width:100%;
|
||||||
|
text-align:center;
|
||||||
.text {
|
font-family:Arial, sans-serif;
|
||||||
position: relative;
|
font-weight:bold;
|
||||||
/* padding-left: 5pt; */
|
font-size:4mm;
|
||||||
}
|
white-space:nowrap;
|
||||||
|
}
|
||||||
.serial {
|
</style>
|
||||||
font-size: 7pt;
|
|
||||||
font-weight: bold;
|
|
||||||
position: relative;
|
|
||||||
/* top: 30pt; */
|
|
||||||
top: -5pt;
|
|
||||||
/* padding-left: 1pt; */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* .po {
|
|
||||||
font-size: 8pt;
|
|
||||||
font-weight: bold;
|
|
||||||
text-align: left !important;
|
|
||||||
position: absolute;
|
|
||||||
right: 5pt;
|
|
||||||
top: 8pt;
|
|
||||||
} */
|
|
||||||
|
|
||||||
.desc {
|
|
||||||
font-family: "Arial Narrow";
|
|
||||||
font-size: 6pt;
|
|
||||||
font-weight: bold;
|
|
||||||
white-space: nowrap;
|
|
||||||
/* padding-top: 42pt; */
|
|
||||||
left: -38pt;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
@foreach($stickers as $sticker)
|
@foreach($stickers as $sticker)
|
||||||
<div class="sticker">
|
<div class="sticker">
|
||||||
<table>
|
|
||||||
<tr>
|
<img class="qr" src="{{ $sticker['qr'] }}">
|
||||||
<td align="center">
|
|
||||||
<img class="qr" src="{{ $sticker['qr'] }}">
|
<div class="serial">
|
||||||
</td>
|
{{ $sticker['serial'] }}
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="text" align="center">
|
|
||||||
<div class="serial">{{ $sticker['serial'] }}</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td class="text" align="center">
|
|
||||||
<div class="desc">{{ $sticker['description'] }}</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="desc">
|
||||||
|
{{ $sticker['description'] }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
@endforeach
|
@endforeach
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -61,6 +61,10 @@ Route::get('production-orders/{production_order}/{plant_code}/printpanel',
|
|||||||
[ProductionOrderController::class, 'printpanel']
|
[ProductionOrderController::class, 'printpanel']
|
||||||
)->name('production-orders.printpanel');
|
)->name('production-orders.printpanel');
|
||||||
|
|
||||||
|
Route::get('production-orders/{production_order}/{plant_code}/printItemSerial',
|
||||||
|
[ProductionOrderController::class, 'printItemSerial']
|
||||||
|
)->name('production-orders.printItemSerial');
|
||||||
|
|
||||||
// Route::get('/characteristic/approve', [CharacteristicApprovalController::class, 'approve'])
|
// Route::get('/characteristic/approve', [CharacteristicApprovalController::class, 'approve'])
|
||||||
// ->name('characteristic.approve')
|
// ->name('characteristic.approve')
|
||||||
// ->middleware('signed');
|
// ->middleware('signed');
|
||||||
|
|||||||
Reference in New Issue
Block a user