You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
3804 lines
170 KiB
3804 lines
170 KiB
<?xml version="1.0" encoding="UTF-8"?>
|
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
|
|
|
<mapper namespace="com.xujie.sys.modules.pms.mapper.EamMapper">
|
|
|
|
<select id="eamAdminSearch" parameterType="com.xujie.sys.modules.pms.data.EamAdminData" resultType="com.xujie.sys.modules.pms.data.EamAdminData">
|
|
SELECT distinct
|
|
ea.Site,
|
|
ea.AdminID,
|
|
ea.AdminName,
|
|
ea.Phone,
|
|
ea.Email,
|
|
ea.Tel,
|
|
ea.LevelID,
|
|
eal.AdminLevelDesc,
|
|
ea.MesUser,
|
|
ea.Active,
|
|
ea.CreatedDate,
|
|
ea.created_by,
|
|
ea.update_date,
|
|
ea.update_by
|
|
FROM eam_admin as ea
|
|
LEFT JOIN eam_adminLevel as eal ON ea.LevelID = eal.AdminLevelID and ea.site = eal.site
|
|
left join eam_admin_dept as ead on ea.site = ead.site and ea.AdminID = ead.admin_id
|
|
LEFT JOIN sys_department as ved ON ead.site = ved.site and ead.dept_id = ved.department_id
|
|
<where>
|
|
<if test="query.site != null and query.site != ''">
|
|
AND ea.site = #{query.site}
|
|
</if>
|
|
<if test="query.adminID != null and query.adminID != ''">
|
|
AND ea.adminID like '%' + #{query.adminID} +'%'
|
|
</if>
|
|
<if test="query.adminName != null and query.adminName != ''">
|
|
AND ea.adminName like '%' + #{query.adminName}+'%'
|
|
</if>
|
|
<if test="query.departmentName != null and query.departmentName != ''">
|
|
AND ved.department_name like '%' + #{query.departmentName}+'%'
|
|
</if>
|
|
<if test="query.active != null and query.active != ''">
|
|
AND ea.active = #{query.active}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="eamAdminSearch2" parameterType="com.xujie.sys.modules.pms.data.EamAdminData" resultType="com.xujie.sys.modules.pms.data.EamAdminData">
|
|
SELECT distinct
|
|
ea.Site,
|
|
ea.bu_no,
|
|
dbo.get_bu_desc(ea.Site, ea.bu_no) as buDesc,
|
|
ea.AdminID,
|
|
ea.AdminName,
|
|
ea.Phone,
|
|
ea.Email,
|
|
ea.Tel,
|
|
ea.LevelID,
|
|
eal.AdminLevelDesc,
|
|
ea.MesUser,
|
|
ea.Active,
|
|
ea.CreatedDate,
|
|
ea.created_by,
|
|
ea.update_date,
|
|
ea.update_by
|
|
FROM eam_admin as ea
|
|
LEFT JOIN eam_adminLevel as eal ON ea.LevelID = eal.AdminLevelID and ea.site = eal.site and ea.bu_no = eal.bu_no
|
|
left join eam_admin_dept as ead on ea.site = ead.site and ea.AdminID = ead.admin_id and ea.bu_no = ead.bu_no
|
|
LEFT JOIN sys_department as ved ON ead.site = ved.site and ead.dept_id = ved.department_id and ead.bu_no = ved.bu_no
|
|
<where>
|
|
ea.site in (select site from eam_access_site where username = #{userName})
|
|
and (ea.site + '-' + ea.bu_no) in (select * from dbo.query_bu(#{query.userName}))
|
|
<if test="adminID != null and adminID != ''">
|
|
AND ea.adminID like '%' + #{adminID} +'%'
|
|
</if>
|
|
<if test="adminName != null and adminName != ''">
|
|
AND ea.adminName like '%' + #{adminName}+'%'
|
|
</if>
|
|
<if test="departmentName != null and departmentName != ''">
|
|
AND ved.department_name like '%' + #{departmentName}+'%'
|
|
</if>
|
|
<if test="active != null and active != ''">
|
|
AND ea.active = #{active}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="eamFamilySearch" parameterType="com.xujie.sys.modules.pms.data.EamFamilyData" resultType="com.xujie.sys.modules.pms.data.EamFamilyData">
|
|
SELECT
|
|
Site,
|
|
bu_no,
|
|
dbo.get_bu_desc(site, bu_no) as buDesc,
|
|
FamilyID,
|
|
FamilyDesc,
|
|
Active,
|
|
case when active = 'Y' then '是' when active = 'N' then '否' else '' end as activeDesc,
|
|
create_date,
|
|
create_by,
|
|
dbo.getOperatorDesc(site, create_by) as createByDesc,
|
|
update_date,
|
|
update_by,
|
|
dbo.getOperatorDesc(site, update_by) as updateByDesc
|
|
FROM eam_family
|
|
<where>
|
|
site in (select site from eam_access_site where username = #{query.userName})
|
|
and (site + '-' + bu_no) in (select * from dbo.query_bu(#{query.userName}))
|
|
<if test="query.buDesc != null and query.buDesc != ''">
|
|
AND dbo.get_bu_desc ( site, bu_no ) = #{query.buDesc}
|
|
</if>
|
|
<if test="query.familyID != null and query.familyID != ''">
|
|
AND familyID like '%' + #{query.familyID} +'%'
|
|
</if>
|
|
<if test="query.familyDesc != null and query.familyDesc != ''">
|
|
AND familyDesc like '%' + #{query.familyDesc} +'%'
|
|
</if>
|
|
<if test="query.active != null and query.active != ''">
|
|
AND active = #{query.active}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="eamGroupSearch" parameterType="com.xujie.sys.modules.pms.data.EamGroupData" resultType="com.xujie.sys.modules.pms.data.EamGroupData">
|
|
SELECT
|
|
Site,
|
|
bu_no,
|
|
dbo.get_bu_desc(site, bu_no) as buDesc,
|
|
GroupID,
|
|
GroupDesc,
|
|
Active,
|
|
case when active = 'Y' then '是' when active = 'N' then '否' else '' end as activeDesc,
|
|
create_date,
|
|
create_by,
|
|
dbo.getOperatorDesc(site, create_by) as createByDesc,
|
|
update_date,
|
|
update_by,
|
|
dbo.getOperatorDesc(site, update_by) as updateByDesc
|
|
FROM eam_group
|
|
<where>
|
|
site in (select site from eam_access_site where username = #{query.userName})
|
|
and (site + '-' + bu_no) in (select * from dbo.query_bu(#{query.userName}))
|
|
<if test="query.buDesc != null and query.buDesc != ''">
|
|
AND dbo.get_bu_desc ( site, bu_no ) = #{query.buDesc}
|
|
</if>
|
|
<if test="query.groupID != null and query.groupID != ''">
|
|
AND groupID like '%' + #{query.groupID} + '%'
|
|
</if>
|
|
<if test="query.groupDesc != null and query.groupDesc != ''">
|
|
AND groupDesc like '%' + #{query.groupDesc} + '%'
|
|
</if>
|
|
<if test="query.active != null and query.active != ''">
|
|
AND active = #{query.active}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="eamLocationSearch" parameterType="com.xujie.sys.modules.pms.data.EamLocationData" resultType="com.xujie.sys.modules.pms.data.EamLocationData">
|
|
SELECT
|
|
Site,
|
|
bu_no,
|
|
dbo.get_bu_desc(site, bu_no) as buDesc,
|
|
LocationID,
|
|
LocationName,
|
|
Active,
|
|
case when active = 'Y' then '是' when active = 'N' then '否' else '' end as activeDesc,
|
|
create_date,
|
|
create_by,
|
|
dbo.getOperatorDesc(site, create_by) as createByDesc,
|
|
update_date,
|
|
update_by,
|
|
dbo.getOperatorDesc(site, update_by) as updateByDesc
|
|
FROM eam_location
|
|
<where>
|
|
site in (select site from eam_access_site where username = #{query.userName})
|
|
and (site + '-' + bu_no) in (select * from dbo.query_bu(#{query.userName}))
|
|
<if test="query.buDesc != null and query.buDesc != ''">
|
|
AND dbo.get_bu_desc ( site, bu_no ) = #{query.buDesc}
|
|
</if>
|
|
<if test="query.locationID != null and query.locationID != ''">
|
|
AND locationID like '%' + #{query.locationID} +'%'
|
|
</if>
|
|
<if test="query.locationName != null and query.locationName != ''">
|
|
AND locationName like '%' + #{query.locationName} +'%'
|
|
</if>
|
|
<if test="query.active != null and query.active != ''">
|
|
AND active = #{query.active}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="eamManufacturerSearch" parameterType="com.xujie.sys.modules.pms.data.EamManufacturerData" resultType="com.xujie.sys.modules.pms.data.EamManufacturerData">
|
|
SELECT
|
|
Site,
|
|
bu_no,
|
|
dbo.get_bu_desc(site, bu_no) as buDesc,
|
|
ManufacturerID,
|
|
ManufacturerName,
|
|
Active,
|
|
case when active = 'Y' then '是' when active = 'N' then '否' else '' end as activeDesc,
|
|
Contact,
|
|
Phone,
|
|
Address,
|
|
Email,
|
|
Remark,
|
|
create_date,
|
|
create_by,
|
|
dbo.getOperatorDesc(site, create_by) as createByDesc,
|
|
update_date,
|
|
update_by,
|
|
dbo.getOperatorDesc(site, update_by) as updateByDesc
|
|
FROM eam_manufacturer
|
|
<where>
|
|
site in (select site from eam_access_site where username = #{query.userName})
|
|
and (site + '-' + bu_no) in (select * from dbo.query_bu(#{query.userName}))
|
|
<if test="query.buDesc != null and query.buDesc != ''">
|
|
AND dbo.get_bu_desc ( site, bu_no ) = #{query.buDesc}
|
|
</if>
|
|
<if test="query.manufacturerID != null and query.manufacturerID != ''">
|
|
AND manufacturerID like '%' + #{query.manufacturerID} +'%'
|
|
</if>
|
|
<if test="query.manufacturerName != null and query.manufacturerName != ''">
|
|
AND manufacturerName like '%' + #{query.manufacturerName} +'%'
|
|
</if>
|
|
<if test="query.active != null and query.active != ''">
|
|
AND active = #{query.active}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="eamAdminLevelSearch" parameterType="com.xujie.sys.modules.pms.data.EamAdminLevelData" resultType="com.xujie.sys.modules.pms.data.EamAdminLevelData">
|
|
SELECT
|
|
Site,
|
|
bu_no,
|
|
dbo.get_bu_desc(site, bu_no) as buDesc,
|
|
AdminLevelID,
|
|
AdminLevelDesc,
|
|
Active,
|
|
case when active = 'Y' then '是' when active = 'N' then '否' else '' end as activeDesc,
|
|
create_date,
|
|
create_by,
|
|
dbo.getOperatorDesc(site, create_by) as createByDesc,
|
|
update_date,
|
|
update_by,
|
|
dbo.getOperatorDesc(site, update_by) as updateByDesc
|
|
FROM eam_adminLevel
|
|
<where>
|
|
site in (select site from eam_access_site where username = #{query.userName})
|
|
and (site + '-' + bu_no) in (select * from dbo.query_bu(#{query.userName}))
|
|
<if test="query.buDesc != null and query.buDesc != ''">
|
|
AND dbo.get_bu_desc ( site, bu_no ) = #{query.buDesc}
|
|
</if>
|
|
<if test="query.adminLevelID != null and query.adminLevelID != ''">
|
|
AND adminLevelID like '%' + #{query.adminLevelID} +'%'
|
|
</if>
|
|
<if test="query.adminLevelDesc != null and query.adminLevelDesc != ''">
|
|
AND adminLevelDesc like '%' + #{query.adminLevelDesc}+'%'
|
|
</if>
|
|
<if test="query.active != null and query.active != ''">
|
|
AND active = #{query.active}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="eamSupplierSearch" parameterType="com.xujie.sys.modules.pms.data.EamSupplierData" resultType="com.xujie.sys.modules.pms.data.EamSupplierData">
|
|
SELECT
|
|
Site,
|
|
bu_no,
|
|
dbo.get_bu_desc(site, bu_no) as buDesc,
|
|
SupplierID,
|
|
SupplierName,
|
|
[Group],
|
|
Active,
|
|
case when active = 'Y' then '是' when active = 'N' then '否' else '' end as activeDesc,
|
|
Contact,
|
|
Phone,
|
|
Address,
|
|
Email,
|
|
Remark,
|
|
create_date,
|
|
dbo.getOperatorDesc(site, create_by) as createByDesc,
|
|
update_date,
|
|
update_by,
|
|
dbo.getOperatorDesc(site, update_by) as updateByDesc
|
|
FROM eam_supplier
|
|
<where>
|
|
site in (select site from eam_access_site where username = #{query.userName})
|
|
and (site + '-' + bu_no) in (select * from dbo.query_bu(#{query.userName}))
|
|
<if test="query.buDesc != null and query.buDesc != ''">
|
|
AND dbo.get_bu_desc ( site, bu_no ) = #{query.buDesc}
|
|
</if>
|
|
<if test="query.supplierID != null and query.supplierID != ''">
|
|
AND supplierID like '%' + #{query.supplierID} +'%'
|
|
</if>
|
|
<if test="query.supplierName != null and query.supplierName != ''">
|
|
AND supplierName like '%' + #{query.supplierName} +'%'
|
|
</if>
|
|
<if test="query.active != null and query.active != ''">
|
|
AND active = #{query.active}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="searchItemAvailable" resultType="com.xujie.sys.modules.pms.data.EamPropertiesItemAvailableData">
|
|
SELECT
|
|
site,
|
|
bu_no,
|
|
ItemNo,
|
|
ValueNo,
|
|
AvailableValue,
|
|
CreatedDate,
|
|
CreatedBy,
|
|
ItemType
|
|
from eam_properties_item_available
|
|
where itemNo = #{itemNo} and ItemType = #{itemType} and site = #{site} and bu_no = #{buNo}
|
|
</select>
|
|
|
|
<select id="getItemValueNo" resultType="Double">
|
|
SELECT isnull( max(valueNo),0)+1 from eam_properties_item_available where itemNo = #{itemNo} and ItemType = #{itemType} and site = #{site} and bu_no = #{buNo}
|
|
</select>
|
|
|
|
<select id="getItemValueNoForPlan" resultType="Double">
|
|
SELECT isnull( max(valueNo),0)+1 from eam_workPlan_item_available where itemNo = #{itemNo} and ItemType = #{itemType} and site = #{site} and PlanID = #{planID} and bu_no = #{buNo}
|
|
</select>
|
|
|
|
<insert id="saveItemAvailable">
|
|
insert into eam_properties_item_available (ItemNo, ValueNo, AvailableValue, CreatedDate, CreatedBy, ItemType, site, bu_no)
|
|
values(#{itemNo}, #{valueNo}, #{availableValue}, GetDate(), #{createdBy}, #{itemType}, #{site}, #{buNo})
|
|
</insert>
|
|
|
|
<update id="updateItemAvailable">
|
|
update eam_properties_item_available
|
|
set AvailableValue = #{availableValue}
|
|
where itemNo = #{itemNo} and ItemType = #{itemType} and ValueNo = #{valueNo} and site = #{site} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<delete id="deleteItemAvailable">
|
|
delete from eam_properties_item_available where itemNo = #{itemNo} and ItemType = #{itemType} and ValueNo = #{valueNo} and site = #{site} and bu_no = #{buNo}
|
|
</delete>
|
|
|
|
<select id="eamPropertiesModelSearch" parameterType="com.xujie.sys.modules.pms.data.EamPropertiesModelHeaderData" resultType="com.xujie.sys.modules.pms.data.EamPropertiesModelHeaderData">
|
|
SELECT
|
|
site,
|
|
bu_no,
|
|
dbo.get_bu_desc(site, bu_no) as buDesc,
|
|
function_type,
|
|
code_no,
|
|
code_desc,
|
|
active,
|
|
case when active = 'Y' then '是' when active = 'N' then '否' else '' end as activeDesc,
|
|
created_date,
|
|
created_by,
|
|
dbo.getOperatorDesc(site, created_by) as createdByDesc,
|
|
update_date,
|
|
update_by,
|
|
dbo.getOperatorDesc(site, update_by) as updateByDesc,
|
|
delflag,
|
|
version,
|
|
CASE WHEN dbo.eam_model_is_use(site, function_type, code_no) > 0 THEN 'Y' else 'N' END as isUse,
|
|
check_type
|
|
FROM eam_properties_model_header
|
|
<where>
|
|
site in (select site from eam_access_site where username = #{query.userName})
|
|
and (site + '-' + bu_no) in (select * from dbo.query_bu(#{query.userName}))
|
|
and check_type in (select role_no from access_role where username = #{query.userName})
|
|
and function_type = #{query.functionType}
|
|
<if test="query.buDesc != null and query.buDesc != ''">
|
|
AND dbo.get_bu_desc ( site, bu_no ) = #{query.buDesc}
|
|
</if>
|
|
<if test="query.codeNo != null and query.codeNo != ''">
|
|
AND code_no like '%' + #{query.codeNo} +'%'
|
|
</if>
|
|
<if test="query.codeDesc != null and query.codeDesc != ''">
|
|
AND code_desc like '%' + #{query.codeDesc} +'%'
|
|
</if>
|
|
<if test="query.active != null and query.active != ''">
|
|
AND active = #{query.active}
|
|
</if>
|
|
<if test='query.isUse != null and query.isUse != "" and query.isUse == "Y"'>
|
|
AND dbo.eam_model_is_use(site, function_type, code_no) > 0
|
|
</if>
|
|
<if test='query.isUse != null and query.isUse != "" and query.isUse == "N"'>
|
|
AND dbo.eam_model_is_use(site, function_type, code_no) = 0
|
|
</if>
|
|
<if test="query.checkType != null and query.checkType != ''">
|
|
AND check_type = #{query.checkType}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<insert id="eamPropertiesModelSave">
|
|
insert into eam_properties_model_header
|
|
(function_type, code_no, code_desc, active, created_date, created_by, delflag, version, update_date, update_by, site, bu_no, check_type)
|
|
values
|
|
(#{functionType}, #{codeNo}, #{codeDesc}, #{active}, GetDate(), #{userId}, 'N', 0, getDate(), #{updateBy}, #{site}, #{buNo}, #{checkType})
|
|
</insert>
|
|
|
|
<update id="eamPropertiesModelEdit">
|
|
update eam_properties_model_header
|
|
set version = version + 1,
|
|
code_desc = #{codeDesc},
|
|
active = #{active},
|
|
update_by = #{updateBy},
|
|
update_date = GetDate()
|
|
where function_type = #{functionType} and code_no = #{codeNo} and site = #{site} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<select id="checkPropertiesModel" resultType="com.xujie.sys.modules.pms.data.EamPropertiesModelHeaderData">
|
|
SELECT
|
|
function_type,
|
|
code_no,
|
|
code_desc,
|
|
active,
|
|
created_date,
|
|
created_by,
|
|
update_date,
|
|
update_by,
|
|
delflag,
|
|
version
|
|
FROM eam_properties_model_header
|
|
where function_type = #{functionType} and code_no = #{codeNo} and site = #{site} and bu_no = #{buNo}
|
|
</select>
|
|
|
|
<delete id="deleteModelDetail">
|
|
delete from eam_properties_model_detail
|
|
where function_type = #{functionType} and code_no = #{codeNo} and site = #{site} and bu_no = #{buNo}
|
|
</delete>
|
|
|
|
<delete id="eamPropertiesModelDelete" >
|
|
delete from eam_properties_model_header where function_type = #{functionType} and code_no = #{codeNo} and site = #{site} and bu_no = #{buNo}
|
|
</delete>
|
|
|
|
<select id="searchModalDetails" resultType="EamPropertiesModelDetailData">
|
|
SELECT
|
|
a.site,
|
|
a.bu_no,
|
|
a.function_type,
|
|
a.code_no,
|
|
a.properties_item_no itemNo,
|
|
a.seq_no,
|
|
b.ItemDesc,
|
|
b.DefaultValue,
|
|
b.ValueType,
|
|
b.ValueType_DB,
|
|
b.ValueChooseFlag,
|
|
b.MaxValue,
|
|
b.MinValue,
|
|
b.ItemRemark,
|
|
b.ItemType,
|
|
a.check_type,a.order_id
|
|
FROM eam_properties_model_detail a
|
|
left join eam_properties_item b on a.function_type = b.itemType and a.properties_item_no = b.itemNo and a.site = b.site and a.bu_no = b.bu_no and a.check_type = b.check_type
|
|
where a.function_type = #{functionType} and a.code_no = #{codeNo} and a.site = #{site} and a.bu_no = #{buNo} and a.check_type = #{checkType}
|
|
order by order_id
|
|
</select>
|
|
|
|
<select id="checkItem" resultType="EamPropertiesModelDetailData">
|
|
SELECT
|
|
ItemDesc
|
|
FROM eam_properties_item
|
|
where itemType = #{functionType} and itemNo = #{itemNo} and site = #{site} and bu_no = #{buNo}
|
|
</select>
|
|
|
|
<select id="checkModalDetails" resultType="EamPropertiesModelDetailData">
|
|
SELECT
|
|
site,
|
|
bu_no,
|
|
function_type,
|
|
code_no,
|
|
properties_item_no itemNo,
|
|
seq_no
|
|
FROM eam_properties_model_detail
|
|
where function_type = #{functionType} and code_no = #{codeNo} and properties_item_no = #{itemNo} and site = #{site} and bu_no = #{buNo}
|
|
</select>
|
|
|
|
<select id="getModalDetailSeqNo" resultType="Integer">
|
|
SELECT
|
|
isnull(max(seq_no),0) + 1
|
|
from eam_properties_model_detail
|
|
where function_type = #{functionType} and code_no = #{codeNo} and site = #{site} and bu_no = #{buNo}
|
|
</select>
|
|
|
|
<insert id="saveModalDetails">
|
|
insert into eam_properties_model_detail
|
|
(function_type, code_no, properties_item_no, seq_no, created_date, created_by, delflag, version, site,
|
|
bu_no, check_type, order_id)
|
|
values (#{functionType}, #{codeNo}, #{itemNo}, #{seqNo}, GetDate(), #{userId}, 'N', 0, #{site}, #{buNo}, #{checkType}, #{orderId})
|
|
</insert>
|
|
|
|
|
|
<delete id="deleteModalDetails">
|
|
delete from eam_properties_model_detail
|
|
where function_type = #{functionType} and code_no = #{codeNo} and properties_item_no = #{itemNo} and site = #{site} and bu_no = #{buNo}
|
|
</delete>
|
|
|
|
<select id="eamWorkPlanOverviewSearch" parameterType="com.xujie.sys.modules.pms.data.EamWorkPlanInData" resultType="com.xujie.sys.modules.pms.data.EamWorkPlanInData">
|
|
SELECT
|
|
a.site,
|
|
a.bu_no,
|
|
dbo.get_bu_desc(a.site, a.bu_no) as buDesc,
|
|
a.plan_id,
|
|
a.plan_desc,
|
|
a.status,
|
|
a.plan_start_date,
|
|
a.plan_end_date,
|
|
a.created_date,
|
|
a.created_by,
|
|
dbo.getOperatorDesc(a.site, a.created_by) as createdByDesc,
|
|
a.update_date,
|
|
a.update_by,
|
|
dbo.getOperatorDesc(a.site, a.update_by) as updateByDesc,
|
|
a.remark,
|
|
a.next_work_date,
|
|
a.delete_flag,
|
|
a.operator,
|
|
a.operator_name,
|
|
a.checker,
|
|
a.checker_name,
|
|
a.function_type,
|
|
a.properties_code,
|
|
a.plan_period,
|
|
d.code_desc,
|
|
a.work_order_rule,
|
|
a.plan_cycle,
|
|
a.task_start_date,
|
|
a.plan_halt_date,
|
|
a.auto_renewal,
|
|
a.check_type
|
|
FROM eam_workPlan_overview as a
|
|
LEFT JOIN eam_properties_model_header as d ON a.site = d.site and a.function_type = d.function_type and a.properties_code = d.code_no and a.bu_no = d.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 a.check_type in (select role_no from access_role where username = #{query.userName})
|
|
and a.delete_flag = 'N' AND a.function_type = #{query.functionType}
|
|
<if test="query.buDesc != null and query.buDesc != ''">
|
|
AND dbo.get_bu_desc ( a.site, a.bu_no ) = #{query.buDesc}
|
|
</if>
|
|
<if test="query.planID != null and query.planID != ''">
|
|
AND a.plan_id like '%' + #{query.planID} +'%'
|
|
</if>
|
|
<if test="query.planDesc != null and query.planDesc != ''">
|
|
AND a.plan_desc like '%' + #{query.planDesc}+'%'
|
|
</if>
|
|
<if test="query.status != null and query.status != ''">
|
|
AND a.status = #{query.status}
|
|
</if>
|
|
<if test="query.startDate != null ">
|
|
AND a.plan_start_date >= #{query.startDate}
|
|
</if>
|
|
<if test="query.endDate != null ">
|
|
AND #{query.endDate} >= a.plan_start_date
|
|
</if>
|
|
<if test="query.checkType != null and query.checkType != ''">
|
|
AND a.check_type = #{query.checkType}
|
|
</if>
|
|
</where>
|
|
ORDER BY a.created_date DESC
|
|
</select>
|
|
|
|
<select id="eamWorkPlanSearch" parameterType="com.xujie.sys.modules.pms.data.EamWorkPlanInData" resultType="com.xujie.sys.modules.pms.data.EamWorkPlanInData">
|
|
SELECT
|
|
a.Site,
|
|
a.PlanID,
|
|
a.PlanDesc,
|
|
a.ObjectID,
|
|
a.FunctionType,
|
|
a.PropertiesCode,
|
|
a.Operator,
|
|
a.checker,
|
|
a.PlanPeriod,
|
|
a.Status,
|
|
a.PlanStartDate,
|
|
a.PlanEndDate,
|
|
a.CreatedDate,
|
|
a.CreatedBy,
|
|
a.UpdateDate,
|
|
a.UpdateBy,
|
|
a.Version,
|
|
a.Remark,
|
|
a.NextWorkDate,
|
|
b.ObjectDesc,
|
|
d.code_desc
|
|
FROM eam_workPlan a
|
|
left join eam_object b on a.Site = b.Site and a.ObjectID = b.ObjectID
|
|
left join eam_properties_model_header d on a.FunctionType = d.function_type and a.PropertiesCode = d.code_no
|
|
<where>
|
|
AND a.DeleteFlag = 'N'
|
|
AND a.FunctionType = #{query.functionType}
|
|
<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.status != null and query.status != ''">
|
|
AND a.status = #{query.status}
|
|
</if>
|
|
<if test="query.startDate != null ">
|
|
AND a.PlanStartDate >= #{query.startDate}
|
|
</if>
|
|
<if test="query.endDate != null ">
|
|
AND #{query.endDate} >= a.PlanStartDate
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectNameById" resultType="string" parameterType="string">
|
|
SELECT
|
|
AdminName
|
|
FROM eam_admin
|
|
WHERE AdminID = #{s}
|
|
</select>
|
|
|
|
<select id="searchPlanItems" resultType="com.xujie.sys.modules.pms.data.EamWorkPlanItemData">
|
|
SELECT
|
|
a.Site,
|
|
a.bu_no,
|
|
a.PlanID,
|
|
a.ItemNo,
|
|
a.ItemDesc,
|
|
a.DefaultValue,
|
|
a.ValueType,
|
|
a.ValueType_DB,
|
|
a.ValueChooseFlag,
|
|
a.UpdateDate,
|
|
a.UpdateBy,
|
|
a.MaxValue,
|
|
a.MinValue,
|
|
a.ItemRemark,
|
|
a.ItemType,
|
|
a.CreatedDate,
|
|
a.CreatedBy,
|
|
a.ObjectID
|
|
FROM eam_workPlan_item a
|
|
left join eam_properties_model_detail b on a.Site = b.site and a.ItemType = b.function_type and a.ItemNo =
|
|
b.properties_item_no and a.bu_no = b.bu_no and b.code_no = #{codeNo}
|
|
<where>
|
|
a.PlanID = #{planID} and a.Site = #{site} and a.ItemType = #{functionType} and a.bu_no = #{buNo}
|
|
<if test = "objectID != null and objectID != ''">
|
|
AND a.ObjectID = #{objectID}
|
|
</if>
|
|
</where>
|
|
ORDER BY b.order_id
|
|
</select>
|
|
|
|
<select id="searchPlanItemAvailable" resultType="com.xujie.sys.modules.pms.data.EamWorkPlanItemAvailableData">
|
|
SELECT
|
|
Site,
|
|
bu_no,
|
|
PlanID,
|
|
ItemNo,
|
|
ItemType,
|
|
ValueNo,
|
|
AvailableValue,
|
|
CreatedDate,
|
|
CreatedBy,
|
|
UpdateDate,
|
|
UpdateBy,
|
|
ObjectID
|
|
from eam_workPlan_item_available
|
|
where PlanID = #{planID} and itemNo = #{itemNo} and site = #{site} and ItemType = #{itemType} and ObjectID = #{objectID} and bu_no = #{buNo}
|
|
</select>
|
|
|
|
<update id="updatePlanItems">
|
|
update eam_workPlan_item
|
|
set DefaultValue = #{defaultValue},
|
|
ValueType = #{valueType},
|
|
ValueType_DB = #{valueTypeDb},
|
|
ValueChooseFlag = #{valueChooseFlag},
|
|
UpdateDate = GetDate(),
|
|
UpdateBy = #{createdBy},
|
|
MaxValue = #{maxValue,jdbcType=FLOAT},
|
|
MinValue = #{minValue,jdbcType=FLOAT},
|
|
ItemRemark = #{itemRemark}
|
|
where site = #{site} and planID = #{planID} and ItemType = #{itemType} and ItemNo = #{itemNo} and ObjectID = #{objectID} and bu_no = #{buNo}
|
|
</update>
|
|
<update id="updatePlanItemsForNull">
|
|
update eam_workPlan_item set DefaultValue=#{defaultValue},ValueType=#{valueType},ValueType_DB=#{valueTypeDb}
|
|
,ValueChooseFlag=#{valueChooseFlag},UpdateDate=GetDate(),UpdateBy=#{createdBy},MaxValue=null,MinValue=null,
|
|
ItemRemark=#{itemRemark}
|
|
where site=#{site} and planID=#{planID} and ItemType=#{itemType}
|
|
and ItemNo=#{itemNo}
|
|
</update>
|
|
|
|
|
|
<insert id="saveItemAvailableForPlan">
|
|
insert into eam_workPlan_item_available
|
|
(Site, PlanID, ItemNo, ValueNo, AvailableValue, CreatedDate, CreatedBy, ItemType, ObjectID, bu_no)
|
|
values(#{site}, #{planID}, #{itemNo}, #{valueNo}, #{availableValue}, GetDate(), #{createdBy}, #{itemType}, #{objectID}, #{buNo})
|
|
</insert>
|
|
|
|
<update id="updateItemAvailableForPlan">
|
|
update eam_workPlan_item_available
|
|
set AvailableValue = #{availableValue},
|
|
updateBy = #{createdBy},
|
|
updateDate = GetDate()
|
|
where itemNo = #{itemNo} and ItemType = #{itemType} and ValueNo = #{valueNo} AND site = #{site} and planID = #{planID} and ObjectID = #{objectID} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
|
|
<delete id="deletePlanItemAvailable">
|
|
delete from eam_workPlan_item_available
|
|
where itemNo = #{itemNo} and ItemType = #{itemType} and ValueNo = #{valueNo} AND site = #{site} and planID = #{planID} and ObjectID = #{objectID} and bu_no = #{buNo}
|
|
</delete>
|
|
|
|
<select id="objectIDBlur" resultType="com.xujie.sys.modules.pms.data.EamObjectData">
|
|
select
|
|
objectID,
|
|
ObjectDesc
|
|
from eam_object
|
|
where active = 'Y'
|
|
and Site = #{site}
|
|
and ObjectID=#{objectID}
|
|
</select>
|
|
|
|
<select id="modalCodeBlur" resultType="com.xujie.sys.modules.pms.data.EamPropertiesModelHeaderData">
|
|
select
|
|
code_no,
|
|
code_desc
|
|
from eam_properties_model_header
|
|
where active = 'Y' and function_type = #{functionType} and code_no = #{codeNo} and check_type = #{checkType}
|
|
</select>
|
|
|
|
<select id="eamWorkOrderSearch" parameterType="com.xujie.sys.modules.pms.data.EamWorkOrderInData" resultType="com.xujie.sys.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,
|
|
a.Remark,
|
|
a.StartTime,
|
|
a.EndTime,
|
|
a.WorkTime,
|
|
a.PlanOperatorName,
|
|
a.checkerName,
|
|
dbo.eam_Get_eamAdminName(a.Site, a.ActualOperator) as actualOperatorName,
|
|
eo.ObjectDesc as objectDesc,
|
|
dbo.eam_Get_eam_properties_CodeDesc(a.site, a.bu_no, a.FunctionType, a.PropertiesCode) as codeDesc,
|
|
a.result,
|
|
a.checkResult,
|
|
a.disposal_measures,
|
|
a.check_work_plan_id,
|
|
a.check_item_no,
|
|
a.reach_date,
|
|
a.reach_operator,
|
|
a.reach_operator_name,
|
|
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,
|
|
a.last_execution_date,
|
|
a.handling_method,
|
|
a.fault_reason,
|
|
a.preventive_measure,
|
|
a.repair_reporting_type,
|
|
a.repair_type,
|
|
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,
|
|
a.check_type,
|
|
a.is_return
|
|
FROM eam_workOrder a
|
|
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 a.check_type in (select role_no from access_role where username = #{query.userName})
|
|
and ea.username = #{query.userName}
|
|
AND a.FunctionType = #{query.functionType}
|
|
<if test="query.buDesc != null and query.buDesc != ''">
|
|
AND dbo.get_bu_desc (a.site, a.bu_no) = #{query.buDesc}
|
|
</if>
|
|
<if test="query.isReturn != null and query.isReturn != ''">
|
|
AND a.is_return = #{query.isReturn}
|
|
</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 query.searchType == "reportCheck"'>
|
|
and getDate() >= dbo.compare_date(ewo.task_start_date)
|
|
</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.checkType != null and query.checkType != ''">
|
|
AND a.check_type = #{query.checkType}
|
|
</if>
|
|
</where>
|
|
ORDER BY a.CreateDate
|
|
</select>
|
|
|
|
<select id="eamWorkOrderSearch2" parameterType="com.xujie.sys.modules.pms.data.EamWorkOrderInData" resultType="com.xujie.sys.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,
|
|
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,
|
|
a.checkerName,
|
|
dbo.eam_Get_eamAdminName(a.Site, a.ActualOperator) as actualOperatorName,
|
|
eo.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.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.FeedBackID as feedBackId,
|
|
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,
|
|
a.last_execution_date,
|
|
a.handling_method,
|
|
a.fault_reason,
|
|
a.preventive_measure,
|
|
a.repair_reporting_type,
|
|
a.repair_type,
|
|
b.CreatedDate,
|
|
a.is_return as isReturn,
|
|
a.difficulty_remark,
|
|
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
|
|
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 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.isReturn != null and query.isReturn != ''">
|
|
AND a.is_return = #{query.isReturn}
|
|
</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 query.searchType == "reportCheck"'>
|
|
and getDate() >= dbo.compare_date(ewo.task_start_date)
|
|
</if>
|
|
<if test="query.urgency != null and query.urgency != ''">
|
|
AND b.urgency = #{query.urgency}
|
|
</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>
|
|
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="eamWorkOrderSearchForDefect" parameterType="com.xujie.sys.modules.pms.data.EamWorkOrderInData" resultType="com.xujie.sys.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,
|
|
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,
|
|
b.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.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>
|
|
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>
|
|
|
|
<select id="eamDefectSearch" parameterType="com.xujie.sys.modules.pms.data.EamDefectData" resultType="com.xujie.sys.modules.pms.data.EamDefectData">
|
|
SELECT
|
|
DefectID,
|
|
DefectDesc,
|
|
Active,
|
|
create_date,
|
|
create_by,
|
|
update_date,
|
|
update_by,
|
|
fault_type
|
|
FROM eam_defect
|
|
<where>
|
|
<if test="query.defectID != null and query.defectID != ''">
|
|
AND defectID like '%' + #{query.defectID} + '%'
|
|
</if>
|
|
<if test="query.defectDesc != null and query.defectDesc != ''">
|
|
AND defectDesc like '%' + #{query.defectDesc} + '%'
|
|
</if>
|
|
<if test="query.active != null and query.active != ''">
|
|
AND active = #{query.active}
|
|
</if>
|
|
</where>
|
|
order by id
|
|
</select>
|
|
|
|
<select id="eamObjectDefectSearch" parameterType="com.xujie.sys.modules.pms.data.EamObjectDefectInData" resultType="com.xujie.sys.modules.pms.data.EamObjectDefectInData">
|
|
SELECT
|
|
a.site,
|
|
a.ObjectID,
|
|
a.DefectID,
|
|
a.Active,
|
|
a.id,
|
|
b.ObjectDesc,
|
|
c.DefectDesc,
|
|
a.create_date,
|
|
a.create_by,
|
|
a.update_date,
|
|
a.update_by
|
|
FROM eam_object_defect a
|
|
left join eam_object b on a.site=b.site and a.ObjectID=b.ObjectID
|
|
left join eam_defect c on a.DefectID=c.DefectID
|
|
<where>
|
|
<if test="query.objectID != null and query.objectID != ''">
|
|
AND a.ObjectID like '%' + #{query.objectID} + '%'
|
|
</if>
|
|
<if test="query.objectDesc != null and query.objectDesc != ''">
|
|
AND b.ObjectDesc like '%' + #{query.objectDesc} + '%'
|
|
</if>
|
|
<if test="query.defectID != null and query.defectID != ''">
|
|
AND a.defectID like '%' + #{query.defectID} + '%'
|
|
</if>
|
|
<if test="query.defectDesc != null and query.defectDesc != ''">
|
|
AND c.defectDesc like '%' + #{query.defectDesc} + '%'
|
|
</if>
|
|
<if test="query.active != null and query.active != ''">
|
|
AND a.active = #{query.active}
|
|
</if>
|
|
</where>
|
|
order by a.id
|
|
</select>
|
|
|
|
<select id="getObjectList" parameterType="com.xujie.sys.modules.pms.data.EamObjectInData" resultType="com.xujie.sys.modules.pms.data.EamObjectInData">
|
|
SELECT
|
|
a.Site,
|
|
a.bu_no,
|
|
a.ObjectID,
|
|
a.ObjectDesc,
|
|
a.LocationID,
|
|
a.FamilyID,
|
|
a.GroupID,
|
|
b.FamilyDesc,
|
|
c.LocationName
|
|
FROM eam_object a
|
|
LEFT JOIN eam_family b ON a.site = b.site and a.FamilyID = b.FamilyID and a.bu_no = b.bu_no
|
|
LEFT JOIN eam_location as c ON a.LocationID = c.LocationID and a.site = c.site and a.bu_no = c.bu_no
|
|
<where>
|
|
<if test="objectID != null and objectID != ''">
|
|
AND a.ObjectID like '%' + #{objectID} + '%'
|
|
</if>
|
|
<if test="objectDesc != null and objectDesc != ''">
|
|
AND a.ObjectDesc like '%' + #{objectDesc} + '%'
|
|
</if>
|
|
AND a.site = #{site} AND a.active = 'Y' and a.bu_no = #{buNo}
|
|
</where>
|
|
</select>
|
|
|
|
<select id="checkEamFamilyDelete" resultType="com.xujie.sys.modules.pms.data.EamObjectData">
|
|
SELECT
|
|
a.site,
|
|
a.objectID
|
|
from eam_object as a
|
|
left join eam_family as b on a.site = b.site and a.FamilyID = b.FamilyID
|
|
where a.site = '2' and (b.son_id like #{sonId} + '%' or a.FamilyID = #{familyID})
|
|
</select>
|
|
|
|
<select id="checkEamGroupDelete" resultType="com.xujie.sys.modules.pms.data.EamObjectData">
|
|
SELECT
|
|
site,
|
|
objectID
|
|
from eam_object
|
|
where site = #{site} and GroupID = #{groupID}
|
|
</select>
|
|
|
|
<select id="checkEamLocationDelete" resultType="com.xujie.sys.modules.pms.data.EamObjectData">
|
|
SELECT
|
|
site,
|
|
objectID
|
|
from eam_object
|
|
where site = #{site} and LocationID = #{locationID}
|
|
</select>
|
|
|
|
<select id="eamWorkPlanItemSearchForReport" resultType="com.xujie.sys.modules.pms.data.EamWorkOrderItemInData">
|
|
SELECT
|
|
a.Site,
|
|
a.bu_no,
|
|
c.OrderNo,
|
|
a.ItemNo,
|
|
a.ItemDesc,
|
|
a.DefaultValue,
|
|
a.ValueType,
|
|
a.ValueType_DB,
|
|
a.ValueChooseFlag,
|
|
a.MaxValue,
|
|
a.MinValue,
|
|
a.ItemRemark,
|
|
a.ItemType,
|
|
a.image_flag,
|
|
a.produce_control_flag,
|
|
CASE WHEN b.id is null THEN 'N'
|
|
ELSE 'Y'
|
|
END as uploadFlag,
|
|
a.item_notes
|
|
from eam_workPlan_item as a
|
|
left join eam_workOrder as c on a.site = c.site and a.PlanID = c.PlanID and a.bu_no = c.bu_no
|
|
left join (SELECT MAX (id) as id, order_ref1, order_ref2, order_ref3, order_ref4 FROM sys_oss GROUP BY order_ref1, order_ref2, order_ref3, order_ref4) as b
|
|
on b.order_ref1 = a.site and b.order_ref2 = c.OrderNo and b.order_ref3 = a.ItemNo and order_ref4 = a.bu_no
|
|
where a.site = #{site} and c.orderNo = #{orderNo} and a.ObjectID = #{objectID} and a.bu_no = #{buNo}
|
|
</select>
|
|
|
|
<select id="checkEamOrderStatus" resultType="com.xujie.sys.modules.pms.data.EamWorkOrderInData">
|
|
SELECT
|
|
Site,
|
|
status,
|
|
OrderNo
|
|
from eam_workOrder
|
|
where site = #{site} and orderNo = #{orderNo} and bu_no = #{buNo}
|
|
</select>
|
|
|
|
<select id="getAdminIDWithMesUser" resultType="com.xujie.sys.modules.pms.data.EamAdminData">
|
|
SELECT username as adminID
|
|
from sys_user
|
|
where username = #{mesUser}
|
|
</select>
|
|
|
|
|
|
<update id="updateDefectResult" >
|
|
update eam_defect_feedBack
|
|
set Status = #{result},
|
|
FinishDate = GetDate(),
|
|
DefectID = #{defectID}
|
|
where Site = #{site} and FeedBackID = #{planID} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<update id="reportWorkOrder" parameterType="com.xujie.sys.modules.pms.data.EamWorkOrderInData">
|
|
update eam_workOrder
|
|
set Status = '待确认',
|
|
ActualOperator = #{actualOperator},
|
|
ActualDate = #{actualDate},
|
|
Remark = #{remark},
|
|
disposal_measures = #{disposalMeasures},
|
|
WorkTime = CASE
|
|
WHEN (DATEDIFF(SECOND, reach_date, #{actualDate}) <![CDATA[<]]> 60) THEN DATEDIFF(SECOND, reach_date, #{actualDate}) / 60.0
|
|
ELSE ceiling(floor(DATEDIFF(SECOND, reach_date, #{actualDate}) * 1.0 / 30) / 2)
|
|
END,
|
|
result = #{result,jdbcType=VARCHAR},
|
|
checkResult = #{checkResult},
|
|
handling_method = #{handlingMethod},
|
|
fault_reason = #{faultReason},
|
|
preventive_measure = #{preventiveMeasure}
|
|
where site = #{site} and orderNo = #{orderNo} and FunctionType = #{functionType} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<update id="reportWorkOrder2" parameterType="com.xujie.sys.modules.pms.data.EamWorkOrderInData">
|
|
update eam_workOrder
|
|
set Status = '待审核',
|
|
ActualOperator = #{actualOperator},
|
|
reach_date = #{reachDate},
|
|
ActualDate = #{actualDate},
|
|
Remark = #{remark},
|
|
disposal_measures = #{disposalMeasures},
|
|
WorkTime = #{workTime},
|
|
result = #{result,jdbcType=VARCHAR},
|
|
checkResult = #{checkResult},
|
|
handling_method = #{handlingMethod},
|
|
check_remark = #{checkRemark}
|
|
where site = #{site} and orderNo = #{orderNo} and FunctionType = #{functionType} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<update id="reportWorkOrder3" parameterType="com.xujie.sys.modules.pms.data.EamWorkOrderInData">
|
|
update eam_workOrder
|
|
set Status = '待审核',
|
|
ActualOperator = #{actualOperator},
|
|
ActualDate = #{actualDate},
|
|
Remark = #{remark},
|
|
disposal_measures = #{disposalMeasures},
|
|
WorkTime = CASE
|
|
WHEN (DATEDIFF(SECOND, reach_date, #{actualDate}) <![CDATA[<]]> 60) THEN DATEDIFF(SECOND, reach_date, #{actualDate}) / 60.0
|
|
ELSE ceiling(floor(DATEDIFF(SECOND, reach_date, #{actualDate}) * 1.0 / 30) / 2)
|
|
END,
|
|
result = #{result,jdbcType=VARCHAR},
|
|
checkResult = #{checkResult},
|
|
handling_method = #{handlingMethod},
|
|
fault_reason = #{faultReason},
|
|
preventive_measure = #{preventiveMeasure}
|
|
where site = #{site} and orderNo = #{orderNo} and FunctionType = #{functionType} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<update id="defectReportWorkOrder" >
|
|
update eam_workOrder
|
|
set Status = '已完工',
|
|
ActualOperator = #{actualOperator},
|
|
ActualDate = GetDate(),
|
|
Remark = #{remark},
|
|
disposal_measures = #{disposalMeasures},
|
|
WorkTime = #{workTime},
|
|
result = #{result,jdbcType=VARCHAR},
|
|
checkResult = #{checkResult}
|
|
where site = #{site}
|
|
and orderNo = #{orderNo}
|
|
</update>
|
|
<insert id="saveWorkOrderItem">
|
|
INSERT into eam_workOrder_item
|
|
(Site, bu_no, OrderNo, ItemNo, ItemDesc, DefaultValue, ValueType, ValueType_DB, ValueChooseFlag, MaxValue, MinValue, ItemRemark, ItemType, TextValue, NumberValue, CreatedDate, CreatedBy, FinishFlag, itemResult, item_notes)
|
|
values (#{site}, #{buNo}, #{orderNo}, #{itemNo}, #{itemDesc}, #{defaultValue}, #{valueType}, #{valueTypeDb}, #{valueChooseFlag}, #{maxValue,jdbcType=DOUBLE}, #{minValue,jdbcType=DOUBLE}, #{itemRemark,jdbcType=VARCHAR}, #{itemType}, #{textValue,jdbcType=VARCHAR}, #{numberValue,jdbcType=DOUBLE}, GetDate(), #{createdBy}, #{finishFlag}, #{itemResult}, #{itemNotes})
|
|
</insert>
|
|
<!-- 修改 eam_workPlan 状态为已结束 -->
|
|
<update id="closePlanWithCheck">
|
|
update eam_workPlan
|
|
set status = '已结束'
|
|
where site = #{site}
|
|
and PlanID = #{planID}
|
|
and ObjectID = #{objectID}
|
|
and GetDate() > PlanEndDate
|
|
</update>
|
|
|
|
<!-- 报工后更新下一个工作日期 -->
|
|
<update id="updatePlanNextDate">
|
|
update eam_workPlan_overview
|
|
set next_work_date = (select top 1 PlanDate from eam_workOrder where site = #{site} and bu_no = #{buNo} and PlanID = #{planID} and PlanDate > GetDate() and status = '未开工' order by PlanDate)
|
|
where site = #{site} and plan_id = #{planID} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<select id="eamWorkOrderReportSearch" resultType="com.xujie.sys.modules.pms.data.EamWorkOrderItemInData">
|
|
SELECT
|
|
Site,
|
|
bu_no,
|
|
OrderNo,
|
|
ItemNo,
|
|
ItemDesc,
|
|
DefaultValue,
|
|
ValueType,
|
|
ValueType_DB,
|
|
ValueChooseFlag,
|
|
MaxValue,
|
|
MinValue,
|
|
ItemRemark,
|
|
ItemType,
|
|
TextValue,
|
|
NumberValue,
|
|
CreatedDate,
|
|
CreatedBy,
|
|
FinishFlag,
|
|
itemResult,
|
|
item_notes
|
|
from eam_workOrder_item
|
|
where site = #{site} and orderNo = #{orderNo} and bu_no = #{buNo}
|
|
</select>
|
|
|
|
<update id="cancelOrder" parameterType="com.xujie.sys.modules.pms.data.EamWorkOrderInData">
|
|
update eam_workOrder
|
|
set Status = '已取消',
|
|
cancel_date = getDate(),
|
|
cancel_by = #{userId}
|
|
where site = #{site} and orderNo = #{orderNo} and FunctionType = #{functionType} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<update id="cancelOrderAll" parameterType="com.xujie.sys.modules.pms.data.EamWorkOrderInData">
|
|
update eam_workOrder
|
|
set Status = '已取消',
|
|
cancel_date = getDate(),
|
|
cancel_by = #{userId}
|
|
where site = #{site} and PlanID = #{planID} and FunctionType = #{functionType} and ObjectID = #{objectID} and Status = #{status} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<update id="updateWorkPlanStatus2" parameterType="com.xujie.sys.modules.pms.data.EamWorkOrderInData">
|
|
update eam_workPlan
|
|
set Status = '已取消',
|
|
cancel_date = getDate(),
|
|
cancel_by = #{userId}
|
|
where site = #{site} and PlanID = #{planID} and FunctionType = #{functionType} and ObjectID = #{objectID} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<select id="checkPlanStatus" resultType="com.xujie.sys.modules.pms.data.EamWorkPlanInData">
|
|
SELECT
|
|
site,
|
|
bu_no,
|
|
status
|
|
from eam_workPlan_overview
|
|
where site = #{site} and plan_id = #{planID} and delete_flag = 'N' and bu_no = #{buNo}
|
|
</select>
|
|
|
|
<update id="planOrder">
|
|
update eam_workPlan
|
|
set Status = '已计划',
|
|
NextWorkDate = null
|
|
where site = #{site} and PlanID = #{planID} and deleteFlag = 'N' and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<update id="cancelPlan">
|
|
update eam_workPlan_overview
|
|
set status = '已取消',
|
|
next_work_date = null,
|
|
cancel_date = getDate(),
|
|
cancel_by = #{userId}
|
|
where site = #{site} and plan_id = #{planID} and delete_flag = 'N' and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<update id="updateWorkPlanStatus">
|
|
update eam_workPlan
|
|
set Status = '已取消',
|
|
NextWorkDate = null,
|
|
cancel_date = getDate(),
|
|
cancel_by = #{userId}
|
|
where Site = #{site} and PlanID = #{planID} and deleteFlag = 'N' and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<update id="cancelOrderWithPlanID">
|
|
update eam_workOrder
|
|
set Status = '已取消',
|
|
cancel_date = getDate(),
|
|
cancel_by = #{userId}
|
|
where site = #{site} and PlanID = #{planID} and status = '未开工' and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<update id="deleteOrderDetailWithPlanID">
|
|
delete from eam_workOrder_item
|
|
where site = #{site} and bu_no = #{buNo}
|
|
and OrderNo in (select OrderNo from eam_workOrder where site = #{site} and PlanID = #{planID} and status = '未开工' and PlanDate > GetDate() - 1 )
|
|
</update>
|
|
|
|
<update id="deleteOrderWithPlanID">
|
|
delete from eam_workOrder
|
|
where site = #{site} and bu_no = #{buNo}
|
|
and PlanID = #{planID} and status = '未开工' and PlanDate > GetDate() - 1
|
|
</update>
|
|
|
|
<update id="updateOrderPlanOperator">
|
|
update eam_workOrder
|
|
set PlanOperator = #{planOperator}
|
|
where site = #{site} and orderNo = #{orderNo}
|
|
</update>
|
|
|
|
<select id="getSpareSelectList" resultType="com.xujie.sys.modules.pms.data.PartSpareInData">
|
|
select a.site ,a.part_no,a.part_description,a.spec,b.resource_id objectID from part_spare a
|
|
left join resource_spare b on a.site = b.site and a.part_no = b.part_no and resource_id = #{objectID}
|
|
<where>
|
|
<if test="partNo != null and partNo != ''">
|
|
AND a.part_no like '%' + #{partNo} + '%'
|
|
</if>
|
|
<if test="partDescription != null and partDescription != ''">
|
|
AND a.part_description like '%' + #{partDescription} + '%'
|
|
</if>
|
|
and a.site=#{site} and a.active='Y'
|
|
</where>
|
|
</select>
|
|
|
|
<select id="checkPartSpare" resultType="com.xujie.sys.modules.pms.data.PartSpareInData">
|
|
select part_no
|
|
from resource_spare
|
|
where site = #{site}
|
|
and resource_id = #{objectID}
|
|
and part_no = #{partNo}
|
|
</select>
|
|
|
|
<insert id="savePartSpare" >
|
|
INSERT Into resource_spare (resource_id,part_no,delflag,version,site)
|
|
values(#{objectID},#{partNo},'',0,#{site})
|
|
</insert>
|
|
|
|
<delete id="deletePartSpare">
|
|
<foreach collection="list" item="item" separator=";">
|
|
delete from resource_spare where site = #{item.site} and resource_id = #{item.objectID}
|
|
</foreach>
|
|
</delete>
|
|
|
|
<insert id="copyPartSpare" >
|
|
INSERT INTO resource_spare
|
|
(resource_id, part_no, delflag, version, site)
|
|
<foreach item="item" index="index" collection="list" separator=",">
|
|
select #{item.objectID}, part_no, delflag, 0, site from resource_spare where resource_id = #{item.oldObjectID} and site = #{item.site}
|
|
</foreach>
|
|
</insert>
|
|
|
|
<select id="getWorkPlanDataWithObjectID" resultType="com.xujie.sys.modules.pms.data.EamWorkPlanInData">
|
|
SELECT a.Site,a.PlanID,a.PlanDesc,a.ObjectID,a.FunctionType,a.PropertiesCode,a.Operator,a.PlanPeriod,a.Status,
|
|
a.PlanStartDate,a.PlanEndDate,a.CreatedDate,a.CreatedBy,a.UpdateDate,a.UpdateBy,a.Version,a.Remark
|
|
,a.NextWorkDate,b.ObjectDesc,c.adminName,d.code_desc
|
|
FROM eam_workPlan a
|
|
left join eam_object b on a.Site=b.Site and a.ObjectID=b.ObjectID
|
|
left join eam_admin c on a.Site=c.Site and a.operator=c.AdminID
|
|
left join eam_properties_model_header d on a.FunctionType=d.function_type and a.PropertiesCode=d.code_no
|
|
where a.site=#{site} and a.ObjectID=#{objectID} and a.FunctionType=#{functionType} and a.DeleteFlag='N'
|
|
and status in ('已计划','进行中')
|
|
</select>
|
|
|
|
<select id="getObjectItemList" resultType="com.xujie.sys.modules.pms.data.EamObjectItemInData">
|
|
SELECT a.site,a.objectID,a.ItemNo,a.DefaultValue,a.ValueType,a.ValueType_DB,a.ValueChooseFlag,a.CreatedDate,a.CreatedBy,
|
|
a.MaxValue,a.MinValue,a.ItemType,b.ItemDesc,b.ItemRemark from eam_object_item a left join eam_properties_item b
|
|
on a.ItemNo=b.ItemNo and a.ItemType=b.ItemType
|
|
where a.site=#{site} and a.ObjectID=#{objectID}
|
|
and a.ItemType=#{itemType}
|
|
</select>
|
|
|
|
<select id="getDefectWithObject" resultType="com.xujie.sys.modules.pms.data.EamObjectDefectInData">
|
|
SELECT a.site,a.ObjectID,a.DefectID,a.Active,a.id,b.DefectDesc
|
|
from eam_object_defect a left join eam_defect b
|
|
on a.DefectID=b.DefectID
|
|
where a.site=#{site} and a.ObjectID=#{objectID}
|
|
|
|
</select>
|
|
|
|
<select id="checkEamObjectItemData" resultType="com.xujie.sys.modules.pms.data.EamObjectItemInData">
|
|
select site,objectID,ItemNo,DefaultValue,ValueType,ValueType_DB,ValueChooseFlag,CreatedDate,CreatedBy,MaxValue,MinValue,
|
|
ItemType from eam_object_item where site=#{site} and objectID=#{objectID} and ItemType=#{itemType} and ItemNo=#{itemNo}
|
|
</select>
|
|
|
|
<insert id="saveNewEamObjectItem" >
|
|
insert into eam_object_item (site,objectID,ItemNo,DefaultValue,ValueType,ValueType_DB,ValueChooseFlag,CreatedDate,CreatedBy,MaxValue,MinValue,
|
|
ItemType) values(#{site},#{objectID},#{itemNo},#{defaultValue},#{valueType},#{valueTypeDb},#{valueChooseFlag},GetDate(),#{userId},#{maxValue,jdbcType=DOUBLE},#{minValue,jdbcType=DOUBLE},#{itemType})
|
|
</insert>
|
|
|
|
<update id="editEamObjectItem">
|
|
update eam_object_item set DefaultValue=#{defaultValue},ValueType=#{valueType},ValueType_DB=#{valueTypeDb}
|
|
,ValueChooseFlag=#{valueChooseFlag},MaxValue=#{maxValue,jdbcType=FLOAT},MinValue=#{minValue,jdbcType=FLOAT}
|
|
where site=#{site} and objectID=#{objectID} and ItemType=#{itemType}
|
|
and ItemNo=#{itemNo}
|
|
</update>
|
|
|
|
<delete id="deleteObjectItem">
|
|
delete from eam_object_item where site=#{site} and objectID=#{objectID} and ItemType=#{itemType}
|
|
and ItemNo=#{itemNo}
|
|
</delete>
|
|
|
|
<insert id="saveNewEamObjectItemAvailable">
|
|
insert into eam_object_item_available (Site,ObjectID,ItemNo,ItemType,ValueNo,AvailableValue,CreatedDate,CreatedBy)
|
|
select #{site},#{objectID},ItemNo,ItemType,ValueNo,AvailableValue,GetDate() ,#{userId} from eam_properties_item_available
|
|
where ItemNo=#{itemNo} and ItemType=#{itemType}
|
|
</insert>
|
|
|
|
<delete id="deleteEamObjectItemAvailable">
|
|
delete from eam_object_item_available where site=#{site} and objectID=#{objectID} and ItemType=#{itemType}
|
|
and ItemNo=#{itemNo}
|
|
</delete>
|
|
<select id="searchObjectItemAvailable" resultType="com.xujie.sys.modules.pms.data.EamObjectItemAvailableData">
|
|
select Site,ObjectID,ItemNo,ItemType,ValueNo,AvailableValue from eam_object_item_available
|
|
where site=#{site} and objectID=#{objectID} and ItemType=#{itemType} and ItemNo=#{itemNo}
|
|
</select>
|
|
<select id="getItemValueNoForObject" resultType="Double">
|
|
SELECT isnull( max(valueNo),0)+1 from eam_object_item_available where itemNo=#{itemNo} and ItemType=#{itemType} and site=#{site} and objectID=#{objectID}
|
|
</select>
|
|
|
|
<insert id="saveObjectItemAvailable">
|
|
insert into eam_object_item_available(Site,ObjectID,ItemNo,ItemType,ValueNo,AvailableValue,CreatedDate,CreatedBy)
|
|
values(#{site},#{objectID},#{itemNo},#{itemType},#{valueNo},#{availableValue},GetDate(),#{createdBy})
|
|
</insert>
|
|
<update id="updateObjectItemAvailable">
|
|
update eam_object_item_available set AvailableValue=#{availableValue},updateDate=GetDate(),updateBy=#{createdBy}
|
|
where site=#{site} and objectID=#{objectID} and ItemType=#{itemType} and ItemNo=#{itemNo} and ValueNo=#{valueNo}
|
|
</update>
|
|
|
|
<delete id="deleteObjectItemAvailable">
|
|
delete from eam_object_item_available where site=#{site} and objectID=#{objectID} and ItemType=#{itemType} and ItemNo=#{itemNo} and ValueNo=#{valueNo}
|
|
</delete>
|
|
|
|
<delete id="deleteObjectItemForCopy">
|
|
delete from eam_object_item where site=#{site} and objectID=#{objectID} and ItemType=#{itemType}
|
|
</delete>
|
|
<delete id="deleteObjectItemAvailableForCopy">
|
|
delete from eam_object_item_available where site=#{site} and objectID=#{objectID} and ItemType=#{itemType}
|
|
</delete>
|
|
<insert id="copyObjectItem" >
|
|
insert into eam_object_item (site,objectID,ItemNo,DefaultValue,ValueType,ValueType_DB,ValueChooseFlag,CreatedDate,CreatedBy,MaxValue,MinValue,
|
|
ItemType)
|
|
select #{site},#{objectID},ItemNo,DefaultValue,ValueType,ValueType_DB,ValueChooseFlag,GetDate(),#{createBy},MaxValue,MinValue,ItemType
|
|
from eam_object_item where site=#{site} and objectID=#{oldObjectID} and ItemType=#{itemType}
|
|
</insert>
|
|
<insert id="copyObjectItemAvailable">
|
|
insert into eam_object_item_available(Site,ObjectID,ItemNo,ItemType,ValueNo,AvailableValue,CreatedDate,CreatedBy)
|
|
select #{site},#{objectID},ItemNo,ItemType,ValueNo,AvailableValue,GetDate(),#{createBy}
|
|
from eam_object_item_available where site=#{site} and objectID=#{oldObjectID} and ItemType=#{itemType}
|
|
</insert>
|
|
<delete id="deleteObjectDefectForCopy">
|
|
delete from eam_object_defect where site=#{site} and objectID=#{objectID}
|
|
</delete>
|
|
|
|
<insert id="copyObjectDefect">
|
|
insert into eam_object_defect(site,ObjectID,DefectID,Active)
|
|
select #{site},#{objectID},DefectID,Active
|
|
from eam_object_defect where site=#{site} and objectID=#{oldObjectID}
|
|
</insert>
|
|
|
|
<select id="eamFeedBackSearch" resultType="com.xujie.sys.modules.pms.data.EamDefectFeedBackInData">
|
|
select
|
|
a.Site,
|
|
a.bu_no,
|
|
dbo.get_bu_desc(a.site, a.bu_no) as buDesc,
|
|
a.FeedBackID,
|
|
a.FeedBackDesc,
|
|
a.ObjectID,
|
|
a.DefectID,
|
|
a.FunctionType,
|
|
a.PlanOperator,
|
|
a.ActualOperator,
|
|
DBO.GET_EAM_Status (A.site,a.bu_no,a.FeedBackID) AS status,
|
|
a.PlanDate,
|
|
a.Remark,
|
|
a.urgency,
|
|
a.deleteFlag,
|
|
a.CreatedDate,
|
|
a.CreatedBy,
|
|
dbo.eam_Get_eamAdminName_TPM(a.site,a.CreatedBy) as feedbackBy,
|
|
a.UpdateDate,
|
|
a.UpdateBy,
|
|
a.Version,
|
|
a.DefectDate,
|
|
dbo.eam_Get_eamAdminName_TPM(a.Site,a.PlanOperator) as PlanOperatorName,
|
|
b.defectDesc,
|
|
e.ObjectDesc as ObjectDesc,
|
|
FinishDate,
|
|
dbo.joint_name(a.Site, a.bu_no, (select OrderNo from eam_workOrder where PlanID = a.FeedBackID and site = a.site and Result = '维修完成' and bu_no = a.bu_no),a.FunctionType) as actualOperatorName,
|
|
a.repair_reporting_type,
|
|
a.repair_type,
|
|
f.department_name as department,
|
|
g.LocationName,
|
|
a.matter_tracking_flag
|
|
from eam_defect_feedBack a
|
|
left join eam_defect b on a.DefectID = b.DefectID
|
|
left join operator as c on a.CreatedBy = c.operator_id
|
|
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
|
|
left join eam_location as g on e.site = g.site and e.LocationID = g.LocationID and e.bu_no = g.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.feedBackID != null and query.feedBackID != ''">
|
|
AND a.feedBackID like '%' + #{query.feedBackID} +'%'
|
|
</if>
|
|
<if test="query.defectDesc != null and query.defectDesc != ''">
|
|
AND b.defectDesc like '%' + #{query.defectDesc} +'%'
|
|
</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.startDate != null ">
|
|
AND a.defectDate >= #{query.startDate}
|
|
</if>
|
|
<if test="query.endDate != null ">
|
|
AND #{query.endDate} >= a.defectDate
|
|
</if>
|
|
<if test="query.urgency != null and query.urgency != ''">
|
|
AND a.urgency = #{query.urgency}
|
|
</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.department != null and query.department != ''">
|
|
AND f.department_name like '%' + #{query.department} + '%'
|
|
</if>
|
|
<if test="query.locationName != null and query.locationName != ''">
|
|
AND g.LocationName like '%' + #{query.locationName} + '%'
|
|
</if>
|
|
<if test="query.matterTrackingFlag != null and query.matterTrackingFlag != ''">
|
|
AND a.matter_tracking_flag = #{query.matterTrackingFlag}
|
|
</if>
|
|
and a.FunctionType = #{query.functionType}
|
|
</where>
|
|
ORDER BY a.DefectDate,
|
|
CASE WHEN a.urgency = '特急' THEN 1
|
|
WHEN a.urgency = '紧急' THEN 2
|
|
WHEN a.urgency = '一般' THEN 3
|
|
END
|
|
</select>
|
|
|
|
<select id="eamFeedBackCheck" resultType="com.xujie.sys.modules.pms.data.EamDefectFeedBackInData">
|
|
select Site, FeedBackID, FeedBackDesc, ObjectID, DefectID, Status from eam_defect_feedBack where FeedBackID = #{feedBackID} and site = #{site} and bu_no = #{buNo}
|
|
</select>
|
|
|
|
|
|
<update id="cancelFeedBack" >
|
|
update eam_defect_feedBack
|
|
set status = '已取消'
|
|
where FeedBackID = #{feedBackID} and site = #{site} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<update id="updateFeedBack">
|
|
update eam_defect_feedBack
|
|
set status = '已下达',
|
|
PlanOperator = #{planOperator},
|
|
UpdateDate = GetDate(),
|
|
UpdateBy = #{updateBy}
|
|
where FeedBackID = #{feedBackID} and site = #{site} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<insert id="saveDefectOrder">
|
|
INSERT INTO eam_workOrder
|
|
(Site, bu_no, OrderNo, PlanID, PropertiesCode, ObjectID, Status, PlanOperator, PlanDate, FunctionType, CreateDate, CreateBy)
|
|
values(#{site}, #{buNo}, (select 'X'+ Right( '0000000000'+ convert(VARCHAR(10),isnull(max(convert(INT,SUBSTRING(OrderNo,3,10))),0)+1),8) from eam_workOrder where site = #{site} and FunctionType='C' and bu_no = #{buNo}), #{feedBackID}, '', #{objectID}, '未开工', #{planOperator}, #{planDate}, 'C', GetDate(), #{userId})
|
|
</insert>
|
|
|
|
<select id="getItemLists" resultType="com.xujie.sys.modules.pms.data.EamPropertiesItemData">
|
|
SELECT
|
|
a.site,
|
|
a.bu_no,
|
|
a.itemNo,
|
|
a.ItemDesc,
|
|
a.ItemRemark
|
|
FROM eam_properties_item a
|
|
LEFT JOIN eam_properties_model_detail b on b.function_type = #{functionType} and b.code_no = #{codeNo} and b.properties_item_no = a.ItemNo and a.site = b.site and a.bu_no = b.bu_no and a.check_type = b.check_type
|
|
<where>
|
|
a.site = #{site} and a.bu_no = #{buNo} and a.ItemType = #{functionType} and a.check_type = #{checkType} AND b.code_no is null
|
|
<if test = "itemNo != null and itemNo != ''">
|
|
AND a.ItemNo LIKE '%' + #{itemNo} + '%'
|
|
</if>
|
|
<if test = "itemDesc != null and itemDesc != ''">
|
|
AND a.ItemDesc LIKE '%' + #{itemDesc} + '%'
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="getModelItemLists" resultType="com.xujie.sys.modules.pms.data.EamPropertiesItemData">
|
|
select
|
|
a.site,
|
|
a.bu_no,
|
|
a.properties_item_no itemNo,
|
|
b.ItemDesc,
|
|
b.ItemRemark
|
|
from eam_properties_model_detail a
|
|
left join eam_properties_item b on a.properties_item_no = b.ItemNo and a.function_type = b.ItemType and a.site = b.site and a.bu_no = b.bu_no and a.check_type = b.check_type
|
|
where a.site = #{site} and a.bu_no = #{buNo} and a.code_no = #{codeNo} and a.function_type = #{functionType} and a.check_type = #{checkType}
|
|
</select>
|
|
|
|
<delete id="deleteObjectFile">
|
|
delete from sys_oss where id = #{id}
|
|
</delete>
|
|
|
|
<select id="checkSparPartImage" resultType="SysOssEntity" parameterType="com.xujie.sys.modules.pms.data.EamWorkOrderInData">
|
|
SELECT
|
|
id,
|
|
url,
|
|
create_date,
|
|
file_name,
|
|
new_file_name,
|
|
created_by,
|
|
order_ref1,
|
|
order_ref2, order_ref3, file_type, file_suffix, file_type_code
|
|
FROM sys_oss
|
|
WHERE order_ref2 = #{orderNo}
|
|
AND order_ref1 = #{site}
|
|
AND order_ref3 = 'reportSparPart'
|
|
</select>
|
|
|
|
<!-- 获取机修人员列表 -->
|
|
<select id="getOperatorList" resultType="com.xujie.sys.modules.pms.data.EamAdminData" parameterType="com.xujie.sys.modules.pms.data.EamAdminData">
|
|
SELECT
|
|
ea.AdminID,
|
|
ea.AdminName,
|
|
ea.Phone,
|
|
dbo.get_eam_dept_str(ea.site,ea.AdminID) as departmentName,
|
|
ea.Email,
|
|
ea.Tel,
|
|
ea.LevelID,
|
|
eal.AdminLevelDesc,
|
|
ea.MesUser,
|
|
ea.Active,
|
|
ea.CreatedDate
|
|
FROM eam_admin as ea
|
|
LEFT JOIN eam_adminLevel as eaL ON ea.LevelID = eal.AdminLevelID and ea.site = eal.site
|
|
<where>
|
|
ea.Active = 'Y'
|
|
AND ea.Site = #{site}
|
|
<if test = "adminID != null and adminID != ''">
|
|
AND ea.AdminID LIKE '%' + #{adminID}+'%'
|
|
</if>
|
|
<if test = "adminName != null and adminName != ''">
|
|
AND ea.AdminName LIKE '%' + #{adminName}+'%'
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 获取审核人员列表 -->
|
|
<select id="getCheckerList" resultType="com.xujie.sys.modules.pms.data.EamAdminData" parameterType="com.xujie.sys.modules.pms.data.EamAdminData">
|
|
SELECT
|
|
a.user_id,
|
|
a.username as adminID,
|
|
a.email,
|
|
a.mobile as phone,
|
|
a.user_display as adminName,
|
|
dbo.get_bu_desc(c.site,c.bu_no) as buDesc,
|
|
d.role_id,
|
|
e.role_name
|
|
FROM sys_user as a
|
|
LEFT JOIN eam_access_site as b on a.username = b.username
|
|
LEFT JOIN AccessBu as c on b.username = c.username and b.site = c.site
|
|
LEFT JOIN sys_user_role as d on a.user_id = d.user_id
|
|
LEFT JOIN sys_role as e on d.role_id = e.role_id
|
|
<where>
|
|
b.site = #{site} and c.bu_no = #{buNo}
|
|
<if test = "adminID != null and adminID != ''">
|
|
AND a.username LIKE '%' + #{adminID}+'%'
|
|
</if>
|
|
<if test = "adminName != null and adminName != ''">
|
|
AND a.user_display LIKE '%' + #{adminName}+'%'
|
|
</if>
|
|
<if test = "buDesc != null and buDesc != ''">
|
|
AND dbo.get_bu_desc(a.site,c.bu_no) LIKE '%' + #{buDesc} + '%'
|
|
</if>
|
|
<if test = "roleId != null and roleId != ''">
|
|
AND d.role_id = #{roleId}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 点检工单审核 -->
|
|
<update id="checkWorkOrder" parameterType="com.xujie.sys.modules.pms.data.EamWorkOrderInData">
|
|
UPDATE eam_workOrder
|
|
SET Status = '已完工'
|
|
WHERE Site = #{site} AND OrderNo = #{orderNo} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<update id="cancelCheckWorkOrder" parameterType="com.xujie.sys.modules.pms.data.EamWorkOrderInData">
|
|
UPDATE eam_workOrder
|
|
SET Status = '待审核'
|
|
WHERE Site = #{site} AND OrderNo = #{orderNo} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<!-- 查看点检工单状态 -->
|
|
<select id="checkWorkOrderStatus" resultType="com.xujie.sys.modules.pms.data.EamWorkOrderInData" parameterType="com.xujie.sys.modules.pms.data.EamWorkOrderInData">
|
|
SELECT
|
|
OrderNo
|
|
FROM eam_workOrder
|
|
WHERE site = #{site} AND PlanID = #{planID} AND Status != '已完工' and bu_no = #{buNo}
|
|
</select>
|
|
|
|
<!-- 点检工单审核 -->
|
|
<update id="updateWorkPlanOverviewStatus" parameterType="com.xujie.sys.modules.pms.data.EamWorkOrderInData">
|
|
UPDATE eam_workPlan_overview
|
|
SET status = '已结束'
|
|
WHERE site = #{site} AND plan_id = #{planID} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<!-- 新增点检计划 -->
|
|
<insert id="saveWorkPlan" parameterType="com.xujie.sys.modules.pms.data.EamWorkPlanInData">
|
|
INSERT INTO eam_workPlan_overview
|
|
(site, plan_id, plan_desc, status, plan_start_date, plan_end_date, created_date, created_by, update_date, update_by,
|
|
remark, delete_flag, operator, operator_name, checker, checker_name, function_type, properties_code, plan_period,
|
|
work_order_rule, plan_cycle, task_start_date, plan_halt_date, auto_renewal, bu_no, check_type)
|
|
VALUES
|
|
(#{site}, #{planID}, #{planDesc}, '已计划', #{planStartDate}, #{planEndDate}, getDate(), #{createdBy}, getDate(), #{updateBy},
|
|
#{remark}, 'N', #{operator}, #{operatorName}, #{checker}, #{checkerName}, #{functionType}, #{propertiesCode}, #{planPeriod},
|
|
#{workOrderRule}, #{planCycle}, #{taskStartDate}, #{planHaltDate}, #{autoRenewal}, #{buNo}, #{checkType})
|
|
</insert>
|
|
|
|
<!-- 生成工单ID -->
|
|
<select id="selectOrderId" resultType="string" parameterType="com.xujie.sys.modules.pms.data.EamWorkPlanInData">
|
|
SELECT
|
|
Right('0000000000'+ convert(VARCHAR(10), isnull(max(convert(INT,SUBSTRING(PlanID,3,10))),0)+1),8)
|
|
FROM eam_workPlan
|
|
WHERE site = #{site} AND FunctionType = #{functionType} and bu_no = #{buNo}
|
|
</select>
|
|
|
|
<!-- 查询计划中的设备列表 -->
|
|
<select id="getPlanDetailList" resultType="com.xujie.sys.modules.pms.data.WorkPlanDetailData" parameterType="com.xujie.sys.modules.pms.data.WorkPlanDetailData">
|
|
SELECT
|
|
ewp.PlanID,
|
|
ewp.PlanDesc,
|
|
ewp.ObjectID,
|
|
eo.ObjectDesc,
|
|
eo.FamilyID,
|
|
ef.FamilyDesc,
|
|
eo.LocationID,
|
|
el.LocationName
|
|
FROM eam_workPlan as ewP
|
|
LEFT JOIN eam_object as eo ON ewP.ObjectID = eo.ObjectID and ewP.Site = eo.Site and ewP.bu_no = eo.bu_no
|
|
LEFT JOIN eam_family as ef ON eo.FamilyID = ef.FamilyID and ewP.Site = ef.Site and ewP.bu_no = ef.bu_no
|
|
LEFT JOIN eam_location as el ON eo.LocationID = el.LocationID and ewP.Site = el.Site and ewP.bu_no = el.bu_no
|
|
<where>
|
|
ewP.site = #{site} and ewP.bu_no = #{buNo}
|
|
AND ewp.PlanID = #{planID}
|
|
<if test = "objectID != null and objectID != ''">
|
|
AND eo.ObjectID LIKE '%' + #{objectID}+'%'
|
|
</if>
|
|
<if test = "objectDesc != null and objectDesc != ''">
|
|
AND eo.ObjectDesc LIKE '%' + #{objectDesc}+'%'
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 删除计划中的设备 -->
|
|
<delete id="delPlanDetail" parameterType="com.xujie.sys.modules.pms.data.WorkPlanDetailData">
|
|
DELETE FROM eam_workPlan
|
|
WHERE Site = #{site}
|
|
AND PlanID = #{planID}
|
|
AND ObjectID = #{objectID}
|
|
</delete>
|
|
|
|
<!-- 获取当前计划不包含的设备 -->
|
|
<select id="getObjList1" resultType="com.xujie.sys.modules.pms.data.WorkPlanDetailData" parameterType="com.xujie.sys.modules.pms.data.WorkPlanDetailData">
|
|
SELECT
|
|
a.ObjectID,
|
|
a.ObjectDesc,
|
|
a.FamilyID,
|
|
ef.FamilyDesc,
|
|
a.LocationID,
|
|
el.LocationName
|
|
FROM eam_object a
|
|
LEFT JOIN eam_workPlan b ON b.PlanID = #{planID} and b.ObjectID = a.ObjectID and a.site = b.site and a.bu_no = b.bu_no
|
|
LEFT JOIN eam_family as ef ON a.FamilyID = ef.FamilyID and a.site = ef.site and a.bu_no = ef.bu_no
|
|
LEFT JOIN eam_location as el ON a.LocationID = el.LocationID and a.site = el.site and a.bu_no = el.bu_no
|
|
WHERE a.site = #{site} and a.bu_no = #{buNo} and b.PlanID is null
|
|
</select>
|
|
|
|
<!-- 获取当前计划包含的设备 -->
|
|
<select id="getObjList2" resultType="com.xujie.sys.modules.pms.data.WorkPlanDetailData" parameterType="com.xujie.sys.modules.pms.data.WorkPlanDetailData">
|
|
SELECT
|
|
a.ObjectID,
|
|
b.ObjectDesc,
|
|
b.FamilyID,
|
|
ef.FamilyDesc,
|
|
b.LocationID,
|
|
el.LocationName
|
|
FROM eam_workPlan a
|
|
LEFT JOIN eam_object b ON a.ObjectID = b.ObjectID and a.site = b.site and a.bu_no = b.bu_no
|
|
LEFT JOIN eam_family as ef ON b.FamilyID = ef.FamilyID and a.site = ef.site and a.bu_no = ef.bu_no
|
|
LEFT JOIN eam_location as el ON b.LocationID = el.LocationID and a.site = el.site and a.bu_no = el.bu_no
|
|
WHERE a.PlanID = #{planID} and a.site = #{site} and a.bu_no = #{buNo}
|
|
</select>
|
|
|
|
<!-- 添加计划设备 -->
|
|
<insert id="addObject" parameterType="com.xujie.sys.modules.pms.data.EamWorkPlanInData">
|
|
INSERT INTO eam_workPlan
|
|
(Site,PlanID,PlanDesc,ObjectID,FunctionType,PropertiesCode,Operator,OperatorName,checker,checkerName,PlanPeriod,Status,PlanStartDate,PlanEndDate,CreatedDate,CreatedBy,Version,Remark,DeleteFlag)
|
|
values (#{site},#{planID},#{planDesc},#{objectID},#{functionType},#{propertiesCode},#{operator},#{operatorName},#{checker},#{checkerName},#{planPeriod},#{status},#{planStartDate},#{planEndDate},GetDate(),#{createdBy},0,#{remark},'N')
|
|
</insert>
|
|
|
|
<!-- 修改工单计划 -->
|
|
<update id="updateWorkPlan" parameterType="com.xujie.sys.modules.pms.data.EamWorkPlanInData">
|
|
UPDATE eam_workPlan_overview
|
|
SET plan_desc = #{planDesc},
|
|
properties_code = #{propertiesCode},
|
|
plan_start_date = #{planStartDate},
|
|
plan_end_date = #{planEndDate},
|
|
plan_period = #{planPeriod},
|
|
remark = #{remark},
|
|
operator = #{operator},
|
|
operator_name = #{operatorName},
|
|
checker = #{checker},
|
|
checker_name = #{checkerName},
|
|
work_order_rule = #{workOrderRule},
|
|
task_start_date = #{taskStartDate},
|
|
plan_cycle = #{planCycle},
|
|
plan_halt_date = #{planHaltDate},
|
|
auto_renewal = #{autoRenewal}
|
|
WHERE site = #{site} AND plan_id = #{planID} AND function_type = #{functionType} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<!-- 删除该计划的旧设备 -->
|
|
<delete id="delWorkPlanObject" parameterType="com.xujie.sys.modules.pms.data.EamWorkPlanInData">
|
|
DELETE FROM eam_workPlan
|
|
WHERE Site = #{site} AND PlanID = #{planID} and bu_no = #{buNo}
|
|
</delete>
|
|
|
|
<!-- 删除该计划的旧设备item -->
|
|
<delete id="delWorkPlanItem" parameterType="com.xujie.sys.modules.pms.data.EamWorkPlanInData">
|
|
DELETE FROM eam_workPlan_item
|
|
WHERE Site = #{site} AND PlanID = #{planID} and bu_no = #{buNo}
|
|
</delete>
|
|
|
|
<!-- 删除该计划的旧设备itemAvailable-->
|
|
<delete id="delWorkPlanItemAvailable">
|
|
DELETE FROM eam_workPlan_item_available
|
|
WHERE Site = #{site}
|
|
AND PlanID = #{planID}
|
|
AND ObjectID = #{objectID}
|
|
</delete>
|
|
|
|
<!-- 查询该计划的设备 -->
|
|
<select id="planObjectSearch" resultType="com.xujie.sys.modules.pms.data.EamWorkPlanItemData" parameterType="com.xujie.sys.modules.pms.data.EamWorkPlanItemData">
|
|
SELECT DISTINCT
|
|
a.ObjectID,
|
|
b.ObjectDesc
|
|
FROM eam_workPlan_item as a
|
|
LEFT JOIN eam_object as b ON a.ObjectID = b.ObjectID and a.site = b.site and a.bu_no = b.bu_no
|
|
WHERE a.Site = #{site} AND a.PlanID = #{planID} and a.bu_no = #{buNo}
|
|
</select>
|
|
|
|
<!-- 修改该计划状态 -->
|
|
<update id="updateOverviewStatus" parameterType="com.xujie.sys.modules.pms.data.EamWorkPlanInData">
|
|
UPDATE eam_workPlan_overview
|
|
SET status = '进行中',
|
|
next_work_date = plan_start_date
|
|
WHERE site = #{site} AND plan_id = #{planID} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<!-- 查询文件路径 -->
|
|
<select id="searchFileUrl" resultType="SysOssEntity" parameterType="com.xujie.sys.modules.pms.data.EamWorkOrderInData">
|
|
SELECT
|
|
id,
|
|
url,
|
|
file_name,
|
|
create_date,
|
|
new_file_name,
|
|
created_by,
|
|
order_ref1,
|
|
order_ref2,
|
|
order_ref3,
|
|
order_ref4,
|
|
file_type,
|
|
file_suffix,
|
|
file_type_code
|
|
FROM sys_oss
|
|
WHERE order_ref1 = #{site} AND order_ref2 = #{orderNo} AND order_ref3 = #{folder} and order_ref4 = #{buNo}
|
|
</select>
|
|
|
|
<!-- 新增子明细信息 -->
|
|
<insert id="saveOperator" parameterType="com.xujie.sys.modules.pms.data.EamWorkOrderInData">
|
|
INSERT INTO eam_actual_operator
|
|
(site, order_no, function_type, operator, bu_no)
|
|
VALUES (#{site}, #{orderNo}, #{functionType}, #{operator}, #{buNo})
|
|
</insert>
|
|
|
|
<!-- AND Status = '已完工' AND PlanOperator is not null-->
|
|
|
|
<!-- 查询实际维修人员 -->
|
|
<select id="getActualOperatorList2" resultType="com.xujie.sys.modules.pms.data.EamAdminData">
|
|
SELECT
|
|
ea.AdminID,
|
|
ea.AdminName
|
|
FROM eam_actual_operator as eao
|
|
LEFT JOIN eam_admin as ea ON eao.operator = ea.AdminID and eao.site = ea.Site
|
|
LEFT JOIN eam_workOrder as ew ON eao.site = ew.Site and eao.function_type = ew.FunctionType and eao.order_no = ew.OrderNo
|
|
WHERE eao.site = #{site} AND eao.function_type = #{functionType} AND ew.PlanID = #{planID}
|
|
</select>
|
|
|
|
<!-- 查询实际维修人员 -->
|
|
<select id="getActualOperatorList" resultType="com.xujie.sys.modules.pms.data.EamAdminData">
|
|
SELECT
|
|
ea.username as adminID,
|
|
ea.user_display as AdminName
|
|
FROM eam_actual_operator as eao
|
|
LEFT JOIN sys_user as ea ON eao.operator = ea.username
|
|
WHERE eao.site = #{site} AND eao.order_no = #{orderNo} AND eao.function_type = #{functionType} and eao.bu_no = #{buNo}
|
|
</select>
|
|
|
|
<!-- 查询设备所属部门 -->
|
|
<select id="selectDeptByObjectID" resultType="string" parameterType="string">
|
|
SELECT ved.department_name
|
|
FROM eam_object as eo
|
|
LEFT JOIN sys_department as ved ON eo.site = ved.site and eo.dept_id = ved.department_id
|
|
WHERE eo.site = #{site}
|
|
AND eo.ObjectID = #{objectID}
|
|
</select>
|
|
|
|
<!-- 查询用户所属部门 -->
|
|
<select id="selectAdminIdByUserName" resultType="string" parameterType="string">
|
|
SELECT AdminID
|
|
FROM eam_admin
|
|
WHERE site = #{site}
|
|
AND MesUser = #{username}
|
|
</select>
|
|
|
|
<!-- <!– 查询部门列表 –>-->
|
|
<!-- <select id="getDeptList" resultType="string" parameterType="string">-->
|
|
<!-- SELECT-->
|
|
<!-- ved.department_name-->
|
|
<!-- FROM eam_admin_dept as ead-->
|
|
<!-- LEFT JOIN sys_department as ved ON ead.site = ved.site and ead.dept_id = ved.department_id-->
|
|
<!-- LEFT JOIN eam_admin as ea ON ead.site = ea.site and ead.admin_id = ea.AdminID-->
|
|
<!-- WHERE ead.site = #{site} AND ea.MesUser = #{username}-->
|
|
<!-- </select>-->
|
|
<!-- 查询部门列表 -->
|
|
<select id="getDeptList" resultType="string" parameterType="string">
|
|
SELECT
|
|
distinct c.department_name
|
|
from sys_user as a
|
|
left join Access_dept as b on a.username = b.username
|
|
left join sys_department as c on c.site in (select site from eam_access_site where username = #{username})
|
|
and (c.site + '-' + c.bu_no) in (select * from dbo.query_bu(#{username}))
|
|
and b.department_id = c.department_id
|
|
where a.username = #{username}
|
|
</select>
|
|
|
|
<!-- 生成新的维修工单 -->
|
|
<insert id="saveDefectWorkOrder" parameterType="com.xujie.sys.modules.pms.data.EamWorkOrderInData">
|
|
INSERT INTO eam_workOrder
|
|
(Site, bu_no, OrderNo, PlanID, PropertiesCode, ObjectID, Status, PlanDate, FunctionType, CreateDate, CreateBy, check_work_plan_id, check_item_no, document_source, repair_reporting_type, repair_type, PlanOperator)
|
|
VALUES
|
|
(#{site}, #{buNo}, #{orderNo}, #{planID}, '', #{objectID}, '未开工', getDate(), 'C', getDate(), #{createBy}, #{checkWorkPlanId}, #{checkItemNo}, #{documentSource}, #{repairReportingType}, #{repairType}, #{planOperator})
|
|
</insert>
|
|
|
|
<!-- 获取旧工单的基础信息 -->
|
|
<select id="queryOldWorkOrderMessage" resultType="com.xujie.sys.modules.pms.data.EamWorkOrderInData" parameterType="com.xujie.sys.modules.pms.data.EamWorkOrderInData">
|
|
select
|
|
PlanOperator,
|
|
PlanOperatorName,
|
|
checker,
|
|
checkerName
|
|
from eam_workOrder where site = #{site} and OrderNo = #{orderNo} and FunctionType = #{functionType} and bu_no = #{buNo}
|
|
</select>
|
|
|
|
<!-- 生成新的维保工单 -->
|
|
<insert id="saveMaintenanceWorkOrder" parameterType="com.xujie.sys.modules.pms.data.EamWorkOrderInData">
|
|
INSERT INTO eam_workOrder
|
|
(Site, bu_no, OrderNo, PlanID, PlanDesc, PropertiesCode, ObjectID, Status, PlanOperator, PlanDate, FunctionType, CreateDate, CreateBy, checker, PlanOperatorName, checkerName)
|
|
VALUES (#{site}, #{buNo}, #{orderNo}, #{planID}, #{planDesc}, #{propertiesCode}, #{objectID}, '未开工', #{planOperator}, Dateadd(dd, Datediff(dd,0,Getdate()), 0), #{functionType}, getDate(), #{createBy}, #{checker}, #{planOperatorName}, #{checkerName})
|
|
</insert>
|
|
|
|
<!-- 检查系统操作人和审核人员是否一致 -->
|
|
<select id="selectNameByMes" resultType="com.xujie.sys.modules.pms.data.EamAdminData" parameterType="com.xujie.sys.modules.pms.data.EamAdminData">
|
|
SELECT AdminName
|
|
FROM eam_admin
|
|
WHERE site = #{site}
|
|
AND MesUser = #{mesUser}
|
|
</select>
|
|
|
|
<!-- 维修审核确认 -->
|
|
<update id="submitDefect" parameterType="com.xujie.sys.modules.pms.data.EamWorkOrderInData">
|
|
UPDATE eam_workOrder
|
|
SET Status = #{status},
|
|
difficulty_level = #{difficultyLevel},
|
|
difficulty_remark = #{difficultyRemark}
|
|
WHERE Site = #{site} AND OrderNo = #{orderNo} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<!-- 查询设备的点检和维保历史记录 -->
|
|
<select id="queryHistoryRecord" resultType="com.xujie.sys.modules.pms.data.EamWorkOrderInData" parameterType="com.xujie.sys.modules.pms.data.EamWorkOrderInData">
|
|
SELECT
|
|
ewo.OrderNo,
|
|
ewo.PlanID,
|
|
ewo.PlanDesc,
|
|
ewo.ActualDate,
|
|
ewo.ObjectID,
|
|
eo.ObjectDesc,
|
|
ewo.Remark,
|
|
dbo.eam_Get_eamAdminName(ewo.site, ewo.ActualOperator) ActualOperatorName,
|
|
ewo.checkResult,
|
|
FROM eam_workOrder as ewo
|
|
LEFT JOIN eam_object as eo ON ewo.site = eo.site and ewo.ObjectID = eo.ObjectID and ewo.bu_no = eo.bu_no
|
|
WHERE ewo.site = #{query.site} and ewo.bu_no = #{query.buNo} and ewo.ObjectID = #{query.objectID} and ewo.FunctionType = #{query.functionType} and (ewo.Status = '已完工' or ewo.Status = '待审核')
|
|
ORDER BY ewo.ActualDate desc
|
|
</select>
|
|
|
|
<!-- 查询设备的维修历史记录 -->
|
|
<select id="queryDefectHistoryRecord" resultType="com.xujie.sys.modules.pms.data.EamWorkOrderInData" parameterType="com.xujie.sys.modules.pms.data.EamWorkOrderInData">
|
|
SELECT DISTINCT
|
|
ewo.OrderNo,
|
|
ewo.PlanID,
|
|
ewo.PlanDesc,
|
|
ewo.ActualDate,
|
|
ewo.Remark,
|
|
ewo.Result,
|
|
ewo.disposal_measures,
|
|
ed.DefectDesc,
|
|
ewo.WorkTime,
|
|
dbo.eam_Get_eamAdminName(ewo.Site, ewo.ActualOperator) actualOperatorName,
|
|
case when so.id is not null then 'Y' else 'N' end as reportFaultFlag,
|
|
case when so1.id is not null then 'Y' else 'N' end as reportSparPartFlag
|
|
FROM eam_workOrder as ewo
|
|
LEFT JOIN eam_object as eo ON ewo.site = eo.site and ewo.ObjectID = eo.ObjectID and ewo.bu_no = eo.bu_no
|
|
LEFT JOIN eam_defect_feedBack as edf ON ewo.site = edf.site and ewo.PlanID = edf.FeedBackID and ewo.bu_no = edf.bu_no
|
|
LEFT JOIN eam_defect as ed ON ed.DefectID = edf.DefectID
|
|
LEFT JOIN sys_oss as so on so.order_ref1 = ewo.Site AND so.order_ref2 = ewo.OrderNo AND so.order_ref3 = 'reportFault' and so.order_ref4 = ewo.bu_no
|
|
LEFT JOIN sys_oss as so1 on so1.order_ref1 = ewo.Site AND so1.order_ref2 = ewo.OrderNo AND so1.order_ref3 =
|
|
'reportSparPart' and so1.order_ref4 = ewo.bu_no
|
|
<where>ewo.site = #{query.site} and ewo.bu_no = #{query.buNo} and ewo.ObjectID = #{query.objectID} and
|
|
ewo.FunctionType = #{query.functionType} AND (ewo.Status = '已完工' or ewo.Status = '待审核')
|
|
<if test="query.startDate != null ">
|
|
AND ewo.ActualDate >= #{query.startDate}
|
|
</if>
|
|
<if test="query.endDate != null ">
|
|
AND #{query.endDate} >= ewo.ActualDate
|
|
</if>
|
|
</where> ORDER BY ewo.ActualDate desc
|
|
</select>
|
|
|
|
<!-- 查询部门列表 -->
|
|
<select id="getEmpyDeptList" resultType="com.xujie.sys.modules.pms.data.EmpyDept" parameterType="com.xujie.sys.modules.pms.data.EmpyDept">
|
|
SELECT
|
|
site,
|
|
department_id as deptId,
|
|
department_name as deptName
|
|
FROM sys_department
|
|
<where>
|
|
site in (select site from eam_access_site where username = #{userName})
|
|
and (site + '-' + bu_no) in (select * from dbo.query_bu(#{userName}))
|
|
<if test = "deptId != null and deptId != ''">
|
|
AND department_id LIKE '%' + #{deptId}+'%'
|
|
</if>
|
|
<if test = "deptName != null and deptName != ''">
|
|
AND department_name LIKE '%' + #{deptName}+'%'
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 生成新的维修工单 -->
|
|
<insert id="saveAdminDepartment">
|
|
INSERT INTO eam_admin_dept
|
|
(Site, admin_id, dept_id)
|
|
VALUES (#{site}, #{adminID}, #{deptId})
|
|
</insert>
|
|
|
|
<!-- 查询部门详情 -->
|
|
<select id="getDeptDetail" resultType="com.xujie.sys.modules.pms.data.EamAdminData" parameterType="string">
|
|
SELECT
|
|
ved.department_id as department,
|
|
ved.department_name as departmentName
|
|
FROM eam_admin_dept as ead
|
|
LEFT JOIN sys_department as ved ON ead.site = ved.site and ead.dept_id = ved.department_id and ead.bu_no = ved.bu_no
|
|
WHERE ead.site in (select site from eam_access_site where username = #{userName})
|
|
and (ead.site + '-' + ead.bu_no) in (select * from dbo.query_bu(#{userName}))
|
|
AND ead.admin_id = #{adminID}
|
|
</select>
|
|
|
|
<!-- 删除旧数据-->
|
|
<delete id="deleteAdminDepartment">
|
|
DELETE FROM eam_admin_dept
|
|
WHERE site = #{site}
|
|
AND admin_id = #{adminID}
|
|
</delete>
|
|
|
|
<!-- 获取可用的MES账号 -->
|
|
<select id="getMesList" resultType="com.xujie.sys.modules.sys.entity.SysUserEntity" parameterType="com.xujie.sys.modules.sys.entity.SysUserEntity">
|
|
SELECT
|
|
a.username,
|
|
a.user_display
|
|
FROM sys_user a
|
|
LEFT JOIN eam_admin b ON b.MesUser = a.username and a.site = b.site
|
|
WHERE a.site = #{site}
|
|
AND b.MesUser is null
|
|
</select>
|
|
|
|
<!-- 查询点检项目 -->
|
|
<select id="eamPropertiesItemSearch" parameterType="com.xujie.sys.modules.pms.data.EamPropertiesItemData" resultType="com.xujie.sys.modules.pms.data.EamPropertiesItemData">
|
|
SELECT
|
|
site,
|
|
bu_no,
|
|
dbo.get_bu_desc(site, bu_no) as buDesc,
|
|
ItemNo,
|
|
ItemDesc,
|
|
DefaultValue,
|
|
ValueType,
|
|
ValueType_DB as valueTypeDb,
|
|
ValueChooseFlag,
|
|
case when ValueChooseFlag = 'Y' then '是' when ValueChooseFlag = 'N' then '否' else '' end as valueChooseFlagDesc,
|
|
CreatedDate,
|
|
CreatedBy,
|
|
dbo.getOperatorDesc(site, CreatedBy) as createdByDesc,
|
|
update_date,
|
|
update_by,
|
|
dbo.getOperatorDesc(site, update_by) as updateByDesc,
|
|
MaxValue,
|
|
MinValue,
|
|
ItemRemark,
|
|
ItemType,
|
|
image_flag,
|
|
produce_control_flag,
|
|
check_type
|
|
FROM eam_properties_item
|
|
<where>
|
|
site in (select site from eam_access_site where username = #{query.userName})
|
|
and (site + '-' + bu_no) in (select * from dbo.query_bu(#{query.userName}))
|
|
and check_type in (select role_no from access_role where username = #{query.userName})
|
|
and ItemType = #{query.itemType}
|
|
<if test="query.buDesc != null and query.buDesc != ''">
|
|
AND dbo.get_bu_desc(site, bu_no) = #{query.buDesc}
|
|
</if>
|
|
<if test="query.itemNo != null and query.itemNo != ''">
|
|
AND ItemNo LIKE '%' + #{query.itemNo} + '%'
|
|
</if>
|
|
<if test="query.itemDesc != null and query.itemDesc != ''">
|
|
AND ItemDesc LIKE '%' + #{query.itemDesc} + '%'
|
|
</if>
|
|
<if test="query.checkType != null and query.checkType != ''">
|
|
AND check_type = #{query.checkType}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 删除图片-->
|
|
<delete id="imageDelete" parameterType="SysOssEntity">
|
|
DELETE FROM sys_oss
|
|
WHERE id = #{id}
|
|
</delete>
|
|
|
|
<!-- 检查该日期内是否已有该设备的计划 -->
|
|
<select id="checkObjectPlan" resultType="com.xujie.sys.modules.pms.data.EamWorkPlanInData" parameterType="com.xujie.sys.modules.pms.data.EamWorkPlanInData">
|
|
SELECT
|
|
a.PlanID,
|
|
a.ObjectID
|
|
FROM eam_workPlan a
|
|
LEFT JOIN eam_workOrder b ON a.site = b.site AND a.PlanID = b.PlanID and a.FunctionType = b.FunctionType and a.ObjectID = b.ObjectID and a.bu_no = b.bu_no
|
|
WHERE a.site = #{site} and a.bu_no = #{buNo} and a.check_type = #{checkType}
|
|
AND a.ObjectID = #{objectID} AND a.FunctionType = #{functionType} AND a.Status in ('已计划','进行中') AND a.deleteFlag = 'N'
|
|
AND (convert(varchar(10), a.PlanStartDate, 120) between #{planStartDate} and #{planEndDate}
|
|
or convert(varchar(10), a.PlanEndDate, 120) between #{planStartDate} and #{planEndDate}
|
|
or (DATEDIFF(day, a.PlanStartDate, #{planStartDate}) >= 0 and DATEDIFF(day, #{planEndDate}, a.PlanEndDate) >= 0))
|
|
and a.PropertiesCode = #{propertiesCode} and a.plan_cycle = #{planCycle} and a.PlanPeriod = #{planPeriod}
|
|
and b.Status not in ('已取消','已完工','待审核')
|
|
</select>
|
|
|
|
<!-- 查询当前计划 -->
|
|
<select id="queryWorkPlan" resultType="com.xujie.sys.modules.pms.data.EamWorkPlanInData" parameterType="com.xujie.sys.modules.pms.data.EamWorkPlanInData">
|
|
SELECT
|
|
site,
|
|
bu_no,
|
|
plan_id,
|
|
plan_desc,
|
|
properties_code,
|
|
#{objectID} as objectID,
|
|
status,
|
|
operator,
|
|
delete_flag,
|
|
plan_start_date,
|
|
plan_end_date,
|
|
plan_period,
|
|
function_type,
|
|
checker,
|
|
checker_name,
|
|
operator_name,
|
|
work_order_rule,
|
|
plan_cycle,
|
|
check_type
|
|
FROM eam_workPlan_overview
|
|
WHERE site = #{site} AND plan_id = #{planID} AND function_type = #{functionType} and bu_no = #{buNo}
|
|
</select>
|
|
|
|
<!-- 获得工单号 -->
|
|
<select id="queryPlanOrderNo" resultType="string" parameterType="com.xujie.sys.modules.pms.data.EamWorkPlanInData">
|
|
SELECT
|
|
Right( '0000000000'+ convert(VARCHAR(10),isnull(max(convert(INT,SUBSTRING(OrderNo,3,10))),0)+1),8)
|
|
FROM eam_workOrder
|
|
WHERE site = #{site} and bu_no = #{buNo} AND FunctionType = #{functionType}
|
|
</select>
|
|
|
|
<!-- 新增工单 -->
|
|
<insert id="insertWorkOrder" parameterType="com.xujie.sys.modules.pms.data.EamWorkPlanInData">
|
|
INSERT INTO eam_workOrder
|
|
(Site, bu_no, OrderNo, PlanID, PlanDesc, PropertiesCode, ObjectID, Status, PlanOperator, PlanDate, FunctionType,CreateDate, CreateBy, checker, PlanOperatorName, checkerName, check_type)
|
|
VALUES
|
|
(#{site}, #{buNo}, #{orderNo}, #{planID}, #{planDesc}, #{propertiesCode}, #{objectID}, '未开工', #{operator}, #{planStartDate}, #{functionType}, getDate(), #{userId}, #{checker}, #{operatorName}, #{checkerName}, #{checkType})
|
|
</insert>
|
|
|
|
<!-- 循环新增工单 -->
|
|
<insert id="forInsertWorkOrder" parameterType="com.xujie.sys.modules.pms.data.EamWorkPlanInData">
|
|
INSERT INTO eam_workOrder
|
|
(Site, bu_no, OrderNo, PlanID, PlanDesc, PropertiesCode, ObjectID, Status, PlanOperator, PlanDate, FunctionType,CreateDate, CreateBy, checker, PlanOperatorName, checkerName, last_execution_date, check_type)
|
|
VALUES
|
|
(#{site}, #{buNo}, #{orderNo}, #{planID}, #{planDesc}, #{propertiesCode}, #{objectID}, '未开工', #{operator}, #{orderDate}, #{functionType}, getDate(), #{userId}, #{checker}, #{operatorName}, #{checkerName}, #{lastExecutionDate}, #{checkType})
|
|
</insert>
|
|
|
|
<!-- 更改plan表的状态为进行中 -->
|
|
<update id="updatePlanStatus" parameterType="com.xujie.sys.modules.pms.data.EamWorkPlanInData">
|
|
update eam_workPlan
|
|
set status = '进行中',
|
|
NextWorkDate = PlanStartDate
|
|
where site = #{site} and PlanID = #{planID} and FunctionType = #{functionType} and ObjectID = #{objectID} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<!-- 获得工单号 -->
|
|
<select id="queryFileByOrderNoAndItemNo" resultType="SysOssEntity" parameterType="com.xujie.sys.modules.pms.data.EamWorkOrderItemInData">
|
|
SELECT
|
|
id,
|
|
file_name
|
|
FROM sys_oss
|
|
WHERE order_ref1 = #{site} AND order_ref2 = #{orderNo} AND order_ref3 = #{itemNo} and order_ref4 = #{buNo}
|
|
</select>
|
|
|
|
<!-- 删除原来工单项目-->
|
|
<delete id="deleteWorkPlanItem" parameterType="com.xujie.sys.modules.pms.data.EamWorkOrderItemInData">
|
|
DELETE FROM eam_workPlan_item
|
|
WHERE site = #{site} and PlanID = #{planID} and ItemType = #{itemType} and ObjectID = #{objectID} and bu_no = #{buNo}
|
|
</delete>
|
|
|
|
<!-- 删除原来的可选值-->
|
|
<delete id="deleteWorkPlanItemAvailable" parameterType="com.xujie.sys.modules.pms.data.EamWorkOrderItemInData">
|
|
DELETE FROM eam_workPlan_item_available
|
|
WHERE site = #{site} and PlanID = #{planID} and ItemType = #{itemType} and ObjectID = #{objectID} and bu_no = #{buNo}
|
|
</delete>
|
|
|
|
<!-- 添加新项目 -->
|
|
<insert id="saveWorkPlanItem" parameterType="com.xujie.sys.modules.pms.data.EamWorkOrderItemInData">
|
|
INSERT INTO eam_workPlan_item (Site, bu_no, PlanID, ObjectID, ItemNo, ItemDesc, DefaultValue, ValueType, ValueType_DB, ValueChooseFlag, MaxValue, MinValue, ItemRemark, ItemType, CreatedDate, CreatedBy, image_flag, produce_control_flag)
|
|
select
|
|
#{site},
|
|
#{buNo},
|
|
#{planID},
|
|
#{objectID},
|
|
a.ItemNo,
|
|
a.ItemDesc,
|
|
case when c.site is not null then c.DefaultValue else a.DefaultValue end,
|
|
case when c.site is not null then c.ValueType else a.ValueType end,
|
|
case when c.site is not null then c.ValueType_DB else a.ValueType_DB end,
|
|
case when c.site is not null then c.ValueChooseFlag else a.ValueChooseFlag end,
|
|
case when c.site is not null then c.MaxValue else a.MaxValue end,
|
|
case when c.site is not null then c.MinValue else a.MinValue end,
|
|
a.ItemRemark,
|
|
a.ItemType,
|
|
GetDate(),
|
|
#{userId},
|
|
a.image_flag,
|
|
a.produce_control_flag
|
|
from eam_properties_item a
|
|
left join eam_properties_model_detail b on a.ItemType = b.function_type and a.ItemNo = b.properties_item_no and a.site = b.site and a.bu_no = b.bu_no
|
|
left join eam_object_item c on a.ItemType = c.ItemType and a.ItemNo = c.ItemNo and c.objectID = #{objectID}
|
|
where a.ItemType = #{itemType} and b.code_no = #{propertiesCode} and a.site = #{site} and a.bu_no = #{buNo}
|
|
</insert>
|
|
|
|
<!-- 添加新项目可选值 -->
|
|
<insert id="saveWorkPlanItemAvailable" parameterType="com.xujie.sys.modules.pms.data.EamWorkOrderItemInData">
|
|
INSERT INTO eam_workPlan_item_available (Site, bu_no, PlanID, ObjectID, ItemNo, ItemType, ValueNo, AvailableValue, CreatedDate, CreatedBy)
|
|
SELECT DISTINCT
|
|
#{site},
|
|
#{buNo},
|
|
#{planID},
|
|
#{objectID},
|
|
a.ItemNo,
|
|
a.ItemType,
|
|
case when c.ValueNo is not null then c.ValueNo else a.ValueNo end,
|
|
case when c.ValueNo is not null then c.AvailableValue else a.AvailableValue end,
|
|
GetDate(),
|
|
#{userId}
|
|
FROM eam_properties_item_available a
|
|
LEFT JOIN eam_properties_model_detail b on a.ItemType = b.function_type and a.ItemNo = b.properties_item_no and a.site = b.site and a.bu_no = b.bu_no
|
|
LEFT JOIN eam_object_item_available c on a.ItemNo = c.ItemNo and a.ItemType = c.ItemType and c.ObjectID = #{objectID}
|
|
WHERE a.ItemType = #{itemType} and b.code_no = #{propertiesCode} and a.site = #{site} and a.bu_no = #{buNo}
|
|
</insert>
|
|
|
|
<!-- 检查维修任务号是否已存在 -->
|
|
<select id="getEamGzData" resultType="com.xujie.sys.modules.pms.data.EamDefectFeedBackData" parameterType="com.xujie.sys.modules.pms.data.EamDefectFeedBackData">
|
|
select
|
|
a.Site,
|
|
a.bu_no,
|
|
a.FeedBackID,
|
|
a.FeedBackDesc,
|
|
a.ObjectID,
|
|
a.Status,
|
|
ISNULL(c.public_facilities_flag,'N') AS public_facilities_flag
|
|
from eam_defect_feedBack a
|
|
left join eam_defect b on a.DefectID = b.DefectID
|
|
left join eam_object c on a.ObjectID = c.ObjectID and a.site = c.site and a.bu_no = c.bu_no
|
|
<where>
|
|
a.site = #{site} and a.deleteFlag = 'N' and a.bu_no = #{buNo} and a.repair_type = #{repairType}
|
|
<if test="feedBackID != null and feedBackID != ''">
|
|
AND a.FeedBackID LIKE '%' + #{feedBackID}+'%'
|
|
</if>
|
|
<if test="feedBackDesc != null and feedBackDesc != ''">
|
|
AND a.FeedBackDesc LIKE '%' + #{feedBackDesc}+'%'
|
|
</if>
|
|
<if test="objectInfo != null and objectInfo != ''">
|
|
AND (a.ObjectID like '%' + #{objectInfo} + '%' or dbo.eam_Get_eamObjectDesc(a.Site, a.bu_no, a.ObjectID) like '%' + #{objectInfo} + '%')
|
|
</if>
|
|
<if test="defectInfo != null and defectInfo != ''">
|
|
AND (a.DefectID like '%' + #{defectInfo} + '%' or b.defectDesc like '%' + #{defectInfo} + '%')
|
|
</if>
|
|
</where>
|
|
ORDER BY a.CreatedDate desc
|
|
</select>
|
|
|
|
<!-- 保存故障信息 -->
|
|
<insert id="saveEamGzBbData" parameterType="com.xujie.sys.modules.pms.data.EamDefectFeedBackData">
|
|
INSERT INTO eam_defect_feedBack
|
|
(Site, bu_no, FeedBackID, FeedBackDesc, ObjectID, DefectID, FunctionType, PlanOperator, Status, PlanDate,
|
|
Remark, deleteFlag, CreatedDate, CreatedBy, Version, DefectDate, urgency, repair_reporting_type, repair_type)
|
|
VALUES
|
|
(#{site}, #{buNo}, #{feedBackID}, #{feedBackDesc}, #{objectID}, #{defectID}, #{functionType}, #{planOperator}, #{status}, #{planDate},
|
|
#{remark}, #{deleteFlag}, getDate(), #{createdBy}, #{version}, #{defectDate}, #{urgency}, #{repairReportingType}, #{repairType})
|
|
</insert>
|
|
|
|
<!-- 查看现场动控是否开启 -->
|
|
<select id="selectControlBaseData" resultType="com.xujie.sys.modules.sys.entity.SysSceneDynamicControlModelEntity" parameterType="string">
|
|
SELECT
|
|
type,
|
|
base_data,
|
|
base_desc,
|
|
status,
|
|
remark,
|
|
third_type,
|
|
second_type,
|
|
page_control,
|
|
control_style
|
|
FROM sys_scene_dynamic_control_model
|
|
where site = #{site} and control_no = #{controlNo}
|
|
</select>
|
|
|
|
<!-- 修改反馈状态为已下达 -->
|
|
<update id="updateDefectFeedBackStatus" parameterType="com.xujie.sys.modules.pms.data.EamDefectFeedBackData">
|
|
UPDATE eam_defect_feedBack
|
|
SET Status = '已下达'
|
|
WHERE Site = #{site} and bu_no = #{buNo} and FeedBackID = #{feedBackID}
|
|
</update>
|
|
|
|
<!-- 查询工单号 -->
|
|
<select id="getOrderNo" resultType="string" parameterType="com.xujie.sys.modules.pms.data.EamWorkOrderInData">
|
|
select
|
|
'X'+ Right( '0000000000'+ convert(VARCHAR(10),isnull(max(convert(INT,SUBSTRING(OrderNo,3,10))),0)+1),8)
|
|
from eam_workOrder
|
|
where site = #{site} and FunctionType = 'C' and bu_no = #{buNo}
|
|
</select>
|
|
|
|
<!-- 创建维修工单 -->
|
|
<insert id="saveWorkOrder" parameterType="com.xujie.sys.modules.pms.data.EamDefectFeedBackData">
|
|
INSERT INTO eam_workOrder
|
|
(Site, bu_no, OrderNo, PlanID, PropertiesCode, ObjectID, Status, PlanDate, FunctionType, CreateDate, CreateBy, PlanDesc, document_source, repair_reporting_type, repair_type, PlanOperator)
|
|
VALUES (#{site}, #{buNo}, #{orderNo}, #{feedBackID}, '', #{objectID}, '未开工', getDate(), 'C', getDate(), #{createdBy}, #{feedBackDesc}, #{documentSource}, #{repairReportingType}, #{repairType}, #{planOperator})
|
|
</insert>
|
|
|
|
<!-- 修改工单 -->
|
|
<update id="updateWorkOrder" parameterType="com.xujie.sys.modules.pms.data.EamWorkOrderInData">
|
|
update eam_workOrder
|
|
set update_by = #{mesUser},
|
|
update_date = GetDate(),
|
|
Remark = #{remark},
|
|
reach_date = #{reachDate},
|
|
ActualDate = #{actualDate},
|
|
WorkTime = #{workTime},
|
|
<if test='functionType == "B" and checkResult == "合格"'>
|
|
disposal_measures = '',
|
|
</if>
|
|
<if test='functionType == "B" and checkResult == "异常"'>
|
|
disposal_measures = #{disposalMeasures},
|
|
</if>
|
|
checkResult = #{checkResult},
|
|
check_remark = #{checkRemark},
|
|
fault_reason = #{faultReason},
|
|
preventive_measure = #{preventiveMeasure}
|
|
where site = #{site} and orderNo = #{orderNo} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<!-- 修改工单项目 -->
|
|
<update id="updateWorkOrderItem" parameterType="com.xujie.sys.modules.pms.data.EamWorkOrderItemInData">
|
|
update eam_workOrder_item
|
|
set update_by = #{updateBy},
|
|
update_date = GetDate(),
|
|
<if test='valueTypeDb == "T"'>
|
|
TextValue = #{textValue},
|
|
</if>
|
|
<if test='valueTypeDb == "N"'>
|
|
NumberValue = #{numberValue},
|
|
</if>
|
|
itemResult = #{itemResult}
|
|
where site = #{site} and OrderNo = #{orderNo} and ItemNo = #{itemNo} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<!-- 删除之前的协同人员-->
|
|
<delete id="delOperator" parameterType="com.xujie.sys.modules.pms.data.EamWorkOrderInData">
|
|
DELETE FROM eam_actual_operator
|
|
WHERE site = #{site} and order_no = #{orderNo} and function_type = #{functionType} and bu_no = #{buNo}
|
|
</delete>
|
|
|
|
<!-- 到达 -->
|
|
<update id="reach" parameterType="com.xujie.sys.modules.pms.data.EamWorkOrderInData">
|
|
update eam_workOrder
|
|
set Status = #{status},
|
|
reach_date = GetDate(),
|
|
reach_operator = #{reachOperator},
|
|
reach_operator_name = #{reachOperatorName}
|
|
where site = #{site} and OrderNo = #{orderNo} and FunctionType = #{functionType} and bu_No = #{buNo}
|
|
</update>
|
|
|
|
<!-- 查询是否已经上传图片 -->
|
|
<select id="checkUploadAlready" resultType="SysOssEntity" parameterType="com.xujie.sys.modules.pms.data.EamWorkOrderItemData">
|
|
SELECT
|
|
id
|
|
FROM sys_oss
|
|
where order_ref1 = #{site} and order_ref2 = #{orderNo} and order_ref3 = #{itemNo}
|
|
</select>
|
|
|
|
<!-- 查询文件路径 -->
|
|
<select id="searchItemFileUrl" resultType="SysOssEntity" parameterType="com.xujie.sys.modules.pms.data.EamWorkOrderItemData">
|
|
SELECT
|
|
id,
|
|
url,
|
|
file_name
|
|
FROM sys_oss
|
|
WHERE order_ref1 = #{site} and order_ref2 = #{orderNo} and order_ref3 = #{itemNo} and order_ref4 = #{buNo}
|
|
</select>
|
|
|
|
<!-- 根据工单号查询知识库记录 -->
|
|
<select id="selectKnowledgeRecordByOrderNo" resultType="com.xujie.sys.modules.pms.data.EamKnowledgeBaseData" parameterType="com.xujie.sys.modules.pms.data.EamWorkOrderInData">
|
|
SELECT
|
|
site,
|
|
bu_no,
|
|
num
|
|
FROM eam_knowledge_base
|
|
WHERE site = #{site} and bu_no = #{buNo} and order_no = #{orderNo}
|
|
</select>
|
|
|
|
<!-- 根据工单号修改知识库记录 -->
|
|
<update id="updateKnowledgeRecordByOrderNo" parameterType="com.xujie.sys.modules.pms.data.EamWorkOrderInData">
|
|
update eam_knowledge_base
|
|
SET defect_id = #{defectID},
|
|
defect_desc = #{defectDesc},
|
|
defect_describe = #{planDesc},
|
|
remark = #{remark},
|
|
fault_reason = #{faultReason},
|
|
handling_method = #{handlingMethod},
|
|
preventive_measure = #{preventiveMeasure},
|
|
feedback_by = #{feedbackBy},
|
|
actual_operator_name = #{actualOperatorName},
|
|
update_date = getDate(),
|
|
update_by = #{updateBy}
|
|
where site = #{site} and order_no = #{orderNo} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<!-- 新增设备知识库记录 -->
|
|
<insert id="saveKnowledgeRecord" parameterType="com.xujie.sys.modules.pms.data.EamWorkOrderInData">
|
|
INSERT INTO eam_knowledge_base
|
|
(site, bu_no, num, defect_describe, remark, object_id, defect_id, defect_desc, order_no,
|
|
fault_reason, handling_method, preventive_measure, feedback_by, actual_operator_name, create_date, create_by)
|
|
VALUES
|
|
(#{site}, #{buNo}, #{num}, #{planDesc}, #{remark}, #{objectID}, #{defectID}, #{defectDesc}, #{orderNo},
|
|
#{faultReason}, #{handlingMethod}, #{preventiveMeasure}, #{feedbackBy}, #{actualOperatorName}, getDate(), #{updateBy})
|
|
</insert>
|
|
|
|
<!-- 修改反馈状态为已取消 -->
|
|
<update id="updateFeedBackStatus" parameterType="com.xujie.sys.modules.pms.data.EamWorkOrderInData">
|
|
UPDATE eam_defect_feedBack
|
|
SET Status = '已取消'
|
|
WHERE Site = #{site} AND FeedBackID = #{planID} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<!-- 获取所有分类 -->
|
|
<select id="getFamilyTree" resultType="com.xujie.sys.modules.pms.data.EamFamilyData" parameterType="com.xujie.sys.modules.pms.data.EamFamilyData">
|
|
SELECT
|
|
site,
|
|
bu_no,
|
|
FamilyID,
|
|
FamilyDesc,
|
|
parent_id,
|
|
son_id,
|
|
Active
|
|
FROM eam_family
|
|
WHERE site in (select site from eam_access_site where username = #{userName})
|
|
and (site + '-' + bu_no) in (select * from dbo.query_bu(#{userName}))
|
|
and Active = 'Y'
|
|
</select>
|
|
|
|
<!-- 获得sonId -->
|
|
<select id="getSonId" resultType="string" parameterType="com.xujie.sys.modules.pms.data.EamFamilyData">
|
|
SELECT
|
|
Right('0000' + convert(varchar(10),isnull(max(convert(INT,Right(son_id,2))),0)+1),2)
|
|
FROM eam_family
|
|
WHERE site = #{site} and bu_no = #{buNo} and son_id like #{parentId} + '%'
|
|
</select>
|
|
|
|
<!-- 删除该分类以及其子类-->
|
|
<delete id="eamFamilyDelete" parameterType="com.xujie.sys.modules.pms.data.EamFamilyData">
|
|
DELETE FROM eam_family
|
|
WHERE site = #{site} and bu_no = #{buNo} and FamilyID = #{familyID}
|
|
<if test="sonId != null and sonId != ''">
|
|
and son_id like #{sonId} + '%'
|
|
</if>
|
|
</delete>
|
|
|
|
<select id="getEamWorkOrder" resultType="com.xujie.sys.modules.pms.data.EamWorkOrderInData" parameterType="com.xujie.sys.modules.pms.data.EamWorkOrderInData">
|
|
EXEC EAM_WORK_ORDER #{site}, #{username}, #{orderNo}, #{planID}, #{objectID}, #{status}, #{startDate}, #{endDate}, #{functionType}, '*'
|
|
</select>
|
|
|
|
<!-- 修改执行结果 -->
|
|
<update id="updateReportResult" parameterType="com.xujie.sys.modules.pms.data.EamWorkOrderInData">
|
|
update eam_workOrder
|
|
set ActualDate = #{actualDate},
|
|
reach_date = #{reachDate},
|
|
fault_reason = #{faultReason},
|
|
handling_method = #{handlingMethod},
|
|
preventive_measure = #{preventiveMeasure},
|
|
Remark = #{remark},
|
|
WorkTime = #{workTime},
|
|
check_assessment = #{checkAssessment},
|
|
check_notes = #{checkNotes}
|
|
where site = #{site} and orderNo = #{orderNo} and FunctionType = #{functionType} and bu_no = #{buNo}
|
|
</update>
|
|
|
|
<!-- 根据设备查所属部门 -->
|
|
<select id="queryDepartmentByObjectId" resultType="com.xujie.sys.modules.pms.data.EamObjectAdminData" parameterType="com.xujie.sys.modules.pms.data.EamDefectFeedBackData">
|
|
SELECT
|
|
eo.site,
|
|
eo.bu_no,
|
|
eo.ObjectDesc,
|
|
eo.dept_id,
|
|
el.LocationName
|
|
FROM eam_object as eo
|
|
LEFT JOIN eam_location as el on eo.site = el.site and eo.LocationID = el.LocationID and eo.bu_no = el.bu_no
|
|
WHERE eo.site = #{site} and eo.ObjectID = #{objectID} and eo.bu_no = #{buNo}
|
|
</select>
|
|
|
|
<!-- 根据部门ID查机修人员电话 -->
|
|
<select id="queryPhoneByDepartmentId" resultType="com.xujie.sys.modules.pms.data.EamObjectAdminData" parameterType="com.xujie.sys.modules.pms.data.EamObjectAdminData">
|
|
SELECT
|
|
ed.user_display as adminName,
|
|
ed.mobile as phone
|
|
FROM Access_dept as edd
|
|
LEFT JOIN sys_user ed on edd.username = ed.username and edd.site in (select site from eam_access_site where username = ed.username)
|
|
and (edd.site + '-' + edd.bu_no) in (select * from dbo.query_bu(ed.username))
|
|
LEFT JOIN access_role as ar on ar.username = edd.username and ar.site in (select site from eam_access_site where username = ed.username)
|
|
WHERE edd.site = #{site} and edd.department_id = #{deptId} and edd.bu_no = #{buNo} and ar.role_no = #{roleNo} and ed.mobile is not null
|
|
</select>
|
|
|
|
<!-- 保存短信记录 -->
|
|
<insert id="saveMessageRecord" parameterType="com.xujie.sys.modules.pms.data.MessageRecordData">
|
|
INSERT INTO send_message_record (site, bu_no, plan_id, object_id, defect_id, feed_back_desc, sender, recipient, phone, send_date)
|
|
VALUES (#{site}, #{buNo}, #{planId}, #{objectId}, #{defectId}, #{feedBackDesc}, #{sender}, #{recipient}, #{phone}, getDate())
|
|
</insert>
|
|
|
|
<!-- 查出计划结束日期为今天并且自动续期标识为Y的计划 -->
|
|
<select id="selectPlanToday" resultType="com.xujie.sys.modules.pms.data.EamWorkPlanInData" parameterType="com.xujie.sys.modules.pms.data.EamWorkPlanInData">
|
|
SELECT
|
|
site,
|
|
(site + '_' + bu_no) as bu,
|
|
plan_id,
|
|
plan_desc,
|
|
status,
|
|
plan_start_date,
|
|
plan_end_date,
|
|
created_date,
|
|
created_by,
|
|
update_date,
|
|
update_by,
|
|
remark,
|
|
next_work_date,
|
|
delete_flag,
|
|
operator,
|
|
operator_name,
|
|
checker,
|
|
checker_name,
|
|
function_type,
|
|
properties_code,
|
|
plan_period,
|
|
work_order_rule,
|
|
plan_cycle,
|
|
task_start_date,
|
|
plan_halt_date,
|
|
auto_renewal
|
|
FROM eam_workPlan_overview
|
|
WHERE site = #{site} and status != #{status} and delete_flag = #{deleteFlag} and DATEDIFF(day, plan_end_date, getdate()) = 0 and auto_renewal = #{autoRenewal}
|
|
</select>
|
|
|
|
<!-- 查出老计划的设备 -->
|
|
<select id="selectObjectByPlanID" resultType="com.xujie.sys.modules.pms.data.EamObjectInData" parameterType="com.xujie.sys.modules.pms.data.EamWorkPlanInData">
|
|
SELECT
|
|
Site,
|
|
PlanID,
|
|
PlanDesc,
|
|
ObjectID,
|
|
FunctionType,
|
|
PropertiesCode,
|
|
Status
|
|
FROM eam_workPlan
|
|
WHERE site = #{site} and PlanID = #{planID} and FunctionType = #{functionType}
|
|
</select>
|
|
|
|
<!-- 获取用户 bu -->
|
|
<select id="getSiteAndBuByUserName" resultType="BuData" parameterType="BuData">
|
|
SELECT
|
|
b.id,
|
|
a.site,
|
|
c.sitename,
|
|
(a.site + '_' + a.bu_no) as buNo,
|
|
b.bu_desc
|
|
FROM AccessBu as a
|
|
left join bu as b on a.bu_no = b.bu_no and a.site = b.site
|
|
left join site as c on a.site = c.siteid
|
|
WHERE a.username = #{username}
|
|
</select>
|
|
|
|
<!-- 获取用户 bu -->
|
|
<select id="getSiteAndBuByUserName2" resultType="BuData" parameterType="BuData">
|
|
SELECT
|
|
a.site,
|
|
c.sitename,
|
|
a.bu_no,
|
|
b.bu_desc
|
|
FROM AccessBu as a
|
|
left join bu as b on a.bu_no = b.bu_no and a.site = b.site
|
|
left join site as c on a.site = c.siteid
|
|
WHERE a.username = #{username}
|
|
</select>
|
|
|
|
<!-- 获取用户 bu -->
|
|
<select id="getBuByUserNameSite" resultType="BuData" parameterType="BuData">
|
|
SELECT
|
|
a.site,
|
|
a.bu_no,
|
|
b.bu_desc
|
|
FROM AccessBu as a
|
|
left join bu as b on a.bu_no = b.bu_no and a.site = b.site
|
|
WHERE a.username = #{username} and a.site = #{site}
|
|
</select>
|
|
|
|
<select id="eamCheckRecordSearch" parameterType="com.xujie.sys.modules.pms.data.EamWorkOrderInData" resultType="com.xujie.sys.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.operator_name as createBy,
|
|
a.Remark,
|
|
a.StartTime,
|
|
a.EndTime,
|
|
a.WorkTime,
|
|
a.PlanOperatorName,
|
|
a.checkerName,
|
|
dbo.eam_Get_eamAdminName(a.Site, a.ActualOperator) as ActualOperatorName,
|
|
eo.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.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.operator_id 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 a.check_type in (select role_no from access_role where username = #{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>
|
|
</select>
|
|
|
|
<select id="eamDefectRecordSearch" parameterType="com.xujie.sys.modules.pms.data.EamWorkOrderInData" resultType="com.xujie.sys.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.operator_name as createBy,
|
|
a.Remark,
|
|
a.StartTime,
|
|
a.EndTime,
|
|
a.WorkTime,
|
|
dbo.eam_Get_eamAdminName(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,
|
|
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.bu_no = ewi.bu_no and a.OrderNo = ewi.OrderNo
|
|
left join eam_defect_feedBack b on a.site = b.site and a.bu_no = b.bu_no and a.PlanID = b.feedBackID
|
|
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 and d.active = 'Y'
|
|
left join eam_object as e on a.site = e.site and a.bu_no = e.bu_no and a.ObjectID = e.ObjectID and e.Active = 'Y'
|
|
left join sys_department as f on e.site = f.site and e.bu_no = f.bu_no and e.dept_id = f.department_id
|
|
left join Access_dept as ead ON ead.site = f.site and ead.bu_no = f.bu_no and ead.department_id = f.department_id
|
|
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>
|
|
</select>
|
|
|
|
<!-- 获取用户角色列表 -->
|
|
<select id="getUserRoleList" resultType="com.xujie.sys.modules.sys.entity.SysRoleEntity">
|
|
SELECT
|
|
role_id,
|
|
role_name
|
|
FROM sys_role
|
|
</select>
|
|
|
|
<!-- 获取故障图片 -->
|
|
<select id="getFeedBackImages" resultType="SysOssEntity" parameterType="com.xujie.sys.modules.pms.data.EamWorkOrderInData">
|
|
SELECT
|
|
id,
|
|
url,
|
|
create_date,
|
|
file_name,
|
|
new_file_name,
|
|
created_by,
|
|
order_ref1,
|
|
order_ref2,
|
|
order_ref3,
|
|
order_ref4,
|
|
file_type,
|
|
file_suffix,
|
|
file_type_code,
|
|
case when order_ref3 = 'feedBack' then '报修' when order_ref3 = 'reportFault' then '维修' end as typeFlag
|
|
FROM sys_oss
|
|
where order_ref1 = #{site} and (order_ref2 = #{orderNo} or order_ref2 = #{planID}) and order_ref3 in ('feedBack', 'reportFault') and order_ref4 = #{buNo}
|
|
</select>
|
|
|
|
<!-- 获取故障图片 -->
|
|
<select id="getFeedBackImages2" resultType="SysOssEntity" parameterType="com.xujie.sys.modules.pms.data.EamWorkOrderInData">
|
|
SELECT
|
|
id,
|
|
url,
|
|
create_date,
|
|
file_name,
|
|
new_file_name,
|
|
created_by,
|
|
order_ref1,
|
|
order_ref2,
|
|
order_ref3,
|
|
order_ref4,
|
|
file_type,
|
|
file_suffix,
|
|
file_type_code
|
|
FROM sys_oss
|
|
where order_ref1 = #{site} and order_ref2 = #{orderNo} and order_ref3 = 'reportSparPart' and order_ref4 = #{buNo}
|
|
</select>
|
|
|
|
<insert id="saveCoreComponent">
|
|
insert into eam_workOrder_coreComponents
|
|
(site, bu_no, OrderNo, ItemNo, partNo, oldSerialNo, newSerialNo, created_by, created_date)
|
|
values
|
|
(#{site}, #{buNo}, #{orderNo}, #{itemNo}, #{partNo}, #{oldSerialNo}, #{newSerialNo}, #{createdBy}, GetDate())
|
|
</insert>
|
|
|
|
<update id="updateCoreComponent">
|
|
UPDATE eam_workOrder_coreComponents
|
|
SET oldSerialNo = #{oldSerialNo},
|
|
newSerialNo = #{newSerialNo}
|
|
WHERE site = #{site} and bu_no = #{buNo} and OrderNo = #{orderNo} and partNo = #{partNo}
|
|
</update>
|
|
|
|
<!-- 获取领用出库信息 -->
|
|
<select id="getInventoryStockList" resultType="com.xujie.sys.modules.pms.data.InventoryStockData" parameterType="com.xujie.sys.modules.pms.data.InventoryStockData">
|
|
SELECT
|
|
A.site,
|
|
A.part_no,
|
|
A.batch_no,
|
|
isnull(A.qty_on_hand ,0) as qtyOnHand,
|
|
isnull(A.in_qty,0) inQty,
|
|
isnull(A.out_qty,0) as outQty,
|
|
A.warehouse_id,
|
|
A.location_id,
|
|
(B.part_description + '/' + B.spec) as partDescription,
|
|
B.S_code_control_flag,
|
|
B.supplier_id,
|
|
dbo.qc_get_supplier_name(A.site, B.supplier_id) as supplierDesc
|
|
FROM inventory_stock as A
|
|
left join part_spare as B on A.site = B.site and A.part_no = B.part_no
|
|
<where>
|
|
A.site = #{site}
|
|
<if test="partNo != null and partNo != ''">
|
|
AND A.part_no = #{partNo}
|
|
</if>
|
|
<if test="batchNo != null and batchNo != ''">
|
|
AND A.batch_no = #{batchNo}
|
|
</if>
|
|
<if test="active != null and active != ''">
|
|
AND B.active = #{active}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 查询设备 -->
|
|
<select id="getResourceCount" resultType="com.xujie.sys.modules.pms.data.ResourceData" parameterType="com.xujie.sys.modules.pms.data.PartSpareData">
|
|
SELECT
|
|
id,
|
|
site,
|
|
resource_id,
|
|
resource_desc
|
|
FROM resource
|
|
where site = #{site} and resource_id = #{resourceId}
|
|
</select>
|
|
|
|
<!-- 获取编码信息 -->
|
|
<select id="getTransNo" resultType="com.xujie.sys.modules.pms.data.TransNoData" parameterType="com.xujie.sys.modules.pms.data.PartSpareData">
|
|
SELECT
|
|
#{site} as site,
|
|
dbo.Get_TransNo(#{site},#{transTypeDB}) as transNo
|
|
</select>
|
|
|
|
<!-- 修改编码信息 -->
|
|
<select id="updateTransNo" parameterType="com.xujie.sys.modules.pms.data.PartSpareData">
|
|
EXEC UpdateTransNo #{site}, #{transTypeDB}
|
|
</select>
|
|
|
|
<select id="getInventoryStockCount" parameterType="com.xujie.sys.modules.pms.data.InventoryStockData" resultType="int">
|
|
select
|
|
count(1)
|
|
from inventory_stock
|
|
where site = #{site} and part_no = #{partNo}
|
|
</select>
|
|
|
|
<select id="queryEamDocumentType" resultType="com.xujie.sys.modules.pms.data.EamDocumentTypeData">
|
|
SELECT
|
|
a.site,
|
|
a.document_type_id,
|
|
a.document_type,
|
|
a.responsible_department,
|
|
a.estimated_completion_days,
|
|
a.create_date,
|
|
a.create_by,
|
|
a.update_date,
|
|
a.update_by,
|
|
b.role_desc
|
|
FROM document_type_definition as a
|
|
LEFT JOIN business_role as b on a.site = b.site and a.responsible_department = b.role_no
|
|
WHERE
|
|
a.site in (select eas.site from eam_access_site as eas where eas.username = #{params.userName})
|
|
<if test="params.sql != null and params.sql != ''">
|
|
${params.sql}
|
|
</if>
|
|
</select>
|
|
<select id="eamDocumentTypeSearch" resultType="com.xujie.sys.modules.pms.data.EamDocumentTypeData">
|
|
SELECT
|
|
a.site,
|
|
a.document_type_id,
|
|
a.document_type,
|
|
a.responsible_department,
|
|
a.estimated_completion_days,
|
|
a.create_date,
|
|
a.create_by,
|
|
a.update_date,
|
|
a.update_by,
|
|
b.role_desc
|
|
FROM document_type_definition as a
|
|
LEFT JOIN business_role as b on a.site = b.site and a.responsible_department = b.role_no
|
|
WHERE
|
|
a.site in (select eas.site from eam_access_site as eas where eas.username = #{query.userName})
|
|
<if test="query.documentTypeId != null and query.documentTypeId != ''">
|
|
AND a.document_type_id LIKE #{query.documentTypeId}
|
|
</if>
|
|
<if test="query.documentType != null and query.documentType != ''">
|
|
AND a.document_type LIKE #{query.documentType}
|
|
</if>
|
|
</select>
|
|
<select id="checkEamDocumentType" resultType="com.xujie.sys.modules.pms.data.EamDocumentTypeData">
|
|
SELECT
|
|
Site,
|
|
document_type_id,
|
|
document_type,
|
|
responsible_department,
|
|
estimated_completion_days
|
|
FROM document_type_definition
|
|
WHERE Site = #{site} and document_type_id = #{documentTypeId}
|
|
</select>
|
|
<insert id="saveNewEamDocumentType">
|
|
INSERT INTO document_type_definition
|
|
(Site, document_type_id, document_type, responsible_department, estimated_completion_days,create_date, create_by)
|
|
VALUES
|
|
(#{site}, #{documentTypeId}, #{documentType}, #{responsibleDepartment}, #{estimatedCompletionDays}, getDate(), #{createBy})
|
|
</insert>
|
|
<update id="eamDocumentTypeEdit">
|
|
UPDATE document_type_definition
|
|
SET document_type = #{documentType},
|
|
responsible_department = #{responsibleDepartment},
|
|
estimated_completion_days = #{estimatedCompletionDays},
|
|
update_date = getDate(),
|
|
update_by = #{updateBy}
|
|
WHERE Site = #{site} and document_type_id = #{documentTypeId}
|
|
</update>
|
|
<delete id="eamDocumentTypeDelete">
|
|
DELETE FROM document_type_definition
|
|
WHERE Site = #{site} and document_type_id = #{documentTypeId}
|
|
</delete>
|
|
|
|
<select id="queryBuDocument" resultType="com.xujie.sys.modules.pms.data.EamBuDocumentListDefinitionVo">
|
|
SELECT
|
|
a.id,
|
|
a.site,
|
|
a.bu_no,
|
|
dbo.get_bu_desc ( a.site, a.bu_no ) as buDesc,
|
|
a.project_category,
|
|
a.document_type_id,
|
|
a.project_phase,
|
|
c.document_type,
|
|
c.responsible_department,
|
|
c.estimated_completion_days,
|
|
a.create_date,
|
|
a.create_by,
|
|
a.update_date,
|
|
a.update_by,
|
|
b.bu_desc,
|
|
d.role_desc
|
|
FROM bu_document_list_definition as a
|
|
LEFT JOIN bu as b on a.site = b.site and a.bu_no = b.bu_no
|
|
LEFT JOIN document_type_definition as c on a.document_type_id = c.document_type_id
|
|
LEFT JOIN business_role as d on a.site = d.site and c.responsible_department = d.role_no
|
|
WHERE
|
|
a.site in (select site from eam_access_site where username = #{params.userName})
|
|
and (a.site + '-' + a.bu_no) in (select * from dbo.query_bu(#{params.userName}))
|
|
<if test="params.sql != null and params.sql != ''">
|
|
${params.sql}
|
|
</if>
|
|
ORDER BY
|
|
b.bu_no,
|
|
a.project_phase,
|
|
a.project_category,
|
|
a.document_type_id
|
|
</select>
|
|
<select id="eamBuDocumentSearch" resultType="com.xujie.sys.modules.pms.data.EamBuDocumentListDefinitionVo">
|
|
SELECT
|
|
a.id,
|
|
a.site,
|
|
a.bu_no,
|
|
a.project_category,
|
|
a.document_type_id,
|
|
a.project_phase,
|
|
c.document_type,
|
|
c.responsible_department,
|
|
c.estimated_completion_days,
|
|
a.create_date,
|
|
a.create_by,
|
|
a.update_date,
|
|
a.update_by,
|
|
b.bu_desc,
|
|
d.role_desc
|
|
FROM bu_document_list_definition as a
|
|
LEFT JOIN bu as b on a.site = b.site and a.bu_no = b.bu_no
|
|
LEFT JOIN document_type_definition as c on a.document_type_id = c.document_type_id
|
|
LEFT JOIN business_role as d on a.site = d.site and c.responsible_department = d.role_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}))
|
|
<if test="query.buDesc != null and query.buDesc != ''">
|
|
AND dbo.get_bu_desc ( a.site, a.bu_no ) = #{query.buDesc}
|
|
</if>
|
|
<if test="query.projectPhase != null and query.projectPhase != ''">
|
|
AND a.project_phase = #{query.projectPhase}
|
|
</if>
|
|
<if test="query.projectCategory != null and query.projectCategory != ''">
|
|
AND a.project_category = #{query.projectCategory}
|
|
</if>
|
|
<if test="query.documentTypeId != null and query.documentTypeId != ''">
|
|
AND a.document_type_id like #{query.documentTypeId}
|
|
</if>
|
|
<if test="query.documentType != null and query.documentType != ''">
|
|
AND c.document_type like #{query.documentType}
|
|
</if>
|
|
ORDER BY
|
|
b.bu_no,
|
|
a.project_phase,
|
|
a.project_category,
|
|
a.document_type_id
|
|
</select>
|
|
<select id="checkEamBuDocument" resultType="com.xujie.sys.modules.pms.data.EamBuDocumentListDefinitionVo">
|
|
SELECT
|
|
Site,
|
|
bu_no,
|
|
project_category,
|
|
document_type_id,
|
|
project_phase
|
|
FROM bu_document_list_definition
|
|
WHERE Site = #{site} and bu_no = #{buNo} and project_category = #{projectCategory} and document_type_id = #{documentTypeId} and project_phase = #{projectPhase}
|
|
</select>
|
|
<select id="checkEamDocumentTypeDelete" resultType="Integer">
|
|
SELECT COUNT(*) FROM bu_document_list_definition t1
|
|
WHERE t1.document_type_id = #{documentTypeId}
|
|
UNION ALL
|
|
SELECT COUNT(*) FROM plm_document_list_definition t2
|
|
WHERE t2.document_type_id = #{documentTypeId}
|
|
</select>
|
|
<insert id="saveNewEamBuDocument">
|
|
INSERT INTO bu_document_list_definition
|
|
(Site, bu_no, project_category, document_type_id, project_phase,create_date, create_by)
|
|
VALUES
|
|
(#{site}, #{buNo}, #{projectCategory}, #{documentTypeId}, #{projectPhase},getDate(), #{createBy})
|
|
</insert>
|
|
<update id="eamBuDocumentEdit">
|
|
UPDATE bu_document_list_definition
|
|
SET project_phase = #{projectPhase},
|
|
project_category = #{projectCategory},
|
|
update_date = getDate(),
|
|
update_by = #{updateBy}
|
|
WHERE Site = #{site} and bu_no = #{buNo} and document_type_id = #{documentTypeId} and id = #{id}
|
|
</update>
|
|
<delete id="eamBuDocumentDelete">
|
|
DELETE FROM bu_document_list_definition
|
|
WHERE Site = #{site} and bu_no = #{buNo} and project_category = #{projectCategory} and document_type_id = #{documentTypeId} and project_phase = #{projectPhase}
|
|
</delete>
|
|
<delete id="deleteCoreComponents">
|
|
delete from eam_workOrder_coreComponents
|
|
WHERE site = #{site} and bu_no = #{buNo} and OrderNo = #{orderNo} and partNo = #{partNo}
|
|
</delete>
|
|
<update id="cancelDefectOrder">
|
|
update eam_workOrder
|
|
set Status = '已取消'
|
|
where site = #{site} AND bu_no = #{buNo} AND OrderNo = #{orderNo} and FunctionType = #{functionType}
|
|
</update>
|
|
|
|
<update id="updateInventoryStock" parameterType="com.xujie.sys.modules.pms.data.InventoryStockData">
|
|
update inventory_stock
|
|
set in_qty = #{inQty},
|
|
out_qty = #{outQty},
|
|
qty_on_hand = #{qtyOnHand},
|
|
latest_out_date = getDate(),
|
|
latest_count_date = getDate()
|
|
<where>
|
|
site = #{site}
|
|
<if test="partNo != null and partNo != ''">
|
|
AND part_no = #{partNo}
|
|
</if>
|
|
<if test="batchNo != null and batchNo != ''">
|
|
AND batch_no = #{batchNo}
|
|
</if>
|
|
</where>
|
|
</update>
|
|
|
|
<insert id="saveRepairTransDetailSub" parameterType="com.xujie.sys.modules.pms.data.RepairTransDetailSubData">
|
|
insert into repair_TransDetailsub
|
|
(TransNo, SeqNo, Site, itemNo, LocationID, BatchNo, RollQty, RollNo, orderRef2, orderRef4)
|
|
values
|
|
(#{transNo}, #{seqNo}, #{site}, #{itemNo}, #{locationId}, #{batchNo}, #{rollQty}, #{rollNo}, #{orderRef2}, #{orderRef4})
|
|
</insert>
|
|
|
|
<insert id="saveInventoryStockData" parameterType="com.xujie.sys.modules.pms.data.InventoryStockData">
|
|
insert into inventory_stock
|
|
(site, warehouse_id, part_no, first_in_date, latest_out_date, latest_in_date, active_date, in_qty, out_qty, qty_on_hand, citem_code, partner_id, latest_count_date, location_id, batch_no)
|
|
values
|
|
(#{site}, #{warehouseId}, #{partNo}, #{firstInDate}, getDate(), getDate(),getDate(), #{inQty}, #{outQty}, #{qtyOnHand}, #{citemCode}, #{partnerId}, #{latestCountDate}, #{locationId}, #{batchNo})
|
|
</insert>
|
|
|
|
<insert id="saveRepairTransDetail" parameterType="com.xujie.sys.modules.pms.data.RepairTransDetailData">
|
|
insert into repair_TransDetail
|
|
(TransNo, Site, ItemNo, PartNo, LocationID, TransQty, Direction, BatchNo, OrderRef1, OrderRef2, OrderRef3, citem_code)
|
|
values
|
|
(#{transNo}, #{site}, #{itemNo}, #{partNo}, #{locationId}, #{transQty}, #{direction}, #{batchNo}, #{orderRef1}, #{orderRef2}, #{orderRef3}, #{citemCode})
|
|
</insert>
|
|
|
|
<insert id="saveRepairTransHeader" parameterType="com.xujie.sys.modules.pms.data.RepairTransHeaderData">
|
|
insert into repair_TransHeader
|
|
(TransNo, Site, WarehouseID, TransDate, TransType_DB, TransType, UserName, Receiver, TransYear, TransMonth, PartnerID, PartnerType, AuthorizeFlag, TransferFlag, EnterDate, UseLocation, LinkOrderFlag, Status, Remark, orderRef1)
|
|
values
|
|
(#{transNo}, #{site}, #{warehouseId}, #{transDate}, #{transTypeDb}, #{transType}, #{userName}, #{receiver}, #{transYear}, #{transMonth}, #{partnerId}, #{partnerType}, #{authorizeFlag}, #{transferFlag}, getDate(), #{useLocation}, #{linkOrderFlag}, #{status}, #{remark}, #{orderRef1})
|
|
</insert>
|
|
|
|
<update id="updatePartSpareLocation" parameterType="com.xujie.sys.modules.pms.data.PartSpareData">
|
|
update part_spare
|
|
set last_update_by =#{userName},
|
|
location_id = #{locationId},
|
|
warehouse_id = #{warehouseId}
|
|
where site = #{site} and part_no = #{partNo}
|
|
</update>
|
|
|
|
<select id="getFeedBackInfo" resultType="com.xujie.sys.modules.pms.data.EamDefectFeedBackInData" parameterType="com.xujie.sys.modules.pms.data.EamDefectFeedBackInData">
|
|
select
|
|
a.Site,
|
|
a.bu_no,
|
|
a.FeedBackID,
|
|
a.FeedBackDesc,
|
|
a.Status,
|
|
a.ObjectID,
|
|
dbo.eam_Get_eamObjectDesc(a.Site, a.bu_no, a.ObjectID) as objectDesc,
|
|
b.reach_date as createdDate,
|
|
b.reach_operator_name as createdBy,
|
|
'' as feedbackBy
|
|
from eam_defect_feedBack as a
|
|
left join eam_workOrder as b on a.site = b.site and a.bu_no = b.bu_no and b.PlanID = a.feedBackID
|
|
<where>
|
|
a.Site = #{site} and a.bu_no = #{buNo} and a.FeedBackID = #{feedBackID} and b.status in ('未开始', '已到达')
|
|
</where>
|
|
</select>
|
|
|
|
<select id="getObjectInfo" resultType="com.xujie.sys.modules.pms.data.EamObjectData">
|
|
select
|
|
site,
|
|
bu_no,
|
|
objectID,
|
|
ObjectDesc,
|
|
standard_maintenance_duration,
|
|
time_out_maintenance_duration,
|
|
standard_response_duration,
|
|
time_out_response_duration
|
|
from eam_object
|
|
where Site = #{site} and bu_no = #{buNo} and ObjectID = #{objectID}
|
|
</select>
|
|
|
|
<select id="getResourceByObject" resultType="string">
|
|
select
|
|
ResourceID
|
|
from eam_object
|
|
where Site = #{site} and bu_no = #{buNo} and ObjectID = #{objectID}
|
|
</select>
|
|
|
|
<select id="selectRecordByOrderNo" resultType="com.xujie.sys.modules.pms.data.EamWorkOrderInData" parameterType="com.xujie.sys.modules.pms.data.EamWorkOrderInData">
|
|
SELECT
|
|
a.Site,
|
|
a.bu_no,
|
|
a.OrderNo,
|
|
a.PlanID,
|
|
b.FeedBackDesc,
|
|
a.ObjectID,
|
|
dbo.eam_Get_eamObjectDesc(a.Site, a.bu_no, a.ObjectID) as objectDesc,
|
|
a.Status,
|
|
a.PlanDate,
|
|
a.ActualDate,
|
|
a.FunctionType,
|
|
a.CreateDate,
|
|
a.Remark,
|
|
a.StartTime,
|
|
a.EndTime,
|
|
a.WorkTime,
|
|
a.result,
|
|
a.reach_date,
|
|
a.confirm_date,
|
|
a.confirm_by,
|
|
a.confirm_result,
|
|
a.confirm_count,
|
|
a.confirm_assessment,
|
|
a.confirm_remark,
|
|
b.CreatedDate,
|
|
dbo.getOperatorDesc(b.site, b.CreatedBy) as createdBy
|
|
FROM eam_workOrder as a
|
|
left join eam_defect_feedBack as b on a.site = b.site and a.bu_no = b.bu_no and a.PlanID = b.feedBackID
|
|
where a.Site = #{site} and a.bu_no = #{buNo} and a.OrderNo = #{orderNo} and a.FunctionType = #{functionType}
|
|
</select>
|
|
|
|
<update id="confirmDefectOrder" parameterType="com.xujie.sys.modules.pms.data.EamWorkOrderInData">
|
|
update eam_workOrder
|
|
set Status = #{status},
|
|
confirm_by = #{confirmBy},
|
|
confirm_date = getDate(),
|
|
confirm_result = #{confirmResult},
|
|
confirm_count = #{confirmCount},
|
|
confirm_assessment = #{confirmAssessment},
|
|
confirm_remark = #{confirmRemark}
|
|
where site = #{site} AND bu_no = #{buNo} AND OrderNo = #{orderNo} and FunctionType = #{functionType}
|
|
</update>
|
|
|
|
<update id="confirmDefectPlan" parameterType="com.xujie.sys.modules.pms.data.EamWorkOrderInData">
|
|
update eam_defect_feedBack
|
|
set Status = #{status}
|
|
where site = #{site} AND bu_no = #{buNo} AND FeedBackID = #{planID} and FunctionType = #{functionType}
|
|
</update>
|
|
|
|
<select id="getCoreComponentByNo" resultType="com.xujie.sys.modules.pms.entity.EamWorkOrderCoreComponentsData">
|
|
select
|
|
site,
|
|
bu_no,
|
|
OrderNo,
|
|
partNo
|
|
from eam_workOrder_coreComponents
|
|
where site = #{site} and bu_no = #{buNo} and OrderNo = #{orderNo} and partNo = #{partNo}
|
|
</select>
|
|
|
|
<select id="getRoleByUserName" resultType="com.xujie.sys.modules.factory.entity.vo.BusinessRoleVo" parameterType="com.xujie.sys.modules.factory.entity.vo.BusinessRoleVo">
|
|
SELECT
|
|
a.site,
|
|
b.role_no,
|
|
b.role_desc
|
|
FROM access_role as a
|
|
left join business_role as b on a.site = b.site and a.role_no = b.role_no
|
|
WHERE a.username = #{username} and b.role_no in ('R022', 'R023', 'R024')
|
|
</select>
|
|
|
|
<select id="checkItemByUse" resultType="com.xujie.sys.modules.pms.data.EamPropertiesItemData">
|
|
SELECT
|
|
site,
|
|
bu_no,
|
|
function_type,
|
|
code_no,
|
|
properties_item_no itemNo,
|
|
seq_no
|
|
FROM eam_properties_model_detail
|
|
where site = #{site} and bu_no = #{buNo} and function_type = #{itemType} and properties_item_no = #{itemNo}
|
|
</select>
|
|
|
|
<select id="getOperatorListByOrder" resultType="com.xujie.sys.modules.pms.data.EamAdminData" parameterType="com.xujie.sys.modules.pms.data.EamAdminData">
|
|
SELECT
|
|
a.user_id, a.username AS adminID, a.email, a.mobile AS phone, a.user_display AS adminName,
|
|
d.role_id, e.role_name, c.site, c.bu_no,
|
|
-- 获取计划工单数
|
|
dbo.get_plan_order_count(c.site, c.bu_no, #{functionType}, a.username) AS planOrderCount,
|
|
-- 获取实际工单数
|
|
dbo.get_actual_order_count(c.site, c.bu_no, #{functionType}, a.username) AS actualOrderCount,
|
|
-- 负荷率(%)
|
|
CASE
|
|
WHEN dbo.get_plan_order_count(c.site, c.bu_no, #{functionType}, a.username) = 0 THEN 0
|
|
ELSE
|
|
CAST(
|
|
dbo.get_actual_order_count(c.site, c.bu_no, #{functionType}, a.username) * 100.0 /
|
|
dbo.get_plan_order_count(c.site, c.bu_no, #{functionType}, a.username)
|
|
AS DECIMAL(5,2))
|
|
END AS load_rate
|
|
FROM
|
|
sys_user AS a
|
|
LEFT JOIN eam_access_site AS b ON a.username = b.username
|
|
LEFT JOIN AccessBu AS c ON b.username = c.username AND b.site = c.site
|
|
LEFT JOIN sys_user_role AS d ON a.user_id = d.user_id
|
|
LEFT JOIN sys_role AS e ON d.role_id = e.role_id
|
|
<where>
|
|
b.site = #{site} and c.bu_no = #{buNo}
|
|
<if test = "adminID != null and adminID != ''">
|
|
AND a.username LIKE '%' + #{adminID} + '%'
|
|
</if>
|
|
<if test = "adminName != null and adminName != ''">
|
|
AND a.user_display LIKE '%' + #{adminName} + '%'
|
|
</if>
|
|
<if test = "roleId != null and roleId != ''">
|
|
AND d.role_id = #{roleId}
|
|
</if>
|
|
<if test = "date != null and classesCode != null and classesCode != ''">
|
|
AND a.username IN (
|
|
SELECT tpm_scheduling_record.admin_id
|
|
FROM tpm_scheduling
|
|
join tpm_scheduling_record on tpm_scheduling.id = tpm_scheduling_record.head_id
|
|
WHERE tpm_scheduling.bu_no = #{buNo} and tpm_scheduling.site = #{site} and tpm_scheduling.date= #{date} and tpm_scheduling.classes_code = #{classesCode} and tpm_scheduling_record.isHoliday = 'N'
|
|
)
|
|
</if>
|
|
<if test = "date != null and (classesCode == null or classesCode == '')">
|
|
AND a.username IN (
|
|
SELECT tpm_scheduling_record.admin_id
|
|
FROM tpm_scheduling
|
|
join tpm_scheduling_record on tpm_scheduling.id = tpm_scheduling_record.head_id
|
|
WHERE tpm_scheduling.bu_no = #{buNo} and tpm_scheduling.site = #{site} and tpm_scheduling.date= #{date} and tpm_scheduling_record.isHoliday = 'N'
|
|
)
|
|
</if>
|
|
<if test = "classesCode != null and classesCode != '' and date == null">
|
|
AND a.username IN (
|
|
SELECT tpm_scheduling_record.admin_id
|
|
FROM tpm_scheduling
|
|
join tpm_scheduling_record on tpm_scheduling.id = tpm_scheduling_record.head_id
|
|
WHERE tpm_scheduling.bu_no = #{buNo} and tpm_scheduling.site = #{site} and tpm_scheduling.classes_code = #{classesCode} and tpm_scheduling_record.isHoliday = 'N'
|
|
)
|
|
</if>
|
|
</where>
|
|
order by load_rate desc
|
|
</select>
|
|
<select id="getOrderId" resultType="java.lang.Integer">
|
|
SELECT isnull(max(order_id), 0) + 1
|
|
from eam_properties_model_detail
|
|
where site = #{site}
|
|
and bu_no= #{buNo}
|
|
and function_type = #{functionType}
|
|
and code_no = #{codeNo}
|
|
</select>
|
|
|
|
<update id="updateOrderStatus" parameterType="com.xujie.sys.modules.pms.data.EamWorkOrderInData">
|
|
update eam_workOrder
|
|
set Status = '已完工'
|
|
where site = #{site} and bu_no = #{buNo} and orderNo = #{orderNo} and FunctionType = #{functionType}
|
|
</update>
|
|
|
|
<update id="updateMessageNotification" parameterType="com.xujie.sys.modules.pms.data.EamWorkOrderInData">
|
|
update TPM_Message_Notification
|
|
set send_flag = 'N'
|
|
WHERE SITE = #{site} AND bu_no = #{buNo} AND plan_no = #{feedBackId} AND order_no = #{orderNo}
|
|
</update>
|
|
<update id="updateRepairTypes">
|
|
UPDATE eam_workOrder
|
|
SET repair_type = #{repairType}
|
|
WHERE site = #{site} AND bu_no = #{buNo} AND OrderNo = #{orderNo}
|
|
</update>
|
|
<update id="updateEamItemOrder">
|
|
update eam_properties_model_detail
|
|
set order_id=#{orderId}
|
|
where site = #{site}
|
|
and bu_no= #{buNo}
|
|
and properties_item_no = #{itemNo}
|
|
and code_no = #{codeNo}
|
|
and function_type = #{functionType}
|
|
</update>
|
|
<update id="updateMessageNotificationByParameter">
|
|
update TPM_Message_Notification
|
|
set send_flag = 'N'
|
|
WHERE SITE = #{site} AND bu_no = #{buNo} AND plan_no = #{planID} AND order_no = #{orderNo}
|
|
</update>
|
|
<update id="updateIsReturn">
|
|
UPDATE eam_workOrder
|
|
SET is_return = 'Y'
|
|
WHERE Site = #{site} AND OrderNo = #{orderNo} and bu_no = #{buNo}
|
|
</update>
|
|
<update id="updateIsReturn2">
|
|
UPDATE eam_workOrder
|
|
SET is_return = 'N'
|
|
WHERE Site = #{site} AND OrderNo = #{orderNo} and bu_no = #{buNo}
|
|
</update>
|
|
<update id="reportWorkOrderForIsReturn">
|
|
update eam_workOrder
|
|
set Remark = #{remark},
|
|
handling_method = #{handlingMethod},
|
|
fault_reason = #{faultReason},
|
|
preventive_measure = #{preventiveMeasure},
|
|
is_return = 'N',
|
|
status = '待审核'
|
|
where site = #{site} and orderNo = #{orderNo} and FunctionType = #{functionType} and bu_no = #{buNo}
|
|
</update>
|
|
<update id="updateEamDefectFeedBackPlanOperator">
|
|
update eam_defect_feedBack
|
|
set PlanOperator = #{planOperator}
|
|
where site = #{site} and bu_no = #{buNo} and feedBackID = #{feedBackID}
|
|
</update>
|
|
<update id="returnWorkOrder">
|
|
UPDATE eam_workOrder
|
|
SET Status = '已到达',
|
|
is_return = 'Y'
|
|
WHERE Site = #{site} AND OrderNo = #{orderNo} and bu_no = #{buNo}
|
|
</update>
|
|
<select id="getUpItemdataEam" resultType="com.xujie.sys.modules.pms.data.EamPropertiesModelDetailData">
|
|
select
|
|
top 1
|
|
site,
|
|
bu_no,
|
|
properties_item_no as itemNo,
|
|
code_no,
|
|
function_type,
|
|
order_id
|
|
from eam_properties_model_detail
|
|
where #{orderId} > order_id
|
|
and site = #{site}
|
|
and bu_no= #{buNo}
|
|
and code_no = #{codeNo}
|
|
and function_type = #{functionType}
|
|
order by order_id desc
|
|
</select>
|
|
<select id="getDownItemdataEam" resultType="com.xujie.sys.modules.pms.data.EamPropertiesModelDetailData">
|
|
select
|
|
top 1
|
|
site,
|
|
bu_no,
|
|
properties_item_no as itemNo,
|
|
code_no,
|
|
function_type,
|
|
order_id
|
|
from eam_properties_model_detail
|
|
where order_id > #{orderId}
|
|
and site = #{site}
|
|
and bu_no= #{buNo}
|
|
and code_no = #{codeNo}
|
|
and function_type = #{functionType}
|
|
order by order_id
|
|
</select>
|
|
|
|
<select id="getResourceSpare" resultType="com.xujie.sys.modules.pms.data.PartSpareInData">
|
|
SELECT
|
|
rs.part_no,
|
|
ps.part_description
|
|
FROM resource_spare rs
|
|
LEFT JOIN part_spare ps ON rs.site = ps.site AND rs.bu_no = ps.bu_no AND rs.part_no = ps.part_no
|
|
WHERE
|
|
rs.site = #{site} and rs.bu_no = #{buNo}
|
|
and rs.resource_id = #{objectID} and rs.part_no = #{partNo} and ps.coreFlag = 'Y'
|
|
</select>
|
|
<select id="getConfirmButtonOperator" resultType="com.xujie.sys.modules.pms.data.EamAdminData">
|
|
select sys_user.username as adminID,
|
|
sys_user.user_display as adminName
|
|
from sys_user
|
|
LEFT JOIN sys_user_role on sys_user.user_id = sys_user_role.user_id
|
|
LEFT JOIN sys_role ON sys_user_role.role_id = sys_role.role_id
|
|
WHERE sys_role.role_name = '维修工单确认按钮权限'
|
|
</select>
|
|
</mapper>
|