ProcessCreateInstantBill.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. namespace App\Jobs;
  3. use App\Process;
  4. use App\Services\LogService;
  5. use App\Services\ProcessService;
  6. use Illuminate\Bus\Queueable;
  7. use Illuminate\Contracts\Queue\ShouldQueue;
  8. use Illuminate\Foundation\Bus\Dispatchable;
  9. use Illuminate\Queue\InteractsWithQueue;
  10. use Illuminate\Queue\SerializesModels;
  11. class ProcessCreateInstantBill implements ShouldQueue
  12. {
  13. use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
  14. protected $process;
  15. /**
  16. * Create a new job instance.
  17. *
  18. * @param Process $process
  19. * @return void
  20. */
  21. public function __construct(Process $process)
  22. {
  23. $this->process = $process;
  24. }
  25. /**
  26. * Execute the job.
  27. *
  28. * @param ProcessService $service
  29. * @return void
  30. */
  31. public function handle(ProcessService $service)
  32. {
  33. try{
  34. $service->createInstantBill($this->process);
  35. }catch (\Exception $e){
  36. LogService::log(__METHOD__,"ERROR-入库生成即时账单",$this->process->toJson()." | ".$e->getMessage());
  37. }
  38. }
  39. }