|
@@ -1,6 +1,8 @@
|
|
|
package com.warewms.hailiang.service.impl;
|
|
|
|
|
|
+import cn.hutool.extra.spring.SpringUtil;
|
|
|
import com.warewms.hailiang.domain.Device;
|
|
|
+import com.warewms.hailiang.domain.DeviceLog;
|
|
|
import com.warewms.hailiang.service.DeviceService;
|
|
|
import org.springframework.context.event.EventListener;
|
|
|
import org.springframework.scheduling.annotation.Async;
|
|
@@ -16,9 +18,9 @@ public class DeviceServiceImpl implements DeviceService {
|
|
|
|
|
|
{
|
|
|
devices.add(new Device("Z1_ChengZhong_PLC-1-52.21", "ChengZhongPlc", "称重辊道PLC", "Z1", "172.20.52.21", 102, "S7", "2"));
|
|
|
- devices.add(new Device("Z1_Daojiao_PLC-1-27.2", "DaoJiaoJiPlc", "倒角机", "Z1", "172.20.27.2", 102, "S7", "2"));
|
|
|
+ devices.add(new Device("Z1_DaoJiao_PLC-1-27.2", "DaoJiaoJiPlc", "倒角机", "Z1", "172.20.27.2", 102, "S7", "2"));
|
|
|
devices.add(new Device("Z1_DaoJiao_PMQ-1-27.4", "InkjetPrinters", "喷码器", "Z1", "172.20.27.4", 102, "TCP", "2"));
|
|
|
- devices.add(new Device("Z1_DaoJia_DMQ-1-27.3", "CodeReader3", "倒角读码器", "Z1", "172.20.27.3", 51236, "TCP", "2"));
|
|
|
+ devices.add(new Device("Z1_DaoJiao_DMQ-1-27.3", "CodeReader3", "倒角读码器", "Z1", "172.20.27.3", 51236, "TCP", "2"));
|
|
|
devices.add(new Device("Z1_Ximian_PLC-1-52.22", "XiMianPlc", "铣面辊道PLC", "Z1", "172.20.52.22", 102, "S7", "2"));
|
|
|
devices.add(new Device("Z1_XiMian_DMQ-1-27.5", "CodeReader5", "铣面读码器", "Z1", "172.20.27.5", 51236, "TCP", "2"));
|
|
|
devices.add(new Device("Z1_Zhazhi_PLC-1-52.24", "ZhaZhiPlc", "轧制辊道PLC", "Z1", "172.20.52.24", 102, "S7", "2"));
|
|
@@ -28,10 +30,10 @@ public class DeviceServiceImpl implements DeviceService {
|
|
|
devices.add(new Device("Z1_DaSanPan_DMQ-2-27.8", "CodeReader8", "大散盘读码器2", "Z1", "172.20.27.8", 51236, "TCP", "2"));
|
|
|
devices.add(new Device("Z1_DaSanPan_DMQ-3-27.9", "CodeReader9", "大散盘读码器3", "Z1", "172.20.27.9", 51236, "TCP", "2"));
|
|
|
devices.add(new Device("Z1_DaSanPan_DMQ-4-27.12", "CodeReader12", "大散盘读码器4", "Z1", "172.20.27.12", 51236, "TCP", "2"));
|
|
|
- devices.add(new Device("Z1_TuiHuoShangLiao_PLC-1-", "TuiHuoUPPlc", "退货上料plc", "Z1", "172.20.27.13", 51236, "s7", "2"));
|
|
|
- devices.add(new Device("Z1_TuiHuoXiaLiao_PLC-1-", "TuiHuoDownPlc", "退货上料plc", "Z1", "172.20.27.13", 51236, "s7", "2"));
|
|
|
- devices.add(new Device("Z1_TuiHuoShangLiao_DMQ-1-27.13", "CodeReader13", "退货上料读码器", "Z1", "172.20.27.13", 51236, "TCP", "2"));
|
|
|
- devices.add(new Device("Z1_TuiHuoXiaLiao_DMQ-1-27.14", "CodeReader14", "退货下料读码器", "Z1", "172.20.27.14", 51236, "TCP", "2"));
|
|
|
+ devices.add(new Device("Z1_TuiHuoShangLiao_PLC-1-", "TuiHuoUPPlc", "退火上料PLC", "Z1", "172.20.27.13", 51236, "s7", "2"));
|
|
|
+ devices.add(new Device("Z1_TuiHuoXiaLiao_PLC-1-", "TuiHuoDownPlc", "退火下料PLC", "Z1", "172.20.27.13", 51236, "s7", "2"));
|
|
|
+ devices.add(new Device("Z1_TuiHuoShangLiao_DMQ-1-27.13", "CodeReader13", "退火上料读码器", "Z1", "172.20.27.13", 51236, "TCP", "2"));
|
|
|
+ devices.add(new Device("Z1_TuiHuoXiaLiao_DMQ-1-27.14", "CodeReader14", "退火下料读码器", "Z1", "172.20.27.14", 51236, "TCP", "2"));
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -56,6 +58,9 @@ public class DeviceServiceImpl implements DeviceService {
|
|
|
for (Device device : devices) {
|
|
|
if(device.getDeviceName().equals(d.getDeviceName())){
|
|
|
device.setStatus(d.getStatus());
|
|
|
+ if ("2".equals(d.getStatus())){
|
|
|
+ SpringUtil.getApplicationContext().publishEvent(new DeviceLog(device.getDeviceId(), device.getDeviceName(), "连接中断,请联系管理员!",d.getStatus() ));
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|