10 Commits

Author SHA1 Message Date
8e1c4f46e8 Merge pull request 'Added characteristic value model file' (#87) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Reviewed-on: #87
2025-12-09 07:58:17 +00:00
dhanabalan
35d9419198 Added characteristic value model file
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / review (pull_request) Failing after 35s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 11s
Laravel Pint / pint (pull_request) Successful in 4m12s
Laravel Larastan / larastan (pull_request) Failing after 5m7s
2025-12-09 13:27:56 +05:30
d699c043d4 Merge pull request 'Added characteristics values migration file' (#86) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Reviewed-on: #86
2025-12-09 07:57:20 +00:00
dhanabalan
63d18fd785 Added characteristics values migration file
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 10s
Gemini PR Review / review (pull_request) Failing after 26s
Laravel Pint / pint (pull_request) Successful in 2m11s
Laravel Larastan / larastan (pull_request) Failing after 3m9s
2025-12-09 13:26:57 +05:30
1806f32a7b Merge pull request 'removed unwanted serial validation mail logic in invoice validation' (#85) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 15s
Reviewed-on: #85
2025-12-09 05:21:01 +00:00
dhanabalan
84b6c45706 removed unwanted serial validation mail logic in invoice validation
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 10s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 10s
Gemini PR Review / review (pull_request) Failing after 34s
Laravel Pint / pint (pull_request) Successful in 2m21s
Laravel Larastan / larastan (pull_request) Failing after 3m22s
2025-12-09 10:50:40 +05:30
eb2ae19641 Merge pull request 'changed mail subject for quality validation' (#84) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 14s
Reviewed-on: #84
2025-12-09 03:11:37 +00:00
dhanabalan
84799678eb changed mail subject for quality validation
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 13s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 12s
Gemini PR Review / review (pull_request) Failing after 36s
Laravel Pint / pint (pull_request) Successful in 1m50s
Laravel Larastan / larastan (pull_request) Failing after 2m57s
2025-12-09 08:40:48 +05:30
2dbcc8b859 Merge pull request 'Added livewire changes in invoice validation' (#83) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 14s
Reviewed-on: #83
2025-12-07 08:33:05 +00:00
dhanabalan
db6af9863f Added livewire changes in invoice validation
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 1m2s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 42s
Gemini PR Review / review (pull_request) Failing after 1m45s
Laravel Pint / pint (pull_request) Successful in 1m52s
Laravel Larastan / larastan (pull_request) Failing after 3m1s
2025-12-07 14:02:34 +05:30
6 changed files with 198 additions and 121 deletions

View File

@@ -136,23 +136,23 @@ class InvoiceValidationResource extends Resource
->reactive() ->reactive()
->readOnly(fn (callable $get) => empty($get('invoice_number'))) ->readOnly(fn (callable $get) => empty($get('invoice_number')))
->disabled(fn (Get $get) => empty($get('invoice_number'))) ->disabled(fn (Get $get) => empty($get('invoice_number')))
->extraAttributes([
'id' => 'serial_number_input',
'x-data' => '{ value: "" }',
'x-model' => 'value',
'wire:keydown.enter.prevent' => 'processSerial(value)', // Using wire:keydown
])
// ->dehydrated(false) // Do not trigger Livewire syncing
// ->extraAttributes([ // ->extraAttributes([
// 'id' => 'serial_number_input', // 'id' => 'serial_number_input',
// 'x-on:keydown.enter.prevent' => " // 'x-data' => '{ value: "" }',
// let serial = \$event.target.value; // 'x-model' => 'value',
// if (serial.trim() != '') { // 'wire:keydown.enter.prevent' => 'processSerial(value)', // Using wire:keydown
// \$wire.dispatch('process-scan', serial);
// \$event.target.value = '';
// }
// ",
// ]) // ])
->dehydrated(false) // Do not trigger Livewire syncing
->extraAttributes([
'id' => 'serial_number_input',
'x-on:keydown.enter.prevent' => "
let serial = \$event.target.value;
if (serial.trim() != '') {
\$wire.dispatch('process-scan', serial);
\$event.target.value = '';
}
",
])
->afterStateUpdated(function ($state, callable $set, callable $get, callable $livewire) { ->afterStateUpdated(function ($state, callable $set, callable $get, callable $livewire) {
$set('update_invoice', 0); $set('update_invoice', 0);
// $this->dispatch('focus-serial-number'); // $this->dispatch('focus-serial-number');

View File

@@ -2261,7 +2261,7 @@ class CreateInvoiceValidation extends CreateRecord
]; ];
} }
public function processSerial($serNo) public function processSer($serNo)
{ {
$serNo = trim($serNo); $serNo = trim($serNo);
$mSerNo = $serNo; $mSerNo = $serNo;
@@ -3171,9 +3171,11 @@ class CreateInvoiceValidation extends CreateRecord
$mPlantName = $mailData['plant_name']; $mPlantName = $mailData['plant_name'];
$emails = $mailData['emails']; $emails = $mailData['emails'];
$mUserName = Filament::auth()->user()->name;
if (! empty($emails)) { if (! empty($emails)) {
Mail::to($emails)->send( Mail::to($emails)->send(
new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'NotFoundInvoice') new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode,$mUserName,'NotFoundInvoice')
); );
} else { } else {
\Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial."); \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
@@ -3379,18 +3381,18 @@ class CreateInvoiceValidation extends CreateRecord
->send(); ->send();
$this->dispatch('playNotificationSound'); $this->dispatch('playNotificationSound');
$mInvoiceType = 'Serial'; // $mInvoiceType = 'Serial';
$mailData = $this->getMail(); // $mailData = $this->getMail();
$mPlantName = $mailData['plant_name']; // $mPlantName = $mailData['plant_name'];
$emails = $mailData['emails']; // $emails = $mailData['emails'];
if (! empty($emails)) { // if (! empty($emails)) {
Mail::to($emails)->send( // Mail::to($emails)->send(
new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'CompletedSerialInvoice') // new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'CompletedSerialInvoice')
); // );
} else { // } else {
\Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial."); // \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
} // }
$filename = $invoiceNumber.'.xlsx'; $filename = $invoiceNumber.'.xlsx';
$directory = 'uploads/temp'; $directory = 'uploads/temp';
@@ -3509,19 +3511,19 @@ class CreateInvoiceValidation extends CreateRecord
$this->dispatch('playNotificationSound'); $this->dispatch('playNotificationSound');
$mInvoiceType = 'Serial'; // $mInvoiceType = 'Serial';
$mailData = $this->getMail(); // $mailData = $this->getMail();
$mPlantName = $mailData['plant_name']; // $mPlantName = $mailData['plant_name'];
$emails = $mailData['emails']; // $emails = $mailData['emails'];
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(
new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'CSerialInvoice') // new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'CSerialInvoice')
); // );
} else { // } else {
\Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial."); // \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
} // }
$filename = $invoiceNumber.'.xlsx'; $filename = $invoiceNumber.'.xlsx';
$directory = 'uploads/temp'; $directory = 'uploads/temp';
@@ -3582,19 +3584,21 @@ class CreateInvoiceValidation extends CreateRecord
$this->dispatch('playWarnSound'); $this->dispatch('playWarnSound');
$mInvoiceType = 'Serial'; // $mInvoiceType = 'Serial';
$mailData = $this->getMail(); // $mailData = $this->getMail();
$mPlantName = $mailData['plant_name']; // $mPlantName = $mailData['plant_name'];
$emails = $mailData['emails']; // $emails = $mailData['emails'];
if (! empty($emails)) { // $mUserName = Filament::auth()->user()->name;
// Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
Mail::to($emails)->send( // if (! empty($emails)) {
new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'DuplicateCapacitorQR') // // Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
); // Mail::to($emails)->send(
} else { // new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, $mUserName, 'DuplicateCapacitorQR')
\Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial."); // );
} // } else {
// \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
// }
$this->form->fill([ $this->form->fill([
'plant_id' => $plantId, 'plant_id' => $plantId,
@@ -3719,19 +3723,19 @@ class CreateInvoiceValidation extends CreateRecord
$this->dispatch('playNotificationSound'); $this->dispatch('playNotificationSound');
$mInvoiceType = 'Serial'; // $mInvoiceType = 'Serial';
$mailData = $this->getMail(); // $mailData = $this->getMail();
$mPlantName = $mailData['plant_name']; // $mPlantName = $mailData['plant_name'];
$emails = $mailData['emails']; // $emails = $mailData['emails'];
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(
new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'ComSerInv') // new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType, $itemCode, 'ComSerInv')
); // );
} else { // } else {
\Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial."); // \Log::warning("No recipients found for plant {$plantId}, module Serial, rule invalid_serial.");
} // }
$filename = $invoiceNumber.'.xlsx'; $filename = $invoiceNumber.'.xlsx';
$directory = 'uploads/temp'; $directory = 'uploads/temp';
@@ -3765,11 +3769,11 @@ class CreateInvoiceValidation extends CreateRecord
} }
} }
// #[On('process-scan')] #[On('process-scan')]
// public function processSerial($serial) public function processSerial($serial)
// { {
// $this->processSer($serial); // Your duplicate check + mail logic $this->processSer($serial);
// } }
public function getHeading(): string public function getHeading(): string
{ {

View File

@@ -46,20 +46,20 @@ class InvalidQualityMail extends Mailable
// dynamic subject based on mail type // dynamic subject based on mail type
switch ($this->mailType) { switch ($this->mailType) {
case 'InvalidPartNumber2': case 'InvalidPartNumber2':
$this->subjectLine = "Invalid Part Number 2 Scanned ({$this->mplantName})"; $this->subjectLine = "Quality Part Validation ({$this->mplantName})";
break; break;
case 'InvalidPartNumber3': case 'InvalidPartNumber3':
$this->subjectLine = "Invalid Part Number 3 Scanned ({$this->mplantName})"; $this->subjectLine = "Quality Part Validation ({$this->mplantName})";
break; break;
case 'InvalidPartNumber4': case 'InvalidPartNumber4':
$this->subjectLine = "Invalid Part Number 4 Scanned ({$this->mplantName})"; $this->subjectLine = "Quality Part Validation ({$this->mplantName})";
break; break;
case 'InvalidPartNumber5': case 'InvalidPartNumber5':
$this->subjectLine = "Invalid Part Number 5 Scanned ({$this->mplantName})"; $this->subjectLine = "Quality Part Validation ({$this->mplantName})";
break; break;
case 'InvalidPartNumber': case 'InvalidPartNumber':
default: default:
$this->subjectLine = "Invalid Part Number 1 Scanned ({$this->mplantName})"; $this->subjectLine = "Quality Part Validation ({$this->mplantName})";
break; break;
} }

View File

@@ -82,12 +82,14 @@ class InvalidSerialMail extends Mailable
public $greeting; public $greeting;
public $subjectLine; public $subjectLine;
public $mUserName;
public $itemCode; public $itemCode;
/** /**
* Create a new message instance. * Create a new message instance.
*/ */
public function __construct($serial, $invoiceNumber, $mplantName, $mInvoiceType, $itemCode, $mailType = 'InvalidFormat') public function __construct($serial, $invoiceNumber, $mplantName, $mInvoiceType, $itemCode, $mUserName, $mailType = 'InvalidFormat')
{ {
$this->serial = $serial; $this->serial = $serial;
$this->invoiceNumber = $invoiceNumber; $this->invoiceNumber = $invoiceNumber;
@@ -95,6 +97,7 @@ class InvalidSerialMail extends Mailable
$this->mInvoiceType = $mInvoiceType; $this->mInvoiceType = $mInvoiceType;
$this->mailType = $mailType; $this->mailType = $mailType;
$this->itemCode = $itemCode; $this->itemCode = $itemCode;
$this->mUserName = $mUserName;
} }
/** /**
@@ -110,15 +113,18 @@ class InvalidSerialMail extends Mailable
case 'DuplicateCapacitorQR': case 'DuplicateCapacitorQR':
$this->subjectLine = "Invoice - Second Scanning({$this->mplantName})"; $this->subjectLine = "Invoice - Second Scanning({$this->mplantName})";
break; break;
case 'CompletedSerialInvoice': case 'InvalidPanelBox':
$this->subjectLine = "Invoice - Second Scanning({$this->mplantName})";
break;
case 'CSerialInvoice':
$this->subjectLine = "Invoice - Second Scanning({$this->mplantName})";
break;
case 'ComSerInv':
$this->subjectLine = "Invoice - Second Scanning({$this->mplantName})"; $this->subjectLine = "Invoice - Second Scanning({$this->mplantName})";
break; break;
// case 'CompletedSerialInvoice':
// $this->subjectLine = "Invoice - Second Scanning({$this->mplantName})";
// break;
// case 'CSerialInvoice':
// $this->subjectLine = "Invoice - Second Scanning({$this->mplantName})";
// break;
// case 'ComSerInv':
// $this->subjectLine = "Invoice - Second Scanning({$this->mplantName})";
// break;
} }
return new Envelope( return new Envelope(
@@ -141,48 +147,20 @@ class InvalidSerialMail extends Mailable
<b>Invoice Type:</b> {$this->mInvoiceType}<br> <b>Invoice Type:</b> {$this->mInvoiceType}<br>
<b>Invoice Number:</b> {$this->invoiceNumber}<br> <b>Invoice Number:</b> {$this->invoiceNumber}<br>
<b>Scanned QR Code:</b> {$this->serial}<br> <b>Scanned QR Code:</b> {$this->serial}<br>
<b>Employee Code:</b> {$this->mUserName}<br>
"; ";
break; break;
case 'DuplicateCapacitorQR': // case 'DuplicateCapacitorQR':
$this->greeting = " // $this->greeting = "
Dear Sir/Madam,<br><br> // Dear Sir/Madam,<br><br>
The scanned <b>Capacitor</b> serial number has already completed the scanning process.<br><br> // The scanned <b>Capacitor</b> serial number has already completed the scanning process.<br><br>
<b>Plant:</b> {$this->mplantName}<br> // <b>Plant:</b> {$this->mplantName}<br>
<b>Invoice Type:</b> {$this->mInvoiceType}<br> // <b>Invoice Type:</b> {$this->mInvoiceType}<br>
<b>Invoice Number:</b> {$this->invoiceNumber}<br> // <b>Invoice Number:</b> {$this->invoiceNumber}<br>
<b>Scanned QR Code:</b> {$this->serial}<br> // <b>Scanned QR Code:</b> {$this->serial}<br>
"; // <b>Employee Code:</b> {$this->mUserName}<br>
break; // ";
case 'CompletedSerialInvoice': // break;
$this->greeting = "
Dear Sir/Madam,<br><br>
Serial invoice <b>'{$this->invoiceNumber}'</b> completed the scanning process.<br>
<b>Plant:</b> {$this->mplantName}<br>
<b>Invoice Type:</b> {$this->mInvoiceType}<br>
<b>Invoice Number:</b> {$this->invoiceNumber}<br>
<b>Scanned QR Code:</b> {$this->serial}<br>
";
break;
case 'CSerialInvoice':
$this->greeting = "
Dear Sir/Madam,<br><br>
Serial invoice <b>'{$this->invoiceNumber}'</b> completed the scanning process.<br>
<b>Plant:</b> {$this->mplantName}<br>
<b>Invoice Type:</b> {$this->mInvoiceType}<br>
<b>Invoice Number:</b> {$this->invoiceNumber}<br>
<b>Scanned QR Code:</b> {$this->serial}<br>
";
break;
case 'ComSerInv':
$this->greeting = "
Dear Sir/Madam,<br><br>
Serial invoice <b>'{$this->invoiceNumber}'</b> completed the scanning process.<br>
<b>Plant:</b> {$this->mplantName}<br>
<b>Invoice Type:</b> {$this->mInvoiceType}<br>
<b>Invoice Number:</b> {$this->invoiceNumber}<br>
<b>Scanned QR Code:</b> {$this->serial}<br>
";
break;
} }
return new Content( return new Content(

View File

@@ -0,0 +1,47 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class CharacteristicValue extends Model
{
use SoftDeletes;
protected $fillable = [
'plant_id',
'line_id',
'item_id',
'machine_id',
'process_order',
'coil_number',
'status',
'created_at',
'updated_at',
'created_by',
'updated_by',
];
public function plant(): BelongsTo
{
return $this->belongsTo(Plant::class);
}
public function line(): BelongsTo
{
return $this->belongsTo(Line::class);
}
public function item(): BelongsTo
{
return $this->belongsTo(Item::class);
}
public function machine(): BelongsTo
{
return $this->belongsTo(Machine::class);
}
}

View File

@@ -0,0 +1,48 @@
<?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 characteristic_values (
id BIGINT GENERATED always AS IDENTITY PRIMARY KEY,
plant_id BIGINT NOT NULL,
line_id BIGINT NOT NULL,
item_id BIGINT NOT NULL,
machine_id BIGINT NOT NULL,
process_order TEXT DEFAULT NULL,
coil_number 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),
FOREIGN KEY (line_id) REFERENCES lines (id),
FOREIGN KEY (item_id) REFERENCES items (id),
FOREIGN KEY (machine_id) REFERENCES machines (id)
);
SQL;
DB::statement($sql);
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('characteristic_values');
}
};