Compare commits
12 Commits
587b743f12
...
renovate/l
| Author | SHA1 | Date | |
|---|---|---|---|
| 2a3946e956 | |||
| e20915ca82 | |||
|
|
5f4494f5aa | ||
| 58e6cbfac0 | |||
|
|
9fa73b2ecc | ||
| 1ace049687 | |||
|
|
d75d435456 | ||
| e5e85a8eea | |||
|
|
ff8aa8b536 | ||
|
|
53f0a7bfdf | ||
| 555802ab35 | |||
|
|
1aa1937b39 |
@@ -3270,7 +3270,7 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
$hasPumpSetQr = $record->stickerMasterRelation->tube_sticker_pumpset ?? null;
|
$hasPumpSetQr = $record->stickerMasterRelation->tube_sticker_pumpset ?? null;
|
||||||
$hasCapacitorQr = $record->stickerMasterRelation->panel_box_code ?? null;
|
$hasCapacitorQr = $record->stickerMasterRelation->panel_box_code ?? null;
|
||||||
|
|
||||||
if (! $hasMotorQr && ! $hasPumpQr && ! $hasPumpSetQr && ! $hasCapacitorQr) {
|
if (! $hasMotorQr && ! $hasPumpQr && ! $hasPumpSetQr) {// && ! $hasCapacitorQr
|
||||||
$hasMotorQr = $record->stickerMasterRelation->pack_slip_motor ?? null;
|
$hasMotorQr = $record->stickerMasterRelation->pack_slip_motor ?? null;
|
||||||
$hasPumpQr = $record->stickerMasterRelation->pack_slip_pump ?? null;
|
$hasPumpQr = $record->stickerMasterRelation->pack_slip_pump ?? null;
|
||||||
$hasPumpSetQr = $record->stickerMasterRelation->pack_slip_pumpset ?? null;
|
$hasPumpSetQr = $record->stickerMasterRelation->pack_slip_pumpset ?? null;
|
||||||
@@ -3278,12 +3278,21 @@ class CreateInvoiceValidation extends CreateRecord
|
|||||||
$hasPumpQr = $record->stickerMasterRelation->pack_slip_pump ?? null;
|
$hasPumpQr = $record->stickerMasterRelation->pack_slip_pump ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$invalidPackage = false;
|
||||||
|
$hasTubeMotorQr = $record->stickerMasterRelation->tube_sticker_motor ?? null;
|
||||||
|
$hasPackMotorQr = $record->stickerMasterRelation->pack_slip_motor ?? null;
|
||||||
|
$hasTubePumpSetQr = $record->stickerMasterRelation->tube_sticker_pumpset ?? null;
|
||||||
|
$hasPackPumpSetQr = $record->stickerMasterRelation->pack_slip_pumpset ?? null;
|
||||||
|
if ($hasTubeMotorQr != $hasPackMotorQr || $hasTubePumpSetQr != $hasPackPumpSetQr) {
|
||||||
|
$invalidPackage = true;
|
||||||
|
}
|
||||||
|
|
||||||
$hadMotorQr = $record->motor_scanned_status ?? null;
|
$hadMotorQr = $record->motor_scanned_status ?? null;
|
||||||
$hadPumpQr = $record->pump_scanned_status ?? null;
|
$hadPumpQr = $record->pump_scanned_status ?? null;
|
||||||
$hadPumpSetQr = $record->scanned_status_set ?? null;
|
$hadPumpSetQr = $record->scanned_status_set ?? null;
|
||||||
$hadCapacitorQr = $record->capacitor_scanned_status ?? null;
|
$hadCapacitorQr = $record->capacitor_scanned_status ?? null;
|
||||||
|
|
||||||
if (! $hasMotorQr && ! $hasPumpQr && ! $hasPumpSetQr && ! $hasCapacitorQr) {
|
if ((! $hasMotorQr && ! $hasPumpQr && ! $hasPumpSetQr && ! $hasCapacitorQr) || $invalidPackage) {
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Invalid: Item Code')
|
->title('Invalid: Item Code')
|
||||||
->body("Scanned 'Item Code' doesn't have valid package type to proceed!")
|
->body("Scanned 'Item Code' doesn't have valid package type to proceed!")
|
||||||
|
|||||||
@@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
namespace App\Livewire;
|
namespace App\Livewire;
|
||||||
|
|
||||||
use App\Filament\Resources\InvoiceValidationResource\Pages\CreateInvoiceValidation;
|
|
||||||
use App\Models\InvoiceValidation;
|
use App\Models\InvoiceValidation;
|
||||||
use App\Models\StickerMaster;
|
use App\Models\StickerMaster;
|
||||||
use Filament\Facades\Filament;
|
use Filament\Facades\Filament;
|
||||||
@@ -41,7 +40,7 @@ class InvoiceDataTable extends Component
|
|||||||
'refreshEmptyInvoice' => 'loadEmptyData',
|
'refreshEmptyInvoice' => 'loadEmptyData',
|
||||||
'refreshInvoiceData' => 'loadData',
|
'refreshInvoiceData' => 'loadData',
|
||||||
'refreshMaterialInvoiceData' => 'loadMaterialData',
|
'refreshMaterialInvoiceData' => 'loadMaterialData',
|
||||||
'openCapacitorModal' => 'showCapacitorInputBox'
|
'openCapacitorModal' => 'showCapacitorInputBox',
|
||||||
];
|
];
|
||||||
|
|
||||||
public $capacitorInput = '';
|
public $capacitorInput = '';
|
||||||
@@ -127,70 +126,52 @@ class InvoiceDataTable extends Component
|
|||||||
// $stickerMaster = \App\Models\StickerMaster::with('item')->find($row['sticker_master_id'] ?? null);
|
// $stickerMaster = \App\Models\StickerMaster::with('item')->find($row['sticker_master_id'] ?? null);
|
||||||
$row['code'] = StickerMaster::with('item')->find($row['sticker_master_id'] ?? null)?->item?->code ?? 'N/A';
|
$row['code'] = StickerMaster::with('item')->find($row['sticker_master_id'] ?? null)?->item?->code ?? 'N/A';
|
||||||
$curStick = StickerMaster::where('id', $row['sticker_master_id'])->first();
|
$curStick = StickerMaster::where('id', $row['sticker_master_id'])->first();
|
||||||
if ($curStick)
|
if ($curStick) {
|
||||||
{
|
if (Str::length($curStick->panel_box_code) > 0) {
|
||||||
if ($curStick->tube_sticker_motor == 1 || $curStick->tube_sticker_pump == 1 || $curStick->tube_sticker_pumpset == 1 || Str::length($curStick->panel_box_code) > 0)
|
|
||||||
{
|
|
||||||
if ($curStick->tube_sticker_motor == 1)
|
|
||||||
{
|
|
||||||
$stickCount++;
|
$stickCount++;
|
||||||
}
|
}
|
||||||
if ($curStick->tube_sticker_pump == 1)
|
if ($curStick->tube_sticker_motor == 1 || $curStick->tube_sticker_pump == 1 || $curStick->tube_sticker_pumpset == 1) {
|
||||||
{
|
if ($curStick->tube_sticker_motor == 1) {
|
||||||
$stickCount++;
|
$stickCount++;
|
||||||
}
|
}
|
||||||
if ($curStick->tube_sticker_pumpset == 1)
|
if ($curStick->tube_sticker_pump == 1 || ($curStick->tube_sticker_pumpset != 1 && $curStick->tube_sticker_pump != 1 && $curStick->pack_slip_pump == 1)) {
|
||||||
{
|
|
||||||
$stickCount++;
|
$stickCount++;
|
||||||
}
|
}
|
||||||
if (Str::length($curStick->panel_box_code) > 0)
|
if ($curStick->tube_sticker_pumpset == 1) {
|
||||||
{
|
|
||||||
$stickCount++;
|
$stickCount++;
|
||||||
}
|
}
|
||||||
}
|
} elseif ($curStick->pack_slip_motor == 1 || $curStick->pack_slip_pump == 1 || $curStick->pack_slip_pumpset == 1) {
|
||||||
else if ($curStick->pack_slip_motor == 1 || $curStick->pack_slip_pump == 1 || $curStick->pack_slip_pumpset == 1)
|
if ($curStick->pack_slip_motor == 1) {
|
||||||
{
|
|
||||||
if ($curStick->pack_slip_motor == 1)
|
|
||||||
{
|
|
||||||
$stickCount++;
|
$stickCount++;
|
||||||
}
|
}
|
||||||
if ($curStick->pack_slip_pump == 1)
|
if ($curStick->pack_slip_pump == 1) {
|
||||||
{
|
|
||||||
$stickCount++;
|
$stickCount++;
|
||||||
}
|
}
|
||||||
if ($curStick->pack_slip_pumpset == 1)
|
if ($curStick->pack_slip_pumpset == 1) {
|
||||||
{
|
|
||||||
$stickCount++;
|
$stickCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($row['motor_scanned_status'] == 1)
|
if ($row['motor_scanned_status'] == 1) {
|
||||||
{
|
|
||||||
$scannedCount++;
|
$scannedCount++;
|
||||||
}
|
}
|
||||||
if ($row['pump_scanned_status'] == 1)
|
if ($row['pump_scanned_status'] == 1) {
|
||||||
{
|
|
||||||
$scannedCount++;
|
$scannedCount++;
|
||||||
}
|
}
|
||||||
if ($row['capacitor_scanned_status'] == 1)
|
if ($row['capacitor_scanned_status'] == 1) {
|
||||||
{
|
|
||||||
$scannedCount++;
|
$scannedCount++;
|
||||||
}
|
}
|
||||||
if ($row['scanned_status_set'] == 1)
|
if ($row['scanned_status_set'] == 1) {
|
||||||
{
|
|
||||||
$scannedCount++;
|
$scannedCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->packageCount += $stickCount - $scannedCount;
|
$this->packageCount += $stickCount - $scannedCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($onCapFocus)
|
if ($onCapFocus) {
|
||||||
{
|
|
||||||
$this->dispatch('focus-capacitor-input');
|
$this->dispatch('focus-capacitor-input');
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->dispatch('focus-serial-number');
|
$this->dispatch('focus-serial-number');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -228,20 +209,13 @@ class InvoiceDataTable extends Component
|
|||||||
// $stickerMaster = \App\Models\StickerMaster::with('item')->find($row['sticker_master_id'] ?? null);
|
// $stickerMaster = \App\Models\StickerMaster::with('item')->find($row['sticker_master_id'] ?? null);
|
||||||
$row['code'] = StickerMaster::with('item')->find($row['sticker_master_id'] ?? null)?->item?->code ?? 'N/A';
|
$row['code'] = StickerMaster::with('item')->find($row['sticker_master_id'] ?? null)?->item?->code ?? 'N/A';
|
||||||
$matType = StickerMaster::where('id', $row['sticker_master_id'] ?? null)->first()->material_type ?? '';
|
$matType = StickerMaster::where('id', $row['sticker_master_id'] ?? null)->first()->material_type ?? '';
|
||||||
if ($matType === 1)
|
if ($matType === 1) {
|
||||||
{
|
|
||||||
$row['material_type'] = 'Individual';
|
$row['material_type'] = 'Individual';
|
||||||
}
|
} elseif ($matType === 2) {
|
||||||
else if ($matType === 2)
|
|
||||||
{
|
|
||||||
$row['material_type'] = 'Bundle';
|
$row['material_type'] = 'Bundle';
|
||||||
}
|
} elseif ($matType === 3) {
|
||||||
else if ($matType === 3)
|
|
||||||
{
|
|
||||||
$row['material_type'] = 'Quantity';
|
$row['material_type'] = 'Quantity';
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$row['material_type'] = 'N/A';
|
$row['material_type'] = 'N/A';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -287,6 +261,7 @@ class InvoiceDataTable extends Component
|
|||||||
// ->duration(3000)
|
// ->duration(3000)
|
||||||
->seconds(2)
|
->seconds(2)
|
||||||
->send();
|
->send();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -309,12 +284,12 @@ class InvoiceDataTable extends Component
|
|||||||
->seconds(2)
|
->seconds(2)
|
||||||
->send();
|
->send();
|
||||||
$this->capacitorInput = '';
|
$this->capacitorInput = '';
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($this->invoiceData as &$row) {
|
foreach ($this->invoiceData as &$row) {
|
||||||
if (($row['code'] ?? '') === $this->currentItemCode && ($row['serial_number'] ?? '') === $this->currentSerialNumber)
|
if (($row['code'] ?? '') === $this->currentItemCode && ($row['serial_number'] ?? '') === $this->currentSerialNumber) {
|
||||||
{
|
|
||||||
$row['panel_box_supplier'] = $supplier;
|
$row['panel_box_supplier'] = $supplier;
|
||||||
$row['panel_box_item_code'] = $itemCode;
|
$row['panel_box_item_code'] = $itemCode;
|
||||||
$row['panel_box_serial_number'] = $serialNumber;
|
$row['panel_box_serial_number'] = $serialNumber;
|
||||||
@@ -343,8 +318,7 @@ class InvoiceDataTable extends Component
|
|||||||
$packCnt = 1;
|
$packCnt = 1;
|
||||||
$scanCnt = 1;
|
$scanCnt = 1;
|
||||||
// if ($hadMotorQr === $hasMotorQr && $hadPumpQr === $hasPumpQr && $hadPumpSetQr === $hasPumpSetQr)
|
// if ($hadMotorQr === $hasMotorQr && $hadPumpQr === $hasPumpQr && $hadPumpSetQr === $hasPumpSetQr)
|
||||||
if ($hasMotorQr || $hasPumpQr || $hasPumpSetQr)
|
if ($hasMotorQr || $hasPumpQr || $hasPumpSetQr) {
|
||||||
{
|
|
||||||
$packCnt = $hasMotorQr ? $packCnt + 1 : $packCnt;
|
$packCnt = $hasMotorQr ? $packCnt + 1 : $packCnt;
|
||||||
$packCnt = $hasPumpQr ? $packCnt + 1 : $packCnt;
|
$packCnt = $hasPumpQr ? $packCnt + 1 : $packCnt;
|
||||||
$packCnt = $hasPumpSetQr ? $packCnt + 1 : $packCnt;
|
$packCnt = $hasPumpSetQr ? $packCnt + 1 : $packCnt;
|
||||||
@@ -353,8 +327,7 @@ class InvoiceDataTable extends Component
|
|||||||
$scanCnt = $hadPumpQr ? $scanCnt + 1 : $scanCnt;
|
$scanCnt = $hadPumpQr ? $scanCnt + 1 : $scanCnt;
|
||||||
$scanCnt = $hadPumpSetQr ? $scanCnt + 1 : $scanCnt;
|
$scanCnt = $hadPumpSetQr ? $scanCnt + 1 : $scanCnt;
|
||||||
|
|
||||||
if ($packCnt === $scanCnt)
|
if ($packCnt === $scanCnt) {
|
||||||
{
|
|
||||||
$matchingValidation->update([
|
$matchingValidation->update([
|
||||||
'panel_box_supplier' => $supplier,
|
'panel_box_supplier' => $supplier,
|
||||||
'panel_box_item_code' => $itemCode,
|
'panel_box_item_code' => $itemCode,
|
||||||
@@ -363,9 +336,7 @@ class InvoiceDataTable extends Component
|
|||||||
'scanned_status' => 'Scanned',
|
'scanned_status' => 'Scanned',
|
||||||
'operator_id' => $operatorName,
|
'operator_id' => $operatorName,
|
||||||
]);
|
]);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$matchingValidation->update([
|
$matchingValidation->update([
|
||||||
'panel_box_supplier' => $supplier,
|
'panel_box_supplier' => $supplier,
|
||||||
'panel_box_item_code' => $itemCode,
|
'panel_box_item_code' => $itemCode,
|
||||||
@@ -374,9 +345,7 @@ class InvoiceDataTable extends Component
|
|||||||
'operator_id' => $operatorName,
|
'operator_id' => $operatorName,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$matchingValidation->update([
|
$matchingValidation->update([
|
||||||
'panel_box_supplier' => $supplier,
|
'panel_box_supplier' => $supplier,
|
||||||
'panel_box_item_code' => $itemCode,
|
'panel_box_item_code' => $itemCode,
|
||||||
@@ -405,8 +374,7 @@ class InvoiceDataTable extends Component
|
|||||||
// 'scanned_quantity'=> $scannedQuantity,
|
// 'scanned_quantity'=> $scannedQuantity,
|
||||||
// ]);
|
// ]);
|
||||||
|
|
||||||
if ($totalQuantity === $scannedQuantity)
|
if ($totalQuantity === $scannedQuantity) {
|
||||||
{
|
|
||||||
Notification::make()
|
Notification::make()
|
||||||
->title('Completed: Serial Invoice')
|
->title('Completed: Serial Invoice')
|
||||||
->body("Serial invoice '$matchingValidation->invoice_number' completed the scanning process.<br>Scan the next 'Serial Invoice' to proceed!")
|
->body("Serial invoice '$matchingValidation->invoice_number' completed the scanning process.<br>Scan the next 'Serial Invoice' to proceed!")
|
||||||
@@ -414,9 +382,7 @@ class InvoiceDataTable extends Component
|
|||||||
->seconds(2)
|
->seconds(2)
|
||||||
->send();
|
->send();
|
||||||
$this->loadCompletedData($matchingValidation->invoice_number, $matchingValidation->plant_id, true);
|
$this->loadCompletedData($matchingValidation->invoice_number, $matchingValidation->plant_id, true);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->loadData($matchingValidation->invoice_number, $matchingValidation->plant_id, false);
|
$this->loadData($matchingValidation->invoice_number, $matchingValidation->plant_id, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -435,5 +401,4 @@ class InvoiceDataTable extends Component
|
|||||||
{
|
{
|
||||||
return view('livewire.invoice-data-table');
|
return view('livewire.invoice-data-table');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,13 +2,13 @@
|
|||||||
|
|
||||||
namespace App\Mail;
|
namespace App\Mail;
|
||||||
|
|
||||||
|
use App\Models\InvoiceDataValidation;
|
||||||
|
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 DateTime;
|
|
||||||
|
|
||||||
class InvoiceDataMail extends Mailable
|
class InvoiceDataMail extends Mailable
|
||||||
{
|
{
|
||||||
@@ -23,7 +23,7 @@ class InvoiceDataMail extends Mailable
|
|||||||
/**
|
/**
|
||||||
* Create a new message instance.
|
* Create a new message instance.
|
||||||
*/
|
*/
|
||||||
public function __construct($scheduleType, $tableData = [], $mailSubject)
|
public function __construct($scheduleType, $tableData, $mailSubject)
|
||||||
{
|
{
|
||||||
$this->scheduleType = $scheduleType;
|
$this->scheduleType = $scheduleType;
|
||||||
$this->tableData = $tableData ?? [];
|
$this->tableData = $tableData ?? [];
|
||||||
@@ -48,12 +48,14 @@ class InvoiceDataMail extends Mailable
|
|||||||
$greeting = 'Dear Sir/Madam,<br><br>We are sending here with list of "Despatch pending sale invoice & STO invoice as on date"';
|
$greeting = 'Dear Sir/Madam,<br><br>We are sending here with list of "Despatch pending sale invoice & STO invoice as on date"';
|
||||||
|
|
||||||
if ($this->scheduleType == 'Daily') {
|
if ($this->scheduleType == 'Daily') {
|
||||||
$firstRecord = \App\Models\InvoiceDataValidation::orderBy('document_date', 'asc')->first();
|
$firstRecord = InvoiceDataValidation::orderBy('document_date', 'asc')->first(); // 'desc'
|
||||||
//$lastRecord = \App\Models\InvoiceDataValidation::orderBy('document_date', 'desc')->first();
|
|
||||||
|
|
||||||
if ($firstRecord) {
|
$startDate = null;
|
||||||
|
if ($firstRecord && $firstRecord?->document_date != null && $firstRecord?->document_date != '') {
|
||||||
$startDate = \Carbon\Carbon::parse($firstRecord->document_date)->startOfDay();
|
$startDate = \Carbon\Carbon::parse($firstRecord->document_date)->startOfDay();
|
||||||
// $endDate = \Carbon\Carbon::parse($lastRecord->document_date)->endOfDay();
|
// $endDate = \Carbon\Carbon::parse($lastRecord->document_date)->endOfDay();
|
||||||
|
} else {
|
||||||
|
$startDate = now()->subDay()->setTime(10, 0, 0);
|
||||||
}
|
}
|
||||||
$endDate = now()->setTime(10, 0, 0);
|
$endDate = now()->setTime(10, 0, 0);
|
||||||
|
|
||||||
@@ -81,10 +83,10 @@ class InvoiceDataMail extends Mailable
|
|||||||
return new Content(
|
return new Content(
|
||||||
view: 'mail.invoice_data_report',
|
view: 'mail.invoice_data_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',
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
"filament/filament": "^3.3",
|
"filament/filament": "^3.3",
|
||||||
"intervention/image": "^3.11",
|
"intervention/image": "^3.11",
|
||||||
"irazasyed/telegram-bot-sdk": "^3.15",
|
"irazasyed/telegram-bot-sdk": "^3.15",
|
||||||
"laravel/framework": "^11.31",
|
"laravel/framework": "^12.0",
|
||||||
"laravel/sanctum": "^4.0",
|
"laravel/sanctum": "^4.0",
|
||||||
"laravel/tinker": "^2.9",
|
"laravel/tinker": "^2.9",
|
||||||
"league/flysystem-sftp-v3": "^3.30",
|
"league/flysystem-sftp-v3": "^3.30",
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Models\AlertMailRule;
|
|
||||||
use Illuminate\Console\Scheduling\Schedule;
|
|
||||||
use Illuminate\Foundation\Inspiring;
|
use Illuminate\Foundation\Inspiring;
|
||||||
use Illuminate\Support\Facades\Artisan;
|
use Illuminate\Support\Facades\Artisan;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use App\Models\AlertMailRule;
|
||||||
|
use Illuminate\Console\Scheduling\Schedule;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Artisan::command('inspire', function () {
|
Artisan::command('inspire', function () {
|
||||||
$this->comment(Inspiring::quote());
|
$this->comment(Inspiring::quote());
|
||||||
@@ -13,88 +14,84 @@ Artisan::command('inspire', function () {
|
|||||||
// 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
|
||||||
|
$productionRules = AlertMailRule::where('module', 'ProductionQuantities')
|
||||||
|
->where('rule_name', 'ProductionMail')
|
||||||
|
->select('plant', 'schedule_type')
|
||||||
|
->distinct()
|
||||||
|
->get();
|
||||||
|
|
||||||
// if (Schema::hasTable('alert_mail_rules')) {
|
foreach ($productionRules as $rule) {
|
||||||
|
$type = $rule->schedule_type;
|
||||||
|
$plantId = $rule->plant;
|
||||||
|
|
||||||
// // Production report scheduling
|
$command = $schedule->command('send:production-report', [$type, $plantId]);
|
||||||
// $productionRules = AlertMailRule::where('module', 'ProductionQuantities')
|
// ->appendOutputTo(storage_path('logs/scheduler.log'));
|
||||||
// ->where('rule_name', 'ProductionMail')
|
|
||||||
// ->select('plant', 'schedule_type')
|
|
||||||
// ->distinct()
|
|
||||||
// ->get();
|
|
||||||
|
|
||||||
// foreach ($productionRules as $rule) {
|
switch ($type) {
|
||||||
// $type = $rule->schedule_type;
|
case 'Live':
|
||||||
// $plantId = $rule->plant;
|
$command->everyMinute();
|
||||||
|
break;
|
||||||
|
case 'Hourly':
|
||||||
|
$command->hourly();
|
||||||
|
break;
|
||||||
|
case 'Daily':
|
||||||
|
$command->dailyAt('07:59');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// $command = $schedule->command('send:production-report', [$type, $plantId]);
|
// Invoice report scheduling
|
||||||
// // ->appendOutputTo(storage_path('logs/scheduler.log'));
|
$invoiceRules = AlertMailRule::where('module', 'InvoiceValidation')
|
||||||
|
->select('plant', 'schedule_type')
|
||||||
|
->distinct()
|
||||||
|
->get();
|
||||||
|
|
||||||
// switch ($type) {
|
foreach ($invoiceRules as $rule) {
|
||||||
// case 'Live':
|
$type = $rule->schedule_type;
|
||||||
// $command->everyMinute();
|
$plantId = $rule->plant;
|
||||||
// break;
|
|
||||||
// case 'Hourly':
|
|
||||||
// $command->hourly();
|
|
||||||
// break;
|
|
||||||
// case 'Daily':
|
|
||||||
// $command->dailyAt('07:59');
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // Invoice report scheduling
|
$command = $schedule->command('send:invoice-report', [$type, $plantId]);
|
||||||
// $invoiceRules = AlertMailRule::where('module', 'InvoiceValidation')
|
|
||||||
// ->select('plant', 'schedule_type')
|
|
||||||
// ->distinct()
|
|
||||||
// ->get();
|
|
||||||
|
|
||||||
// foreach ($invoiceRules as $rule) {
|
switch ($type) {
|
||||||
// $type = $rule->schedule_type;
|
case 'Live':
|
||||||
// $plantId = $rule->plant;
|
$command->everyMinute();
|
||||||
|
break;
|
||||||
|
case 'Hourly':
|
||||||
|
$command->hourly();
|
||||||
|
break;
|
||||||
|
case 'Daily':
|
||||||
|
$command->dailyAt('07:59');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// $command = $schedule->command('send:invoice-report', [$type, $plantId]);
|
// Invoice Data Report Scheduling
|
||||||
|
$invoiceDataRules = AlertMailRule::where('module', 'InvoiceDataReport')
|
||||||
|
->select('plant', 'schedule_type')
|
||||||
|
->distinct()
|
||||||
|
->get();
|
||||||
|
|
||||||
// switch ($type) {
|
foreach ($invoiceDataRules as $rule) {
|
||||||
// case 'Live':
|
$type = $rule->schedule_type;
|
||||||
// $command->everyMinute();
|
$plantId = $rule->plant;
|
||||||
// break;
|
|
||||||
// case 'Hourly':
|
|
||||||
// $command->hourly();
|
|
||||||
// break;
|
|
||||||
// case 'Daily':
|
|
||||||
// $command->dailyAt('07:59');
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// // Invoice Data Report Scheduling
|
$command = $schedule->command('send:invoice-data-report', [$type, $plantId]);
|
||||||
// $invoiceDataRules = AlertMailRule::where('module', 'InvoiceDataReport')
|
|
||||||
// ->select('plant', 'schedule_type')
|
|
||||||
// ->distinct()
|
|
||||||
// ->get();
|
|
||||||
|
|
||||||
// foreach ($invoiceDataRules as $rule) {
|
switch ($type) {
|
||||||
// $type = $rule->schedule_type;
|
case 'Live':
|
||||||
// $plantId = $rule->plant;
|
$command->everyMinute();
|
||||||
|
break;
|
||||||
// $command = $schedule->command('send:invoice-data-report', [$type, $plantId]);
|
case 'Hourly':
|
||||||
|
$command->hourly();
|
||||||
// switch ($type) {
|
break;
|
||||||
// case 'Live':
|
case 'Daily':
|
||||||
// $command->everyMinute();
|
$command->dailyAt('10:00');
|
||||||
// break;
|
break;
|
||||||
// case 'Hourly':
|
}
|
||||||
// $command->hourly();
|
}
|
||||||
// break;
|
});
|
||||||
// case 'Daily':
|
|
||||||
// $command->dailyAt('10:00');
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
|
|||||||
Reference in New Issue
Block a user