From 40609a1bd11ce79445562ac23f16af23a48c3933 Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期五, 18 八月 2023 14:34:28 +0800
Subject: [PATCH] Merge branch 'master' of http://139.186.142.91:10010/r/productDev/dmMes

---
 server/src/main/java/doumeemes/service/ext/impl/WorkorderRecordStandardServiceImpl.java |   21 +++++++++++++--------
 1 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/server/src/main/java/doumeemes/service/ext/impl/WorkorderRecordStandardServiceImpl.java b/server/src/main/java/doumeemes/service/ext/impl/WorkorderRecordStandardServiceImpl.java
index 1e0a085..78f12c7 100644
--- a/server/src/main/java/doumeemes/service/ext/impl/WorkorderRecordStandardServiceImpl.java
+++ b/server/src/main/java/doumeemes/service/ext/impl/WorkorderRecordStandardServiceImpl.java
@@ -705,8 +705,12 @@
             List<WOutbound> outboundList = new ArrayList<>();
             //濡傛灉闇�瑕佹姇鏂欑殑鐗╂枡闆嗗悎锛屽湪搴撳瓨涓鎵炬姇鏂欐潵婧�
             for(WStock model : materialList){
+                List<WStock> useList = allList.stream().filter(wStock -> Constants.equalsInteger(model.getMaterialId(),wStock.getMaterialId())).collect(Collectors.toList());
+                BigDecimal wStockNum = useList.stream().map(s -> s.getNum()).reduce(BigDecimal.ZERO, BigDecimal::add);
+                if(wStockNum.compareTo(Constants.formatBigdecimal(model.getNum()))<Constants.ZERO){
+                    throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "瀵逛笉璧凤紝鐢熶骇鐗╂枡涓嶈冻锛屾棤娉曡繘琛岃鎿嶄綔锛�");
+                }
                 for(WStock ts : allList){
-
                     if(Constants.equalsInteger(model.getMaterialId(),ts.getMaterialId())){
                         //杩橀渶瑕佹姇鏂欐暟閲�
                         BigDecimal actNum = Constants.formatBigdecimal(model.getNum()).subtract(Constants.formatBigdecimal(model.getTNum()));
@@ -830,13 +834,14 @@
             if (bomDetailList == null || bomDetailList.size() == 0) {
                 throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(), "瀵逛笉璧凤紝璇ョ敓浜х墿鏂欑殑bom閰嶇疆鏈夎锛岃鑱旂郴绠$悊鍛橈紒");
             }
-//            for (BomDetailExtListVO i :bomDetailList) {
-//                //鏌ヨ鏄惁鎶曟枡
-//                if(workorderRecordExtMapper.selectCount(new QueryWrapper<WorkorderRecord>()
-//                        .eq("DELETED",Constants.ZERO).eq("MATERIAL_ID",i.getMaterialId()).eq("TYPE",Constants.ZERO))<=0){
-//                    throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀛樺湪鏈姇鏂橞OM鐗╂枡锛屾棤娉曡繘琛屾姤宸�");
-//                }
-//            }
+            for (BomDetailExtListVO i :bomDetailList) {
+                //鏌ヨ鏄惁鎶曟枡
+                if(workorderRecordExtMapper.selectCount(new QueryWrapper<WorkorderRecord>()
+                                .eq("WORKORDER_ID",mp.getId())
+                        .eq("DELETED",Constants.ZERO).eq("MATERIAL_ID",i.getMaterialId()).eq("TYPE",Constants.ZERO))<=0){
+                    throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"瀛樺湪鏈姇鏂橞OM鐗╂枡锛屾棤娉曡繘琛屾姤宸�");
+                }
+            }
         }
 
         WOutbound outbound = new WOutbound();

--
Gitblit v1.9.3