Browse Source

opt:Redis反馈 增加取放货完成、载货开关状态

1
liejiu946 4 days ago
parent
commit
6e12d8bd8c
  1. 2
      nlsso-server/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java
  2. 18
      nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java
  3. 2
      nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java
  4. 5
      nlsso-server/src/main/java/org/nl/quartz/task/SyncDeviceStatus.java

2
nlsso-server/src/main/java/org/nl/acs/auto/run/OneNDCSocketConnectionAutoRun.java

@ -197,7 +197,7 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
} else {
//上报异常信息
//(不需要WCS反馈)
if (phase == 0x70 || phase == 0x71 || phase == 0x72 || phase == 0x73 || phase == 0x74) {
if (phase == 0x70 || phase == 0x71 || phase == 0x72 || phase == 0x73 || phase == 0x74 || phase == 0x75) {
device = deviceAppService.findDeviceByCode(String.valueOf(agvaddr));
} else {
//todo NDC根据车辆编号123456进行查找特定车辆

18
nlsso-server/src/main/java/org/nl/acs/device_driver/basedriver/agv/ndcone/AgvNdcOneDeviceDriver.java

@ -199,6 +199,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
return;
}
// "========================================================================请求取货================================================================================="
agv_status = 1;
//到达桁架1请求取货
if (device.getDeviceDriver() instanceof Hj1DeviceDriver) {
hj1DeviceDriver = (Hj1DeviceDriver) device.getDeviceDriver();
@ -209,7 +210,6 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
if (hj1DeviceDriver.getMode() != 0) {
if (hj1DeviceDriver.getAction() == 2) {
log.info("设备" + device_code + "的Action信号已变更为2允许进入,当前信号值为:Mode:" + hj1DeviceDriver.getMode() + ",Move:" + hj1DeviceDriver.getMove() + ",Action:" + hj1DeviceDriver.getAction() + ",agv开始进入取货。");
agv_status = 1;
flag = true;
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
} else {
@ -236,7 +236,6 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
if (hj2DeviceDriver.getMode() != 0) {
if (hj2DeviceDriver.getAction() == 2) {
log.info("设备" + device_code + "的Action信号已变更为2允许进入,当前信号值为:Mode:" + hj2DeviceDriver.getMode() + ",Move:" + hj2DeviceDriver.getMove() + ",Action:" + hj2DeviceDriver.getAction() + ",agv开始进入取货。");
agv_status = 1;
flag = true;
data = ndcAgvService.sendAgvOneModeInst(phase, index, 0);
} else {
@ -335,6 +334,8 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
return;
}
// "========================================================================取货完成================================================================================="
//反馈车辆动作
agv_status = 2;
//到达桁架1取货完成
if (device.getDeviceDriver() instanceof Hj1DeviceDriver) {
hj1DeviceDriver = (Hj1DeviceDriver) device.getDeviceDriver();
@ -343,8 +344,6 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
hj1DeviceDriver.writing(3);
if (hj1DeviceDriver.getMode() == 3) {
flag = true;
//反馈车辆动作
agv_status = 0;
log.info("设备" + device_code + "的Mode信号已变更为3,当前信号值为:Mode:" + hj1DeviceDriver.getMode() + ",Move:" + hj1DeviceDriver.getMove() + ",Action:" + hj1DeviceDriver.getAction() + ",开始写入0清除mode信号。");
hj1DeviceDriver.writing(0);
data = actionComplete(index, inst, device_code, hj1DeviceDriver.getTo_command(), Integer.parseInt(AgvActionEnum.ACTION_STATUS.code("取货完成")), "取货完成");
@ -371,8 +370,6 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
hj2DeviceDriver.writing(3);
if (hj2DeviceDriver.getMode() == 3) {
flag = true;
//反馈车辆动作
agv_status = 0;
log.info("设备" + device_code + "的Mode信号已变更为3,当前信号值为:Mode:" + hj2DeviceDriver.getMode() + ",Move:" + hj2DeviceDriver.getMove() + ",Action:" + hj2DeviceDriver.getAction() + ",开始写入0清除mode信号。");
hj2DeviceDriver.writing(0);
data = actionComplete(index, inst, device_code, hj2DeviceDriver.getTo_command(), Integer.parseInt(AgvActionEnum.ACTION_STATUS.code("取货完成")), "取货完成");
@ -398,8 +395,6 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
log.info("agv进入" + device_code + ",取货完成,开始写入信号3进行安全交互,当前信号值为:Mode:" + ssxDeviceDriver.getMode() + ",Move:" + ssxDeviceDriver.getMove() + ",Action:" + ssxDeviceDriver.getAction());
ssxDeviceDriver.writing(3);
if (ssxDeviceDriver.getMode() == 3) {
//反馈车辆动作
agv_status = 2;
flag = true;
log.info("设备" + device_code + "的Mode信号已变更为3,当前信号值为:Mode:" + ssxDeviceDriver.getMode() + ",Move:" + ssxDeviceDriver.getMove() + ",Action:" + ssxDeviceDriver.getAction() + ",开始写入0清除mode信号。");
ssxDeviceDriver.writing(0);
@ -463,6 +458,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
return;
}
// "========================================================================请求放货================================================================================="
agv_status = 3;
//到达桁架1请求放货
if (device.getDeviceDriver() instanceof Hj1DeviceDriver) {
hj1DeviceDriver = (Hj1DeviceDriver) device.getDeviceDriver();
@ -473,7 +469,6 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
if (hj1DeviceDriver.getMode() != 0 && hj1DeviceDriver.getMove() == 0) {
if (hj1DeviceDriver.getAction() == 3) {
log.info("设备" + device_code + "的Action信号已变更为3允许进入,当前信号值为:Mode:" + hj1DeviceDriver.getMode() + ",Move:" + hj1DeviceDriver.getMove() + ",Action:" + hj1DeviceDriver.getAction() + ",agv开始进入放货。");
agv_status = 2;
flag = true;
data = getData(data, index, inst, task);
} else {
@ -509,7 +504,6 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
if (hj2DeviceDriver.getMode() != 0 && hj2DeviceDriver.getMove() == 0) {
if (hj2DeviceDriver.getAction() == 3) {
log.info("设备" + device_code + "的Action信号已变更为3允许进入,当前信号值为:Mode:" + hj2DeviceDriver.getMode() + ",Move:" + hj2DeviceDriver.getMove() + ",Action:" + hj2DeviceDriver.getAction() + ",agv开始进入放货。");
agv_status = 2;
flag = true;
data = getData(data, index, inst, task);
} else {
@ -605,6 +599,7 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
}
transportOrder = "";
// "========================================================================放货完成================================================================================="
agv_status = 4;
//到达桁架1放货完成
if (device.getDeviceDriver() instanceof Hj1DeviceDriver) {
hj1DeviceDriver = (Hj1DeviceDriver) device.getDeviceDriver();
@ -613,7 +608,6 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
if (hj1DeviceDriver.getMode() == 4) {
log.info("设备" + device_code + "的Mode信号已变更为4,当前信号值为:Mode:" + hj1DeviceDriver.getMode() + ",Move:" + hj1DeviceDriver.getMove() + ",Action:" + hj1DeviceDriver.getAction() + ",开始写入0清除mode信号。");
hj1DeviceDriver.writing(0);
agv_status = 0;
flag = true;
data = actionComplete(index, inst, device_code, hj1DeviceDriver.getTo_command(), Integer.parseInt(AgvActionEnum.ACTION_STATUS.code("放货完成")), "放货完成");
log.info("设备" + device_code + "已完成信号0写入,当前信号值为:" + "Mode:" + hj1DeviceDriver.getMode() + ",Move:" + hj1DeviceDriver.getMove() + ",Action:" + hj1DeviceDriver.getAction() + ",agv开始离开。");
@ -632,7 +626,6 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
if (hj2DeviceDriver.getMode() == 4) {
log.info("设备" + device_code + "的Mode信号已变更为4,当前信号值为:Mode:" + hj2DeviceDriver.getMode() + ",Move:" + hj2DeviceDriver.getMove() + ",Action:" + hj2DeviceDriver.getAction() + ",开始写入0清除mode信号。");
hj2DeviceDriver.writing(0);
agv_status = 0;
flag = true;
data = actionComplete(index, inst, device_code, hj2DeviceDriver.getTo_command(), Integer.parseInt(AgvActionEnum.ACTION_STATUS.code("放货完成")), "放货完成");
log.info("设备" + device_code + "已完成信号0写入,当前信号值为:" + "Mode:" + hj2DeviceDriver.getMode() + ",Move:" + hj2DeviceDriver.getMove() + ",Action:" + hj2DeviceDriver.getAction() + ",agv开始离开。");
@ -651,7 +644,6 @@ public class AgvNdcOneDeviceDriver extends AbstractDeviceDriver implements Devic
if (ssxDeviceDriver.getMode() == 4) {
log.info("设备" + device_code + "的Mode信号已变更为4,当前信号值为:Mode:" + ssxDeviceDriver.getMode() + ",Move:" + ssxDeviceDriver.getMove() + ",Action:" + ssxDeviceDriver.getAction() + ",开始写入0清除mode信号。");
ssxDeviceDriver.writing(0);
agv_status = 0;
flag = true;
data = actionComplete(index, inst, device_code, ssxDeviceDriver.getTo_command(), Integer.parseInt(AgvActionEnum.ACTION_STATUS.code("放货完成")), "放货完成");
log.info("设备" + device_code + "已完成信号0写入,当前信号值为:" + "Mode:" + ssxDeviceDriver.getMode() + ",Move:" + ssxDeviceDriver.getMove() + ",Action:" + ssxDeviceDriver.getAction() + ",agv开始离开。");

2
nlsso-server/src/main/java/org/nl/acs/instruction/service/impl/InstructionServiceImpl.java

@ -1053,8 +1053,6 @@ public class InstructionServiceImpl extends CommonServiceImpl<InstructionMapper,
InstructionMybatis ins = ConvertUtil.convert(entity, InstructionMybatis.class);
instructionMapper.updateById(ins);
// JSONObject taskjson = taskwo.query("task_id ='" + insttaskid + "'").uniqueResult(0);
// TaskDto obj = taskjson.toJavaObject(TaskDto.class);
Task task = new LambdaQueryChainWrapper<>(taskMapper)
.eq(Task::getTask_id, insttaskid)

5
nlsso-server/src/main/java/org/nl/quartz/task/SyncDeviceStatus.java

@ -68,14 +68,15 @@ public class SyncDeviceStatus {
JSONObject json = new JSONObject();
json.put("device_code", agvNdcOneDeviceDriver.getDevice_code());
json.put("device_name", agvNdcOneDeviceDriver.getDevice_code());
json.put("device_status", AgvActionEnum.DEVICE_STATUS.check(String.valueOf(agvNdcOneDeviceDriver.getStatus())));
json.put("agv_status", AgvActionEnum.DEVICE_STATUS.check(String.valueOf(agvNdcOneDeviceDriver.getAgv_status())));
json.put("device_status", agvNdcOneDeviceDriver.getStatus());
json.put("agv_status", AgvActionEnum.ACTION_STATUS.check(String.valueOf(agvNdcOneDeviceDriver.getAgv_status())));
json.put("energyLevel", agvNdcOneDeviceDriver.getElectric_qty());
json.put("transportOrder", agvNdcOneDeviceDriver.getTransportOrder());
json.put("positionX", agvNdcOneDeviceDriver.getX());
json.put("positionY", agvNdcOneDeviceDriver.getY());
json.put("positionAngle", agvNdcOneDeviceDriver.getAngle());
json.put("message", agvNdcOneDeviceDriver.getAgv_message());
json.put("isLaden", agvNdcOneDeviceDriver.getIs_have());
AGV.add(json);
}
}

Loading…
Cancel
Save