From 2ded9514aa9a93ee440af0b1437d788fb052028b Mon Sep 17 00:00:00 2001
From: pjb <pjb123456>
Date: 星期六, 23 八月 2025 08:36:59 +0800
Subject: [PATCH] wms功能完善

---
 src/main/java/com/zy/common/service/CommonService.java |  297 ++++++++++++++++++++++++++++++-----------------------------
 1 files changed, 150 insertions(+), 147 deletions(-)

diff --git a/src/main/java/com/zy/common/service/CommonService.java b/src/main/java/com/zy/common/service/CommonService.java
index 0ca5ca9..dce1bc3 100644
--- a/src/main/java/com/zy/common/service/CommonService.java
+++ b/src/main/java/com/zy/common/service/CommonService.java
@@ -185,162 +185,165 @@
                     throw new CoolException("鍏ョ┖妗跺簱杈撻�佺嚎缂撳瓨浠诲姟鏁帮細"+count+"锛岃秴閰嶇疆缂撳瓨鏁帮細" + value);
                 }
             }
+            locMast = new LocMast();
+            locMast.setCrnNo(4);
+            locMast.setLocNo("");
             List<WrkMast> wrkMastList = wrkMastMapper.selectLastInEmptyLoc(); // 鍓嶉潰鍏ョ┖妗跺簱鐨勪换鍔�(鏈墽琛屽爢鍨涙満鍏ュ簱)
 
-            if (wrkMastList.size() == 0) {
+//            if (wrkMastList.size() == 0) {
                 // 鍙栨柊搴撲綅缁勭殑绗竴涓簱浣�
                 List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("crn_no", 4).eq("loc_sts", "O"));
                 List<LocMast> collect = locMasts.stream().filter(locMast1 -> locMast1.getRow1() == 9 || locMast1.getRow1() == 11).collect(Collectors.toList());
                 List<LocMast> collect1 = locMasts.stream().filter(locMast1 -> locMast1.getRow1() == 10 || locMast1.getRow1() == 12).collect(Collectors.toList()); // 绗竴涓厛鏀捐繖涓ゆ帓
