|
|
@ -1757,55 +1757,55 @@ public class AgvServiceImpl implements AgvService { |
|
|
|
return jo.toString(); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public HttpResponse chargingQuest(JSONObject json) { |
|
|
|
log.info("agvCode参数:{}", json); |
|
|
|
String inst_no = CodeUtil.getNewCode("INSTRUCT_NO"); |
|
|
|
if (ObjectUtil.isEmpty(json)){ |
|
|
|
throw new BadRequestException("agv编码为空!"); |
|
|
|
} |
|
|
|
String agv_code = json.getString("agv_code"); |
|
|
|
JSONArray ja = new JSONArray(); |
|
|
|
JSONObject orderjo = new JSONObject(); |
|
|
|
//指定agv车号
|
|
|
|
if (StrUtil.equals(agv_code,"1")){ |
|
|
|
orderjo.put("intendedVehicle", "HS 1#AGV"); |
|
|
|
}else if (StrUtil.equals(agv_code,"2")){ |
|
|
|
orderjo.put("intendedVehicle", "HS 2#AGV"); |
|
|
|
} |
|
|
|
JSONObject jo = new JSONObject(); |
|
|
|
//指定agv充电位置
|
|
|
|
jo.put("locationName", "Charge-100"); |
|
|
|
//指定agv操作码
|
|
|
|
jo.put("operation", "CHARGE"); |
|
|
|
ja.add(jo); |
|
|
|
orderjo.put("destinations",ja); |
|
|
|
System.out.println("orderjo的值:"+orderjo); |
|
|
|
log.info("下发agv指令参数:{}", orderjo.toString()); |
|
|
|
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; |
|
|
|
} |
|
|
|
// @Override
|
|
|
|
// public HttpResponse chargingQuest(JSONObject json) {
|
|
|
|
// log.info("agvCode参数:{}", json);
|
|
|
|
// String inst_no = CodeUtil.getNewCode("INSTRUCT_NO");
|
|
|
|
// if (ObjectUtil.isEmpty(json)){
|
|
|
|
// throw new BadRequestException("agv编码为空!");
|
|
|
|
// }
|
|
|
|
// String agv_code = json.getString("agv_code");
|
|
|
|
// JSONArray ja = new JSONArray();
|
|
|
|
// JSONObject orderjo = new JSONObject();
|
|
|
|
// //指定agv车号
|
|
|
|
// if (StrUtil.equals(agv_code,"1")){
|
|
|
|
// orderjo.put("intendedVehicle", "HS 1#AGV");
|
|
|
|
// }else if (StrUtil.equals(agv_code,"2")){
|
|
|
|
// orderjo.put("intendedVehicle", "HS 2#AGV");
|
|
|
|
// }
|
|
|
|
// JSONObject jo = new JSONObject();
|
|
|
|
// //指定agv充电位置
|
|
|
|
// jo.put("locationName", "Charge-100");
|
|
|
|
// //指定agv操作码
|
|
|
|
// jo.put("operation", "CHARGE");
|
|
|
|
// ja.add(jo);
|
|
|
|
// orderjo.put("destinations",ja);
|
|
|
|
// System.out.println("orderjo的值:"+orderjo);
|
|
|
|
// log.info("下发agv指令参数:{}", orderjo.toString());
|
|
|
|
// 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;
|
|
|
|
// }
|
|
|
|
|
|
|
|
@Override |
|
|
|
public JSONObject createOrederData(Instruction inst, String inst_type) { |
|
|
|