Compare commits
1 Commits
7543f8a416
...
dhana-dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d7d27a9dc0 |
4
.github/workflows/gemini-pr-review.yaml
vendored
4
.github/workflows/gemini-pr-review.yaml
vendored
@@ -36,8 +36,8 @@ jobs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ runner.os }}-npm-global-
|
${{ runner.os }}-npm-global-
|
||||||
|
|
||||||
# - name: Install Gemini CLI globally
|
- name: Install Gemini CLI globally
|
||||||
# run: npm install -g --loglevel=http @google/gemini-cli
|
run: npm install -g --loglevel=http @google/gemini-cli
|
||||||
|
|
||||||
- name: Generate git diff and review with Gemini
|
- name: Generate git diff and review with Gemini
|
||||||
id: review
|
id: review
|
||||||
|
|||||||
@@ -1,202 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Console\Commands;
|
|
||||||
|
|
||||||
use Illuminate\Console\Command;
|
|
||||||
use Illuminate\Console\Scheduling\Schedule;
|
|
||||||
use App\Models\AlertMailRule;
|
|
||||||
use Illuminate\Support\Facades\Artisan;
|
|
||||||
use Illuminate\Support\Facades\Log;
|
|
||||||
|
|
||||||
class Scheduler extends Command
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* The name and signature of the console command.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
// protected $signature = 'app:scheduler';
|
|
||||||
|
|
||||||
protected $signature = 'custom:scheduler';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The console command description.
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
// protected $description = 'Command description';
|
|
||||||
|
|
||||||
protected $description = 'Manually trigger scheduler logic';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Execute the console command.
|
|
||||||
*/
|
|
||||||
// public function handle()
|
|
||||||
// {
|
|
||||||
// //
|
|
||||||
// }
|
|
||||||
|
|
||||||
public function handle()
|
|
||||||
{
|
|
||||||
|
|
||||||
// --- Production Rules ---
|
|
||||||
$productionRules = AlertMailRule::where('module', 'ProductionQuantities')
|
|
||||||
->where('rule_name', 'ProductionMail')
|
|
||||||
->select('plant', 'schedule_type')
|
|
||||||
->distinct()
|
|
||||||
->get();
|
|
||||||
|
|
||||||
foreach ($productionRules as $rule) {
|
|
||||||
switch ($rule->schedule_type) {
|
|
||||||
case 'Live':
|
|
||||||
// Run every minute
|
|
||||||
\Artisan::call('send:production-report', [
|
|
||||||
'schedule_type' => $rule->schedule_type,
|
|
||||||
'plant' => $rule->plant,
|
|
||||||
]);
|
|
||||||
break;
|
|
||||||
case 'Hourly':
|
|
||||||
if (now()->minute == 0) {
|
|
||||||
\Artisan::call('send:production-report', [
|
|
||||||
'schedule_type' => $rule->schedule_type,
|
|
||||||
'plant' => $rule->plant,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'Daily':
|
|
||||||
if (now()->format('H:i') == '07:59') {
|
|
||||||
\Artisan::call('send:production-report', [
|
|
||||||
'schedule_type' => $rule->schedule_type,
|
|
||||||
'plant' => $rule->plant,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// --- Invoice Validation Rules ---
|
|
||||||
$invoiceRules = AlertMailRule::where('module', 'InvoiceValidation')
|
|
||||||
->where('rule_name', 'InvoiceMail')
|
|
||||||
->select('plant', 'schedule_type')
|
|
||||||
->distinct()
|
|
||||||
->get();
|
|
||||||
|
|
||||||
foreach ($invoiceRules 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') == '07:59') {
|
|
||||||
\Artisan::call('send:invoice-report', [
|
|
||||||
'schedule_type' => $rule->schedule_type,
|
|
||||||
'plant' => $rule->plant,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// foreach ($invoiceRules as $rule) {
|
|
||||||
|
|
||||||
// switch ($rule->schedule_type) {
|
|
||||||
// case 'Live':
|
|
||||||
// try {
|
|
||||||
// Artisan::call('send:invoice-report', [
|
|
||||||
// 'schedule_type' => $rule->schedule_type,
|
|
||||||
// 'plant' => $rule->plant,
|
|
||||||
// ]);
|
|
||||||
|
|
||||||
// Log::info('Invoice report sent | Plant: '.$rule->plant);
|
|
||||||
// } catch (\Throwable $e) {
|
|
||||||
// Log::error("Invoice Live Failed ({$rule->plant}): ".$e->getMessage());
|
|
||||||
// }
|
|
||||||
// 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') == '07:59') {
|
|
||||||
// Artisan::call('send:invoice-report', [
|
|
||||||
// 'schedule_type' => $rule->schedule_type,
|
|
||||||
// 'plant' => $rule->plant,
|
|
||||||
// ]);
|
|
||||||
// }
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// --- Invoice Data Report Rules ---
|
|
||||||
$invoiceDataRules = AlertMailRule::where('module', 'InvoiceDataReport')
|
|
||||||
->where('rule_name', 'InvoiceDataMail')
|
|
||||||
->select('plant', 'schedule_type')
|
|
||||||
->distinct()
|
|
||||||
->get();
|
|
||||||
|
|
||||||
foreach ($invoiceDataRules as $rule) {
|
|
||||||
|
|
||||||
switch ($rule->schedule_type) {
|
|
||||||
case 'Live':
|
|
||||||
// Run every minute
|
|
||||||
\Artisan::call('send:invoice-data-report', [
|
|
||||||
'schedule_type' => $rule->schedule_type,
|
|
||||||
'plant' => $rule->plant,
|
|
||||||
]);
|
|
||||||
break;
|
|
||||||
case 'Hourly':
|
|
||||||
if (now()->minute == 0) {
|
|
||||||
\Artisan::call('send:invoice-data-report', [
|
|
||||||
'schedule_type' => $rule->schedule_type,
|
|
||||||
'plant' => $rule->plant,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'Daily':
|
|
||||||
if (now()->format('H:i') == '10:00') {
|
|
||||||
\Artisan::call('send:invoice-data-report', [
|
|
||||||
'schedule_type' => $rule->schedule_type,
|
|
||||||
'plant' => $rule->plant,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Helper to call Artisan commands with parameters.
|
|
||||||
*/
|
|
||||||
protected function callArtisanCommand($commandName, $rule)
|
|
||||||
{
|
|
||||||
\Artisan::call($commandName, [
|
|
||||||
'schedule_type' => $rule->schedule_type,
|
|
||||||
'plant' => $rule->plant,
|
|
||||||
]);
|
|
||||||
|
|
||||||
$this->info("Executed {$commandName} for plant: {$rule->plant}");
|
|
||||||
\Log::info("Executed {$commandName} for plant: {$rule->plant}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
namespace App\Console\Commands;
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
use App\Mail\test;
|
|
||||||
use App\Models\InvoiceValidation;
|
use App\Models\InvoiceValidation;
|
||||||
use App\Models\Plant;
|
use App\Models\Plant;
|
||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
use Illuminate\Support\Facades\Mail;
|
use Illuminate\Support\Facades\Mail;
|
||||||
|
use App\Mail\test;
|
||||||
|
|
||||||
class SendInvoiceReport extends Command
|
class SendInvoiceReport extends Command
|
||||||
{
|
{
|
||||||
@@ -15,8 +15,9 @@ class SendInvoiceReport extends Command
|
|||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
// protected $signature = 'app:send-invoice-report';
|
// protected $signature = 'app:send-invoice-report';
|
||||||
protected $signature = 'send:invoice-report {schedule_type} {plant}';
|
protected $signature = 'send:invoice-report{schedule_type} {plant}';
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The console command description.
|
* The console command description.
|
||||||
@@ -28,10 +29,12 @@ class SendInvoiceReport extends Command
|
|||||||
/**
|
/**
|
||||||
* Execute the console command.
|
* Execute the console command.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
$schedule = $this->argument('schedule_type');
|
$schedule = $this->argument('schedule_type');
|
||||||
// $scheduleType = $this->argument('scheduleType');
|
//$scheduleType = $this->argument('scheduleType');
|
||||||
$plantIdArg = (int) $this->argument('plant'); // can be 0 for all plants
|
$plantIdArg = (int) $this->argument('plant'); // can be 0 for all plants
|
||||||
|
|
||||||
$mailRules = \App\Models\AlertMailRule::where('module', 'InvoiceValidation')->get()->groupBy('rule_name');
|
$mailRules = \App\Models\AlertMailRule::where('module', 'InvoiceValidation')->get()->groupBy('rule_name');
|
||||||
@@ -49,14 +52,18 @@ class SendInvoiceReport extends Command
|
|||||||
: [$plantIdArg];
|
: [$plantIdArg];
|
||||||
|
|
||||||
$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);
|
||||||
$endDate = now()->setTime(8, 0, 0);
|
$endDate = now()->setTime(8, 0, 0);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
$startDate = now()->setTime(8, 0, 0);
|
$startDate = now()->setTime(8, 0, 0);
|
||||||
$endDate = now()->copy()->addDay()->setTime(8, 0, 0);
|
$endDate = now()->copy()->addDay()->setTime(8, 0, 0);
|
||||||
}
|
}
|
||||||
foreach ($plantIds as $plantId) {
|
foreach ($plantIds as $plantId)
|
||||||
|
{
|
||||||
$plant = Plant::find($plantId);
|
$plant = Plant::find($plantId);
|
||||||
$plantName = $plant ? $plant->name : $plantId;
|
$plantName = $plant ? $plant->name : $plantId;
|
||||||
|
|
||||||
@@ -82,7 +89,7 @@ class SendInvoiceReport extends Command
|
|||||||
|
|
||||||
$scannedInvoiceQuan = InvoiceValidation::where('plant_id', $plantId)
|
$scannedInvoiceQuan = InvoiceValidation::where('plant_id', $plantId)
|
||||||
->where('scanned_status', 'Scanned')
|
->where('scanned_status', 'Scanned')
|
||||||
->where(function ($query) {
|
->where(function($query) {
|
||||||
$query->whereNull('quantity')
|
$query->whereNull('quantity')
|
||||||
->orWhere('quantity', 0);
|
->orWhere('quantity', 0);
|
||||||
})
|
})
|
||||||
@@ -121,7 +128,7 @@ class SendInvoiceReport extends Command
|
|||||||
$scannedMatInvoiceQuan = InvoiceValidation::where('plant_id', $plantId)
|
$scannedMatInvoiceQuan = InvoiceValidation::where('plant_id', $plantId)
|
||||||
->where('quantity', 1)
|
->where('quantity', 1)
|
||||||
->whereNotNull('serial_number')
|
->whereNotNull('serial_number')
|
||||||
->where('serial_number', '!=', '')
|
->where('serial_number','!=', '')
|
||||||
->whereBetween('updated_at', [$startDate, $endDate])
|
->whereBetween('updated_at', [$startDate, $endDate])
|
||||||
->count();
|
->count();
|
||||||
|
|
||||||
@@ -157,7 +164,7 @@ class SendInvoiceReport extends Command
|
|||||||
$scannedBundleInvoiceQuan = InvoiceValidation::where('plant_id', $plantId)
|
$scannedBundleInvoiceQuan = InvoiceValidation::where('plant_id', $plantId)
|
||||||
->where('quantity', '>', 1)
|
->where('quantity', '>', 1)
|
||||||
->whereNotNull('serial_number')
|
->whereNotNull('serial_number')
|
||||||
->where('serial_number', '!=', '')
|
->where('serial_number','!=', '')
|
||||||
->whereBetween('updated_at', [$startDate, $endDate])
|
->whereBetween('updated_at', [$startDate, $endDate])
|
||||||
->count();
|
->count();
|
||||||
|
|
||||||
@@ -186,6 +193,7 @@ class SendInvoiceReport extends Command
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Send to MaterialInvoiceMail recipients (material + bundle table)
|
// Send to MaterialInvoiceMail recipients (material + bundle table)
|
||||||
if ($mailRules->has('MaterialInvoiceMail')) {
|
if ($mailRules->has('MaterialInvoiceMail')) {
|
||||||
$emails = $mailRules['MaterialInvoiceMail']->pluck('email')->unique()->toArray();
|
$emails = $mailRules['MaterialInvoiceMail']->pluck('email')->unique()->toArray();
|
||||||
@@ -204,14 +212,16 @@ class SendInvoiceReport extends Command
|
|||||||
|
|
||||||
// Show preview in console
|
// Show preview in console
|
||||||
$this->info('--- Serial Invoice Table ---');
|
$this->info('--- Serial Invoice Table ---');
|
||||||
$this->table(['#', 'Plant', 'Total Invoice', 'Scanned Invoice', 'TotalInvoice Quantity', 'ScannedInvoice Quantity'], $serialTableData);
|
$this->table(['#', 'Plant', 'Total Invoice', 'Scanned Invoice','TotalInvoice Quantity', 'ScannedInvoice Quantity'], $serialTableData);
|
||||||
|
|
||||||
$this->info('--- Material Invoice Table ---');
|
$this->info('--- Material Invoice Table ---');
|
||||||
$this->table(['#', 'Plant', 'Total Invoice', 'Scanned Invoice', 'TotalInvoice Quantity', 'ScannedInvoice Quantity'], $materialTableData);
|
$this->table(['#', 'Plant', 'Total Invoice', 'Scanned Invoice','TotalInvoice Quantity', 'ScannedInvoice Quantity'], $materialTableData);
|
||||||
|
|
||||||
$this->info('--- Bundle Invoice Table ---');
|
$this->info('--- Bundle Invoice Table ---');
|
||||||
$this->table(['#', 'Plant', 'Total Invoice', 'Scanned Invoice', 'TotalInvoice Quantity', 'ScannedInvoice Quantity'], $bundleTableData);
|
$this->table(['#', 'Plant', 'Total Invoice', 'Scanned Invoice','TotalInvoice Quantity', 'ScannedInvoice Quantity'], $bundleTableData);
|
||||||
|
|
||||||
$this->info($contentVars['wishes'] ?? '');
|
$this->info($contentVars['wishes'] ?? '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ class AlertMailRuleResource extends Resource
|
|||||||
->label('CC Emails'),
|
->label('CC Emails'),
|
||||||
Forms\Components\Select::make('schedule_type')
|
Forms\Components\Select::make('schedule_type')
|
||||||
->label('Schedule Type')
|
->label('Schedule Type')
|
||||||
|
->required()
|
||||||
->options([
|
->options([
|
||||||
'Live' => 'Live',
|
'Live' => 'Live',
|
||||||
'Hourly' => 'Hourly',
|
'Hourly' => 'Hourly',
|
||||||
|
|||||||
@@ -24,12 +24,6 @@ use Illuminate\Database\Eloquent\SoftDeletingScope;
|
|||||||
use Livewire\Features\SupportFileUploads\TemporaryUploadedFile;
|
use Livewire\Features\SupportFileUploads\TemporaryUploadedFile;
|
||||||
use Smalot\PdfParser\Parser;
|
use Smalot\PdfParser\Parser;
|
||||||
use Storage;
|
use Storage;
|
||||||
use Filament\Forms\Components\DateTimePicker;
|
|
||||||
use Filament\Tables\Filters\Filter;
|
|
||||||
use Filament\Forms\Components\Select;
|
|
||||||
use App\Models\Line;
|
|
||||||
use Filament\Forms\Components\TextInput;
|
|
||||||
use App\Models\Item;
|
|
||||||
|
|
||||||
class ProcessOrderResource extends Resource
|
class ProcessOrderResource extends Resource
|
||||||
{
|
{
|
||||||
@@ -115,6 +109,7 @@ class ProcessOrderResource extends Resource
|
|||||||
->afterStateHydrated(function ($component, $state, Get $get, Set $set) {
|
->afterStateHydrated(function ($component, $state, Get $get, Set $set) {
|
||||||
$itemId = $get('item_id');
|
$itemId = $get('item_id');
|
||||||
if ($get('id')) {
|
if ($get('id')) {
|
||||||
|
|
||||||
$item = \App\Models\Item::where('id', $itemId)->first()?->description;
|
$item = \App\Models\Item::where('id', $itemId)->first()?->description;
|
||||||
if ($item) {
|
if ($item) {
|
||||||
$set('item_description', $item);
|
$set('item_description', $item);
|
||||||
@@ -144,34 +139,6 @@ class ProcessOrderResource extends Resource
|
|||||||
$set('sfgNumberError', null);
|
$set('sfgNumberError', null);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
->rule(function (callable $get) {
|
|
||||||
return function (string $attribute, $value, \Closure $fail) use ($get) {
|
|
||||||
|
|
||||||
$plantId = $get('plant_id');
|
|
||||||
$itemId = $get('item_id');
|
|
||||||
$processOrder = $value;
|
|
||||||
//$currentId = $get('id'); // current editing record id
|
|
||||||
|
|
||||||
if (! $plantId || ! $processOrder) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$existing = ProcessOrder::where('plant_id', $plantId)
|
|
||||||
->where('process_order', $processOrder)
|
|
||||||
->where('item_id', '!=', $itemId)
|
|
||||||
->first();
|
|
||||||
|
|
||||||
if ($existing) {
|
|
||||||
|
|
||||||
Notification::make()
|
|
||||||
->title('Duplicate Process Order!')
|
|
||||||
->body("Process Order '{$value}' is already exist with item code '{$existing->item->code}'.")
|
|
||||||
->danger()
|
|
||||||
->send();
|
|
||||||
$fail("process order already exists for this plant and item code '{$existing->item->code}'.");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
})
|
|
||||||
->required(),
|
->required(),
|
||||||
Forms\Components\TextInput::make('coil_number')
|
Forms\Components\TextInput::make('coil_number')
|
||||||
->label('Coil Number')
|
->label('Coil Number')
|
||||||
@@ -525,131 +492,9 @@ class ProcessOrderResource extends Resource
|
|||||||
->sortable()
|
->sortable()
|
||||||
->toggleable(isToggledHiddenByDefault: true),
|
->toggleable(isToggledHiddenByDefault: true),
|
||||||
])
|
])
|
||||||
// ->filters([
|
->filters([
|
||||||
// Tables\Filters\TrashedFilter::make(),
|
Tables\Filters\TrashedFilter::make(),
|
||||||
// ])
|
|
||||||
->filters([
|
|
||||||
|
|
||||||
Tables\Filters\TrashedFilter::make(),
|
|
||||||
Filter::make('advanced_filters')
|
|
||||||
->label('Advanced Filters')
|
|
||||||
->form([
|
|
||||||
Select::make('Plant')
|
|
||||||
->label('Select Plant')
|
|
||||||
->nullable()
|
|
||||||
->options(function (callable $get) {
|
|
||||||
$userHas = Filament::auth()->user()->plant_id;
|
|
||||||
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::pluck('name', 'id')->toArray();
|
|
||||||
})
|
|
||||||
->reactive()
|
|
||||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
|
||||||
$set('Item', null);
|
|
||||||
}),
|
|
||||||
Select::make('Item')
|
|
||||||
->label('Item Code')
|
|
||||||
->nullable()
|
|
||||||
->options(function (callable $get) {
|
|
||||||
$plantId = $get('Plant');
|
|
||||||
|
|
||||||
return $plantId ? Item::where('plant_id', $plantId)->pluck('code', 'id') : [];
|
|
||||||
})
|
|
||||||
->reactive()
|
|
||||||
->afterStateUpdated(function ($state, callable $set, callable $get) {
|
|
||||||
$set('process_order', null);
|
|
||||||
}),
|
|
||||||
TextInput::make('process_order')
|
|
||||||
->label('Process Order')
|
|
||||||
->placeholder('Enter Process Order'),
|
|
||||||
TextInput::make('sfg_number')
|
|
||||||
->label('Sfg Number')
|
|
||||||
->placeholder(placeholder: 'Enter Sfg Number'),
|
|
||||||
TextInput::make('machine_name')
|
|
||||||
->label('Machine Name')
|
|
||||||
->placeholder(placeholder: 'Enter Machine Name'),
|
|
||||||
DateTimePicker::make(name: 'created_from')
|
|
||||||
->label('Created From')
|
|
||||||
->placeholder(placeholder: 'Select From DateTime')
|
|
||||||
->reactive()
|
|
||||||
->native(false),
|
|
||||||
DateTimePicker::make('created_to')
|
|
||||||
->label('Created To')
|
|
||||||
->placeholder(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['sfg_number']) && empty($data['created_from']) && empty($data['created_to']) && empty($data['machine_name'])) {
|
|
||||||
return $query->whereRaw('1 = 0');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($data['Plant'])) {
|
|
||||||
$query->where('plant_id', $data['Plant']);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($data['Item'])) {
|
|
||||||
$query->where('item_id', $data['Item']);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($data['process_order'])) {
|
|
||||||
$query->where('process_order', $data['process_order']);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($data['sfg_number'])) {
|
|
||||||
$query->where('sfg_number', $data['sfg_number']);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($data['machine_name'])) {
|
|
||||||
// $query->where('machine_name', $data['machine_name']);
|
|
||||||
$query->where('machine_name', 'like', '%' . $data['machine_name'] . '%');
|
|
||||||
}
|
|
||||||
|
|
||||||
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: ' . Plant::where('id', $data['Plant'])->value('name');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($data['Item'])) {
|
|
||||||
$indicators[] = 'Item: ' . Item::where('id', $data['Item'])->value('code');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($data['process_order'])) {
|
|
||||||
$indicators[] = 'Process Order: ' . $data['process_order'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($data['sfg_number'])) {
|
|
||||||
$indicators[] = 'Sfg Number: ' . $data['sfg_number'];
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($data['machine_name'])) {
|
|
||||||
$indicators[] = 'Machine Name: ' . $data['machine_name'];
|
|
||||||
}
|
|
||||||
|
|
||||||
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(),
|
||||||
|
|||||||
@@ -654,6 +654,7 @@ class QualityValidationResource extends Resource
|
|||||||
->label('Select Validation')
|
->label('Select Validation')
|
||||||
->reactive()
|
->reactive()
|
||||||
->options(fn (callable $get) => $get('part_validation_type_options') ?? [])
|
->options(fn (callable $get) => $get('part_validation_type_options') ?? [])
|
||||||
|
->required()
|
||||||
->afterStateUpdated(function ($state, callable $set) {
|
->afterStateUpdated(function ($state, callable $set) {
|
||||||
// when user selects something new, hide the image
|
// when user selects something new, hide the image
|
||||||
$set('show_validation_image', false);
|
$set('show_validation_image', false);
|
||||||
@@ -2249,15 +2250,9 @@ class QualityValidationResource extends Resource
|
|||||||
|
|
||||||
$mPlantId = $get('plant_id');
|
$mPlantId = $get('plant_id');
|
||||||
|
|
||||||
$mlineId = $get('line_id');
|
|
||||||
|
|
||||||
$plant = Plant::find($mPlantId);
|
$plant = Plant::find($mPlantId);
|
||||||
$plantCodePart1 = $plant?->code;
|
$plantCodePart1 = $plant?->code;
|
||||||
|
|
||||||
$mLine = Line::find($mlineId);
|
|
||||||
$mLinePart = $mLine?->name;
|
|
||||||
|
|
||||||
|
|
||||||
$stickerMasterId = $get('sticker_master_id');
|
$stickerMasterId = $get('sticker_master_id');
|
||||||
if (!$stickerMasterId) {
|
if (!$stickerMasterId) {
|
||||||
return;
|
return;
|
||||||
@@ -2289,13 +2284,12 @@ class QualityValidationResource extends Resource
|
|||||||
|
|
||||||
$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(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 InvalidQualityMail($state, $mPorder, $mPlantName, $mLinePart, $mUserName, 'InvalidPartNumber')
|
new InvalidQualityMail($state, $mPorder, $mPlantName, 'InvalidPartNumber')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -2354,11 +2348,6 @@ class QualityValidationResource extends Resource
|
|||||||
$plant = Plant::find($mPlantId);
|
$plant = Plant::find($mPlantId);
|
||||||
$plantCodePart2 = $plant?->code;
|
$plantCodePart2 = $plant?->code;
|
||||||
|
|
||||||
$mlineId = $get('line_id');
|
|
||||||
|
|
||||||
$mLine = Line::find($mlineId);
|
|
||||||
$mLinePart = $mLine?->name;
|
|
||||||
|
|
||||||
$stickerMasterId = $get('sticker_master_id');
|
$stickerMasterId = $get('sticker_master_id');
|
||||||
if (!$stickerMasterId) {
|
if (!$stickerMasterId) {
|
||||||
return;
|
return;
|
||||||
@@ -2387,13 +2376,12 @@ class QualityValidationResource extends Resource
|
|||||||
|
|
||||||
$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(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 InvalidQualityMail($state, $mPorder, $mPlantName,$mLinePart, $mUserName, 'InvalidPartNumber2')
|
new InvalidQualityMail($state, $mPorder, $mPlantName, 'InvalidPartNumber2')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -2453,12 +2441,6 @@ class QualityValidationResource extends Resource
|
|||||||
$plant = Plant::find($mPlantId);
|
$plant = Plant::find($mPlantId);
|
||||||
$plantCodePart3 = $plant?->code;
|
$plantCodePart3 = $plant?->code;
|
||||||
|
|
||||||
$mlineId = $get('line_id');
|
|
||||||
|
|
||||||
$mLine = Line::find($mlineId);
|
|
||||||
$mLinePart = $mLine?->name;
|
|
||||||
|
|
||||||
|
|
||||||
if (!$stickerMasterId) {
|
if (!$stickerMasterId) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -2487,13 +2469,12 @@ class QualityValidationResource extends Resource
|
|||||||
|
|
||||||
$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(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 InvalidQualityMail($state, $mPorder, $mPlantName,$mLinePart, $mUserName, 'InvalidPartNumber3')
|
new InvalidQualityMail($state, $mPorder, $mPlantName, 'InvalidPartNumber3')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -2551,11 +2532,6 @@ class QualityValidationResource extends Resource
|
|||||||
$plant = Plant::find($mPlantId);
|
$plant = Plant::find($mPlantId);
|
||||||
$plantCodePart4 = $plant?->code;
|
$plantCodePart4 = $plant?->code;
|
||||||
|
|
||||||
$mlineId = $get('line_id');
|
|
||||||
|
|
||||||
$mLine = Line::find($mlineId);
|
|
||||||
$mLinePart = $mLine?->name;
|
|
||||||
|
|
||||||
if (!$stickerMasterId) {
|
if (!$stickerMasterId) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -2584,13 +2560,12 @@ class QualityValidationResource extends Resource
|
|||||||
|
|
||||||
$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(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 InvalidQualityMail($state, $mPorder, $mPlantName,$mLinePart, $mUserName, 'InvalidPartNumber4')
|
new InvalidQualityMail($state, $mPorder, $mPlantName, 'InvalidPartNumber4')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -2704,22 +2679,22 @@ class QualityValidationResource extends Resource
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$set('part_validation5_error', "Invalid input for part validation 5.");
|
$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'];
|
$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 InvalidQualityMail($state, $mPorder, $mPlantName, 'InvalidPartNumber5')
|
new InvalidQualityMail($state, $mPorder, $mPlantName, 'InvalidPartNumber5')
|
||||||
// );
|
);
|
||||||
// }
|
}
|
||||||
// else
|
else
|
||||||
// {
|
{
|
||||||
// \Log::warning("No recipients found for plant {$mPlantName}, module Serial, rule invalid_serial.");
|
\Log::warning("No recipients found for plant {$mPlantName}, module Serial, rule invalid_serial.");
|
||||||
// }
|
}
|
||||||
$set('part_validation5', null);
|
$set('part_validation5', null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -2740,21 +2715,6 @@ class QualityValidationResource extends Resource
|
|||||||
public static function getMailData($plantId)
|
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');
|
$mPlantName = Plant::where('id', $plantId)->value('name');
|
||||||
|
|
||||||
$emails = AlertMailRule::where('plant', $plantId)
|
$emails = AlertMailRule::where('plant', $plantId)
|
||||||
|
|||||||
@@ -20,24 +20,17 @@ class InvalidQualityMail extends Mailable
|
|||||||
public $invoiceNumber;
|
public $invoiceNumber;
|
||||||
public $mplantName;
|
public $mplantName;
|
||||||
public $mProdOrder;
|
public $mProdOrder;
|
||||||
|
|
||||||
public $mUserName;
|
|
||||||
|
|
||||||
public $mPartNo;
|
public $mPartNo;
|
||||||
public $mailType;
|
public $mailType;
|
||||||
public $greeting;
|
public $greeting;
|
||||||
public $subjectLine;
|
public $subjectLine;
|
||||||
|
|
||||||
public $mLinePart;
|
|
||||||
|
|
||||||
public $itemCode;
|
public $itemCode;
|
||||||
public function __construct($parNo, $mProdOrder, $mplantName, $mLinePart, $mUserName, $mailType = 'InvalidPartNumber')
|
public function __construct($parNo, $mProdOrder, $mplantName, $mailType = 'InvalidPartNumber')
|
||||||
{
|
{
|
||||||
$this->mPartNo = $parNo;
|
$this->mPartNo = $parNo;
|
||||||
$this->mProdOrder = $mProdOrder;
|
$this->mProdOrder = $mProdOrder;
|
||||||
$this->mplantName = $mplantName;
|
$this->mplantName = $mplantName;
|
||||||
$this->mLinePart = $mLinePart;
|
|
||||||
$this->mUserName = $mUserName;
|
|
||||||
$this->mailType = $mailType;
|
$this->mailType = $mailType;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,10 +70,8 @@ class InvalidQualityMail extends Mailable
|
|||||||
Dear Sir/Madam,<br><br>
|
Dear Sir/Madam,<br><br>
|
||||||
Please note that the scanned part number appears to be incorrect.<br>
|
Please note that the scanned part number appears to be incorrect.<br>
|
||||||
<b>Plant:</b> {$this->mplantName}<br>
|
<b>Plant:</b> {$this->mplantName}<br>
|
||||||
<b>Line Name:</b> {$this->mLinePart}<br>
|
|
||||||
<b>Production Order:</b> {$this->mProdOrder}<br>
|
<b>Production Order:</b> {$this->mProdOrder}<br>
|
||||||
<b>Scanned Part Number 2:</b> {$this->mPartNo}<br>
|
<b>Scanned Part Number 2:</b> {$this->mPartNo}<br>
|
||||||
<b>Employee Code:</b> {$this->mUserName}<br>
|
|
||||||
";
|
";
|
||||||
break;
|
break;
|
||||||
case 'InvalidPartNumber3':
|
case 'InvalidPartNumber3':
|
||||||
@@ -88,10 +79,8 @@ class InvalidQualityMail extends Mailable
|
|||||||
Dear Sir/Madam,<br><br>
|
Dear Sir/Madam,<br><br>
|
||||||
Please note that the scanned part number appears to be incorrect.<br>
|
Please note that the scanned part number appears to be incorrect.<br>
|
||||||
<b>Plant:</b> {$this->mplantName}<br>
|
<b>Plant:</b> {$this->mplantName}<br>
|
||||||
<b>Line Name:</b> {$this->mLinePart}<br>
|
|
||||||
<b>Production Order:</b> {$this->mProdOrder}<br>
|
<b>Production Order:</b> {$this->mProdOrder}<br>
|
||||||
<b>Scanned Part Number 3:</b> {$this->mPartNo}<br>
|
<b>Scanned Part Number 3:</b> {$this->mPartNo}<br>
|
||||||
<b>Employee Code:</b> {$this->mUserName}<br>
|
|
||||||
";
|
";
|
||||||
break;
|
break;
|
||||||
case 'InvalidPartNumber4':
|
case 'InvalidPartNumber4':
|
||||||
@@ -99,10 +88,8 @@ class InvalidQualityMail extends Mailable
|
|||||||
Dear Sir/Madam,<br><br>
|
Dear Sir/Madam,<br><br>
|
||||||
Please note that the scanned part number appears to be incorrect.<br>
|
Please note that the scanned part number appears to be incorrect.<br>
|
||||||
<b>Plant:</b> {$this->mplantName}<br>
|
<b>Plant:</b> {$this->mplantName}<br>
|
||||||
<b>Line Name:</b> {$this->mLinePart}<br>
|
|
||||||
<b>Production Order:</b> {$this->mProdOrder}<br>
|
<b>Production Order:</b> {$this->mProdOrder}<br>
|
||||||
<b>Scanned Part Number 4:</b> {$this->mPartNo}<br>
|
<b>Scanned Part Number 4:</b> {$this->mPartNo}<br>
|
||||||
<b>Employee Code:</b> {$this->mUserName}<br>
|
|
||||||
";
|
";
|
||||||
break;
|
break;
|
||||||
case 'InvalidPartNumber5':
|
case 'InvalidPartNumber5':
|
||||||
@@ -110,10 +97,8 @@ class InvalidQualityMail extends Mailable
|
|||||||
Dear Sir/Madam,<br><br>
|
Dear Sir/Madam,<br><br>
|
||||||
Please note that the scanned part number appears to be incorrect.<br>
|
Please note that the scanned part number appears to be incorrect.<br>
|
||||||
<b>Plant:</b> {$this->mplantName}<br>
|
<b>Plant:</b> {$this->mplantName}<br>
|
||||||
<b>Line Name:</b> {$this->mLinePart}<br>
|
|
||||||
<b>Production Order:</b> {$this->mProdOrder}<br>
|
<b>Production Order:</b> {$this->mProdOrder}<br>
|
||||||
<b>Scanned Part Number 5:</b> {$this->mPartNo}<br>
|
<b>Scanned Part Number 5:</b> {$this->mPartNo}<br>
|
||||||
<b>Employee Code:</b> {$this->mUserName}<br>
|
|
||||||
";
|
";
|
||||||
break;
|
break;
|
||||||
case 'InvalidPartNumber':
|
case 'InvalidPartNumber':
|
||||||
@@ -122,10 +107,8 @@ class InvalidQualityMail extends Mailable
|
|||||||
Dear Sir/Madam,<br><br>
|
Dear Sir/Madam,<br><br>
|
||||||
Please note that the scanned part number appears to be incorrect.<br>
|
Please note that the scanned part number appears to be incorrect.<br>
|
||||||
<b>Plant:</b> {$this->mplantName}<br>
|
<b>Plant:</b> {$this->mplantName}<br>
|
||||||
<b>Line Name:</b> {$this->mLinePart}<br>
|
|
||||||
<b>Production Order:</b> {$this->mProdOrder}<br>
|
<b>Production Order:</b> {$this->mProdOrder}<br>
|
||||||
<b>Scanned Part Number 1:</b> {$this->mPartNo}<br>
|
<b>Scanned Part Number 1:</b> {$this->mPartNo}<br>
|
||||||
<b>Employee Code:</b> {$this->mUserName}<br>
|
|
||||||
";
|
";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
use Illuminate\Foundation\Inspiring;
|
use Illuminate\Foundation\Inspiring;
|
||||||
use Illuminate\Support\Facades\Artisan;
|
use Illuminate\Support\Facades\Artisan;
|
||||||
|
use App\Models\AlertMailRule;
|
||||||
|
use Illuminate\Console\Scheduling\Schedule;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -9,93 +11,87 @@ Artisan::command('inspire', function () {
|
|||||||
$this->comment(Inspiring::quote());
|
$this->comment(Inspiring::quote());
|
||||||
})->purpose('Display an inspiring quote');
|
})->purpose('Display an inspiring quote');
|
||||||
|
|
||||||
|
|
||||||
Artisan::command('auto:scheduler', function () {
|
|
||||||
$this->call('custom:scheduler');
|
|
||||||
})->everyMinute();
|
|
||||||
|
|
||||||
|
|
||||||
// Schedule::command('send:invoice-report');
|
// Schedule::command('send:invoice-report');
|
||||||
// Schedule::command('send:production-report');
|
// Schedule::command('send:production-report');
|
||||||
|
|
||||||
// app()->booted(function () {
|
app()->booted(function () {
|
||||||
// $schedule = app(Schedule::class);
|
$schedule = app(Schedule::class);
|
||||||
|
|
||||||
// // $schedule->command('report:send-daily-production')->dailyAt('07:59');
|
// $schedule->command('report:send-daily-production')->dailyAt('07:59');
|
||||||
// // Production report scheduling
|
// Production report scheduling
|
||||||
// $productionRules = AlertMailRule::where('module', 'ProductionQuantities')
|
$productionRules = AlertMailRule::where('module', 'ProductionQuantities')
|
||||||
// ->where('rule_name', 'ProductionMail')
|
->where('rule_name', 'ProductionMail')
|
||||||
// ->select('plant', 'schedule_type')
|
->select('plant', 'schedule_type')
|
||||||
// ->distinct()
|
->distinct()
|
||||||
// ->get();
|
->get();
|
||||||
|
|
||||||
// foreach ($productionRules as $rule) {
|
foreach ($productionRules as $rule) {
|
||||||
// $type = $rule->schedule_type;
|
$type = $rule->schedule_type;
|
||||||
// $plantId = $rule->plant;
|
$plantId = $rule->plant;
|
||||||
|
|
||||||
// $command = $schedule->command('send:production-report', [$type, $plantId]);
|
$command = $schedule->command('send:production-report', [$type, $plantId]);
|
||||||
// // ->appendOutputTo(storage_path('logs/scheduler.log'));
|
// ->appendOutputTo(storage_path('logs/scheduler.log'));
|
||||||
|
|
||||||
// switch ($type) {
|
switch ($type) {
|
||||||
// case 'Live':
|
case 'Live':
|
||||||
// $command->everyMinute();
|
$command->everyMinute();
|
||||||
// break;
|
break;
|
||||||
// case 'Hourly':
|
case 'Hourly':
|
||||||
// $command->hourly();
|
$command->hourly();
|
||||||
// break;
|
break;
|
||||||
// case 'Daily':
|
case 'Daily':
|
||||||
// $command->dailyAt('07:59');
|
$command->dailyAt('07:59');
|
||||||
// break;
|
break;
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
// // Invoice report scheduling
|
// Invoice report scheduling
|
||||||
// $invoiceRules = AlertMailRule::where('module', 'InvoiceValidation')
|
$invoiceRules = AlertMailRule::where('module', 'InvoiceValidation')
|
||||||
// ->select('plant', 'schedule_type')
|
->select('plant', 'schedule_type')
|
||||||
// ->distinct()
|
->distinct()
|
||||||
// ->get();
|
->get();
|
||||||
|
|
||||||
// foreach ($invoiceRules as $rule) {
|
foreach ($invoiceRules as $rule) {
|
||||||
// $type = $rule->schedule_type;
|
$type = $rule->schedule_type;
|
||||||
// $plantId = $rule->plant;
|
$plantId = $rule->plant;
|
||||||
|
|
||||||
// $command = $schedule->command('send:invoice-report', [$type, $plantId]);
|
$command = $schedule->command('send:invoice-report', [$type, $plantId]);
|
||||||
|
|
||||||
// switch ($type) {
|
switch ($type) {
|
||||||
// case 'Live':
|
case 'Live':
|
||||||
// $command->everyMinute();
|
$command->everyMinute();
|
||||||
// break;
|
break;
|
||||||
// case 'Hourly':
|
case 'Hourly':
|
||||||
// $command->hourly();
|
$command->hourly();
|
||||||
// break;
|
break;
|
||||||
// case 'Daily':
|
case 'Daily':
|
||||||
// $command->dailyAt('07:59');
|
$command->dailyAt('07:59');
|
||||||
// break;
|
break;
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
|
|
||||||
// // Invoice Data Report Scheduling
|
// Invoice Data Report Scheduling
|
||||||
// $invoiceDataRules = AlertMailRule::where('module', 'InvoiceDataReport')
|
$invoiceDataRules = AlertMailRule::where('module', 'InvoiceDataReport')
|
||||||
// ->select('plant', 'schedule_type')
|
->select('plant', 'schedule_type')
|
||||||
// ->distinct()
|
->distinct()
|
||||||
// ->get();
|
->get();
|
||||||
|
|
||||||
// foreach ($invoiceDataRules as $rule) {
|
foreach ($invoiceDataRules as $rule) {
|
||||||
// $type = $rule->schedule_type;
|
$type = $rule->schedule_type;
|
||||||
// $plantId = $rule->plant;
|
$plantId = $rule->plant;
|
||||||
|
|
||||||
// $command = $schedule->command('send:invoice-data-report', [$type, $plantId]);
|
$command = $schedule->command('send:invoice-data-report', [$type, $plantId]);
|
||||||
|
|
||||||
// switch ($type) {
|
switch ($type) {
|
||||||
// case 'Live':
|
case 'Live':
|
||||||
// $command->everyMinute();
|
$command->everyMinute();
|
||||||
// break;
|
break;
|
||||||
// case 'Hourly':
|
case 'Hourly':
|
||||||
// $command->hourly();
|
$command->hourly();
|
||||||
// break;
|
break;
|
||||||
// case 'Daily':
|
case 'Daily':
|
||||||
// $command->dailyAt('10:00');
|
$command->dailyAt('10:00');
|
||||||
// break;
|
break;
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// });
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user