cy
2023-11-27 41dd97a3255d581d4013529730cedfb3f8f8e8ea
feat: 盘点
12个文件已修改
149 ■■■■■ 已修改文件
consum-base/src/main/java/com/consum/base/core/WarehouseCoreService.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
consum-base/src/main/java/com/consum/base/core/service/LWhWarningCoreServiceImpl.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
consum-base/src/main/java/com/consum/base/service/LWarehouseFlowCoreService.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
consum-base/src/main/java/com/consum/base/service/LWhFormInventoryCoreService.java 39 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
consum-base/src/main/java/com/consum/base/service/LWhFormInventoryGoodsServiceImpl.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
consum-base/src/main/java/com/consum/base/service/LWhFormInventoryServiceImpl.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
consum-base/src/main/java/com/consum/base/service/LWhFormOutputCoreService.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
consum-base/src/main/java/com/consum/base/service/LWhFormProcureCoreService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
consum-base/src/main/java/com/consum/base/service/LWhFormScrappedCoreService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
consum-base/src/main/java/com/consum/base/service/LWhFormScrappedServiceImpl.java 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
consum-base/src/main/java/com/consum/base/service/LWhFormTransferCoreService.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
consum-base/src/main/java/com/consum/base/service/LWhGoodsService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
consum-base/src/main/java/com/consum/base/core/WarehouseCoreService.java
@@ -1,14 +1,16 @@
package com.consum.base.core;
import com.consum.base.core.param.BaseWarehouseParam;
import com.consum.base.core.utils.SqlParameter;
import com.consum.base.core.utils.DateUtil;
import com.consum.base.core.utils.SqlParameter;
import com.consum.model.po.*;
import com.walker.infrastructure.utils.NumberGenerator;
import com.walker.jdbc.service.BaseServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import java.util.ArrayList;
@@ -20,6 +22,7 @@
 */
