count = $count; $this->key = $key; } /** * Execute the job. * * @return void */ public function handle() { /** @var ForeignHaiRoboticsService $service */ $service = app("ForeignHaiRoboticsService"); if (!Cache::has($this->key))return; /** @var Collection $task */ list($task,$location) = Cache::get($this->key); if ($this->count!==$task->count())return; $dataToPost = $service->makeJson_move_multi($task, '缓存架入立架', $location); $controlSuccess = $service->controlHaiRobot($dataToPost,$task,'缓存架入立架'); $tIds = []; $task->each(function ($t)use(&$tIds){$tIds[] = $t->id;}); StationTaskMaterialBox::query()->where("id",$tIds) ->where("status","待处理")->update(['status' => $controlSuccess ? '处理中' : '异常']); Cache::forget($this->key); } }