Browse Source

简化代码

wukai 11 months ago
parent
commit
af45ad8971

+ 14 - 1
ruoyi-admin/src/main/java/com/ruoyi/biz/service/impl/ApiServiceImpl.java

@@ -137,8 +137,9 @@ public class ApiServiceImpl implements IApiService {
                 }
 
                 int alarm27 = (int) map.get("Alarm_unit_27");
+                IndexAlarm indexAlarm;
                 if (alarm27 != 0) {
-                    IndexAlarm indexAlarm = new IndexAlarm();
+                    indexAlarm = new IndexAlarm();
                     indexAlarm.setCode(device.getDeviceCode());
                     indexAlarm.setName(device.getDeviceName());
                     indexAlarm.setType(27);
@@ -146,21 +147,33 @@ public class ApiServiceImpl implements IApiService {
                 }
 
                 int stopStatus = (int) map.get("Capacity_data_48");
+                indexAlarm = new IndexAlarm();
+                indexAlarm.setCode(device.getDeviceCode());
+                indexAlarm.setName(device.getDeviceName());
+                int alarmType = 0;
                 switch (stopStatus) {
                     case 1:
                         stop1++;
+                        alarmType = 10001;
                         break;
                     case 2:
                         stop2++;
+                        alarmType = 10002;
                         break;
                     case 6:
                         stop6++;
+                        alarmType = 10006;
                         break;
                     case 7:
                         //7-盘头剩余圈数达到停机,表示停机叫料
                         stop8++;
+                        alarmType = 10008;
                     default:
                 }
+                if (alarmType != 0) {
+                    indexAlarm.setType(alarmType);
+                    alarmList.add(indexAlarm);
+                }
 
                 int[] curr = new int[5];
                 int[] max = new int[5];