|
|
@ -4,6 +4,7 @@ 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; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import net.sf.json.JSONArray; |
|
|
@ -41,6 +42,7 @@ import org.nl.acs.opc.DeviceType; |
|
|
|
import org.nl.acs.task.service.TaskService; |
|
|
|
import org.nl.exception.BadRequestException; |
|
|
|
import org.nl.logger.BusinessLogger; |
|
|
|
import org.nl.modules.system.util.CodeUtil; |
|
|
|
import org.nl.start.auto.run.NDCSocketConnectionAutoRun; |
|
|
|
import org.nl.utils.SpringContextHolder; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
@ -354,6 +356,7 @@ public class AgvServiceImpl implements AgvService { |
|
|
|
JSONArray prija = new JSONArray(); |
|
|
|
prija.add(prijo); |
|
|
|
orderjo.put("properties", prija); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@ -1754,6 +1757,56 @@ 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 JSONObject createOrederData(Instruction inst, String inst_type) { |
|
|
|
String inst_code = inst.getInstruction_code(); |
|
|
@ -1964,6 +2017,7 @@ public class AgvServiceImpl implements AgvService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public HttpResponse resume() throws Exception { |
|
|
|
|
|
|
|