|
|
@@ -116,34 +116,17 @@ class StorageController extends Controller
|
|
|
$boxes = request("boxes");
|
|
|
//清理任务
|
|
|
$data = '';
|
|
|
- $station = Station::query()->select("id")->whereIn("code",$boxes);
|
|
|
- $occupy = Storage::query()->with("station:id,code")->whereIn("station_id",$station)->where("status",1)->get();
|
|
|
+ $occupy = Storage::query()->with("station:id,code")->whereIn("station_id",Station::query()->select("id")->whereIn("code",$boxes))->where("status",1)->get();
|
|
|
foreach ($occupy as $item){
|
|
|
unset($boxes[array_search($item->station->code,$boxes)]);
|
|
|
$data .= '“'.$item->station->code.'”,';
|
|
|
}
|
|
|
if ($occupy->count()>0){
|
|
|
- $data .= "存在任务待处理,无法释放";
|
|
|
+ $data .= "存在任务待处理,无法调取";
|
|
|
$boxes = array_values($boxes);
|
|
|
- $station = Station::query()->select("id")->whereIn("code",$boxes);
|
|
|
}
|
|
|
- //清除海柔信息,标记料箱为出库
|
|
|
- DB::connection("mysql_haiRobotics")->table("ks_bin")->whereIn("ks_bin_space_code",$boxes)
|
|
|
- ->where("status",1)->update([
|
|
|
- "ks_bin_space_code" => null,"ks_bin_space_id"=>null,"orig_ks_bin_space_code"=>null,"orig_ks_bin_space_id"=>null,
|
|
|
- "status"=>4,
|
|
|
- ]);
|
|
|
- $task = StationTask::query()->select("id")->where("status","!=",'完成')->whereIn("station_id",$station);
|
|
|
- StationTaskMaterialBox::query()->where("status","!=",'完成')->whereIn("station_task_id",$task)->update([
|
|
|
- "status" => "完成"
|
|
|
- ]);
|
|
|
- StationTask::query()->where("status","!=",'完成')->whereIn("station_id",$station)->update([
|
|
|
- "status" => "完成"
|
|
|
- ]);
|
|
|
- Storage::query()->whereIn("station_id",$station)->update([
|
|
|
- "status" => 1,
|
|
|
- "station_id" => null,
|
|
|
- ]);
|
|
|
+ //清理原有任务
|
|
|
+ app("StorageService")->clearTask($boxes);//TODO 改为机器人防置时触发 但需要阿君修改任务参数为指定格口而非整个缓存架
|
|
|
//重新调取料箱
|
|
|
$result = app("ForeignHaiRoboticsService")->paddingCacheShelf(Station::query()->whereIn("code",$boxes)->get());
|
|
|
if ($result===null)$this->error("任务下发错误,检查日志");
|