From b3a01c368c8cd08aa21f4b226ad5885b1cc2a234 Mon Sep 17 00:00:00 2001
From: zhangchao <zc857179121@qq.com>
Date: 星期四, 05 九月 2024 19:05:14 +0800
Subject: [PATCH] 1

---
 src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java |   85 +++++++++++++++++++++---------------------
 1 files changed, 43 insertions(+), 42 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 b3e674b..5283bde 100644
--- a/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MainServiceImpl.java
@@ -91,17 +91,17 @@
     @Value("${wms.url}")
     private String wmsUrl;
 
-    private Short getWorkMode(Integer bay) {
-        if (bay == 2 || bay == 7) {
+    private Short getWorkMode(Short locType1, Integer bay) {
+        if (locType1 == 2) {
             return (short) 3;
-        } else if (bay == 3) {
-            return (short) 2;
-        } else if (bay == 4) {
-            return (short) 2;
-        } else if (bay == 5) {
-            return (short) 1;
+        } else if (locType1 == 5) {
+            return (short) 3;
         } else {
-            return (short) 0;
+            if (bay == 5) {
+                return (short) 1;
+            } else {
+                return (short) 2;
+            }
         }
     }
 
@@ -803,8 +803,7 @@
                 flag = true;
             }
             if (!flag) {
-                //TODO
-                News.error("" + mark + " - 1" + " - 3" + " - 鍫嗗灈鏈哄叆搴撶珯淇℃伅(浠ヤ笅闇�瑕佸叏true):" + "鑷姩淇″彿" + staProtocol.isAutoing() + "鏈夌墿淇″彿" + staProtocol.isLoading() + "宸ヤ綔鍙�>0" + staProtocol.getWorkNo() + "鍙叆淇″彿" + staProtocol.isInEnable() + "鑳藉叆淇″彿锛坵ms璁剧疆锛�.equals(\"Y\")" + staDetl.getCanining());
+                News.errorNoLog("" + mark + " - 1" + " - 3" + " - 鍫嗗灈鏈哄叆搴撶珯淇℃伅(浠ヤ笅闇�瑕佸叏true):" + "鑷姩淇″彿" + staProtocol.isAutoing() + "鏈夌墿淇″彿" + staProtocol.isLoading() + "宸ヤ綔鍙�>0" + staProtocol.getWorkNo() + "鍙叆淇″彿" + staProtocol.isInEnable() + "鑳藉叆淇″彿锛坵ms璁剧疆锛�.equals(\"Y\")" + staDetl.getCanining());
                 continue;
             }
             // 鑾峰彇宸ヤ綔鐘舵�佷负2锛堣澶囦笂璧帮級鐨勫叆搴撳伐浣滄。
@@ -883,7 +882,7 @@
             CrnCommand crnCommand = new CrnCommand();
             crnCommand.setCrnNo(slave.getId()); // 鍫嗗灈鏈虹紪鍙�
             crnCommand.setTaskNo(wrkMast.getWrkNo().shortValue()); // 宸ヤ綔鍙�
-            Short workMode = getWorkMode(locMast.getBay1());
+            Short workMode = getWorkMode(locMast.getLocType1(), locMast.getBay1());
             if (workMode == 2) {
                 //CrnTaskModeType璇ユ灇涓剧被鏃犳晥锛屽彧鏈�1浠h〃宸ヤ綅锛�2浠h〃宸ヤ綅2锛�3鍙屽伐浣�
                 crnCommand.setTaskMode(CrnTaskModeType.PAKOUT);
@@ -1055,12 +1054,13 @@
                     News.warnNoLog("" + mark + " - 2" + " - 12" + " - 鍛戒护涓嬪彂 : 宸ヤ綔鍙�={},婧愭帓={},婧愬垪={},婧愬眰={},鐩爣鎺�={},鐩爣鍒�={},鐩爣灞�={}", wrkMast.getWrkNo().shortValue(), sourceSta.getRow1().shortValue(), sourceSta.getBay1().shortValue(), sourceSta.getLev1().shortValue(), crnStn.getRow().shortValue(), crnStn.getBay().shortValue(), crnStn.getLev().shortValue());
 
                     String locNo = sourceSta.getLocNo();
-
+                    // 鑾峰彇鐩爣搴撲綅淇℃伅
+                    LocMast sta = locMastService.getById(sourceSta.getLocNo());
                     // 1.鍫嗗灈鏈哄紑濮嬬Щ鍔�
                     CrnCommand crnCommand = new CrnCommand();
                     crnCommand.setCrnNo(slave.getId()); // 鍫嗗灈鏈虹紪鍙�
                     crnCommand.setTaskNo(wrkMast.getWrkNo().shortValue()); // 宸ヤ綔鍙�
-                    Short workMode = getWorkMode(sourceSta.getBay1());
+                    Short workMode = getWorkMode(sta.getLocType1(), sourceSta.getBay1());
                     if (workMode == 2) {
                         //CrnTaskModeType璇ユ灇涓剧被鏃犳晥锛屽彧鏈�1浠h〃宸ヤ綅锛�2浠h〃宸ヤ綅2锛�3鍙屽伐浣�
                         crnCommand.setTaskMode(CrnTaskModeType.PAKOUT);
@@ -1268,10 +1268,11 @@
         CrnCommand crnCommand = new CrnCommand();
         crnCommand.setCrnNo(slave.getId()); // 鍫嗗灈鏈虹紪鍙�
         crnCommand.setTaskNo(wrkMast.getWrkNo().shortValue()); // 宸ヤ綔鍙�
-        Short workMode = getWorkMode(sourceSta.getBay1());
+        Short workMode = getWorkMode(sta.getLocType1(), sourceSta.getBay1());
         crnCommand.setAckFinish((short) 0);  // 浠诲姟瀹屾垚纭浣�
         if (workMode == 2) {
             //CrnTaskModeType璇ユ灇涓剧被鏃犳晥锛屽彧鏈�1浠h〃宸ヤ綅锛�2浠h〃宸ヤ綅2锛�3鍙屽伐浣�
+            crnCommand.setTaskMode(CrnTaskModeType.PAKOUT);
             crnCommand.setSourcePosXTwo(sourceSta.getRow1().shortValue());     // 婧愬簱浣嶆帓
             crnCommand.setSourcePosYTwo(sourceSta.getBay1().shortValue());     // 婧愬簱浣嶅垪
             crnCommand.setSourcePosZTwo(sourceSta.getLev1().shortValue());     // 婧愬簱浣嶅眰
@@ -1918,7 +1919,7 @@
             LocMast loc = null;
             for (Integer row : rows) {
                 if (Utils.isDeepLoc(slaveProperties, row)) {
-                    loc = locMastService.queryFreeLocMast(row, shallowLoc.getLocType1(), shallowLoc.getLocType2());
+                    loc = locMastService.queryFreeLocMast(row, shallowLoc.getBay1(), shallowLoc.getLocType1(), shallowLoc.getLocType2());
                     if (loc != null) {
                         if (Utils.isDeepLoc(slaveProperties, loc.getLocNo())) {
                             String shallowLocNo = Utils.getShallowLoc(slaveProperties, loc.getLocNo());
@@ -1930,25 +1931,25 @@
                     }
                     if (null != loc) {
                         //璋冩暣鐨勫師鍥狅細鍙屽伐浣嶇殑鎯呭喌锛�5鍒楋紝鍙兘2鍙峰伐浣嶅彇鏀撅紝34鍒楋紝鍙兘宸ヤ綅1鍙栨斁
-                        if (shallowLoc.getLocType1() == 1) {
-                            if (shallowLoc.getBay1() == 5 && loc.getBay1() == 5) {
-                                break;
-                            } else if (shallowLoc.getBay1() == 3 || shallowLoc.getBay1() == 4) {
-                                if (loc.getBay1() == 3 || loc.getBay1() == 4) {
-                                    break;
-                                }
-                            }
-                            loc = null;
-                        } else {
-                            break;
-                        }
+//                        if (shallowLoc.getLocType1() == 1) {
+//                            if (shallowLoc.getBay1() == 5 && loc.getBay1() == 5) {
+//                                break;
+//                            } else if (shallowLoc.getBay1() == 3 || shallowLoc.getBay1() == 4) {
+//                                if (loc.getBay1() == 3 || loc.getBay1() == 4) {
+//                                    break;
+//                                }
+//                            }
+//                            loc = null;
+//                        } else {
+                        break;
+                        // }
                     }
                 }
             }
             if (null == loc) {
                 for (Integer row : rows) {
                     if (Utils.isShallowLoc(slaveProperties, row)) {
-                        loc = locMastService.queryFreeLocMast(row, shallowLoc.getLocType1(), shallowLoc.getLocType2());
+                        loc = locMastService.queryFreeLocMast(row, shallowLoc.getBay1(), shallowLoc.getLocType1(), shallowLoc.getLocType2());
 
                         if (null != loc) {//瀵瑰簲娣卞簱浣嶉潪鍦ㄥ簱鐘舵��,涓嶈兘绉诲簱
                             String deepLoc = Utils.getDeepLoc(slaveProperties, loc.getLocNo());
@@ -1959,19 +1960,19 @@
                         }
 
                         if (null != loc) {
-                            //璋冩暣鐨勫師鍥狅細鍙屽伐浣嶇殑鎯呭喌锛�5鍒楋紝鍙兘2鍙峰伐浣嶅彇鏀撅紝34鍒楋紝鍙兘宸ヤ綅1鍙栨斁
-                            if (shallowLoc.getLocType1() == 1) {
-                                if (shallowLoc.getBay1() == 5 && loc.getBay1() == 5) {
-                                    break;
-                                } else if (shallowLoc.getBay1() == 3 || shallowLoc.getBay1() == 4) {
-                                    if (loc.getBay1() == 3 || loc.getBay1() == 4) {
-                                        break;
-                                    }
-                                }
-                                loc = null;
-                            } else {
-                                break;
-                            }
+//                            //璋冩暣鐨勫師鍥狅細鍙屽伐浣嶇殑鎯呭喌锛�5鍒楋紝鍙兘2鍙峰伐浣嶅彇鏀撅紝34鍒楋紝鍙兘宸ヤ綅1鍙栨斁
+//                            if (shallowLoc.getLocType1() == 1) {
+//                                if (shallowLoc.getBay1() == 5 && loc.getBay1() == 5) {
+//                                    break;
+//                                } else if (shallowLoc.getBay1() == 3 || shallowLoc.getBay1() == 4) {
+//                                    if (loc.getBay1() == 3 || loc.getBay1() == 4) {
+//                                        break;
+//                                    }
+//                                }
+//                                loc = null;
+//                            } else {
+                            break;
+                            // }
                         }
                     }
                 }

--
Gitblit v1.9.1