|
@ -154,7 +154,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
device_code = deviceService.queryDeviceCodeByAddress(agvaddr); |
|
|
device_code = deviceService.queryDeviceCodeByAddress(agvaddr); |
|
|
if (agvaddr != 0) { |
|
|
/*if (agvaddr != 0) { |
|
|
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr); |
|
|
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr); |
|
|
if (StrUtil.contains(old_device_code, "-")) { |
|
|
if (StrUtil.contains(old_device_code, "-")) { |
|
|
String[] point = old_device_code.split("-"); |
|
|
String[] point = old_device_code.split("-"); |
|
@ -166,6 +166,11 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
} else { |
|
|
} else { |
|
|
device_code = old_device_code; |
|
|
device_code = old_device_code; |
|
|
} |
|
|
} |
|
|
|
|
|
}*/ |
|
|
|
|
|
|
|
|
|
|
|
if (agvaddr != 0) { |
|
|
|
|
|
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr); |
|
|
|
|
|
device_code = old_device_code; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
device = deviceAppService.findDeviceByCode(device_code); |
|
|
device = deviceAppService.findDeviceByCode(device_code); |
|
@ -188,13 +193,13 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
if ("1".equals(plc_to_agv)) { |
|
|
if ("1".equals(plc_to_agv)) { |
|
|
plcToAgvDeviceDriver.writing("AGVSetOutReqUpper", "1"); |
|
|
plcToAgvDeviceDriver.writing("AGVSetOutReqUpper", "1"); |
|
|
if (plcToAgvDeviceDriver.getAGVSetOutUpperAllowed() == 1) { |
|
|
if (plcToAgvDeviceDriver.getAGVSetOutUpperAllowed() == 1) { |
|
|
data = feedBackStatus(data, index, 1, inst, task); |
|
|
data = feedBackStatus(data, index, 1, inst, task,2,false); |
|
|
plcToAgvDeviceDriver.writing("AGVInOP", "1"); |
|
|
plcToAgvDeviceDriver.writing("AGVInOP", "1"); |
|
|
} |
|
|
} |
|
|
} else if ("2".equals(plc_to_agv)) { |
|
|
} else if ("2".equals(plc_to_agv)) { |
|
|
plcToAgvDeviceDriver.writing("AGVSetOutReqLower", "1"); |
|
|
plcToAgvDeviceDriver.writing("AGVSetOutReqLower", "1"); |
|
|
if (plcToAgvDeviceDriver.getAGVSetOutLowerAllowed() == 1) { |
|
|
if (plcToAgvDeviceDriver.getAGVSetOutLowerAllowed() == 1) { |
|
|
data = feedBackStatus(data, index, 1, inst, task); |
|
|
data = feedBackStatus(data, index, 1, inst, task,2,false); |
|
|
plcToAgvDeviceDriver.writing("AGVInOP", "1"); |
|
|
plcToAgvDeviceDriver.writing("AGVInOP", "1"); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -206,7 +211,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
} |
|
|
} |
|
|
} else if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { |
|
|
} else if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { |
|
|
try { |
|
|
try { |
|
|
data = feedBackStatus(data, index, 1, inst, task); |
|
|
data = feedBackStatus(data, index, 1, inst, task,1,false); |
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
log.info("到达取货点反馈AGV状态失败:{}", e.getMessage()); |
|
|
log.info("到达取货点反馈AGV状态失败:{}", e.getMessage()); |
|
|
} |
|
|
} |
|
@ -229,17 +234,8 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
} |
|
|
} |
|
|
if (agvaddr != 0) { |
|
|
if (agvaddr != 0) { |
|
|
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr); |
|
|
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr); |
|
|
if (StrUtil.contains(old_device_code, "-")) { |
|
|
|
|
|
String[] point = old_device_code.split("-"); |
|
|
|
|
|
device_code = point[0]; |
|
|
|
|
|
} else if (StrUtil.contains(old_device_code, ".")) { |
|
|
|
|
|
String[] point = old_device_code.split("\\."); |
|
|
|
|
|
device_code = point[0]; |
|
|
|
|
|
emptyNum = point[1]; |
|
|
|
|
|
} else { |
|
|
|
|
|
device_code = old_device_code; |
|
|
device_code = old_device_code; |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
device = deviceAppService.findDeviceByCode(device_code); |
|
|
device = deviceAppService.findDeviceByCode(device_code); |
|
|
|
|
|
|
|
|
if (ObjectUtil.isEmpty(device_code)) { |
|
|
if (ObjectUtil.isEmpty(device_code)) { |
|
@ -260,10 +256,10 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
log.info("下发AGVInOP信号:{}失败", "0"); |
|
|
log.info("下发AGVInOP信号:{}失败", "0"); |
|
|
} |
|
|
} |
|
|
data = feedBackStatus(data, index, 2, inst, task); |
|
|
data = feedBackStatus(data, index, 2, inst, task,2,false); |
|
|
} else if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { |
|
|
} else if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { |
|
|
try { |
|
|
try { |
|
|
data = feedBackStatus(data, index, 2, inst, task); |
|
|
data = feedBackStatus(data, index, 2, inst, task,1,false); |
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
log.info("取货完成反馈AGV状态失败:{}", e.getMessage()); |
|
|
log.info("取货完成反馈AGV状态失败:{}", e.getMessage()); |
|
|
} |
|
|
} |
|
@ -284,18 +280,22 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase); |
|
|
logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
if (agvaddr != 0) { |
|
|
/*if (agvaddr != 0) { |
|
|
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr); |
|
|
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr); |
|
|
if (StrUtil.contains(old_device_code, "-")) { |
|
|
if (StrUtil.contains(old_device_code, "-")) { |
|
|
String[] point = old_device_code.split("-"); |
|
|
String[] point = old_device_code.split("-"); |
|
|
|
|
|
emptyNum = point[1]; |
|
|
device_code = point[0]; |
|
|
device_code = point[0]; |
|
|
} else if (StrUtil.contains(old_device_code, ".")) { |
|
|
} else if (StrUtil.contains(old_device_code, ".")) { |
|
|
String[] point = old_device_code.split("\\."); |
|
|
String[] point = old_device_code.split("\\."); |
|
|
device_code = point[0]; |
|
|
device_code = point[0]; |
|
|
emptyNum = point[1]; |
|
|
|
|
|
} else { |
|
|
} else { |
|
|
device_code = old_device_code; |
|
|
device_code = old_device_code; |
|
|
} |
|
|
} |
|
|
|
|
|
}*/ |
|
|
|
|
|
if (agvaddr != 0) { |
|
|
|
|
|
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr); |
|
|
|
|
|
device_code = old_device_code; |
|
|
} |
|
|
} |
|
|
device = deviceAppService.findDeviceByCode(device_code); |
|
|
device = deviceAppService.findDeviceByCode(device_code); |
|
|
if (ObjectUtil.isEmpty(device_code)) { |
|
|
if (ObjectUtil.isEmpty(device_code)) { |
|
@ -315,13 +315,13 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
if ("1".equals(plc_to_agv)) { |
|
|
if ("1".equals(plc_to_agv)) { |
|
|
plcToAgvDeviceDriver.writing("AGVSetInReqUpper", "1"); |
|
|
plcToAgvDeviceDriver.writing("AGVSetInReqUpper", "1"); |
|
|
if (plcToAgvDeviceDriver.getAGVSetInUpperAllowed() == 1) { |
|
|
if (plcToAgvDeviceDriver.getAGVSetInUpperAllowed() == 1) { |
|
|
data = feedBackStatus(data, index, 3, inst, task); |
|
|
data = feedBackStatus(data, index, 3, inst, task,2,false); |
|
|
plcToAgvDeviceDriver.writing("AGVInOP", "1"); |
|
|
plcToAgvDeviceDriver.writing("AGVInOP", "1"); |
|
|
} |
|
|
} |
|
|
} else if ("2".equals(plc_to_agv)) { |
|
|
} else if ("2".equals(plc_to_agv)) { |
|
|
plcToAgvDeviceDriver.writing("AGVSetInReqLower", "1"); |
|
|
plcToAgvDeviceDriver.writing("AGVSetInReqLower", "1"); |
|
|
if (plcToAgvDeviceDriver.getAGVSetInLowerAllowed() == 1) { |
|
|
if (plcToAgvDeviceDriver.getAGVSetInLowerAllowed() == 1) { |
|
|
data = feedBackStatus(data, index, 3, inst, task); |
|
|
data = feedBackStatus(data, index, 3, inst, task,2,false); |
|
|
plcToAgvDeviceDriver.writing("AGVInOP", "1"); |
|
|
plcToAgvDeviceDriver.writing("AGVInOP", "1"); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -333,7 +333,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
} |
|
|
} |
|
|
} else if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { |
|
|
} else if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { |
|
|
try { |
|
|
try { |
|
|
data = feedBackStatus(data, index, 3, inst, task); |
|
|
data = feedBackStatus(data, index, 2, inst, task,1,false); |
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
log.info("到达放货点反馈AGV状态失败:{}", e.getMessage()); |
|
|
log.info("到达放货点反馈AGV状态失败:{}", e.getMessage()); |
|
|
} |
|
|
} |
|
@ -351,7 +351,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase); |
|
|
logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase); |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
if (agvaddr != 0) { |
|
|
/*if (agvaddr != 0) { |
|
|
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr); |
|
|
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr); |
|
|
if (StrUtil.contains(old_device_code, "-")) { |
|
|
if (StrUtil.contains(old_device_code, "-")) { |
|
|
String[] point = old_device_code.split("-"); |
|
|
String[] point = old_device_code.split("-"); |
|
@ -363,6 +363,11 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
} else { |
|
|
} else { |
|
|
device_code = old_device_code; |
|
|
device_code = old_device_code; |
|
|
} |
|
|
} |
|
|
|
|
|
}*/ |
|
|
|
|
|
|
|
|
|
|
|
if (agvaddr != 0) { |
|
|
|
|
|
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr); |
|
|
|
|
|
device_code = old_device_code; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
device = deviceAppService.findDeviceByCode(device_code); |
|
|
device = deviceAppService.findDeviceByCode(device_code); |
|
@ -387,10 +392,12 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
log.info("下发AGVInOP信号:{}失败", "0"); |
|
|
log.info("下发AGVInOP信号:{}失败", "0"); |
|
|
} |
|
|
} |
|
|
data = feedBackStatus(data, index, 4, inst, task); |
|
|
data = feedBackStatus(data, index, 4, inst, task,2,false); |
|
|
} else if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { |
|
|
} else if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) { |
|
|
try { |
|
|
try { |
|
|
data = feedBackStatus(data, index, 4, inst, task); |
|
|
StandardOrdinarySiteDeviceDriver standar = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver(); |
|
|
|
|
|
boolean is_empty = (boolean)standar.getDevice().getExtraValue().get("is_empty"); |
|
|
|
|
|
data = feedBackStatus(data, index, 2, inst, task,1,false); |
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
log.info("放货完成反馈AGV状态失败:{},", e.getMessage()); |
|
|
log.info("放货完成反馈AGV状态失败:{},", e.getMessage()); |
|
|
} |
|
|
} |
|
@ -458,16 +465,19 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic |
|
|
return data; |
|
|
return data; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private byte[] feedBackStatus(byte[] data, int index, int agvStatus, Instruction inst, TaskDto task) { |
|
|
private byte[] feedBackStatus(byte[] data, int index, int agvStatus, Instruction inst, TaskDto task,int connector_and_sorting,boolean is_empty) { |
|
|
String hasWms = paramService.findByCode("hasWms").getValue(); |
|
|
String hasWms = paramService.findByCode("hasWms").getValue(); |
|
|
if (StrUtil.isNotEmpty(hasWms) && "1".equals(hasWms)) { |
|
|
if (StrUtil.isNotEmpty(hasWms) && "1".equals(hasWms)) { |
|
|
log.info("存在LMS系统,需要反馈,指令号:{}",inst.getInstruction_code()); |
|
|
log.info("存在LMS系统,需要反馈,指令号:{}",inst.getInstruction_code()); |
|
|
JSONArray ja = new JSONArray(); |
|
|
JSONArray ja = new JSONArray(); |
|
|
JSONObject jo = new JSONObject(); |
|
|
JSONObject jo = new JSONObject(); |
|
|
|
|
|
jo.put("is_connector", connector_and_sorting == 1? 1:2); |
|
|
|
|
|
jo.put("task_type",task.getTask_type()); |
|
|
jo.put("vehicle_code", inst.getVehicle_code()); |
|
|
jo.put("vehicle_code", inst.getVehicle_code()); |
|
|
jo.put("status", agvStatus); |
|
|
jo.put("status", agvStatus); |
|
|
jo.put("device_code", this.device_code); |
|
|
jo.put("device_code", this.device_code); |
|
|
jo.put("task_code", inst.getTask_code()); |
|
|
jo.put("task_code", inst.getTask_code()); |
|
|
|
|
|
jo.put("is_empty", is_empty); |
|
|
ja.add(jo); |
|
|
ja.add(jo); |
|
|
HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(ja); |
|
|
HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(ja); |
|
|
log.info("指令号:{},phase:{},acs反馈wms结果:{}", inst.getInstruction_code(), phase, httpResponse); |
|
|
log.info("指令号:{},phase:{},acs反馈wms结果:{}", inst.getInstruction_code(), phase, httpResponse); |
|
|