From 89495b208235d2e30244ce9485c75ac2f1690c79 Mon Sep 17 00:00:00 2001
From: futian.liu <liufutianyoo@163.com>
Date: 星期二, 28 十一月 2023 20:48:08 +0800
Subject: [PATCH] 部门分发

---
 consum-base/src/main/java/com/consum/base/service/LWhFormOutputCoreService.java |   53 +++++++++++++++++++++++++++++++++--------------------
 1 files changed, 33 insertions(+), 20 deletions(-)

diff --git a/consum-base/src/main/java/com/consum/base/service/LWhFormOutputCoreService.java b/consum-base/src/main/java/com/consum/base/service/LWhFormOutputCoreService.java
index c74b9a0..dd3ce96 100644
--- a/consum-base/src/main/java/com/consum/base/service/LWhFormOutputCoreService.java
+++ b/consum-base/src/main/java/com/consum/base/service/LWhFormOutputCoreService.java
@@ -1,25 +1,26 @@
 package com.consum.base.service;
 
+import cn.hutool.core.convert.Convert;
 import com.consum.base.core.CodeGeneratorEnum;
 import com.consum.base.core.CodeGeneratorService;
 import com.consum.base.core.WhBusinessEnum;
 import com.consum.base.core.param.BaseWarehouseParam1;
+import com.consum.base.core.service.LWhWarningCoreServiceImpl;
 import com.consum.base.core.utils.LockManage;
-import com.consum.model.po.LWarehouseFlow;
-import com.consum.model.po.LWhFormOutput;
-import com.consum.model.po.LWhFormTransfer;
-import com.consum.model.po.LWhGoodsRecord;
-import com.consum.model.po.LWhProcureModel;
+import com.consum.model.po.*;
 import com.iplatform.model.po.S_user_core;
 import com.walker.infrastructure.utils.CollectionUtils;
 import com.walker.infrastructure.utils.NumberGenerator;
-import java.util.List;
-import java.util.Map;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Propagation;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.interceptor.TransactionAspectSupport;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
 
 /**
  * @ClassName WhFormOutputCoreService
@@ -29,7 +30,7 @@
  **/
 @Slf4j
 @Service
