修复成本问题

This commit is contained in:
2026-01-27 16:54:46 +08:00
parent bfe8750b86
commit a1f8b0c60b
9 changed files with 268 additions and 205 deletions

View File

@@ -237,9 +237,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<!-- 按入场钢卷号统计成本 -->
<!-- 虽然方法名仍然包含 EnterCoilNo但统计口径已统一为“当前钢卷号current_coil_no-->
<select id="selectCostByEnterCoilNo" resultType="java.util.HashMap">
SELECT
mc.enter_coil_no AS enterCoilNo,
mc.current_coil_no AS currentCoilNo,
COUNT(DISTINCT mc.coil_id) AS coilCount,
COUNT(DISTINCT CASE WHEN mc.export_time IS NULL THEN mc.coil_id END) AS unshippedCount,
COUNT(DISTINCT CASE WHEN mc.export_time IS NOT NULL THEN mc.coil_id END) AS shippedCount,
@@ -253,15 +254,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND mc.data_type = 1
AND mc.del_flag = 0
<if test="enterCoilNo != null and enterCoilNo != ''">
AND mc.enter_coil_no = #{enterCoilNo}
AND mc.current_coil_no = #{enterCoilNo}
</if>
GROUP BY mc.enter_coil_no
GROUP BY mc.current_coil_no
ORDER BY totalCost DESC
</select>
<!-- 囤积成本(按当前钢卷号聚合)列表 -->
<select id="selectStockpileByEnterCoilNo" resultType="java.util.HashMap">
SELECT
t.enter_coil_no AS enterCoilNo,
t.current_coil_no AS currentCoilNo,
COUNT(*) AS coilCount,
SUM(t.net_weight_ton) AS totalNetWeight,
SUM(t.gross_weight_ton) AS totalGrossWeight,
@@ -271,7 +273,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
MAX(CASE WHEN IFNULL(t.net_weight_ton, 0) = 0 THEN 1 ELSE 0 END) AS hasNetWeightZero
FROM (
SELECT
m.enter_coil_no,
m.current_coil_no,
IFNULL(m.net_weight, 0) AS net_weight_ton,
IFNULL(m.gross_weight, 0) AS gross_weight_ton,
CASE
@@ -293,33 +295,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND m.del_flag = 0
AND m.export_time IS NULL
<if test="enterCoilNo != null and enterCoilNo != ''">
AND m.enter_coil_no LIKE CONCAT(#{enterCoilNo}, '%')
AND m.current_coil_no LIKE CONCAT(#{enterCoilNo}, '%')
</if>
) t
GROUP BY t.enter_coil_no
ORDER BY t.enter_coil_no DESC
GROUP BY t.current_coil_no
ORDER BY t.current_coil_no DESC
LIMIT #{offset}, #{pageSize}
</select>
<!-- 囤积成本(按入场钢卷号聚合)列表总数 -->
<!-- 囤积成本(按当前钢卷号聚合)列表总数 -->
<select id="countStockpileByEnterCoilNo" resultType="long">
SELECT
COUNT(*) AS cnt
FROM (
SELECT m.enter_coil_no
SELECT m.current_coil_no
FROM wms_material_coil m
WHERE m.data_type = 1
AND m.del_flag = 0
and m.status = 0
AND m.export_time IS NULL
<if test="enterCoilNo != null and enterCoilNo != ''">
AND m.enter_coil_no LIKE CONCAT(#{enterCoilNo}, '%')
AND m.current_coil_no LIKE CONCAT(#{enterCoilNo}, '%')
</if>
GROUP BY m.enter_coil_no
GROUP BY m.current_coil_no
) t
</select>
<!-- 囤积成本(按入场钢卷号聚合)汇总 -->
<!-- 囤积成本(按当前钢卷号聚合)汇总 -->
<select id="selectStockpileSummaryByEnterCoilNo" resultType="java.util.HashMap">
SELECT
SUM(t.net_weight_ton) AS totalNetWeight,