This commit is contained in:
磷叶 2024-11-20 18:18:52 +08:00
parent 92ce39f236
commit b6b7fd653a
21 changed files with 242 additions and 18 deletions

View File

@ -23,5 +23,7 @@ public class K3ProdField {
public static final String F_BASE_UNIT_QTY = "FBaseUnitQty"; // 明细.基本单位数量
public static final String F_QTY = "FQty"; // 明细.数量
public static final String F_UNIT_ID = "FUnitId"; // 明细.单位
public static final String F_BASE_UNIT_ID = "FBaseUnitId"; // 明细.基本单位
public static final String F_NO_STOCK_IN_QTY = "FNoStockInQty"; // 明细.未入库数量
public static final String F_BASE_NO_STOCK_IN_QTY = "FBaseNoStockInQty"; // 明细.基本单位未入库数量
}

View File

@ -110,4 +110,15 @@ public class ProdOrder extends BaseEntity
@ApiModelProperty("ERP未入库数量")
private BigDecimal erpNoStockInQty;
@Excel(name = "ERP基本单位未入库数量")
@ApiModelProperty("ERP基本单位未入库数量")
private BigDecimal erpBaseNoStockInQty;
@Excel(name = "已审核通过的基础数量")
@ApiModelProperty("已审核通过的基础数量")
private BigDecimal verifiedBaseNum;
@Excel(name = "ERP明细基本单位ID")
@ApiModelProperty("ERP明细基本单位ID")
private String erpBaseUnitId;
}

View File

@ -24,5 +24,7 @@ public class ProdOrderQuery extends ProdOrderVO {
@ApiModelProperty("订单ID列表")
private List<Long> ids;
@ApiModelProperty("ERP业务状态列表")
private List<String> erpStatusList;
}

View File

@ -21,10 +21,10 @@ public class ProdOrderVO extends ProdOrder {
@ApiModelProperty("单位名称")
private String unitName;
@ApiModelProperty("基本单位名称")
private String baseUnitName;
@ApiModelProperty("部门ID")
private Long deptId;
@ApiModelProperty("ERP业务状态列表")
private List<String> erpStatusList;
}

View File

