From 2028b51aeda2b6b23fda4183875b145d5e83822f Mon Sep 17 00:00:00 2001
From: zjj <zjj123456>
Date: 星期三, 19 六月 2024 11:06:50 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/gdykwcs' into gdykwcs

---
 src/main/java/com/zy/asrs/controller/CrnController.java |   40 +++++++++++++++++++++++++++++++++++++---
 1 files changed, 37 insertions(+), 3 deletions(-)

diff --git a/src/main/java/com/zy/asrs/controller/CrnController.java b/src/main/java/com/zy/asrs/controller/CrnController.java
index 52fadad..e4fcfca 100644
--- a/src/main/java/com/zy/asrs/controller/CrnController.java
+++ b/src/main/java/com/zy/asrs/controller/CrnController.java
@@ -35,6 +35,7 @@
 import com.zy.core.model.protocol.CrnProtocol;
 import com.zy.core.properties.SlaveProperties;
 import com.zy.core.properties.SystemProperties;
+import com.zy.core.thread.RgvThread;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -248,6 +249,8 @@
         command.setDestinationPosX(param.getRow());     // 鐩爣搴撲綅鎺�
         command.setDestinationPosY(param.getBay());     // 鐩爣搴撲綅鍒�
         command.setDestinationPosZ(param.getLev());     // 鐩爣搴撲綅灞�
+        boolean locSts = isLocSts(param.getRow().toString(), param.getBay().toString(), param.getLev().toString());
+        command.setTraySize(locSts);
         return crnControl(command)?R.ok():R.error();
     }
 
@@ -265,6 +268,8 @@
         command.setDestinationPosX(param.getRow());     // 鐩爣搴撲綅鎺�
         command.setDestinationPosY(param.getBay());     // 鐩爣搴撲綅鍒�
         command.setDestinationPosZ(param.getLev());     // 鐩爣搴撲綅灞�
+        boolean locSts = isLocSts(param.getSourceRow().toString(), param.getSourceBay().toString(), param.getSourceLev().toString());
+        command.setTraySize(locSts);
         return crnControl(command)?R.ok():R.error();
     }
 
@@ -286,7 +291,11 @@
                 .eq("bay1", command.getSourcePosY()).eq("lev1", command.getSourcePosZ()));
         LocMast loc = locMastService.selectOne(new EntityWrapper<LocMast>().eq("row1", command.getDestinationPosX())
                 .eq("bay1", command.getDestinationPosY()).eq("lev1", command.getDestinationPosZ()));
-        VersionUtils.locMoveCheckLocType(sourceLoc, loc);
+        if (sourceLoc.getLocType1() != loc.getLocType1()){
+            return R.error("搴撲綅绫诲瀷涓嶄竴鑷�");
+        }
+        command.setTraySize(loc.getLocType1() == 2);
+//        VersionUtils.locMoveCheckLocType(sourceLoc, loc);
         return crnControl(command)?R.ok():R.error();
     }
 
@@ -376,6 +385,8 @@
         return crnControl(command)?R.ok():R.error();
     }
 
+
+
 //    @ManagerAuth(memo = "鏆傚仠")
 //    @PostMapping("/operator/pause")
 //    public R crnPause(CrnOperatorParam param){
@@ -394,8 +405,18 @@
         if (param.getCrnNo() == null) {
             throw new CoolException("璇烽�夋嫨鍫嗗灈鏈�");
         }
-        MessageQueue.clear(SlaveType.Crn, param.getCrnNo());
-        return R.ok("娓呴櫎鍛戒护鎴愬姛");
+        CrnCommand command = new CrnCommand();
+        command.setCrnNo(param.getCrnNo()); // 鍫嗗灈鏈虹紪鍙�
+        command.setTaskNo((short) 0); // 宸ヤ綔鍙�
+        command.setAckFinish((short) 0);  // 浠诲姟瀹屾垚纭浣�
+        command.setTaskMode(CrnTaskModeType.NONE); // 浠诲姟妯″紡
+        command.setSourcePosX((short) 0);     // 婧愬簱浣嶆帓
+        command.setSourcePosY((short) 0);     // 婧愬簱浣嶅垪
+        command.setSourcePosZ((short) 0);     // 婧愬簱浣嶅眰
+        command.setDestinationPosX((short) 0);     // 鐩爣搴撲綅鎺�
+        command.setDestinationPosY((short) 0);     // 鐩爣搴撲綅鍒�
+        command.setDestinationPosZ((short) 0);     // 鐩爣搴撲綅灞�
+        return crnControl(command)?R.ok():R.error();
     }
 
     @ManagerAuth(memo = "鎵嬪姩澶嶄綅")
@@ -420,6 +441,7 @@
                 crnCommand.setCrnNo(crn.getId()); // 鍫嗗灈鏈虹紪鍙�
                 crnCommand.setTaskMode(CrnTaskModeType.CLEAR);
                 crnCommand.setAckFinish((short) 0);  // 浠诲姟瀹屾垚纭浣�
+                crnCommand.setCommand((short) 0);  // 浠诲姟瀹屾垚纭浣�
                 // 寤舵椂鍙戦��
                 Thread.sleep(1000L);
                 if (MessageQueue.offer(SlaveType.Crn, crn.getId(), new Task(2, crnCommand))) {
@@ -490,5 +512,17 @@
         }
     }
 
+    private boolean isLocSts(String row,String bay,String lev){
+        String loc = String.format("%2d",row)+String.format("%3d",bay)+String.format("%2d",lev);
+        LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", loc));
+        if (Cools.isEmpty(locMast)){
+            return false;
+        }
+        if (locMast.getLocType1() == 2){
+            return true;
+        }
+        return false;
+    }
+
 
 }

--
Gitblit v1.9.1