|
@@ -885,22 +885,32 @@
|
|
|
<select id="unFinishedTask" resultType="java.util.Map">
|
|
|
SELECT * from (
|
|
|
SELECT
|
|
|
+ z.name as zoneName,p.name as resourceName,o.single_task_flag,
|
|
|
<choose>
|
|
|
<when test="params.taskType !=null and params.taskType !=''">
|
|
|
n.resource_id as resourceId,
|
|
|
- n.end_time AS completeTime,
|
|
|
TIMESTAMPDIFF(MINUTE, n.start_time, n.end_time) AS runTime,
|
|
|
+ n.node_name AS bizName,
|
|
|
+ n.id AS bizId,
|
|
|
+ n.complete_batch_no as completeBatchNo,
|
|
|
+ n.start_time,
|
|
|
+ n.create_time,
|
|
|
+ n.complete_batch_no as completeBatchNo,
|
|
|
</when>
|
|
|
<otherwise>
|
|
|
c.resource_id as resourceId,
|
|
|
- c.end_time AS completeTime,
|
|
|
TIMESTAMPDIFF(MINUTE, c.start_time, c.end_time) AS runTime,
|
|
|
+ c.procedure_name AS bizName,
|
|
|
+ c.id AS bizId,
|
|
|
+ c.complete_batch_no as completeBatchNo,
|
|
|
+ c.start_time,
|
|
|
+ c.create_time,
|
|
|
</otherwise>
|
|
|
</choose>
|
|
|
<if test="params.startDate !=null and params.startDate !='' and params.endDate !=null and params.endDate !=''">
|
|
|
<choose>
|
|
|
- <when test="params.taskType !=null and params.taskType !=''">DATE_FORMAT(n.start_time, '%Y-%m-%d') AS time</when>
|
|
|
- <otherwise>DATE_FORMAT(c.start_time, '%Y-%m-%d') AS time</otherwise>
|
|
|
+ <when test="params.taskType !=null and params.taskType !=''">DATE_FORMAT(ifnull(n.start_time, Now()), '%Y-%m-%d') AS time</when>
|
|
|
+ <otherwise>DATE_FORMAT(ifnull(c.start_time,Now()), '%Y-%m-%d') AS time</otherwise>
|
|
|
</choose>
|
|
|
</if>
|
|
|
<if test="params.month !=null and params.month !=''">
|
|
@@ -917,14 +927,17 @@
|
|
|
</if>
|
|
|
<if test="params.today !=null and params.today !=''">
|
|
|
<choose>
|
|
|
- <when test="params.taskType !=null and params.taskType !=''">DATE_FORMAT(n.start_time, '%Y-%m-%d') AS time</when>
|
|
|
- <otherwise> DATE_FORMAT(c.start_time, '%Y-%m-%d') AS time</otherwise>
|
|
|
+ <when test="params.taskType !=null and params.taskType !=''">DATE_FORMAT(ifnull(n.start_time, Now()), '%Y-%m-%d') AS time</when>
|
|
|
+ <otherwise> DATE_FORMAT(ifnull(c.start_time,Now()), '%Y-%m-%d') AS time</otherwise>
|
|
|
</choose>
|
|
|
</if>
|
|
|
- c.*
|
|
|
FROM imcs_t_task c
|
|
|
- LEFT JOIN imcs_t_task_node n ON c.id = n.task_id ,
|
|
|
+ <choose>
|
|
|
+ <when test="params.taskType !=null and params.taskType !=''">LEFT JOIN imcs_t_task_node n ON c.id = n.task_id</when>
|
|
|
+ </choose>
|
|
|
LEFT JOIN imcs_tenant_productionresource p ON c.resource_id = p.id
|
|
|
+ LEFT JOIN imcs_o_order o ON c.order_id = o.id
|
|
|
+ LEFT JOIN imcs_z_zone z ON o.zone_id = z.id
|
|
|
WHERE
|
|
|
<choose>
|
|
|
<when test="params.taskType !=null and params.taskType !=''">n.exe_status <![CDATA[ <> ]]> '3'</when>
|
|
@@ -968,7 +981,11 @@
|
|
|
SELECT
|
|
|
ihai.*,
|
|
|
ihadi.callback_time AS completeTime,
|
|
|
- TIMESTAMPDIFF(MINUTE, ihai.response_time, ihadi.callback_time) AS runTime,
|
|
|
+ ioo.order_name AS orderName,
|
|
|
+ ioo.order_no AS orderNo,
|
|
|
+ ibb.name AS partName,
|
|
|
+ itw.unique_code AS partNo,
|
|
|
+ itt.procedure_no AS procedureNo,
|
|
|
<if test="params.startDate !=null and params.startDate !='' and params.endDate !=null and params.endDate !=''">
|
|
|
DATE_FORMAT(ihadi.callback_time, '%Y-%m-%d') AS time
|
|
|
</if>
|
|
@@ -982,8 +999,18 @@
|
|
|
DATE_FORMAT(ihadi.callback_time, '%Y-%m-%d') AS time
|
|
|
</if>
|
|
|
FROM imcs_hik_agv_info ihai,
|
|
|
- imcs_hik_agv_detail_info ihadi
|
|
|
- WHERE ihai.task_code = ihadi.task_code
|
|
|
+ imcs_hik_agv_detail_info ihadi,
|
|
|
+ imcs_t_task itt,
|
|
|
+ imcs_t_workpiece itw,
|
|
|
+ imcs_o_order ioo,
|
|
|
+ imcs_o_order_product ioop,
|
|
|
+ imcs_b_bom ibb
|
|
|
+ WHERE ihadi.task_code = ihai.task_code
|
|
|
+ AND ihai.task_id = itt.id
|
|
|
+ AND itt.complete_batch_no = itw.complete_batch_no
|
|
|
+ AND itt.order_id = ioo.id
|
|
|
+ AND ioo.id = ioop.order_id
|
|
|
+ AND ioop.bom_id = ibb.id
|
|
|
<if test="params.startDate !=null and params.startDate !='' and params.endDate !=null and params.endDate !=''">
|
|
|
AND ihadi.callback_time BETWEEN #{params.startDate} and #{params.endDate}
|
|
|
</if>
|