From 28a7821e43bd5763739fe67384cfea6693b3500b Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期二, 08 九月 2020 13:19:26 +0800
Subject: [PATCH] Merge branches 'gdwcs' and 'jswcs' of https://gitee.com/luxiaotao1123/zy-wcs into jswcs

---
 src/main/java/com/zy/common/service/CommonService.java |   95 +++++++++++++++++++++++++++--------------------
 1 files changed, 54 insertions(+), 41 deletions(-)

diff --git a/src/main/java/com/zy/asrs/service/impl/CommonService.java b/src/main/java/com/zy/common/service/CommonService.java
similarity index 71%
rename from src/main/java/com/zy/asrs/service/impl/CommonService.java
rename to src/main/java/com/zy/common/service/CommonService.java
index 48ab58c..431da27 100644
--- a/src/main/java/com/zy/asrs/service/impl/CommonService.java
+++ b/src/main/java/com/zy/common/service/CommonService.java
@@ -1,4 +1,4 @@
-package com.zy.asrs.service.impl;
+package com.zy.common.service;
 
 import com.baomidou.mybatisplus.mapper.EntityWrapper;
 import com.baomidou.mybatisplus.mapper.Wrapper;
@@ -89,12 +89,19 @@
      * @return locNo 妫�绱㈠埌鐨勫簱浣嶅彿
      */
     public StartupDto getLocNo(Integer whsType, Integer staDescId, Integer sourceStaNo, List<String> matNos) {
+        if (sourceStaNo == 3) {
+            whsType = 1;
+        } else if (sourceStaNo == 7) {
+            whsType = 2;
+        } else {
+            throw new CoolException("鏃犳晥鍏ュ簱绔�");
+        }
         StartupDto startupDto = new StartupDto();
         RowLastno rowLastno = rowLastnoService.selectById(whsType);
         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();
@@ -106,48 +113,54 @@
             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;
-                    }
-                }
-            }
+//            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 +175,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