@ -32,14 +32,19 @@
bpo.erp_material_id,
bpo.match_prices,
bpo.erp_no_stock_in_qty,
bpo.erp_base_no_stock_in_qty,
bpo.verified_base_num,
bpo.erp_base_unit_id,
bm.erp_number as material_number,
sd.dept_name as work_shop_name,
sd.dept_id as dept_id,
bu.erp_name as unit_name
bu.erp_name as unit_name,
bu_b.erp_name as base_unit_name
from bst_prod_order bpo
left join sys_dept sd on sd.erp_id = bpo.erp_work_shop_id
left join bst_material bm on bm.erp_id = bpo.erp_material_id
left join bst_unit bu on bu.erp_id = bpo.erp_unit_id
left join bst_unit bu_b on bu_b.erp_id = bpo.erp_base_unit_id
</sql>
<sql id="searchCondition">
@ -59,6 +64,7 @@
<if test="query.erpReqSrc != null and query.erpReqSrc != ''"> and bpo.erp_req_src = #{query.erpReqSrc}</if>
<if test="query.deptId != null "> and sd.dept_id = #{query.deptId}</if>
<if test="query.erpMaterialId != null and query.erpMaterialId != ''"> and bpo.erp_material_id = #{query.erpMaterialId}</if>
<if test="query.erpBaseUnitId != null and query.erpBaseUnitId != ''"> and erp_base_unit_id = #{query.erpBaseUnitId}</if>
<if test="query.erpStatusList != null and query.erpStatusList.size() > 0">
and bpo.erp_status in
<foreach collection="query.erpStatusList" item="item" open="(" close=")" separator=",">
@ -110,6 +116,9 @@
<if test="erpMaterialId != null">erp_material_id,</if>
<if test="matchPrices != null">match_prices,</if>
<if test="erpNoStockInQty != null">erp_no_stock_in_qty,</if>
<if test="erpBaseNoStockInQty != null">erp_base_no_stock_in_qty,</if>
<if test="verifiedBaseNum != null">verified_base_num,</if>
<if test="erpBaseUnitId != null">erp_base_unit_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="erpId != null and erpId != ''">#{erpId},</if>
@ -133,6 +142,9 @@
<if test="erpMaterialId != null">#{erpMaterialId},</if>
<if test="matchPrices != null">#{matchPrices,typeHandler=com.ruoyi.common.mybatis.typehandler.StringSplitListTypeHandler},</if>
<if test="erpNoStockInQty != null">#{erpNoStockInQty},</if>
<if test="erpBaseNoStockInQty != null">#{erpBaseNoStockInQty},</if>
<if test="verifiedBaseNum != null">#{verifiedBaseNum},</if>
<if test="erpBaseUnitId != null">#{erpBaseUnitId},</if>
</trim>
</insert>
@ -166,6 +178,9 @@
<if test="data.erpMaterialId != null">erp_material_id = #{data.erpMaterialId},</if>
<if test="data.matchPrices != null">match_prices = #{data.matchPrices,typeHandler=com.ruoyi.common.mybatis.typehandler.StringSplitListTypeHandler},</if>
<if test="data.erpNoStockInQty != null">erp_no_stock_in_qty = #{data.erpNoStockInQty},</if>
<if test="data.erpBaseNoStockInQty != null">erp_base_no_stock_in_qty = #{data.erpBaseNoStockInQty},</if>
<if test="data.verifiedBaseNum != null">verified_base_num = #{data.verifiedBaseNum},</if>
<if test="data.erpBaseUnitId != null">erp_base_unit_id = #{data.erpBaseUnitId},</if>
</sql>
<delete id="deleteProdOrderById" parameterType="Long">

View File

@ -95,12 +95,18 @@ public class ProdOrderConverterImpl implements ProdOrderConverter {
case K3ProdField.F_UNIT_ID:
po.setErpUnitId(row.getString(i));
break;
case K3ProdField.F_BASE_UNIT_ID:
po.setErpBaseUnitId(row.getString(i));
break;
case K3ProdField.F_MATERIAL_ID:
po.setErpMaterialId(row.getString(i));
break;
case K3ProdField.F_NO_STOCK_IN_QTY:
po.setErpNoStockInQty(row.getBigDecimal(i));
break;
case K3ProdField.F_BASE_NO_STOCK_IN_QTY:
po.setErpBaseNoStockInQty(row.getBigDecimal(i));
break;
default: break;
}
}

View File

@ -148,8 +148,10 @@ public class ProdOrderServiceImpl implements ProdOrderService
K3ProdField.F_BASE_UNIT_QTY,
K3ProdField.F_QTY,
K3ProdField.F_UNIT_ID,
K3ProdField.F_BASE_UNIT_ID,
K3ProdField.F_MATERIAL_ID,
K3ProdField.F_NO_STOCK_IN_QTY
K3ProdField.F_NO_STOCK_IN_QTY,
K3ProdField.F_BASE_NO_STOCK_IN_QTY
);
int startRow = 0;
int limit = 10000;

View File

