Task.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. namespace App\Http\Controllers\api\thirdPart\syrius\beans;
  3. class Task extends \stdClass
  4. {
  5. const ORDER_PICKING = "ORDER_PICKING";
  6. const TOTAL_PICKING = "TOTAL_PICKING";
  7. const PUTAWAY = "PUTAWAY";
  8. public $id; //任务ID string
  9. //Optional
  10. public $batchId; //批次ID string
  11. //ENUM
  12. public $type; //任务类型 string
  13. //Optional:between(1,10) default:5
  14. public $priority; //优先级 string
  15. public $timestamp; //下达时间 int
  16. //Optional
  17. public $expectedExecutionTime; //预计执行时间 int
  18. //Optional
  19. public $expectedFinishTime; //预计完成时间 int
  20. public $warehouseId; //仓库ID string
  21. //Optional
  22. public $notifyUrl; //任务执行通知地址 string
  23. public $storages; //存储Storage对象示例:[{type:"",serialNo:""}] array
  24. public $attributes; //一些属性:{dischargeLocations:"",...},这里在初始传递时应为一个对象,通过内部转换为key-val数组
  25. public $items; //TaskItem array
  26. public function get(): Task
  27. {
  28. if (!$this->type)$this->type = self::TOTAL_PICKING;
  29. $this->timestamp = time();
  30. $this->notifyUrl = config("app.url")."/api/thirdPart/syrius/order/notification";
  31. if (!$this->storages)$this->storages = [];
  32. if (!$this->priority)unset($this->priority);
  33. if (!$this->expectedExecutionTime)unset($this->expectedExecutionTime);
  34. if (!$this->expectedFinishTime)unset($this->expectedFinishTime);
  35. return $this;
  36. }
  37. }