|
|
|
@ -2475,4 +2475,286 @@ |
|
|
|
left join site as c on a.site = c.siteid |
|
|
|
WHERE a.username = #{username} |
|
|
|
</select> |
|
|
|
|
|
|
|
<select id="eamCheckRecordSearch" parameterType="com.jianteng.modules.pms.data.EamWorkOrderInData" resultType="com.jianteng.modules.pms.data.EamWorkOrderInData"> |
|
|
|
SELECT |
|
|
|
a.Site, |
|
|
|
a.bu_no, |
|
|
|
dbo.get_bu_desc(a.site, a.bu_no) as buDesc, |
|
|
|
a.OrderNo, |
|
|
|
a.PlanID, |
|
|
|
a.PlanDesc, |
|
|
|
a.PropertiesCode, |
|
|
|
a.ObjectID, |
|
|
|
a.Status, |
|
|
|
a.PlanOperator, |
|
|
|
a.checker, |
|
|
|
a.ActualOperator, |
|
|
|
a.PlanDate, |
|
|
|
a.ActualDate, |
|
|
|
a.FunctionType, |
|
|
|
a.CreateDate, |
|
|
|
d.operatorName as createBy, |
|
|
|
a.Remark, |
|
|
|
a.StartTime, |
|
|
|
a.EndTime, |
|
|
|
a.WorkTime, |
|
|
|
a.PlanOperatorName, |
|
|
|
a.checkerName, |
|
|
|
dbo.eam_Get_eamAdminName(a.Site, a.ActualOperator) ActualOperatorName, |
|
|
|
dbo.eam_Get_eamObjectDesc(a.Site, a.bu_no, a.ObjectID) objectDesc, |
|
|
|
dbo.eam_Get_eam_properties_CodeDesc(a.site, a.bu_no, a.FunctionType, a.PropertiesCode) codeDesc, |
|
|
|
a.result, |
|
|
|
b.urgency, |
|
|
|
a.checkResult, |
|
|
|
b.DefectID, |
|
|
|
c.DefectDesc, |
|
|
|
a.disposal_measures, |
|
|
|
a.check_work_plan_id, |
|
|
|
a.check_item_no, |
|
|
|
a.reach_date, |
|
|
|
a.reach_operator, |
|
|
|
a.reach_operator_name, |
|
|
|
b.FeedBackDesc, |
|
|
|
dbo.joint_id(a.Site, a.bu_no, a.OrderNo, a.FunctionType) as adminID, |
|
|
|
dbo.joint_name(a.Site, a.bu_no, a.OrderNo, a.FunctionType) as operator, |
|
|
|
a.check_remark, |
|
|
|
a.document_source, |
|
|
|
ewi.ItemNo, |
|
|
|
ewi.ItemDesc, |
|
|
|
ewi.DefaultValue, |
|
|
|
ewi.ValueType, |
|
|
|
ewi.ValueType_DB, |
|
|
|
ewi.ValueChooseFlag, |
|
|
|
ewi.MaxValue, |
|
|
|
ewi.MinValue, |
|
|
|
ewi.ItemRemark, |
|
|
|
ewi.ItemType, |
|
|
|
ewi.TextValue, |
|
|
|
ewi.NumberValue, |
|
|
|
ewi.CreatedDate, |
|
|
|
ewi.CreatedBy, |
|
|
|
ewi.FinishFlag, |
|
|
|
ewi.itemResult, |
|
|
|
ewi.item_notes |
|
|
|
FROM eam_workOrder a |
|
|
|
left join eam_workOrder_item ewi on a.site = ewi.site and a.OrderNo = ewi.OrderNo and a.bu_no = ewi.bu_no |
|
|
|
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.operatorID and d.active = 'Y' |
|
|
|
left join eam_object as eo on eo.site = a.site and eo.ObjectID = a.ObjectID and eo.bu_no = a.bu_no |
|
|
|
left join sys_department as sd ON eo.site = sd.site and eo.dept_id = sd.department_id and eo.bu_no = sd.bu_no |
|
|
|
left join Access_dept as ead ON ead.site = sd.site and ead.department_id = sd.department_id and ead.bu_no = sd.bu_no |
|
|
|
left join sys_user as ea on ead.username = ea.username |
|
|
|
left join eam_workPlan_overview as ewo on a.site = ewo.site and a.PlanID = ewo.plan_id and a.bu_no = ewo.bu_no |
|
|
|
<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.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.planDesc != null and query.planDesc != ''"> |
|
|
|
AND a.PlanDesc like '%' + #{query.planDesc} +'%' |
|
|
|
</if> |
|
|
|
<if test="query.objectID != null and query.objectID != ''"> |
|
|
|
AND a.ObjectID like '%' + #{query.objectID} +'%' |
|
|
|
</if> |
|
|
|
<if test="query.planOperatorName != null and query.planOperatorName != ''"> |
|
|
|
AND a.PlanOperatorName like '%' + #{query.planOperatorName} +'%' |
|
|
|
</if> |
|
|
|
<if test='(query.status == null || query.status == "") and query.functionType == "A" and query.searchType == "checkOrder" '> |
|
|
|
AND a.status != '已取消' |
|
|
|
</if> |
|
|
|
<if test='query.status != null and query.status != "" and query.functionType == "A" and query.searchType == "checkOrder" '> |
|
|
|
AND a.status = #{query.status} |
|
|
|
</if> |
|
|
|
<if test='query.functionType == "A" and query.searchType == "reportCheck" '> |
|
|
|
AND a.status = '未开工' |
|
|
|
</if> |
|
|
|
<if test='(query.status == null || query.status == "") and query.functionType == "B" and query.searchType == "maintenanceOrder" '> |
|
|
|
AND a.status != '已取消' |
|
|
|
</if> |
|
|
|
<if test='query.status != null and query.status != "" and query.functionType == "B" and query.searchType == "maintenanceOrder" '> |
|
|
|
AND a.status = #{query.status} |
|
|
|
</if> |
|
|
|
<if test='query.functionType == "B" and query.searchType == "reportMaintenance" '> |
|
|
|
AND (a.status = '未开工' or a.status = '已到达') |
|
|
|
</if> |
|
|
|
<if test='(query.status == null || query.status == "") and query.functionType == "C" and query.searchType == "reportDefect" '> |
|
|
|
AND (a.status = '未开工' or a.status = '已到达') |
|
|
|
</if> |
|
|
|
<if test='query.status != null and query.status != "" and query.functionType == "C" and query.searchType == "reportDefect" '> |
|
|
|
AND a.status = #{query.status} |
|
|
|
</if> |
|
|
|
<if test='query.documentSource != null and query.documentSource != "" and query.functionType == "C" and query.searchType == "reportDefect" '> |
|
|
|
AND a.document_source = #{query.documentSource} |
|
|
|
</if> |
|
|
|
<if test="query.planDate != null"> |
|
|
|
AND a.PlanDate = #{query.planDate} |
|
|
|
</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.endDate == null "> |
|
|
|
AND getDate() >= a.PlanDate |
|
|
|
</if> |
|
|
|
<if test='query.functionType == "A"'> |
|
|
|
and getDate() >= dbo.compare_date(ewo.task_start_date) |
|
|
|
</if> |
|
|
|
<if test="query.reachDate != null "> |
|
|
|
AND a.reach_date >= #{query.reachDate} |
|
|
|
</if> |
|
|
|
<if test="query.actualDate != null "> |
|
|
|
AND #{query.actualDate} >= a.ActualDate |
|
|
|
</if> |
|
|
|
<if test="query.itemNo != null and query.itemNo != ''"> |
|
|
|
AND ewi.ItemNo like '%' + #{query.itemNo} +'%' |
|
|
|
</if> |
|
|
|
<if test="query.itemDesc != null and query.itemDesc != ''"> |
|
|
|
AND ewi.ItemDesc like '%' + #{query.itemDesc} +'%' |
|
|
|
</if> |
|
|
|
AND a.FunctionType = #{query.functionType} |
|
|
|
</where> |
|
|
|
ORDER BY a.CreateDate, |
|
|
|
CASE WHEN b.urgency = '特急' THEN 1 |
|
|
|
WHEN b.urgency = '紧急' THEN 2 |
|
|
|
WHEN b.urgency = '一般' THEN 3 |
|
|
|
END |
|
|
|
</select> |
|
|
|
|
|
|
|
<select id="eamDefectRecordSearch" parameterType="com.jianteng.modules.pms.data.EamWorkOrderInData" resultType="com.jianteng.modules.pms.data.EamWorkOrderInData"> |
|
|
|
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, |
|
|
|
d.operatorName as createBy, |
|
|
|
a.Remark, |
|
|
|
a.StartTime, |
|
|
|
a.EndTime, |
|
|
|
a.WorkTime, |
|
|
|
dbo.eam_Get_eamAdminName(a.Site,a.PlanOperator) as planOperatorName, |
|
|
|
b.DefectID, |
|
|
|
c.DefectDesc, |
|
|
|
dbo.eam_Get_eamObjectDesc(a.Site, a.bu_no, a.ObjectID) 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, |
|
|
|
b.CreatedDate, |
|
|
|
a.handling_method, |
|
|
|
dbo.eam_Get_eamResourceDesc(a.Site, a.ObjectID) as resourceDesc, |
|
|
|
CASE |
|
|
|
WHEN (DATEDIFF(SECOND, b.CreatedDate, a.reach_date) <![CDATA[<]]> 60) THEN DATEDIFF(SECOND, b.CreatedDate, a.reach_date) / 60.0 |
|
|
|
ELSE DATEDIFF(MINUTE, b.CreatedDate, 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, |
|
|
|
ewi.ItemNo, |
|
|
|
ewi.ItemDesc, |
|
|
|
ewi.DefaultValue, |
|
|
|
ewi.ValueType, |
|
|
|
ewi.ValueType_DB, |
|
|
|
ewi.ValueChooseFlag, |
|
|
|
ewi.MaxValue, |
|
|
|
ewi.MinValue, |
|
|
|
ewi.ItemRemark, |
|
|
|
ewi.ItemType, |
|
|
|
ewi.TextValue, |
|
|
|
ewi.NumberValue, |
|
|
|
ewi.FinishFlag, |
|
|
|
ewi.itemResult, |
|
|
|
ewi.item_notes |
|
|
|
FROM eam_workOrder a |
|
|
|
left join eam_workOrder_item ewi on a.site = ewi.site and a.OrderNo = ewi.OrderNo and a.bu_no = ewi.bu_no |
|
|
|
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.operatorID and d.active = 'Y' |
|
|
|
left join eam_object as e on a.site = e.site and a.ObjectID = e.ObjectID and e.Active = 'Y' 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.reachDate != null "> |
|
|
|
AND a.reach_date >= #{query.reachDate} |
|
|
|
</if> |
|
|
|
<if test="query.actualDate != null "> |
|
|
|
AND #{query.actualDate} >= a.ActualDate |
|
|
|
</if> |
|
|
|
<if test="query.itemNo != null and query.itemNo != ''"> |
|
|
|
AND ewi.ItemNo like '%' + #{query.itemNo} +'%' |
|
|
|
</if> |
|
|
|
<if test="query.itemDesc != null and query.itemDesc != ''"> |
|
|
|
AND ewi.ItemDesc like '%' + #{query.itemDesc} +'%' |
|
|
|
</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> |
|
|
|
</mapper> |