@ -3,7 +3,10 @@ package com.ruoyi.web.yh.report.domain;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
/**
@ -17,4 +20,8 @@ public class ReportQuery extends ReportVO {
@ApiModelProperty("状态列表")
private List<String> statusList;
@ApiModelProperty("报表日期范围")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private List<LocalDate> reportDateRange;
}

View File

@ -49,6 +49,9 @@
#{item}
</foreach>
</if>
<if test="query.reportDateRange != null and query.reportDateRange.size() > 1">
and date(br.report_date) >= date(#{query.reportDateRange[0]}) and date(br.report_date) &lt;= date(#{query.reportDateRange[1]})
</if>
${query.params.dataScope}
</sql>

View File

@ -18,7 +18,7 @@ import com.ruoyi.web.yh.report.service.ReportValidator;
import com.ruoyi.web.yh.reportOrderProd.domain.ReportOrderProd;
import com.ruoyi.web.yh.reportOrderProd.domain.ReportOrderProdVO;
import com.ruoyi.web.yh.reportOrderProd.domain.bo.ReportOrderProdBO;
import com.ruoyi.web.yh.reportOrderProd.service.IReportOrderProdService;
import com.ruoyi.web.yh.reportOrderProd.service.ReportOrderProdService;
import com.ruoyi.web.yh.reportProd.domain.ReportProd;
import com.ruoyi.web.yh.reportProd.domain.ReportProdVO;
import com.ruoyi.web.yh.reportProd.domain.bo.ReportProdBO;
@ -58,7 +58,7 @@ public class ReportServiceImpl implements ReportService
private ReportUserProdService reportUserProdService;
@Autowired
private IReportOrderProdService reportOrderProdService;
private ReportOrderProdService reportOrderProdService;
@Autowired
private ISysUserService userService;

View File

@ -2,6 +2,8 @@ package com.ruoyi.web.yh.reportOrderProd.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.web.yh.reportOrderProd.service.ReportOrderProdAssembler;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@ -19,7 +21,7 @@ import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.web.yh.reportOrderProd.domain.ReportOrderProd;
import com.ruoyi.web.yh.reportOrderProd.domain.ReportOrderProdVO;
import com.ruoyi.web.yh.reportOrderProd.domain.ReportOrderProdQuery;
import com.ruoyi.web.yh.reportOrderProd.service.IReportOrderProdService;
import com.ruoyi.web.yh.reportOrderProd.service.ReportOrderProdService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
@ -34,7 +36,10 @@ import com.ruoyi.common.core.page.TableDataInfo;
public class ReportOrderProdController extends BaseController
{
@Autowired
private IReportOrderProdService reportOrderProdService;
private ReportOrderProdService reportOrderProdService;
@Autowired
private ReportOrderProdAssembler reportOrderProdAssembler;
/**
* 查询订单产量列表
@ -46,6 +51,7 @@ public class ReportOrderProdController extends BaseController
startPage();
startOrderBy();
List<ReportOrderProdVO> list = reportOrderProdService.selectReportOrderProdList(query);
reportOrderProdAssembler.assembleVerifyingBaseNum(list);
return getDataTable(list);
}

View File

@ -15,4 +15,10 @@ public class ReportOrderProdQuery extends ReportOrderProdVO {
@ApiModelProperty("报表产量ID列表")
private List<Long> reportProdIds;
@ApiModelProperty("生产订单ID列表")
private List<Long> orderIds;
@ApiModelProperty("报表状态")
private String reportStatus;
}

View File

@ -21,7 +21,25 @@ public class ReportOrderProdVO extends ReportOrderProd {
@ApiModelProperty("订单数量")
private BigDecimal orderErpQty;
@ApiModelProperty("订单基础数量")
private BigDecimal orderErpBaseUnitQty;
@ApiModelProperty("订单未入库数量")
private BigDecimal orderErpNoStockInQty;
@ApiModelProperty("订单单位名称")
private String unitName;
@ApiModelProperty("订单基础单位名称")
private String baseUnitName;
@ApiModelProperty("订单基础未入库数量")
private BigDecimal orderErpBaseNoStockInQty;
@ApiModelProperty("订单审核中的基础产量")
private BigDecimal verifyingBaseNum;
@ApiModelProperty("订单已审核通过的基础产量")
private BigDecimal verifiedBaseNum;
}

View File

@ -0,0 +1,24 @@
package com.ruoyi.web.yh.reportOrderProd.domain.vo;
import lombok.Data;
import java.math.BigDecimal;
/**
* @author wjh
* 2024/11/19
*/
@Data
public class ReportOrderProdSumOfBaseNumGroupByOrderIdVO {
/**
* 订单ID
*/
private Long orderId;
/**
* 基础产量总和
*/
private BigDecimal sum;
}

