From 19c13db8d30d1c2aeb9250ed218c110e1290d05f Mon Sep 17 00:00:00 2001
From: 18516761980 <4761516tqsxp>
Date: 星期二, 08 二月 2022 16:37:27 +0800
Subject: [PATCH] #

---
 src/main/java/com/zy/asrs/service/impl/MatOutServiceImpl.java |   59 +++++++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 39 insertions(+), 20 deletions(-)

diff --git a/src/main/java/com/zy/asrs/service/impl/MatOutServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/MatOutServiceImpl.java
index e8ee621..adccb2b 100644
--- a/src/main/java/com/zy/asrs/service/impl/MatOutServiceImpl.java
+++ b/src/main/java/com/zy/asrs/service/impl/MatOutServiceImpl.java
@@ -9,7 +9,6 @@
 import com.zy.asrs.service.*;
 import com.zy.asrs.utils.VersionUtils;
 import com.zy.common.model.LocDetlDto;
-import com.zy.common.model.OutLocDto;
 import com.zy.common.service.CommonService;
 import com.zy.ints.entity.WaitMatout;
 import com.zy.ints.mapper.WaitMatoutMapper;
@@ -18,7 +17,9 @@
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
 
 @Service
 public class MatOutServiceImpl implements MatOutService {
@@ -70,23 +71,33 @@
                     // 鍒ゆ柇鍏ュ嚭搴撶被鍨嬶細101.鍏ㄦ澘鍑哄簱 or 103.鎷f枡鍑哄簱
                     Double sumCount=locDetlService.getLocDetlSumQty(locDetl.getLocNo());
                     int ioType=0;
-                    ioType=sumCount-outQty>0?103 : 101;
+                    ioType = sumCount-locDetl.getQty()>0 ? 103 : 101;
 
-                    if (outQty >= locDetl.getQty()){
-                        //鐢熸垚鏂囨。璁板綍
-                        stockOut(waitMatout.getBillNo(),staNo,new LocDetlDto(locDetl,locDetl.getQty()),ioType,userId);
-                        waitMatout.setOutQty(waitMatout.getOutQty() + locDetl.getQty());
-                        //淇敼璁板綍
-                        Integer update = waitMatoutMapper.update(waitMatout, new EntityWrapper<WaitMatout>().eq("bill_no", paramLocDetl.getBillNo())
-                                                                .eq("seq_no",paramLocDetl.getSeqNo()));
-                    }else {
-                        //鐢熸垚鏂囨。璁板綍
-                        stockOut(waitMatout.getBillNo(),staNo,new LocDetlDto(locDetl,outQty),ioType,userId);
-                        waitMatout.setOutQty(waitMatout.getOutQty() + outQty);
-                        //淇敼璁板綍
-                        Integer update = waitMatoutMapper.update(waitMatout, new EntityWrapper<WaitMatout>().eq("bill_no", paramLocDetl.getBillNo())
-                                                                .eq("seq_no",paramLocDetl.getSeqNo()));
-                    }
+                    Double curOutQty = outQty >= locDetl.getQty() ? locDetl.getQty() : outQty;   //鏈鍑哄簱閲�
+                    stockOut(waitMatout.getBillNo(),waitMatout.getSeqNo(),staNo,new LocDetlDto(locDetl,curOutQty),ioType,userId);
+                    waitMatout.setOutQty(waitMatout.getOutQty() + curOutQty);
+                    waitMatout.setIoStatus(1);
+                    //淇敼璁板綍
+                    Integer update = waitMatoutMapper.update(waitMatout, new EntityWrapper<WaitMatout>().eq("bill_no", paramLocDetl.getBillNo())
+                            .eq("seq_no",paramLocDetl.getSeqNo()));
+
+//                    if (outQty >= locDetl.getQty()){
+//                        //鐢熸垚鏂囨。璁板綍
+//                        stockOut(waitMatout.getBillNo(),waitMatout.getSeqNo(),staNo,new LocDetlDto(locDetl,locDetl.getQty()),ioType,userId);
+//                        waitMatout.setOutQty(waitMatout.getOutQty() + locDetl.getQty());
+//                        waitMatout.setIoStatus(1);
+//                        //淇敼璁板綍
+//                        Integer update = waitMatoutMapper.update(waitMatout, new EntityWrapper<WaitMatout>().eq("bill_no", paramLocDetl.getBillNo())
+//                                                                .eq("seq_no",paramLocDetl.getSeqNo()));
+//                    }else {
+//                        //鐢熸垚鏂囨。璁板綍
+//                        stockOut(waitMatout.getBillNo(),waitMatout.getSeqNo(),staNo,new LocDetlDto(locDetl,outQty),ioType,userId);
+//                        waitMatout.setOutQty(waitMatout.getOutQty() + outQty);
+//                        waitMatout.setIoStatus(1);
+//                        //淇敼璁板綍
+//                        Integer update = waitMatoutMapper.update(waitMatout, new EntityWrapper<WaitMatout>().eq("bill_no", paramLocDetl.getBillNo())
+//                                                                .eq("seq_no",paramLocDetl.getSeqNo()));
+//                    }
                 }
             }
         }
@@ -94,7 +105,7 @@
 
     @Override
     @Transactional
-    public void stockOut(String billNo,BasDevp staNo, LocDetlDto locDetlDtos, Integer ioType, Long userId) {
+    public void stockOut(String billNo, Integer seqNo, BasDevp staNo, LocDetlDto locDetlDtos, Integer ioType, Long userId) {
         // 鐢熸垚宸ヤ綔妗�
             LocDetl locDetl=locDetlDtos.getLocDetl();
             // 鑾峰彇搴撲綅
@@ -108,8 +119,14 @@
             if (Cools.isEmpty(staDesc)) {
                 throw new CoolException("鍑哄簱璺緞涓嶅瓨鍦�");
             }
+            int rok;
+            if(ioType==103){
+                rok=2;
+            }else{
+                rok=1;
+            }
             // 鐢熸垚宸ヤ綔鍙�
-            int workNo = commonService.getWorkNo(DEFAULT_WORK_NO_TYPE);
+            int workNo = commonService.getWorkNo(rok);
             // 鐢熸垚宸ヤ綔妗�
             WrkMast wrkMast = new WrkMast();
             wrkMast.setWrkNo(workNo);
@@ -144,10 +161,12 @@
                 wrkDetl.setAppeUser(userId);
                 wrkDetl.setModiTime(new Date());
                 wrkDetl.setBillNo(billNo);
+                wrkDetl.setSeqNo(seqNo);
                 wrkDetl.setModiUser(userId);
                 if (!wrkDetlService.insert(wrkDetl)) {
                     throw new CoolException("淇濆瓨宸ヤ綔妗f槑缁嗗け璐�");
                 }
+
             // 淇敼搴撲綅鐘舵��:   F.鍦ㄥ簱 ====>>> R.鍑哄簱棰勭害/P.鎷f枡/鐩樼偣/骞舵澘鍑哄簱涓�
             locMast = locMastService.selectById(locDetl.getLocNo());
             if (locMast.getLocSts().equals("F")) {

--
Gitblit v1.9.1