opt: 联调测试优化

This commit is contained in:
yanps
2024-08-13 08:57:05 +08:00
parent 59734cd4b8
commit b018644aea
23 changed files with 443 additions and 84 deletions

View File

@@ -110,21 +110,41 @@ public class NDCAgvServiceImpl implements NDCAgvService {
str1 += "/priority:" + hexToString(prioritylow & 0xFF);
System.out.println(str);
System.out.println(str1);
byte[] b = new byte[]{(byte) 0X87, (byte) 0XCD,
(byte) 0X00, (byte) 0X08,
(byte) 0X00, (byte) 0X14,
(byte) 0X00, (byte) 0X01,
(byte) 0X00, (byte) 0X71,
(byte) 0X00, (byte) 0X10,
(byte) 0X01, (byte) 0X80,
(byte) 0X00, (byte) 0X01,
(byte) ikeyhigh, (byte) ikeylow,
(byte) ikeyhigh, (byte) ikeylow,
(byte) typehigh, (byte) typelow,
(byte) qhdhigh, (byte) qhdlow,
(byte) fhdhigh, (byte) fhdlow,
(byte) 0X00, (byte) 0X00,
};
byte[] b = null;
if(type == 1){
b = new byte[]{(byte) 0X87, (byte) 0XCD,
(byte) 0X00, (byte) 0X08,
(byte) 0X00, (byte) 0X14,
(byte) 0X00, (byte) 0X01,
(byte) 0X00, (byte) 0X71,
(byte) 0X00, (byte) 0X10,
(byte) 0X01, (byte) 0X80,
(byte) 0X00, (byte) 0X01,
(byte) ikeyhigh, (byte) ikeylow,
(byte) ikeyhigh, (byte) ikeylow,
(byte) typehigh, (byte) typelow,
(byte) qhdhigh, (byte) qhdlow,
(byte) 0X00, (byte) 0X00,
(byte) fhdhigh, (byte) fhdlow,
};
}else if(type == 2){
b = new byte[]{(byte) 0X87, (byte) 0XCD,
(byte) 0X00, (byte) 0X08,
(byte) 0X00, (byte) 0X14,
(byte) 0X00, (byte) 0X01,
(byte) 0X00, (byte) 0X71,
(byte) 0X00, (byte) 0X10,
(byte) 0X01, (byte) 0X80,
(byte) 0X00, (byte) 0X01,
(byte) ikeyhigh, (byte) ikeylow,
(byte) ikeyhigh, (byte) ikeylow,
(byte) typehigh, (byte) typelow,
(byte) qhdhigh, (byte) qhdlow,
(byte) fhdhigh, (byte) fhdlow,
(byte) 0X00, (byte) 0X00,
};
}
log.info("下发AGV作业指令--{}", str1);
log.info("下发AGV作业指令--{}", str);
OneNDCSocketConnectionAutoRun.write(b);

View File

@@ -309,7 +309,6 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
} catch (Exception e1) {
e1.printStackTrace();
}
}
}
}

View File