View File

@ -4,6 +4,7 @@ import java.util.List;
import com.ruoyi.web.yh.reportOrderProd.domain.ReportOrderProd;
import com.ruoyi.web.yh.reportOrderProd.domain.ReportOrderProdVO;
import com.ruoyi.web.yh.reportOrderProd.domain.ReportOrderProdQuery;
import com.ruoyi.web.yh.reportOrderProd.domain.vo.ReportOrderProdSumOfBaseNumGroupByOrderIdVO;
import org.apache.ibatis.annotations.Param;
/**
@ -76,4 +77,9 @@ public interface ReportOrderProdMapper
* 批量逻辑删除
*/
int batchLogicDel(@Param("ids") List<Long> ids);
/**
* 查询订单基础产量合计
*/
List<ReportOrderProdSumOfBaseNumGroupByOrderIdVO> selectSumOfBaseNumGroupByOrderId(@Param("query") ReportOrderProdQuery query);
}

View File

@ -16,10 +16,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
brp.report_id as report_id,
bpo.erp_bill_no as order_erp_bill_no,
bpo.erp_qty as order_erp_qty,
bpo.erp_no_stock_in_qty as order_erp_no_stock_in_qty
bpo.erp_no_stock_in_qty as order_erp_no_stock_in_qty,
bpo.erp_base_unit_qty as order_erp_base_unit_qty,
bpo.erp_base_no_stock_in_qty as order_erp_base_no_stock_in_qty,
bpo.verified_base_num as verified_base_num,
bu.erp_name as unit_name,
bu_b.erp_name as base_unit_name
from bst_report_order_prod brop
left join bst_report_prod brp on brp.id = brop.report_prod_id
left join bst_report br on br.report_id = brp.report_id
left join bst_prod_order bpo on bpo.id = brop.order_id
left join bst_unit bu on bu.erp_id = bpo.erp_unit_id
left join bst_unit bu_b on bu_b.erp_id = bpo.erp_base_unit_id
</sql>
<sql id="searchCondition">
@ -29,12 +37,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="query.reportId != null "> and brp.report_id = #{query.reportId}</if>
<if test="query.deleted == null "> and brop.deleted = false</if>
<if test="query.deleted != null "> and brop.deleted = #{query.deleted}</if>
<if test="query.reportStatus != null "> and br.status = #{query.reportStatus}</if>
<if test="query.reportProdIds != null and query.reportProdIds.size() > 0">
and brop.report_prod_id in
<foreach collection="query.reportProdIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="query.orderIds != null and query.orderIds.size() > 0">
and brop.order_id in
<foreach collection="query.orderIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
${query.params.dataScope}
</sql>
@ -50,6 +65,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where brop.id = #{id}
</select>
<resultMap id="ReportOrderProdSumOfBaseNumGroupByOrderIdVO" type="ReportOrderProdSumOfBaseNumGroupByOrderIdVO" autoMapping="true">
<result property="sum" column="sum" typeHandler="com.ruoyi.common.mybatis.typehandler.NonNullDecimalTypeHandler"/>
</resultMap>
<select id="selectSumOfBaseNumGroupByOrderId" resultMap="ReportOrderProdSumOfBaseNumGroupByOrderIdVO">
select
sum(brop.num * if(brp.price_quantity is null, 1, brp.price_quantity)) as `sum`,
order_id
from bst_report_order_prod brop
left join bst_report_prod brp on brp.id = brop.report_prod_id
left join bst_report br on br.report_id = brp.report_id
<where>
<include refid="searchCondition"/>
</where>
group by order_id
</select>
<insert id="insertReportOrderProd" parameterType="ReportOrderProd" useGeneratedKeys="true" keyProperty="id">
insert into bst_report_order_prod
<trim prefix="(" suffix=")" suffixOverrides=",">

View File

