Browse Source

完善PDA补码造成数据混乱问题

zhifei 1 year ago
parent
commit
c6e8dc76d2

+ 3 - 3
warewms-admin/src/main/resources/application-test.yml

@@ -67,9 +67,9 @@ spring:
     druid:
       # 主库数据源
       master:
-        url: jdbc:mysql://localhost:3306/ahhl_tarece?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8
-        username: root
-        password: root
+        url: jdbc:mysql://172.20.2.8:3306/trace_system?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&serverTimezone=GMT%2B8&allowPublicKeyRetrieval=true
+        username: warewms
+        password: warewms123
       # 从库数据源
       slave:
         # 从数据源开关/默认关闭

+ 1 - 1
warewms-admin/src/main/resources/application.yml

@@ -1,7 +1,7 @@
 # 指定环境的默认配置
 spring:
   profiles:
-    active: prod
+    active: test
 
 # MES对接接口
 MES:

+ 29 - 23
warewms-system/src/main/java/com/warewms/hailiang/MES/impl/MesServiceImpl.java

@@ -75,12 +75,12 @@ public class MesServiceImpl implements MesService {
             body = HttpRequest.post(MESAddress + getBatchNoUrl).body(entries.toString()).execute().body();
         } catch (Exception e) {
             log.error("调用MES系统拿铜管批次号失败,msg:{}", e.getMessage());
-            return invokeAlarms("称重辊道PLC", "获取MES铜管批次号失败!");
+            return invokeAlarms("称重辊道PLC", "获取MES铜管批次号失败!"+e.getMessage());
         }
         JSONObject jsonObject = JSONUtil.parseObj(body);
-        if ("false".equals(jsonObject.get("ret"))) {
+        if ("false".equals(jsonObject.get("ret").toString())) {
             log.error("调用MES系统拿铜管批次号失败,msg:{}", jsonObject.get("message"));
-            return invokeAlarms("称重辊道PLC", "获取MES铜管批次号失败!");
+            return invokeAlarms("称重辊道PLC", "获取MES铜管批次号失败!"+jsonObject.get("message"));
         }
         return JSONUtil.parseObj(body).get("BatchNo").toString();
     }