@@ -194,13 +194,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,2,false);
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,2,false);
data = feedBackStatus(data, index, 1, inst, task, 2, false);
plcToAgvDeviceDriver.writing("AGVInOP", "1");
}
}
@@ -212,7 +212,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
}
} else if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
try {
data = feedBackStatus(data, index, 1, inst, task,1,false);
data = feedBackStatus(data, index, 1, inst, task, 1, false);
} catch (Exception e) {
log.info("到达取货点反馈AGV状态失败:{}", e.getMessage());
}
@@ -257,10 +257,10 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
} catch (Exception e) {
log.info("下发AGVInOP信号:{}失败", "0");
}
data = feedBackStatus(data, index, 2, inst, task,2,false);
data = feedBackStatus(data, index, 2, inst, task, 2, false);
} else if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
try {
data = feedBackStatus(data, index, 2, inst, task,1,false);
data = feedBackStatus(data, index, 2, inst, task, 1, false);
} catch (Exception e) {
log.info("取货完成反馈AGV状态失败:{}", e.getMessage());
}
@@ -281,19 +281,6 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
logServer.deviceExecuteLog(this.device_code, "", "", "agv地址参数有误,phase:" + phase);
return;
}
/*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];
} else {
device_code = old_device_code;
}
}*/
if (agvaddr != 0) {
old_device_code = deviceService.queryDeviceCodeByAddress(agvaddr);
device_code = old_device_code;
@@ -316,13 +303,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,2,false);
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,2,false);
data = feedBackStatus(data, index, 3, inst, task, 2, false);
plcToAgvDeviceDriver.writing("AGVInOP", "1");
}
}
@@ -334,7 +321,13 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
}
} else if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
try {
data = feedBackStatus(data, index, 2, inst, task,1,false);
StandardOrdinarySiteDeviceDriver standar = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
Map<String, Object> extraValue = standar.getDevice().getExtraValue();
if (ObjectUtil.isNotEmpty(extraValue.get("ignore_release_check")) && "true".equals(extraValue.get("ignore_release_check"))) {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0);
} else {
data = feedBackStatus(data, index, 2, inst, task, 1, false);
}
} catch (Exception e) {
log.info("到达放货点反馈AGV状态失败:{}", e.getMessage());
}
@@ -393,16 +386,16 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
} catch (Exception e) {
log.info("下发AGVInOP信号:{}失败", "0");
}
data = feedBackStatus(data, index, 4, inst, task,2,false);
data = feedBackStatus(data, index, 4, inst, task, 2, false);
} else if (device.getDeviceDriver() instanceof StandardOrdinarySiteDeviceDriver) {
try {
StandardOrdinarySiteDeviceDriver standar = (StandardOrdinarySiteDeviceDriver) device.getDeviceDriver();
Map<String, Object> extraValue = standar.getDevice().getExtraValue();
Map<String, Object> extraValue = standar.getDevice().getExtraValue();
boolean is_empty = false;
if(ObjectUtil.isNotEmpty(extraValue.get("is_empty"))){
is_empty = (boolean)extraValue.get("is_empty");
if (ObjectUtil.isNotEmpty(extraValue.get("is_empty"))) {
is_empty = (boolean) extraValue.get("is_empty");
}
data = feedBackStatus(data, index, 4, inst, task,1,is_empty);
data = feedBackStatus(data, index, 4, inst, task, 1, is_empty);
} catch (Exception e) {
log.info("放货完成反馈AGV状态失败:{},", e.getMessage());
}
@@ -436,12 +429,12 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
} else if (phase == 0x73) {
//agv电量
electric_qty = ikey;
int electric = Integer.parseInt(paramService.findByCode(AcsConfig.ELECTRIC).getValue());
/*int electric = Integer.parseInt(paramService.findByCode(AcsConfig.ELECTRIC).getValue());
if (electric_qty > 0 && electric_qty < electric) {
log.info("当前车辆{}电量为{}低于{},开始判断是否需要充电!", this.device_code, electric_qty, electric);
NDCAgvService.charge(String.valueOf(this.agvaddr));
isCharge = true;
}
}*/
} else if (phase == 0x74) {
//三色灯状态
status = ikey;
@@ -456,8 +449,8 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
String hasWms = paramService.findByCode("hasWms").getValue();
if ("3".equals(task.getTask_type()) && StrUtil.isNotEmpty(hasWms) && "1".equals(hasWms)) {
String resp = acsToWmsService.requestTaskAgain(task.getNext_point_code(), task.getExt_task_id(), inst.getVehicle_code());
if(StrUtil.isEmpty(resp)){
log.info("申请分配二次点位失败,响应参数:{}",resp);
if (StrUtil.isEmpty(resp)) {
log.info("申请分配二次点位失败,响应参数:{}", resp);
}
JSONObject respjson = JSONObject.parseObject(resp);
String point_code = respjson.getString("point_code");
@@ -473,14 +466,14 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
return data;
}
private byte[] feedBackStatus(byte[] data, int index, int agvStatus, Instruction inst, TaskDto task,int connector_and_sorting,boolean is_empty) {
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());
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("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);
@@ -492,7 +485,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
if (ObjectUtil.isNotEmpty(httpResponse) && httpResponse.getStatus() == 200) {
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0);
} else {
if(connector_and_sorting == 1){
if (connector_and_sorting == 1) {
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
@@ -502,7 +495,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
log.info("指令号:{},phase:{},acs反馈wms失败:{}", inst.getInstruction_code(), phase, httpResponse);
}
} else {
log.info("不存在LMS系统,不需要反馈直接进去取货,指令号:{}",inst.getInstruction_code());
log.info("不存在LMS系统,不需要反馈直接进去取货,指令号:{}", inst.getInstruction_code());
data = NDCAgvService.sendAgvOneModeInst(phase, index, 0, 0, 0, 0, 0);
}
return data;