@ -0,0 +1,16 @@
package com.ruoyi.web.yh.reportOrderProd.service;
import com.ruoyi.web.yh.reportOrderProd.domain.ReportOrderProdVO;
import java.util.List;
/**
* @author wjh
* 2024/11/19
*/
public interface ReportOrderProdAssembler {
/**
* 拼接审核中的基础产量
*/
void assembleVerifyingBaseNum(List<ReportOrderProdVO> list);
}

View File

@ -4,7 +4,7 @@ import java.util.List;
import com.ruoyi.web.yh.reportOrderProd.domain.ReportOrderProd;
import com.ruoyi.web.yh.reportOrderProd.domain.ReportOrderProdVO;
import com.ruoyi.web.yh.reportOrderProd.domain.ReportOrderProdQuery;
import com.ruoyi.web.yh.reportOrderProd.domain.bo.ReportOrderProdBO;
import com.ruoyi.web.yh.reportOrderProd.domain.vo.ReportOrderProdSumOfBaseNumGroupByOrderIdVO;
/**
* 订单产量Service接口
@ -12,7 +12,7 @@ import com.ruoyi.web.yh.reportOrderProd.domain.bo.ReportOrderProdBO;
* @author ruoyi
* @date 2024-11-19
*/
public interface IReportOrderProdService
public interface ReportOrderProdService
{
/**
* 查询订单产量
@ -78,4 +78,9 @@ public interface IReportOrderProdService
int batchUpdate(List<? extends ReportOrderProd> list);
int batchLogicDel(List<? extends ReportOrderProd> list);
/**
* 查询订单基础产量合计
*/
List<ReportOrderProdSumOfBaseNumGroupByOrderIdVO> selectSumOfBaseNumGroupByOrderId(ReportOrderProdQuery query);
}

View File

@ -0,0 +1,49 @@
package com.ruoyi.web.yh.reportOrderProd.service.impl;
import com.ruoyi.common.utils.collection.CollectionUtils;
import com.ruoyi.web.yh.report.domain.enums.ReportStatus;
import com.ruoyi.web.yh.reportOrderProd.domain.ReportOrderProdQuery;
import com.ruoyi.web.yh.reportOrderProd.domain.ReportOrderProdVO;
import com.ruoyi.web.yh.reportOrderProd.domain.vo.ReportOrderProdSumOfBaseNumGroupByOrderIdVO;
import com.ruoyi.web.yh.reportOrderProd.service.ReportOrderProdAssembler;
import com.ruoyi.web.yh.reportOrderProd.service.ReportOrderProdService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.List;
/**
* @author wjh
* 2024/11/19
*/
@Service
public class ReportOrderProdAssemblerImpl implements ReportOrderProdAssembler {
@Autowired
private ReportOrderProdService reportOrderProdService;
@Override
public void assembleVerifyingBaseNum(List<ReportOrderProdVO> list) {
if (CollectionUtils.isEmptyElement(list)) {
return;
}
ReportOrderProdQuery query = new ReportOrderProdQuery();
query.setOrderIds(CollectionUtils.map(list, ReportOrderProdVO::getOrderId));
query.setReportStatus(ReportStatus.WAIT_VERIFY.getStatus());
List<ReportOrderProdSumOfBaseNumGroupByOrderIdVO> sumList = reportOrderProdService.selectSumOfBaseNumGroupByOrderId(query);
for (ReportOrderProdVO orderProd : list) {
ReportOrderProdSumOfBaseNumGroupByOrderIdVO sum = sumList.stream()
.filter(item -> item.getOrderId().equals(orderProd.getOrderId()))
.findFirst().orElse(null);
if (sum == null) {
orderProd.setVerifyingBaseNum(BigDecimal.ZERO);
} else {
orderProd.setVerifyingBaseNum(sum.getSum());
}
}
}
}

View File

