From 1dca57c0f15c3cdfbebf14ad1e9e04d8c84e775c Mon Sep 17 00:00:00 2001
From: skyouc <958836976@qq.com>
Date: 星期六, 07 三月 2026 09:51:47 +0800
Subject: [PATCH] no message

---
 src/main/java/com/zy/common/service/CommonService.java |  442 +++++++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 381 insertions(+), 61 deletions(-)

diff --git a/src/main/java/com/zy/common/service/CommonService.java b/src/main/java/com/zy/common/service/CommonService.java
index adbd3b1..9970cfb 100644
--- a/src/main/java/com/zy/common/service/CommonService.java
+++ b/src/main/java/com/zy/common/service/CommonService.java
@@ -122,40 +122,112 @@
     public StartupDto getLocNo(Integer staDescId, Integer sourceStaNo, Integer whsType, FindLocNoAttributeVo findLocNoAttributeVo,
                                LocTypeDto locTypeDto) {
         try {
-//            Integer whsType = Utils.GetWhsType(sourceStaNo);
-//            RowLastno rowLastno = rowLastnoService.selectById(whsType);
-//            RowLastnoType rowLastnoType = rowLastnoTypeService.selectById(rowLastno.getTypeId());
-            /**
-             * 搴撳瀷 1: 鏍囧噯鍫嗗灈鏈哄簱 2: 骞冲簱 3: 绌挎鏉� 4: 鍥涘悜杞� 5: AGV 0: 鏈煡
-             */
-            return getLocNoRun(staDescId, whsType,  sourceStaNo, findLocNoAttributeVo, 0, locTypeDto, 0);
-
-            // switch (rowLastnoType.getType()) {
-            // case 1:
-            // return getLocNoRun(whsType, staDescId, sourceStaNo, findLocNoAttributeVo, 0,
-            // locTypeDto, 0);
-            //// case 2:
-            //// log.error("绔欑偣={} 鏈煡璇㈠埌瀵瑰簲鐨勮鍒�", sourceStaNo);
-            //// break;
-            //// case 3:
-            //// log.error("绔欑偣={} 鏈煡璇㈠埌瀵瑰簲鐨勮鍒�", sourceStaNo);
-            //// break;
-            //// case 4:
-            //// return getLocNoRun4(whsType, staDescId, sourceStaNo, findLocNoAttributeVo,
-            // 4, locTypeDto, 0);
-            //// case 5:
-            //// return getLocNoRun5(whsType, staDescId, sourceStaNo, findLocNoAttributeVo,
-            // 0, locTypeDto, 0);
-            //// default:
-            //// log.error("绔欑偣={} 鏈煡璇㈠埌瀵瑰簲鐨勮鍒�", sourceStaNo);
-            //// break;
-            // }
-
+            RowLastno rowLastno = rowLastnoService.selectById(whsType);
+            RowLastnoType rowLastnoType = rowLastnoTypeService.selectById(rowLastno.getTypeId());
+//            /**
+//             * 搴撳瀷 1: 鏍囧噯鍫嗗灈鏈哄簱 2: 骞冲簱 3: 绌挎鏉� 4: 鍥涘悜杞� 5: AGV 0: 鏈煡
+//             */
+//            if (rowLastnoType.getType() == 3) {
+//                return getDoubleLocNoRun(whsType, staDescId, sourceStaNo, findLocNoAttributeVo,
+//                        4, locTypeDto, 0);
+//            } else {
+//
+//            }
+            return getLocNoRun(whsType, staDescId, sourceStaNo, findLocNoAttributeVo, 0, locTypeDto, 0);
         } catch (Exception e) {
             log.error("绔欑偣={} 鏈煡璇㈠埌瀵瑰簲鐨勮鍒�", sourceStaNo);
         }
         return null;
     }
