Browse Source

提交三色灯

master
汪菘 3 years ago
parent
commit
51a2fed110
  1. 49
      hd/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/AgvServiceImpl.java
  2. 8
      hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lamp_three_color/LampThreecolorDeviceDriver.java
  3. 3
      hd/nladmin-system/src/main/java/org/nl/acs/opc/DeviceType.java
  4. 1
      hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/AutoCleanLog.java

49
hd/nladmin-system/src/main/java/org/nl/acs/agv/server/impl/AgvServiceImpl.java

@ -15,6 +15,7 @@ import org.nl.acs.config.server.AcsConfigService;
import org.nl.acs.device.service.DeviceService;
import org.nl.acs.device.service.impl.DeviceServiceImpl;
import org.nl.acs.device_driver.agv_site.AgvSiteDeviceDriver;
import org.nl.acs.device_driver.lamp_three_color.LampThreecolorDeviceDriver;
import org.nl.acs.device_driver.machines_site.MachinesSiteDeviceDriver;
import org.nl.acs.device_driver.magic3.Magic3DeviceDriver;
import org.nl.acs.device_driver.ndxy_special_two.NdxySpecialTwoDeviceDriver;
@ -1348,6 +1349,7 @@ public class AgvServiceImpl implements AgvService {
break;
default:
StandardAutodoorDeviceDriver autodoor;
LampThreecolorDeviceDriver lampThreecolorDeviceDriver;
Device doordevice = deviceAppService.findDeviceByCode(device);
if (ObjectUtil.isEmpty(doordevice)) {
throw new BadRequestException("未找到对应设备");
@ -1363,6 +1365,17 @@ public class AgvServiceImpl implements AgvService {
log.info("下发关门请求");
}
}
if (doordevice.getDeviceDriver() instanceof LampThreecolorDeviceDriver) {
lampThreecolorDeviceDriver = (LampThreecolorDeviceDriver) doordevice.getDeviceDriver();
if (StrUtil.equals("open", param)) {
lampThreecolorDeviceDriver.OpenOrClose("3");
log.info("下发红灯");
} else if (StrUtil.equals("close", param)) {
lampThreecolorDeviceDriver.OpenOrClose("2");
log.info("下发绿灯");
}
}
break;
}
@ -1400,6 +1413,22 @@ public class AgvServiceImpl implements AgvService {
JSONObject jo = JSONObject.fromObject(mes);
ja.add(jo);
}
List<Device> list2 = deviceAppService.findDevice(DeviceType.三色灯);
for (int i = 0; i < list.size(); i++) {
Device doordevice = deviceAppService.findDeviceByCode(list.get(i).getDevice_code());
if (ObjectUtil.isEmpty(doordevice)) {
throw new BadRequestException("未找到对应设备");
}
String mes = null;
LampThreecolorDeviceDriver lampThreecolorDeviceDriver;
if (doordevice.getDeviceDriver() instanceof LampThreecolorDeviceDriver) {
lampThreecolorDeviceDriver = (LampThreecolorDeviceDriver) doordevice.getDeviceDriver();
mes = lampThreecolorDeviceDriver.getStatus();
}
JSONObject jo = JSONObject.fromObject(mes);
ja.add(jo);
}
log.info("AGV查询自动门状态,反馈:{}", ja.toString());
return ja.toString();
@ -1414,6 +1443,11 @@ public class AgvServiceImpl implements AgvService {
autodoor = (StandardAutodoorDeviceDriver) doordevice.getDeviceDriver();
mes = autodoor.getStatus();
}
LampThreecolorDeviceDriver lampThreecolorDeviceDriver;
if (doordevice.getDeviceDriver() instanceof LampThreecolorDeviceDriver) {
lampThreecolorDeviceDriver = (LampThreecolorDeviceDriver) doordevice.getDeviceDriver();
mes = lampThreecolorDeviceDriver.getStatus();
}
JSONObject jo = JSONObject.fromObject(mes);
log.info("AGV查询自动门状态,反馈:{}", jo.toString());
return jo.toString();
@ -1440,6 +1474,21 @@ public class AgvServiceImpl implements AgvService {
JSONObject jo = JSONObject.fromObject(mes);
ja.add(jo);
}
List<Device> list2 = deviceAppService.findDevice(DeviceType.三色灯);
for (int i = 0; i < list2.size(); i++) {
Device doordevice = deviceAppService.findDeviceByCode(list2.get(i).getDevice_code());
if (ObjectUtil.isEmpty(doordevice)) {
throw new BadRequestException("未找到对应设备");
}
String mes = null;
LampThreecolorDeviceDriver lampThreecolorDeviceDriver;
if (doordevice.getDeviceDriver() instanceof LampThreecolorDeviceDriver) {
lampThreecolorDeviceDriver = (LampThreecolorDeviceDriver) doordevice.getDeviceDriver();
mes = lampThreecolorDeviceDriver.getStatus();
}
JSONObject jo = JSONObject.fromObject(mes);
ja.add(jo);
}
log.info("AGV查询全部自动门状态,反馈:{}", ja.toString());
return ja.toString();
}

8
hd/nladmin-system/src/main/java/org/nl/acs/device_driver/lamp_three_color/LampThreecolorDeviceDriver.java

@ -121,17 +121,13 @@ public class LampThreecolorDeviceDriver extends AbstractOpcDeviceDriver implemen
public synchronized String getStatus() {
JSONObject jo = new JSONObject();
if (action == 1) {
if (action == 2) {
jo.put("name", this.getDevice().getDevice_code());
jo.put("status", "OPEN");
} else if (action == 2) {
jo.put("name", this.getDevice().getDevice_code());
jo.put("status", "CLOSE");
} else {
jo.put("name", this.getDevice().getDevice_code());
jo.put("status", "ERROR");
jo.put("status", "CLOSE");
}
return jo.toString();
}

3
hd/nladmin-system/src/main/java/org/nl/acs/opc/DeviceType.java

@ -16,7 +16,8 @@ public enum DeviceType {
plcDb("plcDb块", 13),
autodoor("自动门", 14),
shadow("影子设备", 20),
other("其他设备", 14);
三色灯("三色灯",16),
other("其他设备", 15);
private String description;
private int order;

1
hd/nladmin-system/src/main/java/org/nl/modules/quartz/task/AutoCleanLog.java

@ -25,6 +25,7 @@ public class AutoCleanLog {
WQLObject logTab = WQLObject.getWQLObject("sys_log");
int days = Integer.parseInt(acsConfigService.findConfigFromCache().get(AcsConfig.AutoCleanDays));
logTab.delete("DATE(create_time) <= DATE(DATE_SUB(NOW(),INTERVAL " + days + " day)) limit 50");
log.info("自动清理日志执行成功...!");
}

Loading…
Cancel
Save