From d3cc456ffe53a2423c80377d4d96b79459405e29 Mon Sep 17 00:00:00 2001
From: Junjie <fallin.jie@qq.com>
Date: 星期六, 09 九月 2023 16:21:09 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java |  101 +++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 95 insertions(+), 6 deletions(-)

diff --git a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
index e47ec88..33b4420 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -69,6 +69,8 @@
     @Autowired
     private BasShuttleErrLogService basShuttleErrLogService;
     @Autowired
+    private BasLiftErrLogService basLiftErrLogService;
+    @Autowired
     private BasShuttleErrService basShuttleErrService;
     @Autowired
     private BasCrnErrorMapper basCrnErrorMapper;
@@ -1453,6 +1455,7 @@
     public void recErr() {
         try {
             this.recShuttleErr();
+            this.recLiftErr();
         } catch (Exception e) {
             News.error("recErr fail", e);
         }
@@ -1573,6 +1576,91 @@
 //                        }
 //                    }
 //                }
+            }
+        }
+    }
+
+    /**
+     * 鎻愬崌鏈哄紓甯镐俊鎭褰�
+     */
+    private void recLiftErr() {
+        Date now = new Date();
+        for (LiftSlave liftSlave : slaveProperties.getLift()) {
+            // 鑾峰彇鎻愬崌鏈轰俊鎭�
+            LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, liftSlave.getId());
+            if (liftThread == null) {
+                continue;
+            }
+            LiftProtocol liftProtocol = liftThread.getLiftProtocol();
+            if (liftProtocol == null) {
+                continue;
+            }
+
+            if (liftProtocol.getTaskNo() != 0) {
+                //鏈変换鍔�
+                BasLiftErrLog latest = basLiftErrLogService.findLatestByTaskNo(liftSlave.getId(), liftProtocol.getTaskNo().intValue());
+                // 鏈夊紓甯�
+                if (latest == null) {
+                    if (liftProtocol.getDeviceError() != null && liftProtocol.getDeviceError()) {
+                        WrkMast wrkMast = wrkMastMapper.selectById(liftProtocol.getTaskNo());
+                        if (wrkMast == null) {
+                            continue;
+                        }
+
+                        String errName = "";
+                        if (liftProtocol.getFrontOverrun()) {
+                            errName = "鍓嶈秴闄�";
+                        } else if (liftProtocol.getBackOverrun()) {
+                            errName = "鍚庤秴闄�";
+                        } else if (liftProtocol.getLeftOverrun()) {
+                            errName = "宸﹁秴闄�";
+                        } else if (liftProtocol.getRightOverrun()) {
+                            errName = "鍙宠秴闄�";
+                        } else if (liftProtocol.getOverHeight()) {
+                            errName = "瓒呴珮";
+                        } else if (liftProtocol.getOverWeight()) {
+                            errName = "瓒呴噸";
+                        }
+
+                        BasLiftErrLog basLiftErrLog = new BasLiftErrLog(
+                                null,    // 缂栧彿
+                                wrkMast.getWrkNo(),    // 宸ヤ綔鍙�
+                                now,    // 鍙戠敓鏃堕棿
+                                null,    // 缁撴潫鏃堕棿
+                                wrkMast.getWrkSts(),    // 宸ヤ綔鐘舵��
+                                wrkMast.getIoType(),    // 鍏ュ嚭搴撶被鍨�
+                                liftSlave.getId(),    // 鎻愬崌鏈�
+                                null,    // plc
+                                wrkMast.getLocNo(),    // 鐩爣搴撲綅
+                                wrkMast.getStaNo(),    // 鐩爣绔�
+                                wrkMast.getSourceStaNo(),    // 婧愮珯
+                                wrkMast.getSourceLocNo(),    // 婧愬簱浣�
+                                wrkMast.getBarcode(),    // 鏉$爜
+                                null,    // 寮傚父鐮�
+                                errName,    // 寮傚父
+                                1,    // 寮傚父鎯呭喌
+                                now,    // 娣诲姞鏃堕棿
+                                null,    // 娣诲姞浜哄憳
+                                now,    // 淇敼鏃堕棿
+                                null,    // 淇敼浜哄憳
+                                "浠诲姟涓紓甯�",    // 澶囨敞
+                                JSON.toJSONString(liftProtocol)    // 绯荤粺鐘舵�佹暟鎹�
+                        );
+                        if (!basLiftErrLogService.insert(basLiftErrLog)) {
+                            News.error("鎻愬崌鏈簆lc寮傚父璁板綍澶辫触 ===>> [id:{}] [error:{}]", liftSlave.getId(), errName);
+                        }
+                    }
+                } else {
+                    // 寮傚父淇
+                    if (liftProtocol.getDeviceError() == null || !liftProtocol.getDeviceError()) {
+                        latest.setEndTime(now);
+                        latest.setUpdateTime(now);
+                        latest.setStatus(2);
+                        if (!basLiftErrLogService.updateById(latest)) {
+                            News.error("鎻愬崌鏈簆lc寮傚父璁板綍淇澶辫触 ===>> [id:{}] [errLogId:{}]", liftSlave.getId(), latest.getId());
+                        }
+                    }
+                }
             }
         }
     }
