7 Commits 6a627e05b4 ... 6798216d09

Author SHA1 Message Date
  zhifei 6798216d09 修复喷码更新问题 1 year ago
  zhifei ff5ca568e6 添加铜管追溯信息导出功能 1 year ago
  zhifei 0f9490ee56 完善设备报警 1 year ago
  zhifei c654510891 添加铣面、轧制工艺读码成功后上传MES系统 1 year ago
  zhifei 51ebbc94fe 完善倒角plc的对接 1 year ago
  zhifei 4da6cae248 添加页面手动触发读码功能 1 year ago
  zhifei 6a1211e09e 完成设备报警推送功能 1 year ago
24 changed files with 428 additions and 62 deletions
  1. 5 0
      warewms-system/pom.xml
  2. 121 0
      warewms-system/src/main/java/com/warewms/hailiang/config/DeviceMessageSocket.java
  3. 17 0
      warewms-system/src/main/java/com/warewms/hailiang/config/WebSocketConfig.java
  4. 7 6
      warewms-system/src/main/java/com/warewms/hailiang/connect/CodeReader3Connect.java
  5. 5 0
      warewms-system/src/main/java/com/warewms/hailiang/connect/CodeReader5Connect.java
  6. 6 0
      warewms-system/src/main/java/com/warewms/hailiang/connect/CodeReader6Connect.java
  7. 17 3
      warewms-system/src/main/java/com/warewms/hailiang/contoller/DeviceController.java
  8. 24 0
      warewms-system/src/main/java/com/warewms/hailiang/contoller/RetroactiveHistoryController.java
  9. 7 2
      warewms-system/src/main/java/com/warewms/hailiang/contoller/RetroactiveNowController.java
  10. 69 0
      warewms-system/src/main/java/com/warewms/hailiang/domain/DTO/RetroactiveHistoryDTO.java
  11. 2 0
      warewms-system/src/main/java/com/warewms/hailiang/domain/Device.java
  12. 3 0
      warewms-system/src/main/java/com/warewms/hailiang/domain/RetroactiveHistory.java
  13. 7 4
      warewms-system/src/main/java/com/warewms/hailiang/enums/DaoJiaoPlcEnum.java
  14. 33 33
      warewms-system/src/main/java/com/warewms/hailiang/job/TraceJob.java
  15. 1 1
      warewms-system/src/main/java/com/warewms/hailiang/service/DeviceLogService.java
  16. 3 1
      warewms-system/src/main/java/com/warewms/hailiang/service/ProcessRealizationService.java
  17. 2 0
      warewms-system/src/main/java/com/warewms/hailiang/service/RetroactiveHistoryService.java
  18. 3 0
      warewms-system/src/main/java/com/warewms/hailiang/service/RetroactiveNowService.java
  19. 7 1
      warewms-system/src/main/java/com/warewms/hailiang/service/impl/DeviceLogServiceImpl.java
  20. 11 6
      warewms-system/src/main/java/com/warewms/hailiang/service/impl/DeviceServiceImpl.java
  21. 9 4
      warewms-system/src/main/java/com/warewms/hailiang/service/impl/ProcessRealizationServiceImpl.java
  22. 54 0
      warewms-system/src/main/java/com/warewms/hailiang/service/impl/RetroactiveHistoryServiceImpl.java
  23. 6 0
      warewms-system/src/main/java/com/warewms/hailiang/service/impl/RetroactiveNowServiceImpl.java
  24. 9 1
      warewms-system/src/main/java/com/warewms/system/config/SecurityConfig.java

+ 5 - 0
warewms-system/pom.xml

@@ -31,6 +31,11 @@
             <groupId>com.github.xingshuangs</groupId>
             <artifactId>iot-communication</artifactId>
         </dependency>
+
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-websocket</artifactId>
+        </dependency>
     </dependencies>
 
 </project>

+ 121 - 0
warewms-system/src/main/java/com/warewms/hailiang/config/DeviceMessageSocket.java

