From 0eb4bcffe0c6e017f9a9967576f12818c9b05db7 Mon Sep 17 00:00:00 2001
From: 18516761980 <4761516tqsxp>
Date: 星期六, 11 九月 2021 13:36:44 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java |   92 +++++++++++++++++----------------------------
 1 files changed, 35 insertions(+), 57 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 b67cfb9..a489602 100644
--- a/src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/WorkServiceImpl.java
@@ -14,12 +14,11 @@
 import com.zy.asrs.service.*;
 import com.zy.asrs.utils.VersionUtils;
 import com.zy.common.model.LocDetlDto;
+import com.zy.common.model.LocTypeDto;
 import com.zy.common.model.OutLocDto;
 import com.zy.common.model.StartupDto;
 import com.zy.common.service.CommonService;
-import com.zy.ints.entity.IoComplete;
 import com.zy.ints.entity.WaitMatchk;
-import com.zy.ints.entity.WaitMatout;
 import com.zy.ints.service.IoCompleteService;
 import com.zy.ints.service.WaitMatchkService;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -83,7 +82,9 @@
         int workNo = commonService.getWorkNo(DEFAULT_WORK_NO_TYPE);
         // 妫�绱㈠簱浣�
         List<String> matNos = param.getList().stream().map(FullStoreParam.MatCodeStore::getMatNo).distinct().collect(Collectors.toList());
-        StartupDto dto = commonService.getLocNo(DEFAULT_ROW_NO_TYPE, 1, param.getDevpNo(), matNos, 0);
+        LocTypeDto locTypeDto = new LocTypeDto(sourceStaNo);
+        locTypeDto.setLocType1((short) 1);
+        StartupDto dto = commonService.getLocNo(DEFAULT_ROW_NO_TYPE, 1, param.getDevpNo(),false, matNos,locTypeDto, 0);
         // 鐢熸垚宸ヤ綔妗�
         WrkMast wrkMast = new WrkMast();
         wrkMast.setWrkNo(workNo);
@@ -156,7 +157,7 @@
             }
         }
         if (!locDetlDtos.isEmpty()) {
-            // 鍚姩鍑哄簱寮�濮� 101.鍑哄簱
+            // 鍚姩鍑哄簱寮�濮� 101.103鍑哄簱
             stockOut(staNo, locDetlDtos, null, userId);
         } else {
             throw new CoolException("搴撲綅浜у搧涓嶅瓨鍦�");
@@ -183,37 +184,38 @@
             }
             dtos.add(new OutLocDto(locNo, list));
         }
