|
|
|
|
@ -400,7 +400,7 @@
|
|
|
|
|
o.plan_end_time AS planEndTime,
|
|
|
|
|
GETDATE() AS currentTime,
|
|
|
|
|
CAST(ISNULL(ps.totalProcessCount, 0) AS VARCHAR(10)) + '道' AS totalProcessCount,
|
|
|
|
|
-- 清理工序名称中的多余逗号和空格
|
|
|
|
|
|
|
|
|
|
LTRIM(RTRIM(REPLACE(REPLACE(ISNULL(ps.wipProcessNames, ''), ',,', ','), ',', ','))) AS wipProcesses,
|
|
|
|
|
LTRIM(RTRIM(REPLACE(REPLACE(ISNULL(ps.remainingProcessNames, ''), ',,', ','), ',', ','))) AS remainingProcesses,
|
|
|
|
|
-- 整体进度计算:已完成数量占比 + 在制品进度占比
|
|
|
|
|
@ -462,6 +462,33 @@
|
|
|
|
|
ORDER BY o.order_code DESC
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!-- 在制品跟踪报表总数(简化版 count):避免复杂 CTE/聚合,保持与筛选条件一致 -->
|
|
|
|
|
<select id="wipTrackingReportCount" resultType="java.lang.Long">
|
|
|
|
|
SELECT COUNT(*)
|
|
|
|
|
FROM prod_order_info o
|
|
|
|
|
INNER JOIN base_material_info m ON m.material_id = o.material_id
|
|
|
|
|
WHERE m.del_flag = '0'
|
|
|
|
|
<if test="map.beginDate != null and map.beginDate != '' and map.endDate != null and map.endDate != ''">
|
|
|
|
|
AND o.plan_begin_time <![CDATA[>=]]> CAST(#{map.beginDate} AS DATETIME)
|
|
|
|
|
AND o.plan_begin_time <![CDATA[<]]> DATEADD(day, 1, CAST(#{map.endDate} AS DATETIME))
|
|
|
|
|
</if>
|
|
|
|
|
<if test="map.orderCode != null and map.orderCode != ''">
|
|
|
|
|
AND o.order_code LIKE CONCAT('%', #{map.orderCode}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="map.materialName != null and map.materialName != ''">
|
|
|
|
|
AND m.material_name LIKE CONCAT('%', #{map.materialName}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="map.materialCode != null and map.materialCode != ''">
|
|
|
|
|
AND m.material_code LIKE CONCAT('%', #{map.materialCode}, '%')
|
|
|
|
|
</if>
|
|
|
|
|
<if test="map.progressStatus != null and map.progressStatus != ''">
|
|
|
|
|
AND CASE
|
|
|
|
|
WHEN o.plan_end_time IS NOT NULL AND GETDATE() > o.plan_end_time AND ISNULL(o.complete_amount,0) <![CDATA[<]]> o.plan_amount THEN '延期'
|
|
|
|
|
ELSE '正常'
|
|
|
|
|
END = #{map.progressStatus}
|
|
|
|
|
</if>
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
<!-- 获取订单的工序进度详情 - 高性能优化版本(保留单订单查询,不返回productOrderId以兼容旧用法) -->
|
|
|
|
|
<select id="getOrderProcessProgress" resultType="org.dromara.mes.domain.vo.ProcessProgressVo">
|
|
|
|
|
SELECT
|
|
|
|
|
|