<?php

namespace App\Console;

use App\Console\Commands\BeforeCreateOwnerReport;
use App\Console\Commands\ClearCancelledOrderTask;
use App\Console\Commands\CreateProcurementTotalBill;
use App\Console\Commands\CreateWeightStatistic;
use App\Console\Commands\FluxOrderFix;
use App\Console\Commands\InventoryDailyLoggingOwner;
use App\Console\Commands\LogExpireDelete;
use App\Console\Commands\MakeServiceCommand;
use App\Console\Commands\SyncBatchTask;
use App\Console\Commands\SyncCarrier;
use App\Console\Commands\SyncLogCacheTask;
use App\Console\Commands\SyncOrderPackageLogisticRouteTask;
use App\Console\Commands\SyncUserVisitMenuLogsCacheTask;
use App\Console\Commands\SyncWmsCommoditiesInformation;
use App\Console\Commands\SyncWMSOrderTask;
use App\Console\Commands\TestTemp;
use App\Console\Commands\WasSyncWmsAsnInformation;
use App\Console\Commands\WASSyncWMSOrderInformation;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use Illuminate\Foundation\Console\ModelMakeCommand;

class  Kernel extends ConsoleKernel
{
    /**
     * The Artisan commands provided by your application.
     *
     * @var array
     */
    protected $commands = [
        LogExpireDelete::class,
        MakeServiceCommand::class,
        FluxOrderFix::class,
        InventoryDailyLoggingOwner::class,
        WASSyncWMSOrderInformation::class,
        SyncLogCacheTask::class,
        SyncUserVisitMenuLogsCacheTask::class,
        TestTemp::class,
        SyncBatchTask::class,
        SyncWMSOrderTask::class,
        SyncOrderPackageLogisticRouteTask::class,
        SyncWmsCommoditiesInformation::class,
        ClearCancelledOrderTask::class,
        WasSyncWmsAsnInformation::class,
        CreateWeightStatistic::class,
        BeforeCreateOwnerReport::class,
        CreateProcurementTotalBill::class,
        SyncCarrier::class,
    ];

    /**
     * Define the application's command schedule.
     *
     * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
        $schedule->command('LogExpireDelete')->dailyAt('00:01');
        $schedule->command('InventoryDailyLoggingOwner')->dailyAt('08:00');
        $schedule->command('FluxOrderFix')->hourlyAt(1);
        $schedule->command('WASSyncWMSOrderInformation')->everyMinute();
        $schedule->command('syncLogCacheTask')->everyMinute();
        $schedule->command('createOwnerReport')->monthlyOn(1);
        $schedule->command('createOwnerBillReport')->monthlyOn(1);
        $schedule->command('createOwnerAreaReport')->monthlyOn(1);
        $schedule->command('beforeCreateOwnerReport')->monthlyOn(1);
        $schedule->command('sync:batch')->everyMinute();
        $schedule->command('sync:order')->everyMinute();
        $schedule->command('syncOrderPackageLogisticRouteTask')->dailyAt('1:20');//同步快递信息到orderPackage
        $schedule->command('syncOrderPackageLogisticRouteTask')->dailyAt('12:01');//同步快递信息到orderPackage
        $schedule->command('updateOrderPackageExceptionTypeCountingRecordTask')->dailyAt('2:20');//更新OrderPackageExceptionTypeCountingRecord
        $schedule->command('SyncWmsCommoditiesInformation')->everyMinute();
        $schedule->command('clear:cancelledOrder')->everyMinute();
        $schedule->command('WasSyncWmsAsnInformation')->everyMinute();
        $schedule->command('create:weightStatistic')->dailyAt("00:30");
        $schedule->command('sync:carrier')->hourlyAt(1);
        $schedule->command('createProcurementTotalBill')->monthlyOn(1);
    }

    /**
     * Register the commands for the application.
     *
     * @return void
     */
    protected function commands()
    {
        $this->load(__DIR__ . '/Commands');
        $this->app->extend('command.model.make',function(ModelMakeCommand $base,$app){
            return new \App\Console\Commands\MakeModelCommand($app['files']);
        });
        require base_path('routes/console.php');
    }
}