-        //鐢熸垚鐩樼偣鏂囨。
-        for (LocDetlDto locDetlDto : locDetlDtos) {
 
-            String id="";
+        if(ioType == 107) {
             //鑾峰彇褰撳墠鏃堕棿鎴�
             SimpleDateFormat sf = new SimpleDateFormat("yyyyMMddHHmmss");
             String temp = sf.format(new Date());
-            //鑾峰彇6浣嶉殢鏈烘暟
-            int random=(int) ((Math.random()+1)*1000);
-            id=temp+random;
-
+            //鑾峰彇3浣嶉殢鏈烘暟
+            Random rand = new Random();
+            Integer r = rand.nextInt(900) + 100;
+            String billNo = temp + r;
+            //鐢熸垚鐩樼偣閫氱煡妗�
+            for (LocDetlDto locDetlDto : locDetlDtos) {
 //            String replace = UUID.randomUUID().toString().replace("-", "");
-            LocDetl locDetl = locDetlDto.getLocDetl();
-            //鐢熸垚鐩樼偣妗�
-            WaitMatchk waitMatchk = new WaitMatchk();
-            waitMatchk.setBillNo(id);//璁㈠崟缂栧彿
-            waitMatchk.setLocNo(locDetl.getLocNo());//搴撲綅鍙�
-            waitMatchk.setStockQty(locDetl.getQty());
-            waitMatchk.setMatNo(locDetl.getMatNo());//浜у搧缂栧彿
-            waitMatchk.setMatName(locDetl.getMatName());//閾插钩鍚嶇О
-            waitMatchk.setSeqNo(i);
-            waitMatchk.setIoTime(new Date());
-            waitMatchk.setZpallet(locDetl.getZpallet());
-            waitMatchk.setAppeUser(userId); // 鎿嶄綔浜哄憳鏁版嵁
-            waitMatchk.setAppeTime(new Date());
-            waitMatchk.setModiUser(userId);
-            waitMatchk.setModiTime(new Date());
-            if (!waitMatchkService.insert(waitMatchk)){
-                throw new CoolException("淇濆瓨鐩樼偣妗eけ璐�");
+                LocDetl locDetl = locDetlDto.getLocDetl();
+                //鐢熸垚鐩樼偣妗�
+                WaitMatchk waitMatchk = new WaitMatchk();
+                waitMatchk.setBillNo(billNo);//璁㈠崟缂栧彿
+                waitMatchk.setLocNo(locDetl.getLocNo());//搴撲綅鍙�
+                waitMatchk.setStockQty(locDetl.getQty());
+                waitMatchk.setMatNo(locDetl.getMatNo());//浜у搧缂栧彿
+                waitMatchk.setMatName(locDetl.getMatName());//閾插钩鍚嶇О
+                waitMatchk.setSeqNo(i);
+                waitMatchk.setIoTime(new Date());
+                waitMatchk.setZpallet(locDetl.getZpallet());
+                waitMatchk.setAppeUser(userId); // 鎿嶄綔浜哄憳鏁版嵁
+                waitMatchk.setAppeTime(new Date());
+                waitMatchk.setModiUser(userId);
+                waitMatchk.setModiTime(new Date());
+                if (!waitMatchkService.insert(waitMatchk)) {
+                    throw new CoolException("淇濆瓨鐩樼偣妗eけ璐�");
+                }
+                i++;
             }
-            i++;
         }
 
         // 鐢熸垚宸ヤ綔妗�
@@ -236,7 +238,6 @@
             }
             // 鐢熸垚宸ヤ綔鍙�
             int workNo = commonService.getWorkNo(DEFAULT_WORK_NO_TYPE);
-
 
             // 鐢熸垚宸ヤ綔妗�
             WrkMast wrkMast = new WrkMast();
@@ -302,7 +303,9 @@
         // 鐢熸垚宸ヤ綔鍙�
         int workNo = commonService.getWorkNo(DEFAULT_WORK_NO_TYPE);
         // 妫�绱㈠簱浣�
-        StartupDto dto = commonService.getLocNo(DEFAULT_ROW_NO_TYPE, 10, devpNo, null, 0);
+        LocTypeDto locTypeDto = new LocTypeDto(sourceStaNo);
+        locTypeDto.setLocType1((short) 1);
+        StartupDto dto = commonService.getLocNo(DEFAULT_ROW_NO_TYPE, 10, devpNo, true,null,locTypeDto, 0);
         // 鐢熸垚宸ヤ綔妗�
         WrkMast wrkMast = new WrkMast();
         wrkMast.setWrkNo(workNo);
@@ -533,32 +536,7 @@
         } else if (wrkMast.getWrkSts() > 10) {
             wrkMast.setWrkSts(14L);
         }
-        //鏌ヨ鏄庣粏
-        List<WrkDetl> detls = wrkDetlService.selectList(new EntityWrapper<WrkDetl>().eq("wrk_no", workNo));
-        int i=1;
-        for (WrkDetl detl : detls) {
-            //鐢熸垚鍥炴姤妗�
-            IoComplete ioComplete = new IoComplete();
-            ioComplete.setBillNo(detl.getBillNo());
-            ioComplete.setMatNo(detl.getMatNo());
-            ioComplete.setMatName(detl.getMatName());
-            ioComplete.setSeqNo(i);
-            ioComplete.setQty(detl.getQty());
-            ioComplete.setZpallet(detl.getZpallet());
-            ioComplete.setAppeUser(userId);
-            if (wrkMast.getWrkSts()==4L){
-                ioComplete.setTaskType(1);
-                ioComplete.setLocNo(wrkMast.getLocNo());
-            }else if (wrkMast.getWrkSts()==14L){
-                ioComplete.setTaskType(2);
-                ioComplete.setLocNo(wrkMast.getSourceLocNo());
-            }
-            ioComplete.setAppeTime(new Date());
-            if (!ioCompleteService.insert(ioComplete)){
-                throw new CoolException("鐢熸垚鍥炴姤妗eけ璐�");
-            }
-            i++;
-        }
+
         // 瀹屾垚鎿嶄綔浜哄憳璁板綍
         wrkMast.setManuType("鎵嬪姩瀹屾垚");
         Date now = new Date();

--
Gitblit v1.9.1