@@ -102,7 +102,7 @@ public class MesServiceImpl implements MesService {
         entries.set("type", result);
         String body = HttpRequest.post(MESAddress + getBatchNoResultURl).body(entries.toString()).execute().body();
         JSONObject jsonObject = JSONUtil.parseObj(body);
-        if ("false".equals(jsonObject.get("ret"))) {
+        if ("false".equals(jsonObject.get("ret").toString())) {
             retryTofeedback(MESAddress + processFeedbackUrl, entries, "BatchNoResult");
             return null;
         }
@@ -115,10 +115,10 @@ public class MesServiceImpl implements MesService {
         JSONObject entries = new JSONObject();
         entries.set("BatchNo", batchNo);
         entries.set("Type", type);
-        entries.set("d", "Z1");
+        entries.set("LineNo", "Z1");
         String body = HttpRequest.post(MESAddress + processFeedbackUrl).body(entries.toString()).execute().body();
         JSONObject jsonObject = JSONUtil.parseObj(body);
-        if ("0".equals(jsonObject.get("RES_FLAG"))) {
+        if ("false".equals(jsonObject.get("ret"))) {
             retryTofeedback(MESAddress + processFeedbackUrl, entries, "process");
             return null;
         }
@@ -129,20 +129,26 @@ public class MesServiceImpl implements MesService {
 
     @Override
     public String bindLotNo(String deviceId,String lotNot) {
-        log.info("散盘产出设备:{}",deviceId);
-        JSONObject entries = new JSONObject();
-        entries.set("StockNo", lotNot);
-        entries.set("UnitNo",deviceId );
-        entries.set("LineNo", "Z1");
-        String body = HttpRequest.post( MESAddress+ sanPanGetBatchNoUrl).body(entries.toString()).execute().body();
-        JSONObject jsonObject = JSONUtil.parseObj(body);
-        if ("0".equals(jsonObject.get("RES_FLAG"))) {
+        JSONObject entries = null;
+        String body = null;
+        try {
+            log.info("散盘产出设备:{}",deviceId);
+            entries = new JSONObject();
+            entries.set("StockNo", lotNot);
+            entries.set("UnitNo",deviceId );
+            entries.set("LineNo", "Z1");
+            body = HttpRequest.post( MESAddress+ sanPanGetBatchNoUrl).body(entries.toString()).execute().body();
+            JSONObject jsonObject = JSONUtil.parseObj(body);
+            if ("0".equals(jsonObject.get("RES_FLAG").toString())) {
             retryTofeedback(MESAddress + sanPanGetBatchNoUrl, entries, "sanpan");
+
+            }
+            return JSONUtil.parseObj(jsonObject.get("Result")).get("mat_no").toString();
+
+        }catch (Exception e){
+            log.error("大散盘绑定批次号发生错误,json:{},body:{},msg",entries,body,e);
             return null;
         }
-        log.info(body);
-        return JSONUtil.parseObj(jsonObject.get("Result")).get("mat_no").toString();
-
     }
 
     /**
@@ -165,23 +171,23 @@ public class MesServiceImpl implements MesService {
                     String data = HttpRequest.post(URl).body(body.toString()).execute().body();
                     JSONObject jsonObject = JSONUtil.parseObj(data);
                     if ("process".equals(type)) {
-                        if ("0".equals(jsonObject.get("RES_FLAG"))) {
+                        if ("false".equals(jsonObject.get("ret").toString())) {
                             log.error("工序读码成功反馈失败,msg:{}", jsonObject.get("message"));
-                            invokeAlarms("1".equals(type) ? "铣面工序" : "轧制工序", "工序读码成功反馈MES失败!");
+                            invokeAlarms("1".equals(type) ? "铣面工序" : "轧制工序", "工序读码成功反馈MES失败!"+ jsonObject.get("message"));
                             return false;
                         }
                     }
                     if ("BatchNoResult".equals(type)){
-                        if ("false".equals(jsonObject.get("ret"))) {
+                        if ("false".equals(jsonObject.get("ret").toString())) {
                             log.error("喷码成功反馈MES失败,msg:{}", jsonObject.get("message"));
-                            invokeAlarms("喷码器", "喷码成功反馈MES失败!");
+                            invokeAlarms("喷码器", "喷码成功反馈MES失败!"+ jsonObject.get("message"));
                             return false;
                         }
                     }
                     if ("sanpan".equals(type)){
-                        if ("false".equals(jsonObject.get("ret"))) {
+                        if ("false".equals(jsonObject.get("ret").toString())) {
                             log.error("散盘托盘号反馈MES失败,msg:{}", jsonObject.get("message"));
-                            invokeAlarms("大散盘", "获取批次号失败!");
+                            invokeAlarms("大散盘", "获取批次号失败!"+ jsonObject.get("message"));
                             return false;
                         }
                     }

+ 1 - 1
warewms-system/src/main/java/com/warewms/hailiang/connect/CodeReader12Connect.java

@@ -159,7 +159,7 @@ public class CodeReader12Connect implements TCPConnectBase {
     private void ConnectsTheHeartbeat() {
         scheduledFuture = scheduledExecutorService.scheduleWithFixedDelay(() -> {
             try {
-                log.info("发送心跳,设备:{}", deviceName);
+//                log.info("发送心跳,设备:{}", deviceName);
                 pipeline.writeAndFlush(Unpooled.copiedBuffer(CodeReadProperties.heartbeat, CharsetUtil.UTF_8));
             } catch (Exception e) {
                 log.error("设备:{},连接中断", deviceName);

+ 1 - 1
warewms-system/src/main/java/com/warewms/hailiang/connect/CodeReader13Connect.java

@@ -150,7 +150,7 @@ public class CodeReader13Connect implements TCPConnectBase {
     private void ConnectsTheHeartbeat() {
         scheduledFuture = scheduledExecutorService.scheduleWithFixedDelay(() -> {
             try {
-                log.info("发送心跳,设备:{}", deviceName);
+//                log.info("发送心跳,设备:{}", deviceName);
                 pipeline.writeAndFlush(Unpooled.copiedBuffer(CodeReadProperties.heartbeat, CharsetUtil.UTF_8));
             } catch (Exception e) {
                 log.error("设备:{},连接中断", deviceName);

+ 1 - 1
warewms-system/src/main/java/com/warewms/hailiang/connect/CodeReader14Connect.java

@@ -151,7 +151,7 @@ public class CodeReader14Connect implements TCPConnectBase {
     private void ConnectsTheHeartbeat() {
         scheduledFuture = scheduledExecutorService.scheduleWithFixedDelay(() -> {
             try {
-                log.info("发送心跳,设备:{}", deviceName);
+//                log.info("发送心跳,设备:{}", deviceName);
                 pipeline.writeAndFlush(Unpooled.copiedBuffer(CodeReadProperties.heartbeat, CharsetUtil.UTF_8));
             } catch (Exception e) {
                 log.error("设备:{},连接中断", deviceName);

+ 1 - 1
warewms-system/src/main/java/com/warewms/hailiang/connect/CodeReader3Connect.java

@@ -180,7 +180,7 @@ public class CodeReader3Connect implements TCPConnectBase {
     private void ConnectsTheHeartbeat() {
         scheduledFuture = scheduledExecutorService.scheduleWithFixedDelay(() -> {
             try {
-                log.info("发送心跳,设备:{}", deviceName);
+//                log.info("发送心跳,设备:{}", deviceName);
                 pipeline.writeAndFlush(Unpooled.copiedBuffer(CodeReadProperties.heartbeat, CharsetUtil.UTF_8));
             } catch (Exception e) {
                 log.error("设备:{},连接中断", deviceName);

+ 1 - 1
warewms-system/src/main/java/com/warewms/hailiang/connect/CodeReader5Connect.java

@@ -191,7 +191,7 @@ public class CodeReader5Connect implements TCPConnectBase {
     private void ConnectsTheHeartbeat() {
         scheduledFuture = scheduledExecutorService.scheduleWithFixedDelay(() -> {
             try {
-                log.info("发送心跳,设备:{}", deviceName);
+//                log.info("发送心跳,设备:{}", deviceName);
                 pipeline.writeAndFlush(Unpooled.copiedBuffer(CodeReadProperties.heartbeat, CharsetUtil.UTF_8));
             } catch (Exception e) {
                 log.error("设备:{},连接中断", deviceName);

+ 1 - 1
warewms-system/src/main/java/com/warewms/hailiang/connect/CodeReader6Connect.java

@@ -161,7 +161,7 @@ public class CodeReader6Connect implements TCPConnectBase {
     private void ConnectsTheHeartbeat() {
         scheduledFuture = scheduledExecutorService.scheduleWithFixedDelay(() -> {
             try {
-                log.info("发送心跳,设备:{}", deviceName);
+//                log.info("发送心跳,设备:{}", deviceName);
                 pipeline.writeAndFlush(Unpooled.copiedBuffer(CodeReadProperties.heartbeat, CharsetUtil.UTF_8));
             } catch (Exception e) {
                 log.error("设备:{},连接中断", deviceName);

+ 1 - 1
warewms-system/src/main/java/com/warewms/hailiang/connect/CodeReader8Connect.java

@@ -161,7 +161,7 @@ public class CodeReader8Connect implements TCPConnectBase {
     private void ConnectsTheHeartbeat() {
         scheduledFuture = scheduledExecutorService.scheduleWithFixedDelay(() -> {
             try {
-                log.info("发送心跳,设备:{}", deviceName);
+//                log.info("发送心跳,设备:{}", deviceName);
                 pipeline.writeAndFlush(Unpooled.copiedBuffer(CodeReadProperties.heartbeat, CharsetUtil.UTF_8));
             } catch (Exception e) {
                 log.error("设备:{},连接中断", deviceName);

+ 2 - 2
warewms-system/src/main/java/com/warewms/hailiang/connect/InkjetPrintersConnect.java

@@ -133,7 +133,7 @@ public class InkjetPrintersConnect implements TCPConnectBase {
                 }
             });
         } catch (RetryException | ExecutionException e) {
-            e.printStackTrace();
+            log.error("喷码机连接故障,msg:",e);
         }
     }
 
@@ -172,7 +172,7 @@ public class InkjetPrintersConnect implements TCPConnectBase {
     private void initRoutine() {
         if (!isInitRoutine) {
             log.info("初始化打印设置");
-            movement = "初始化打印设置";
+            movement = "更新喷码机喷码内容";
             pipeline.writeAndFlush(Unpooled.copiedBuffer(ParseMsgTools.hexString2Bytes(InkjetPrintersDirectivesEnum.CODE41.getCode())));
             isInitRoutine = true;
         }

+ 2 - 2
warewms-system/src/main/java/com/warewms/hailiang/enums/DaSanPanPlcEnum.java

@@ -11,9 +11,9 @@ public enum DaSanPanPlcEnum {
     ISREAD_fourth("DB200.2.0"),
 
     /**
-     *号车任务位置
+     *号车任务位置
      */
-    TASK_ADD_1("DB200.2.0"),
+    TASK_ADD_1("DB200.4.0"),
 
 
     /**

+ 10 - 10
warewms-system/src/main/java/com/warewms/hailiang/job/TraceJob.java

@@ -48,7 +48,7 @@ public class TraceJob {
     public void getWeightSignal() throws InterruptedException {
         //获取plc实例对象读取称重信号
         boolean b = plcConnectServiceRunner.getPlcServer(DeviceNameEnum.WEIGHTPLC.getDeviceName()).readBoolean(WeighPlcEnum.IsRead.getMetadata());
-        log.info("称重信号:{}", b);
+//        log.info("称重信号:{}", b);
         if (b) {
             processRealizationService.weightProcess();
         }
@@ -60,7 +60,7 @@ public class TraceJob {
      */
     public void getTheChamferCompletionSignal() throws InterruptedException {
         byte i = plcConnectServiceRunner.getPlcServer(DeviceNameEnum.DAOJIAOPLC.getDeviceName()).readByte(DaoJiaoPlcEnum.CHECKFINISH.getMetadata());
-        log.info("喷码信号:{}", i);
+//        log.info("喷码信号:{}", i);
         if (i == 6) {
             plcConnectServiceRunner.getPlcServer(DeviceNameEnum.WEIGHTPLC.getDeviceName()).writeBoolean(WeighPlcEnum.returnWeight.getMetadata(), false);
             processRealizationService.DaoJiaoCodingCodeProcess();
@@ -73,7 +73,7 @@ public class TraceJob {
 
     public void obtainTheChamferingMachineCodeReadingSignal() {
         byte i = plcConnectServiceRunner.getPlcServer(DeviceNameEnum.DAOJIAOPLC.getDeviceName()).readByte(DaoJiaoPlcEnum.READCODE.getMetadata());
-        log.info("倒角机读码信号,{}", i);
+//        log.info("倒角机读码信号,{}", i);
         if (i == 16) {
             plcConnectServiceRunner.getPlcServer(DeviceNameEnum.DAOJIAOPLC.getDeviceName()).writeByte(DaoJiaoPlcEnum.CHECKFINISH.getMetadata(), (byte) 0);
             processRealizationService.CodeReadingProcess("CodeReader3");
@@ -85,7 +85,7 @@ public class TraceJob {
      */
     public void obtainTheMillingFaceReadingSignal() {
         boolean b = plcConnectServiceRunner.getPlcServer(DeviceNameEnum.XIMIANPLC.getDeviceName()).readBoolean(XiMianPlcEnum.ISREAD.getMetadata());
-        log.info("铣面读码信号:{}", b);
+//        log.info("铣面读码信号:{}", b);
         if (b) {
             processRealizationService.CodeReadingProcess("CodeReader5");
         }
@@ -96,7 +96,7 @@ public class TraceJob {
      */
     public void getARollingReadingSignal() {
         boolean b = plcConnectServiceRunner.getPlcServer(DeviceNameEnum.ZHAZHIPLC.getDeviceName()).readBoolean(ZhaZhiPlcEnum.ISREAD.getMetadata());
-        log.info("轧制读码信号:{}", b);
+//        log.info("轧制读码信号:{}", b);
         if (b) {
             if (ObjectUtil.isNull(redisCache.getCacheObject(DeviceNameEnum.ZHAZHIPLC.getDeviceName()))){
                 processRealizationService.CodeReadingProcess("CodeReader6");
@@ -116,7 +116,7 @@ public class TraceJob {
      */
     public void getTheDriving2CodeReadingSignal() {
         byte b = plcConnectServiceRunner.getPlcServer(DeviceNameEnum.DASANPANPLC.getDeviceName()).readByte(DaSanPanPlcEnum.ISREAD_two.getMetadata());
-        log.info("大散盘2号行车读码信号:{}", b);
+//        log.info("大散盘2号行车读码信号:{}", b);
         if (b==1) {
             processRealizationService.CodeReadingProcess("CodeReader8");
         }
@@ -134,7 +134,7 @@ public class TraceJob {
      */
     public void getTheDriving4CodeReadingSignal() {
         byte b = plcConnectServiceRunner.getPlcServer(DeviceNameEnum.DASANPANPLC.getDeviceName()).readByte(DaSanPanPlcEnum.ISREAD_fourth.getMetadata());
-        log.info("大散盘4号行车读码信号:{}", b);
+//        log.info("大散盘4号行车读码信号:{}", b);
         if (b==1) {
             processRealizationService.CodeReadingProcess("CodeReader12");
         }
@@ -145,7 +145,7 @@ public class TraceJob {
      */
     public void obtainTheLoadingReadingSignal() {
         boolean b = plcConnectServiceRunner.getPlcServer(DeviceNameEnum.TUIHUOUPPLC.getDeviceName()).readBoolean(TuiHuoUPPlcEnum.ISREAD.getMetadata());
-        log.info("大散盘4号行车读码信号:{}", b);
+//        log.info("大散盘4号行车读码信号:{}", b);
         if (b) {
             processRealizationService.CodeReadingProcess("CodeReader13");
         }
@@ -156,7 +156,7 @@ public class TraceJob {
      */
     public void obtainTheUnloadingReadingSignal() {
         boolean b = plcConnectServiceRunner.getPlcServer(DeviceNameEnum.TuiHuoDownPcl.getDeviceName()).readBoolean(TuiHuoDownPlcEnum.ISREAD.getMetadata());
-        log.info("大散盘4号行车读码信号:{}", b);
+//        log.info("大散盘4号行车读码信号:{}", b);
         if (b) {
             processRealizationService.CodeReadingProcess("CodeReader14");
         }
@@ -165,7 +165,7 @@ public class TraceJob {
     /**
      * 清空PLC信号日志
      */
-    public void cleanPLCDeviceLog() {
+    public void cleanDeviceLog() {
         int i = deviceLogService.cleanUpDataFromAWeekAgo();
         log.info("已清除三个月前的数据,数量:{}",i);
     }

+ 6 - 8
warewms-system/src/main/java/com/warewms/hailiang/service/impl/ProcessRealizationServiceImpl.java

@@ -104,14 +104,12 @@ public class ProcessRealizationServiceImpl implements ProcessRealizationService
         if (ObjectUtil.isNotNull(retroactiveNow)) {
             //更新喷码机条码内容
             String updateCode = InkjetPrintersSetUpTools.updateCode(retroactiveNow.getBatchNo());
-            ChannelFuture channelFuture = tcpServiceRunner.getTCPInstanceList("InkjetPrinters").getChannel().writeAndFlush(Unpooled.copiedBuffer(ParseMsgTools.hexString2Bytes(updateCode)));
-            if (channelFuture.isSuccess()) {
-                redisCache.setCacheObject("InkjetPrinters", retroactiveNow.getBatchNo());
-                SpringUtil.getApplicationContext().publishEvent(new DeviceLog("Z1_DaoJiao_PMQ-1-27.4", "InkjetPrinters", "喷码内容修改完成,内容为:" + retroactiveNow.getBatchNo(), "1"));
-                //回写plc信号进行喷码
-                plcConnectServiceRunner.getPlcServer(DeviceNameEnum.DAOJIAOPLC.getDeviceName()).writeByte(DaoJiaoPlcEnum.CHECKFINISH.getMetadata(), (byte) 8);
-            }
-        }else {
+            tcpServiceRunner.getTCPInstanceList("InkjetPrinters").getChannel().writeAndFlush(Unpooled.copiedBuffer(ParseMsgTools.hexString2Bytes(updateCode)));
+            redisCache.setCacheObject("InkjetPrinters", retroactiveNow.getBatchNo());
+            SpringUtil.getApplicationContext().publishEvent(new DeviceLog("Z1_DaoJiao_PMQ-1-27.4", "InkjetPrinters", "喷码内容修改完成,内容为:" + retroactiveNow.getBatchNo(), "1"));
+            //回写plc信号进行喷码
+            plcConnectServiceRunner.getPlcServer(DeviceNameEnum.DAOJIAOPLC.getDeviceName()).writeByte(DaoJiaoPlcEnum.CHECKFINISH.getMetadata(), (byte) 8);
+        } else {
             SpringUtil.getApplicationContext().publishEvent(new DeviceLog("Z1_DaoJiao_PLC-1-27.2", "DaoJiaoJiPlc", "数据不存在已称重状态的铜管信息", "1"));
         }
     }

+ 30 - 26
warewms-system/src/main/java/com/warewms/hailiang/service/impl/RetroactiveHistoryServiceImpl.java

@@ -1,6 +1,7 @@
 package com.warewms.hailiang.service.impl;
 
 import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -25,13 +26,13 @@ import java.util.Map;
 import java.util.stream.Collectors;
 
 /**
-* @author AD
-* @description 针对表【retroactive_history(生产历史追溯表)】的数据库操作Service实现
-* @createDate 2023-08-22 14:02:21
-*/
+ * @author AD
+ * @description 针对表【retroactive_history(生产历史追溯表)】的数据库操作Service实现
+ * @createDate 2023-08-22 14:02:21
+ */
 @Service
 public class RetroactiveHistoryServiceImpl extends ServiceImpl<RetroactiveHistoryMapper, RetroactiveHistory>
-    implements RetroactiveHistoryService{
+        implements RetroactiveHistoryService {
 
     @Autowired
     RetroactiveHistoryMapper retroactiveHistoryMapper;
@@ -44,13 +45,13 @@ public class RetroactiveHistoryServiceImpl extends ServiceImpl<RetroactiveHistor
 
     @Override
     public TableDataInfo<RetroactiveHistory> getListByPage(RetroactiveHistory retroactiveHistory, PageDomain pageDomain) {
-        return TableDataInfo.build(retroactiveHistoryMapper.selectPage(pageDomain.build(),new LambdaQueryWrapper<RetroactiveHistory>()
-                .like(StringUtils.isNotEmpty(retroactiveHistory.getRetroactiveId()),RetroactiveHistory::getRetroactiveId,retroactiveHistory.getRetroactiveId())
-                .like(StringUtils.isNotEmpty(retroactiveHistory.getProductionLine()),RetroactiveHistory::getProductionLine,retroactiveHistory.getProductionLine())
-                .like(StringUtils.isNotEmpty(retroactiveHistory.getBatchNo()),RetroactiveHistory::getBatchNo,retroactiveHistory.getBatchNo())
-                .like(StringUtils.isNotEmpty(retroactiveHistory.getLotNo()),RetroactiveHistory::getLotNo,retroactiveHistory.getLotNo())
-                .eq(StringUtils.isNotEmpty(retroactiveHistory.getStatus()),RetroactiveHistory::getStatus,retroactiveHistory.getStatus())
-                .eq(RetroactiveHistory::getDelFlag,"0")
+        return TableDataInfo.build(retroactiveHistoryMapper.selectPage(pageDomain.build(), new LambdaQueryWrapper<RetroactiveHistory>()
+                .like(StringUtils.isNotEmpty(retroactiveHistory.getRetroactiveId()), RetroactiveHistory::getRetroactiveId, retroactiveHistory.getRetroactiveId())
+                .like(StringUtils.isNotEmpty(retroactiveHistory.getProductionLine()), RetroactiveHistory::getProductionLine, retroactiveHistory.getProductionLine())
+                .like(StringUtils.isNotEmpty(retroactiveHistory.getBatchNo()), RetroactiveHistory::getBatchNo, retroactiveHistory.getBatchNo())
+                .like(StringUtils.isNotEmpty(retroactiveHistory.getLotNo()), RetroactiveHistory::getLotNo, retroactiveHistory.getLotNo())
+                .eq(StringUtils.isNotEmpty(retroactiveHistory.getStatus()), RetroactiveHistory::getStatus, retroactiveHistory.getStatus())
+                .eq(RetroactiveHistory::getDelFlag, "0")
                 .orderByDesc(RetroactiveHistory::getCreateTime)
 
         ));
@@ -72,13 +73,16 @@ public class RetroactiveHistoryServiceImpl extends ServiceImpl<RetroactiveHistor
                 .eq(StringUtils.isNotEmpty(retroactiveHistory.getStatus()), RetroactiveHistory::getStatus, retroactiveHistory.getStatus())
                 .orderByAsc(RetroactiveHistory::getCreateTime)).stream().collect(Collectors.groupingBy(RetroactiveHistory::getStatus));
 
-        for (RetroactiveHistory history : collect.get("5")) {
-            for (Device device : deviceService.getList()) {
-                if (device.getDeviceId().equals(history.getDeviceId())){
-                    history.setDeviceId(device.getAbbreviation());
+        if (ObjectUtil.isNotNull(collect.get("5"))) {
+            for (RetroactiveHistory history : collect.get("5")) {
+                for (Device device : deviceService.getList()) {
+                    if (device.getDeviceId().equals(history.getDeviceId())) {
+                        history.setDeviceId(device.getAbbreviation());
+                    }
                 }
             }
         }
+
         return collect;
     }
 
@@ -86,31 +90,31 @@ public class RetroactiveHistoryServiceImpl extends ServiceImpl<RetroactiveHistor
     public List<RetroactiveHistoryDTO> export(RetroactiveHistory retroactiveHistory, String ids) {
         LambdaQueryWrapper<RetroactiveHistory> retroactiveHistoryLambdaQueryWrapper = Wrappers.lambdaQuery(RetroactiveHistory.class);
         List<String> longs = new ArrayList<>();
-        if (StringUtils.isNotEmpty(ids)){
+        if (StringUtils.isNotEmpty(ids)) {
             String[] split = ids.split(",");
-            if (split.length==1){
+            if (split.length == 1) {
                 longs.add(ids);
-            }else{
+            } else {
                 longs = Arrays.asList(split);
                 System.out.println(longs);
-                retroactiveHistoryLambdaQueryWrapper.in(RetroactiveHistory::getHistoryId,longs)
+                retroactiveHistoryLambdaQueryWrapper.in(RetroactiveHistory::getHistoryId, longs)
                         .orderByAsc(RetroactiveHistory::getCreateTime);
             }
-        }else {
+        } else {
             retroactiveHistoryLambdaQueryWrapper
-                    .like(StringUtils.isNotEmpty(retroactiveHistory.getRetroactiveId()),RetroactiveHistory::getRetroactiveId,retroactiveHistory.getRetroactiveId())
-                    .eq(StringUtils.isNotEmpty(retroactiveHistory.getStatus()),RetroactiveHistory::getStatus,retroactiveHistory.getStatus())
+                    .like(StringUtils.isNotEmpty(retroactiveHistory.getRetroactiveId()), RetroactiveHistory::getRetroactiveId, retroactiveHistory.getRetroactiveId())
+                    .eq(StringUtils.isNotEmpty(retroactiveHistory.getStatus()), RetroactiveHistory::getStatus, retroactiveHistory.getStatus())
                     .orderByAsc(RetroactiveHistory::getCreateTime);
         }
-        return retroactiveHistoryMapper.selectList(retroactiveHistoryLambdaQueryWrapper).stream().map(itme->{
+        return retroactiveHistoryMapper.selectList(retroactiveHistoryLambdaQueryWrapper).stream().map(itme -> {
             RetroactiveHistoryDTO retroactiveHistoryDTO = BeanUtil.copyProperties(itme, RetroactiveHistoryDTO.class);
             for (Device device : deviceService.getList()) {
-                if(device.getDeviceId().equals(retroactiveHistoryDTO.getDeviceId())){
+                if (device.getDeviceId().equals(retroactiveHistoryDTO.getDeviceId())) {
                     retroactiveHistoryDTO.setDeviceId(device.getAbbreviation());
                 }
             }
             for (SysDictData process : dictTypeService.selectDictDataByType("process")) {
-                if (process.getDictValue().equals(retroactiveHistoryDTO.getStatus())){
+                if (process.getDictValue().equals(retroactiveHistoryDTO.getStatus())) {
                     retroactiveHistoryDTO.setStatus(process.getDictLabel());
                 }
             }