@@ -2082,8 +2170,9 @@
             if (liftWrkMast != null) {
                 return false;//褰撳墠鎻愬崌鏈哄瓨鍦ㄦ湭瀹屾垚浠诲姟锛岀瓑寰呬笅涓�娆¤疆璇�
             }
-            NavigateNode liftNode = new NavigateNode(basLift.getPoint().getX(), basLift.getPoint().getY());
-            liftNode.setZ(basLift.getPoint().getZ());
+
+            NavigateNode liftNode = new NavigateNode(basLift.getPoint$().getX(), basLift.getPoint$().getY());
+            liftNode.setZ(basLift.getPoint$().getZ());
 
             //鑾峰彇灏忚溅鍒拌緭閫佺珯鐐硅璧板懡浠�
             NyShuttleOperaResult result = NyShuttleOperaUtils.getStartToTargetCommands(shuttleThread.getSlave().getId(), wrkMast.getWrkNo(), shuttleProtocol.getCurrentLocNo(), recentDevp.getLocNo());
@@ -2255,8 +2344,8 @@
             if (basLift.getPoint() == null) {
                 return false;//娌℃湁璁剧疆鎻愬崌鏈虹偣浣嶅潗鏍�
             }
-            NavigateNode liftNode = new NavigateNode(basLift.getPoint().getX(), basLift.getPoint().getY());
-            liftNode.setZ(basLift.getPoint().getZ());
+            NavigateNode liftNode = new NavigateNode(basLift.getPoint$().getX(), basLift.getPoint$().getY());
+            liftNode.setZ(basLift.getPoint$().getZ());
 
             List<NyShuttleHttpCommand> commands = new ArrayList<>();
             //鑾峰彇灏忚溅鍑烘彁鍗囨満琛岃蛋鍛戒护
@@ -2336,8 +2425,8 @@
             if (basLift.getPoint() == null) {
                 return false;//娌℃湁璁剧疆鎻愬崌鏈虹偣浣嶅潗鏍�
             }
-            NavigateNode liftNode = new NavigateNode(basLift.getPoint().getX(), basLift.getPoint().getY());
-            liftNode.setZ(basLift.getPoint().getZ());
+            NavigateNode liftNode = new NavigateNode(basLift.getPoint$().getX(), basLift.getPoint$().getY());
+            liftNode.setZ(basLift.getPoint$().getZ());
 
             //鑾峰彇灏忚溅浠庤緭閫佺珯鍒扮洰鏍囧簱浣嶅懡浠�
             NyShuttleOperaResult result = NyShuttleOperaUtils.getStartToTargetCommands(shuttleThread.getSlave().getId(), wrkMast.getWrkNo(), targetBasDevp.getLocNo(), wrkMast.getLocNo());

--
Gitblit v1.9.1