add:科冲接口新增
This commit is contained in:
@@ -11,6 +11,7 @@ import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.AcsConfig;
|
||||
import org.nl.acs.agv.server.dao.AgvResponse;
|
||||
import org.nl.acs.device.domain.Device;
|
||||
import org.nl.acs.device_driver.agv.xg_agv_car.XgAgvCarDeviceDriver;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
@@ -45,23 +46,27 @@ public class QueryAGVStatus {
|
||||
TaskService taskService = SpringContextHolder.getBean(TaskService.class);
|
||||
ISysParamService paramService = SpringContextHolder.getBean(ISysParamService.class);
|
||||
List<Instruction> allInstFromCache = instructionService.findAllInstFromCache();
|
||||
List<Instruction> agvInstruction = allInstFromCache.stream().filter(item -> AgvSystemTypeEnum.One_NDC_System_Type.getIndex().equals(item.getAgv_system_type()) || AgvSystemTypeEnum.XG_System_Type.getIndex().equals(item.getAgv_system_type())).collect(Collectors.toList());
|
||||
if (CollUtil.isEmpty(agvInstruction) || agvInstruction.size() < 1) {
|
||||
// List<Instruction> agvInstruction = allInstFromCache.stream().filter(item -> AgvSystemTypeEnum.One_NDC_System_Type.getIndex().equals(item.getAgv_system_type()) || AgvSystemTypeEnum.XG_System_Type.getIndex().equals(item.getAgv_system_type())).collect(Collectors.toList());
|
||||
if (CollUtil.isEmpty(allInstFromCache) || allInstFromCache.size() < 1) {
|
||||
return;
|
||||
}
|
||||
for (Instruction instruction : agvInstruction) {
|
||||
for (Instruction instruction : allInstFromCache) {
|
||||
String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue();
|
||||
String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue();
|
||||
JSONObject param = new JSONObject();
|
||||
agvurl = agvurl + ":" + agvport + "/orderDetails/" + instruction.getInstruction_code();
|
||||
agvurl = agvurl + ":" + agvport + "/api/fms/taskStatus ";
|
||||
param.put("TaskNo", instruction.getInstruction_code());
|
||||
log.info("根据运单号查询运单状态的请求:{}", agvurl);
|
||||
HttpResponse result = HttpRequest.get(agvurl)
|
||||
.body(String.valueOf(param))
|
||||
.timeout(20000)//超时,毫秒
|
||||
.execute();
|
||||
log.info("根据运单号查询运单状态的请求反馈:{}", result);
|
||||
String body = result.body();
|
||||
JSONObject json = JSONObject.parseObject(body);
|
||||
if (result.getStatus() == 200 && json.getString("id").equals(instruction.getInstruction_code())) {
|
||||
JSONObject taskStatus = json.getJSONObject("TaskStatus");
|
||||
String taskNo = taskStatus.getString("TaskNo");
|
||||
if ("true".equals(json.getString("Result")) && taskNo.equals(instruction.getInstruction_code())) {
|
||||
// 已创建=CREATED,
|
||||
// 待分配=TOBEDISPATCHED,
|
||||
// 正在执行=RUNNING,
|
||||
@@ -71,10 +76,10 @@ public class QueryAGVStatus {
|
||||
// 无法执行=Error(参数错误),
|
||||
// 等待=WAITING
|
||||
//执行中
|
||||
String state = json.getString("state");
|
||||
String carNo = json.getString("vehicle");
|
||||
String state = json.getString("Status");
|
||||
String carNo = json.getString("VehicleNo");
|
||||
String instructionCode = json.getString("id");
|
||||
if ("RUNNING".equals(state) || "TOBEDISPATCHED".equals(state) || "WAITING".equals(state)) {
|
||||
if ("running".equals(state)) {
|
||||
if ("1".equals(instruction.getInstruction_status())) {
|
||||
instruction.setCarno(carNo);
|
||||
TaskDto task = new TaskDto();
|
||||
@@ -83,19 +88,19 @@ public class QueryAGVStatus {
|
||||
task.setTask_id(instruction.getTask_id());
|
||||
instructionService.update(instruction);
|
||||
taskService.update(task);
|
||||
if (StrUtil.isNotEmpty(instructionCode)) {
|
||||
Device carCode = deviceAppService.findDeviceByCode(instructionCode);
|
||||
XgAgvCarDeviceDriver xgAgvCarDeviceDriver;
|
||||
if (null != carCode) {
|
||||
if (carCode.getDeviceDriver() instanceof XgAgvCarDeviceDriver) {
|
||||
xgAgvCarDeviceDriver = (XgAgvCarDeviceDriver) carCode.getDeviceDriver();
|
||||
xgAgvCarDeviceDriver.setTaskType(AgvActionTypeEnum.getStatus(instruction.getAgv_action_type()));
|
||||
}
|
||||
}
|
||||
}
|
||||
// if (StrUtil.isNotEmpty(instructionCode)) {
|
||||
// Device carCode = deviceAppService.findDeviceByCode(instructionCode);
|
||||
// XgAgvCarDeviceDriver xgAgvCarDeviceDriver;
|
||||
// if (null != carCode) {
|
||||
// if (carCode.getDeviceDriver() instanceof XgAgvCarDeviceDriver) {
|
||||
// xgAgvCarDeviceDriver = (XgAgvCarDeviceDriver) carCode.getDeviceDriver();
|
||||
// xgAgvCarDeviceDriver.setTaskType(AgvActionTypeEnum.getStatus(instruction.getAgv_action_type()));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
} else if ("FINISHED".equals(state)) {
|
||||
} else if ("finish".equals(state)) {
|
||||
if (!"2".equals(instruction.getInstruction_status())) {
|
||||
instruction.setInstruction_status("2");
|
||||
try {
|
||||
@@ -105,7 +110,7 @@ public class QueryAGVStatus {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
} else if ("STOPPED".equals(state) || "FAILED".equals(state) || "Error".equals(state)) {
|
||||
} else if ("paused".equals(state) || "aborted".equals(state) || "Error".equals(state)) {
|
||||
if (!"1".equals(instruction.getInstruction_status())) {
|
||||
instruction.setInstruction_status("1");
|
||||
instructionService.update(instruction);
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package org.nl.acs.agv.rest;
|
||||
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.agv.server.KeCongAgvService;
|
||||
import org.nl.acs.agv.server.dao.AgvResponse;
|
||||
import org.nl.common.logging.annotation.Log;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@RestController
|
||||
@RequiredArgsConstructor
|
||||
|
||||
@RequestMapping("/api/fms")
|
||||
@Slf4j
|
||||
public class KeCongAgvController {
|
||||
private final KeCongAgvService keCongAgvService;
|
||||
|
||||
@PostMapping("/waitPointRequest")
|
||||
@Log("等待点请求")
|
||||
@SaIgnore
|
||||
public ResponseEntity<AgvResponse> waitPointRequest(@RequestBody JSONObject requestParam) {
|
||||
return new ResponseEntity<>(keCongAgvService.xgAGVWaitPointRequest(requestParam), HttpStatus.OK);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/requestResource")
|
||||
@Log("请求资源")
|
||||
@SaIgnore
|
||||
public ResponseEntity<AgvResponse> requestResource(@RequestBody JSONObject requestParam) {
|
||||
return new ResponseEntity<>(keCongAgvService.requestResource(requestParam), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@PostMapping("/releaseResource")
|
||||
@Log("释放资源")
|
||||
@SaIgnore
|
||||
public ResponseEntity<AgvResponse> releaseResource(@RequestBody JSONObject requestParam) {
|
||||
return new ResponseEntity<>(keCongAgvService.releaseResource(requestParam), HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package org.nl.acs.agv.server;
|
||||
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.nl.acs.agv.server.dao.AgvResponse;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
|
||||
public interface KeCongAgvService {
|
||||
|
||||
/**
|
||||
* 下发运单序列
|
||||
*
|
||||
* @param inst
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public HttpResponse addTask(Instruction inst) throws Exception;
|
||||
|
||||
|
||||
/**
|
||||
* 查询AGV任务状态
|
||||
* @param instCode
|
||||
* @return
|
||||
*/
|
||||
public HttpResponse queryKZAgvInstStatus(String instCode);
|
||||
|
||||
/**
|
||||
* 查询AGV状态
|
||||
* @param vehicleCode
|
||||
* @return
|
||||
*/
|
||||
public HttpResponse queryKZAgvStatus(String vehicleCode);
|
||||
|
||||
AgvResponse xgAGVWaitPointRequest(JSONObject requestParam);
|
||||
|
||||
public AgvResponse updateKZAgvInst(JSONObject requestParam);
|
||||
|
||||
AgvResponse requestResource(JSONObject requestParam);
|
||||
|
||||
AgvResponse releaseResource(JSONObject requestParam);
|
||||
|
||||
HttpResponse getRobotInfo(String robotCode);
|
||||
|
||||
/**
|
||||
* 更新任务状态
|
||||
* @param instCode
|
||||
* @return
|
||||
*/
|
||||
// public JSONObject updateKZAgvInstStatus(String instCode);
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package org.nl.acs.agv.server.dao;
|
||||
|
||||
public class AgvRequest {
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package org.nl.acs.agv.server.dao;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class AgvResponse {
|
||||
private int ErrCode;
|
||||
|
||||
private String ErrMsg;
|
||||
|
||||
private String result;//Result: true;
|
||||
}
|
||||
@@ -0,0 +1,346 @@
|
||||
package org.nl.acs.agv.server.impl;
|
||||
|
||||
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.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.AcsConfig;
|
||||
import org.nl.acs.agv.server.KeCongAgvService;
|
||||
import org.nl.acs.agv.server.MagicAgvService;
|
||||
import org.nl.acs.agv.server.dao.AgvResponse;
|
||||
import org.nl.acs.common.base.CommonFinalParam;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.common.exception.BadRequestException;
|
||||
import org.nl.config.lucene.service.LuceneExecuteLogService;
|
||||
import org.nl.config.lucene.service.dto.LuceneLogDto;
|
||||
import org.nl.system.service.param.ISysParamService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class KeCongAgvServiceImpl implements KeCongAgvService {
|
||||
|
||||
@Autowired
|
||||
private LuceneExecuteLogService luceneExecuteLogService;
|
||||
@Autowired
|
||||
private InstructionService instructionService;
|
||||
private final ISysParamService paramService;
|
||||
|
||||
@Override
|
||||
public HttpResponse addTask(Instruction inst) throws Exception {
|
||||
JSONObject jo = new JSONObject();
|
||||
JSONArray arr = new JSONArray();
|
||||
jo.put("TaskType", inst.getInstruction_type());
|
||||
JSONObject json1 = new JSONObject();
|
||||
json1.put("Key", "TaskId");
|
||||
json1.put("Value", inst.getInstruction_code());
|
||||
arr.add(json1);
|
||||
JSONObject json2 = new JSONObject();
|
||||
json2.put("Key", "VehicleNo");
|
||||
json2.put("Value", "3");
|
||||
arr.add(json2);
|
||||
JSONObject json3 = new JSONObject();
|
||||
json3.put("Key", "point1");
|
||||
json3.put("Value", inst.getStart_device_code());
|
||||
arr.add(json3);
|
||||
JSONObject json4 = new JSONObject();
|
||||
json4.put("Key", "point2");
|
||||
json4.put("Value", inst.getNext_device_code());
|
||||
arr.add(json4);
|
||||
if ("任务1" .equals(inst.getInstruction_type())) {
|
||||
JSONObject json5 = new JSONObject();
|
||||
json5.put("Key", "point3");
|
||||
json5.put("Value", inst.getStart_device_code2());
|
||||
arr.add(json5);
|
||||
JSONObject json6 = new JSONObject();
|
||||
json6.put("Key", "point4");
|
||||
json6.put("Value", inst.getNext_device_code2());
|
||||
arr.add(json6);
|
||||
} else if ("任务11" .equals(inst.getInstruction_type())) {
|
||||
JSONObject json5 = new JSONObject();
|
||||
json5.put("Key", "isget");
|
||||
json5.put("Value", "0");
|
||||
arr.add(json5);
|
||||
} else if ("任务12" .equals(inst.getInstruction_type())) {
|
||||
JSONObject json6 = new JSONObject();
|
||||
json6.put("Key", "isput");
|
||||
json6.put("Value", "0");
|
||||
arr.add(json6);
|
||||
} else if ("任务13" .equals(inst.getInstruction_type())) {
|
||||
JSONObject json5 = new JSONObject();
|
||||
json5.put("Key", "isget");
|
||||
json5.put("Value", "0");
|
||||
arr.add(json5);
|
||||
JSONObject json6 = new JSONObject();
|
||||
json6.put("Key", "isput");
|
||||
json6.put("Value", "0");
|
||||
arr.add(json6);
|
||||
}
|
||||
jo.put("Params", arr);
|
||||
System.out.println(jo);
|
||||
LuceneLogDto logDto = LuceneLogDto.builder()
|
||||
.device_code("下发科聪任务")
|
||||
.content("任务号:" + inst.getTask_code() + ",指令号:" + inst.getInstruction_code() + ",下发agv任务序列参数:" + jo)
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto);
|
||||
log.info("任务号:{},指令号{},下发科聪任务序列参数:{}", inst.getTask_code(), inst.getInstruction_code(), jo);
|
||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).
|
||||
|
||||
getValue(), CommonFinalParam.ONE)) {
|
||||
String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue();
|
||||
String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue();
|
||||
|
||||
agvurl = agvurl + ":" + agvport + "/api/fms/addTaskV2";
|
||||
|
||||
log.info(agvurl);
|
||||
HttpResponse result = HttpRequest.post(agvurl)
|
||||
//表单内容
|
||||
.body(String.valueOf(jo))
|
||||
//超时,毫秒
|
||||
.timeout(20000)
|
||||
.execute();
|
||||
LuceneLogDto logDto1 = LuceneLogDto.builder()
|
||||
.device_code("下发科聪任务")
|
||||
.content("任务号:" + inst.getTask_code() + ",指令号:" + inst.getInstruction_code() + ",下发科聪任务序列反馈参数:" + jo)
|
||||
.build();
|
||||
logDto.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto1);
|
||||
log.info("任务号:{},指令号{},状态{},下发agv订单序列反馈:{}", inst.getTask_code(), inst.getInstruction_code(), result.getStatus(), result.body());
|
||||
|
||||
return result;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public HttpResponse queryKZAgvInstStatus(String instCode) {
|
||||
|
||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), CommonFinalParam.ONE)) {
|
||||
String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue();
|
||||
String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue();
|
||||
|
||||
agvurl = agvurl + ":" + agvport + "/api/fms/taskStatus/" + instCode;
|
||||
|
||||
HttpResponse result = HttpRequest.get(agvurl)
|
||||
//超时,毫秒
|
||||
.timeout(20000)
|
||||
.execute();
|
||||
System.out.println("查询agv指令数据:" + result.body());
|
||||
|
||||
return result;
|
||||
} else {
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResponse queryKZAgvStatus(String vehicleCode) {
|
||||
|
||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), CommonFinalParam.ONE)) {
|
||||
String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue();
|
||||
String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue();
|
||||
|
||||
agvurl = agvurl + ":" + agvport + "/api/fms/vehicleStatus/" + vehicleCode;
|
||||
|
||||
HttpResponse result = HttpRequest.get(agvurl)
|
||||
//超时,毫秒
|
||||
.timeout(20000)
|
||||
.execute();
|
||||
System.out.println("查询agv数据:" + result.body());
|
||||
|
||||
return result;
|
||||
} else {
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AgvResponse xgAGVWaitPointRequest(JSONObject requestParam) {
|
||||
System.out.println("请求kc参数:" + requestParam);
|
||||
String taskId = requestParam.getString("TaskId");
|
||||
String type = requestParam.getString("type"); // 1 取货点等待 2 放货点等待
|
||||
Instruction inst = instructionService.findByCodeFromCache(taskId);
|
||||
if (ObjectUtil.isEmpty(inst)) {
|
||||
throw new BadRequestException("请求失败,未找到指令!");
|
||||
}
|
||||
JSONObject jo = new JSONObject();
|
||||
JSONArray arr = new JSONArray();
|
||||
jo.put("TaskNo", taskId);
|
||||
if ("任务11" .equals(inst.getInstruction_type())) {
|
||||
//todo :需要跟上位申请新的点位
|
||||
JSONObject json1 = new JSONObject();
|
||||
json1.put("Name", "point1");
|
||||
json1.put("Value", "3");
|
||||
arr.add(json1);
|
||||
} else if ("任务12" .equals(inst.getInstruction_type())) {
|
||||
//todo :需要跟上位申请新的点位
|
||||
JSONObject json1 = new JSONObject();
|
||||
json1.put("Name", "point2");
|
||||
json1.put("Value", "4");
|
||||
arr.add(json1);
|
||||
} else if ("任务13" .equals(inst.getInstruction_type())) {
|
||||
if ("1" .equals(type)) {
|
||||
//todo :需要跟上位申请新的点位
|
||||
JSONObject json1 = new JSONObject();
|
||||
json1.put("Name", "point1");
|
||||
json1.put("Value", "1");
|
||||
arr.add(json1);
|
||||
} else if ("2" .equals(type)) {
|
||||
//todo :需要跟上位申请新的点位
|
||||
JSONObject json1 = new JSONObject();
|
||||
json1.put("Name", "point2");
|
||||
json1.put("Value", "1");
|
||||
arr.add(json1);
|
||||
}
|
||||
}
|
||||
if ("任务11" .equals(inst.getInstruction_type())) {
|
||||
JSONObject json2 = new JSONObject();
|
||||
json2.put("Name", "isget");
|
||||
json2.put("Value", "1");
|
||||
arr.add(json2);
|
||||
} else if ("任务12" .equals(inst.getInstruction_type())) {
|
||||
JSONObject json2 = new JSONObject();
|
||||
json2.put("Name", "isput");
|
||||
json2.put("Value", "1");
|
||||
arr.add(json2);
|
||||
} else if ("任务13" .equals(inst.getInstruction_type())) {
|
||||
if ("1" .equals(type)) {
|
||||
JSONObject json3 = new JSONObject();
|
||||
json3.put("Name", "isget");
|
||||
json3.put("Value", "1");
|
||||
arr.add(json3);
|
||||
} else if ("2" .equals(type)) {
|
||||
JSONObject json2 = new JSONObject();
|
||||
json2.put("Name", "isput");
|
||||
json2.put("Value", "1");
|
||||
arr.add(json2);
|
||||
}
|
||||
}
|
||||
jo.put("Params", arr);
|
||||
String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue();
|
||||
String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue();
|
||||
|
||||
//更新任务参数
|
||||
agvurl = agvurl + ":" + agvport + "/api/fms/updateTaskParam";
|
||||
|
||||
log.info(agvurl);
|
||||
HttpResponse result = HttpRequest.post(agvurl)
|
||||
//表单内容
|
||||
.body(String.valueOf(jo))
|
||||
//超时,毫秒
|
||||
.timeout(20000)
|
||||
.execute();
|
||||
LuceneLogDto logDto1 = LuceneLogDto.builder()
|
||||
.device_code("下发科聪任务")
|
||||
.content("任务号:" + inst.getTask_code() + ",指令号:" + inst.getInstruction_code() + ",下发科聪任务序列反馈参数:" + jo)
|
||||
.build();
|
||||
logDto1.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto1);
|
||||
log.info("任务号:{},指令号{},状态{},下发agv订单序列反馈:{}", inst.getTask_code(), inst.getInstruction_code(), result.getStatus(), result.body());
|
||||
JSONObject jsonObject = null;
|
||||
if (ObjectUtil.isNotEmpty(result)) {
|
||||
String body = result.body();
|
||||
jsonObject = JSONObject.parseObject(body);
|
||||
if (ObjectUtil.isNotNull(jsonObject) && "true" .equals(jsonObject.getString("Result"))) {
|
||||
AgvResponse agvResponse = new AgvResponse();
|
||||
agvResponse.setResult("true");
|
||||
agvResponse.setErrMsg("");
|
||||
return agvResponse;
|
||||
} else {
|
||||
AgvResponse agvResponse = new AgvResponse();
|
||||
agvResponse.setResult("false");
|
||||
agvResponse.setErrMsg("");
|
||||
return agvResponse;
|
||||
}
|
||||
} else {
|
||||
AgvResponse agvResponse = new AgvResponse();
|
||||
agvResponse.setResult("false");
|
||||
agvResponse.setErrMsg("");
|
||||
return agvResponse;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AgvResponse updateKZAgvInst(JSONObject requestParam) {
|
||||
// JSONObject ja = new JSONObject();
|
||||
// ja.put("Key","Result");
|
||||
// ja.put("Value","true");
|
||||
|
||||
AgvResponse agvResponse = new AgvResponse();
|
||||
agvResponse.setResult("true");
|
||||
agvResponse.setErrMsg("");
|
||||
return agvResponse;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AgvResponse requestResource(JSONObject requestParam) {
|
||||
//todo: 延迟十秒
|
||||
AgvResponse agvResponse = new AgvResponse();
|
||||
agvResponse.setResult("true");
|
||||
agvResponse.setErrMsg("请求失败");
|
||||
return agvResponse;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AgvResponse releaseResource(JSONObject requestParam) {
|
||||
AgvResponse agvResponse = new AgvResponse();
|
||||
agvResponse.setResult("true");
|
||||
agvResponse.setErrMsg("请求失败");
|
||||
return agvResponse;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResponse getRobotInfo(String robotCode) {
|
||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), "1")) {
|
||||
String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue();
|
||||
String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue();
|
||||
|
||||
agvurl = agvurl + ":" + agvport + "/" + "robotsStatus?vehicles=" + robotCode;
|
||||
log.info("根据指定机器人查询状态的请求:{}", agvurl);
|
||||
JSONObject param = new JSONObject();
|
||||
param.put("VehicleNo", robotCode);
|
||||
HttpResponse result = HttpRequest.get(agvurl)
|
||||
.body(String.valueOf(param))
|
||||
.timeout(20000)//超时,毫秒
|
||||
.execute();
|
||||
log.info("根据指定机器人查询状态的请求反馈:{}", result);
|
||||
return result;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public JSONObject updateKZAgvInstStatus(String instCode) {
|
||||
// if (StrUtil.equals(paramService.findByCode(AcsConfig.FORKAGV).getValue(), CommonFinalParam.ONE)) {
|
||||
// String agvurl = paramService.findByCode(AcsConfig.AGVURL).getValue();
|
||||
// String agvport = paramService.findByCode(AcsConfig.AGVPORT).getValue();
|
||||
//
|
||||
// agvurl = agvurl + ":" + agvport + "/api/fms/updateTaskParam";
|
||||
//
|
||||
// HttpResponse result = HttpRequest.get(agvurl)
|
||||
// //超时,毫秒
|
||||
// .timeout(20000)
|
||||
// .execute();
|
||||
// System.out.println("查询agv数据:" + result.body());
|
||||
//
|
||||
// return result;
|
||||
// } else {
|
||||
//
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package org.nl.acs.device_driver.agv.kc_agv;
|
||||
|
||||
import org.nl.acs.device.domain.Device;
|
||||
import org.nl.acs.device.enums.DeviceType;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.DeviceDriverDefination;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class KcagvDefination implements DeviceDriverDefination {
|
||||
@Override
|
||||
public String getDriverCode() {
|
||||
return "kc_agv";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDriverName() {
|
||||
return "科聪AGV车";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDriverDescription() {
|
||||
return "科聪AGV车";
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceDriver getDriverInstance(Device device) {
|
||||
return (new KcagvDeviceDriver()).setDevice(device).setDriverDefination(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends DeviceDriver> getDeviceDriverType() {
|
||||
return KcagvDeviceDriver.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeviceType> getFitDeviceTypes() {
|
||||
List<DeviceType> types = new LinkedList();
|
||||
types.add(DeviceType.agv);
|
||||
return types;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,255 @@
|
||||
package org.nl.acs.device_driver.agv.kc_agv;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.nl.acs.agv.server.NDCAgvService;
|
||||
import org.nl.acs.common.base.CommonFinalParam;
|
||||
import org.nl.acs.device.service.DeviceService;
|
||||
import org.nl.acs.device_driver.DeviceDriver;
|
||||
import org.nl.acs.device_driver.RouteableDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.AbstractDeviceDriver;
|
||||
import org.nl.acs.device_driver.driver.ExecutableDeviceDriver;
|
||||
import org.nl.acs.ext.wms.service.AcsToWmsService;
|
||||
import org.nl.acs.ext.wms.service.impl.AcsToWmsServiceImpl;
|
||||
import org.nl.acs.instruction.domain.Instruction;
|
||||
import org.nl.acs.instruction.service.InstructionService;
|
||||
import org.nl.acs.log.service.DeviceExecuteLogService;
|
||||
import org.nl.acs.monitor.DeviceStageMonitor;
|
||||
import org.nl.acs.opc.DeviceAppService;
|
||||
import org.nl.acs.route.service.RouteLineService;
|
||||
import org.nl.acs.task.service.TaskService;
|
||||
import org.nl.config.SpringContextHolder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@Data
|
||||
@RequiredArgsConstructor
|
||||
public class KcagvDeviceDriver extends AbstractDeviceDriver implements DeviceDriver, ExecutableDeviceDriver, RouteableDeviceDriver, DeviceStageMonitor {
|
||||
@Autowired
|
||||
DeviceAppService deviceAppservice = SpringContextHolder.getBean(DeviceAppService.class);
|
||||
@Autowired
|
||||
InstructionService instructionService = SpringContextHolder.getBean("instructionServiceImpl");
|
||||
@Autowired
|
||||
DeviceService deviceservice = SpringContextHolder.getBean("deviceServiceImpl");
|
||||
@Autowired
|
||||
RouteLineService routelineserver = SpringContextHolder.getBean("routeLineServiceImpl");
|
||||
@Autowired
|
||||
TaskService taskserver = SpringContextHolder.getBean("taskServiceImpl");
|
||||
@Autowired
|
||||
RouteLineService routeLineService = SpringContextHolder.getBean(RouteLineService.class);
|
||||
@Autowired
|
||||
AcsToWmsService acsToWmsService = SpringContextHolder.getBean(AcsToWmsServiceImpl.class);
|
||||
@Autowired
|
||||
DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class);
|
||||
@Autowired
|
||||
NDCAgvService agvService = SpringContextHolder.getBean(NDCAgvService.class);
|
||||
|
||||
Integer hasGoods = 0;
|
||||
int error = 0;
|
||||
Boolean iserror = false;
|
||||
Boolean islock = false;
|
||||
|
||||
int branchProtocol = 0;
|
||||
int last_branchProtocol = 0;
|
||||
/**
|
||||
* 是否需要输入物料
|
||||
*/
|
||||
String input_material = "0";
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
String remark = "";
|
||||
/**
|
||||
* 数量
|
||||
*/
|
||||
String qty = "";
|
||||
/**
|
||||
* 批次
|
||||
*/
|
||||
String batch = "";
|
||||
/**
|
||||
* 物料
|
||||
*/
|
||||
String material = "";
|
||||
/**
|
||||
* 目标点位
|
||||
*/
|
||||
String purpose = "";
|
||||
/**
|
||||
* 当前指令
|
||||
*/
|
||||
Instruction inst = null;
|
||||
/**
|
||||
* 上次指令
|
||||
*/
|
||||
Instruction last_inst = null;
|
||||
|
||||
boolean requireSucess = false;
|
||||
|
||||
/**
|
||||
* 触摸屏手动触发任务
|
||||
*/
|
||||
private Boolean is_has_task = false;
|
||||
|
||||
/**
|
||||
* 申请搬运任务
|
||||
*/
|
||||
private Boolean apply_handling = false;
|
||||
/**
|
||||
* 申请物料
|
||||
*/
|
||||
private Boolean apply_material = false;
|
||||
|
||||
/**
|
||||
* 1取货完成 2放货完成 3进入区域 4离开区域
|
||||
*/
|
||||
private int flag;
|
||||
|
||||
/**
|
||||
* 人工确认信号 默认0 agv到达后请求置1 等人工确认后变为2 反馈agv后继续为0
|
||||
*/
|
||||
private int manua_confirm = 0;
|
||||
|
||||
/**
|
||||
* 是否推送场景的状态 0=可推送 1=正在更新场景 2=正在执行运单
|
||||
*/
|
||||
private String upload_scene_status = "";
|
||||
/**
|
||||
* 机器人当前运单
|
||||
*/
|
||||
private String current_order = "";
|
||||
/**
|
||||
* 机器人连接状态 0表示断连 1表示连接上
|
||||
*/
|
||||
private String connection_status = "";
|
||||
/**
|
||||
* 机器人可接单状态 true=可接单 false=不可接单
|
||||
*/
|
||||
private boolean dispatchable = false;
|
||||
/**
|
||||
* core出错标识
|
||||
*/
|
||||
private boolean is_error = false;
|
||||
/**
|
||||
* 是否正在执行用户下发的运单
|
||||
*/
|
||||
private boolean procBusiness = false;
|
||||
/**
|
||||
* 机器人当前地图不在场景中
|
||||
*/
|
||||
private boolean current_map_invalid = false;
|
||||
/**
|
||||
* 机器人是否断连
|
||||
*/
|
||||
private boolean disconnect = false;
|
||||
/**
|
||||
* 1 = api 设置可接单,2 = api 设置不可接单(小车占用资源), 3 = api 设置不可接单(小车不占用资源)
|
||||
*/
|
||||
private int dispatchable_status = 0;
|
||||
/**
|
||||
* 低电量
|
||||
*/
|
||||
private boolean low_battery = false;
|
||||
/**
|
||||
* 暂停运单
|
||||
*/
|
||||
private boolean suspended = false;
|
||||
/**
|
||||
* 未确认定位
|
||||
*/
|
||||
private boolean unconfirmed_reloc = false;
|
||||
/**
|
||||
* 0: 控制权在core手上 1; 控制权被其他人抢走; 2: 控制权没有被抢占
|
||||
*/
|
||||
private int unlock = 0;
|
||||
|
||||
/**
|
||||
* agv二次分配类型(1、普通任务 2、取货二次分配 3、防货二次分配 4、取放货二次分配)
|
||||
*/
|
||||
private String taskType = "";
|
||||
|
||||
|
||||
String device_code = null;
|
||||
String container;
|
||||
String container_type_desc;
|
||||
String last_container_type_desc;
|
||||
String last_container;
|
||||
private Date instruction_require_time = new Date();
|
||||
private Date instruction_finished_time = new Date();
|
||||
|
||||
private int instruction_require_time_out;
|
||||
|
||||
String message;
|
||||
|
||||
// 1 上位系统允许进入 2 上位系统允许离开
|
||||
int status = 0;
|
||||
|
||||
int agvphase = 0;
|
||||
int index = 0;
|
||||
|
||||
int mode = 2;
|
||||
|
||||
int move;
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
try {
|
||||
// getAgvStatus();
|
||||
} catch (Exception e) {
|
||||
message = "获取机器人状态报错";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public JSONObject getDeviceStatusName() {
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
// try {
|
||||
// getAgvStatus();
|
||||
// } catch (Exception e) {
|
||||
// message = "获取机器人状态报错";
|
||||
// }
|
||||
String isError;
|
||||
if (is_error) {
|
||||
isError = "出错,不执行任何运单";
|
||||
} else {
|
||||
isError = "正常";
|
||||
}
|
||||
if (CommonFinalParam.ONE.equals(upload_scene_status)) {
|
||||
upload_scene_status = "正在更新场景";
|
||||
} else if (CommonFinalParam.TWO.equals(upload_scene_status)) {
|
||||
upload_scene_status = "正在执行运单";
|
||||
} else if (CommonFinalParam.DELETE.equals(upload_scene_status)) {
|
||||
upload_scene_status = "可推送";
|
||||
}
|
||||
map.put("errors", isError);
|
||||
map.put("upload_scene_status", upload_scene_status);
|
||||
map.put("procBusiness", procBusiness ? "是": "否");
|
||||
// map.put("current_order", current_order);
|
||||
map.put("connection_status", "1".equals(connection_status) ? "连接上" : "断连");
|
||||
map.put("dispatchable", dispatchable ? "可接单" : "不可接单");
|
||||
map.put("dispatchable_status", dispatchable_status == 1?"设置可接单" : dispatchable_status == 2?"设置不可接单(小车占用资源)" : dispatchable_status == 3?"设置不可接单(小车不占用资源)" : "未知");
|
||||
map.put("current_map_invalid", current_map_invalid ? "机器人不在地图场景中": "机器人在地图场景中");
|
||||
map.put("disconnect", disconnect ? "机器人断连" : "机器人连接上");
|
||||
map.put("low_battery", low_battery ? "低电量": "正常");
|
||||
map.put("suspended", suspended ? "订单被暂停,需要人工手动恢复": "正常");
|
||||
map.put("message", message);
|
||||
map.put("agv_task_type", taskType);
|
||||
map.put("unconfirmed_reloc", unconfirmed_reloc ? "未确认定位" : "正常");
|
||||
map.put("unlock", unlock == 0 ? "控制权在core手上" : unlock == 1 ? "控制权被其他人抢走" : unlock == 2 ? "控制权没有被抢占" : "未知");
|
||||
map.put("move_2","有货");
|
||||
JSONObject jo = new JSONObject(map);
|
||||
return jo;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setDeviceStatus(JSONObject data) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,7 @@ import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapp
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.nl.acs.AcsConfig;
|
||||
import org.nl.acs.agv.server.KeCongAgvService;
|
||||
import org.nl.acs.agv.server.MagicAgvService;
|
||||
import org.nl.acs.agv.server.NDCAgvService;
|
||||
import org.nl.acs.agv.server.XianGongAgvService;
|
||||
@@ -121,6 +122,8 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
private LimitRegionalService limitRegionalService;
|
||||
@Autowired
|
||||
private LuceneExecuteLogService luceneExecuteLogService;
|
||||
@Autowired
|
||||
private KeCongAgvService keCongAgvService;
|
||||
|
||||
private List<Instruction> instructions = new CopyOnWriteArrayList();
|
||||
|
||||
@@ -456,37 +459,24 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
if (ObjectUtils.isEmpty(shortPathsList)) {
|
||||
throw new Exception(dto.getStart_device_code() + "->" + dto.getNext_device_code() + "路由不通");
|
||||
}
|
||||
if (StrUtil.equals(shortPathsList.get(0).getType(), CommonFinalParam.ONE)) {
|
||||
throw new BadRequestException(dto.getStart_device_code() + "->" + dto.getNext_device_code() + "路由类型不是agv类型");
|
||||
}
|
||||
// if (StrUtil.equals(shortPathsList.get(0).getType(), CommonFinalParam.ONE)) {
|
||||
// throw new BadRequestException(dto.getStart_device_code() + "->" + dto.getNext_device_code() + "路由类型不是agv类型");
|
||||
// }
|
||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "2")) {
|
||||
NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvService.class);
|
||||
ndcAgvService.sendAgvInstToNDC(task.getAgv_system_type(), dto);
|
||||
}
|
||||
//判断是否是仙工AGV
|
||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "3")) {
|
||||
|
||||
if (dto.getAgv_system_type().equals(AgvSystemTypeEnum.XG_System_Type.getIndex())) {
|
||||
String interactionJson = task.getInteraction_json();
|
||||
if (StrUtil.isEmpty(interactionJson)) {
|
||||
throw new BadRequestException("agv叉车调整长宽参数为空");
|
||||
}
|
||||
InteractionJsonDTO interactionJsonDTO = JSON.parseObject(interactionJson, InteractionJsonDTO.class);
|
||||
//仙工叉车
|
||||
HttpResponse response = xiangGongAgvService.sendOrderSequencesToForklift(dto, interactionJsonDTO);
|
||||
if (ObjectUtils.isEmpty(response) || response.getStatus() != 200) {
|
||||
dto.setSend_status("2");
|
||||
} else {
|
||||
dto.setSend_status("1");
|
||||
}
|
||||
} else if (dto.getAgv_system_type().equals(AgvSystemTypeEnum.One_NDC_System_Type.getIndex())) {
|
||||
//一楼agv任务创建运单序列
|
||||
HttpResponse response = xiangGongAgvService.sendOrderSequencesToXZ(dto);
|
||||
if (ObjectUtils.isEmpty(response) || response.getStatus() != 200) {
|
||||
dto.setSend_status("2");
|
||||
} else {
|
||||
dto.setSend_status("1");
|
||||
}
|
||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "5")) {
|
||||
HttpResponse response = keCongAgvService.addTask(dto);
|
||||
JSONObject jsonObject = null;
|
||||
if (ObjectUtil.isNotEmpty(response)) {
|
||||
String body = response.body();
|
||||
jsonObject = JSONObject.parseObject(body);
|
||||
}
|
||||
if (ObjectUtil.isNotNull(jsonObject) && "true" .equals(jsonObject.getString("Result"))) {
|
||||
dto.setSend_status("1");
|
||||
} else {
|
||||
dto.setSend_status("2");
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
@@ -620,47 +610,17 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
|
||||
}
|
||||
|
||||
//判断是否是仙工AGV
|
||||
if (shortPathsList.size() > 0 && StrUtil.equals(shortPathsList.get(0).getType(), CommonFinalParam.ONE)) {
|
||||
Device deviceByCode = deviceAppService.findDeviceByCode(dto.getStart_device_code());
|
||||
if (dto.getAgv_system_type().equals(AgvSystemTypeEnum.XG_System_Type.getIndex())) {
|
||||
String interactionJson = task.getInteraction_json();
|
||||
if (StrUtil.isEmpty(interactionJson)) {
|
||||
throw new BadRequestException("agv叉车调整长宽参数为空");
|
||||
}
|
||||
InteractionJsonDTO interactionJsonDTO = JSON.parseObject(interactionJson, InteractionJsonDTO.class);
|
||||
//仙工叉车
|
||||
HttpResponse response = xiangGongAgvService.sendOrderSequencesToForklift(dto, interactionJsonDTO);
|
||||
if (ObjectUtils.isEmpty(response) || response.getStatus() != 200) {
|
||||
dto.setSend_status("2");
|
||||
} else {
|
||||
dto.setSend_status("1");
|
||||
}
|
||||
} else if (dto.getAgv_system_type().equals(AgvSystemTypeEnum.One_NDC_System_Type.getIndex())) {
|
||||
//一楼agv任务创建运单序列
|
||||
HttpResponse response = xiangGongAgvService.sendOrderSequencesToXZ(dto);
|
||||
if (ObjectUtils.isEmpty(response) || response.getStatus() != 200) {
|
||||
dto.setSend_status("2");
|
||||
} else {
|
||||
dto.setSend_status("1");
|
||||
}
|
||||
} else if (dto.getAgv_system_type().equals(AgvSystemTypeEnum.Two_NDC_System_Type.getIndex())) {
|
||||
NDCAgvService ndcAgvService = SpringContextHolder.getBean(NDCAgvService.class);
|
||||
log.warn("下发AGV指令数据," + "指令号:" + dto.getInstruction_code() + ",AGV系统类型:" + dto.getAgv_system_type());
|
||||
try {
|
||||
ndcAgvService.sendAgvInstToNDC(task.getAgv_system_type(), dto);
|
||||
dto.setSend_status("1");
|
||||
} catch (Exception e) {
|
||||
dto.setSend_status("2");
|
||||
dto.setRemark(e.getMessage());
|
||||
e.printStackTrace();
|
||||
log.warn("下发AGV指令异常:" + e);
|
||||
LuceneLogDto logDto1 = LuceneLogDto.builder()
|
||||
.device_code(start_device_code)
|
||||
.content("下发AGV指令异常")
|
||||
.build();
|
||||
logDto1.setLog_level(4);
|
||||
luceneExecuteLogService.deviceExecuteLog(logDto1);
|
||||
}
|
||||
if (StrUtil.equals(paramService.findByCode(AcsConfig.AGVTYPE).getValue(), "5")) {
|
||||
HttpResponse response = keCongAgvService.addTask(dto);
|
||||
JSONObject jsonObject = null;
|
||||
if(ObjectUtil.isNotEmpty(response)){
|
||||
String body = response.body();
|
||||
jsonObject = JSONObject.parseObject(body);
|
||||
}
|
||||
if (ObjectUtil.isNotNull(jsonObject) && "true".equals(jsonObject.getString("Result"))) {
|
||||
dto.setSend_status("1");
|
||||
} else {
|
||||
dto.setSend_status("2");
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
@@ -101,47 +101,47 @@ public class AutoCreateInst {
|
||||
}
|
||||
|
||||
//校验路由关系
|
||||
List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code);
|
||||
if (ObjectUtils.isEmpty(shortPathsList)) {
|
||||
acsTask.setRemark("路由不通无法生成指令");
|
||||
taskserver.updateByCodeFromCache(acsTask);
|
||||
continue;
|
||||
}
|
||||
// List<RouteLineDto> shortPathsList = routeLineService.getShortPathLines(start_device_code, next_device_code, route_plan_code);
|
||||
// if (ObjectUtils.isEmpty(shortPathsList)) {
|
||||
// acsTask.setRemark("路由不通无法生成指令");
|
||||
// taskserver.updateByCodeFromCache(acsTask);
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// if (!StrUtil.equals(shortPathsList.get(0).getType(), CommonFinalParam.ONE)) {
|
||||
// continue;
|
||||
// }
|
||||
|
||||
if (!StrUtil.equals(shortPathsList.get(0).getType(), CommonFinalParam.ONE)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
RouteLineDto routeLineDto = shortPathsList.get(0);
|
||||
String path = routeLineDto.getPath();
|
||||
String type = routeLineDto.getType();
|
||||
String[] str = path.split("->");
|
||||
List<String> pathlist = Arrays.asList(str);
|
||||
int index = 0;
|
||||
boolean flag = false;
|
||||
for (int m = 0; m < pathlist.size(); m++) {
|
||||
if (pathlist.get(m).equals(start_device_code)) {
|
||||
if("1".equals(acsTask.getTask_type()) && !pathlist.get(m+1).equals(next_device_code)){
|
||||
flag = true;
|
||||
break;
|
||||
}
|
||||
index = m + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (flag) {
|
||||
acsTask.setRemark("路由不通无法生成指令");
|
||||
taskserver.update(acsTask);
|
||||
taskserver.updateByCodeFromCache(acsTask);
|
||||
continue;
|
||||
}
|
||||
next_device_code = pathlist.get(index);
|
||||
|
||||
if (StrUtil.equals(appService.findDeviceTypeByCode(next_device_code), "storage")) {
|
||||
next_point_code = next_device_code + "-" + acsTask.getTo_y() + "-" + acsTask.getTo_z();
|
||||
} else {
|
||||
next_point_code = next_device_code;
|
||||
}
|
||||
// RouteLineDto routeLineDto = shortPathsList.get(0);
|
||||
// String path = routeLineDto.getPath();
|
||||
// String type = routeLineDto.getType();
|
||||
// String[] str = path.split("->");
|
||||
// List<String> pathlist = Arrays.asList(str);
|
||||
// int index = 0;
|
||||
// boolean flag = false;
|
||||
// for (int m = 0; m < pathlist.size(); m++) {
|
||||
// if (pathlist.get(m).equals(start_device_code)) {
|
||||
// if("1".equals(acsTask.getTask_type()) && !pathlist.get(m+1).equals(next_device_code)){
|
||||
// flag = true;
|
||||
// break;
|
||||
// }
|
||||
// index = m + 1;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// if (flag) {
|
||||
// acsTask.setRemark("路由不通无法生成指令");
|
||||
// taskserver.update(acsTask);
|
||||
// taskserver.updateByCodeFromCache(acsTask);
|
||||
// continue;
|
||||
// }
|
||||
// next_device_code = pathlist.get(index);
|
||||
//
|
||||
// if (StrUtil.equals(appService.findDeviceTypeByCode(next_device_code), "storage")) {
|
||||
// next_point_code = next_device_code + "-" + acsTask.getTo_y() + "-" + acsTask.getTo_z();
|
||||
// } else {
|
||||
// next_point_code = next_device_code;
|
||||
// }
|
||||
|
||||
|
||||
Instruction instdto = new Instruction();
|
||||
|
||||
@@ -10,7 +10,7 @@ spring:
|
||||
driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
# url: jdbc:log4jdbc:mysql://${DB_HOST:192.168.81.252}:${DB_PORT:3306}/${DB_NAME:stand_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
# url: jdbc:log4jdbc:mysql://${DB_HOST:47.111.78.178}:${DB_PORT:3306}/${DB_NAME:lzhl_two_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:127.0.0.1}:${DB_PORT:3306}/${DB_NAME:ynfj_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
|
||||
url: jdbc:log4jdbc:mysql://${DB_HOST:localhost}:${DB_PORT:3306}/${DB_NAME:ynfj_acs}?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&useOldAliasMetadataBehavior=true&allowPublicKeyRetrieval=true
|
||||
|
||||
username: ${DB_USER:root}
|
||||
# password: ${DB_PWD:Root.123456}
|
||||
@@ -76,7 +76,7 @@ spring:
|
||||
redis:
|
||||
#数据库索引
|
||||
database: ${REDIS_DB:2}
|
||||
host: ${REDIS_HOST:127.0.0.1}
|
||||
host: ${REDIS_HOST:localhost}
|
||||
port: ${REDIS_PORT:6379}
|
||||
# password: ${REDIS_PWD:}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user