mirror of
https://gitlab.com/CIEFWorldwideSdnBhd/shipping-portal.git
synced 2026-08-24 06:54:09 +00:00
78 lines
2.4 KiB
PHP
78 lines
2.4 KiB
PHP
<?php
|
|
|
|
namespace App\Console\Commands\V2;
|
|
|
|
use App\Classes\Jobs\Commands\V2\YD\FetchPackingListsFromYdPortalV2CommandJob;
|
|
use App\Classes\Jobs\Commands\V2\YD\FetchContainersFromYdPortalV2CommandJob;
|
|
use App\Classes\Jobs\Commands\V2\YD\FetchContainersUpdatesFromYdPortalV2CommandJob;
|
|
use App\Classes\Jobs\Commands\V2\YD\FetchDeliveryUpdatesFromYdPortalV2CommandJob;
|
|
use App\Classes\Jobs\Commands\V2\YD\FetchOrderListsFromYdPortalV2CommandJob;
|
|
use App\Classes\Jobs\Commands\V3\YD\FetchContainersYdPortalV3CommandJob;
|
|
use App\Classes\Jobs\Commands\V3\YD\FetchContainersUpdatesYdPortalV3CommandJob;
|
|
|
|
use App\Models\PackingList;
|
|
use App\Models\Container;
|
|
use App\Classes\ValueObjects\Constants\PackingListType;
|
|
use App\Classes\ValueObjects\Constants\ApprovalStatus;
|
|
|
|
use Carbon\Carbon;
|
|
use Illuminate\Console\Command;
|
|
use Illuminate\Support\Facades\Bus;
|
|
use Illuminate\Support\Facades\Log;
|
|
|
|
class OneTimeProcessYDPortalDataV2Command extends Command
|
|
{
|
|
/**
|
|
* The name and signature of the console command.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $signature = 'one-time-process-yd-portal-data-command {start_date?} {end_date?}';
|
|
|
|
/**
|
|
* The console command description.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $description = 'One time process data from YD Portal for the given date range';
|
|
|
|
/**
|
|
* Execute the console command.
|
|
*
|
|
* @return int
|
|
*/
|
|
public function handle()
|
|
{
|
|
$jobs = [];
|
|
$jobs1 = $this->fetchPackingListsFromYdPortalV2CommandJobs();
|
|
|
|
|
|
foreach ($jobs1 as $index => $job) {
|
|
dispatch($job)->delay(now()->addSeconds($index * 2));
|
|
}
|
|
}
|
|
|
|
private function fetchPackingListsFromYdPortalV2CommandJobs(){
|
|
$jobs = [];
|
|
|
|
// $startDate1 = Carbon::create(2025, 1, 15, 0, 0, 0);
|
|
// $endDate1 = Carbon::create(2025, 1, 16, 23, 59, 59);
|
|
|
|
// $startDate2 = Carbon::create(2025, 2, 18, 0, 0, 0);
|
|
// $endDate2 = Carbon::create(2025, 2, 19, 23, 59, 59);
|
|
|
|
// $jobs[] = new FetchPackingListsFromYdPortalV2CommandJob($startDate1, $endDate1);
|
|
// $jobs[] = new FetchPackingListsFromYdPortalV2CommandJob($startDate2, $endDate2);
|
|
|
|
$startDate = Carbon::create(2025, 4, 17);
|
|
$endDate = Carbon::create(2025, 4, 18);
|
|
|
|
$jobs[] = new FetchPackingListsFromYdPortalV2CommandJob($startDate, $endDate);
|
|
|
|
Log::info('Dispatched FetchPackingListsFromYdPortalV2CommandJob (one-time-process)');
|
|
|
|
return $jobs;
|
|
}
|
|
|
|
}
|