From 6a478880c4aa9c62e960a72591b1eb3ea92c223f Mon Sep 17 00:00:00 2001
From: luxiaotao1123 <t1341870251@163.com>
Date: 星期四, 24 十二月 2020 15:33:17 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/common/service/CommonService.java |   83 +++++++++--------------------------------
 1 files changed, 19 insertions(+), 64 deletions(-)

diff --git a/src/main/java/com/zy/common/service/CommonService.java b/src/main/java/com/zy/common/service/CommonService.java
index 1986fe9..530f2d5 100644
--- a/src/main/java/com/zy/common/service/CommonService.java
+++ b/src/main/java/com/zy/common/service/CommonService.java
@@ -2,7 +2,6 @@
 
 import com.baomidou.mybatisplus.mapper.EntityWrapper;
 import com.baomidou.mybatisplus.mapper.Wrapper;
-import com.core.common.Arith;
 import com.core.common.Cools;
 import com.core.exception.CoolException;
 import com.zy.asrs.entity.*;
@@ -49,20 +48,6 @@
             throw new CoolException("鏁版嵁寮傚父锛岃鑱旂郴绠$悊鍛�");
         }
 
-        // 绫诲瀷
-        switch (wrkMk) {
-            case 0:     // 鍏ュ簱 1 - 3000
-                break;
-            case 1:     // 鎷f枡/骞舵澘/鐩樼偣 3001 - 6000
-                break;
-            case 2:     // 鍑哄簱 6001 -9000
-                break;
-            case 3:     // 鍏朵粬 9001 -9999
-                break;
-            default:
-                break;
-        }
-
         int workNo = wrkLastno.getWrkNo();
         int sNo = wrkLastno.getSNo();
         int eNo = wrkLastno.getENo();
@@ -104,6 +89,11 @@
         // 鐢熸垚宸ヤ綔鍙�
         int workNo = getWorkNo(WorkNoType.getWorkNoType(staDescId));
         startupDto.setWorkNo(workNo);
+        if (sourceStaNo < 100) {
+            whsType = 1;
+        } else {
+            whsType = 2;
+        }
         RowLastno rowLastno = rowLastnoService.selectById(whsType);
         if (Cools.isEmpty(rowLastno)) {
             throw new CoolException("鏁版嵁寮傚父锛岃鑱旂郴绠$悊鍛�");
@@ -112,33 +102,20 @@
             int curRow = rowLastno.getCurrentRow();
             int sRow = rowLastno.getsRow();
             int eRow = rowLastno.geteRow();
-            int crn_qty = rowLastno.getCrnQty();
-            int rowCount = eRow - sRow + 1;
-            // 鐩爣鍫嗗灈鏈哄彿
-            int crnNo = 0;
-            // 鐩爣搴撲綅
-            LocMast locMast = null;
 
-            // 濡傛灉娌℃湁鐩歌繎鐗╂枡锛屽垯鎸夎鍒欒疆璇㈣揣鏋�
-            if (null == locMast) {
-                // 鑾峰彇鐩爣绔欐墍鍦ㄨ揣鏋舵帓鍙�  todo:luxiaotao
-                if (curRow == sRow) {
-                    curRow = eRow;
-                } else {
-                    curRow = sRow;
-                }
-                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;
-//                    }
-//                }
+            // 鑾峰彇鐩爣绔欐墍鍦ㄨ揣鏋舵帓鍙�
+            curRow = curRow == sRow ? eRow : sRow;
+            // 鐩爣鍫嗗灈鏈哄彿
+            int crnNo;
+            switch (whsType) {
+                case 1:
+                    crnNo = 1;
+                    break;
+                case 2:
+                    crnNo = 2;
+                    break;
+                default:
+                    throw new CoolException("妫�绱㈠簱浣� -- 妫�绱㈠爢鍨涙満鍙峰け璐�");
             }
 
             basCrnpService.checkSiteStatus(crnNo);
@@ -155,9 +132,7 @@
             int inQty = staNo.getInQty()==null?0:staNo.getInQty();
             if (staNo.getAutoing().equals("Y") && inQty<2) {
                 // 鏌ユ壘搴撲綅
-                if (locMast == null) {
-                    locMast = locMastService.queryFreeLocMast(curRow);
-                }
+                LocMast locMast = locMastService.queryFreeLocMast(curRow);
                 if (Cools.isEmpty(locMast)) {
                     throw new CoolException("娌℃湁绌哄簱浣�");
                 }
@@ -179,26 +154,6 @@
             throw new CoolException(rowLastno.getWhsType()+"鍙峰簱浣嶆帓鍙峰垎閰嶈鍒欎笉鍙敤");
         }
         return startupDto;
-    }
-
-    public static void main(String[] args) {
-        System.out.println(Arith.remainder(1, 4));
-        System.out.println("0200201".substring(0, 2));
-        String locNo = "0800201";
-        int row = Integer.parseInt(locNo.substring(0, 2));
-        double remainder = Arith.remainder(row, 4);
-        int targetRow;
-        if (remainder == 1) {
-            // 寰楀埌褰撳墠搴撲綅鐨勫鍥村簱浣�
-            targetRow =  row + 1;
-        } else if (remainder == 0) {
-            // 寰楀埌褰撳墠搴撲綅鐨勫唴鍥村簱浣�
-            targetRow =  row - 1;
-        } else {
-            return;
-        }
-        String zerofill = zerofill(String.valueOf(targetRow), 2)+locNo.substring(2);
-        System.out.println(zerofill);
     }
 
     public static String zerofill(String msg, Integer count) {

--
Gitblit v1.9.1