cy
2023-11-30 0c31534172f689160c95a4ff61df11712b6890fe
consum-base/src/main/java/com/consum/base/service/LWhFormOutputCoreService.java
@@ -14,6 +14,7 @@
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;
@@ -29,7 +30,7 @@
 **/
@Slf4j
@Service
@Transactional(rollbackFor = Exception.class)
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
public class LWhFormOutputCoreService {
    private BaseGoodsTemplateServiceImpl baseGoodsTemplateService;
@@ -71,7 +72,7 @@
     * @return 出库单Id
     */
    @Transactional(rollbackFor = Exception.class)
    public Long createOutFormByTransId(Long whFormTransferId, S_user_core currentUser, Long dealTime) {
    public Long createOutFormByTransId(Long whFormTransferId, WhBusinessEnum businessEnum, S_user_core currentUser, Long dealTime) {
        if (whFormTransferId == null) {
            return null;
        }
@@ -88,10 +89,11 @@
        }
        //申请调拨的物品
        List<LWhProcureModel> goodsModelNumList = lWhProcureModelService.getModelByForm(WhBusinessEnum.DIAOBO, whFormTransferId);
        List<LWhProcureModel> goodsModelNumList = lWhProcureModelService.getModelByForm(businessEnum, whFormTransferId);
        if (CollectionUtils.isEmpty(goodsModelNumList)) {
            log.error("没有要入库的物品");
            return null;
            throw new RuntimeException("没有要入库的物品");
//            return null;
        }
        Long outWarehouseId = lWhFormTransfer.getOutWarehouseId();
        String outWarehouseName = lWhFormTransfer.getOutWarehouseName();
@@ -189,18 +191,24 @@
        //采购方式(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)) {
            lWarehouseFlowBusinessId = lWhFormOutput.getTransBusinessId();
        } 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;
@@ -298,7 +306,9 @@
        lWhFormOutputService.update(lWhFormOutput);
        //当库存变动时调用该方法
        lWhWarningCoreService.updateKuCun(Convert.toShort(outWarehouseType, (short) 0), outWarehouseId, allChangModelList, null, dealTime);
        if (outWarehouseType == 0){
            lWhWarningCoreService.updateKuCun(Convert.toShort(outWarehouseType, (short) 0), outWarehouseId, allChangModelList, null, dealTime);
        }
        return lWarehouseFlowId;
    }