@ -4,13 +4,14 @@ import java.util.Collections;
import java.util.List;
import com.ruoyi.common.utils.collection.CollectionUtils;
import com.ruoyi.web.yh.reportOrderProd.domain.vo.ReportOrderProdSumOfBaseNumGroupByOrderIdVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.web.yh.reportOrderProd.mapper.ReportOrderProdMapper;
import com.ruoyi.web.yh.reportOrderProd.domain.ReportOrderProd;
import com.ruoyi.web.yh.reportOrderProd.domain.ReportOrderProdVO;
import com.ruoyi.web.yh.reportOrderProd.domain.ReportOrderProdQuery;
import com.ruoyi.web.yh.reportOrderProd.service.IReportOrderProdService;
import com.ruoyi.web.yh.reportOrderProd.service.ReportOrderProdService;
/**
* 订单产量Service业务层处理
@ -19,7 +20,7 @@ import com.ruoyi.web.yh.reportOrderProd.service.IReportOrderProdService;
* @date 2024-11-19
*/
@Service
public class ReportOrderProdServiceImpl implements IReportOrderProdService
public class ReportOrderProdServiceImpl implements ReportOrderProdService
{
@Autowired
private ReportOrderProdMapper reportOrderProdMapper;
@ -130,4 +131,9 @@ public class ReportOrderProdServiceImpl implements IReportOrderProdService
List<Long> ids = CollectionUtils.map(list, ReportOrderProd::getId);
return reportOrderProdMapper.batchLogicDel(ids);
}
@Override
public List<ReportOrderProdSumOfBaseNumGroupByOrderIdVO> selectSumOfBaseNumGroupByOrderId(ReportOrderProdQuery query) {
return reportOrderProdMapper.selectSumOfBaseNumGroupByOrderId(query);
}
}

View File

@ -3,7 +3,8 @@ package com.ruoyi.web.yh.reportProd.service.impl;
import com.ruoyi.common.utils.collection.CollectionUtils;
import com.ruoyi.web.yh.reportOrderProd.domain.ReportOrderProdQuery;
import com.ruoyi.web.yh.reportOrderProd.domain.ReportOrderProdVO;
import com.ruoyi.web.yh.reportOrderProd.service.IReportOrderProdService;
import com.ruoyi.web.yh.reportOrderProd.service.ReportOrderProdAssembler;
import com.ruoyi.web.yh.reportOrderProd.service.ReportOrderProdService;
import com.ruoyi.web.yh.reportProd.domain.ReportProdVO;
import com.ruoyi.web.yh.reportProd.service.ReportProdAssembler;
import com.ruoyi.web.yh.reportUserProd.domain.ReportUserProdQuery;
@ -28,7 +29,10 @@ public class ReportProdAssemblerImpl implements ReportProdAssembler {
private ReportUserProdService reportUserProdService;
@Autowired
private IReportOrderProdService reportOrderProdService;
private ReportOrderProdService reportOrderProdService;
@Autowired
private ReportOrderProdAssembler reportOrderProdAssembler;
@Override
public void assembleUserProdList(List<ReportProdVO> list) {
@ -58,8 +62,13 @@ public class ReportProdAssemblerImpl implements ReportProdAssembler {
ReportOrderProdQuery query = new ReportOrderProdQuery();
query.setReportProdIds(CollectionUtils.map(list, ReportProdVO::getId));
Map<Long, List<ReportOrderProdVO>> group = reportOrderProdService.selectReportOrderProdList(query)
.stream().collect(Collectors.groupingBy(ReportOrderProdVO::getReportProdId));
List<ReportOrderProdVO> orderList = reportOrderProdService.selectReportOrderProdList(query);
// 拼接订单数据
reportOrderProdAssembler.assembleVerifyingBaseNum(orderList);
Map<Long, List<ReportOrderProdVO>> group = orderList.stream()
.collect(Collectors.groupingBy(ReportOrderProdVO::getReportProdId));
for (ReportProdVO prod : list) {
List<ReportOrderProdVO> orderProdList = group.get(prod.getId());