Added import transit scheduling mail in scheduler page #576
@@ -40,6 +40,7 @@ class Scheduler extends Command
|
|||||||
{
|
{
|
||||||
|
|
||||||
$this->call('approval:trigger-mails');
|
$this->call('approval:trigger-mails');
|
||||||
|
// $this->call('sftp:process-files');
|
||||||
|
|
||||||
// --- Production Rules ---
|
// --- Production Rules ---
|
||||||
$productionRules = AlertMailRule::where('module', 'ProductionQuantities')
|
$productionRules = AlertMailRule::where('module', 'ProductionQuantities')
|
||||||
@@ -234,6 +235,55 @@ class Scheduler extends Command
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$ImportTransitRules = AlertMailRule::where('module', 'ImportTransit')
|
||||||
|
->where('rule_name', 'ImportTransitMail')
|
||||||
|
->select('plant', 'schedule_type')
|
||||||
|
->distinct()
|
||||||
|
->get();
|
||||||
|
|
||||||
|
foreach ($ImportTransitRules as $rule) {
|
||||||
|
|
||||||
|
switch ($rule->schedule_type) {
|
||||||
|
case 'Live':
|
||||||
|
// Run every minute
|
||||||
|
\Artisan::call('send-import-transit', [
|
||||||
|
'schedule_type' => $rule->schedule_type,
|
||||||
|
'plant' => $rule->plant,
|
||||||
|
]);
|
||||||
|
break;
|
||||||
|
case 'Hourly':
|
||||||
|
if (now()->minute == 0) {
|
||||||
|
\Artisan::call('send-import-transit', [
|
||||||
|
'schedule_type' => $rule->schedule_type,
|
||||||
|
'plant' => $rule->plant,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'Daily':
|
||||||
|
if (now()->format('H:i') == '11:10') {
|
||||||
|
try {
|
||||||
|
\Artisan::call('send-import-transit', [
|
||||||
|
'schedule_type' => $rule->schedule_type,
|
||||||
|
'plant' => $rule->plant,
|
||||||
|
]);
|
||||||
|
|
||||||
|
Log::info('Invoice Transit executed', [
|
||||||
|
'plant' => $rule->plant,
|
||||||
|
'type' => $rule->schedule_type,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
catch (\Throwable $e) {
|
||||||
|
Log::error('Invoice Transit FAILED', [
|
||||||
|
'plant' => $rule->plant,
|
||||||
|
'error' => $e->getMessage(),
|
||||||
|
'trace' => $e->getTraceAsString(),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user