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.
1253 lines
60 KiB
1253 lines
60 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">
|
|
|
|
<!-- namespace = 接口的全限定符 -->
|
|
<mapper namespace="com.xujie.sys.modules.pms.mapper.ProofingInformationMapper">
|
|
<insert id="proofingInformationSave" useGeneratedKeys="true" keyProperty="proofingId">
|
|
INSERT INTO plm_proofing_information
|
|
(site,proofing_no,project_id,test_part_id,customer_no,tracker,engineer,priority_level,proofing_number,plan_start_date,required_delivery_date,remark,technical_considerations,is_need_to_send_samples,send_samples_address,consignee,consignee_contact,proofing_result_information,actuality_send_samples_date,send_samples_method,deliver_goods_information,deliver_goods_remark,actuality_reply_date,confirm_results,confirm_by,confirm_information,proofing_status,proofing_result_status,next_to_do,create_date,create_by,approver,step_id,reject_flag,reject_step_id,c_project_type_db,project_phase)
|
|
VALUES
|
|
(#{site},#{proofingNo},#{projectId},#{projectPartId},#{customerNo},#{tracker},#{engineer},#{priorityLevel},#{proofingNumber},#{planStartDate},#{requiredDeliveryDate},#{remark},#{technicalConsiderations},#{isNeedToSendSamples},#{sendSamplesAddress},#{consignee},#{consigneeContact},#{proofingResultInformation},#{actualitySendSamplesDate},#{sendSamplesMethod},#{deliverGoodsInformation},#{deliverGoodsRemark},#{actualityReplyDate},#{confirmResults},#{confirmBy},#{confirmInformation},#{proofingStatus},#{proofingResultStatus},#{nextToDo},getDate(),#{createBy},#{approver},#{stepId},#{rejectFlag},#{rejectStepId},#{cProjectTypeDb},#{projectPhase})
|
|
</insert>
|
|
|
|
<update id="updateProofingInfoById">
|
|
UPDATE plm_proofing_information
|
|
SET
|
|
proofing_no = #{proofingNo},
|
|
proofing_number = #{proofingNumber},
|
|
plan_start_date = #{planStartDate},
|
|
required_delivery_date = #{requiredDeliveryDate},
|
|
actuality_delivery_date = #{actualityDeliveryDate},
|
|
update_date = getDate(),
|
|
update_by = #{updateBy},
|
|
c_project_type_db = #{cProjectTypeDb},
|
|
project_phase = #{projectPhase},
|
|
proofing_status = #{proofingStatus},
|
|
proofing_result_status = #{proofingResultStatus},
|
|
remark = #{remark}
|
|
WHERE id = #{proofingId}
|
|
</update>
|
|
<update id="updateProofingInfoById1">
|
|
UPDATE plm_proofing_information
|
|
SET proofing_no = #{proofingNo},
|
|
proofing_number = #{proofingNumber},
|
|
plan_start_date = #{planStartDate},
|
|
required_delivery_date = #{requiredDeliveryDate},
|
|
update_date = getDate(),
|
|
update_by = #{updateBy},
|
|
c_project_type_db = #{cProjectTypeDb},
|
|
project_phase = #{projectPhase},
|
|
proofing_status = #{proofingStatus},
|
|
proofing_result_status = #{proofingResultStatus},
|
|
remark = #{remark}
|
|
WHERE id = #{proofingId}
|
|
</update>
|
|
<update id="updateDocumentListUploadedFlag">
|
|
UPDATE plm_document_list_definition
|
|
SET uploaded_flag = 'N'
|
|
WHERE site = #{site} AND proofing_id = #{proofingId} AND project_id = #{projectId} AND test_part_id = #{projectPartId} and id = #{documentDefinitionListId}
|
|
</update>
|
|
|
|
<select id="proofingInformationSearch" resultType="com.xujie.sys.modules.pms.data.ProofingInformationData">
|
|
SELECT
|
|
a.id as proofing_id,
|
|
a.site,
|
|
a.proofing_no,
|
|
a.project_id,
|
|
b.project_no,
|
|
a.test_part_id as project_part_id,
|
|
d.test_part_no,
|
|
a.customer_no,
|
|
a.tracker,
|
|
a.engineer,
|
|
a.priority_level,
|
|
a.proofing_number,
|
|
a.plan_start_date,
|
|
a.required_delivery_date,
|
|
a.remark,
|
|
a.technical_considerations,
|
|
a.is_need_to_send_samples,
|
|
a.send_samples_address,
|
|
a.consignee,
|
|
a.consignee_contact,
|
|
a.actuality_delivery_date,
|
|
a.proofing_result_information,
|
|
a.actuality_send_samples_date,
|
|
a.send_samples_method,
|
|
a.deliver_goods_information,
|
|
a.deliver_goods_remark,
|
|
a.actuality_reply_date,
|
|
a.confirm_results,
|
|
a.confirm_by,
|
|
a.confirm_information,
|
|
a.proofing_status,
|
|
a.proofing_result_status,
|
|
a.next_to_do,
|
|
a.create_date,
|
|
a.create_by,
|
|
a.update_date,
|
|
a.update_by,
|
|
a.approver,
|
|
a.step_id,
|
|
a.reject_flag,
|
|
a.reject_step_id,
|
|
a.c_project_type_db,
|
|
a.project_phase,
|
|
b.project_category,
|
|
b.bu_no,
|
|
b.project_desc,
|
|
c.customer_desc,
|
|
d.part_desc
|
|
FROM plm_proofing_information as a
|
|
LEFT JOIN plm_project_info as b ON a.project_id = b.id and a.site = b.site
|
|
LEFT JOIN plm_customer_information AS c ON c.customer_no = b.customer_no and c.site = b.site
|
|
LEFT JOIN plm_project_part AS d ON d.project_id = a.project_id and d.id = a.test_part_id
|
|
where
|
|
a.project_id = #{query.projectId}
|
|
and a.test_part_id = #{query.projectPartId}
|
|
|
|
order by a.create_date desc
|
|
</select>
|
|
<select id="getProofDocument" parameterType="map" statementType="CALLABLE" resultType="com.xujie.sys.modules.pms.data.ProofDocumentData">
|
|
{call plm_getdocumentlist(#{site, mode=IN}, #{projectId, mode=IN}, #{projectPartId,mode=IN}, #{proofingId, mode=IN})}
|
|
</select>
|
|
<delete id="deleteDocumentType">
|
|
DELETE FROM plm_document_list_definition WHERE id = #{documentDefinitionListId}
|
|
</delete>
|
|
<select id="countUploadedDocumentByIds" resultType="java.lang.Integer">
|
|
SELECT COUNT(1)
|
|
FROM CKT_MES_II_REAL.dbo.sys_oss AS a
|
|
INNER JOIN plm_document_list_definition AS b ON CAST(b.id AS VARCHAR(50)) = a.order_ref3
|
|
WHERE b.id IN
|
|
<foreach collection="documentDefinitionListIds" item="id" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</select>
|
|
<delete id="batchDeleteDocumentType">
|
|
DELETE FROM plm_document_list_definition
|
|
WHERE id IN
|
|
<foreach collection="documentDefinitionListIds" item="id" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
<delete id="deleteProofingDocument">
|
|
DELETE a
|
|
FROM
|
|
plm_document_list_definition as a
|
|
INNER join bu_document_list_definition as b on a.document_type_id = b.document_type_id and a.site = b.site
|
|
WHERE a.proofing_id = #{proofingId} and b.project_category = #{cProjectTypeDb}
|
|
</delete>
|
|
<delete id="deleteProofingDocument1">
|
|
DELETE FROM CKT_MES_II_REAL.dbo.sys_oss WHERE id = #{documentId}
|
|
</delete>
|
|
<delete id="deleteProjectDocument">
|
|
DELETE a
|
|
FROM
|
|
plm_document_list_definition as a
|
|
INNER join bu_document_list_definition as b on a.document_type_id = b.document_type_id and a.site = b.site
|
|
WHERE a.proofing_id = -1 and b.project_category = #{projectCategory} and a.project_id = #{projectId} and a.test_part_id = #{projectPartId}
|
|
</delete>
|
|
<delete id="proofingInformationDelete">
|
|
DELETE FROM plm_proofing_information WHERE id = #{proofingId}
|
|
</delete>
|
|
<delete id="deleteDocumentDefinitionById">
|
|
DELETE FROM plm_document_list_definition WHERE id = #{documentDefinitionListId}
|
|
</delete>
|
|
<select id="selecProofingOne" resultType="com.xujie.sys.modules.pms.data.ProofingInformationData">
|
|
SELECT *,id as proofing_id FROM plm_proofing_information WHERE id = #{proofingId}
|
|
</select>
|
|
|
|
<!-- 查询documentTypeId列表 -->
|
|
<select id="getDocumentTypeIds" resultType="com.xujie.sys.modules.pms.data.ProofingInformationData" parameterType="com.xujie.sys.modules.pms.data.ProofingInformationData">
|
|
SELECT a.document_type_id, b.responsible_department ,c.role_desc
|
|
FROM bu_document_list_definition as a
|
|
left join document_type_definition as b on a.document_type_id = b.document_type_id and a.site = b.site
|
|
left join business_role as c on b.responsible_department = c.role_no and b.Site = c.site
|
|
WHERE a.site = #{site}
|
|
AND a.bu_no = #{buNo}
|
|
AND a.project_category = #{cProjectTypeDb}
|
|
AND a.project_phase = 'Sample'
|
|
</select>
|
|
|
|
<!-- 查询documentTypeId列表 -->
|
|
<select id="getProjectDocumentTypeIds" resultType="string" parameterType="com.xujie.sys.modules.pms.data.ProofingInformationData">
|
|
SELECT document_type_id
|
|
FROM bu_document_list_definition
|
|
WHERE site = #{site}
|
|
AND bu_no = #{buNo}
|
|
AND project_category = #{projectCategory}
|
|
AND project_phase = 'Mass production'
|
|
</select>
|
|
|
|
<!-- 检查文档是否存在 -->
|
|
<select id="documentExists" resultType="boolean" parameterType="map">
|
|
SELECT CASE WHEN COUNT(1) > 0 THEN CAST(1 AS BIT) ELSE CAST(0 AS BIT) END
|
|
FROM plm_document_list_definition
|
|
WHERE site = #{data.site}
|
|
AND proofing_id = #{data.proofingId}
|
|
AND project_id = #{data.projectId}
|
|
AND document_type_id = #{documentTypeId}
|
|
</select>
|
|
|
|
<!-- 检查文档是否存在 -->
|
|
<select id="projectDocumentExists" resultType="boolean" parameterType="map">
|
|
SELECT CASE WHEN COUNT(1) > 0 THEN CAST(1 AS BIT) ELSE CAST(0 AS BIT) END
|
|
FROM plm_document_list_definition
|
|
WHERE site = #{data.site}
|
|
AND proofing_id = #{data.proofingId}
|
|
AND project_id = #{data.projectId}
|
|
AND test_part_id = #{data.projectPartId}
|
|
AND document_type_id = #{documentTypeId}
|
|
</select>
|
|
<select id="getExtraDocumentList" resultType="com.xujie.sys.modules.pms.data.EamBuDocumentListDefinitionVo">
|
|
SELECT
|
|
a.document_type_id,
|
|
a.document_type,
|
|
(SELECT role_desc FROM business_role WHERE role_no = a.responsible_department and site = #{query.site}) AS
|
|
responsible_department,
|
|
a.estimated_completion_days
|
|
FROM document_type_definition as a
|
|
where
|
|
a.site = #{query.site}
|
|
AND a.document_type_id NOT IN (
|
|
SELECT document_type_id
|
|
FROM plm_document_list_definition
|
|
WHERE site = #{query.site}
|
|
AND proofing_id = #{query.proofingId}
|
|
AND project_id = #{query.projectId}
|
|
)
|
|
<if test="query.documentTypeId != null and query.documentTypeId != ''">
|
|
AND UPPER(a.document_type_id) like '%' + UPPER(#{query.documentTypeId}) + '%'
|
|
</if>
|
|
<if test="query.documentType != null and query.documentType != ''">
|
|
AND UPPER(a.document_type) like '%' + UPPER(#{query.documentType}) + '%'
|
|
</if>
|
|
<if test="query.responsibleDepartment != null and query.responsibleDepartment != ''">
|
|
AND UPPER(a.responsible_department) like '%' + UPPER(#{query.responsibleDepartment}) + '%'
|
|
</if>
|
|
</select>
|
|
<select id="documentExists1" resultType="java.lang.Boolean">
|
|
SELECT CASE WHEN COUNT(1) > 0 THEN CAST(1 AS BIT) ELSE CAST(0 AS BIT) END
|
|
FROM plm_document_list_definition
|
|
WHERE site = #{data.site}
|
|
AND proofing_id = #{data.proofingId}
|
|
and test_part_id = #{data.projectPartId}
|
|
AND project_id = #{data.projectId}
|
|
AND document_type_id = #{documentTypeId}
|
|
</select>
|
|
<select id="selectProjectList" resultType="com.xujie.sys.modules.pms.data.ProofingInformationData">
|
|
SELECT a.*,b.project_category FROM plm_document_list_definition as a
|
|
left join plm_project_info as b on a.project_id = b.id
|
|
left join bu_document_list_definition as c on a.document_type_id = c.document_type_id
|
|
WHERE a.project_id = #{projectId} and a.proofing_id = -1 and c.project_phase = 'Mass Production'
|
|
</select>
|
|
<select id="searchProjectAllDocument" parameterType="map" statementType="CALLABLE" resultType="com.xujie.sys.modules.pms.data.ProofingInformationData">
|
|
{call plm_getdocumentlist(#{site, mode=IN}, #{projectId, mode=IN}, #{projectPartId,mode=IN}, #{proofingId, mode=IN})}
|
|
</select>
|
|
<select id="queryProofingNo" resultType="com.xujie.sys.modules.pms.data.ProofingInformationData">
|
|
SELECT * FROM plm_proofing_information WHERE site = #{site} and project_id = #{projectId} and id = #{proofingId}
|
|
</select>
|
|
<select id="selectProofingDocument" resultType="com.xujie.sys.modules.pms.data.ProofingInformationData">
|
|
SELECT
|
|
c.id
|
|
FROM
|
|
sys_oss AS a
|
|
LEFT JOIN plm_document_list_definition AS b ON CAST ( b.id AS VARCHAR ) = a.order_ref3
|
|
LEFT JOIN bu_document_list_definition AS c ON b.document_type_id = c.document_type_id
|
|
WHERE b.proofing_id = #{proofingId} and c.project_category = #{cProjectTypeDb} and c.project_phase = 'Sample'
|
|
</select>
|
|
<select id="checkProductionConfirmationDocument" resultType="boolean">
|
|
SELECT
|
|
CASE
|
|
WHEN EXISTS (
|
|
SELECT 1
|
|
FROM plm_project_document_confirm_file_list AS a
|
|
WHERE Site = #{site} AND document_type = #{documentType} AND Order_Ref1 = #{OrderRef1} AND document_id = #{documentId} and Order_Ref2 = #{OrderRef2}
|
|
) THEN 1
|
|
ELSE 0
|
|
END AS exists_flag
|
|
</select>
|
|
<select id="getPendingUploads" resultType="com.xujie.sys.modules.pms.data.ProofDocumentData">
|
|
SELECT * FROM view_plm_toupload_list_byUser
|
|
<where>
|
|
status != '草稿' AND RelatedPerson = #{userId}
|
|
<if test="query.projectNo != null and query.projectNo != ''">
|
|
AND (
|
|
project_no like '%' + #{query.projectNo} + '%'
|
|
OR project_no IN (
|
|
SELECT Value FROM CKT_MES_II_REAL.dbo.SplitString(#{query.projectNo}, ',')
|
|
)
|
|
)
|
|
</if>
|
|
<if test="query.projectDesc != null and query.projectDesc != ''">
|
|
and project_desc like '%' + #{query.projectDesc} + '%'
|
|
</if>
|
|
<if test="query.uploadedFlag != null and query.uploadedFlag != ''">
|
|
<choose>
|
|
<when test="query.uploadedFlag == '已上传'">
|
|
<![CDATA[
|
|
AND uploaded_flag = '已上传'
|
|
]]>
|
|
</when>
|
|
<when test="query.uploadedFlag == '未上传'">
|
|
<![CDATA[
|
|
AND uploaded_flag != '已上传'
|
|
]]>
|
|
</when>
|
|
<otherwise>
|
|
<![CDATA[
|
|
AND uploaded_flag = #{query.uploadedFlag, jdbcType=VARCHAR}
|
|
]]>
|
|
</otherwise>
|
|
</choose>
|
|
</if>
|
|
<if test="query.testPartNo != null and query.testPartNo != ''">
|
|
AND (
|
|
test_part_no like '%' + #{query.testPartNo} + '%'
|
|
OR test_part_no IN (
|
|
SELECT Value FROM CKT_MES_II_REAL.dbo.SplitString(#{query.testPartNo}, ',')
|
|
)
|
|
)
|
|
</if>
|
|
<if test="query.partDesc != null and query.partDesc != ''">
|
|
and part_desc like '%' + #{query.partDesc} + '%'
|
|
</if>
|
|
<if test="query.proofingNo != null and query.proofingNo != ''">
|
|
and proofing_no like '%' + #{query.proofingNo} + '%'
|
|
</if>
|
|
<if test="query.customerNo != null and query.customerNo != ''">
|
|
and customer_no like '%' + #{query.customerNo} + '%'
|
|
</if>
|
|
<if test="query.customerDesc != null and query.customerDesc != ''">
|
|
and customer_desc like '%' + #{query.customerDesc} + '%'
|
|
</if>
|
|
<if test="query.buDesc != null and query.buDesc != ''">
|
|
AND dbo.get_bu_desc ( site, bu_no ) = #{query.buDesc}
|
|
</if>
|
|
<if test="query.projectCategory != null and query.projectCategory != ''">
|
|
and project_category = #{query.projectCategory}
|
|
</if>
|
|
<if test="query.status != null and query.status != ''">
|
|
and status = #{query.status}
|
|
</if>
|
|
<if test="query.projectManager != null and query.projectManager != ''">
|
|
and project_manager = #{query.projectManager}
|
|
</if>
|
|
<if test="query.projectOwner != null and query.projectOwner != ''">
|
|
and project_owner = #{query.projectOwner}
|
|
</if>
|
|
<if test="query.engineer != null and query.engineer != ''">
|
|
and engineer = #{query.engineer}
|
|
</if>
|
|
<if test="query.projectLeader != null and query.projectLeader != ''">
|
|
AND (
|
|
CASE
|
|
WHEN responsible_department = 'R001' AND CHARINDEX('-', ISNULL(project_manager, '')) > 0 THEN SUBSTRING(project_manager, CHARINDEX('-', project_manager) + 1, LEN(project_manager))
|
|
WHEN responsible_department = 'R002' AND CHARINDEX('-', ISNULL(project_owner, '')) > 0 THEN SUBSTRING(project_owner, CHARINDEX('-', project_owner) + 1, LEN(project_owner))
|
|
WHEN responsible_department = 'R004' AND CHARINDEX('-', ISNULL(engineer, '')) > 0 THEN SUBSTRING(engineer, CHARINDEX('-', engineer) + 1, LEN(engineer))
|
|
WHEN responsible_department = 'R005' AND CHARINDEX('-', ISNULL(c_quality_engineer1, '')) > 0 THEN SUBSTRING(c_quality_engineer1, CHARINDEX('-', c_quality_engineer1) + 1, LEN(c_quality_engineer1))
|
|
WHEN responsible_department = 'R007' AND CHARINDEX('-', ISNULL(c_quality_engineer2, '')) > 0 THEN SUBSTRING(c_quality_engineer2, CHARINDEX('-', c_quality_engineer2) + 1, LEN(c_quality_engineer2))
|
|
WHEN responsible_department = 'R008' AND CHARINDEX('-', ISNULL(c_quality_engineer3, '')) > 0 THEN SUBSTRING(c_quality_engineer3, CHARINDEX('-', c_quality_engineer3) + 1, LEN(c_quality_engineer3))
|
|
WHEN responsible_department = 'R009' AND CHARINDEX('-', ISNULL(c_manufacture_engineer, '')) > 0 THEN SUBSTRING(c_manufacture_engineer, CHARINDEX('-', c_manufacture_engineer) + 1, LEN(c_manufacture_engineer))
|
|
WHEN responsible_department = 'R011' AND CHARINDEX('-', ISNULL(c_quality_engineer4, '')) > 0 THEN SUBSTRING(c_quality_engineer4, CHARINDEX('-', c_quality_engineer4) + 1, LEN(c_quality_engineer4))
|
|
WHEN responsible_department = 'R012' AND CHARINDEX('-', ISNULL(doc_engineer, '')) > 0 THEN SUBSTRING(doc_engineer, CHARINDEX('-', doc_engineer) + 1, LEN(doc_engineer))
|
|
WHEN responsible_department = 'R013' AND CHARINDEX('-', ISNULL(c_quality_engineer5, '')) > 0 THEN SUBSTRING(c_quality_engineer5, CHARINDEX('-', c_quality_engineer5) + 1, LEN(c_quality_engineer5))
|
|
WHEN responsible_department = 'R014' AND CHARINDEX('-', ISNULL(c_quality_engineer6, '')) > 0 THEN SUBSTRING(c_quality_engineer6, CHARINDEX('-', c_quality_engineer6) + 1, LEN(c_quality_engineer6))
|
|
WHEN responsible_department = 'R015' AND CHARINDEX('-', ISNULL(ipqc_hard_tag, '')) > 0 THEN SUBSTRING(ipqc_hard_tag, CHARINDEX('-', ipqc_hard_tag) + 1, LEN(ipqc_hard_tag))
|
|
WHEN responsible_department = 'R016' AND CHARINDEX('-', ISNULL(c_quality_engineer7, '')) > 0 THEN SUBSTRING(c_quality_engineer7, CHARINDEX('-', c_quality_engineer7) + 1, LEN(c_quality_engineer7))
|
|
WHEN responsible_department = 'R017' AND CHARINDEX('-', ISNULL(doc_engineer2, '')) > 0 THEN SUBSTRING(doc_engineer2, CHARINDEX('-', doc_engineer2) + 1, LEN(doc_engineer2))
|
|
ELSE ''
|
|
END
|
|
) = #{query.projectLeader}
|
|
</if>
|
|
<if test="query.finalPartNo != null and query.finalPartNo != ''">
|
|
and final_part_no = #{query.finalPartNo}
|
|
</if>
|
|
<if test="query.massProductionStartDate != null ">
|
|
AND close_date >= #{query.massProductionStartDate}
|
|
</if>
|
|
<if test="query.massProductionEndDate != null ">
|
|
AND #{query.massProductionEndDate} >= close_date
|
|
</if>
|
|
<if test="query.startDate != null ">
|
|
AND build_date >= #{query.startDate}
|
|
</if>
|
|
<if test="query.endDate != null ">
|
|
AND #{query.endDate} >= build_date
|
|
</if>
|
|
<if test="query.documentDefinitionListId != null and query.documentDefinitionListId != ''">
|
|
AND documentDefinitionListId = #{query.documentDefinitionListId}
|
|
</if>
|
|
<if test="query.documentTypeId != null and query.documentTypeId != ''">
|
|
AND document_type_id like '%' + #{query.documentTypeId} + '%'
|
|
</if>
|
|
<if test="query.documentType != null and query.documentType != ''">
|
|
AND document_type like '%' + #{query.documentType} + '%'
|
|
</if>
|
|
</where>
|
|
order by project_id
|
|
</select>
|
|
<select id="getOverdueUploads" resultType="com.xujie.sys.modules.pms.data.ProofDocumentData">
|
|
<![CDATA[
|
|
SELECT * FROM view_plm_toupload_list_byUser
|
|
WHERE status != '草稿'
|
|
AND Request_date < GETDATE()
|
|
AND RelatedPerson = #{userId}
|
|
]]>
|
|
<if test="query.projectNo != null and query.projectNo != ''">
|
|
<![CDATA[
|
|
AND (
|
|
project_no like '%' + #{query.projectNo} + '%'
|
|
OR project_no IN (
|
|
SELECT Value FROM CKT_MES_II_REAL.dbo.SplitString(#{query.projectNo}, ',')
|
|
)
|
|
)
|
|
]]>
|
|
</if>
|
|
<if test="query.projectDesc != null and query.projectDesc != ''">
|
|
<![CDATA[
|
|
and project_desc like '%' + #{query.projectDesc} + '%'
|
|
]]>
|
|
</if>
|
|
<if test="query.uploadedFlag != null and query.uploadedFlag != ''">
|
|
<choose>
|
|
<when test="query.uploadedFlag == '已上传'">
|
|
<![CDATA[
|
|
AND uploaded_flag = '已上传'
|
|
]]>
|
|
</when>
|
|
<when test="query.uploadedFlag == '未上传'">
|
|
<![CDATA[
|
|
AND uploaded_flag != '已上传'
|
|
]]>
|
|
</when>
|
|
<otherwise>
|
|
<![CDATA[
|
|
AND uploaded_flag = #{query.uploadedFlag, jdbcType=VARCHAR}
|
|
]]>
|
|
</otherwise>
|
|
</choose>
|
|
</if>
|
|
<if test="query.testPartNo != null and query.testPartNo != ''">
|
|
<![CDATA[
|
|
AND (
|
|
test_part_no like '%' + #{query.testPartNo} + '%'
|
|
OR test_part_no IN (
|
|
SELECT Value FROM CKT_MES_II_REAL.dbo.SplitString(#{query.testPartNo}, ',')
|
|
)
|
|
)
|
|
]]>
|
|
</if>
|
|
<if test="query.partDesc != null and query.partDesc != ''">
|
|
<![CDATA[
|
|
AND part_desc like '%' + #{query.partDesc} + '%'
|
|
]]>
|
|
</if>
|
|
<if test="query.proofingNo != null and query.proofingNo != ''">
|
|
<![CDATA[
|
|
AND proofing_no like '%' + #{query.proofingNo} + '%'
|
|
]]>
|
|
</if>
|
|
<if test="query.customerNo != null and query.customerNo != ''">
|
|
<![CDATA[
|
|
AND customer_no LIKE '%' + #{query.customerNo} + '%'
|
|
]]>
|
|
</if>
|
|
<if test="query.customerDesc != null and query.customerDesc != ''">
|
|
<![CDATA[
|
|
AND customer_desc LIKE '%' + #{query.customerDesc} + '%'
|
|
]]>
|
|
</if>
|
|
<if test="query.buDesc != null and query.buDesc != ''">
|
|
<![CDATA[
|
|
AND dbo.get_bu_desc(site, bu_no) = #{query.buDesc}
|
|
]]>
|
|
</if>
|
|
<if test="query.projectCategory != null and query.projectCategory != ''">
|
|
<![CDATA[
|
|
AND project_category = #{query.projectCategory}
|
|
]]>
|
|
</if>
|
|
<if test="query.status != null and query.status != ''">
|
|
<![CDATA[
|
|
AND status = #{query.status}
|
|
]]>
|
|
</if>
|
|
<if test="query.projectManager != null and query.projectManager != ''">
|
|
<![CDATA[
|
|
AND project_manager = #{query.projectManager}
|
|
]]>
|
|
</if>
|
|
<if test="query.projectOwner != null and query.projectOwner != ''">
|
|
<![CDATA[
|
|
AND project_owner = #{query.projectOwner}
|
|
]]>
|
|
</if>
|
|
<if test="query.engineer != null and query.engineer != ''">
|
|
<![CDATA[
|
|
AND engineer = #{query.engineer}
|
|
]]>
|
|
</if>
|
|
<if test="query.projectLeader != null and query.projectLeader != ''">
|
|
<![CDATA[
|
|
AND (
|
|
CASE
|
|
WHEN responsible_department = 'R001' AND CHARINDEX('-', ISNULL(project_manager, '')) > 0 THEN SUBSTRING(project_manager, CHARINDEX('-', project_manager) + 1, LEN(project_manager))
|
|
WHEN responsible_department = 'R002' AND CHARINDEX('-', ISNULL(project_owner, '')) > 0 THEN SUBSTRING(project_owner, CHARINDEX('-', project_owner) + 1, LEN(project_owner))
|
|
WHEN responsible_department = 'R004' AND CHARINDEX('-', ISNULL(engineer, '')) > 0 THEN SUBSTRING(engineer, CHARINDEX('-', engineer) + 1, LEN(engineer))
|
|
WHEN responsible_department = 'R005' AND CHARINDEX('-', ISNULL(c_quality_engineer1, '')) > 0 THEN SUBSTRING(c_quality_engineer1, CHARINDEX('-', c_quality_engineer1) + 1, LEN(c_quality_engineer1))
|
|
WHEN responsible_department = 'R007' AND CHARINDEX('-', ISNULL(c_quality_engineer2, '')) > 0 THEN SUBSTRING(c_quality_engineer2, CHARINDEX('-', c_quality_engineer2) + 1, LEN(c_quality_engineer2))
|
|
WHEN responsible_department = 'R008' AND CHARINDEX('-', ISNULL(c_quality_engineer3, '')) > 0 THEN SUBSTRING(c_quality_engineer3, CHARINDEX('-', c_quality_engineer3) + 1, LEN(c_quality_engineer3))
|
|
WHEN responsible_department = 'R009' AND CHARINDEX('-', ISNULL(c_manufacture_engineer, '')) > 0 THEN SUBSTRING(c_manufacture_engineer, CHARINDEX('-', c_manufacture_engineer) + 1, LEN(c_manufacture_engineer))
|
|
WHEN responsible_department = 'R011' AND CHARINDEX('-', ISNULL(c_quality_engineer4, '')) > 0 THEN SUBSTRING(c_quality_engineer4, CHARINDEX('-', c_quality_engineer4) + 1, LEN(c_quality_engineer4))
|
|
WHEN responsible_department = 'R012' AND CHARINDEX('-', ISNULL(doc_engineer, '')) > 0 THEN SUBSTRING(doc_engineer, CHARINDEX('-', doc_engineer) + 1, LEN(doc_engineer))
|
|
WHEN responsible_department = 'R013' AND CHARINDEX('-', ISNULL(c_quality_engineer5, '')) > 0 THEN SUBSTRING(c_quality_engineer5, CHARINDEX('-', c_quality_engineer5) + 1, LEN(c_quality_engineer5))
|
|
WHEN responsible_department = 'R014' AND CHARINDEX('-', ISNULL(c_quality_engineer6, '')) > 0 THEN SUBSTRING(c_quality_engineer6, CHARINDEX('-', c_quality_engineer6) + 1, LEN(c_quality_engineer6))
|
|
WHEN responsible_department = 'R015' AND CHARINDEX('-', ISNULL(ipqc_hard_tag, '')) > 0 THEN SUBSTRING(ipqc_hard_tag, CHARINDEX('-', ipqc_hard_tag) + 1, LEN(ipqc_hard_tag))
|
|
WHEN responsible_department = 'R016' AND CHARINDEX('-', ISNULL(c_quality_engineer7, '')) > 0 THEN SUBSTRING(c_quality_engineer7, CHARINDEX('-', c_quality_engineer7) + 1, LEN(c_quality_engineer7))
|
|
WHEN responsible_department = 'R017' AND CHARINDEX('-', ISNULL(doc_engineer2, '')) > 0 THEN SUBSTRING(doc_engineer2, CHARINDEX('-', doc_engineer2) + 1, LEN(doc_engineer2))
|
|
ELSE ''
|
|
END
|
|
) = #{query.projectLeader}
|
|
]]>
|
|
</if>
|
|
<if test="query.finalPartNo != null and query.finalPartNo != ''">
|
|
<![CDATA[
|
|
and final_part_no = #{query.finalPartNo}
|
|
]]>
|
|
</if>
|
|
<if test="query.massProductionStartDate != null ">
|
|
<![CDATA[
|
|
AND close_date >= #{query.massProductionStartDate}
|
|
]]>
|
|
</if>
|
|
<if test="query.massProductionEndDate != null ">
|
|
<![CDATA[
|
|
AND #{query.massProductionEndDate} >= close_date
|
|
]]>
|
|
</if>
|
|
<if test="query.startDate != null">
|
|
<![CDATA[
|
|
AND build_date >= #{query.startDate}
|
|
]]>
|
|
</if>
|
|
<if test="query.endDate != null">
|
|
<![CDATA[
|
|
AND #{query.endDate} >= build_date
|
|
]]>
|
|
</if>
|
|
<if test="query.documentTypeId != null and query.documentTypeId != ''">
|
|
<![CDATA[
|
|
AND document_type_id like '%' + #{query.documentTypeId} + '%'
|
|
]]>
|
|
</if>
|
|
<if test="query.documentType != null and query.documentType != ''">
|
|
<![CDATA[
|
|
AND document_type like '%' + #{query.documentType} + '%'
|
|
]]>
|
|
</if>
|
|
<![CDATA[
|
|
ORDER BY project_id
|
|
]]>
|
|
</select>
|
|
<select id="getAllUploads" resultType="com.xujie.sys.modules.pms.data.ProofDocumentData">
|
|
SELECT * FROM view_plm_toupload_list_byUser
|
|
<where>
|
|
status != '草稿'
|
|
<if test="query.projectNo != null and query.projectNo != ''">
|
|
AND (
|
|
project_no like '%' + #{query.projectNo} + '%'
|
|
OR project_no IN (
|
|
SELECT Value FROM CKT_MES_II_REAL.dbo.SplitString(#{query.projectNo}, ',')
|
|
)
|
|
)
|
|
</if>
|
|
<if test="query.uploadedFlag != null and query.uploadedFlag != ''">
|
|
<choose>
|
|
<when test="query.uploadedFlag == '已上传'">
|
|
AND uploaded_flag = '已上传'
|
|
</when>
|
|
<when test="query.uploadedFlag == '未上传'">
|
|
AND uploaded_flag != '已上传'
|
|
</when>
|
|
<otherwise>
|
|
AND uploaded_flag = #{query.uploadedFlag, jdbcType=VARCHAR}
|
|
</otherwise>
|
|
</choose>
|
|
</if>
|
|
<if test="query.projectDesc != null and query.projectDesc != ''">
|
|
and project_desc like '%' + #{query.projectDesc} + '%'
|
|
</if>
|
|
<if test="query.testPartNo != null and query.testPartNo != ''">
|
|
AND (
|
|
test_part_no like '%' + #{query.testPartNo} + '%'
|
|
OR test_part_no IN (
|
|
SELECT Value FROM CKT_MES_II_REAL.dbo.SplitString(#{query.testPartNo}, ',')
|
|
)
|
|
)
|
|
</if>
|
|
<if test="query.partDesc != null and query.partDesc != ''">
|
|
and part_desc like '%' + #{query.partDesc} + '%'
|
|
</if>
|
|
<if test="query.proofingNo != null and query.proofingNo != ''">
|
|
<![CDATA[
|
|
AND proofing_no like '%' + #{query.proofingNo} + '%'
|
|
]]>
|
|
</if>
|
|
<if test="query.customerNo != null and query.customerNo != ''">
|
|
and customer_no like '%' + #{query.customerNo} + '%'
|
|
</if>
|
|
<if test="query.customerDesc != null and query.customerDesc != ''">
|
|
and customer_desc like '%' + #{query.customerDesc} + '%'
|
|
</if>
|
|
<if test="query.buDesc != null and query.buDesc != ''">
|
|
AND dbo.get_bu_desc ( site, bu_no ) = #{query.buDesc}
|
|
</if>
|
|
<if test="query.projectCategory != null and query.projectCategory != ''">
|
|
and project_category = #{query.projectCategory}
|
|
</if>
|
|
<if test="query.status != null and query.status != ''">
|
|
and status = #{query.status}
|
|
</if>
|
|
<if test="query.projectManager != null and query.projectManager != ''">
|
|
and project_manager = #{query.projectManager}
|
|
</if>
|
|
<if test="query.projectOwner != null and query.projectOwner != ''">
|
|
and project_owner = #{query.projectOwner}
|
|
</if>
|
|
<if test="query.engineer != null and query.engineer != ''">
|
|
and engineer = #{query.engineer}
|
|
</if>
|
|
<if test="query.projectLeader != null and query.projectLeader != ''">
|
|
AND (
|
|
CASE
|
|
WHEN responsible_department = 'R001' AND CHARINDEX('-', ISNULL(project_manager, '')) > 0 THEN SUBSTRING(project_manager, CHARINDEX('-', project_manager) + 1, LEN(project_manager))
|
|
WHEN responsible_department = 'R002' AND CHARINDEX('-', ISNULL(project_owner, '')) > 0 THEN SUBSTRING(project_owner, CHARINDEX('-', project_owner) + 1, LEN(project_owner))
|
|
WHEN responsible_department = 'R004' AND CHARINDEX('-', ISNULL(engineer, '')) > 0 THEN SUBSTRING(engineer, CHARINDEX('-', engineer) + 1, LEN(engineer))
|
|
WHEN responsible_department = 'R005' AND CHARINDEX('-', ISNULL(c_quality_engineer1, '')) > 0 THEN SUBSTRING(c_quality_engineer1, CHARINDEX('-', c_quality_engineer1) + 1, LEN(c_quality_engineer1))
|
|
WHEN responsible_department = 'R007' AND CHARINDEX('-', ISNULL(c_quality_engineer2, '')) > 0 THEN SUBSTRING(c_quality_engineer2, CHARINDEX('-', c_quality_engineer2) + 1, LEN(c_quality_engineer2))
|
|
WHEN responsible_department = 'R008' AND CHARINDEX('-', ISNULL(c_quality_engineer3, '')) > 0 THEN SUBSTRING(c_quality_engineer3, CHARINDEX('-', c_quality_engineer3) + 1, LEN(c_quality_engineer3))
|
|
WHEN responsible_department = 'R009' AND CHARINDEX('-', ISNULL(c_manufacture_engineer, '')) > 0 THEN SUBSTRING(c_manufacture_engineer, CHARINDEX('-', c_manufacture_engineer) + 1, LEN(c_manufacture_engineer))
|
|
WHEN responsible_department = 'R011' AND CHARINDEX('-', ISNULL(c_quality_engineer4, '')) > 0 THEN SUBSTRING(c_quality_engineer4, CHARINDEX('-', c_quality_engineer4) + 1, LEN(c_quality_engineer4))
|
|
WHEN responsible_department = 'R012' AND CHARINDEX('-', ISNULL(doc_engineer, '')) > 0 THEN SUBSTRING(doc_engineer, CHARINDEX('-', doc_engineer) + 1, LEN(doc_engineer))
|
|
WHEN responsible_department = 'R013' AND CHARINDEX('-', ISNULL(c_quality_engineer5, '')) > 0 THEN SUBSTRING(c_quality_engineer5, CHARINDEX('-', c_quality_engineer5) + 1, LEN(c_quality_engineer5))
|
|
WHEN responsible_department = 'R014' AND CHARINDEX('-', ISNULL(c_quality_engineer6, '')) > 0 THEN SUBSTRING(c_quality_engineer6, CHARINDEX('-', c_quality_engineer6) + 1, LEN(c_quality_engineer6))
|
|
WHEN responsible_department = 'R015' AND CHARINDEX('-', ISNULL(ipqc_hard_tag, '')) > 0 THEN SUBSTRING(ipqc_hard_tag, CHARINDEX('-', ipqc_hard_tag) + 1, LEN(ipqc_hard_tag))
|
|
WHEN responsible_department = 'R016' AND CHARINDEX('-', ISNULL(c_quality_engineer7, '')) > 0 THEN SUBSTRING(c_quality_engineer7, CHARINDEX('-', c_quality_engineer7) + 1, LEN(c_quality_engineer7))
|
|
WHEN responsible_department = 'R017' AND CHARINDEX('-', ISNULL(doc_engineer2, '')) > 0 THEN SUBSTRING(doc_engineer2, CHARINDEX('-', doc_engineer2) + 1, LEN(doc_engineer2))
|
|
ELSE ''
|
|
END
|
|
) = #{query.projectLeader}
|
|
</if>
|
|
<if test="query.finalPartNo != null and query.finalPartNo != ''">
|
|
and final_part_no = #{query.finalPartNo}
|
|
</if>
|
|
<if test="query.massProductionStartDate != null ">
|
|
AND close_date >= #{query.massProductionStartDate}
|
|
</if>
|
|
<if test="query.massProductionEndDate != null ">
|
|
AND #{query.massProductionEndDate} >= close_date
|
|
</if>
|
|
<if test="query.startDate != null ">
|
|
AND build_date >= #{query.startDate}
|
|
</if>
|
|
<if test="query.endDate != null ">
|
|
AND #{query.endDate} >= build_date
|
|
</if>
|
|
<if test="query.documentTypeId != null and query.documentTypeId != ''">
|
|
AND document_type_id like '%' + #{query.documentTypeId} + '%'
|
|
</if>
|
|
<if test="query.documentType != null and query.documentType != ''">
|
|
AND document_type like '%' + #{query.documentType} + '%'
|
|
</if>
|
|
</where>
|
|
order by project_id
|
|
</select>
|
|
<select id="queryPendingUploads" resultType="com.xujie.sys.modules.pms.data.ProofDocumentData">
|
|
SELECT * FROM view_plm_toupload_list_byUser
|
|
<where>
|
|
status != '草稿' AND RelatedPerson = #{user.userId}
|
|
<if test="params.sql != null and params.sql != ''">
|
|
${params.sql}
|
|
</if>
|
|
</where>
|
|
order by project_id
|
|
</select>
|
|
<select id="queryOverdueUploads" resultType="com.xujie.sys.modules.pms.data.ProofDocumentData">
|
|
<![CDATA[
|
|
SELECT * FROM view_plm_toupload_list_byUser
|
|
WHERE status != '草稿'
|
|
AND Request_date < GETDATE()
|
|
AND RelatedPerson = #{user.userId}
|
|
]]>
|
|
<if test="params.sql != null and params.sql != ''">
|
|
<![CDATA[
|
|
${params.sql}
|
|
]]>
|
|
</if>
|
|
<![CDATA[
|
|
ORDER BY project_id
|
|
]]>
|
|
</select>
|
|
<select id="queryAllUploads" resultType="com.xujie.sys.modules.pms.data.ProofDocumentData">
|
|
SELECT * FROM view_plm_toupload_list_byUser
|
|
<where>
|
|
status != '草稿'
|
|
<if test="params.sql != null and params.sql != ''">
|
|
${params.sql}
|
|
</if>
|
|
</where>
|
|
order by project_id
|
|
</select>
|
|
<select id="getPendingConfirmations" resultType="com.xujie.sys.modules.pms.data.ProjectProductionValidationDocumentData">
|
|
SELECT * FROM view_plm_toproconfirm_list_byUser
|
|
<where>
|
|
status != '草稿' AND RelatedPerson = #{userId}
|
|
<if test="query.projectNo != null and query.projectNo != ''">
|
|
AND (
|
|
project_no like '%' + #{query.projectNo} + '%'
|
|
OR project_no IN (
|
|
SELECT Value FROM CKT_MES_II_REAL.dbo.SplitString(#{query.projectNo}, ',')
|
|
)
|
|
)
|
|
</if>
|
|
<if test="query.projectDesc != null and query.projectDesc != ''">
|
|
and project_desc like '%' + #{query.projectDesc} + '%'
|
|
</if>
|
|
<if test="query.confirmFlag != null and query.confirmFlag != ''">
|
|
and confirm_flag like #{query.confirmFlag}
|
|
</if>
|
|
<if test="query.testPartNo != null and query.testPartNo != ''">
|
|
AND (
|
|
test_part_no like '%' + #{query.testPartNo} + '%'
|
|
OR test_part_no IN (
|
|
SELECT Value FROM CKT_MES_II_REAL.dbo.SplitString(#{query.testPartNo}, ',')
|
|
)
|
|
)
|
|
</if>
|
|
<if test="query.partDesc != null and query.partDesc != ''">
|
|
and part_desc like '%' + #{query.partDesc} + '%'
|
|
</if>
|
|
<if test="query.customerNo != null and query.customerNo != ''">
|
|
and customer_no like '%' + #{query.customerNo} + '%'
|
|
</if>
|
|
<if test="query.customerDesc != null and query.customerDesc != ''">
|
|
and customer_desc like '%' + #{query.customerDesc} + '%'
|
|
</if>
|
|
<if test="query.buDesc != null and query.buDesc != ''">
|
|
AND dbo.get_bu_desc ( site, bu_no ) = #{query.buDesc}
|
|
</if>
|
|
<if test="query.projectCategory != null and query.projectCategory != ''">
|
|
and project_category = #{query.projectCategory}
|
|
</if>
|
|
<if test="query.status != null and query.status != ''">
|
|
and status = #{query.status}
|
|
</if>
|
|
<if test="query.projectManager != null and query.projectManager != ''">
|
|
and project_manager = #{query.projectManager}
|
|
</if>
|
|
<if test="query.projectOwner != null and query.projectOwner != ''">
|
|
and project_owner = #{query.projectOwner}
|
|
</if>
|
|
<if test="query.engineer != null and query.engineer != ''">
|
|
and engineer = #{query.engineer}
|
|
</if>
|
|
<if test="query.startDate != null ">
|
|
AND build_date >= #{query.startDate}
|
|
</if>
|
|
<if test="query.endDate != null ">
|
|
AND #{query.endDate} >= build_date
|
|
</if>
|
|
</where>
|
|
order by project_id
|
|
</select>
|
|
<select id="getOverdueConfirmations" resultType="com.xujie.sys.modules.pms.data.ProjectProductionValidationDocumentData">
|
|
<![CDATA[
|
|
SELECT * FROM view_plm_toproconfirm_list_byUser
|
|
WHERE status != '草稿' AND confirm_flag = 'N' AND wanted_confirm_date < GETDATE() AND RelatedPerson = #{userId}
|
|
]]>
|
|
<if test="query.projectNo != null and query.projectNo != ''">
|
|
<![CDATA[
|
|
AND (
|
|
project_no like '%' + #{query.projectNo} + '%'
|
|
OR project_no IN (
|
|
SELECT Value FROM CKT_MES_II_REAL.dbo.SplitString(#{query.projectNo}, ',')
|
|
)
|
|
)
|
|
]]>
|
|
</if>
|
|
<if test="query.projectDesc != null and query.projectDesc != ''">
|
|
<![CDATA[
|
|
and project_desc like '%' + #{query.projectDesc} + '%'
|
|
]]>
|
|
</if>
|
|
<if test="query.confirmFlag != null and query.confirmFlag != ''">
|
|
<![CDATA[
|
|
and confirm_flag = #{query.confirmFlag}
|
|
]]>
|
|
</if>
|
|
<if test="query.testPartNo != null and query.testPartNo != ''">
|
|
<![CDATA[
|
|
AND (
|
|
test_part_no like '%' + #{query.testPartNo} + '%'
|
|
OR test_part_no IN (
|
|
SELECT Value FROM CKT_MES_II_REAL.dbo.SplitString(#{query.testPartNo}, ',')
|
|
)
|
|
)
|
|
]]>
|
|
</if>
|
|
<if test="query.partDesc != null and query.partDesc != ''">
|
|
<![CDATA[
|
|
and part_desc like '%' + #{query.partDesc} + '%'
|
|
]]>
|
|
</if>
|
|
<if test="query.customerNo != null and query.customerNo != ''">
|
|
<![CDATA[
|
|
AND customer_no LIKE '%' + #{query.customerNo} + '%'
|
|
]]>
|
|
</if>
|
|
<if test="query.customerDesc != null and query.customerDesc != ''">
|
|
<![CDATA[
|
|
AND customer_desc LIKE '%' + #{query.customerDesc} + '%'
|
|
]]>
|
|
</if>
|
|
<if test="query.buDesc != null and query.buDesc != ''">
|
|
<![CDATA[
|
|
AND dbo.get_bu_desc(site, bu_no) = #{query.buDesc}
|
|
]]>
|
|
</if>
|
|
<if test="query.projectCategory != null and query.projectCategory != ''">
|
|
<![CDATA[
|
|
AND project_category = #{query.projectCategory}
|
|
]]>
|
|
</if>
|
|
<if test="query.status != null and query.status != ''">
|
|
<![CDATA[
|
|
AND status = #{query.status}
|
|
]]>
|
|
</if>
|
|
<if test="query.projectManager != null and query.projectManager != ''">
|
|
<![CDATA[
|
|
AND project_manager = #{query.projectManager}
|
|
]]>
|
|
</if>
|
|
<if test="query.startDate != null">
|
|
<![CDATA[
|
|
AND build_date >= #{query.startDate}
|
|
]]>
|
|
</if>
|
|
<if test="query.endDate != null">
|
|
<![CDATA[
|
|
AND #{query.endDate} >= build_date
|
|
]]>
|
|
</if>
|
|
<![CDATA[
|
|
ORDER BY project_id
|
|
]]>
|
|
</select>
|
|
<select id="getAllConfirmations"
|
|
resultType="com.xujie.sys.modules.pms.data.ProjectProductionValidationDocumentData">
|
|
SELECT * FROM view_plm_toproconfirm_list_byUser
|
|
<where>
|
|
status != '草稿'
|
|
<if test="query.projectNo != null and query.projectNo != ''">
|
|
AND (
|
|
project_no like '%' + #{query.projectNo} + '%'
|
|
OR project_no IN (
|
|
SELECT Value FROM CKT_MES_II_REAL.dbo.SplitString(#{query.projectNo}, ',')
|
|
)
|
|
)
|
|
</if>
|
|
<if test="query.projectDesc != null and query.projectDesc != ''">
|
|
and project_desc like '%' + #{query.projectDesc} + '%'
|
|
</if>
|
|
<if test="query.confirmFlag != null and query.confirmFlag != ''">
|
|
and confirm_flag = #{query.confirmFlag}
|
|
</if>
|
|
<if test="query.testPartNo != null and query.testPartNo != ''">
|
|
AND (
|
|
test_part_no like '%' + #{query.testPartNo} + '%'
|
|
OR test_part_no IN (
|
|
SELECT Value FROM CKT_MES_II_REAL.dbo.SplitString(#{query.testPartNo}, ',')
|
|
)
|
|
)
|
|
</if>
|
|
<if test="query.partDesc != null and query.partDesc != ''">
|
|
and part_desc like '%' + #{query.partDesc} + '%'
|
|
</if>
|
|
<if test="query.customerNo != null and query.customerNo != ''">
|
|
and customer_no like '%' + #{query.customerNo} + '%'
|
|
</if>
|
|
<if test="query.customerDesc != null and query.customerDesc != ''">
|
|
and customer_desc like '%' + #{query.customerDesc} + '%'
|
|
</if>
|
|
<if test="query.buDesc != null and query.buDesc != ''">
|
|
AND dbo.get_bu_desc ( site, bu_no ) = #{query.buDesc}
|
|
</if>
|
|
<if test="query.projectCategory != null and query.projectCategory != ''">
|
|
and project_category = #{query.projectCategory}
|
|
</if>
|
|
<if test="query.status != null and query.status != ''">
|
|
and status = #{query.status}
|
|
</if>
|
|
<if test="query.projectManager != null and query.projectManager != ''">
|
|
and project_manager = #{query.projectManager}
|
|
</if>
|
|
<if test="query.projectOwner != null and query.projectOwner != ''">
|
|
and project_owner = #{query.projectOwner}
|
|
</if>
|
|
<if test="query.engineer != null and query.engineer != ''">
|
|
and engineer = #{query.engineer}
|
|
</if>
|
|
<if test="query.startDate != null ">
|
|
AND build_date >= #{query.startDate}
|
|
</if>
|
|
<if test="query.endDate != null ">
|
|
AND #{query.endDate} >= build_date
|
|
</if>
|
|
</where>
|
|
</select>
|
|
<select id="queryPendingConfirmations" resultType="com.xujie.sys.modules.pms.data.ProjectProductionValidationDocumentData">
|
|
SELECT * FROM view_plm_toproconfirm_list_byUser
|
|
<where>
|
|
status != '草稿' AND RelatedPerson = #{user.userId}
|
|
<if test="params.sql != null and params.sql != ''">
|
|
${params.sql}
|
|
</if>
|
|
</where>
|
|
order by project_id
|
|
</select>
|
|
<select id="queryOverdueConfirmations" resultType="com.xujie.sys.modules.pms.data.ProjectProductionValidationDocumentData">
|
|
<![CDATA[
|
|
SELECT * FROM view_plm_toproconfirm_list_byUser
|
|
WHERE status != '草稿' AND confirm_flag = 'N' AND wanted_confirm_date < GETDATE() AND RelatedPerson = #{userId}
|
|
]]>
|
|
<if test="params.sql != null and params.sql != ''">
|
|
<![CDATA[
|
|
${params.sql}
|
|
]]>
|
|
</if>
|
|
<![CDATA[
|
|
ORDER BY project_id
|
|
]]>
|
|
</select>
|
|
<select id="queryAllConfirmProgressList" resultType="com.xujie.sys.modules.pms.data.ProjectProductionValidationDocumentData">
|
|
SELECT * FROM view_plm_toproconfirm_list_byUser
|
|
<where>
|
|
status != '草稿'
|
|
<if test="params.sql != null and params.sql != ''">
|
|
${params.sql}
|
|
</if>
|
|
</where>
|
|
order by project_id
|
|
</select>
|
|
<select id="getDocumentOwnerEmail">
|
|
SELECT b.username FROM view_plm_toupload_list_byUser as a
|
|
left join sys_user as b on a.RelatedPerson = b.user_id
|
|
WHERE a.project_part_id = #{projectPartId}
|
|
</select>
|
|
<select id="getAllUploadsList" resultType="com.xujie.sys.modules.pms.data.ProofDocumentData">
|
|
SELECT * FROM view_plm_toupload_list_byUser
|
|
order by project_id
|
|
</select>
|
|
<select id="getAllConfirmationsList"
|
|
resultType="com.xujie.sys.modules.pms.data.ProjectProductionValidationDocumentData">
|
|
SELECT * FROM view_plm_toproconfirm_list_byUser
|
|
</select>
|
|
|
|
<!-- 插入文档 -->
|
|
<insert id="insertDocument" parameterType="map">
|
|
INSERT INTO plm_document_list_definition
|
|
(site, proofing_id, test_part_id, project_id, created_by, manual_flag, uploaded_flag, create_date, document_type_id)
|
|
VALUES
|
|
(#{data.site}, #{data.proofingId}, #{data.projectPartId}, #{data.projectId}, #{data.createBy}, 'N', 'N', getDate(), #{documentTypeId})
|
|
</insert>
|
|
|
|
<!-- 插入文档 -->
|
|
<insert id="insertProjectDocument" parameterType="map">
|
|
INSERT INTO plm_document_list_definition
|
|
(site, proofing_id, test_part_id, project_id, created_by, manual_flag, uploaded_flag, create_date, document_type_id)
|
|
VALUES
|
|
(#{data.site}, #{data.proofingId}, #{data.projectPartId}, #{data.projectId}, #{data.createBy}, 'N', 'N', getDate(), #{documentTypeId})
|
|
</insert>
|
|
<insert id="proofingDocumentNEWSave">
|
|
INSERT INTO plm_document_list_definition
|
|
(site,proofing_id, test_part_id, project_id,document_type_id,created_by,manual_flag,uploaded_flag,create_date)
|
|
VALUES
|
|
(#{site},#{proofingId}, #{projectPartId}, #{projectId},#{documentTypeId},#{createBy},'Y','N',GETDATE())
|
|
</insert>
|
|
|
|
<!-- 查询所有打样记录 -->
|
|
<select id="queryAllProofing" resultType="com.xujie.sys.modules.pms.data.ProofDocumentData">
|
|
SELECT b.id as project_id,
|
|
ppp.id AS project_part_id,
|
|
ppp.test_part_no,
|
|
ppp.part_desc,
|
|
b.project_no,
|
|
b.ori_project_id,
|
|
ppp.project_category,
|
|
b.project_name,
|
|
ppp.status,
|
|
b.project_source,
|
|
b.customer_no,
|
|
b.priority,
|
|
ppp.site,
|
|
b.project_desc,
|
|
b.customer_remark,
|
|
ppp.need_date,
|
|
b.bu_no,
|
|
b.parent_project_no,
|
|
b.final_customer_id,
|
|
b.c_project_region,
|
|
ppp.project_manager,
|
|
ppp.project_owner,
|
|
b.c_project_build_date,
|
|
ppp.c_quality_engineer1,
|
|
ppp.c_quality_engineer2,
|
|
ppp.c_quality_engineer3,
|
|
ppp.c_quality_engineer4,
|
|
ppp.c_quality_engineer5,
|
|
ppp.c_quality_engineer6,
|
|
ppp.c_manufacture_engineer,
|
|
ppp.doc_engineer,
|
|
ppp.doc_engineer2,
|
|
ppp.ipqc_hard_tag,
|
|
ppp.c_quality_engineer7,
|
|
ppp.close_date,
|
|
ppp.final_part_no,
|
|
ppp.build_date,
|
|
ppp.engineer,
|
|
ppi.id AS proofing_id,
|
|
ppi.proofing_no,
|
|
ppi.tracker,
|
|
ppi.priority_level,
|
|
ppi.proofing_number,
|
|
ppi.plan_start_date,
|
|
ppi.required_delivery_date,
|
|
ppi.remark,
|
|
ppi.technical_considerations,
|
|
ppi.is_need_to_send_samples,
|
|
ppi.send_samples_address,
|
|
ppi.consignee,
|
|
ppi.consignee_contact,
|
|
ppi.actuality_delivery_date,
|
|
ppi.proofing_result_information,
|
|
ppi.actuality_send_samples_date,
|
|
ppi.send_samples_method,
|
|
ppi.deliver_goods_information,
|
|
ppi.deliver_goods_remark,
|
|
ppi.actuality_reply_date,
|
|
ppi.confirm_results,
|
|
ppi.confirm_by,
|
|
ppi.confirm_information,
|
|
ppi.proofing_status,
|
|
ppi.proofing_result_status,
|
|
ppi.next_to_do,
|
|
ppi.approver,
|
|
ppi.step_id,
|
|
ppi.reject_flag,
|
|
ppi.reject_step_id,
|
|
ppi.c_project_type_db,
|
|
dbo.plm_get_customer_desc(b.site,b.customer_no) as customer_desc,
|
|
dbo.get_bu_desc(b.site,b.bu_no) as bu_desc,
|
|
ppi.create_by,
|
|
ppi.create_date,
|
|
ppi.update_by,
|
|
ppi.update_date,
|
|
ppi.project_phase
|
|
FROM plm_proofing_information as ppi
|
|
left join plm_project_info as b on ppi.project_id = b.id
|
|
left join plm_project_part as ppp on ppi.test_part_id = ppp.id
|
|
<where> ppp.status != '草稿'
|
|
<if test="query.projectNo != null and query.projectNo != ''">
|
|
AND (
|
|
b.project_no like '%' + #{query.projectNo} + '%'
|
|
OR b.project_no IN (
|
|
SELECT Value FROM CKT_MES_II_REAL.dbo.SplitString(#{query.projectNo}, ',')
|
|
)
|
|
)
|
|
</if>
|
|
<if test="query.projectDesc != null and query.projectDesc != ''">
|
|
and b.project_desc like '%' + #{query.projectDesc} + '%'
|
|
</if>
|
|
<if test="query.testPartNo != null and query.testPartNo != ''">
|
|
AND (
|
|
ppp.test_part_no like '%' + #{query.testPartNo} + '%'
|
|
OR ppp.test_part_no IN (
|
|
SELECT Value FROM CKT_MES_II_REAL.dbo.SplitString(#{query.testPartNo}, ',')
|
|
)
|
|
)
|
|
</if>
|
|
<if test="query.partDesc != null and query.partDesc != ''">
|
|
and ppp.part_desc like '%' + #{query.partDesc} + '%'
|
|
</if>
|
|
<if test="query.proofingNo != null and query.proofingNo != ''">
|
|
and ppi.proofing_no like '%' + #{query.proofingNo} + '%'
|
|
</if>
|
|
<if test="query.projectManager != null and query.projectManager != ''">
|
|
and ppp.project_manager = #{query.projectManager}
|
|
</if>
|
|
<if test="query.projectOwner != null and query.projectOwner != ''">
|
|
and ppp.project_owner = #{query.projectOwner}
|
|
</if>
|
|
<if test="query.engineer != null and query.engineer != ''">
|
|
and ppp.engineer = #{query.engineer}
|
|
</if>
|
|
<if test="query.customerNo != null and query.customerNo != ''">
|
|
and b.customer_no like '%' + #{query.customerNo} + '%'
|
|
</if>
|
|
<if test="query.customerDesc != null and query.customerDesc != ''">
|
|
and dbo.plm_get_customer_desc(b.site,b.customer_no) like '%' + #{query.customerDesc} + '%'
|
|
</if>
|
|
<if test="query.buDesc != null and query.buDesc != ''">
|
|
AND dbo.get_bu_desc ( b.site,b.bu_no ) = #{query.buDesc}
|
|
</if>
|
|
<if test="query.cProjectTypeDb != null and query.cProjectTypeDb != ''">
|
|
and ppi.c_project_type_db = #{query.cProjectTypeDb}
|
|
</if>
|
|
<if test="query.status != null and query.status != ''">
|
|
and ppp.status = #{query.status}
|
|
</if>
|
|
<if test="query.startDate != null ">
|
|
AND ppp.build_date >= #{query.startDate}
|
|
</if>
|
|
<if test="query.endDate != null ">
|
|
AND #{query.endDate} >= ppp.build_date
|
|
</if>
|
|
<if test="query.proofingStatus != null and query.proofingStatus != ''">
|
|
and ppi.proofing_status = #{query.proofingStatus}
|
|
</if>
|
|
<if test="query.proofingResultStatus != null and query.proofingResultStatus != ''">
|
|
and ppi.proofing_result_status = #{query.proofingResultStatus}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
<select id="queryAllProofing2" resultType="com.xujie.sys.modules.pms.data.ProofDocumentData">
|
|
SELECT b.id as project_id,
|
|
ppp.id AS project_part_id,
|
|
ppp.test_part_no,
|
|
ppp.part_desc,
|
|
b.project_no,
|
|
b.ori_project_id,
|
|
ppp.project_category,
|
|
b.project_name,
|
|
ppp.status,
|
|
b.project_source,
|
|
b.customer_no,
|
|
b.priority,
|
|
ppp.site,
|
|
b.project_desc,
|
|
b.customer_remark,
|
|
ppp.need_date,
|
|
b.bu_no,
|
|
b.parent_project_no,
|
|
b.final_customer_id,
|
|
b.c_project_region,
|
|
ppp.project_manager,
|
|
ppp.project_owner,
|
|
b.c_project_build_date,
|
|
ppp.c_quality_engineer1,
|
|
ppp.c_quality_engineer2,
|
|
ppp.c_quality_engineer3,
|
|
ppp.c_quality_engineer4,
|
|
ppp.c_quality_engineer5,
|
|
ppp.c_quality_engineer6,
|
|
ppp.c_manufacture_engineer,
|
|
ppp.doc_engineer,
|
|
ppp.doc_engineer2,
|
|
ppp.ipqc_hard_tag,
|
|
ppp.c_quality_engineer7,
|
|
ppp.close_date,
|
|
ppp.final_part_no,
|
|
ppp.build_date,
|
|
ppp.engineer,
|
|
ppi.id AS proofing_id,
|
|
ppi.proofing_no,
|
|
ppi.tracker,
|
|
ppi.priority_level,
|
|
ppi.proofing_number,
|
|
ppi.plan_start_date,
|
|
ppi.required_delivery_date,
|
|
ppi.remark,
|
|
ppi.technical_considerations,
|
|
ppi.is_need_to_send_samples,
|
|
ppi.send_samples_address,
|
|
ppi.consignee,
|
|
ppi.consignee_contact,
|
|
ppi.actuality_delivery_date,
|
|
ppi.proofing_result_information,
|
|
ppi.actuality_send_samples_date,
|
|
ppi.send_samples_method,
|
|
ppi.deliver_goods_information,
|
|
ppi.deliver_goods_remark,
|
|
ppi.actuality_reply_date,
|
|
ppi.confirm_results,
|
|
ppi.confirm_by,
|
|
ppi.confirm_information,
|
|
ppi.proofing_status,
|
|
ppi.proofing_result_status,
|
|
ppi.next_to_do,
|
|
ppi.approver,
|
|
ppi.step_id,
|
|
ppi.reject_flag,
|
|
ppi.reject_step_id,
|
|
ppi.c_project_type_db,
|
|
dbo.plm_get_customer_desc(b.site,b.customer_no) as customer_desc,
|
|
dbo.get_bu_desc(b.site,b.bu_no) as bu_desc,
|
|
ppi.create_by,
|
|
ppi.create_date,
|
|
ppi.update_by,
|
|
ppi.update_date
|
|
FROM plm_proofing_information as ppi
|
|
left join plm_project_info as b on ppi.project_id = b.id
|
|
left join plm_project_part as ppp on ppi.test_part_id = ppp.id
|
|
<where> ppp.status != '草稿'
|
|
<if test="params.sql != null and params.sql != ''">
|
|
${params.sql}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
<select id="queryPlmUser"
|
|
resultType="com.xujie.sys.modules.pms.data.ProofDocumentData">
|
|
Select a.username, a.user_display, a.user_id from sys_user as a left join access_role as b on a.username = b.username where b.role_no = 'R002' and a.site = #{site}
|
|
</select>
|
|
<select id="selecProofingOneByNo" resultType="com.xujie.sys.modules.pms.data.ProofingInformationData">
|
|
SELECT * FROM plm_proofing_information WHERE proofing_no = #{proofingNo}
|
|
</select>
|
|
|
|
<!-- 试验申请单附件同步至打样文档:文档类型为「试验申请单+三方签字」(与前端 document_type + document_desc 展示一致) -->
|
|
<select id="selectDocumentListIdForErfProofCopy" resultType="java.lang.Integer">
|
|
SELECT TOP 1 p.id
|
|
FROM plm_document_list_definition AS p
|
|
INNER JOIN document_type_definition AS dtd
|
|
ON p.document_type_id = dtd.document_type_id AND p.site = dtd.Site
|
|
WHERE p.site = #{site}
|
|
AND p.proofing_id = #{proofingId}
|
|
AND p.project_id = #{projectId}
|
|
AND p.test_part_id = #{projectPartId}
|
|
AND dtd.document_type LIKE N'%试验申请单%'
|
|
AND dtd.document_type LIKE N'%三方签字%'
|
|
</select>
|
|
<select id="getCopyDocumentFileList" resultType="com.xujie.sys.modules.pms.data.ProofDocumentData">
|
|
Select t.site,t.project_id,pi.project_no,pi.project_desc,t.test_part_id,ppp.test_part_no,ppp.part_desc,t.proofing_id,isnull(ppi.proofing_no,'*') as proofing_no,t.id,t.document_type_id,dtd.document_type,dtd.estimated_completion_days,(SELECT role_desc FROM business_role WHERE role_no = dtd.responsible_department AND site = '2') AS responsible_department
|
|
,t.uploaded_flag,d.file_name,d.create_date,d.created_by,d.id as oss_id,d.conclusion,d.url
|
|
from plm_document_list_definition as t
|
|
left join sys_oss as d on convert(varchar(50),t.site)=d.order_ref1
|
|
and convert(varchar(50),t.project_id)=d.order_ref4
|
|
and convert(varchar(50),t.test_part_id)=d.order_ref5
|
|
and convert(varchar(50),t.proofing_id)=d.order_ref2
|
|
and convert(varchar(50),t.id)=d.order_ref3
|
|
and d.order_reftype='项目文档' --固定代码
|
|
LEFT JOIN plm_project_info as pi on t.site = pi.site and t.project_id = pi.id
|
|
LEFT JOIN plm_project_part as ppp on t.test_part_id = ppp.id and t.site = ppp.site
|
|
left join plm_proofing_information as ppi on t.site=ppi.site and t.proofing_id=ppi.id
|
|
,document_type_definition as dtd
|
|
where t.document_type_id=dtd.document_type_id
|
|
and t.uploaded_flag = 'Y'
|
|
AND d.order_reftype = '项目文档'
|
|
and t.site= #{site}
|
|
and t.project_id= #{projectId}
|
|
and t.document_type_id = #{documentTypeId}
|
|
ORDER BY t.test_part_id , t.proofing_id
|
|
</select>
|
|
</mapper>
|