add: 添加取放货逻辑
This commit is contained in:
@@ -236,9 +236,9 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
//上报异常信息
|
||||
//(不需要WCS反馈)
|
||||
if (phase == 0x70 || phase == 0x71 || phase == 0x72 || phase == 0x73 || phase == 0x74) {
|
||||
device = deviceAppService.findDeviceByCode(Integer.toString(agvaddr));
|
||||
device = deviceAppService.findDeviceByCode("agv"+ Integer.toString(agvaddr));
|
||||
} else {
|
||||
device = deviceAppService.findDeviceByCode(Integer.toString(arr[20]));
|
||||
device = deviceAppService.findDeviceByCode("agv"+ Integer.toString(arr[20]));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(device)) {
|
||||
if (device.getDeviceDriver() instanceof AgvNdcOneDeviceDriver) {
|
||||
|
||||
@@ -154,7 +154,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
return;
|
||||
}
|
||||
device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
|
||||
if (agvaddr != 0) {
|
||||
/*if (agvaddr != 0) {
|
||||
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
|
||||
if (StrUtil.contains(old_device_code, "-")) {
|
||||
String[] point = old_device_code.split("-");
|
||||
@@ -166,6 +166,11 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
} else {
|
||||
device_code = old_device_code;
|
||||
}
|
||||
}*/
|
||||
|
||||
if (agvaddr != 0) {
|
||||
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
|
||||
device_code = old_device_code;
|
||||
}
|
||||
|
||||
device = deviceAppService.findDeviceByCode(device_code);
|
||||
@@ -188,13 +193,13 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
if ("1".equals(plc_to_agv)) {
|
||||
plcToAgvDeviceDriver.writing("AGVSetOutReqUpper", "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");
|
||||
}
|
||||
} else if ("2".equals(plc_to_agv)) {
|
||||
plcToAgvDeviceDriver.writing("AGVSetOutReqLower", "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");
|
||||
}
|
||||
}
|
||||
@@ -206,7 +211,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
}
|
||||
} else if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
try {
|
||||
data = feedBackStatus(data, index, 1, inst, task);
|
||||
data = feedBackStatus(data, index, 1, inst, task,1,false);
|
||||
} catch (Exception e) {
|
||||
log.info("到达取货点反馈AGV状态失败:{}", e.getMessage());
|
||||
}
|
||||
@@ -229,16 +234,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
}
|
||||
if (agvaddr != 0) {
|
||||
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);
|
||||
|
||||
@@ -260,10 +256,10 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
} catch (Exception e) {
|
||||
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) {
|
||||
try {
|
||||
data = feedBackStatus(data, index, 2, inst, task);
|
||||
data = feedBackStatus(data, index, 2, inst, task,1,false);
|
||||
} catch (Exception e) {
|
||||
log.info("取货完成反馈AGV状态失败:{}", e.getMessage());
|
||||
}
|
||||
@@ -284,18 +280,22 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase);
|
||||
return;
|
||||
}
|
||||
if (agvaddr != 0) {
|
||||
/*if (agvaddr != 0) {
|
||||
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
|
||||
if (StrUtil.contains(old_device_code, "-")) {
|
||||
String[] point = old_device_code.split("-");
|
||||
emptyNum = point[1];
|
||||
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;
|
||||
}
|
||||
}*/
|
||||
if (agvaddr != 0) {
|
||||
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
|
||||
device_code = old_device_code;
|
||||
}
|
||||
device = deviceAppService.findDeviceByCode(device_code);
|
||||
if (ObjectUtil.isEmpty(device_code)) {
|
||||
@@ -315,13 +315,13 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
if ("1".equals(plc_to_agv)) {
|
||||
plcToAgvDeviceDriver.writing("AGVSetInReqUpper", "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");
|
||||
}
|
||||
} else if ("2".equals(plc_to_agv)) {
|
||||
plcToAgvDeviceDriver.writing("AGVSetInReqLower", "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");
|
||||
}
|
||||
}
|
||||
@@ -333,7 +333,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
}
|
||||
} else if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
|
||||
try {
|
||||
data = feedBackStatus(data, index, 3, inst, task);
|
||||
data = feedBackStatus(data, index, 2, inst, task,1,false);
|
||||
} catch (Exception e) {
|
||||
log.info("到达放货点反馈AGV状态失败:{}", e.getMessage());
|
||||
}
|
||||
@@ -351,7 +351,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase);
|
||||
return;
|
||||
}
|
||||
if (agvaddr != 0) {
|
||||
/*if (agvaddr != 0) {
|
||||
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
|
||||
if (StrUtil.contains(old_device_code, "-")) {
|
||||
String[] point = old_device_code.split("-");
|
||||
@@ -363,6 +363,11 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
} else {
|
||||
device_code = old_device_code;
|
||||
}
|
||||
}*/
|
||||
|
||||
if (agvaddr != 0) {
|
||||
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
|
||||
device_code = old_device_code;
|
||||
}
|
||||
|
||||
device = deviceAppService.findDeviceByCode(device_code);
|
||||
@@ -387,10 +392,12 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
} catch (Exception e) {
|
||||
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) {
|
||||
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) {
|
||||
log.info("放货完成反馈AGV状态失败:{},", e.getMessage());
|
||||
}
|
||||
@@ -458,16 +465,19 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
|
||||
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();
|
||||
if (StrUtil.isNotEmpty(hasWms) && "1".equals(hasWms)) {
|
||||
log.info("存在LMS系统,需要反馈,指令号:{}",inst.getInstruction_code());
|
||||
JSONArray ja = new JSONArray();
|
||||
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("status", agvStatus);
|
||||
jo.put("device_code", this.device_code);
|
||||
jo.put("task_code", inst.getTask_code());
|
||||
jo.put("is_empty", is_empty);
|
||||
ja.add(jo);
|
||||
HttpResponse httpResponse = acsToWmsService.feedAgvTaskStatus(ja);
|
||||
log.info("指令号:{},phase:{},acs反馈wms结果:{}", inst.getInstruction_code(), phase, httpResponse);
|
||||
|
||||
@@ -150,6 +150,8 @@ public class AcsToWmsServiceImpl implements AcsToWmsService {
|
||||
String wmsurl = paramService.findByCode(AcsConfig.WMSURL).getValue();
|
||||
JSONObject jo = new JSONObject();
|
||||
jo.put("task_id", task_id);
|
||||
jo.put("vehicle_code", vehicle_code);
|
||||
jo.put("device_code",address);
|
||||
String result2 = null;
|
||||
|
||||
AddressDto addressDto = addressService.findByCode("requestTaskAgain");
|
||||
|
||||
@@ -18,13 +18,12 @@ https://juejin.cn/post/6844903775631572999
|
||||
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径-->
|
||||
<property name="LOG_HOME" value="${logPath}"/>
|
||||
<!--引入默认的一些设置-->
|
||||
<!-- <include resource="log/AutoCreateInst.xml"/>-->
|
||||
<!-- <include resource="log/AcsToWms.xml"/>-->
|
||||
<!-- <include resource="log/WmsToAcs.xml"/>-->
|
||||
<!-- <include resource="log/NDCSocketConnectionAutoRun.xml"/>-->
|
||||
<!-- <include resource="log/AgvNdcOneDeviceDriver.xml"/>-->
|
||||
<!-- <include resource="log/NDCAgvServiceImpl.xml"/>-->
|
||||
<!-- <include resource="log/LnshRGVDeviceDriver.xml"/>-->
|
||||
<include resource="log/AutoCreateInst.xml"/>
|
||||
<include resource="log/AcsToWms.xml"/>
|
||||
<include resource="log/WmsToAcs.xml"/>
|
||||
<include resource="log/OneNDCSocketConnectionAutoRun.xml"/>
|
||||
<include resource="log/AgvNdcOneDeviceDriver.xml"/>
|
||||
<include resource="log/NDCAgvServiceImpl.xml"/>
|
||||
|
||||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<!-- 控制台高亮-->
|
||||
|
||||
Reference in New Issue
Block a user