+
+    /**
+     * 妫�绱㈠簱浣嶅彿
+     *
+     * @param whsType              绫诲瀷 1:鍗曚几寮忚揣鏋�
+     * @param staDescId            璺緞ID
+     * @param sourceStaNo          婧愮珯
+     * @param findLocNoAttributeVo 灞炴��
+     * @param moveCrnNo            婧�
+     * @param locTypeDto           绫诲瀷
+     * @param times                杞娆℃暟
+     * @return locNo 妫�绱㈠埌鐨勫簱浣嶅彿
+     */
+    @Transactional
+    public StartupDto getLocNoRun(Integer whsType, Integer staDescId, Integer sourceStaNo,
+                                  FindLocNoAttributeVo findLocNoAttributeVo, Integer moveCrnNo, LocTypeDto locTypeDto, int times) {
+        staDescId = 1;
+        // 鍒濆鍖栧弬鏁�
+        int crnNo = 0; // 鍫嗗灈鏈哄彿
+        int nearRow = 0; // 鏈�娴呭簱浣嶆帓
+        LocMast locMast = null; // 鐩爣搴撲綅
+
+        RowLastno rowLastno = rowLastnoService.selectById(whsType);
+        if (Cools.isEmpty(rowLastno)) {
+            throw new CoolException("鏁版嵁寮傚父锛岃鑱旂郴绠$悊鍛�===>搴撲綅瑙勫垯鏈煡");
+        }
+
+        int minCount = Integer.MAX_VALUE;
+        if (whsType == 2) {
+            if (locTypeDto.getLocType1() == 2) {
+                // 鍧囪 鍒嗗竷鍫嗗灈鏈�
+                for (int i = 4; i <= 5; i++) {
+                    int count = wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("crn_no", i));
+                    if (count < minCount) {
+                        minCount = count;
+                        crnNo = i;
+                    }
+                }
+            } else {
+                for (int i = 4; i <= 6; i++) {
+                    int count = wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("crn_no", i));
+                    if (count < minCount) {
+                        minCount = count;
+                        crnNo = 6;
+                    }
+                }
+
+                if (crnNo == 6) {
+                    return getDoubleLocNoRun(3, 1, sourceStaNo, findLocNoAttributeVo, null, locTypeDto, times);
+                }
+            }
+        } else {
+            // 鍧囪 鍒嗗竷鍫嗗灈鏈�
+            for (int i = rowLastno.getsCrnNo(); i <= rowLastno.geteCrnNo(); i++) {
+                int count = wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("crn_no", i));
+                if (count < minCount) {
+                    minCount = count;
+                    crnNo = i;
+                }
+            }
+        }
+
+        StartupDto startupDto = new StartupDto();
+        locMast = locMastService.selectOne(new EntityWrapper<LocMast>()
+                .ge("row1", rowLastno.getsRow())
+                .le("row1", rowLastno.geteRow())
+                .eq("crn_no", crnNo)
+                .eq("loc_type1", locTypeDto.getLocType1())
+                .eq("loc_sts", "O")
+                .orderAsc(Arrays.asList("lev1", "row1", "bay1")));
+        // int crnCountO = wrkMastService.selectCount(new
+        // EntityWrapper<WrkMast>().eq("crn_no", crnNo).le("io_type", 100));
+        // 鐢熸垚宸ヤ綔鍙�
+        int workNo;
+        if (whsType == 2) {
+            // 鐢熸垚宸ヤ綔鍙�
+            workNo = getWorkNo(3);
+        } else {
+            // 鐢熸垚宸ヤ綔鍙�
+            workNo = getWorkNo(0);
+        }
+        // 杩斿洖dto
+        startupDto.setWorkNo(workNo);
+        startupDto.setCrnNo(locMast.getCrnNo());
+        startupDto.setSourceStaNo(sourceStaNo);
+        startupDto.setLocNo(locMast.getLocNo());
+        return startupDto;
+    }
+
 
     /**
      * 妫�绱㈠簱浣嶅彿
@@ -169,52 +241,300 @@
      * @param times                杞娆℃暟
      * @return locNo 妫�绱㈠埌鐨勫簱浣嶅彿
      */
