|
@@ -0,0 +1,47 @@
|
|
|
+package com.warewms.hailiang.service.impl;
|
|
|
+
|
|
|
+import com.warewms.common.core.domain.base.page.TableDataInfo;
|
|
|
+import com.warewms.hailiang.domian.Device;
|
|
|
+import com.warewms.hailiang.service.DeviceService;
|
|
|
+import org.apache.ibatis.annotations.Update;
|
|
|
+import org.springframework.context.event.EventListener;
|
|
|
+import org.springframework.scheduling.annotation.Async;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+@Service
|
|
|
+public class DeviceServiceImpl implements DeviceService {
|
|
|
+
|
|
|
+ private List<Device> devices = new ArrayList<>();
|
|
|
+
|
|
|
+ {
|
|
|
+ devices.add(new Device("Z1_Daojia_PMJG-1-27.2", "DaoJiaoJiPlc", "倒角机", "Z1", "172.20.27.2", 102, "S7", "2"));
|
|
|
+ devices.add(new Device("Z1_DaoJiao_PMQ-1-27.4", "PanMaQi", "喷码器", "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_XiMian_DMQ-1-27.5", "CodeReader5", "铣面读码器", "Z1", "172.20.27.5", 51236, "TCP", "2"));
|
|
|
+ devices.add(new Device("Z1_ZhaZhi_DMQ-1-27.6", "CodeReader6", "轧制读码器", "Z1", "172.20.27.6", 51236, "TCP", "2"));
|
|
|
+ devices.add(new Device("Z1_DaSanPan_DMQ-1-27.7", "CodeReader7", "大散盘读码器1", "Z1", "172.20.27.7", 51236, "TCP", "2"));
|
|
|
+ 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_TuiHuoSShangLiao_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
|
|
|
+ public List<Device> getList() {
|
|
|
+ return devices;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Async
|
|
|
+ @EventListener
|
|
|
+ void updateStatus(Device d){
|
|
|
+ for (Device device : devices) {
|
|
|
+ if(device.getDeviceName().equals(d.getDeviceName())){
|
|
|
+ device.setStatus(d.getStatus());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|