@@ -0,0 +1,121 @@
+package com.warewms.hailiang.config;
+
+import com.warewms.common.annotation.Anonymous;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+
+import javax.websocket.*;
+import javax.websocket.server.PathParam;
+import javax.websocket.server.ServerEndpoint;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CopyOnWriteArraySet;
+
+@Component
+@Slf4j
+@Anonymous
+@ServerEndpoint("/websocket/device/{userName}")  // 接口路径 ws://localhost:8080/device/userName;
+public class DeviceMessageSocket {
+    //与某个客户端的连接会话,需要通过它来给客户端发送数据
+    private Session session;
+
+
+    private String userName;
+
+
+    private static CopyOnWriteArraySet<DeviceMessageSocket> webSockets =new CopyOnWriteArraySet<>();
+
+    // 用来存在线连接用户信息
+    private static ConcurrentHashMap<String,Session> sessionPool = new ConcurrentHashMap<String,Session>();
+
+    /**
+     * 链接成功调用的方法
+     */
+    @OnOpen
+    public void onOpen(Session session, @PathParam(value="userName")String userName) {
+        try {
+            this.session = session;
+            this.userName = userName;
+            webSockets.add(this);
+            sessionPool.put(userName, session);
+            log.info("【websocket消息】有新的连接,总数为:"+webSockets.size());
+        } catch (Exception e) {
+        }
+    }
+
+    /**
+     * 链接关闭调用的方法
+     */
+    @OnClose
+    public void onClose() {
+        try {
+            webSockets.remove(this);
+            sessionPool.remove(this.userName);
+        } catch (Exception e) {
+        }
+    }
+    /**
+     * 收到客户端消息后调用的方法
+     *
+     * @param message
+
+     */
+    @OnMessage
+    public void onMessage(String message) {
+        log.info("【websocket消息】收到客户端消息:"+message);
+    }
+
+    /** 发送错误时的处理
+     * @param session
+     * @param error
+     */
+    @OnError
+    public void onError(Session session, Throwable error) {
+
+        log.error("用户错误,原因:"+error.getMessage());
+        error.printStackTrace();
+    }
+
+
+    // 此为广播消息
+    public void sendAllMessage(String message) {
+        log.info("【websocket消息】广播消息:"+message);
+        for(DeviceMessageSocket webSocket : webSockets) {
+            try {
+                if(webSocket.session.isOpen()) {
+                    webSocket.session.getAsyncRemote().sendText(message);
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+    // 此为单点消息
+    public void sendOneMessage(String userName, String message) {
+        Session session = sessionPool.get(userName);
+        if (session != null&&session.isOpen()) {
+            try {
+                log.info("【websocket消息】 单点消息:"+message);
+                session.getAsyncRemote().sendText(message);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+    // 此为单点消息(多人)
+    public void sendMoreMessage(String[] userNames, String message) {
+        for(String userName:userNames) {
+            Session session = sessionPool.get(userName);
+            if (session != null&&session.isOpen()) {
+                try {
+                    log.info("【websocket消息】 单点消息:"+message);
+                    session.getAsyncRemote().sendText(message);
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+
+    }
+}

+ 17 - 0
warewms-system/src/main/java/com/warewms/hailiang/config/WebSocketConfig.java

@@ -0,0 +1,17 @@
+package com.warewms.hailiang.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.socket.server.standard.ServerEndpointExporter;
+
+@Configuration
+public class WebSocketConfig {
+    /**
+     * 	注入ServerEndpointExporter,
+     */
+    @Bean
+    public ServerEndpointExporter serverEndpointExporter() {
+        return new ServerEndpointExporter();
+    }
+
+}

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

@@ -168,27 +168,28 @@ public class CodeReader3Connect implements TCPConnectBase {
         try {
             log.info("倒角机读码器读码结果,{}", message);
             if (CodeReadProperties.failureReturnInstruction.equals(message)) {
+                plcConnectServiceRunner.getPlcServer(DeviceNameEnum.DAOJIAOPLC.getDeviceName()).writeInt32(DaoJiaoPlcEnum.RETURNOUTCOME.getMetadata(), 19);
                 //读码失败
-                SpringUtil.getApplicationContext().publishEvent(new DeviceLog("Z1_DaoJia_DMQ-1-27.3", deviceName, "未识别到码", "2"));
+                SpringUtil.getApplicationContext().publishEvent(new DeviceLog("Z1_DaoJiao_DMQ-1-27.3", deviceName, "未识别到码", "2"));
                 return;
             }
             //修改数据库信息
             RetroactiveNow retroactiveNow = new RetroactiveNow();
             retroactiveNow.setBatchNo(message);
             retroactiveNow.setStatus("2");
-            retroactiveNow.setDeviceId("Z1_DaoJia_DMQ-1-27.3");
+            retroactiveNow.setDeviceId("Z1_DaoJiao_DMQ-1-27.3");
             retroactiveNowService.updateData(retroactiveNow);
             //上传MES系统
             mesService.getBatchNoResult(message, true);
             //回写PLC读码完成
-            plcConnectServiceRunner.getPlcServer(DeviceNameEnum.DAOJIAOPLC.getDeviceName()).writeBoolean(DaoJiaoPlcEnum.RETURNOUTCOME.getMetadata(), false);
-
+            plcConnectServiceRunner.getPlcServer(DeviceNameEnum.DAOJIAOPLC.getDeviceName()).writeInt32(DaoJiaoPlcEnum.RETURNOUTCOME.getMetadata(), 18);
+            plcConnectServiceRunner.getPlcServer(DeviceNameEnum.DAOJIAOPLC.getDeviceName()).writeInt32(DaoJiaoPlcEnum.READCODE.getMetadata(), 0);
             //添加日志
-            SpringUtil.getApplicationContext().publishEvent(new DeviceLog("Z1_DaoJia_DMQ-1-27.3", deviceName, "识别到码:" + message, "1"));
+            SpringUtil.getApplicationContext().publishEvent(new DeviceLog("Z1_DaoJiao_DMQ-1-27.3", deviceName, "识别到码:" + message, "1"));
         } catch (Exception e) {
             e.printStackTrace();
             log.error("倒角读码任务执行异常,msg:{}", e.getMessage());
-            SpringUtil.getApplicationContext().publishEvent(new DeviceLog("Z1_DaoJia_DMQ-1-27.3", deviceName, "读码任务出错,msg:" + StringUtils.substring(e.getMessage(), 0, 2000), "2"));
+            SpringUtil.getApplicationContext().publishEvent(new DeviceLog("Z1_DaoJiao_DMQ-1-27.3", deviceName, "读码任务出错,msg:" + StringUtils.substring(e.getMessage(), 0, 2000), "2"));
         }
     }
 

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

@@ -2,6 +2,7 @@ package com.warewms.hailiang.connect;
 
 import cn.hutool.extra.spring.SpringUtil;
 import com.github.rholder.retry.*;
+import com.warewms.hailiang.MES.MesService;
 import com.warewms.hailiang.config.CodeReadProperties;
 import com.warewms.hailiang.connect.base.TCPConnectBase;
 import com.warewms.hailiang.domain.Device;
@@ -55,12 +56,14 @@ public class CodeReader5Connect implements TCPConnectBase {
 
     private ChannelPipeline pipeline;
 
+    private MesService mesService;
 
     private RetroactiveNowService retroactiveNowService;
 
     private PlcConnectServiceRunner plcConnectServiceRunner;
 
     {
+        mesService = SpringUtil.getBean(MesService.class);
         retroactiveNowService = SpringUtil.getBean(RetroactiveNowService.class);
         plcConnectServiceRunner = SpringUtil.getBean(PlcConnectServiceRunner.class);
     }
@@ -175,6 +178,8 @@ public class CodeReader5Connect implements TCPConnectBase {
                 retroactiveNow.setDeviceId("Z1_XiMian_DMQ-1-27.5");
                 retroactiveNowService.updateData(retroactiveNow);
                 plcConnectServiceRunner.getPlcServer(DeviceNameEnum.XIMIANPLC.getDeviceName()).writeBoolean(XiMianPlcEnum.ISREAD.getMetadata(), false);
+                //上传ME系统
+                mesService.processFeedback(message,"1");
                 //添加设备日志
                 SpringUtil.getApplicationContext().publishEvent(new DeviceLog("Z1_XiMian_DMQ-1-27.5", deviceName, "识别到码:" + message, "1"));
             }

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

@@ -2,6 +2,7 @@ package com.warewms.hailiang.connect;
 
 import cn.hutool.extra.spring.SpringUtil;
 import com.github.rholder.retry.*;
+import com.warewms.hailiang.MES.MesService;
 import com.warewms.hailiang.config.CodeReadProperties;
 import com.warewms.hailiang.connect.base.TCPConnectBase;
 import com.warewms.hailiang.domain.Device;
@@ -52,9 +53,12 @@ public class CodeReader6Connect implements TCPConnectBase {
 
     private ChannelPipeline pipeline;
 
+    private MesService mesService;
+
     private RetroactiveNowService retroactiveNowService;
 
     {
+        mesService = SpringUtil.getBean(MesService.class);
         retroactiveNowService = SpringUtil.getBean(RetroactiveNowService.class);
     }
     @Override
@@ -163,6 +167,8 @@ public class CodeReader6Connect implements TCPConnectBase {
                 retroactiveNow.setStatus("4");
                 retroactiveNow.setDeviceId("Z1_ZhaZhi_DMQ-1-27.6");
                 retroactiveNowService.updateData(retroactiveNow);
+                //上传ME系统
+                mesService.processFeedback(message,"2");
                 //添加设备日志
                 SpringUtil.getApplicationContext().publishEvent(new DeviceLog("Z1_ZhaZhi_DMQ-1-27.6", deviceName, "识别到码:" + message, "1"));
             }

+ 17 - 3
warewms-system/src/main/java/com/warewms/hailiang/contoller/DeviceController.java

@@ -1,12 +1,14 @@
 package com.warewms.hailiang.contoller;
 
+import cn.hutool.extra.spring.SpringUtil;
 import com.warewms.common.core.domain.R;
+import com.warewms.common.utils.StringUtils;
 import com.warewms.hailiang.domain.Device;
+import com.warewms.hailiang.domain.DeviceLog;
 import com.warewms.hailiang.service.DeviceService;
+import com.warewms.hailiang.service.ProcessRealizationService;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
 
@@ -22,8 +24,20 @@ public class DeviceController {
     @Autowired
     DeviceService deviceService;
 
+    @Autowired
+    ProcessRealizationService processRealizationService;
+
     @GetMapping("/list")
     public R<List<Device>> getList() {
         return R.ok(deviceService.getList());
     }
+
+    @PostMapping("/triggerCodeRead")
+    public R triggerCodeRead(@RequestBody Device device) {
+        R r = processRealizationService.CodeReadingProcess(device.getDeviceName());
+        if(R.isSuccess(r)){
+            SpringUtil.getApplicationContext().publishEvent(new DeviceLog(device.getDeviceId(), device.getDeviceName(), "手动触发读码", "1"));
+        }
+        return r;
+    }
 }

+ 24 - 0
warewms-system/src/main/java/com/warewms/hailiang/contoller/RetroactiveHistoryController.java

@@ -1,17 +1,25 @@
 package com.warewms.hailiang.contoller;
 
+import com.warewms.common.annotation.Log;
 import com.warewms.common.core.domain.R;
 import com.warewms.common.core.domain.base.page.PageDomain;
 import com.warewms.common.core.domain.base.page.TableDataInfo;
+import com.warewms.common.core.domain.entity.SysUser;
+import com.warewms.common.enums.BusinessType;
+import com.warewms.common.utils.poi.ExcelUtil;
+import com.warewms.hailiang.domain.DTO.RetroactiveHistoryDTO;
 import com.warewms.hailiang.domain.RetroactiveHistory;
 import com.warewms.hailiang.domain.RetroactiveNow;
 import com.warewms.hailiang.service.RetroactiveHistoryService;
 import com.warewms.hailiang.service.RetroactiveNowService;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.servlet.http.HttpServletResponse;
 import java.util.List;
 
 /**
@@ -39,4 +47,20 @@ public class RetroactiveHistoryController {
     public R<List<RetroactiveHistory>> getInfoList(RetroactiveHistory retroactiveHistory){
         return R.ok( retroactiveHistoryService.getHistoryList(retroactiveHistory));
     }
+
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, RetroactiveHistory retroactiveHistory)
+    {
+        List<RetroactiveHistoryDTO> historyList = retroactiveHistoryService.export(retroactiveHistory,null);
+        ExcelUtil<RetroactiveHistoryDTO> util = new ExcelUtil<RetroactiveHistoryDTO>(RetroactiveHistoryDTO.class);
+        util.exportExcel(response, historyList, "铜管信息");
+    }
+
+    @PostMapping("/exportByIds")
+    public void exportByIds(HttpServletResponse response, String  ids)
+    {
+        List<RetroactiveHistoryDTO> historyList = retroactiveHistoryService.export(null,ids);
+        ExcelUtil<RetroactiveHistoryDTO> util = new ExcelUtil<RetroactiveHistoryDTO>(RetroactiveHistoryDTO.class);
+        util.exportExcel(response, historyList, "铜管信息");
+    }
 }

+ 7 - 2
warewms-system/src/main/java/com/warewms/hailiang/contoller/RetroactiveNowController.java

@@ -12,6 +12,7 @@ import com.warewms.hailiang.service.DeviceLogService;
 import com.warewms.hailiang.service.RetroactiveNowService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -39,16 +40,20 @@ public class RetroactiveNowController {
             if (split.length==1){
                 status.add(inStatus);
             }else{
-                status = Arrays.asList(inStatus);
+                status = Arrays.asList(split);
             }
         }
         System.err.println(status);
         return retroactiveNowService.getList(retroactiveNow, pageDomain,status);
     }
 
-
     @GetMapping("/info")
     public R<RetroactiveNow> getInfo(RetroactiveNow retroactiveNow) {
         return R.ok(retroactiveNowService.selectTheOneByParameter(retroactiveNow));
     }
+
+    @PostMapping("/pda/complement")
+    public R complement(RetroactiveNow retroactiveNow){
+        return retroactiveNowService.complement(retroactiveNow);
+    }
 }

+ 69 - 0
warewms-system/src/main/java/com/warewms/hailiang/domain/DTO/RetroactiveHistoryDTO.java

@@ -0,0 +1,69 @@
+package com.warewms.hailiang.domain.DTO;
+
+import com.baomidou.mybatisplus.annotation.*;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.warewms.common.annotation.Excel;
+import com.warewms.common.core.domain.base.BaseEntity;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.Date;
+
+/**
+ * 生产历史追溯excel映射表
+ * @TableName retroactive_history
+ */
+@Data
+public class RetroactiveHistoryDTO {
+
+    /**
+     * 历史追溯编号
+     */
+    private Long historyId;
+    /**
+     * 追溯id
+     */
+    @Excel(name = "追溯编号")
+    private String retroactiveId;
+
+    /**
+     * 产线
+     */
+    @Excel(name = "产线")
+    private String productionLine;
+
+    /**
+     * 批次号
+     */
+    @Excel(name = "批次号")
+    private String batchNo;
+
+    /**
+     * 托盘号
+     */
+    @Excel(name = "托盘号")
+    private String lotNo;
+
+    /**
+     * 重量
+     */
+    @Excel(name = "重量(KG)")
+    private Double weight;
+
+    /**
+     * 生产状态
+     */
+    @Excel(name = "生产状态")
+    private String status;
+
+    /**
+     * 设备编号
+     */
+    @Excel(name = "设备编号")
+    private String deviceId;
+
+    /** 完成工艺时间 */
+    @Excel(name = "完成工艺时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Excel.Type.EXPORT)
+    private Date createTime;
+
+}

+ 2 - 0
warewms-system/src/main/java/com/warewms/hailiang/domain/Device.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.warewms.common.core.domain.base.BaseEntity;
 import lombok.Data;
+import lombok.NoArgsConstructor;
 
 import java.io.Serializable;
 
@@ -14,6 +15,7 @@ import java.io.Serializable;
  * @TableName device
  */
 @Data
+@NoArgsConstructor
 public class Device extends BaseEntity implements Serializable {
 
     /**

+ 3 - 0
warewms-system/src/main/java/com/warewms/hailiang/domain/RetroactiveHistory.java

@@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.annotation.TableName;
 import java.io.Serializable;
 import java.time.LocalDateTime;
 
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
 import com.warewms.common.core.domain.base.BaseEntity;
 import lombok.Data;
 
@@ -22,6 +24,7 @@ public class RetroactiveHistory extends BaseEntity {
      * 历史追溯编号
      */
     @TableId(type = IdType.ASSIGN_ID)
+    @JsonSerialize(using= ToStringSerializer.class)
     private Long historyId;
     /**
      * 追溯id

+ 7 - 4
warewms-system/src/main/java/com/warewms/hailiang/enums/DaoJiaoPlcEnum.java

@@ -8,14 +8,17 @@ public enum DaoJiaoPlcEnum {
     /**
      * 验证喷码机喷码内容
      */
-    CHECKFINISH("Q1.6"),
+    CHECKFINISH("VB470"),
 
     /**
-     *
+     * 读码消息
      */
-    READCODE("Q1.7"),
+    READCODE("VB472"),
 
-    RETURNOUTCOME("");
+    /**
+     * 读码反馈
+     */
+    RETURNOUTCOME("VB472");
 
     private String metadata;
 

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

@@ -6,7 +6,6 @@ import com.warewms.hailiang.init.PlcConnectServiceRunner;
 import com.warewms.hailiang.init.TcpServiceRunner;
 import com.warewms.hailiang.service.ProcessRealizationService;
 import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
 import javax.annotation.Resource;
@@ -55,11 +54,12 @@ public class TraceJob {
      * 获取喷码信号
      */
     public void getTheChamferCompletionSignal() {
-//        boolean b = plcConnectServiceRunner.getPlcServer(DeviceNameEnum.DAOJIAOPLC.getDeviceName()).readBoolean(DaoJiaoPlcEnum.CHECKFINISH.getMetadata());
-//        log.info("喷码信号:{}", b);
-//        if (b) {
+        Integer i = plcConnectServiceRunner.getPlcServer(DeviceNameEnum.DAOJIAOPLC.getDeviceName()).readInt32(DaoJiaoPlcEnum.CHECKFINISH.getMetadata());
+        log.info("喷码信号:{}", i);
+        if (i.equals(6)) {
             processRealizationService.DaoJiaoCodingCodeProcess();
-//        }
+            plcConnectServiceRunner.getPlcServer(DeviceNameEnum.DAOJIAOPLC.getDeviceName()).writeInt32(DaoJiaoPlcEnum.CHECKFINISH.getMetadata(),0);
+        }
     }
 
     /**
@@ -67,44 +67,44 @@ public class TraceJob {
      */
 
     public void obtainTheChamferingMachineCodeReadingSignal (){
-//        boolean b = plcConnectServiceRunner.getPlcServer(DeviceNameEnum.DAOJIAOPLC.getDeviceName()).readBoolean(DaoJiaoPlcEnum.READCODE.getMetadata());
-//        log.info("倒角机读码信号,{}",b);
-//        if (b) {
+        Integer i = plcConnectServiceRunner.getPlcServer(DeviceNameEnum.DAOJIAOPLC.getDeviceName()).readInt32(DaoJiaoPlcEnum.READCODE.getMetadata());
+        log.info("倒角机读码信号,{}",i);
+        if (i.equals(16)) {
             processRealizationService.CodeReadingProcess("CodeReader3");
-//        }
+        }
     }
 
     /**
      * 获取铣面读码信号
      */
     public void obtainTheMillingFaceReadingSignal() {
-//        boolean b = plcConnectServiceRunner.getPlcServer(DeviceNameEnum.XIMIANPLC.getDeviceName()).readBoolean(XiMianPlcEnum.ISREAD.getMetadata());
-//        log.info("铣面读码信号:{}", b);
-//        if (b) {
+        boolean b = plcConnectServiceRunner.getPlcServer(DeviceNameEnum.XIMIANPLC.getDeviceName()).readBoolean(XiMianPlcEnum.ISREAD.getMetadata());
+        log.info("铣面读码信号:{}", b);
+        if (b) {
             processRealizationService.CodeReadingProcess("CodeReader5");
-//        }
+        }
     }
 
     /**
      * 获取轧制读码信号
      */
     public void getARollingReadingSignal() {
-//        boolean b = plcConnectServiceRunner.getPlcServer(DeviceNameEnum.ZHAZHIPLC.getDeviceName()).readBoolean(ZhaZhiPlcEnum.ISREAD.getMetadata());
-//        log.info("轧制读码信号:{}", b);
-//        if (b) {
+        boolean b = plcConnectServiceRunner.getPlcServer(DeviceNameEnum.ZHAZHIPLC.getDeviceName()).readBoolean(ZhaZhiPlcEnum.ISREAD.getMetadata());
+        log.info("轧制读码信号:{}", b);
+        if (b) {
             processRealizationService.CodeReadingProcess("CodeReader6");
-//        }
+        }
     }
 
     /**
      * 获取行车1读码信号
      */
     public void getTheDriving1CodeReadingSignal() {
-//        boolean b = plcConnectServiceRunner.getPlcServer(DeviceNameEnum.DASANPANPLC.getDeviceName()).readBoolean(DaSanPanPlcEnum.ISREAD_one.getMetadata());
-//        log.info("大散盘1号行车读码信号:{}", b);
-//        if (b) {
+        boolean b = plcConnectServiceRunner.getPlcServer(DeviceNameEnum.DASANPANPLC.getDeviceName()).readBoolean(DaSanPanPlcEnum.ISREAD_one.getMetadata());
+        log.info("大散盘1号行车读码信号:{}", b);
+        if (b) {
             processRealizationService.CodeReadingProcess("CodeReader7");
-//        }
+        }
     }
 
     /**
@@ -125,32 +125,32 @@ public class TraceJob {
      * 获取行车4读码信号
      */
     public void getTheDriving4CodeReadingSignal() {
-//        boolean b = plcConnectServiceRunner.getPlcServer(DeviceNameEnum.DASANPANPLC.getDeviceName()).readBoolean(DaSanPanPlcEnum.ISREAD_fourth.getMetadata());
-//        log.info("大散盘4号行车读码信号:{}", b);
-//        if (b) {
+        boolean b = plcConnectServiceRunner.getPlcServer(DeviceNameEnum.DASANPANPLC.getDeviceName()).readBoolean(DaSanPanPlcEnum.ISREAD_fourth.getMetadata());
+        log.info("大散盘4号行车读码信号:{}", b);
+        if (b) {
             processRealizationService.CodeReadingProcess("CodeReader12");
-//        }
+        }
     }
 
     /**
      * 获取上料读码信号
      */
     public void obtainTheLoadingReadingSignal() {
-//        boolean b = plcConnectServiceRunner.getPlcServer(DeviceNameEnum.TUIHUOUPPLC.getDeviceName()).readBoolean(TuiHuoUPPlcEnum.ISREAD.getMetadata());
-//        log.info("大散盘4号行车读码信号:{}", b);
-//        if (b) {
+        boolean b = plcConnectServiceRunner.getPlcServer(DeviceNameEnum.TUIHUOUPPLC.getDeviceName()).readBoolean(TuiHuoUPPlcEnum.ISREAD.getMetadata());
+        log.info("大散盘4号行车读码信号:{}", b);
+        if (b) {
             processRealizationService.CodeReadingProcess("CodeReader13");
-//        }
+        }
     }
 
     /**
      * 获取下料读码信号
      */
     public void obtainTheUnloadingReadingSignal() {
-//        boolean b = plcConnectServiceRunner.getPlcServer(DeviceNameEnum.TuiHuoDownPcl.getDeviceName()).readBoolean(TuiHuoDownPlcEnum.ISREAD.getMetadata());
-//        log.info("大散盘4号行车读码信号:{}", b);
-//        if (b) {
+        boolean b = plcConnectServiceRunner.getPlcServer(DeviceNameEnum.TuiHuoDownPcl.getDeviceName()).readBoolean(TuiHuoDownPlcEnum.ISREAD.getMetadata());
+        log.info("大散盘4号行车读码信号:{}", b);
+        if (b) {
             processRealizationService.CodeReadingProcess("CodeReader14");
-//        }
+        }
     }
 }

+ 1 - 1
warewms-system/src/main/java/com/warewms/hailiang/service/DeviceLogService.java

@@ -17,6 +17,6 @@ public interface DeviceLogService extends IService<DeviceLog> {
 
     TableDataInfo<DeviceLog> getList(DeviceLog deviceLog, PageDomain pageDomain);
 
-    void crateLog(DeviceLog deviceLog);
+    void createLog(DeviceLog deviceLog);
 
 }

+ 3 - 1
warewms-system/src/main/java/com/warewms/hailiang/service/ProcessRealizationService.java

@@ -1,5 +1,7 @@
 package com.warewms.hailiang.service;
 
+import com.warewms.common.core.domain.R;
+
 /**
  * 工艺流程实现
  */
@@ -18,6 +20,6 @@ public interface ProcessRealizationService {
     /**
      * 读码触发实现
      */
-    void CodeReadingProcess(String codeReadName);
+    R CodeReadingProcess(String codeReadName);
 
 }

+ 2 - 0
warewms-system/src/main/java/com/warewms/hailiang/service/RetroactiveHistoryService.java

@@ -2,6 +2,7 @@ package com.warewms.hailiang.service;
 
 import com.warewms.common.core.domain.base.page.PageDomain;
 import com.warewms.common.core.domain.base.page.TableDataInfo;
+import com.warewms.hailiang.domain.DTO.RetroactiveHistoryDTO;
 import com.warewms.hailiang.domain.RetroactiveHistory;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.warewms.hailiang.domain.RetroactiveNow;
@@ -19,4 +20,5 @@ public interface RetroactiveHistoryService extends IService<RetroactiveHistory>
 
     List<RetroactiveHistory> getHistoryList(RetroactiveHistory retroactiveHistory);
 
+    List<RetroactiveHistoryDTO> export(RetroactiveHistory retroactiveHistory, String ids);
 }

+ 3 - 0
warewms-system/src/main/java/com/warewms/hailiang/service/RetroactiveNowService.java

@@ -1,6 +1,7 @@
 package com.warewms.hailiang.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.warewms.common.core.domain.R;
 import com.warewms.common.core.domain.base.page.PageDomain;
 import com.warewms.common.core.domain.base.page.TableDataInfo;
 import com.warewms.hailiang.domain.RetroactiveNow;
@@ -23,4 +24,6 @@ public interface RetroactiveNowService extends IService<RetroactiveNow> {
     int updateData(RetroactiveNow retroactiveNow);
 
     int finishProduce(RetroactiveNow retroactiveNow);
+
+    R complement(RetroactiveNow retroactiveNow);
 }

+ 7 - 1
warewms-system/src/main/java/com/warewms/hailiang/service/impl/DeviceLogServiceImpl.java

@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.warewms.common.core.domain.base.page.PageDomain;
 import com.warewms.common.core.domain.base.page.TableDataInfo;
 import com.warewms.common.utils.StringUtils;
+import com.warewms.hailiang.config.DeviceMessageSocket;
 import com.warewms.hailiang.domain.DeviceLog;
 import com.warewms.hailiang.mapper.DeviceLogMapper;
 import com.warewms.hailiang.service.DeviceLogService;
@@ -30,6 +31,9 @@ public class DeviceLogServiceImpl extends ServiceImpl<DeviceLogMapper, DeviceLog
     @Autowired
     DeviceLogMapper deviceLogMapper;
 
+    @Autowired
+    DeviceMessageSocket deviceMessageSocket;
+
 
     @Override
     public TableDataInfo<DeviceLog> getList(DeviceLog deviceLog, PageDomain pageDomain) {
@@ -47,10 +51,12 @@ public class DeviceLogServiceImpl extends ServiceImpl<DeviceLogMapper, DeviceLog
     @Override
     @Async
     @EventListener
-    public void crateLog(DeviceLog deviceLog) {
+    public void createLog(DeviceLog deviceLog) {
         deviceLog.setCreateBy("system");
         deviceLog.setUpdateBy("system");
         deviceLogMapper.insert(deviceLog);
+        //推送消息
+        deviceMessageSocket.sendAllMessage(deviceLog.toString());
     }
 
 }

+ 11 - 6
warewms-system/src/main/java/com/warewms/hailiang/service/impl/DeviceServiceImpl.java

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

+ 9 - 4
warewms-system/src/main/java/com/warewms/hailiang/service/impl/ProcessRealizationServiceImpl.java

@@ -2,12 +2,14 @@ package com.warewms.hailiang.service.impl;
 
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.extra.spring.SpringUtil;
+import com.warewms.common.core.domain.R;
 import com.warewms.common.core.redis.RedisCache;
 import com.warewms.common.utils.StringUtils;
 import com.warewms.hailiang.MES.MesService;
 import com.warewms.hailiang.config.CodeReadProperties;
 import com.warewms.hailiang.domain.DeviceLog;
 import com.warewms.hailiang.domain.RetroactiveNow;
+import com.warewms.hailiang.enums.DaoJiaoPlcEnum;
 import com.warewms.hailiang.enums.DeviceNameEnum;
 import com.warewms.hailiang.enums.WeighPlcEnum;
 import com.warewms.hailiang.init.PlcConnectServiceRunner;
@@ -72,7 +74,7 @@ public class ProcessRealizationServiceImpl implements ProcessRealizationService
                 //更新喷码机条码内容
                 String updateCode = InkjetPrintersSetUpTools.updateCode(retroactiveNow.getBatchNo());
                 tcpServiceRunner.getTCPInstanceList("InkjetPrinters").getChannel().writeAndFlush(ParseMsgTools.hexString2Bytes(updateCode));
-                redisCache.setCacheObject("InkjetPrinters", updateCode);
+                redisCache.setCacheObject("InkjetPrinters", BatchNo);
                 SpringUtil.getApplicationContext().publishEvent(new DeviceLog("Z1_DaoJiao_PMQ-1-27.4", "InkjetPrinters", "喷码内容修改完成,内容为:" + retroactiveNow.getBatchNo(), "1"));
                 log.info("追溯记录生成成功,BatchNo:{}", BatchNo);
             }
@@ -94,16 +96,19 @@ public class ProcessRealizationServiceImpl implements ProcessRealizationService
                 SpringUtil.getApplicationContext().publishEvent(new DeviceLog("Z1_DaoJiao_PMQ-1-27.4", "InkjetPrinters", "喷码内容修改完成,内容为:" + retroactiveNow.getBatchNo(), "1"));
             }
             //回写plc信号进行喷码
+            plcConnectServiceRunner.getPlcServer(DeviceNameEnum.DAOJIAOPLC.getDeviceName()).writeInt32(DaoJiaoPlcEnum.CHECKFINISH.getMetadata(),8);
         }
     }
 
     @Override
-    public void CodeReadingProcess(String codeReadName) {
+    public R CodeReadingProcess(String codeReadName) {
+        System.out.println(codeReadName);
         if (redisCache.hasKey(codeReadName)) {
             log.info("读码器{}正在读码!", codeReadName);
-            return;
+            return R.fail("该读码器正在读码,请勿重复操作");
         }
         tcpServiceRunner.getTCPInstanceList(codeReadName).getChannel().writeAndFlush(Unpooled.copiedBuffer(CodeReadProperties.startTheCommand, CharsetUtil.UTF_8));
-        redisCache.expire(codeReadName, 30, TimeUnit.SECONDS);
+        redisCache.setCacheObject(codeReadName,codeReadName, 30, TimeUnit.SECONDS);
+        return R.ok();
     }
 }

+ 54 - 0
warewms-system/src/main/java/com/warewms/hailiang/service/impl/RetroactiveHistoryServiceImpl.java

@@ -1,18 +1,29 @@
 package com.warewms.hailiang.service.impl;
 
+import cn.hutool.core.bean.BeanUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.warewms.common.core.domain.base.page.PageDomain;
 import com.warewms.common.core.domain.base.page.TableDataInfo;
+import com.warewms.common.core.domain.entity.SysDictData;
 import com.warewms.common.utils.StringUtils;
+import com.warewms.hailiang.domain.DTO.RetroactiveHistoryDTO;
+import com.warewms.hailiang.domain.Device;
 import com.warewms.hailiang.domain.RetroactiveHistory;
 import com.warewms.hailiang.domain.RetroactiveNow;
+import com.warewms.hailiang.service.DeviceService;
 import com.warewms.hailiang.service.RetroactiveHistoryService;
 import com.warewms.hailiang.mapper.RetroactiveHistoryMapper;
+import com.warewms.system.service.impl.SysDictTypeServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.sql.Wrapper;
+import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
+import java.util.stream.Collectors;
 
 /**
 * @author AD
@@ -26,9 +37,16 @@ public class RetroactiveHistoryServiceImpl extends ServiceImpl<RetroactiveHistor
     @Autowired
     RetroactiveHistoryMapper retroactiveHistoryMapper;
 
+    @Autowired
+    DeviceService deviceService;
+
+    @Autowired
+    SysDictTypeServiceImpl dictTypeService;
+
     @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())
@@ -45,6 +63,42 @@ public class RetroactiveHistoryServiceImpl extends ServiceImpl<RetroactiveHistor
                 .eq(StringUtils.isNotEmpty(retroactiveHistory.getStatus()),RetroactiveHistory::getStatus,retroactiveHistory.getStatus())
                 .orderByAsc(RetroactiveHistory::getCreateTime));
     }
+
+    @Override
+    public List<RetroactiveHistoryDTO> export(RetroactiveHistory retroactiveHistory, String ids) {
+        LambdaQueryWrapper<RetroactiveHistory> retroactiveHistoryLambdaQueryWrapper = Wrappers.lambdaQuery(RetroactiveHistory.class);
+        List<String> longs = new ArrayList<>();
+        if (StringUtils.isNotEmpty(ids)){
+            String[] split = ids.split(",");
+            if (split.length==1){
+                longs.add(ids);
+            }else{
+                longs = Arrays.asList(split);
+                System.out.println(longs);
+                retroactiveHistoryLambdaQueryWrapper.in(RetroactiveHistory::getHistoryId,longs)
+                        .orderByAsc(RetroactiveHistory::getCreateTime);
+            }
+        }else {
+            retroactiveHistoryLambdaQueryWrapper
+                    .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->{
+            RetroactiveHistoryDTO retroactiveHistoryDTO = BeanUtil.copyProperties(itme, RetroactiveHistoryDTO.class);
+            for (Device device : deviceService.getList()) {
+                if(device.getDeviceId().equals(retroactiveHistoryDTO.getDeviceId())){
+                    retroactiveHistoryDTO.setDeviceId(device.getAbbreviation());
+                }
+            }
+            for (SysDictData process : dictTypeService.selectDictDataByType("process")) {
+                if (process.getDictValue().equals(retroactiveHistoryDTO.getStatus())){
+                    retroactiveHistoryDTO.setStatus(process.getDictLabel());
+                }
+            }
+            return retroactiveHistoryDTO;
+        }).collect(Collectors.toList());
+    }
 }
 
 

+ 6 - 0
warewms-system/src/main/java/com/warewms/hailiang/service/impl/RetroactiveNowServiceImpl.java

@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.ObjectUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.warewms.common.core.domain.R;
 import com.warewms.common.core.domain.base.page.PageDomain;
 import com.warewms.common.core.domain.base.page.TableDataInfo;
 import com.warewms.common.exception.ServiceException;
@@ -115,6 +116,11 @@ public class RetroactiveNowServiceImpl extends ServiceImpl<RetroactiveNowMapper,
         retroactiveHistoryMapper.insert(retroactiveHistory);
         return retroactiveNowMapper.deleteById(baseData);
     }
+
+    @Override
+    public R complement(RetroactiveNow retroactiveNow) {
+        return null;
+    }
 }
 
 

+ 9 - 1
warewms-system/src/main/java/com/warewms/system/config/SecurityConfig.java

@@ -11,6 +11,7 @@ import org.springframework.security.authentication.AuthenticationManager;
 import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
 import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
 import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.annotation.web.builders.WebSecurity;
 import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
 import org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer;
 import org.springframework.security.config.http.SessionCreationPolicy;
@@ -77,6 +78,13 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
         return super.authenticationManagerBean();
     }
 
+    @Override
+    public void configure(WebSecurity web) throws Exception {
+        web.ignoring().antMatchers(
+                "/ws/**"
+        );
+    }
+
     /**
      * anyRequest          |   匹配所有请求路径
      * access              |   SpringEl表达式结果为true时可以访问
@@ -111,7 +119,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter
                 // 过滤请求
                 .authorizeRequests()
                 // 对于登录login 注册register 验证码captchaImage 允许匿名访问
-                .antMatchers("/login", "/register","/test/**").permitAll()
+                .antMatchers("/login", "/register","/test/**","/websocket/**").permitAll()
                 // 静态资源,可匿名访问
                 .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
                 .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()