-                if (collect.size() == 0 || collect1.size() == 0) {
+                if (collect.size() - wrkMastList.size() <= 0 && collect1.size()  - wrkMastList.size() <= 0) {
                     log.error("-----绌烘《搴撴棤绌哄簱浣�----");
                     throw new CoolException("绌烘《搴撴棤绌哄簱浣�");
                 }
-                // 鍙敤搴撲綅缁�
-                List<LocMast> locMastList = new ArrayList<>();
-                for(LocMast locMast1:collect) {
-                    Optional<LocMast> first = collect1.stream().filter(locMast2 -> locMast1.getRow1() + 1 == locMast2.getRow1() && Objects.equals(locMast1.getLev1(), locMast2.getLev1())
-                            && Objects.equals(locMast1.getBay1(), locMast2.getBay1())).findFirst();
-                    first.ifPresent(locMastList::add);
-                }
-
-                if (locMastList.size() == 0) {
-                    log.error("-----绌烘《搴撴棤瀵瑰簲绌虹┖妗剁粍----");
-                    throw new CoolException("绌烘《搴撴棤瀵瑰簲绌虹┖妗剁粍");
-                }
-                String model = findLocNoAttributeVo.getModel(); // 褰撳墠妗剁被鍨�
-                if (model.equals("208L") && locMastList.size() <= 40 * 2 * 2) { // 鏈�涓婇潰涓�灞傚彧鑳芥斁208L锛屽簱浣嶅墿浣欓噺涓嶅鏃讹紝濡傛灉鏄�208L妗跺叆搴擄紝鍒欏厛浠庢渶椤跺眰鏀�
-                    locMastList = locMastList.stream().sorted(Comparator.comparing(LocMast::getLev1).reversed().thenComparing(LocMast::getBay1).thenComparing(LocMast::getRow1)).collect(Collectors.toList());
-                } else {
-                    locMastList = locMastList.stream().sorted(Comparator.comparing(LocMast::getLev1).thenComparing(LocMast::getBay1).thenComparing(LocMast::getRow1)).collect(Collectors.toList());
-                }
-                locMast = locMastList.get(0);
-
-            } else {
-                WrkMast wrkMast = wrkMastList.get(0); // 鏈�鍚庝竴涓叆绌烘《搴撲换鍔�
-                // 鍓嶄竴涓换鍔℃《绫诲瀷
-                String oldModel = wrkMast.getPdcType();
-                // 鍓嶄竴涓换鍔″熬鎵樻爣璇�
-                Integer oldCtnType = wrkMast.getCtnType();
-                // 褰撳墠妗剁被鍨�
-                String matnr = findLocNoAttributeVo.getMatnr();
-                if(findLocNoAttributeVo.getMatnr().equals(wrkMast.getPdcType())) { // 褰撳墠妗朵笌鍓嶆《鏄竴绉嶇被鍨�
-                    // 褰撳墠妗剁被鍨嬬殑浠诲姟鏈夊嚑涓�
-                    long count = wrkMastList.stream().filter(wrkMast1 -> wrkMast1.getPdcType().equals(matnr)).count();
-                    if (count % 2  == 0) { // 鍋舵暟锛屽彇涓�缁勬柊搴撲綅
-                        // 鍙栨柊搴撲綅缁勭殑绗竴涓簱浣�
-                        List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("crn_no", 4).eq("loc_sts", "O"));
-                        List<LocMast> collect = locMasts.stream().filter(locMast1 -> locMast1.getRow1() == 9 || locMast1.getRow1() == 11).collect(Collectors.toList());
-                        List<LocMast> collect1 = locMasts.stream().filter(locMast1 -> locMast1.getRow1() == 10 || locMast1.getRow1() == 12).collect(Collectors.toList()); // 绗竴涓厛鏀捐繖涓ゆ帓
-                        if (collect.size() == 0 || collect1.size() == 0) {
-                            log.error("-----绌烘《搴撴棤绌哄簱浣�----");
-                            throw new CoolException("绌烘《搴撴棤绌哄簱浣�");
-                        }
-                        // 鍙敤搴撲綅缁�
-                        List<LocMast> locMastList = new ArrayList<>();
-                        for(LocMast locMast1:collect) {
-                            Optional<LocMast> first = collect1.stream().filter(locMast2 -> locMast1.getRow1() + 1 == locMast2.getRow1() && Objects.equals(locMast1.getLev1(), locMast2.getLev1())
-                                    && Objects.equals(locMast1.getBay1(), locMast2.getBay1())).findFirst();
-                            first.ifPresent(locMastList::add);
-                        }
-
-                        if (locMastList.size() == 0) {
-                            log.error("-----绌烘《搴撴棤瀵瑰簲绌虹┖妗剁粍----");
-                            throw new CoolException("绌烘《搴撴棤瀵瑰簲绌虹┖妗剁粍");
-                        }
-                        String model = findLocNoAttributeVo.getModel(); // 褰撳墠妗剁被鍨�
-                        if (model.equals("208L") && locMastList.size() <= 40 * 2 * 2) { // 鏈�涓婇潰涓�灞傚彧鑳芥斁208L锛屽簱浣嶅墿浣欓噺涓嶅鏃讹紝濡傛灉鏄�208L妗跺叆搴擄紝鍒欏厛浠庢渶椤跺眰鏀�
-                            locMastList = locMastList.stream().sorted(Comparator.comparing(LocMast::getLev1).reversed().thenComparing(LocMast::getBay1).thenComparing(LocMast::getRow1)).collect(Collectors.toList());
-                        } else {
-                            locMastList = locMastList.stream().sorted(Comparator.comparing(LocMast::getLev1).thenComparing(LocMast::getBay1).thenComparing(LocMast::getRow1)).collect(Collectors.toList());
-                        }
-                        locMast = locMastList.get(0);
-                    } else { // 濂囨暟锛屽彇鍓嶄竴搴撲綅瀵瑰簲鐨勭┖搴撲綅
-                        String locNo = wrkMast.getLocNo();
-                        int row = Integer.parseInt(locNo.substring(0, 2));
-                        if(row == 10 || row == 12) {
-                            String newLocNo =(row == 10 ? "09" : "11") + locNo.substring(2);
-                            locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", newLocNo).eq("loc_sts","O"));
-                            if (locMast == null) {
-                                log.error("-----涓庡墠闈㈡《绫诲瀷涓�鏍凤紝鍓嶉潰璇ユ《绫诲瀷浠诲姟鏁版槸濂囨暟锛�10锛�12鎺�,浣嗘槸瀵瑰簲搴撲綅涓嶄负绌�----");
-                                throw new CoolException("涓庡墠闈㈡《绫诲瀷涓�鏍凤紝鍓嶉潰璇ユ《绫诲瀷浠诲姟鏁版槸濂囨暟锛屾槸10锛�12鎺�,浣嗘槸瀵瑰簲搴撲綅涓嶄负绌�");
-                            }
-                        } else {
-                            // 鑷姩缁欏墠闈换鍔¤ˉ灏炬《淇″彿
-                            wrkMastService.updateCtnType(wrkMast);
-                            log.error("-----涓庡墠闈㈡《绫诲瀷涓�鏍凤紝鍓嶉潰璇ユ《绫诲瀷浠诲姟鏁版槸濂囨暟锛屼絾鏄笉鏄�10锛�12鎺�----");
-                            throw new CoolException("涓庡墠闈㈡《绫诲瀷涓�鏍凤紝鍓嶉潰璇ユ《绫诲瀷浠诲姟鏁版槸濂囨暟锛屼絾鏄笉鏄�10锛�12鎺�");
-                        }
-                    }
-                } else { // 褰撳墠妗朵笌鍓嶆《涓嶆槸涓�绉嶇被鍨�
-                      if(oldCtnType == 1) { // 鍓嶉潰鏄熬妗�
-                          // 鍙栨柊搴撲綅缁勭殑绗竴涓簱浣�
-                          List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("crn_no", 4).eq("loc_sts", "O"));
-                          List<LocMast> collect = locMasts.stream().filter(locMast1 -> locMast1.getRow1() == 9 || locMast1.getRow1() == 11).collect(Collectors.toList());
-                          List<LocMast> collect1 = locMasts.stream().filter(locMast1 -> locMast1.getRow1() == 10 || locMast1.getRow1() == 12).collect(Collectors.toList()); // 绗竴涓厛鏀捐繖涓ゆ帓
-                          if (collect.size() == 0 || collect1.size() == 0) {
-                              log.error("-----绌烘《搴撴棤绌哄簱浣�----");
-                              throw new CoolException("绌烘《搴撴棤绌哄簱浣�");
-                          }
-                          // 鍙敤搴撲綅缁�
-                          List<LocMast> locMastList = new ArrayList<>();
-                          for(LocMast locMast1:collect) {
-                              Optional<LocMast> first = collect1.stream().filter(locMast2 -> locMast1.getRow1() + 1 == locMast2.getRow1() && Objects.equals(locMast1.getLev1(), locMast2.getLev1())
-                                      && Objects.equals(locMast1.getBay1(), locMast2.getBay1())).findFirst();
-                              first.ifPresent(locMastList::add);
-                          }
-
-                          if (locMastList.size() == 0) {
-                              log.error("-----绌烘《搴撴棤瀵瑰簲绌虹┖妗剁粍----");
-                              throw new CoolException("绌烘《搴撴棤瀵瑰簲绌虹┖妗剁粍");
-                          }
-                          String model = findLocNoAttributeVo.getModel(); // 褰撳墠妗剁被鍨�
-                          if (model.equals("208L") && locMastList.size() <= 40 * 2 * 2) { // 鏈�涓婇潰涓�灞傚彧鑳芥斁208L锛屽簱浣嶅墿浣欓噺涓嶅鏃讹紝濡傛灉鏄�208L妗跺叆搴擄紝鍒欏厛浠庢渶椤跺眰鏀�
-                              locMastList = locMastList.stream().sorted(Comparator.comparing(LocMast::getLev1).reversed().thenComparing(LocMast::getBay1).thenComparing(LocMast::getRow1)).collect(Collectors.toList());
-                          } else {
-                              locMastList = locMastList.stream().sorted(Comparator.comparing(LocMast::getLev1).thenComparing(LocMast::getBay1).thenComparing(LocMast::getRow1)).collect(Collectors.toList());
-                          }
-                          locMast = locMastList.get(0);
-                      } else { // 鍓嶉潰涓嶆槸灏炬《
-                          // 鍒ゆ柇鍓嶉潰鍏ョ┖妗跺簱浠诲姟鏁伴噺(鏈墽琛屽爢鍨涙満鍏ュ簱)
-                          long count = wrkMastList.stream().filter(wrkMast1 -> wrkMast1.getPdcType().equals(oldModel)).count();
-                          if (count % 2 == 0) { // 鍋舵暟锛屽彲浠ュ叆搴�
-                              // 鍙栨柊搴撲綅缁勭殑绗竴涓簱浣�
-                              List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("crn_no", 4).eq("loc_sts", "O"));
-                              List<LocMast> collect = locMasts.stream().filter(locMast1 -> locMast1.getRow1() == 9 || locMast1.getRow1() == 11).collect(Collectors.toList());
-                              List<LocMast> collect1 = locMasts.stream().filter(locMast1 -> locMast1.getRow1() == 10 || locMast1.getRow1() == 12).collect(Collectors.toList()); // 绗竴涓厛鏀捐繖涓ゆ帓
-                              if (collect.size() == 0 || collect1.size() == 0) {
-                                  log.error("-----绌烘《搴撴棤绌哄簱浣�----");
-                                  throw new CoolException("绌烘《搴撴棤绌哄簱浣�");
-                              }
-                              // 鍙敤搴撲綅缁�
-                              List<LocMast> locMastList = new ArrayList<>();
-                              for(LocMast locMast1:collect) {
-                                  Optional<LocMast> first = collect1.stream().filter(locMast2 -> locMast1.getRow1() + 1 == locMast2.getRow1() && Objects.equals(locMast1.getLev1(), locMast2.getLev1())
-                                          && Objects.equals(locMast1.getBay1(), locMast2.getBay1())).findFirst();
-                                  first.ifPresent(locMastList::add);
-                              }
-
-                              if (locMastList.size() == 0) {
-                                  log.error("-----绌烘《搴撴棤瀵瑰簲绌虹┖妗剁粍----");
-                                  throw new CoolException("绌烘《搴撴棤瀵瑰簲绌虹┖妗剁粍");
-                              }
-                              String model = findLocNoAttributeVo.getModel(); // 褰撳墠妗剁被鍨�
-                              if (model.equals("208L") && locMastList.size() <= 40 * 2 * 2) { // 鏈�涓婇潰涓�灞傚彧鑳芥斁208L锛屽簱浣嶅墿浣欓噺涓嶅鏃讹紝濡傛灉鏄�208L妗跺叆搴擄紝鍒欏厛浠庢渶椤跺眰鏀�
-                                  locMastList = locMastList.stream().sorted(Comparator.comparing(LocMast::getLev1).reversed().thenComparing(LocMast::getBay1).thenComparing(LocMast::getRow1)).collect(Collectors.toList());
-                              } else {
-                                  locMastList = locMastList.stream().sorted(Comparator.comparing(LocMast::getLev1).thenComparing(LocMast::getBay1).thenComparing(LocMast::getRow1)).collect(Collectors.toList());
-                              }
-                              locMast = locMastList.get(0);
-                          } else { // 濂囨暟锛屼笉鍙互鍏ュ簱
-                              // 鑷姩缁欏墠闈换鍔¤ˉ灏炬《淇″彿
-                              wrkMastService.updateCtnType(wrkMast);
-                              log.error("-----涓庡墠闈㈡《绫诲瀷涓嶄竴鏍凤紝鍓嶉潰妗朵笉鏄熬妗讹紝鍓嶉潰璇ユ《绫诲瀷浠诲姟鏁颁笉鏄伓鏁帮紝涓嶈兘鍏ュ簱----");
-                              throw new CoolException("涓庡墠闈㈡《绫诲瀷涓嶄竴鏍凤紝鍓嶉潰妗朵笉鏄熬妗讹紝鍓嶉潰璇ユ《绫诲瀷浠诲姟鏁颁笉鏄伓鏁帮紝涓嶈兘鍏ュ簱");
-                          }
-                      }
-                }
-            }
+//                // 鍙敤搴撲綅缁�
+//                List<LocMast> locMastList = new ArrayList<>();
+//                for(LocMast locMast1:collect) {
+//                    Optional<LocMast> first = collect1.stream().filter(locMast2 -> locMast1.getRow1() + 1 == locMast2.getRow1() && Objects.equals(locMast1.getLev1(), locMast2.getLev1())
+//                            && Objects.equals(locMast1.getBay1(), locMast2.getBay1())).findFirst();
+//                    first.ifPresent(locMastList::add);
+//                }
+//
+//                if (locMastList.size() == 0) {
+//                    log.error("-----绌烘《搴撴棤瀵瑰簲绌虹┖妗剁粍----");
+//                    throw new CoolException("绌烘《搴撴棤瀵瑰簲绌虹┖妗剁粍");
+//                }
+//                String model = findLocNoAttributeVo.getModel(); // 褰撳墠妗剁被鍨�
+//                if (model.equals("208L") && locMastList.size() <= 40 * 2 * 2) { // 鏈�涓婇潰涓�灞傚彧鑳芥斁208L锛屽簱浣嶅墿浣欓噺涓嶅鏃讹紝濡傛灉鏄�208L妗跺叆搴擄紝鍒欏厛浠庢渶椤跺眰鏀�
+//                    locMastList = locMastList.stream().sorted(Comparator.comparing(LocMast::getLev1).reversed().thenComparing(LocMast::getBay1).thenComparing(LocMast::getRow1)).collect(Collectors.toList());
+//                } else {
+//                    locMastList = locMastList.stream().sorted(Comparator.comparing(LocMast::getLev1).thenComparing(LocMast::getBay1).thenComparing(LocMast::getRow1)).collect(Collectors.toList());
+//                }
+//                locMast = locMastList.get(0);
+//
+//            } else {
+//                WrkMast wrkMast = wrkMastList.get(0); // 鏈�鍚庝竴涓叆绌烘《搴撲换鍔�
+//                // 鍓嶄竴涓换鍔℃《绫诲瀷
+//                String oldModel = wrkMast.getPdcType();
+//                // 鍓嶄竴涓换鍔″熬鎵樻爣璇�
+//                Integer oldCtnType = wrkMast.getCtnType();
+//                // 褰撳墠妗剁被鍨�
+//                String matnr = findLocNoAttributeVo.getMatnr();
+//                if(findLocNoAttributeVo.getMatnr().equals(wrkMast.getPdcType())) { // 褰撳墠妗朵笌鍓嶆《鏄竴绉嶇被鍨�
+//                    // 褰撳墠妗剁被鍨嬬殑浠诲姟鏈夊嚑涓�
+//                    long count = wrkMastList.stream().filter(wrkMast1 -> wrkMast1.getPdcType().equals(matnr)).count();
+//                    if (count % 2  == 0) { // 鍋舵暟锛屽彇涓�缁勬柊搴撲綅
+//                        // 鍙栨柊搴撲綅缁勭殑绗竴涓簱浣�
+//                        List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("crn_no", 4).eq("loc_sts", "O"));
+//                        List<LocMast> collect = locMasts.stream().filter(locMast1 -> locMast1.getRow1() == 9 || locMast1.getRow1() == 11).collect(Collectors.toList());
+//                        List<LocMast> collect1 = locMasts.stream().filter(locMast1 -> locMast1.getRow1() == 10 || locMast1.getRow1() == 12).collect(Collectors.toList()); // 绗竴涓厛鏀捐繖涓ゆ帓
+//                        if (collect.size() == 0 || collect1.size() == 0) {
+//                            log.error("-----绌烘《搴撴棤绌哄簱浣�----");
+//                            throw new CoolException("绌烘《搴撴棤绌哄簱浣�");
+//                        }
+//                        // 鍙敤搴撲綅缁�
+//                        List<LocMast> locMastList = new ArrayList<>();
+//                        for(LocMast locMast1:collect) {
+//                            Optional<LocMast> first = collect1.stream().filter(locMast2 -> locMast1.getRow1() + 1 == locMast2.getRow1() && Objects.equals(locMast1.getLev1(), locMast2.getLev1())
+//                                    && Objects.equals(locMast1.getBay1(), locMast2.getBay1())).findFirst();
+//                            first.ifPresent(locMastList::add);
+//                        }
+//
+//                        if (locMastList.size() == 0) {
+//                            log.error("-----绌烘《搴撴棤瀵瑰簲绌虹┖妗剁粍----");
+//                            throw new CoolException("绌烘《搴撴棤瀵瑰簲绌虹┖妗剁粍");
+//                        }
+//                        String model = findLocNoAttributeVo.getModel(); // 褰撳墠妗剁被鍨�
+//                        if (model.equals("208L") && locMastList.size() <= 40 * 2 * 2) { // 鏈�涓婇潰涓�灞傚彧鑳芥斁208L锛屽簱浣嶅墿浣欓噺涓嶅鏃讹紝濡傛灉鏄�208L妗跺叆搴擄紝鍒欏厛浠庢渶椤跺眰鏀�
+//                            locMastList = locMastList.stream().sorted(Comparator.comparing(LocMast::getLev1).reversed().thenComparing(LocMast::getBay1).thenComparing(LocMast::getRow1)).collect(Collectors.toList());
+//                        } else {
+//                            locMastList = locMastList.stream().sorted(Comparator.comparing(LocMast::getLev1).thenComparing(LocMast::getBay1).thenComparing(LocMast::getRow1)).collect(Collectors.toList());
+//                        }
+//                        locMast = locMastList.get(0);
+//                    } else { // 濂囨暟锛屽彇鍓嶄竴搴撲綅瀵瑰簲鐨勭┖搴撲綅
+//                        String locNo = wrkMast.getLocNo();
+//                        int row = Integer.parseInt(locNo.substring(0, 2));
+//                        if(row == 10 || row == 12) {
+//                            String newLocNo =(row == 10 ? "09" : "11") + locNo.substring(2);
+//                            locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", newLocNo).eq("loc_sts","O"));
+//                            if (locMast == null) {
+//                                log.error("-----涓庡墠闈㈡《绫诲瀷涓�鏍凤紝鍓嶉潰璇ユ《绫诲瀷浠诲姟鏁版槸濂囨暟锛�10锛�12鎺�,浣嗘槸瀵瑰簲搴撲綅涓嶄负绌�----");
+//                                throw new CoolException("涓庡墠闈㈡《绫诲瀷涓�鏍凤紝鍓嶉潰璇ユ《绫诲瀷浠诲姟鏁版槸濂囨暟锛屾槸10锛�12鎺�,浣嗘槸瀵瑰簲搴撲綅涓嶄负绌�");
+//                            }
+//                        } else {
+//                            // 鑷姩缁欏墠闈换鍔¤ˉ灏炬《淇″彿
+//                            wrkMastService.updateCtnType(wrkMast);
+//                            log.error("-----涓庡墠闈㈡《绫诲瀷涓�鏍凤紝鍓嶉潰璇ユ《绫诲瀷浠诲姟鏁版槸濂囨暟锛屼絾鏄笉鏄�10锛�12鎺�----");
+//                            throw new CoolException("涓庡墠闈㈡《绫诲瀷涓�鏍凤紝鍓嶉潰璇ユ《绫诲瀷浠诲姟鏁版槸濂囨暟锛屼絾鏄笉鏄�10锛�12鎺�");
+//                        }
+//                    }
+//                } else { // 褰撳墠妗朵笌鍓嶆《涓嶆槸涓�绉嶇被鍨�
+//                      if(oldCtnType == 1) { // 鍓嶉潰鏄熬妗�
+//                          // 鍙栨柊搴撲綅缁勭殑绗竴涓簱浣�
+//                          List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("crn_no", 4).eq("loc_sts", "O"));
+//                          List<LocMast> collect = locMasts.stream().filter(locMast1 -> locMast1.getRow1() == 9 || locMast1.getRow1() == 11).collect(Collectors.toList());
+//                          List<LocMast> collect1 = locMasts.stream().filter(locMast1 -> locMast1.getRow1() == 10 || locMast1.getRow1() == 12).collect(Collectors.toList()); // 绗竴涓厛鏀捐繖涓ゆ帓
+//                          if (collect.size() == 0 || collect1.size() == 0) {
+//                              log.error("-----绌烘《搴撴棤绌哄簱浣�----");
+//                              throw new CoolException("绌烘《搴撴棤绌哄簱浣�");
+//                          }
+//                          // 鍙敤搴撲綅缁�
+//                          List<LocMast> locMastList = new ArrayList<>();
+//                          for(LocMast locMast1:collect) {
+//                              Optional<LocMast> first = collect1.stream().filter(locMast2 -> locMast1.getRow1() + 1 == locMast2.getRow1() && Objects.equals(locMast1.getLev1(), locMast2.getLev1())
+//                                      && Objects.equals(locMast1.getBay1(), locMast2.getBay1())).findFirst();
+//                              first.ifPresent(locMastList::add);
+//                          }
+//
+//                          if (locMastList.size() == 0) {
+//                              log.error("-----绌烘《搴撴棤瀵瑰簲绌虹┖妗剁粍----");
+//                              throw new CoolException("绌烘《搴撴棤瀵瑰簲绌虹┖妗剁粍");
+//                          }
+//                          String model = findLocNoAttributeVo.getModel(); // 褰撳墠妗剁被鍨�
+//                          if (model.equals("208L") && locMastList.size() <= 40 * 2 * 2) { // 鏈�涓婇潰涓�灞傚彧鑳芥斁208L锛屽簱浣嶅墿浣欓噺涓嶅鏃讹紝濡傛灉鏄�208L妗跺叆搴擄紝鍒欏厛浠庢渶椤跺眰鏀�
+//                              locMastList = locMastList.stream().sorted(Comparator.comparing(LocMast::getLev1).reversed().thenComparing(LocMast::getBay1).thenComparing(LocMast::getRow1)).collect(Collectors.toList());
+//                          } else {
+//                              locMastList = locMastList.stream().sorted(Comparator.comparing(LocMast::getLev1).thenComparing(LocMast::getBay1).thenComparing(LocMast::getRow1)).collect(Collectors.toList());
+//                          }
+//                          locMast = locMastList.get(0);
+//                      } else { // 鍓嶉潰涓嶆槸灏炬《
+//                          // 鍒ゆ柇鍓嶉潰鍏ョ┖妗跺簱浠诲姟鏁伴噺(鏈墽琛屽爢鍨涙満鍏ュ簱)
+//                          long count = wrkMastList.stream().filter(wrkMast1 -> wrkMast1.getPdcType().equals(oldModel)).count();
+//                          if (count % 2 == 0) { // 鍋舵暟锛屽彲浠ュ叆搴�
+//                              // 鍙栨柊搴撲綅缁勭殑绗竴涓簱浣�
+//                              List<LocMast> locMasts = locMastService.selectList(new EntityWrapper<LocMast>().eq("crn_no", 4).eq("loc_sts", "O"));
+//                              List<LocMast> collect = locMasts.stream().filter(locMast1 -> locMast1.getRow1() == 9 || locMast1.getRow1() == 11).collect(Collectors.toList());
+//                              List<LocMast> collect1 = locMasts.stream().filter(locMast1 -> locMast1.getRow1() == 10 || locMast1.getRow1() == 12).collect(Collectors.toList()); // 绗竴涓厛鏀捐繖涓ゆ帓
+//                              if (collect.size() == 0 || collect1.size() == 0) {
+//                                  log.error("-----绌烘《搴撴棤绌哄簱浣�----");
+//                                  throw new CoolException("绌烘《搴撴棤绌哄簱浣�");
+//                              }
+//                              // 鍙敤搴撲綅缁�
+//                              List<LocMast> locMastList = new ArrayList<>();
+//                              for(LocMast locMast1:collect) {
+//                                  Optional<LocMast> first = collect1.stream().filter(locMast2 -> locMast1.getRow1() + 1 == locMast2.getRow1() && Objects.equals(locMast1.getLev1(), locMast2.getLev1())
+//                                          && Objects.equals(locMast1.getBay1(), locMast2.getBay1())).findFirst();
+//                                  first.ifPresent(locMastList::add);
+//                              }
+//
+//                              if (locMastList.size() == 0) {
+//                                  log.error("-----绌烘《搴撴棤瀵瑰簲绌虹┖妗剁粍----");
+//                                  throw new CoolException("绌烘《搴撴棤瀵瑰簲绌虹┖妗剁粍");
+//                              }
+//                              String model = findLocNoAttributeVo.getModel(); // 褰撳墠妗剁被鍨�
+//                              if (model.equals("208L") && locMastList.size() <= 40 * 2 * 2) { // 鏈�涓婇潰涓�灞傚彧鑳芥斁208L锛屽簱浣嶅墿浣欓噺涓嶅鏃讹紝濡傛灉鏄�208L妗跺叆搴擄紝鍒欏厛浠庢渶椤跺眰鏀�
+//                                  locMastList = locMastList.stream().sorted(Comparator.comparing(LocMast::getLev1).reversed().thenComparing(LocMast::getBay1).thenComparing(LocMast::getRow1)).collect(Collectors.toList());
+//                              } else {
+//                                  locMastList = locMastList.stream().sorted(Comparator.comparing(LocMast::getLev1).thenComparing(LocMast::getBay1).thenComparing(LocMast::getRow1)).collect(Collectors.toList());
+//                              }
+//                              locMast = locMastList.get(0);
+//                          } else { // 濂囨暟锛屼笉鍙互鍏ュ簱
+//                              // 鑷姩缁欏墠闈换鍔¤ˉ灏炬《淇″彿
+//                              wrkMastService.updateCtnType(wrkMast);
+//                              log.error("-----涓庡墠闈㈡《绫诲瀷涓嶄竴鏍凤紝鍓嶉潰妗朵笉鏄熬妗讹紝鍓嶉潰璇ユ《绫诲瀷浠诲姟鏁颁笉鏄伓鏁帮紝涓嶈兘鍏ュ簱----");
+//                              throw new CoolException("涓庡墠闈㈡《绫诲瀷涓嶄竴鏍凤紝鍓嶉潰妗朵笉鏄熬妗讹紝鍓嶉潰璇ユ《绫诲瀷浠诲姟鏁颁笉鏄伓鏁帮紝涓嶈兘鍏ュ簱");
+//                          }
+//                      }
+//                }
+//            }
 
         } else if ((staDescId == 1 && locArea == 1) || staDescId == 10) { // 婊℃澘鍏ユ垚鍝佸簱鎴栬�呯┖鏉垮叆鎴愬搧搴�
 

--
Gitblit v1.9.1