|
|
@@ -63,6 +63,30 @@
|
|
|
<!-- 评分退回理由 -->
|
|
|
<result property="scoreReturnReason" column="score_return_reason" />
|
|
|
<result property="orderEntryType" column="order_entry_type" />
|
|
|
+
|
|
|
+ <result property="issueHour" column="issueHour" />
|
|
|
+ <result property="acceptHour" column="acceptHour" />
|
|
|
+ <result property="prepareHour" column="prepareHour" />
|
|
|
+ <result property="suspendHour" column="suspendHour" />
|
|
|
+ <result property="workHour" column="workHour" />
|
|
|
+ <result property="restartHour" column="restartHour" />
|
|
|
+ <result property="downtimeHour" column="downtimeHour" />
|
|
|
+ <result property="wlryNum" column="wlry_num" />
|
|
|
+ <result property="wwryNum" column="wwry_num" />
|
|
|
+ <result property="workPermitNum" column="work_permit_num" />
|
|
|
+ <result property="misOrderNo" column="misOrderNo" />
|
|
|
+ <result property="faultBarcode" column="faultBarcode" />
|
|
|
+ <result property="realFailureReason" column="realFailureReason" />
|
|
|
+ <result property="lostPower" column="lostPower" />
|
|
|
+ <result property="resetMethod" column="resetMethod" />
|
|
|
+ <result property="extraWork" column="extraWork" />
|
|
|
+ <result property="workArea" column="workArea" />
|
|
|
+ <result property="itemCompletionFactorSum" column="itemCompletionFactorSum" />
|
|
|
+ <result property="itemCompletionFactor" column="itemCompletionFactor" />
|
|
|
+ <result property="selfRatingTime" column="selfRatingTime" />
|
|
|
+ <result property="reviewRatingTime" column="reviewRatingTime" />
|
|
|
+ <result property="finalizeMethod" column="finalizeMethod" />
|
|
|
+ <result property="teamLeaderScore" column="teamLeaderScore" />
|
|
|
</resultMap>
|
|
|
|
|
|
<select id="selectUnionOrderList" resultMap="OrderScoreInfoResult">
|
|
|
@@ -486,4 +510,254 @@
|
|
|
</where>
|
|
|
) t
|
|
|
</select>
|
|
|
+
|
|
|
+ <select id="selectUnionExportOrderList" resultMap="OrderScoreInfoResult">
|
|
|
+ SELECT * FROM (
|
|
|
+ SELECT
|
|
|
+ 1 as order_type,
|
|
|
+ work_order_project_no as work_order_project_no,
|
|
|
+ (SELECT dict.dict_label FROM sys_dict_data dict
|
|
|
+ WHERE dict.dict_type = 'gxt_work_order_status' AND dict.dict_value = t.work_order_status) as work_order_status,
|
|
|
+ gxt_center_id as gxt_center_id,
|
|
|
+ gxt_center as gxt_center,
|
|
|
+ pcs_station_id as pcs_station_id,
|
|
|
+ pcs_station_pid as pcs_station_pid,
|
|
|
+ pcs_station_name as pcs_station_name,
|
|
|
+ pcs_device_id as pcs_device_id,
|
|
|
+ pcs_device_name as pcs_device_name,
|
|
|
+ brand as brand,
|
|
|
+ model as model,
|
|
|
+ assign_time as assign_time,
|
|
|
+ assign_user_id as assign_user_id,
|
|
|
+ assign_user_name as assign_user_name,
|
|
|
+ accept_time as accept_time,
|
|
|
+ accept_user_id as accept_user_id,
|
|
|
+ accept_user_name as accept_user_name,
|
|
|
+ real_start_time as real_start_time,
|
|
|
+ real_end_time as real_end_time,
|
|
|
+ team_leader_id as team_leader_id,
|
|
|
+ team_leader_name as team_leader_name,
|
|
|
+ work_group_member_id as work_group_member_id,
|
|
|
+ work_group_member_name as work_group_member_name,
|
|
|
+ t.score as score,
|
|
|
+ (SELECT GROUP_CONCAT(CONCAT(p.nick_name, ':',
|
|
|
+ CASE
|
|
|
+ WHEN p.score = ROUND(p.score, 0) THEN CAST(ROUND(p.score, 0) AS CHAR)
|
|
|
+ ELSE TRIM(TRAILING '.0' FROM CAST(ROUND(p.score, 1) AS CHAR))
|
|
|
+ END
|
|
|
+ ) SEPARATOR ',')
|
|
|
+ FROM gxt_repair_order_person p
|
|
|
+ WHERE p.order_id = t.id AND p.is_leader = 0 AND p.score IS NOT NULL) as workGroupMemberScore,
|
|
|
+ review_content as review_content,
|
|
|
+ suspend_reason as suspend_reason,
|
|
|
+ restart_time as restart_time,
|
|
|
+ priority_type as priority_type,
|
|
|
+ real_end_time as work_end_time,
|
|
|
+ scoring_status as scoring_status,
|
|
|
+ content as work_summary,
|
|
|
+ maintenance_type as maintenance_type,
|
|
|
+ null as inspection_type,
|
|
|
+ null as plan_start_time,
|
|
|
+ null as plan_end_time,
|
|
|
+ plan_hour as plan_hour,
|
|
|
+ fault_code as fault_code,
|
|
|
+ fault_desc as fault_desc,
|
|
|
+ occur_time as occur_time,
|
|
|
+ null as suspend_time,
|
|
|
+ null as pause_reason,
|
|
|
+ null as pause_time,
|
|
|
+ null as complete_time,
|
|
|
+ review_score_num as review_score_num,
|
|
|
+ final_coefficient as final_coefficient,
|
|
|
+ t.feedback_reason as feedback_reason,
|
|
|
+ t.confirm_status as confirm_status,
|
|
|
+ t.create_time as create_time,
|
|
|
+ t.update_time as update_time,
|
|
|
+ t.appeal_reason as appeal_reason,
|
|
|
+ t.score_return_reason as score_return_reason,
|
|
|
+ t.wwry_num as wwry_num,
|
|
|
+ t.wlry_num as wlry_num,
|
|
|
+ t.work_permit_num as work_permit_num,
|
|
|
+ t.mis_order_no as misOrderNo,
|
|
|
+ t.fault_barcode as faultBarcode,
|
|
|
+ t.real_failure_reason as realFailureReason,
|
|
|
+ t.lost_power as lostPower,
|
|
|
+ (SELECT dict.dict_label FROM sys_dict_data dict
|
|
|
+ WHERE dict.dict_type = 'gxt_reset_method' AND dict.dict_value = t.reset_method) as resetMethod,
|
|
|
+ extra_work as extraWork,
|
|
|
+ (SELECT GROUP_CONCAT(dict.dict_label SEPARATOR ',')
|
|
|
+ FROM sys_dict_data dict
|
|
|
+ WHERE dict.dict_type = 'gxt_work_area'
|
|
|
+ AND FIND_IN_SET(dict.dict_value, t.work_area)) as workArea,
|
|
|
+ null as itemCompletionFactorSum,
|
|
|
+ null as itemCompletionFactor,
|
|
|
+ f1.action_time as selfRatingTime,
|
|
|
+ f2.action_time as reviewRatingTime,
|
|
|
+ (SELECT dict.dict_label FROM sys_dict_data dict
|
|
|
+ WHERE dict.dict_type = 'gxt_finalize_method' AND dict.dict_value = t.finalize_method) as finalizeMethod,
|
|
|
+ p.score as teamLeaderScore,
|
|
|
+ ROUND(TIMESTAMPDIFF( SECOND, t.occur_time, t.assign_time ) / 3600,2) AS issueHour,
|
|
|
+ ROUND(( TIMESTAMPDIFF( SECOND, t.assign_time, t.accept_time ) - IFNULL(gq.total_night_auto_suspend_seconds, 0))/ 3600,2) AS acceptHour,
|
|
|
+ ROUND((TIMESTAMPDIFF( SECOND, t.accept_time, t.real_start_time ) - IFNULL(gq.total_before_start_suspend_seconds, 0)) / 3600,2) AS prepareHour,
|
|
|
+ ROUND(TIMESTAMPDIFF( SECOND, t.occur_time, t.restart_time ) / 3600,2) AS downtimeHour,
|
|
|
+ ROUND(TIMESTAMPDIFF( SECOND, t.real_end_time, t.restart_time ) / 3600,2) AS restartHour,
|
|
|
+ ROUND((TIMESTAMPDIFF( SECOND, t.real_start_time, t.real_end_time ) - IFNULL(gq.total_in_work_suspend_seconds, 0)) / 3600,2) AS workHour,
|
|
|
+ ROUND(CASE WHEN gq.order_id IS NOT NULL THEN (gq.total_before_start_suspend_seconds + gq.total_in_work_suspend_seconds + gq.total_night_auto_suspend_seconds)/3600 ELSE 0 END,2) AS suspendHour
|
|
|
+ FROM gxt_repair_order t
|
|
|
+ LEFT JOIN gxt_repair_order_flow_records_next gq ON gq.order_id = t.id
|
|
|
+ LEFT JOIN gxt_repair_order_person p ON p.order_id = t.id and p.is_leader = 1
|
|
|
+ LEFT JOIN gxt_repair_order_flow f1 ON f1.order_id = t.id and f1.action_type = 'selfRating'
|
|
|
+ LEFT JOIN gxt_repair_order_flow f2 ON f2.order_id = t.id and f2.action_type = 'reviewRating'
|
|
|
+
|
|
|
+ <where>
|
|
|
+ <if test="repairOrder.workOrderProjectNo != null and repairOrder.workOrderProjectNo != ''"> and work_order_project_no like concat('%', #{repairOrder.workOrderProjectNo}, '%')</if>
|
|
|
+ <if test="repairOrder.workOrderStatus != null and repairOrder.workOrderStatus != ''"> and work_order_status = #{repairOrder.workOrderStatus}</if>
|
|
|
+ <if test="repairOrder.gxtCenterId != null"> and gxt_center_id = #{repairOrder.gxtCenterId}</if>
|
|
|
+ <if test="repairOrder.gxtCenter != null and repairOrder.gxtCenter != ''"> and gxt_center = #{repairOrder.gxtCenter}</if>
|
|
|
+ <if test="repairOrder.pcsStationId != null"> and pcs_station_id = #{repairOrder.pcsStationId}</if>
|
|
|
+ <if test="repairOrder.pcsStationName != null and repairOrder.pcsStationName != ''"> and pcs_station_name = #{repairOrder.pcsStationName}</if>
|
|
|
+ <if test="repairOrder.pcsDeviceId != null"> and pcs_device_id = #{repairOrder.pcsDeviceId}</if>
|
|
|
+ <if test="repairOrder.pcsDeviceName != null and repairOrder.pcsDeviceName != ''"> and pcs_device_name like concat('%', #{repairOrder.pcsDeviceName}, '%')</if>
|
|
|
+ <if test="repairOrder.teamLeaderName != null and repairOrder.teamLeaderName != ''"> and team_leader_name like concat('%', #{repairOrder.teamLeaderName}, '%')</if>
|
|
|
+ <if test="repairOrder.scoringStatus != null and repairOrder.scoringStatus != ''"> and scoring_status in
|
|
|
+ <foreach collection="repairOrder.scoringStatus.split(',')" item="status" open="(" close=")" separator=",">
|
|
|
+ #{status}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="repairOrder.orderType != null"> and order_type = #{repairOrder.orderType}</if>
|
|
|
+ <if test="repairOrder.beginOccurTime != null and repairOrder.beginOccurTime != ''"> and date_format(occur_time,'%y%m%d') >= date_format(#{repairOrder.beginOccurTime},'%y%m%d')</if>
|
|
|
+ <if test="repairOrder.endOccurTime != null and repairOrder.endOccurTime != ''"> and date_format(occur_time,'%y%m%d') <= date_format(#{repairOrder.endOccurTime},'%y%m%d')</if>
|
|
|
+ <if test="repairOrder.repairMethod != null and repairOrder.repairMethod != ''"> and repair_method = #{repairOrder.repairMethod}</if>
|
|
|
+ <if test="repairOrder.faultCode != null and repairOrder.faultCode != ''"> and fault_code like concat('%', #{repairOrder.faultCode}, '%')</if>
|
|
|
+
|
|
|
+<!-- <if test="repairOrder.orderType != null and repairOrder.orderType != ''"> and 1 = #{repairOrder.orderType}</if>-->
|
|
|
+ AND work_order_status != 'invalid'
|
|
|
+ <!-- 业务特定数据权限过滤条件 -->
|
|
|
+ <if test="repairOrder.params.businessDataScope != null and repairOrder.params.businessDataScope != ''">
|
|
|
+ ${repairOrder.params.businessDataScope}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+
|
|
|
+ UNION ALL
|
|
|
+
|
|
|
+ SELECT
|
|
|
+ 2 as order_type,
|
|
|
+ work_order_project_no as work_order_project_no,
|
|
|
+ (SELECT dict.dict_label FROM sys_dict_data dict
|
|
|
+ WHERE dict.dict_type = 'gxt_work_order_status' AND dict.dict_value = t.work_order_status) as work_order_status,
|
|
|
+ gxt_center_id as gxt_center_id,
|
|
|
+ gxt_center as gxt_center,
|
|
|
+ pcs_station_id as pcs_station_id,
|
|
|
+ pcs_station_pid as pcs_station_pid,
|
|
|
+ pcs_station_name as pcs_station_name,
|
|
|
+ pcs_device_id as pcs_device_id,
|
|
|
+ pcs_device_name as pcs_device_name,
|
|
|
+ brand as brand,
|
|
|
+ model as model,
|
|
|
+ assign_time as assign_time,
|
|
|
+ assign_user_id as assign_user_id,
|
|
|
+ assign_user_name as assign_user_name,
|
|
|
+ accept_time as accept_time,
|
|
|
+ accept_user_id as accept_user_id,
|
|
|
+ accept_user_name as accept_user_name,
|
|
|
+ real_start_time as real_start_time,
|
|
|
+ real_end_time as real_end_time,
|
|
|
+ team_leader_id as team_leader_id,
|
|
|
+ team_leader_name as team_leader_name,
|
|
|
+ work_group_member_id as work_group_member_id,
|
|
|
+ work_group_member_name as work_group_member_name,
|
|
|
+ t.score as score,
|
|
|
+ (SELECT GROUP_CONCAT(CONCAT(p.nick_name, ':',
|
|
|
+ CASE
|
|
|
+ WHEN p.score = ROUND(p.score, 0) THEN CAST(ROUND(p.score, 0) AS CHAR)
|
|
|
+ ELSE TRIM(TRAILING '.0' FROM CAST(ROUND(p.score, 1) AS CHAR))
|
|
|
+ END
|
|
|
+ ) SEPARATOR ',')
|
|
|
+ FROM gxt_work_order_person p
|
|
|
+ WHERE p.order_id = t.id AND p.is_leader = 0 AND p.score IS NOT NULL) as workGroupMemberScore,
|
|
|
+ review_content as review_content,
|
|
|
+ suspend_reason as suspend_reason,
|
|
|
+ restart_time as restart_time,
|
|
|
+ priority_type as priority_type,
|
|
|
+ real_end_time as work_end_time,
|
|
|
+ scoring_status as scoring_status,
|
|
|
+ real_content as work_summary,
|
|
|
+ null as maintenance_type,
|
|
|
+ (SELECT dict.dict_label FROM sys_dict_data dict
|
|
|
+ WHERE dict.dict_type = 'gxt_inspection_type' AND dict.dict_value = t.inspection_type) as inspection_type,
|
|
|
+ plan_start_time as plan_start_time,
|
|
|
+ plan_end_time as plan_end_time,
|
|
|
+ plan_hour as plan_hour,
|
|
|
+ fault_code as fault_code,
|
|
|
+ fault_desc as fault_desc,
|
|
|
+ null as occur_time,
|
|
|
+ suspend_time as suspend_time,
|
|
|
+ pause_reason as pause_reason,
|
|
|
+ pause_time as pause_time,
|
|
|
+ complete_time as complete_time,
|
|
|
+ review_score_num as review_score_num,
|
|
|
+ final_coefficient as final_coefficient,
|
|
|
+ t.feedback_reason as feedback_reason,
|
|
|
+ t.confirm_status as confirm_status,
|
|
|
+ t.create_time as create_time,
|
|
|
+ t.update_time as update_time,
|
|
|
+ null as appeal_reason,
|
|
|
+ t.score_return_reason as score_return_reason,
|
|
|
+ t.wwry_num as wwry_num,
|
|
|
+ t.wlry_num as wlry_num,
|
|
|
+ t.work_permit_num as work_permit_num,
|
|
|
+ t.mis_no as misOrderNo,
|
|
|
+ null as faultBarcode,
|
|
|
+ null as realFailureReason,
|
|
|
+ lost_power as lostPower,
|
|
|
+ null as resetMethod,
|
|
|
+ null as extraWork,
|
|
|
+ null as workArea,
|
|
|
+ item_completion_factor_sum as itemCompletionFactorSum,
|
|
|
+ item_completion_factor as itemCompletionFactor,
|
|
|
+ f1.action_time as selfRatingTime,
|
|
|
+ f2.action_time as reviewRatingTime,
|
|
|
+ (SELECT dict.dict_label FROM sys_dict_data dict
|
|
|
+ WHERE dict.dict_type = 'gxt_finalize_method' AND dict.dict_value = t.finalize_method) as finalizeMethod,
|
|
|
+ p.score as teamLeaderScore,
|
|
|
+ ROUND(TIMESTAMPDIFF( SECOND, t.create_time, t.assign_time ) / 3600,2) AS issueHour,
|
|
|
+ ROUND(TIMESTAMPDIFF( SECOND, t.assign_time, t.accept_time ) / 3600,2) AS acceptHour,
|
|
|
+ ROUND((TIMESTAMPDIFF( SECOND, t.accept_time, t.real_start_time ) - IFNULL(gq.total_before_start_suspend_seconds, 0)) / 3600,2) AS prepareHour,
|
|
|
+ ROUND(TIMESTAMPDIFF( SECOND, COALESCE ( t.pause_time, t.real_start_time ), t.restart_time ) / 3600,2) AS downtimeHour,
|
|
|
+ ROUND(TIMESTAMPDIFF( SECOND, t.real_end_time, t.restart_time ) / 3600,2) AS restartHour,
|
|
|
+ ROUND(( TIMESTAMPDIFF( SECOND, t.real_start_time, t.real_end_time ) - IFNULL(gq.total_in_work_suspend_seconds, 0)) / 3600,2) AS workHour,
|
|
|
+ ROUND(CASE WHEN gq.order_id IS NOT NULL THEN (gq.total_before_start_suspend_seconds + gq.total_in_work_suspend_seconds + gq.total_night_auto_suspend_seconds)/3600 ELSE 0 END,2) AS suspendHour
|
|
|
+ FROM gxt_work_order t
|
|
|
+ LEFT JOIN gxt_work_order_flow_records_next gq ON gq.order_id = t.id
|
|
|
+ LEFT JOIN gxt_work_order_person p ON p.order_id = t.id and p.is_leader = 1
|
|
|
+ LEFT JOIN gxt_work_order_flow f1 ON f1.order_id = t.id and f1.action_type = 'selfRating'
|
|
|
+ LEFT JOIN gxt_work_order_flow f2 ON f2.order_id = t.id and f2.action_type = 'reviewRating'
|
|
|
+ <where>
|
|
|
+ <if test="workOrder.workOrderProjectNo != null and workOrder.workOrderProjectNo != ''"> and work_order_project_no like concat('%', #{workOrder.workOrderProjectNo}, '%')</if>
|
|
|
+ <if test="workOrder.workOrderStatus != null and workOrder.workOrderStatus != ''"> and work_order_status = #{workOrder.workOrderStatus}</if>
|
|
|
+ <if test="workOrder.gxtCenterId != null"> and gxt_center_id = #{workOrder.gxtCenterId}</if>
|
|
|
+ <if test="workOrder.gxtCenter != null and workOrder.gxtCenter != ''"> and gxt_center = #{workOrder.gxtCenter}</if>
|
|
|
+ <if test="workOrder.pcsStationId != null"> and pcs_station_id = #{workOrder.pcsStationId}</if>
|
|
|
+ <if test="workOrder.pcsStationName != null and workOrder.pcsStationName != ''"> and pcs_station_name = #{workOrder.pcsStationName}</if>
|
|
|
+ <if test="workOrder.pcsDeviceId != null"> and pcs_device_id = #{workOrder.pcsDeviceId}</if>
|
|
|
+ <if test="workOrder.pcsDeviceName != null and workOrder.pcsDeviceName != ''"> and pcs_device_name like concat('%', #{workOrder.pcsDeviceName}, '%')</if>
|
|
|
+ <if test="workOrder.teamLeaderName != null and workOrder.teamLeaderName != ''"> and team_leader_name like concat('%', #{workOrder.teamLeaderName}, '%')</if>
|
|
|
+ <if test="workOrder.scoringStatus != null and workOrder.scoringStatus != ''"> and scoring_status in
|
|
|
+ <foreach collection="workOrder.scoringStatus.split(',')" item="status" open="(" close=")" separator=",">
|
|
|
+ #{status}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="workOrder.orderType != null"> and order_type = #{workOrder.orderType}</if>
|
|
|
+ <if test="workOrder.beginCreateTime != null and workOrder.beginCreateTime != ''"> and date_format(t.create_time,'%y%m%d') >= date_format(#{workOrder.beginCreateTime},'%y%m%d')</if>
|
|
|
+ <if test="workOrder.endCreateTime != null and workOrder.endCreateTime != ''"> and date_format(t.create_time,'%y%m%d') <= date_format(#{workOrder.endCreateTime},'%y%m%d')</if>
|
|
|
+<!-- <if test="workOrder.orderType != null and workOrder.orderType != ''"> and 2 = #{workOrder.orderType}</if>-->
|
|
|
+ AND work_order_status != 'invalid'
|
|
|
+ <!-- 业务特定数据权限过滤条件 -->
|
|
|
+ <if test="workOrder.params.businessDataScope != null and workOrder.params.businessDataScope != ''">
|
|
|
+ ${workOrder.params.businessDataScope}
|
|
|
+ </if>
|
|
|
+ </where>
|
|
|
+ ) t
|
|
|
+ ORDER BY COALESCE(update_time, create_time) DESC, create_time DESC
|
|
|
+ </select>
|
|
|
</mapper>
|