-@Transactional(rollbackFor = Exception.class)
+@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
 public class LWhFormOutputCoreService {
 
     private BaseGoodsTemplateServiceImpl baseGoodsTemplateService;
@@ -37,19 +38,21 @@
     private CodeGeneratorService codeGeneratorService;
     private LWhProcureModelService lWhProcureModelService;
     private LWhFormOutputService lWhFormOutputService;
+    private LWhWarningCoreServiceImpl lWhWarningCoreService;
     private LWarehouseFlowService lWarehouseFlowService;
     private LWhGoodsRecordDetailsService lWhGoodsRecordDetailsService;
     private LWhGoodsRecordService lWhGoodsRecordService;
 
     @Autowired
     public LWhFormOutputCoreService(BaseGoodsTemplateServiceImpl baseGoodsTemplateService,
-        LWhGoodsService lWhGoodsService,
-        CodeGeneratorService codeGeneratorService,
-        LWhProcureModelService lWhProcureModelService,
-        LWhFormOutputService lWhFormOutputService,
-        LWarehouseFlowService lWarehouseFlowService,
-        LWhGoodsRecordDetailsService lWhGoodsRecordDetailsService,
-        LWhGoodsRecordService lWhGoodsRecordService) {
+                                    LWhGoodsService lWhGoodsService,
+                                    CodeGeneratorService codeGeneratorService,
+                                    LWhProcureModelService lWhProcureModelService,
+                                    LWhFormOutputService lWhFormOutputService,
+                                    LWarehouseFlowService lWarehouseFlowService,
+                                    LWhGoodsRecordDetailsService lWhGoodsRecordDetailsService,
+                                    LWhGoodsRecordService lWhGoodsRecordService,
+                                    LWhWarningCoreServiceImpl lWhWarningCoreService) {
         this.baseGoodsTemplateService = baseGoodsTemplateService;
         this.lWhGoodsService = lWhGoodsService;
         this.codeGeneratorService = codeGeneratorService;
@@ -58,6 +61,7 @@
         this.lWarehouseFlowService = lWarehouseFlowService;
         this.lWhGoodsRecordDetailsService = lWhGoodsRecordDetailsService;
         this.lWhGoodsRecordService = lWhGoodsRecordService;
+        this.lWhWarningCoreService = lWhWarningCoreService;
     }
 
 
@@ -186,18 +190,23 @@
         //閲囪喘鏂瑰紡锛�1锛氶泦閲囷紱2=鑷噰锛�
         Integer buyTypeT = null;
         Integer modGoodsTransferingStatusT = null;
-        String outputCode = lWhFormOutput.getOutputCode();
-        if ((BaseWarehouseParam1.In_OutPutTypeEnum.Transfer_Output.getValue() + "").equals(outputCode)) {
+        short businessTypeValue = businessType.getValue();
+        if (BaseWarehouseParam1.In_OutPutTypeEnum.Transfer_Output.getValue()  == businessTypeValue) {
             //璋冩嫧鍑哄簱
             queryModelStatusT = 1;
             buyTypeT = 1;
             lWarehouseFlowBusinessId = lWhFormOutput.getTransBusinessId();
             modGoodsTransferingStatusT = 0;
-        } else if ((BaseWarehouseParam1.In_OutPutTypeEnum.Dept_Lending_Out.getValue() + "").equals(outputCode)) {
+        } else if (BaseWarehouseParam1.In_OutPutTypeEnum.Dept_Lending_Out.getValue()  == businessTypeValue) {
             //  閮ㄩ棬浠撳簱 鍒嗗彂鍑哄簱
 //            queryModelStatusT = 2;
-        } else if ((BaseWarehouseParam1.In_OutPutTypeEnum.Fragmentary_Output.getValue() + "").equals(outputCode)) {
+        } else if (BaseWarehouseParam1.In_OutPutTypeEnum.Fragmentary_Output.getValue()  == businessTypeValue) {
             //  闆舵槦鍑哄簱
+            queryModelStatusT = 1;
+            buyTypeT = null;
+            modGoodsTransferingStatusT = 4;
+        }else if (BaseWarehouseParam1.In_OutPutTypeEnum.Inventory_Output.getValue()  == businessTypeValue) {
+            //  鐩樼偣鍑哄簱
             queryModelStatusT = 1;
             buyTypeT = null;
             modGoodsTransferingStatusT = 4;
@@ -206,9 +215,11 @@
         Integer buyType = buyTypeT;
         Integer modGoodsTransferingStatus = modGoodsTransferingStatusT;
 
+        ArrayList<Long> allChangModelList = new ArrayList<>();
         goodsModelNumList.forEach(itemModelInfo -> {
             // 闇�瑕佽皟鎷ㄧ殑鐗╁搧鐨勬煇涓瀷鍙�
             Long baseGoodsModelsId = itemModelInfo.getBaseGoodsModelsId();
+            allChangModelList.add(baseGoodsModelsId);
             // 闇�瑕佽皟鎷ㄧ殑鐗╁搧鏌愪釜鍨嬪彿鐨勬暟閲�
             Integer counts = itemModelInfo.getCounts();
 
@@ -258,7 +269,7 @@
 
                 //鍑哄簱鏃跺�欙紝鎸� 鍏堝叆搴撶殑鍏堝嚭搴擄紝鍚屾椂鍏ュ簱鐨勶紝鎸変环鏍奸珮鐨勫厛鍑哄簱
                 outGoodsId = lWhGoodsService.queryOutGoodsId(outWarehouseType, outWarehouseId, baseGoodsModelsId, queryModelStatus, buyType,
-                    counts);
+                        counts);
                 lWhGoodsService.modGoodsTransfering(outGoodsId, inWarehouseType, inWarehouseId, inWarehouseName, modGoodsTransferingStatus);
                 // 鎵归噺鎻掑叆 杩涘嚭搴撴祦姘存槑缁哰L_WH_GOODS_RECORD_DETAILS]
                 lWhGoodsRecordDetailsService.sameGoodsInsertMore(outGoodsId, whGoodsRecordId, (short) 0);
@@ -292,6 +303,8 @@
         lWhFormOutput.setWarehouseFlowId(lWarehouseFlowId);
         lWhFormOutputService.update(lWhFormOutput);
 
+        //褰撳簱瀛樺彉鍔ㄦ椂璋冪敤璇ユ柟娉�
+        lWhWarningCoreService.updateKuCun(Convert.toShort(outWarehouseType, (short) 0), outWarehouseId, allChangModelList, null, dealTime);
         return lWarehouseFlowId;
     }
 

--
Gitblit v1.9.1