提交三色灯

This commit is contained in:
USER-20220102CG\noblelift
2022-08-08 14:49:53 +08:00
parent 651357a7b5
commit 51a2fed110
4 changed files with 54 additions and 7 deletions

View File

@@ -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();
}

View File

@@ -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();
}

View File

@@ -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;

View File

@@ -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("自动清理日志执行成功...!");
}