<?php

namespace App\Jobs;

use App\Events\WmsReceiveNewEvent;
use App\Http\Controllers\Controller;
use App\WMSReflectReceive;
use App\WMSReflectReceiveSku;
use Carbon\Carbon;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\SerializesModels;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;

class ProcessReceiveCombinedJob implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    protected $logisticNumberReturn;
    public function __construct($logisticNumberReturn)
    {
        $this->logisticNumberReturn=$logisticNumberReturn;
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        $wmsReceives=WMSReflectReceive::where('ASNREFERENCE3',$this->logisticNumberReturn)->get();
        if(config('api.jianshang_rejecteds_log_switch'))Controller::logS(__METHOD__,__FUNCTION__,"执行队列任务，处理退单号：{$this->logisticNumberReturn}",null);
        event(new WmsReceiveNewEvent($this->logisticNumberReturn,$wmsReceives->first()));
    }
}
