出入库统计接口

This commit is contained in:
2026-02-02 09:00:39 +08:00
parent ae2f7a897e
commit 5812fce297
6 changed files with 107 additions and 8 deletions

View File

@@ -581,22 +581,25 @@
<!-- 入库统计 -->
<select id="selectInRecordStatistic"
<select id="selectRecordStatisticByCondition"
parameterType="com.zg.project.wisdom.domain.RkRecord"
resultType="com.zg.project.wisdom.domain.vo.StockStatisticVO">
SELECT
IFNULL(SUM(rr.real_qty * rr.ht_dj), 0) AS total_amount,
COUNT(DISTINCT rr.pcode) AS location_count,
IFNULL(SUM(rr.real_qty), 0) AS total_quantity
IFNULL(SUM(rr.real_qty * rr.ht_dj), 0) AS totalAmount,
COUNT(DISTINCT rr.pcode) AS locationCount,
IFNULL(SUM(rr.real_qty), 0) AS totalQuantity
FROM rk_record rr
<where>
rr.is_delete = 0
AND rr.exec_status = 1
AND rr.biz_type = 0 <!-- 入库 -->
<if test="operationType != null and operationType != ''">
AND rr.operation_type LIKE CONCAT('%', #{operationType}, '%')
<if test="operationType != null and operationType.size() > 0">
AND rr.operation_type IN
<foreach collection="operationType" item="it" open="(" separator="," close=")">
#{it}
</foreach>
</if>
<if test="xmNo != null and xmNo != ''">
AND rr.xm_no LIKE CONCAT('%', #{xmNo}, '%')
@@ -688,5 +691,72 @@
WHERE id = #{id}
AND is_delete = '0'
</update>
<select id="selectInOutStatisticByCondition"
parameterType="com.zg.project.wisdom.domain.RkRecord"
resultType="com.zg.project.wisdom.domain.vo.StockStatisticVO">
SELECT
IFNULL(SUM(rr.real_qty * rr.ht_dj), 0) AS totalAmount,
COUNT(DISTINCT rr.pcode) AS locationCount,
IFNULL(SUM(rr.real_qty), 0) AS totalQuantity
FROM rk_record rr
<where>
rr.exec_status = '1'
AND rr.is_delete = '0'
<if test="operationType != null and operationType != ''">
AND rr.operation_type LIKE CONCAT('%', #{operationType}, '%')
</if>
<if test="wlType != null and wlType != ''">
AND rr.wl_type LIKE CONCAT('%', #{wlType}, '%')
</if>
<if test="cangku != null and cangku != ''">
AND rr.cangku LIKE CONCAT('%', #{cangku}, '%')
</if>
<if test="billNo != null and billNo != ''">
AND rr.bill_no LIKE CONCAT('%', #{billNo}, '%')
</if>
<if test="xmNo != null and xmNo != ''">
AND rr.xm_no LIKE CONCAT('%', #{xmNo}, '%')
</if>
<if test="xmMs != null and xmMs != ''">
AND rr.xm_ms LIKE CONCAT('%', #{xmMs}, '%')
</if>
<if test="wlNo != null and wlNo != ''">
AND rr.wl_no LIKE CONCAT('%', #{wlNo}, '%')
</if>
<if test="wlMs != null and wlMs != ''">
AND rr.wl_ms LIKE CONCAT('%', #{wlMs}, '%')
</if>
<if test="gysMc != null and gysMc != ''">
AND rr.gys_mc LIKE CONCAT('%', #{gysMc}, '%')
</if>
<if test="sapNo != null and sapNo != ''">
AND rr.sap_no LIKE CONCAT('%', #{sapNo}, '%')
</if>
<if test="pcode != null and pcode != ''">
AND rr.pcode LIKE CONCAT('%', #{pcode}, '%')
</if>
<!-- 时间:建议用 “< endDate+1天” 防止漏当天 -->
<if test="startDate != null">
AND rr.operation_time &gt;= #{startDate}
</if>
<if test="endDate != null">
AND rr.operation_time &lt; DATE_ADD(#{endDate}, INTERVAL 1 DAY)
</if>
</where>
</select>
</mapper>