|
|
@ -7,6 +7,7 @@ import cn.hutool.core.map.MapUtil; |
|
|
|
import cn.hutool.core.util.IdUtil; |
|
|
|
import cn.hutool.core.util.ObjectUtil; |
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
import cn.hutool.http.HttpRequest; |
|
|
|
import cn.hutool.http.HttpResponse; |
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
@ -1627,4 +1628,46 @@ public class TaskServiceImpl implements TaskService, ApplicationAutoInitial { |
|
|
|
return num; |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public HttpResponse chargingQuest(String agvCode) { |
|
|
|
String inst_no = CodeUtil.getNewCode("INSTRUCT_NO"); |
|
|
|
if (StrUtil.isEmpty(agvCode)){ |
|
|
|
throw new BadRequestException("agv编码为空!"); |
|
|
|
} |
|
|
|
JSONArray ja = new JSONArray(); |
|
|
|
JSONObject orderjo = new JSONObject(); |
|
|
|
//指定agv车号
|
|
|
|
orderjo.put("intendedVehicle", agvCode); |
|
|
|
JSONObject jo = new JSONObject(); |
|
|
|
//指定agv充电位置
|
|
|
|
jo.put("locationName", "100"); |
|
|
|
//指定agv操作码
|
|
|
|
jo.put("operation", "Charge"); |
|
|
|
ja.add(jo); |
|
|
|
orderjo.put("destinations",ja); |
|
|
|
HttpResponse result = null; |
|
|
|
if (StrUtil.equals(acsConfigService.findConfigFromCache().get(AcsConfig.FORKAGV).toString(), "1")) { |
|
|
|
String agvurl = acsConfigService.findConfigFromCache().get(AcsConfig.AGVURL); |
|
|
|
String agvport = acsConfigService.findConfigFromCache().get(AcsConfig.AGVPORT); |
|
|
|
|
|
|
|
agvurl = agvurl + ":" + agvport + "/v1/transportOrders/" + inst_no; |
|
|
|
|
|
|
|
log.info("下发agv指令参数:{}", orderjo.toString()); |
|
|
|
|
|
|
|
try { |
|
|
|
result = HttpRequest.post(agvurl) |
|
|
|
.body(String.valueOf(orderjo))//表单内容
|
|
|
|
.timeout(20000)//超时,毫秒
|
|
|
|
.execute(); |
|
|
|
System.out.println(result); |
|
|
|
log.info("chargingQuest----返回参数{}", result); |
|
|
|
} catch (Exception e) { |
|
|
|
throw new RuntimeException("下发agv失败!"); |
|
|
|
} |
|
|
|
} else { |
|
|
|
throw new RuntimeException("系统参数未配置!"); |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|