|
|
|
@ -4341,6 +4341,132 @@ |
|
|
|
</where> |
|
|
|
ORDER BY a.CreateDate |
|
|
|
</select> |
|
|
|
<select id="eamWorkOrderSearchForDefectExport" |
|
|
|
resultType="com.xujie.sys.modules.pms.data.EamWorkOrderExportData"> |
|
|
|
SELECT |
|
|
|
a.Site, |
|
|
|
a.bu_no, |
|
|
|
dbo.get_bu_desc(a.site, a.bu_no) as buDesc, |
|
|
|
a.OrderNo, |
|
|
|
a.PlanID, |
|
|
|
a.ObjectID, |
|
|
|
a.Status, |
|
|
|
a.PlanOperator, |
|
|
|
a.ActualOperator, |
|
|
|
a.PlanDate, |
|
|
|
a.ActualDate, |
|
|
|
a.FunctionType, |
|
|
|
a.CreateDate, |
|
|
|
dbo.eam_Get_eamAdminName_TPM(a.Site,b.CreatedBy) as createBy, |
|
|
|
a.Remark, |
|
|
|
a.StartTime, |
|
|
|
a.EndTime, |
|
|
|
a.WorkTime, |
|
|
|
dbo.eam_Get_eamAdminName_TPM(a.Site,a.PlanOperator) as planOperatorName, |
|
|
|
b.DefectID, |
|
|
|
c.DefectDesc, |
|
|
|
e.ObjectDesc as objectDesc, |
|
|
|
dbo.eam_Get_eam_properties_CodeDesc(a.site, a.bu_no, a.FunctionType, a.PropertiesCode) as codeDesc, |
|
|
|
a.result, |
|
|
|
b.urgency, |
|
|
|
a.disposal_measures, |
|
|
|
a.difficulty_level, |
|
|
|
a.difficulty_remark, |
|
|
|
f.department_name, |
|
|
|
a.reach_date, |
|
|
|
a.reach_operator, |
|
|
|
a.reach_operator_name, |
|
|
|
case when a.status = '已废弃' then null else b.CreatedDate end as CreatedDate, |
|
|
|
a.handling_method, |
|
|
|
dbo.eam_Get_eamResourceDesc(a.Site, a.ObjectID) as resourceDesc, |
|
|
|
CASE WHEN (DATEDIFF(SECOND, a.CreateDate, a.reach_date) <![CDATA[<]]> 60) THEN DATEDIFF(SECOND, a.CreateDate, a.reach_date) / 60.0 |
|
|
|
ELSE DATEDIFF(MINUTE, a.CreateDate, a.reach_date) |
|
|
|
END AS responseTime, |
|
|
|
b.FeedBackDesc, |
|
|
|
dbo.joint_name(a.Site,a.bu_no,a.OrderNo,a.FunctionType) as actualOperatorName, |
|
|
|
a.fault_reason, |
|
|
|
a.preventive_measure, |
|
|
|
a.document_source, |
|
|
|
a.repair_reporting_type, |
|
|
|
a.repair_type, |
|
|
|
a.confirm_assessment, |
|
|
|
a.confirm_remark, |
|
|
|
a.check_assessment, |
|
|
|
a.check_notes |
|
|
|
FROM eam_workOrder a |
|
|
|
left join eam_defect_feedBack b on a.site = b.site and a.PlanID = b.feedBackID and a.bu_no = b.bu_no |
|
|
|
left join eam_defect c on b.DefectID = c.DefectID |
|
|
|
left join operator as d on a.site = d.site and a.CreateBy = d.operator_id |
|
|
|
left join eam_object as e on a.site = e.site and a.ObjectID = e.ObjectID and a.bu_no = e.bu_no |
|
|
|
left join sys_department as f on e.site = f.site and e.dept_id = f.department_id and e.bu_no = f.bu_no |
|
|
|
left join Access_dept as ead ON ead.site = f.site and ead.department_id = f.department_id and ead.bu_no = f.bu_no |
|
|
|
left join sys_user as ea on ead.username = ea.username |
|
|
|
<where> |
|
|
|
a.site in (select site from eam_access_site where username = #{query.userName}) |
|
|
|
and (a.site + '-' + a.bu_no) in (select * from dbo.query_bu(#{query.userName})) |
|
|
|
and ea.username = #{query.userName} |
|
|
|
<if test="query.buDesc != null and query.buDesc != ''"> |
|
|
|
AND dbo.get_bu_desc ( a.site, a.bu_no ) = #{query.buDesc} |
|
|
|
</if> |
|
|
|
<if test="query.deptArr != null"> |
|
|
|
AND |
|
|
|
<foreach collection="query.deptArr" item="item" open="(" separator="or" close=")"> |
|
|
|
f.department_name like '%' + #{item} + '%' |
|
|
|
</foreach> |
|
|
|
</if> |
|
|
|
<if test="query.orderNo != null and query.orderNo != ''"> |
|
|
|
AND a.OrderNo like '%' + #{query.orderNo} +'%' |
|
|
|
</if> |
|
|
|
<if test="query.planID != null and query.planID != ''"> |
|
|
|
AND a.PlanID like '%' + #{query.planID} +'%' |
|
|
|
</if> |
|
|
|
<if test="query.objectID != null and query.objectID != ''"> |
|
|
|
AND a.ObjectID like '%' + #{query.objectID} +'%' |
|
|
|
</if> |
|
|
|
<if test="query.planOperator != null and query.planOperator != ''"> |
|
|
|
AND a.PlanOperator like '%' + #{query.planOperator} +'%' |
|
|
|
</if> |
|
|
|
<if test="query.status != null and query.status != ''"> |
|
|
|
AND a.status = #{query.status} |
|
|
|
</if> |
|
|
|
<if test="query.documentSource != null and query.documentSource != ''"> |
|
|
|
AND a.document_source = #{query.documentSource} |
|
|
|
</if> |
|
|
|
<if test="query.startDate != null "> |
|
|
|
AND a.PlanDate >= #{query.startDate} |
|
|
|
</if> |
|
|
|
<if test="query.endDate != null "> |
|
|
|
AND #{query.endDate} >= a.PlanDate |
|
|
|
</if> |
|
|
|
<if test="query.actualStartDate != null "> |
|
|
|
AND a.ActualDate >= #{query.actualStartDate} |
|
|
|
</if> |
|
|
|
<if test="query.actualEndDate != null "> |
|
|
|
AND DATEADD(DAY, 1, CONVERT(DATE, #{query.actualEndDate})) > a.ActualDate |
|
|
|
</if> |
|
|
|
<if test="query.urgency != null and query.urgency != ''"> |
|
|
|
AND b.urgency = #{query.urgency} |
|
|
|
</if> |
|
|
|
<if test="query.result != null and query.result != ''"> |
|
|
|
AND a.result = #{query.result} |
|
|
|
</if> |
|
|
|
<if test="query.repairReportingType != null and query.repairReportingType != ''"> |
|
|
|
AND a.repair_reporting_type = #{query.repairReportingType} |
|
|
|
</if> |
|
|
|
<if test="query.repairType != null and query.repairType != ''"> |
|
|
|
AND a.repair_type = #{query.repairType} |
|
|
|
</if> |
|
|
|
<if test="query.feedBackDesc != null and query.feedBackDesc != ''"> |
|
|
|
AND b.FeedBackDesc like '%' +#{query.feedBackDesc}+'%' |
|
|
|
</if> |
|
|
|
and a.FunctionType =#{query.functionType} |
|
|
|
</where> |
|
|
|
ORDER BY a.PlanDate, |
|
|
|
CASE WHEN b.urgency = '特急' THEN 1 |
|
|
|
WHEN b.urgency = '紧急' THEN 2 |
|
|
|
WHEN b.urgency = '一般' THEN 3 |
|
|
|
END |
|
|
|
</select> |
|
|
|
<insert id="saveSoundBoxEmailLog" parameterType="com.xujie.sys.modules.pms.entity.SoundBoxEmailLog"> |
|
|
|
insert into sound_box_email_log (site, component_part_no, notify_no, request_data, response_data, email, created_at, user_id, username) |
|
|
|
values (#{site}, #{componentPartNo}, #{notifyNo}, #{requestData}, #{responseData}, #{email}, #{createdAt}, #{userId}, #{username}) |
|
|
|
|