HandleExceptionWaybill.php 996 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. namespace App\Jobs;
  3. use App\Order;
  4. use App\Waybill;
  5. use Illuminate\Bus\Queueable;
  6. use Illuminate\Contracts\Queue\ShouldQueue;
  7. use Illuminate\Foundation\Bus\Dispatchable;
  8. use Illuminate\Queue\InteractsWithQueue;
  9. /**
  10. * @Deprecated 订单与物流单关联
  11. */
  12. class HandleExceptionWaybill implements ShouldQueue
  13. {
  14. use Dispatchable, InteractsWithQueue, Queueable;
  15. /** @var Waybill|\stdClass */
  16. protected $waybill;
  17. /**
  18. * Create a new job instance.
  19. *
  20. * @param Waybill $waybill
  21. *
  22. * @return void
  23. */
  24. public function __construct(Waybill $waybill)
  25. {
  26. $this->waybill = $waybill;
  27. }
  28. /**
  29. * Execute the job.
  30. *
  31. * @return void
  32. *
  33. * @throws
  34. */
  35. public function handle()
  36. {
  37. $order = Order::query()->where("code",$this->waybill->wms_bill_number)->first();
  38. if ($order)$this->waybill->update(["order_id"=>$order->id]);
  39. else throw new \Exception("order does not exist");
  40. }
  41. }