Files
klp-oa/klp-pocket/src/main/resources/mapper/pocket/AcidOeeMasterMapper.xml
2026-03-19 18:17:08 +08:00

69 lines
3.5 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.klp.pocket.acid.mapper.AcidOeeMasterMapper">
<!-- OEE日汇总结果映射 -->
<resultMap id="AcidOeeDailySummaryResultMap" type="com.klp.pocket.acid.domain.vo.AcidOeeDailySummaryVo">
<result column="stat_date" property="statDate" jdbcType="VARCHAR"/>
<result column="line_id" property="lineId" jdbcType="VARCHAR"/>
<result column="line_name" property="lineName" jdbcType="VARCHAR"/>
<result column="planned_time_min" property="plannedTimeMin" jdbcType="BIGINT"/>
<result column="planned_downtime_min" property="plannedDowntimeMin" jdbcType="BIGINT"/>
<result column="loading_time_min" property="loadingTimeMin" jdbcType="BIGINT"/>
<result column="downtime_min" property="downtimeMin" jdbcType="BIGINT"/>
<result column="run_time_min" property="runTimeMin" jdbcType="BIGINT"/>
<result column="total_output_ton" property="totalOutputTon" jdbcType="DECIMAL"/>
<result column="total_output_coil" property="totalOutputCoil" jdbcType="BIGINT"/>
<result column="good_output_ton" property="goodOutputTon" jdbcType="DECIMAL"/>
<result column="good_output_coil" property="goodOutputCoil" jdbcType="BIGINT"/>
<result column="defect_output_ton" property="defectOutputTon" jdbcType="DECIMAL"/>
<result column="defect_output_coil" property="defectOutputCoil" jdbcType="BIGINT"/>
<result column="ideal_cycle_time_min_per_ton" property="idealCycleTimeMinPerTon" jdbcType="DECIMAL"/>
<result column="ideal_cycle_time_min_per_coil" property="idealCycleTimeMinPerCoil" jdbcType="DECIMAL"/>
</resultMap>
<!-- 查询OEE日汇总总产量统一使用主库 wms_material_coil -->
<select id="selectDailySummary" resultMap="AcidOeeDailySummaryResultMap">
SELECT
DATE_FORMAT(mc.create_time, '%Y-%m-%d') AS stat_date,
'SY' AS line_id,
'酸轧线' AS line_name,
1440 AS planned_time_min,
0 AS planned_downtime_min,
1440 AS loading_time_min,
0 AS downtime_min,
COALESCE(SUM(mc.net_weight), 0) AS total_output_ton,
COUNT(*) AS total_output_coil,
0 AS good_output_ton,
0 AS good_output_coil,
0 AS defect_output_ton,
0 AS defect_output_coil,
NULL AS ideal_cycle_time_min_per_ton,
NULL AS ideal_cycle_time_min_per_coil
FROM wms_material_coil mc
WHERE DATE(mc.create_time) BETWEEN #{startDate} AND #{endDate}
AND mc.create_by = #{createBy}
AND mc.del_flag = 0
AND mc.net_weight IS NOT NULL
AND mc.net_weight > 0
GROUP BY DATE_FORMAT(mc.create_time, '%Y-%m-%d')
</select>
<!-- 查询每日的钢卷号、重量、判级主库wms_material_coil -->
<select id="selectCoilInfoByDate" resultType="com.klp.pocket.acid.domain.vo.AcidOeeCoilInfoByDateVo">
SELECT
DATE_FORMAT(mc.create_time, '%Y-%m-%d') AS statDate,
mc.current_coil_no AS coilNo,
(mc.net_weight) AS weight,
mc.quality_status AS qualityStatus
FROM wms_material_coil mc
WHERE DATE(mc.create_time) BETWEEN #{startDate} AND #{endDate}
AND mc.create_by = #{createBy}
AND mc.del_flag = 0
AND mc.net_weight IS NOT NULL
AND mc.net_weight > 0
</select>
</mapper>