-    @Transactional
-    public StartupDto getLocNoRun( Integer staDescId, Integer whsType, Integer sourceStaNo,
-            FindLocNoAttributeVo findLocNoAttributeVo, Integer moveCrnNo, LocTypeDto locTypeDto, int times) {
-        staDescId = 1;
+    public StartupDto getDoubleLocNoRun(Integer whsType, Integer staDescId, Integer sourceStaNo, FindLocNoAttributeVo findLocNoAttributeVo, Integer moveCrnNo, LocTypeDto locTypeDto, int times) {
         // 鍒濆鍖栧弬鏁�
-        int crnNo = 0; // 鍫嗗灈鏈哄彿
-        int nearRow = 0; // 鏈�娴呭簱浣嶆帓
-        LocMast locMast = null; // 鐩爣搴撲綅
+        int crnNo = 6;      //鍫嗗灈鏈哄彿
+        int nearRow = 11;    //鏈�娴呭簱浣嶆帓
+        int curRow = 14;     //鏈�娣卞簱浣嶆帓
+        int rowCount = 0;   //杞杞
+        LocMast locMast = null;     // 鐩爣搴撲綅
 
+        StartupDto startupDto = new StartupDto();
         RowLastno rowLastno = rowLastnoService.selectById(whsType);
         if (Cools.isEmpty(rowLastno)) {
             throw new CoolException("鏁版嵁寮傚父锛岃鑱旂郴绠$悊鍛�===>搴撲綅瑙勫垯鏈煡");
         }
+        RowLastnoType rowLastnoType = rowLastnoTypeService.selectById(rowLastno.getTypeId());
+        if (Cools.isEmpty(rowLastnoType)) {
+            throw new CoolException("鏁版嵁寮傚父锛岃鑱旂郴绠$悊鍛�===銆嬪簱浣嶈鍒欑被鍨嬫湭鐭�");
+        }
+        int sRow = rowLastno.getsRow();
+        int eRow = rowLastno.geteRow();
+        int crnNumber = rowLastno.getCrnQty();
 
-        // 鍧囪 鍒嗗竷鍫嗗灈鏈�
-        int minCount = Integer.MAX_VALUE;
-        for (int i = rowLastno.getsCrnNo(); i <= rowLastno.geteCrnNo(); i++) {
-            int count = wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("crn_no", i));
-            if (count < minCount) {
-                minCount = count;
-                crnNo = i;
+
+        // ===============>>>> 寮�濮嬫墽琛�
+        curRow = rowLastno.getCurrentRow();
+
+        if (!Cools.isEmpty(moveCrnNo) && moveCrnNo != 0) {
+            crnNumber = moveCrnNo;
+            if (times == 0) {
+                curRow = moveCrnNo * 4 - 1;
+            } else {
+                curRow = moveCrnNo * 4 - 2;
             }
         }
-        StartupDto startupDto = new StartupDto();
-        locMast = locMastService.selectOne(new EntityWrapper<LocMast>()
-                .ge("row1", rowLastno.getsRow())
-                .le("row1", rowLastno.geteRow())
-                .eq("crn_no", crnNo)
-                .eq("move_status", 0)
-                .eq("loc_sts", "O")
-                .orderAsc(Arrays.asList("lev1", "row1", "bay1")));
-        // int crnCountO = wrkMastService.selectCount(new
-        // EntityWrapper<WrkMast>().eq("crn_no", crnNo).le("io_type", 100));
+
+//        //姝ょ▼搴忕敤浜庝紭鍖栧爢鍨涙満寮傚父鏃剁殑杩愯鏃堕棿
+//        for (int i = times; i < crnNumber * 2; i++) {
+//            int[] locNecessaryParameters = Utils.LocNecessaryParameters(rowLastno, curRow, crnNumber);
+//            curRow = locNecessaryParameters[1];
+//            crnNo = locNecessaryParameters[2];
+//            if (basCrnpService.checkSiteError(crnNo, true)) {
+//                rowCount = locNecessaryParameters[0];
+//                nearRow = locNecessaryParameters[3];
+//                List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>()
+//                        .eq("row1", nearRow).eq("loc_sts", "O").eq("whs_type", rowLastnoType.getType().longValue()));
+//                int crnCountO = wrkMastService.selectCount(new EntityWrapper<WrkMast>().eq("crn_no", crnNo).le("io_type", 100));
+//                if (locMasts.size() - crnCountO <= 2) {
+//                    log.error(crnNo + "鍙峰爢鍨涙満娌℃湁绌哄簱浣嶏紒锛侊紒 灏哄瑙勬牸锛� {}锛� 杞娆℃暟锛歿}", JSON.toJSONString(locTypeDto), times);
+//                    nearRow = 0;
+//                    times++;
+//                    continue;
+//                }
+//                break;
+//            } else {
+//                times++;
+//            }
+//        }
+        if (nearRow == 0) {
+            throw new CoolException("鏃犲彲鐢ㄥ爢鍨涙満");
+        }
+
+        boolean signRule1 = false;
+        boolean signRule2 = false;
+
+
+        if (Utils.BooleanWhsTypeStaIoType(rowLastno)) {
+            // 闈犺繎鎽嗘斁瑙勫垯 --- 鍚屽ぉ鍚岃鏍肩墿鏂� //鍒嗙鐗�
+            if (!Cools.isEmpty(findLocNoAttributeVo.getMatnr()) && staDescId == 1) {
+                signRule1 = true;
+            }
+            // 闈犺繎鎽嗘斁瑙勫垯 --- 鍚屽ぉ鍚岃鏍肩墿鏂� //浜掗�氱増
+            if (!Cools.isEmpty(findLocNoAttributeVo.getMatnr()) && staDescId == 1) {
+                signRule2 = true;
+            }
+
+            if (!Cools.isEmpty(findLocNoAttributeVo.getMatnr()) && (staDescId == 11 || staDescId == 111)) {
+                signRule1 = true;
+            }
+        }
+
+        if (signRule1) {
+            if (nearRow != curRow) {
+                List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>()
+                        .eq("row1", nearRow).eq("loc_sts", "O").eq("crn_no", crnNo));
+                for (LocMast locMast1 : locMasts) {
+                    //鑾峰彇宸烽亾
+//                    List<String> groupOutsideLocCrn = Utils.getGroupOutLocCrn(curRow,nearRow,locMast1.getLocNo(), curRow>nearRow);
+//                    LocMast locMastGro = locMastService.selectById(wrkMast.getLocNo());
+                    //鑾峰彇鐩爣搴撲綅鎵�鍦ㄥ贩閬撴渶娴呴潪绌哄簱浣�
+                    LocMast locMastF = locMastService.selectLocByLocStsPakInF(curRow, nearRow, locMast1, rowLastnoType.getType().longValue());
+                    if (!Cools.isEmpty(locMastF) && locMastF.getLocSts().equals("F")) {
+                        LocDetl locDetl = locDetlService.selectOne(new EntityWrapper<LocDetl>().eq("loc_no", locMastF.getLocNo()));
+                        if (!Cools.isEmpty(locDetl) && findLocNoAttributeVo.getMatnr().equals(locDetl.getMatnr())
+                                && findLocNoAttributeVo.getBatch().equals(locDetl.getBatch())
+                                && findLocNoAttributeVo.getBrand().equals(locDetl.getBrand())) {
+                            //鑾峰彇鐩爣搴撲綅鎵�鍦ㄥ贩閬撴渶娣辩┖搴撲綅
+                            locMast = locMastService.selectLocByLocStsPakInO(curRow, nearRow, locMast1, rowLastnoType.getType().longValue());
+                            break;
+                        }
+                    }
+                }
+            }
+        } else if (signRule2) {
+            List<String> locNos = locDetlService.getSameDetlToday(findLocNoAttributeVo.getMatnr(), sRow, eRow);
+            for (String locNo : locNos) {
+                if (Utils.isShallowLoc(slaveProperties, locNo)) {
+                    continue;
+                }
+                String shallowLocNo = Utils.getShallowLoc(slaveProperties, locNo);
+                // 妫�娴嬬洰鏍囧簱浣嶆槸鍚︿负绌哄簱浣�
+                LocMast shallowLoc = locMastService.selectById(shallowLocNo);
+                if (shallowLoc != null && shallowLoc.getLocSts().equals("O")) {
+                    if (VersionUtils.locMoveCheckLocTypeComplete(shallowLoc, locTypeDto)) {
+                        if (basCrnpService.checkSiteError(shallowLoc.getCrnNo(), true)) {
+                            locMast = shallowLoc;
+                            crnNo = locMast.getCrnNo();
+                            break;
+                        }
+                    }
+                }
+            }
+        }
+
+//        // 闈犺繎鎽嗘斁瑙勫垯 --- 绌烘墭  //鍒嗙鐗�
+//        if (staDescId == 10 && Utils.BooleanWhsTypeStaIoType(whsType)) {
+//            List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("row1", nearRow).eq("loc_sts", "O"));
+//            for (LocMast locMast1:locMasts){
+//                if (VersionUtils.locMoveCheckLocTypeComplete(locMast1, locTypeDto)) {
+//                    continue;
+//                }
+//                String shallowLoc = Utils.getDeepLoc(slaveProperties,locMast1.getLocNo());
+//                LocMast locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no",shallowLoc));
+//                if (!Cools.isEmpty(locMast2) && locMast2.getLocSts().equals("D")){
+//                    locMast = locMast1;
+//                    break;
+//                }
+//            }
+//        }
+
+//        // 闈犺繎鎽嗘斁瑙勫垯 --- 绌烘墭 //浜掗�氱増
+//        if (staDescId == 10 && Utils.BooleanWhsTypeStaIoType(rowLastno)) {
+//            List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>()
+//                    .eq("loc_sts", "D").ge("row1", sRow).le("row1", eRow).eq("whs_type", rowLastnoType.getType().longValue()));
+//            if (!locMasts.isEmpty()) {
+//                for (LocMast loc : locMasts) {
+//                    if (Utils.isShallowLoc(slaveProperties, loc.getLocNo())) {
+//                        continue;
+//                    }
+//                    String shallowLocNo = Utils.getShallowLoc(slaveProperties, loc.getLocNo());
+//                    // 妫�娴嬬洰鏍囧簱浣嶆槸鍚︿负绌哄簱浣�
+//                    LocMast shallowLoc = locMastService.selectById(shallowLocNo);
+//                    if (shallowLoc != null && shallowLoc.getLocSts().equals("O")) {
+//                        if (VersionUtils.locMoveCheckLocTypeComplete(shallowLoc, locTypeDto)) {
+//                            if (basCrnpService.checkSiteError(shallowLoc.getCrnNo(), true)) {
+//                                locMast = shallowLoc;
+//                                crnNo = locMast.getCrnNo();
+//                                break;
+//                            }
+//                        }
+//                    }
+//                }
+//            }
+//        }
+
+        Wrapper<StaDesc> wrapper = null;
+        StaDesc staDesc = null;
+        BasDevp staNo = null;
+
+//        if (Utils.BooleanWhsTypeSta(rowLastno, staDescId)) {
+//            // 鑾峰彇鐩爣绔�
+//            wrapper = new EntityWrapper<StaDesc>()
+//                    .eq("type_no", staDescId)
+//                    .eq("stn_no", sourceStaNo)
+//                    .eq("crn_no", crnNo);
+//            staDesc = staDescService.selectOne(wrapper);
+//            if (Cools.isEmpty(staDesc)) {
+//                log.error("type_no={},stn_no={},crn_no={}", staDescId, sourceStaNo, crnNo);
+////                throw new CoolException("鍏ュ簱璺緞涓嶅瓨鍦�");
+//                crnNo = 0;
+//            } else {
+//                staNo = basDevpService.selectById(staDesc.getCrnStn());
+//                if (!staNo.getAutoing().equals("Y")) {
+//                    log.error("鐩爣绔�" + staDesc.getCrnStn() + "涓嶅彲鐢�");
+////                throw new CoolException("鐩爣绔�"+staDesc.getCrnStn()+"涓嶅彲鐢�");
+//                    crnNo = 0;
+//                }
+//                startupDto.setStaNo(staNo.getDevNo());
+//            }
+//            // 鏇存柊搴撲綅鎺掑彿
+//            if (Cools.isEmpty(locMast)) {
+//                rowLastno.setCurrentRow(curRow);
+//                rowLastnoService.updateById(rowLastno);
+//            }
+//        }
+
+        // 寮�濮嬫煡鎵惧簱浣� ==============================>>
+        // 1.鎸夎鍒欐煡鎵惧簱浣�
+        if (Cools.isEmpty(locMast) && crnNo != 0) {
+            List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>()
+                    .eq("row1", nearRow)
+                    .eq("loc_sts", "O").eq("crn_no", crnNo)
+                    .orderBy("lev1", true).orderBy("bay1", true));
+//            for (LocMast locMast1 : locMasts) {
+//                if (!VersionUtils.locMoveCheckLocTypeComplete(locMast1, locTypeDto)) {
+//                    continue;
+//                }
+//                if (Utils.BooleanWhsTypeStaIoType(rowLastno)) {
+//                    String shallowLoc = Utils.getDeepLoc(slaveProperties, locMast1.getLocNo());
+//                    LocMast locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>()
+//                            .eq("loc_no", shallowLoc).eq("loc_sts", "O").eq("crn_no", crnNo));
+//                    if (!Cools.isEmpty(locMast2)) {
+//                        locMast = locMast2;
+//                        break;
+//                    }
+//                } else {
+//                    if (!Cools.isEmpty(locMast1)) {
+//                        locMast = locMast1;
+//                        break;
+//                    }
+//                }
+//            }
+
+            if (Cools.isEmpty(locMast) && Utils.BooleanWhsTypeStaIoType(rowLastno)) {
+                for (LocMast locMast1 : locMasts) {
+                    if (!VersionUtils.locMoveCheckLocTypeComplete(locMast1, locTypeDto)) {
+                        continue;
+                    }
+                    if (Utils.BooleanWhsTypeStaIoType(rowLastno)) {
+                        String shallowLoc = Utils.getDeepLoc(slaveProperties, locMast1.getLocNo());
+                        LocMast locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>()
+                                .eq("loc_no", shallowLoc).eq("loc_sts", "O").eq("crn_no", crnNo));
+                        if (!Cools.isEmpty(locMast2)) {
+                            locMast = locMast2;
+                            break;
+                        } else {
+                            locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>()
+                                    .eq("loc_no", shallowLoc).eq("loc_sts", "F").eq("crn_no", crnNo));
+                            if (!Cools.isEmpty(locMast2)) {
+                                locMast = locMast1;
+                                break;
+                            } else {
+                                locMast2 = locMastService.selectOne(new EntityWrapper<LocMast>()
+                                        .eq("loc_no", shallowLoc).eq("loc_sts", "D").eq("crn_no", crnNo));
+                                if (!Cools.isEmpty(locMast2)) {
+                                    locMast = locMast1;
+                                    break;
+                                }
+                            }
+                        }
+                    } else {
+                        if (!Cools.isEmpty(locMast1)) {
+                            locMast = locMast1;
+                            break;
+                        }
+                    }
+                }
+            }
+        }
+
+        if (!Cools.isEmpty(locMast) && !basCrnpService.checkSiteError(crnNo, true)) {
+            locMast = null;
+        }
+
+        // 閫掑綊鏌ヨ
+        if (Cools.isEmpty(locMast) || !locMast.getLocSts().equals("O")) {
+            // 褰撳墠宸烽亾鏃犵┖搴撲綅鏃讹紝閫掑綊璋冩暣鑷充笅涓�宸烽亾锛屾绱㈠叏閮ㄥ贩閬撴棤鏋滃悗锛岃烦鍑洪�掑綊
+            if (times < rowCount * 2) {
+                times = times + 1;
+                return getDoubleLocNoRun(whsType, 1, sourceStaNo, findLocNoAttributeVo, moveCrnNo, locTypeDto, times);
+            }
+//            // 2.搴撲綅褰撳墠鎵�灞炲昂瀵告棤绌哄簱浣嶆椂锛岃皟鏁村昂瀵稿弬鏁帮紝鍚戜笂鍏煎妫�绱㈠簱浣�
+//            if (locTypeDto.getLocType1() < 2) {
+//                int i = locTypeDto.getLocType1() + 1;
+//                locTypeDto.setLocType1((short)i);
+//                return getLocNo(1, staDescId, sourceStaNo, matnr,batch,grade, locTypeDto, 0);
+//            }
+            log.error("绯荤粺娌℃湁绌哄簱浣嶏紒锛侊紒 灏哄瑙勬牸锛� {}锛� 杞娆℃暟锛歿}", JSON.toJSONString(locTypeDto), times);
+            throw new CoolException("娌℃湁绌哄簱浣�");
+        }
+        String locNo = locMast.getLocNo();
 
         // 鐢熸垚宸ヤ綔鍙�
         int workNo = getWorkNo(0);
         // 杩斿洖dto
         startupDto.setWorkNo(workNo);
