Added line name and employee code for quality validation mail
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 10s
Gemini PR Review / review (pull_request) Failing after 24s
Laravel Pint / pint (pull_request) Successful in 2m25s
Laravel Larastan / larastan (pull_request) Failing after 3m6s
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 11s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 10s
Gemini PR Review / review (pull_request) Failing after 24s
Laravel Pint / pint (pull_request) Successful in 2m25s
Laravel Larastan / larastan (pull_request) Failing after 3m6s
This commit is contained in:
@@ -2250,9 +2250,15 @@ class QualityValidationResource extends Resource
|
||||
|
||||
$mPlantId = $get('plant_id');
|
||||
|
||||
$mlineId = $get('line_id');
|
||||
|
||||
$plant = Plant::find($mPlantId);
|
||||
$plantCodePart1 = $plant?->code;
|
||||
|
||||
$mLine = Line::find($mlineId);
|
||||
$mLinePart = $mLine?->name;
|
||||
|
||||
|
||||
$stickerMasterId = $get('sticker_master_id');
|
||||
if (!$stickerMasterId) {
|
||||
return;
|
||||
@@ -2284,12 +2290,13 @@ class QualityValidationResource extends Resource
|
||||
|
||||
$mPlantName = $mailData['plant_name'];
|
||||
$emails = $mailData['emails'];
|
||||
$mUserName = Filament::auth()->user()->name;
|
||||
|
||||
if (!empty($emails))
|
||||
{
|
||||
//Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
|
||||
Mail::to($emails)->send(
|
||||
new InvalidQualityMail($state, $mPorder, $mPlantName, 'InvalidPartNumber')
|
||||
new InvalidQualityMail($state, $mPorder, $mPlantName, $mLinePart, $mUserName, 'InvalidPartNumber')
|
||||
);
|
||||
}
|
||||
else
|
||||
@@ -2348,6 +2355,11 @@ class QualityValidationResource extends Resource
|
||||
$plant = Plant::find($mPlantId);
|
||||
$plantCodePart2 = $plant?->code;
|
||||
|
||||
$mlineId = $get('line_id');
|
||||
|
||||
$mLine = Line::find($mlineId);
|
||||
$mLinePart = $mLine?->name;
|
||||
|
||||
$stickerMasterId = $get('sticker_master_id');
|
||||
if (!$stickerMasterId) {
|
||||
return;
|
||||
@@ -2376,12 +2388,13 @@ class QualityValidationResource extends Resource
|
||||
|
||||
$mPlantName = $mailData['plant_name'];
|
||||
$emails = $mailData['emails'];
|
||||
$mUserName = Filament::auth()->user()->name;
|
||||
|
||||
if (!empty($emails))
|
||||
{
|
||||
//Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
|
||||
Mail::to($emails)->send(
|
||||
new InvalidQualityMail($state, $mPorder, $mPlantName, 'InvalidPartNumber2')
|
||||
new InvalidQualityMail($state, $mPorder, $mPlantName,$mLinePart, $mUserName, 'InvalidPartNumber2')
|
||||
);
|
||||
}
|
||||
else
|
||||
@@ -2441,6 +2454,12 @@ class QualityValidationResource extends Resource
|
||||
$plant = Plant::find($mPlantId);
|
||||
$plantCodePart3 = $plant?->code;
|
||||
|
||||
$mlineId = $get('line_id');
|
||||
|
||||
$mLine = Line::find($mlineId);
|
||||
$mLinePart = $mLine?->name;
|
||||
|
||||
|
||||
if (!$stickerMasterId) {
|
||||
return;
|
||||
}
|
||||
@@ -2469,12 +2488,13 @@ class QualityValidationResource extends Resource
|
||||
|
||||
$mPlantName = $mailData['plant_name'];
|
||||
$emails = $mailData['emails'];
|
||||
$mUserName = Filament::auth()->user()->name;
|
||||
|
||||
if (!empty($emails))
|
||||
{
|
||||
//Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
|
||||
Mail::to($emails)->send(
|
||||
new InvalidQualityMail($state, $mPorder, $mPlantName, 'InvalidPartNumber3')
|
||||
new InvalidQualityMail($state, $mPorder, $mPlantName,$mLinePart, $mUserName, 'InvalidPartNumber3')
|
||||
);
|
||||
}
|
||||
else
|
||||
@@ -2532,6 +2552,11 @@ class QualityValidationResource extends Resource
|
||||
$plant = Plant::find($mPlantId);
|
||||
$plantCodePart4 = $plant?->code;
|
||||
|
||||
$mlineId = $get('line_id');
|
||||
|
||||
$mLine = Line::find($mlineId);
|
||||
$mLinePart = $mLine?->name;
|
||||
|
||||
if (!$stickerMasterId) {
|
||||
return;
|
||||
}
|
||||
@@ -2560,12 +2585,13 @@ class QualityValidationResource extends Resource
|
||||
|
||||
$mPlantName = $mailData['plant_name'];
|
||||
$emails = $mailData['emails'];
|
||||
$mUserName = Filament::auth()->user()->name;
|
||||
|
||||
if (!empty($emails))
|
||||
{
|
||||
//Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
|
||||
Mail::to($emails)->send(
|
||||
new InvalidQualityMail($state, $mPorder, $mPlantName, 'InvalidPartNumber4')
|
||||
new InvalidQualityMail($state, $mPorder, $mPlantName,$mLinePart, $mUserName, 'InvalidPartNumber4')
|
||||
);
|
||||
}
|
||||
else
|
||||
@@ -2679,22 +2705,22 @@ class QualityValidationResource extends Resource
|
||||
else
|
||||
{
|
||||
$set('part_validation5_error', "Invalid input for part validation 5.");
|
||||
$mailData = \App\Filament\Resources\QualityValidationResource::getMailData($mPlantId);
|
||||
// $mailData = \App\Filament\Resources\QualityValidationResource::getMailData($mPlantId);
|
||||
|
||||
$mPlantName = $mailData['plant_name'];
|
||||
$emails = $mailData['emails'];
|
||||
// $mPlantName = $mailData['plant_name'];
|
||||
// $emails = $mailData['emails'];
|
||||
|
||||
if (!empty($emails))
|
||||
{
|
||||
//Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
|
||||
Mail::to($emails)->send(
|
||||
new InvalidQualityMail($state, $mPorder, $mPlantName, 'InvalidPartNumber5')
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
\Log::warning("No recipients found for plant {$mPlantName}, module Serial, rule invalid_serial.");
|
||||
}
|
||||
// if (!empty($emails))
|
||||
// {
|
||||
// //Mail::to($emails)->send(new InvalidSerialMail($serNo, $invoiceNumber, $mPlantName, $mInvoiceType));
|
||||
// Mail::to($emails)->send(
|
||||
// new InvalidQualityMail($state, $mPorder, $mPlantName, 'InvalidPartNumber5')
|
||||
// );
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// \Log::warning("No recipients found for plant {$mPlantName}, module Serial, rule invalid_serial.");
|
||||
// }
|
||||
$set('part_validation5', null);
|
||||
return;
|
||||
}
|
||||
@@ -2715,6 +2741,21 @@ class QualityValidationResource extends Resource
|
||||
public static function getMailData($plantId)
|
||||
{
|
||||
|
||||
$globalEmails = AlertMailRule::where('plant', 0)
|
||||
->where('module', 'QualityValidation')
|
||||
->where('rule_name', 'QualityMail')
|
||||
->where(fn ($q) => $q->whereNull('schedule_type')->orWhere('schedule_type', ''))
|
||||
->pluck('email')
|
||||
->toArray();
|
||||
|
||||
if (!empty($globalEmails)) {
|
||||
return [
|
||||
'plant_id' => 0,
|
||||
'plant_name' => 'All Plants',
|
||||
'emails' => $globalEmails,
|
||||
];
|
||||
}
|
||||
|
||||
$mPlantName = Plant::where('id', $plantId)->value('name');
|
||||
|
||||
$emails = AlertMailRule::where('plant', $plantId)
|
||||
|
||||
Reference in New Issue
Block a user