|
|
@@ -373,7 +373,29 @@
|
|
|
AND imfc.id = ibbpt.tray_id
|
|
|
AND imm.id = ibb.meterial_id
|
|
|
AND itt.resource_id = #{resourceId}
|
|
|
- ORDER BY ittn.exe_status DESC, funcType desc, ipp.prority desc, rclType asc, itt.procedure_order desc, ittn.complete_batch_sort, itt.expect_start_time LIMIT 0, 6
|
|
|
+
|
|
|
+ ORDER BY
|
|
|
+ CASE
|
|
|
+ WHEN ittn.node_name LIKE '%上料%' AND NOT EXISTS (
|
|
|
+ SELECT 1
|
|
|
+ FROM imcs_base_hz_0000.imcs_t_task_node pre
|
|
|
+ WHERE pre.complete_batch_no = ittn.complete_batch_no
|
|
|
+ AND pre.interface_type = '04'
|
|
|
+ AND pre.node_name LIKE '%下料%'
|
|
|
+ AND pre.complete_batch_sort = ittn.complete_batch_sort - 1
|
|
|
+ AND pre.exe_status = '3'
|
|
|
+ AND pre.exe_result = '1'
|
|
|
+ ) THEN 1 ELSE 0
|
|
|
+ END ASC,
|
|
|
+ -- ↓ 保留你的原排序
|
|
|
+ ittn.exe_status DESC,
|
|
|
+ (ibbp.name LIKE '%下料%') DESC,
|
|
|
+ ipp.prority DESC,
|
|
|
+ (ittn.node_name LIKE '%申请%') ASC,
|
|
|
+ itt.procedure_order DESC,
|
|
|
+ ittn.complete_batch_sort,
|
|
|
+ itt.expect_start_time
|
|
|
+LIMIT 6
|
|
|
</select>
|
|
|
<select id="selectTotalMachineUseTime" resultType="java.lang.Integer">
|
|
|
SELECT
|