From a8c0be78fd16a49c1819be6a2c8dccbbfce20f37 Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期二, 22 十二月 2020 15:47:40 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/common/service/CommonService.java |   89 +++++++++++++++++++++++---------------------
 1 files changed, 47 insertions(+), 42 deletions(-)

diff --git a/src/main/java/com/zy/common/service/CommonService.java b/src/main/java/com/zy/common/service/CommonService.java
index bcc0107..0de4133 100644
--- a/src/main/java/com/zy/common/service/CommonService.java
+++ b/src/main/java/com/zy/common/service/CommonService.java
@@ -7,7 +7,6 @@
 import com.core.exception.CoolException;
 import com.zy.asrs.entity.*;
 import com.zy.asrs.service.*;
-import com.zy.common.model.Shelves;
 import com.zy.common.model.StartupDto;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -94,7 +93,7 @@
         if (Cools.isEmpty(rowLastno)) {
             throw new CoolException("鏁版嵁寮傚父锛岃鑱旂郴绠$悊鍛�");
         }
-        if (rowLastno.getWhsType() == 1){
+        if (whsType == 1 || whsType == 2){
             int curRow = rowLastno.getCurrentRow();
             int sRow = rowLastno.getsRow();
             int eRow = rowLastno.geteRow();
@@ -105,49 +104,55 @@
             // 鐩爣搴撲綅
             LocMast locMast = null;
 
-            // 鍚屼竴澶╁悓瑙勬牸璐х墿闈犺繎鎽嗘硶瑙勫垯
-            if (!Cools.isEmpty(matNos)) {
-                List<String> locNos = locDetlService.getSameDetlToday(matNos.get(0));
-                for (String locNo : locNos) {
-                    // 鑾峰彇鎺�
-                    int row = Integer.parseInt(locNo.substring(0, 2));
-                    // 鍒ゆ柇鏄惁涓烘繁搴撲綅
-                    double remainder = Arith.remainder(row, rowCount / crn_qty);
-                    int targetRow;
-                    if (remainder == 1) {
-                        // 寰楀埌褰撳墠搴撲綅鐨勫鍥村簱浣�
-                        targetRow =  row + 1;
-                    } else if (remainder == 0) {
-                        // 寰楀埌褰撳墠搴撲綅鐨勫唴鍥村簱浣�
-                        targetRow =  row - 1;
-                    } else {
-                        continue;
-                    }
-                    String targetLocNo = zerofill(String.valueOf(targetRow), 2)+locNo.substring(2);
-                    // 妫�娴嬬洰鏍囧簱浣嶆槸鍚︿负绌哄簱浣�
-                    LocMast targetLocMast = locMastService.selectById(targetLocNo);
-                    if (targetLocMast != null && targetLocMast.getLocSts().equals("O")) {
-                        locMast = targetLocMast;
-                        crnNo = locMast.getCrnNo();
-                        break;
-                    }
-                }
-            }
+            // 鍚屼竴澶╁悓瑙勬牸璐х墿闈犺繎鎽嗘硶瑙勫垯 todo:luxiaotao
+//            if (!Cools.isEmpty(matNos)) {
+//                List<String> locNos = locDetlService.getSameDetlToday(matNos.get(0));
+//                for (String locNo : locNos) {
+//                    // 鑾峰彇鎺�
+//                    int row = Integer.parseInt(locNo.substring(0, 2));
+//                    // 鍒ゆ柇鏄惁涓烘繁搴撲綅
+//                    double remainder = Arith.remainder(row, rowCount / crn_qty);
+//                    int targetRow;
+//                    if (remainder == 1) {
+//                        // 寰楀埌褰撳墠搴撲綅鐨勫鍥村簱浣�
+//                        targetRow =  row + 1;
+//                    } else if (remainder == 0) {
+//                        // 寰楀埌褰撳墠搴撲綅鐨勫唴鍥村簱浣�
+//                        targetRow =  row - 1;
+//                    } else {
+//                        continue;
+//                    }
+//                    String targetLocNo = zerofill(String.valueOf(targetRow), 2)+locNo.substring(2);
+//                    // 妫�娴嬬洰鏍囧簱浣嶆槸鍚︿负绌哄簱浣�
+//                    LocMast targetLocMast = locMastService.selectById(targetLocNo);
+//                    if (targetLocMast != null && targetLocMast.getLocSts().equals("O")) {
+//                        locMast = targetLocMast;
+//                        crnNo = locMast.getCrnNo();
+//                        break;
+//                    }
+//                }
+//            }
 
             // 濡傛灉娌℃湁鐩歌繎鐗╂枡锛屽垯鎸夎鍒欒疆璇㈣揣鏋�
             if (null == locMast) {
-                // 鑾峰彇鐩爣绔欐墍鍦ㄨ揣鏋舵帓鍙�
-                Shelves shelves = new Shelves(rowCount, crn_qty);
-                curRow = shelves.start(curRow);
-                if (curRow < 0) {
-                    throw new CoolException("妫�绱㈠簱浣嶅け璐ワ紝璇疯仈绯荤鐞嗗憳");
+                // 鑾峰彇鐩爣绔欐墍鍦ㄨ揣鏋舵帓鍙�  todo:luxiaotao
+                if (curRow == sRow) {
+                    curRow = eRow;
+                } else {
+                    curRow = sRow;
                 }
-                for (List<Integer> node : shelves.nodes){
-                    if (node.contains(curRow)) {
-                        crnNo = shelves.nodes.indexOf(node) + 1;
-                        break;
-                    }
-                }
+                crnNo = whsType;
+//                Shelves shelves = new Shelves(rowCount, crn_qty);
+//                curRow = shelves.start(curRow);
+//                if (curRow < 0) {
+//                    throw new CoolException("妫�绱㈠簱浣嶅け璐ワ紝璇疯仈绯荤鐞嗗憳");
+//                }
+//                for (List<Integer> node : shelves.nodes){
+//                    if (node.contains(curRow)) {
+//                        crnNo = shelves.nodes.indexOf(node) + 1;
+//                        break;
+//                    }
+//                }
             }
 
             basCrnpService.checkSiteStatus(crnNo);
@@ -162,7 +167,7 @@
             }
             BasDevp staNo = basDevpService.selectById(staDesc.getCrnStn());
             int inQty = staNo.getInQty()==null?0:staNo.getInQty();
-            if (staNo.getInEnable().equals("Y") && staNo.getAutoing().equals("Y") && inQty<2) {
+            if (staNo.getAutoing().equals("Y") && inQty<2) {
                 // 鏌ユ壘搴撲綅
                 if (locMast == null) {
                     locMast = locMastService.queryFreeLocMast(curRow);

--
Gitblit v1.9.1