@Service
@Slf4j
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
public class WarehouseCoreService extends BaseServiceImpl {
    public static void main(String[] args) {
consum-base/src/main/java/com/consum/base/core/service/LWhWarningCoreServiceImpl.java
@@ -10,6 +10,8 @@
import com.walker.infrastructure.utils.NumberGenerator;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
@@ -26,6 +28,7 @@
 * @Version 1.0
 **/
@Service
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
public class LWhWarningCoreServiceImpl {
    @Resource
@@ -129,8 +132,7 @@
        StringBuilder sql = new StringBuilder(KU_CUN_NORMAL_MODEL);
        if (!org.springframework.util.CollectionUtils.isEmpty(normalBaseModelIdList)) {
            sql.append(" and BASE_GOODS_MODELS_ID in(?)");
            params.add(org.apache.commons.lang3.StringUtils.join(normalBaseModelIdList, ","));
            sql.append(" and BASE_GOODS_MODELS_ID in(").append( org.apache.commons.lang3.StringUtils.join(normalBaseModelIdList, ",")).append(")");
        }
        return lWhWarningService.update(sql.toString(), params.toArray());
    }
consum-base/src/main/java/com/consum/base/service/LWarehouseFlowCoreService.java
@@ -12,6 +12,8 @@
import org.springframework.jdbc.core.namedparam.SqlParameterSource;
import org.springframework.jdbc.core.simple.SimpleJdbcCall;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.PostConstruct;
import java.util.List;
@@ -26,6 +28,7 @@
 **/
@Service
@Slf4j
@Transactional(propagation = Propagation.REQUIRED)
public class LWarehouseFlowCoreService {
    private final JdbcTemplate jdbcTemplate;
@@ -78,8 +81,8 @@
        //采购方式(1:集采;2=自采)
        short buyType = lWhFormProcure.getBuyType().shortValue();
        //采购时间
        Long procureTime = lWhFormProcure.getProcureTime();
        Long procureTime2 = lWhFormProcure.getProcureTime();
        Long procureTime = procureTime2 == null ? dealTime : procureTime2;
        // 插入流水总表
        int flowInsertFlag = lWarehouseFlowService.insert(warehouseFlow);
        if (flowInsertFlag == 0) {
consum-base/src/main/java/com/consum/base/service/LWhFormInventoryCoreService.java
@@ -4,27 +4,22 @@
import com.consum.base.core.CodeGeneratorService;
import com.consum.base.core.WhBusinessEnum;
import com.consum.base.core.utils.IdUtil;
import com.consum.model.po.BaseWarehouse;
import com.consum.model.po.FinSysTenantUser;
import com.consum.model.po.LWhFormInventory;
import com.consum.model.po.LWhFormInventoryGoods;
import com.consum.model.po.LWhFormOutput;
import com.consum.model.po.LWhFormProcure;
import com.consum.model.po.LWhFormProcureGoods;
import com.consum.model.po.LWhProcureModel;
import com.consum.model.po.*;
import com.iplatform.model.po.S_user_core;
import com.walker.infrastructure.utils.NumberGenerator;
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 org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.util.CollectionUtils;
/**
 * @ClassName LWhFormInventoryCoreService
@@ -34,6 +29,7 @@
 **/
@Slf4j
@Service
@Transactional(propagation = Propagation.REQUIRED)
public class LWhFormInventoryCoreService {
    private LWhFormInventoryGoodsServiceImpl lWhFormInventoryGoods;
@@ -131,8 +127,8 @@
//                    rtnMap.put("errMsg", "创建入库单失败");
                    return "创建入库单失败";
                }
                Long inFormByInventoryId = (Long) inOutMap.get("inId");
                inOutMap.putAll(rkMap);
                Long inFormByInventoryId = (Long) inOutMap.get("inId");
                String errMsg = lWhFormProcureCoreService.doProcure(inFormByInventoryId, currentUser);
                if (errMsg != null) {
                    TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
@@ -156,7 +152,7 @@
                inOutMap.putAll(ckMap);
                Long lWhFormOutputId = (Long) inOutMap.get("outId");
                //2.根据出库单出库
                Long lWarehouseFlowId = lWhFormOutputCoreService.outFormByTransId(lWhFormOutputId, WhBusinessEnum.CAIGOU, currentUser, stopTime);
                Long lWarehouseFlowId = lWhFormOutputCoreService.outFormByTransId(lWhFormOutputId, WhBusinessEnum.PANDIAN, currentUser, stopTime);
                if (lWarehouseFlowId == null) {
                    TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
//                    throw new RuntimeException("创建出库单失败");
@@ -277,6 +273,7 @@
        //出入库id
        long lWhFormOutputId = IdUtil.generateId();
        lWhFormOutput.setId(lWhFormOutputId);
        lWhFormOutput.setOutWarehouseType(0);
        lWhFormOutput.setWarehouseId(warehouseId);
        //根据仓库id查询仓库
        BaseWarehouse warehouse = this.baseWarehouseService.getById(warehouseId);
@@ -301,6 +298,7 @@
        if (flag1 != 1) {
            return null;
        }
        ArrayList<LWhProcureModel> lWhProcureModels = new ArrayList<>();
        for (LWhFormInventoryGoods inventoryGoods : inventoryGoodsList) {
            Long baseGoodsModelsId = inventoryGoods.getBaseGoodsModelsId();
            Integer counts = inventoryGoods.getErrorCounts();
@@ -312,11 +310,16 @@
            //新增L_WH_PROCURE_MODEL记录
            LWhProcureModel lWhProcureModel = new LWhProcureModel();
            lWhProcureModel.setId(IdUtil.generateId());
            lWhProcureModel.setBusinessType(3);
            lWhProcureModel.setBusinessType(WhBusinessEnum.CHUKU.getValue() + 0);
            lWhProcureModel.setBusinessId(lWhFormOutputId);
            lWhProcureModel.setBaseGoodsModelsId(baseGoodsModelsId);
            lWhProcureModel.setCounts(counts);
            lWhProcureModel.setWorehouseCount(goodsNum);
            lWhProcureModelService.insert(lWhProcureModel);
//            lWhProcureModelService.insert(lWhProcureModel);
            lWhProcureModels.add(lWhProcureModel);
        }
        if (!CollectionUtils.isEmpty(lWhProcureModels)) {
            lWhProcureModelService.insertBatch(lWhProcureModels);
        }
        HashMap<String, Object> rtnMap = new HashMap<>();
        rtnMap.put("outId", lWhFormOutputId);
consum-base/src/main/java/com/consum/base/service/LWhFormInventoryGoodsServiceImpl.java
@@ -4,10 +4,13 @@
import com.consum.base.pojo.response.FormInventoryGoodsVO;
import com.consum.model.po.LWhFormInventoryGoods;
import com.walker.jdbc.service.BaseServiceImpl;
import java.util.ArrayList;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
/**
 * @Description 盘点单物品
@@ -16,6 +19,7 @@
 */
@Slf4j
@Service
@Transactional(propagation = Propagation.REQUIRED)
public class LWhFormInventoryGoodsServiceImpl extends BaseServiceImpl {
    /**
@@ -56,9 +60,9 @@
            Integer inventoryCount = inventoryGoods.getInventoryCount();
            Integer realNum = inventoryGoods.getRealNum();
            if (realNum != null) {
                int errorCount = inventoryCount - realNum;
                int errorCount = realNum - inventoryCount ;
                lWhFormInventoryGoods.setInventoryCounts(realNum);
                lWhFormInventoryGoods.setErrorCounts(errorCount);
                lWhFormInventoryGoods.setErrorCounts(Math.abs(errorCount));
                //盘点结果(1=正常;2=盘盈;3=盘亏)
                lWhFormInventoryGoods.setInventoryResult((errorCount > 0) ? 2 : (errorCount < 0) ? 3 : 1);
                goodsList.add(lWhFormInventoryGoods);
consum-base/src/main/java/com/consum/base/service/LWhFormInventoryServiceImpl.java
@@ -21,9 +21,6 @@
import com.walker.infrastructure.utils.DateUtils;
import com.walker.infrastructure.utils.StringUtils;
import com.walker.jdbc.service.BaseServiceImpl;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.compress.utils.Lists;
import org.springframework.beans.BeanUtils;
@@ -32,6 +29,10 @@
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * @Description 盘点
 * @Author 卢庆阳
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;
@@ -189,21 +190,26 @@
        //采购方式(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;
        }
        Integer queryModelStatus = queryModelStatusT;
        Integer buyType = buyTypeT;
consum-base/src/main/java/com/consum/base/service/LWhFormProcureCoreService.java
@@ -10,6 +10,7 @@
import com.walker.infrastructure.utils.NumberGenerator;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
@@ -24,6 +25,7 @@
 **/
@Service
@Slf4j
@Transactional(propagation= Propagation.REQUIRED)
public class LWhFormProcureCoreService {
    @Resource
    private LWhProcureModelService lWhProcureModelService;
consum-base/src/main/java/com/consum/base/service/LWhFormScrappedCoreService.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;
@@ -30,6 +31,7 @@
 **/
@Service
@Slf4j
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
public class LWhFormScrappedCoreService {
    private GoodsBaseServiceImpl goodsBaseService;
consum-base/src/main/java/com/consum/base/service/LWhFormScrappedServiceImpl.java
@@ -14,29 +14,23 @@
import com.consum.base.pojo.response.FormScrappedGoodsVO;
import com.consum.base.pojo.response.GoodsModelVO;
import com.consum.base.pojo.response.LWhFormScrappedExtendVO;
import com.consum.model.po.BaseGoodsModels;
import com.consum.model.po.BaseGoodsTemplate;
import com.consum.model.po.BaseWarehouse;
import com.consum.model.po.FinSysTenantDepartment;
import com.consum.model.po.FinSysTenantUser;
import com.consum.model.po.LWhFormScrapped;
import com.consum.model.po.LWhFormScrappedGoods;
import com.consum.model.po.SDictData;
import com.consum.model.po.*;
import com.iplatform.model.po.S_user_core;
import com.walker.db.page.GenericPager;
import com.walker.infrastructure.utils.StringUtils;
import com.walker.jdbc.service.BaseServiceImpl;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.apache.commons.compress.utils.Lists;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
 * @Description 报废单
@@ -80,23 +74,39 @@
     * @return 1.新增报废单  2.新增报废单物品
     */
    public int add(LWhFormScrappedParam param, S_user_core currentUser, FinSysTenantUser sysInfo) {
    public int add(LWhFormScrappedParam param, int warehouseType, S_user_core currentUser, FinSysTenantUser sysInfo) {
        //1.新增报废单记录
        LWhFormScrapped lWhFormScrapped = new LWhFormScrapped();
        //报废单id
        long lWhFormScrappedId = IdUtil.generateId();
        lWhFormScrapped.setId(lWhFormScrappedId);
        lWhFormScrapped.setBusinessFormCode(codeGeneratorService.createBusinessFormCode(CodeGeneratorEnum.Scrapped));
        lWhFormScrapped.setWarehouseType(0);
        Long warehouseId = param.getWarehouseId();
        lWhFormScrapped.setWarehouseId(warehouseId);
        lWhFormScrapped.setWarehouseType(warehouseType);
        // 公用
        Long warehouseId = null;
        //仓库名称
        String wareHouseName = null;
        if (warehouseType == 0){
            warehouseId = param.getWarehouseId();
        //根据仓库id查询仓库
        BaseWarehouse warehouse = this.baseWarehouseService.getById(warehouseId);
        if (warehouse == null) {
            log.error("仓库不存在");
            return 0;
        }
        lWhFormScrapped.setWarehouseName(warehouse.getWarehouseName());
            wareHouseName = warehouse.getWarehouseName();
        } else {
            // 查询部门名称
            warehouseId = param.getDepartmentId();
            FinSysTenantDepartment sysTenantDepartment = departmentService.getById(warehouseId);
            if (sysTenantDepartment == null) {
                log.error("部门不存在");
                return 0;
            }
            wareHouseName = sysTenantDepartment.getName();
        }
        lWhFormScrapped.setWarehouseId(warehouseId);
        lWhFormScrapped.setWarehouseName(wareHouseName);
        lWhFormScrapped.setAgencyId(Long.valueOf(sysInfo.getTenantId()));
        lWhFormScrapped.setAgencyName(sysInfo.getTenantName());
        lWhFormScrapped.setOperatorId(sysInfo.getSysUserId());
@@ -147,7 +157,7 @@
                LWhFormScrappedGoods scrappedGoods = new LWhFormScrappedGoods();
                scrappedGoods.setId(IdUtil.generateId());
                //根据物品型号查询物品库存
                int goodsNum = this.lWhGoodsService.queryGoodsModelNum(0, warehouseId, scrappedGoods.getBaseGoodsModelsId(), 1, null);
                int goodsNum = this.lWhGoodsService.queryGoodsModelNum(warehouseType, warehouseId, scrappedGoods.getBaseGoodsModelsId(), 1, null);
                if (params.getCounts() > goodsNum) {
                    log.error("报废数量大于库存数量");
                    return 0;
consum-base/src/main/java/com/consum/base/service/LWhFormTransferCoreService.java
@@ -11,6 +11,7 @@
import com.walker.infrastructure.utils.NumberGenerator;
import lombok.extern.slf4j.Slf4j;
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 @@
 **/
@Service
@Slf4j
@Transactional(rollbackFor = Exception.class)
@Transactional(rollbackFor = Exception.class, propagation = Propagation.REQUIRED)
public class LWhFormTransferCoreService {
    @Resource
consum-base/src/main/java/com/consum/base/service/LWhGoodsService.java
@@ -240,7 +240,7 @@
    public int modGoodsTransfering(List<Long> whGoods, Integer warehouseType, Long toWarehouseId, String toWarehouseName, Integer states) {
        StringBuilder sql = new StringBuilder(MOD_GOODS_TRANSFERING_PREFIX);
        ArrayList<Object> params = new ArrayList<>();
        if (toWarehouseId != null) {
        if (warehouseType != null) {
            sql.append(", WAREHOUSE_TYPE=?");
            params.add(warehouseType);
        }