| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- <?php
- namespace App\Jobs;
- use App\OracleDOCASNDetail;
- use App\OracleDOCASNHeader;
- use Illuminate\Bus\Queueable;
- use Illuminate\Contracts\Queue\ShouldQueue;
- use Illuminate\Foundation\Bus\Dispatchable;
- use Illuminate\Queue\InteractsWithQueue;
- use Illuminate\Queue\SerializesModels;
- use Illuminate\Support\Facades\Http;
- use Illuminate\Support\Facades\Log;
- /**
- * @Deprecated 退货推单
- */
- class RejectedPushJob implements ShouldQueue
- {
- use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
- public $tries = 5;
- public $timeout = 120;
- /**
- * type: 推单,上架
- * [
- * ['sku' => '75603675975072','taskNum' => 'JI20220316211', 'asnNo' => 'asn002', 'type' => '推单'],
- * ['sku' => '75603675975072','taskNum' => 'JI20220316211', 'asnNo' => 'asn002', 'type' => '推单'],
- * ]
- */
- private $asnNos;
- /**
- * RejectedPushJob constructor.
- * @param array $asnNos
- */
- public function __construct(array $asnNos)
- {
- $this->asnNos = $asnNos;
- }
- /**
- * Execute the job.
- *
- * @return void
- */
- public function handle()
- {
- $result = array();
- $array = array();
- if (count($this->asnNos) > 0) {
- $asnHerders=OracleDOCASNHeader::query()->whereIn('asnno',$this->asnNos)
- ->select('asnno','notes','asntype','asnstatus')
- ->get();
- foreach ($asnHerders as $asnHerder) {
- if ($asnHerder->asntype == 'THRK' && $asnHerder->notes) {
- preg_match('/^[A-Z]{2}[0-9]{8}\d{0,8}/', $asnHerder->notes, $result);
- if (count($result) < 1) continue;
- $details = OracleDOCASNDetail::query()->select('sku', 'linestatus')->where('asnno', $asnHerder->asnno)->get();
- if (count($details) < 1) continue;
- foreach ($details as $detail) {
- $array[] = [
- 'sku' => $detail->sku,
- 'taskNum' => $result[0],
- 'asnNo' => $asnHerder->asnno,
- 'type' => $detail->linestatus == '99' ? '上架' : '推单'
- ];
- }
- }
- }
- }
- $url = config('api.java.wms.rejectedPushTask.receivePush');
- if (count($array) > 0) {
- $response = Http::post($url, $array);
- Log::info("推送信息!", ['res' => $response->body(), 'req' => $array]);
- }else{
- Log::info("推送信息失败!", ['res' => $this->asnNos,'array'=>$array]);
- }
- }
- }
|