From b51eadaa66a5c0ee6da0e418a3ba193dfc878fca Mon Sep 17 00:00:00 2001
From: zhang <zc857179121@qq.com>
Date: 星期四, 03 七月 2025 13:21:56 +0800
Subject: [PATCH] 1

---
 src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java |  196 ++++++++++++++++++++++++++++++++++++------------
 1 files changed, 145 insertions(+), 51 deletions(-)

diff --git a/src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java
index 3f4ac35..68a9c07 100644
--- a/src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java
@@ -181,8 +181,15 @@
         if (!locDetlDtos.isEmpty()) {
             LocMast locMast = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", locDetlDtos.get(0).getLocDetl().getLocNo()));
             if (locMast.getLocSts().equals("F") || locMast.getLocSts().equals("D")) {
-                // 鍚姩鍑哄簱寮�濮� 101.鍑哄簱
-                stockOut(staNo, locDetlDtos, null, userId);
+                if (staNo.getDevNo() == 1135 && locMast.getLocType1() == 2) {
+                    throw new CoolException("鎵�閫夊簱浣嶄笉鏄綆搴撲綅鏃犳硶璋冩嫧锛屽簱浣嶅彿锛歿}" + locMast.getLocNo());
+                }
+                if(staNo.getDevNo()>=1100){
+                    // 鍚姩鍑哄簱寮�濮� 101.鍑哄簱
+                    stockOut(staNo, locDetlDtos, null, userId);
+                }else {
+                    stockOutSXK(staNo, locDetlDtos, null, userId);
+                }
             } else {
                 throw new CoolException("鎵�閫夊簱浣嶅瓨鍦ㄧ姸鎬佷笉涓篎銆丏鐨勫簱浣嶏紝搴撲綅鍙凤細" + locMast.getLocNo() + " 銆佸綋鍓嶇姸鎬侊細" + locMast.getLocSts() + "-" + locMast.getLocSts$());
             }
@@ -228,6 +235,11 @@
             LocMast locMast = locMastService.selectById(dto.getLocNo());
 
             Integer outSta = staNo.getDevNo();
+            if (outSta == 1135 || outSta == 1031) {
+                if (101 != ioType) {
+                    throw new CoolException("璇ョ珯鐐瑰繀椤诲叏鏉垮嚭搴擄紝鍑哄簱搴撲綅鍙凤細" + dto.getLocNo());
+                }
+            }
 //            //2鍙峰爢鍨涙満鍏ㄦ澘鍑哄簱绔欐寚瀹氫负204绔欙紝鎷f枡绔欐寚瀹氫负202
 //            if(locMast.getCrnNo()==2){
 //                outSta = ioType == 101 ? 204 : 202;
@@ -526,30 +538,26 @@
         LocMast locMast = locMastService.selectById(taskDto.getLocNo());
 
         List<LocMast> locMasts = new ArrayList<>();
-        if ((locMast.getBay1() >= 1 && locMast.getBay1() <= 2) || (locMast.getBay1() >= 6 && locMast.getBay1() <= 7 && locMast.getRow1() != 36 && locMast.getRow1() != 29) || (locMast.getBay1() >= 11 && locMast.getBay1() <= 12)) {
+        if ((locMast.getBay1() >= 3 && locMast.getBay1() <= 6) ) {
             locMasts = locMastService.selectList(new EntityWrapper<LocMast>()
-                    .eq("gro1", locMast.getGro1())
-                    .eq("crn_no", 7)
-                    .eq("loc_type1", locMast.getLocType1())
-                    .orderBy("bay1", false));
-        } else {
-            locMasts = locMastService.selectList(new EntityWrapper<LocMast>()
-                    .eq("gro1", locMast.getGro1())
+                    .eq("row1", locMast.getBay1())
+                    .in("bay1", 3,4,5,6)
                     .eq("crn_no", 7)
                     .eq("loc_type1", locMast.getLocType1())
                     .orderBy("bay1", true));
-        }
-        for (LocMast locMast1 : locMasts) {
-            if (locMast1.getLocNo().equals(taskDto.getLocNo())) {
-                break;
-            }
-            if (locMast1.getLocSts().equals("X")) {
-                throw new CoolException(taskDto.getLocNo() + "搴撲綅鍓嶆柟鏈夐攣瀹氬簱浣嶏紝绂佹鍑哄簱");
-            }
-            if (locMast1.getLocSts().equals("F")) {
-                moveLocForDeepLoc(locMast1);
+            for (LocMast locMast1 : locMasts) {
+                if (locMast1.getLocNo().equals(taskDto.getLocNo())) {
+                    break;
+                }
+                if (locMast1.getLocSts().equals("X")) {
+                    throw new CoolException(taskDto.getLocNo() + "搴撲綅鍓嶆柟鏈夐攣瀹氬簱浣嶏紝绂佹鍑哄簱");
+                }
+                if (locMast1.getLocSts().equals("F")) {
+                    locMast = locMast1;
+                }
             }
         }
+
 
         // 鑾峰彇璺緞
         int ioType = taskDto.isAll() ? 101 : 103;
@@ -1763,30 +1771,50 @@
             LocMast locMast = locMastService.selectById(dto.getLocNo());
 
             List<LocMast> locMasts = new ArrayList<>();
-            if ((locMast.getBay1() >= 1 && locMast.getBay1() <= 2) || (locMast.getBay1() >= 6 && locMast.getBay1() <= 7 && locMast.getRow1() != 36 && locMast.getRow1() != 29) || (locMast.getBay1() >= 11 && locMast.getBay1() <= 12)) {
+//            if ((locMast.getBay1() >= 1 && locMast.getBay1() <= 2) || (locMast.getBay1() >= 6 && locMast.getBay1() <= 7 && locMast.getRow1() != 36 && locMast.getRow1() != 29) || (locMast.getBay1() >= 11 && locMast.getBay1() <= 12)) {
+//                locMasts = locMastService.selectList(new EntityWrapper<LocMast>()
+//                        .eq("gro1", locMast.getGro1())
+//                        .eq("crn_no", 7)
+//                        .eq("loc_type1", locMast.getLocType1())
+//                        .orderBy("bay1", false));
+//            } else {
+//                locMasts = locMastService.selectList(new EntityWrapper<LocMast>()
+//                        .eq("gro1", locMast.getGro1())
+//                        .eq("crn_no", 7)
+//                        .eq("loc_type1", locMast.getLocType1())
+//                        .orderBy("bay1", true));
+//            }
+//            for (LocMast locMast1 : locMasts) {
+//                if (locMast1.getLocNo().equals(dto.getLocNo())) {
+//                    break;
+//                }
+//                if (locMast1.getLocSts().equals("X")) {
+//                    throw new CoolException(dto.getLocNo() + "搴撲綅鍓嶆柟鏈夐攣瀹氬簱浣嶏紝绂佹鍑哄簱");
+//                }
+//                if (locMast1.getLocSts().equals("F")) {
+//                    moveLocForDeepLoc(locMast1);
+//                }
+//            }
+            if ((locMast.getBay1() >= 3 && locMast.getBay1() <= 6) ) {
                 locMasts = locMastService.selectList(new EntityWrapper<LocMast>()
-                        .eq("gro1", locMast.getGro1())
-                        .eq("crn_no", 7)
-                        .eq("loc_type1", locMast.getLocType1())
-                        .orderBy("bay1", false));
-            } else {
-                locMasts = locMastService.selectList(new EntityWrapper<LocMast>()
-                        .eq("gro1", locMast.getGro1())
+                        .eq("row1", locMast.getBay1())
+                        .in("bay1", 3,4,5,6)
                         .eq("crn_no", 7)
                         .eq("loc_type1", locMast.getLocType1())
                         .orderBy("bay1", true));
-            }
-            for (LocMast locMast1 : locMasts) {
-                if (locMast1.getLocNo().equals(dto.getLocNo())) {
-                    break;
-                }
-                if (locMast1.getLocSts().equals("X")) {
-                    throw new CoolException(dto.getLocNo() + "搴撲綅鍓嶆柟鏈夐攣瀹氬簱浣嶏紝绂佹鍑哄簱");
-                }
-                if (locMast1.getLocSts().equals("F")) {
-                    moveLocForDeepLoc(locMast1);
+                for (LocMast locMast1 : locMasts) {
+                    if (locMast1.getLocNo().equals(locMast.getLocNo())) {
+                        break;
+                    }
+                    if (locMast1.getLocSts().equals("X")) {
+                        throw new CoolException(locMast.getLocNo() + "搴撲綅鍓嶆柟鏈夐攣瀹氬簱浣嶏紝绂佹鍑哄簱");
+                    }
+                    if (locMast1.getLocSts().equals("F")) {
+                        locMast = locMast1;
+                    }
                 }
             }
+
 
             Integer outSta = staNo.getDevNo();
 //            //2鍙峰爢鍨涙満鍏ㄦ澘鍑哄簱绔欐寚瀹氫负204绔欙紝鎷f枡绔欐寚瀹氫负202
@@ -1863,7 +1891,6 @@
 
     @Transactional
     public void toSxk(WrkMast wrkMastold, List<WrkDetl> wrkDetls, Short locType) {
-
         LocTypeDto locTypeDto = new LocTypeDto();
         locTypeDto.setLocType1(locType);
         StartupDto dto = commonService.getLocNo(1, 1031, null, null, null, locTypeDto, false);
@@ -1877,9 +1904,11 @@
         WrkMast wrkMast = new WrkMast();
         wrkMast.setWrkNo(workNo);
         wrkMast.setIoTime(new Date());
-        wrkMast.setWrkSts(1L); // 宸ヤ綔鐘舵�侊細1.鐢熸垚鍏ュ簱ID
-        wrkMast.setIoType(1); // 鍏ュ嚭搴撶姸鎬侊細 1.搴撴牸绉昏浇
+        wrkMast.setWrkSts(2L); // 宸ヤ綔鐘舵�侊細1.鐢熸垚鍏ュ簱ID
+        wrkMast.setIoType(wrkMastold.getIoType() - 100); // 鍏ュ嚭搴撶姸鎬侊細 1.搴撴牸绉昏浇
         wrkMast.setIoPri(12D);
+        wrkMast.setStaNo(1032);
+        wrkMast.setSourceStaNo(1031);
         wrkMast.setCrnNo(7);
         wrkMast.setLocNo(dto.getLocNo()); // 鐩爣搴撲綅
         wrkMast.setFullPlt("Y"); // 婊℃澘
@@ -1888,6 +1917,7 @@
         wrkMast.setEmptyMk("Y"); // 绌烘澘
         wrkMast.setBarcode(wrkMastold.getBarcode()); // 鎵樼洏鐮�
         wrkMast.setLinkMis("N");
+        wrkMast.setPltType(wrkMastold.getWrkNo());
         wrkMast.setAppeTime(new Date());
         wrkMast.setModiTime(new Date());
         boolean res = wrkMastService.insert(wrkMast);
@@ -1895,16 +1925,18 @@
             throw new CoolException("淇濆瓨宸ヤ綔妗eけ璐�");
         }
         // 宸ヤ綔妗f槑缁嗕繚瀛�
-        for (WrkDetl wrk : wrkDetls) {
-            WrkDetl wrkDetl = new WrkDetl();
-            Synchro.Copy(wrk, wrkDetl);
-            wrkDetl.setWrkNo(workNo);
-            wrkDetl.setIoTime(new Date());
-            wrkDetl.setAnfme(wrk.getAnfme());
-            wrkDetl.setAppeTime(new Date());
-            wrkDetl.setModiTime(new Date());
-            if (!wrkDetlService.insert(wrkDetl)) {
-                throw new CoolException("淇濆瓨宸ヤ綔妗f槑缁嗗け璐�");
+        if (wrkDetls != null) {
+            for (WrkDetl wrk : wrkDetls) {
+                WrkDetl wrkDetl = new WrkDetl();
+                Synchro.Copy(wrk, wrkDetl);
+                wrkDetl.setWrkNo(workNo);
+                wrkDetl.setIoTime(new Date());
+                wrkDetl.setAnfme(wrk.getAnfme());
+                wrkDetl.setAppeTime(new Date());
+                wrkDetl.setModiTime(new Date());
+                if (!wrkDetlService.insert(wrkDetl)) {
+                    throw new CoolException("淇濆瓨宸ヤ綔妗f槑缁嗗け璐�");
+                }
             }
         }
         // 淇敼鐩爣搴撲綅鐘舵��
@@ -1920,5 +1952,67 @@
 
     }
 
+    @Transactional
+    public void toCrn(WrkMast wrkMastold, List<WrkDetl> wrkDetls, Short locType) {
+        LocTypeDto locTypeDto = new LocTypeDto();
+        locTypeDto.setLocType1(locType);
+        StartupDto dto = commonService.getLocNo(1, 1135, null, null, null, locTypeDto, false);
+        if (Cools.isEmpty(dto)) {
+            throw new CoolException("鍘诲爢鍨涙満鏈壘鍒板簱浣�");
+        }
+        LocMast loc = locMastService.selectOne(new EntityWrapper<LocMast>().eq("loc_no", dto.getLocNo()));
+        // 鑾峰彇宸ヤ綔鍙�
+        int workNo = commonService.getWorkNo(0);
+        // 淇濆瓨宸ヤ綔妗�
+        WrkMast wrkMast = new WrkMast();
+        wrkMast.setWrkNo(workNo);
+        wrkMast.setIoTime(new Date());
+        wrkMast.setWrkSts(1L); // 宸ヤ綔鐘舵�侊細1.鐢熸垚鍏ュ簱ID
+        wrkMast.setIoType(wrkMastold.getIoType() - 100);  // 鍏ュ嚭搴撶姸鎬侊細 1.鍏ュ簱
+        wrkMast.setIoPri(12D);
+        wrkMast.setCrnNo(1);
+        wrkMast.setStaNo(1131);
+        wrkMast.setSourceStaNo(1135);
+        wrkMast.setLocNo(dto.getLocNo()); // 鐩爣搴撲綅
+        wrkMast.setFullPlt(wrkDetls == null ? "N" : "Y"); // 婊℃澘
+        wrkMast.setPicking("N"); // 鎷f枡
+        wrkMast.setExitMk("N"); // 閫�鍑�
+        wrkMast.setEmptyMk(wrkDetls != null ? "N" : "Y"); // 绌烘澘
+        wrkMast.setBarcode(wrkMastold.getBarcode()); // 鎵樼洏鐮�
+        wrkMast.setLinkMis("N");
+        wrkMast.setPltType(wrkMastold.getWrkNo());
+        wrkMast.setAppeTime(new Date());
+        wrkMast.setModiTime(new Date());
+        boolean res = wrkMastService.insert(wrkMast);
+        if (!res) {
+            throw new CoolException("淇濆瓨宸ヤ綔妗eけ璐�");
+        }
+        // 宸ヤ綔妗f槑缁嗕繚瀛�
+        if (wrkDetls != null) {
+            for (WrkDetl wrk : wrkDetls) {
+                WrkDetl wrkDetl = new WrkDetl();
+                Synchro.Copy(wrk, wrkDetl);
+                wrkDetl.setWrkNo(workNo);
+                wrkDetl.setIoTime(new Date());
+                wrkDetl.setAnfme(wrk.getAnfme());
+                wrkDetl.setAppeTime(new Date());
+                wrkDetl.setModiTime(new Date());
+                if (!wrkDetlService.insert(wrkDetl)) {
+                    throw new CoolException("淇濆瓨宸ヤ綔妗f槑缁嗗け璐�");
+                }
+            }
+        }
+        // 淇敼鐩爣搴撲綅鐘舵��
+        if (loc.getLocSts().equals("O")) {
+            loc.setLocSts("S"); // S.鍏ュ簱棰勭害
+            loc.setModiTime(new Date());
+            if (!locMastService.updateById(loc)) {
+                throw new CoolException("鏇存柊鐩爣搴撲綅鐘舵�佸け璐�");
+            }
+        } else {
+            throw new CoolException("绉昏浆澶辫触");
+        }
+
+    }
 
 }

--
Gitblit v1.9.1