-        startupDto.setCrnNo(locMast.getCrnNo());
+        startupDto.setCrnNo(crnNo);
         startupDto.setSourceStaNo(sourceStaNo);
-        startupDto.setLocNo(locMast.getLocNo());
+        startupDto.setLocNo(locNo);
+
         return startupDto;
     }
 
+
     public StartupDto getLocNoRun4(Integer whsType, Integer staDescId, Integer sourceStaNo,
-            FindLocNoAttributeVo findLocNoAttributeVo, Integer moveCrnNo, LocTypeDto locTypeDto, int times) {
+                                   FindLocNoAttributeVo findLocNoAttributeVo, Integer moveCrnNo, LocTypeDto locTypeDto, int times) {
 
         // 鍒濆鍖栧弬鏁�
         int crnNo = 0; // 鍫嗗灈鏈哄彿
@@ -307,7 +627,7 @@
                     if (!(Utils.getRow(locMastGro.getLocNo()) > nearRowW
                             && Utils.getRow(locMastGro.getLocNo()) <= curRowW)
                             && !(Utils.getRow(locMastGro.getLocNo()) < nearRowW
-                                    && Utils.getRow(locMastGro.getLocNo()) >= curRowW)) {
+                            && Utils.getRow(locMastGro.getLocNo()) >= curRowW)) {
                         int[] locNecessaryParameters = Utils.LocNecessaryParameters(rowLastno, curRowW, crnNumber);
                         curRowW = locNecessaryParameters[1];
                         nearRowW = locNecessaryParameters[3];
@@ -380,7 +700,7 @@
                     if (!(Utils.getRow(locMastGro.getLocNo()) > nearRowW
                             && Utils.getRow(locMastGro.getLocNo()) <= curRowW)
                             && !(Utils.getRow(locMastGro.getLocNo()) < nearRowW
-                                    && Utils.getRow(locMastGro.getLocNo()) >= curRowW)) {
+                            && Utils.getRow(locMastGro.getLocNo()) >= curRowW)) {
                         int[] locNecessaryParameters = Utils.LocNecessaryParameters(rowLastno, curRowW, crnNumber);
                         curRowW = locNecessaryParameters[1];
                         nearRowW = locNecessaryParameters[3];
@@ -479,7 +799,7 @@
                     if (!(Utils.getRow(locMastGro.getLocNo()) > nearRowW
                             && Utils.getRow(locMastGro.getLocNo()) <= curRowW)
                             && !(Utils.getRow(locMastGro.getLocNo()) < nearRowW
-                                    && Utils.getRow(locMastGro.getLocNo()) >= curRowW)) {
+                            && Utils.getRow(locMastGro.getLocNo()) >= curRowW)) {
                         int[] locNecessaryParameters = Utils.LocNecessaryParameters(rowLastno, curRowW, crnNumber);
                         curRowW = locNecessaryParameters[1];
                         nearRowW = locNecessaryParameters[3];
@@ -560,7 +880,7 @@
                     if (!(Utils.getRow(locMastGro.getLocNo()) > nearRowW
                             && Utils.getRow(locMastGro.getLocNo()) <= curRowW)
                             && !(Utils.getRow(locMastGro.getLocNo()) < nearRowW
-                                    && Utils.getRow(locMastGro.getLocNo()) >= curRowW)) {
+                            && Utils.getRow(locMastGro.getLocNo()) >= curRowW)) {
                         int[] locNecessaryParameters = Utils.LocNecessaryParameters(rowLastno, curRowW, crnNumber);
                         curRowW = locNecessaryParameters[1];
                         nearRowW = locNecessaryParameters[3];
@@ -705,7 +1025,7 @@
     }
 
     public StartupDto getLocNoRun5(Integer whsType, Integer staDescId, Integer sourceStaNo,
-            FindLocNoAttributeVo findLocNoAttributeVo, Integer moveCrnNo, LocTypeDto locTypeDto, int times) {
+                                   FindLocNoAttributeVo findLocNoAttributeVo, Integer moveCrnNo, LocTypeDto locTypeDto, int times) {
 
         // 鍒濆鍖栧弬鏁�
         int crnNo = 0; // 鍫嗗灈鏈哄彿

--
Gitblit v1.9.1