首页统计接口修改
配送修改状态修改
This commit is contained in:
@@ -303,4 +303,11 @@
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<update id="updateDeliveryStatusByBillNo">
|
||||
UPDATE rk_bill
|
||||
SET is_delivery = #{isDelivery},
|
||||
update_time = NOW()
|
||||
WHERE bill_no = #{billNo}
|
||||
AND is_delete = '0'
|
||||
</update>
|
||||
</mapper>
|
||||
|
||||
@@ -658,6 +658,7 @@
|
||||
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">
|
||||
@@ -735,4 +736,37 @@
|
||||
AND is_delete = '0'
|
||||
</select>
|
||||
|
||||
|
||||
<!-- 修改 record 状态 -->
|
||||
<update id="updateDeliveryStatus">
|
||||
UPDATE rk_record
|
||||
SET is_delivery = #{isDelivery},
|
||||
update_time = NOW()
|
||||
WHERE is_delete = '0'
|
||||
AND id IN
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<!-- 找到受影响的 bill -->
|
||||
<select id="selectBillNosByRecordIds" resultType="string">
|
||||
SELECT DISTINCT bill_no
|
||||
FROM rk_record
|
||||
WHERE id IN
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
AND is_delete = '0'
|
||||
</select>
|
||||
|
||||
<!-- 统计不同状态数量 -->
|
||||
<select id="countDifferentDeliveryStatus" resultType="int">
|
||||
SELECT COUNT(1)
|
||||
FROM rk_record
|
||||
WHERE bill_no = #{billNo}
|
||||
AND is_delete = '0'
|
||||
AND is_delivery != #{isDelivery}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -5,112 +5,165 @@
|
||||
<!-- 当前入库类型统计 -->
|
||||
<select id="statCurrentInByOperationType"
|
||||
resultType="com.zg.project.wisdom.domain.vo.StockStatisticGroupVO">
|
||||
|
||||
SELECT
|
||||
ri.operation_type AS groupValue,
|
||||
sit.type_name AS groupName,
|
||||
|
||||
IFNULL(SUM(ri.real_qty * ri.ht_dj), 0) AS totalAmount,
|
||||
COUNT(DISTINCT ri.pcode) AS locationCount,
|
||||
IFNULL(SUM(ri.real_qty), 0) AS totalQuantity,
|
||||
COUNT(DISTINCT ri.xm_no) AS projectCount
|
||||
|
||||
FROM rk_info ri
|
||||
LEFT JOIN stock_in_type sit
|
||||
ON sit.type_code = ri.operation_type
|
||||
AND sit.status = 1
|
||||
|
||||
WHERE ri.exec_status = 1
|
||||
AND ri.is_chuku = 0
|
||||
AND ri.is_delete = 0
|
||||
GROUP BY ri.operation_type
|
||||
|
||||
GROUP BY ri.operation_type, sit.type_name
|
||||
|
||||
</select>
|
||||
|
||||
<!-- 当前物资类型统计 -->
|
||||
<select id="statCurrentByMaterialType"
|
||||
resultType="com.zg.project.wisdom.domain.vo.StockStatisticGroupVO">
|
||||
|
||||
SELECT
|
||||
ri.wl_type AS groupValue,
|
||||
mt.type_name AS groupName,
|
||||
|
||||
IFNULL(SUM(ri.real_qty * ri.ht_dj), 0) AS totalAmount,
|
||||
COUNT(DISTINCT ri.pcode) AS locationCount,
|
||||
IFNULL(SUM(ri.real_qty), 0) AS totalQuantity,
|
||||
COUNT(DISTINCT ri.xm_no) AS projectCount
|
||||
|
||||
FROM rk_info ri
|
||||
LEFT JOIN material_type mt
|
||||
ON mt.type_code = ri.wl_type
|
||||
AND mt.status = 1
|
||||
|
||||
WHERE ri.exec_status = 1
|
||||
AND ri.is_chuku = 0
|
||||
AND ri.is_delete = 0
|
||||
GROUP BY ri.wl_type
|
||||
|
||||
GROUP BY ri.wl_type, mt.type_name
|
||||
|
||||
</select>
|
||||
|
||||
|
||||
<!-- 入库类型统计(时间) -->
|
||||
<select id="statInByOperationType"
|
||||
resultType="com.zg.project.wisdom.domain.vo.StockStatisticGroupVO">
|
||||
|
||||
SELECT
|
||||
ri.operation_type AS groupValue,
|
||||
sit.type_name AS groupName,
|
||||
|
||||
IFNULL(SUM(ri.real_qty * ri.ht_dj), 0) AS totalAmount,
|
||||
COUNT(DISTINCT ri.pcode) AS locationCount,
|
||||
IFNULL(SUM(ri.real_qty), 0) AS totalQuantity,
|
||||
COUNT(DISTINCT ri.xm_no) AS projectCount
|
||||
|
||||
FROM rk_info ri
|
||||
LEFT JOIN stock_in_type sit
|
||||
ON sit.type_code = ri.operation_type
|
||||
AND sit.status = 1
|
||||
|
||||
WHERE ri.exec_status = 1
|
||||
AND ri.is_chuku = 0
|
||||
AND ri.is_delete = 0
|
||||
|
||||
<if test="startDate != null">
|
||||
AND ri.operation_time <![CDATA[>=]]> #{startDate}
|
||||
</if>
|
||||
|
||||
<if test="endDate != null">
|
||||
AND ri.operation_time <![CDATA[<=]]> #{endDate}
|
||||
</if>
|
||||
GROUP BY ri.operation_type
|
||||
|
||||
GROUP BY ri.operation_type, sit.type_name
|
||||
|
||||
</select>
|
||||
|
||||
<!-- 出库类型统计(时间) -->
|
||||
<select id="statOutByOperationType"
|
||||
resultType="com.zg.project.wisdom.domain.vo.StockStatisticGroupVO">
|
||||
|
||||
SELECT
|
||||
ri.operation_type AS groupValue,
|
||||
IFNULL(SUM(ri.real_qty * ri.ht_dj), 0) AS totalAmount,
|
||||
COUNT(DISTINCT ri.pcode) AS locationCount,
|
||||
IFNULL(SUM(ri.real_qty), 0) AS totalQuantity,
|
||||
COUNT(DISTINCT ri.xm_no) AS projectCount
|
||||
FROM rk_info ri
|
||||
WHERE ri.exec_status = 1
|
||||
AND ri.is_chuku = 1
|
||||
AND ri.is_delete = 0
|
||||
rr.operation_type AS groupValue,
|
||||
|
||||
sot.type_name AS groupName,
|
||||
|
||||
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,
|
||||
|
||||
COUNT(DISTINCT rr.xm_no) AS projectCount
|
||||
|
||||
FROM rk_record rr
|
||||
|
||||
LEFT JOIN stock_out_type sot
|
||||
ON sot.type_code = rr.operation_type
|
||||
AND sot.is_delete = '0'
|
||||
|
||||
WHERE rr.exec_status = '1'
|
||||
AND rr.biz_type = '1' <!-- 出库 -->
|
||||
AND rr.is_delete = '0'
|
||||
|
||||
<if test="startDate != null">
|
||||
AND ri.operation_time <![CDATA[>=]]> #{startDate}
|
||||
AND rr.operation_time <![CDATA[>=]]> #{startDate}
|
||||
</if>
|
||||
|
||||
<if test="endDate != null">
|
||||
AND ri.operation_time <![CDATA[<=]]> #{endDate}
|
||||
AND rr.operation_time <![CDATA[<=]]> #{endDate}
|
||||
</if>
|
||||
GROUP BY ri.operation_type
|
||||
|
||||
GROUP BY rr.operation_type, sot.type_name
|
||||
|
||||
</select>
|
||||
|
||||
<select id="statHomeKpi"
|
||||
resultType="com.zg.project.wisdom.domain.vo.HomeKpiVO">
|
||||
|
||||
SELECT
|
||||
/* 月入库 */
|
||||
COUNT(CASE WHEN ri.is_chuku = 0
|
||||
AND DATE_FORMAT(ri.operation_time,'%Y-%m') = DATE_FORMAT(CURDATE(),'%Y-%m')
|
||||
/* ===== 月入库 ===== */
|
||||
COUNT(CASE WHEN rr.biz_type = '0'
|
||||
AND DATE_FORMAT(rr.operation_time,'%Y-%m') = DATE_FORMAT(CURDATE(),'%Y-%m')
|
||||
THEN 1 END) AS monthInCount,
|
||||
|
||||
COUNT(DISTINCT CASE WHEN ri.is_chuku = 0
|
||||
AND DATE_FORMAT(ri.operation_time,'%Y-%m') = DATE_FORMAT(CURDATE(),'%Y-%m')
|
||||
THEN ri.xm_no END) AS monthInProjectCount,
|
||||
COUNT(DISTINCT CASE WHEN rr.biz_type = '0'
|
||||
AND DATE_FORMAT(rr.operation_time,'%Y-%m') = DATE_FORMAT(CURDATE(),'%Y-%m')
|
||||
THEN rr.xm_no END) AS monthInProjectCount,
|
||||
|
||||
IFNULL(SUM(CASE WHEN ri.is_chuku = 0
|
||||
AND DATE_FORMAT(ri.operation_time,'%Y-%m') = DATE_FORMAT(CURDATE(),'%Y-%m')
|
||||
THEN ri.real_qty * ri.ht_dj END),0) AS monthInAmount,
|
||||
IFNULL(SUM(CASE WHEN rr.biz_type = '0'
|
||||
AND DATE_FORMAT(rr.operation_time,'%Y-%m') = DATE_FORMAT(CURDATE(),'%Y-%m')
|
||||
THEN rr.real_qty * rr.ht_dj END),0) AS monthInAmount,
|
||||
|
||||
/* 月出库 */
|
||||
COUNT(CASE WHEN ri.is_chuku = 1
|
||||
AND DATE_FORMAT(ri.operation_time,'%Y-%m') = DATE_FORMAT(CURDATE(),'%Y-%m')
|
||||
/* ===== 月出库 ===== */
|
||||
COUNT(CASE WHEN rr.biz_type = '1'
|
||||
AND DATE_FORMAT(rr.operation_time,'%Y-%m') = DATE_FORMAT(CURDATE(),'%Y-%m')
|
||||
THEN 1 END) AS monthOutCount,
|
||||
|
||||
COUNT(DISTINCT CASE WHEN ri.is_chuku = 1
|
||||
AND DATE_FORMAT(ri.operation_time,'%Y-%m') = DATE_FORMAT(CURDATE(),'%Y-%m')
|
||||
THEN ri.xm_no END) AS monthOutProjectCount,
|
||||
COUNT(DISTINCT CASE WHEN rr.biz_type = '1'
|
||||
AND DATE_FORMAT(rr.operation_time,'%Y-%m') = DATE_FORMAT(CURDATE(),'%Y-%m')
|
||||
THEN rr.xm_no END) AS monthOutProjectCount,
|
||||
|
||||
IFNULL(SUM(CASE WHEN rr.biz_type = '1'
|
||||
AND DATE_FORMAT(rr.operation_time,'%Y-%m') = DATE_FORMAT(CURDATE(),'%Y-%m')
|
||||
THEN rr.real_qty * rr.ht_dj END),0) AS monthOutAmount
|
||||
|
||||
FROM rk_record rr
|
||||
WHERE rr.exec_status = '1'
|
||||
AND rr.is_delete = '0'
|
||||
|
||||
IFNULL(SUM(CASE WHEN ri.is_chuku = 1
|
||||
AND DATE_FORMAT(ri.operation_time,'%Y-%m') = DATE_FORMAT(CURDATE(),'%Y-%m')
|
||||
THEN ri.real_qty * ri.ht_dj END),0) AS monthOutAmount
|
||||
FROM rk_info ri
|
||||
WHERE ri.exec_status = 1
|
||||
AND ri.is_delete = 0
|
||||
</select>
|
||||
|
||||
<select id="selectStockAgeStat" resultType="com.zg.project.wisdom.domain.vo.StockAgeStatVO">
|
||||
<![CDATA[
|
||||
SELECT '10-20天' AS name, COUNT(*) AS value
|
||||
|
||||
Reference in New Issue
Block a user