cy
2023-11-14 f629df36eb51c492abb8694aef13142886ee2c7b
consum-base/src/main/java/com/consum/base/service/LWhFormOutputServiceImpl.java
@@ -2,28 +2,28 @@
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.utils.IdUtil;
import com.consum.base.core.utils.MapperUtil;
import com.consum.base.pojo.LWFormsOutputGoodsModelParam;
import com.consum.base.pojo.LWFormsOutputGoodsParam;
import com.consum.base.pojo.LWhFormOutputInsertParam;
import com.consum.base.pojo.query.LWhFormOutputQry;
import com.consum.model.po.BaseGoodsModels;
import com.consum.model.po.BaseWarehouse;
import com.consum.model.po.FinSysTenantUser;
import com.consum.model.po.LWhFormOutput;
import com.consum.model.po.LWhProcureModel;
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 lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * @Description 出库单
@@ -211,7 +211,7 @@
        }
        //3.根据出库单出库
        Long lWarehouseFlowId = this.lWhFormOutputCoreService.outFormByTransId(lWhFormOutputId, currentUser, param.getDealTime());
        Long lWarehouseFlowId = this.lWhFormOutputCoreService.outFormByTransId(lWhFormOutputId, WhBusinessEnum.CHUKU, currentUser, param.getDealTime());
        if (lWarehouseFlowId == null) {
            log.error("根据出库单出库失败");
            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
@@ -232,13 +232,13 @@
        //出库单号
        if (!StringUtils.isEmpty(param.getBusinessFormCode())) {
            sql.append(" and BUSINESS_FORM_CODE = :businessFormCode ");
            paramts.put("businessFormCode", StringUtils.CHAR_PERCENT + param.getBusinessFormCode() + StringUtils.CHAR_PERCENT);
            paramts.put("businessFormCode", param.getBusinessFormCode());
        }
        //物品名称
        if (!StringUtils.isEmpty(param.getGoodsTemplateName())) {
        if (!StringUtils.isEmpty(param.getGoodsName())) {
            sql.append(
                " AND id IN (SELECT BUSINESS_ID FROM L_WH_PROCURE_MODEL procureModel LEFT JOIN BASE_GOODS_MODELS baseModel ON procureModel.BASE_GOODS_MODELS_ID=baseModel.ID LEFT JOIN BASE_GOODS_TEMPLATE baseTemp ON baseModel.GOODS_TEMPLATES_ID=baseTemp.id WHERE procureModel.BUSINESS_TYPE=1 AND baseTemp.GOODS_NAME LIKE :goodsTemplateName)");
            paramts.put("goodsTemplateName", StringUtils.CHAR_PERCENT + param.getGoodsTemplateName() + StringUtils.CHAR_PERCENT);
                " AND id IN (SELECT BUSINESS_ID FROM L_WH_PROCURE_MODEL procureModel LEFT JOIN BASE_GOODS_MODELS baseModel ON procureModel.BASE_GOODS_MODELS_ID=baseModel.ID LEFT JOIN BASE_GOODS_TEMPLATE baseTemp ON baseModel.GOODS_TEMPLATES_ID=baseTemp.id WHERE procureModel.BUSINESS_TYPE=3 AND baseTemp.GOODS_NAME LIKE :goodsTemplateName)");
            paramts.put("goodsTemplateName", StringUtils.CHAR_PERCENT + param.getGoodsName() + StringUtils.CHAR_PERCENT);
        }
        //机构
        if (param.getAgencyId() != null) {
@@ -269,4 +269,52 @@
        GenericPager genericPager = selectSplit(sql.toString(), paramts, new LWhFormOutput());
        return genericPager;
    }
    public GenericPager<Map<String, Object>> queryFormOutputDetailList(LWhFormOutputQry param) {
        HashMap<String, Object> paramts = new HashMap<>();
        StringBuilder sql = new StringBuilder("SELECT pm.id,fp.BUSINESS_FORM_CODE,fpg.GOODS_TEMPLATE_NAME,pm.PRICE,pm.COUNTS, "
            + "( pm.PRICE * pm.COUNTS ) amount,fp.AGENCY_NAME,fp.BUYER_NAME,fp.PROCURE_TIME,pm.BUSINESS_ID,pm.BASE_GOODS_MODELS_NAME FROM l_wh_procure_model pm "
            + "LEFT JOIN l_wh_form_procure fp ON pm.BUSINESS_ID = fp.id "
            + "LEFT JOIN l_wh_form_procure_goods fpg ON fp.id = fpg.WH_FORM_PROCURE_ID WHERE pm.BUSINESS_TYPE = 1 ");
        //入库单号
        if (!StringUtils.isEmpty(param.getBusinessFormCode())) {
            sql.append("and BUSINESS_FORM_CODE = :businessFormCode ");
            paramts.put("businessFormCode", param.getBusinessFormCode());
        }
        //物品名称
        if (!StringUtils.isEmpty(param.getGoodsName())) {
            sql.append("and fpg.GOODS_TEMPLATE_NAME like :goodsTemplateName ");
            paramts.put("goodsTemplateName", StringUtils.CHAR_PERCENT + param.getGoodsName() + StringUtils.CHAR_PERCENT);
        }
        if (param.getAgencyId() != null) {
            sql.append("and AGENCY_ID like :agencyId ");
            paramts.put("agencyId", param.getAgencyId() + StringUtils.CHAR_PERCENT);
        }
        //创建人
        if (!StringUtils.isEmpty(param.getCreateName())) {
            sql.append("and buyer_Name =:buyerName ");
            paramts.put("buyerName", param.getCreateName());
        }
        //入库开始时间
        if (param.getStartTime() != null) {
            sql.append("and INCOME_TIME >=:incomeTimeStart ");
            paramts.put("incomeTimeStart", param.getStartTime() * 1000000);
        }
        //入库结束时间
        if (param.getEndTime() != null) {
            sql.append("and INCOME_TIME <:incomeTimeEnd ");
            paramts.put("incomeTimeEnd", param.getEndTime() * 1000000 + 240000);
        }
        //规格型号
        if (param.getBaseGoodsModelsId() != null) {
            sql.append("and pm.BASE_GOODS_MODELS_ID =:baseGoodsModelsId ");
            paramts.put("baseGoodsModelsId", param.getBaseGoodsModelsId());
        }
        sql.append("ORDER BY PROCURE_TIME DESC");
        GenericPager genericPager = selectSplit(sql.toString(), paramts, param.getPageNum(), param.getPageSize(), new MapperUtil());
        return genericPager;
    }
}