成型机生产报表优化

master
shaoyong 9 months ago
parent 5a88e45c35
commit 0262e1237a

@ -748,24 +748,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="getMachineProductionList" resultType="com.op.mes.domain.MesMachineReport">
SELECT
concat(pow.product_code,mt.ymd) pduCode,
concat(pow.product_code,pow.product_date) pduCode,
COUNT(0) quantity,
pow.product_code productCode,
pow.product_name productName,
mt.ymd ymd
pow.product_date ymd
FROM
(
SELECT CONVERT(VARCHAR ( 10 ), mtr.update_time, 20 ) ymd,mtr.OrderCode
(
SELECT
case when mtr.change_shift_id is not null then mtr.change_shift_id else mtr.shift_id end shift_id,
case when mtr.change_order is not null then mtr.change_order else mtr.OrderCode end OrderCode
FROM mes_material_transfer_result mtr
LEFT JOIN base_equipment equ ON mtr.equipmentCode = equ.equipment_code
WHERE
rfid_status = '1'
AND equ.equipment_type_code = 'equ_type_cxj'
<if test="productDateStart != null "> and CONVERT(varchar(30),mtr.update_time, 120) &gt;= #{productDateStart}</if>
<if test="productDateEnd != null "> and #{productDateEnd} &gt; CONVERT(varchar(30),mtr.update_time, 120)</if>
) mt
) mt
LEFT JOIN pro_order_workorder pow ON pow.workorder_id = mt.OrderCode
WHERE pow.order_code IS NOT NULL
<if test="productDateStart != null"> and pow.product_date >= #{productDateStart}</if>
<if test="productDateEnd != null"> and #{productDateEnd} >= pow.product_date</if>
<if test="shiftId != null and shiftId != ''">
and pow.shift_id = #{shiftId}
</if>
@ -776,7 +778,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and pow.product_name like concat('%', #{productName}, '%')
</if>
GROUP BY
mt.ymd,
pow.product_date,
pow.product_code,
pow.product_name
</select>

Loading…
Cancel
Save