RejectedBillCreateInstantBill.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. namespace App\Jobs;
  3. use App\Components\ErrorPush;
  4. use App\RejectedBill;
  5. use Illuminate\Bus\Queueable;
  6. use Illuminate\Contracts\Queue\ShouldQueue;
  7. use Illuminate\Foundation\Bus\Dispatchable;
  8. use Illuminate\Queue\InteractsWithQueue;
  9. class RejectedBillCreateInstantBill implements ShouldQueue
  10. {
  11. use Dispatchable, InteractsWithQueue, Queueable, ErrorPush;
  12. protected $rejected;
  13. /**
  14. * Create a new job instance.
  15. *
  16. * @return void
  17. *
  18. * @param RejectedBill $rejectedBill
  19. */
  20. public function __construct(RejectedBill $rejectedBill)
  21. {
  22. $this->rejected = $rejectedBill;
  23. }
  24. /**
  25. * Execute the job.
  26. *
  27. * @return void
  28. * @throws
  29. */
  30. public function handle()
  31. {
  32. try{
  33. app("RejectedBillService")->buildInstantBill($this->rejected);
  34. }catch(\Exception $exception){
  35. $this->push(__METHOD__."->".__LINE__,"退货单建立即时账单",$exception->getMessage()." | ".json_encode($this->rejected));
  36. }
  37. }
  38. }