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.
1581 lines
63 KiB
1581 lines
63 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.spring.modules.change.mapper.ChangeManagementMapper">
|
|
|
|
<!-- 技术参数卡列表 -->
|
|
<select id="technicalSpecificationSearch" parameterType="TechnicalSpecificationData" resultType="TechnicalSpecificationData">
|
|
SELECT
|
|
a.site,
|
|
b.bu_no,
|
|
b.final_part_no as partNo,
|
|
b.part_desc,
|
|
a.project_id,
|
|
c.project_name as project_desc,
|
|
c.customer_id,
|
|
j.customer_desc,
|
|
a.code_no,
|
|
a.ori_code_no,
|
|
a.rev_no,
|
|
case when a.ECN_flag = 'Y' then '变更中' else '未发起' end as ecnFlag,
|
|
a.ECN_no,
|
|
a.ECN_address,
|
|
b.test_part_no
|
|
FROM plm_technical_specification_sheet a
|
|
LEFT JOIN plm_project_info c ON a.site = c.site AND a.project_id = c.project_id
|
|
LEFT JOIN plm_customer_information j ON j.site = c.site and j.customer_no = c.customer_id
|
|
left join view_Project_final_Part b on a.site = b.site and a.project_id = b.project_id and a.test_part_no = b.test_part_no
|
|
<where>
|
|
a.site = #{query.site} AND isnull(a.ECN_flag, 'N') = 'N' and a.status = '已完成' and isnull(a.show_in_query_flag, 'Y') = 'Y'
|
|
<if test = "query.buNo != null and query.buNo != ''">
|
|
AND b.bu_no = #{query.buNo}
|
|
</if>
|
|
<if test = "query.testPartNo != null and query.testPartNo != ''">
|
|
AND b.test_part_no like #{query.testPartNo}
|
|
</if>
|
|
<if test = "query.partNo != null and query.partNo != ''">
|
|
AND b.final_part_no like #{query.partNo}
|
|
</if>
|
|
<if test = "query.partDesc != null and query.partDesc != ''">
|
|
AND b.part_desc like #{query.partDesc}
|
|
</if>
|
|
<if test = "query.customerId != null and query.customerId != ''">
|
|
AND c.customer_id like #{query.customerId}
|
|
</if>
|
|
<if test = "query.customerDesc != null and query.customerDesc != ''">
|
|
AND j.customer_desc like #{query.customerDesc}
|
|
</if>
|
|
<if test = "query.projectId != null and query.projectId != ''">
|
|
AND a.project_id like #{query.projectId}
|
|
</if>
|
|
<if test = "query.projectDesc != null and query.projectDesc != ''">
|
|
AND c.project_name like #{query.projectDesc}
|
|
</if>
|
|
<if test = "query.oriCodeNo != null and query.oriCodeNo != ''">
|
|
AND a.ori_code_no like #{query.oriCodeNo}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 技术参数卡列表 -->
|
|
<select id="technicalSpecificationSearch2" parameterType="TechnicalSpecificationData" resultType="TechnicalSpecificationData">
|
|
SELECT
|
|
a.site,
|
|
b.bu_no,
|
|
a.test_part_no as testPartNo,
|
|
b.part_desc,
|
|
a.project_id,
|
|
c.project_name as project_desc,
|
|
c.customer_id,
|
|
j.customer_desc,
|
|
a.code_no,
|
|
a.ori_code_no,
|
|
a.rev_no,
|
|
case when a.ECN_flag = 'Y' then '变更中' else '未发起' end as ecnFlag,
|
|
a.ECN_no,
|
|
a.ECN_address ,
|
|
b.final_part_no as partNo
|
|
FROM plm_technical_specification_sheet a
|
|
LEFT JOIN view_Project_final_Part b ON a.site = b.site AND a.project_id = b.project_id AND a.test_part_no = b.test_part_no
|
|
LEFT JOIN plm_project_info c ON a.site = c.site AND a.project_id = c.project_id
|
|
LEFT JOIN plm_customer_information j ON j.site = c.site and j.customer_no = c.customer_id
|
|
<where>
|
|
a.site = #{site} AND (a.ECN_flag is null or a.ECN_flag = 'N') and a.status = '已完成'
|
|
<if test = "buNo != null and buNo != ''">
|
|
AND b.bu_no = #{buNo}
|
|
</if>
|
|
<if test = "partNo != null and partNo != ''">
|
|
AND b.final_part_no like #{partNo}
|
|
</if>
|
|
<if test = "testPartNo != null and testPartNo != ''">
|
|
AND a.test_part_no like #{testPartNo}
|
|
</if>
|
|
<if test = "partDesc != null and partDesc != ''">
|
|
AND b.part_desc like #{partDesc}
|
|
</if>
|
|
<if test = "customerId != null and customerId != ''">
|
|
AND c.customer_id like #{customerId}
|
|
</if>
|
|
<if test = "customerDesc != null and customerDesc != ''">
|
|
AND j.customer_desc like #{customerDesc}
|
|
</if>
|
|
<if test = "projectId != null and projectId != ''">
|
|
AND a.project_id like #{projectId}
|
|
</if>
|
|
<if test = "projectDesc != null and projectDesc != ''">
|
|
AND c.project_name like #{projectDesc}
|
|
</if>
|
|
<if test = "oriCodeNo != null and oriCodeNo != ''">
|
|
AND a.ori_code_no like #{oriCodeNo}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 根据用户编码获得用户部门 -->
|
|
<select id="getDepartmentByUserName" resultType="com.spring.modules.change.vo.SysUserVo" parameterType="com.spring.modules.change.vo.SysUserVo">
|
|
SELECT
|
|
a.site,
|
|
a.user_id,
|
|
a.username,
|
|
a.password,
|
|
a.salt,
|
|
a.email,
|
|
a.mobile,
|
|
a.status,
|
|
a.create_user_id,
|
|
a.create_time,
|
|
a.language_default,
|
|
a.user_display,
|
|
a.bu_no,
|
|
a.post_no,
|
|
a.department_no,
|
|
b.department_name
|
|
FROM sys_user as a
|
|
LEFT JOIN department as b on a.site = b.site and a.department_no = b.department_no
|
|
WHERE a.site = #{site} and a.username = #{username}
|
|
</select>
|
|
|
|
<!-- 根据变更单号删除文件 -->
|
|
<delete id="deleteChangeFiles" parameterType="ChangeRequestEntity">
|
|
delete from sys_oss
|
|
where order_ref1 = #{site} and order_ref2 = #{changeNo}
|
|
</delete>
|
|
|
|
<!-- 新增变更详情 -->
|
|
<insert id="saveChangeRequestDetail">
|
|
insert into plm_change_request_detail
|
|
(site, change_no, code_no, rev_no, part_no, part_desc, drawing_no, draft_no, new_part_no, new_drawing_no, new_draft_no, create_date, create_by) VALUES
|
|
<foreach collection="list" item="item" index="index" separator=",">
|
|
(#{item.site}, #{item.changeNo}, #{item.codeNo}, #{item.revNo}, #{item.partNo}, #{item.partDesc}, #{item.drawingNo}, #{item.draftNo}, #{item.newPartNo}, #{item.newDrawingNo}, #{item.newDraftNo}, getDate(), #{item.createBy})
|
|
</foreach>
|
|
</insert>
|
|
|
|
<!-- 修改技术参数卡的ECN状态 -->
|
|
<update id="updateTechnicalSpecificationSheet">
|
|
update plm_technical_specification_sheet
|
|
set ECN_flag = 'Y',
|
|
ECN_no = #{changeNo},
|
|
update_date = getDate(),
|
|
update_by = #{createBy}
|
|
where site = #{site}
|
|
AND code_no in (
|
|
<foreach collection="ids" item="item" separator=",">
|
|
#{item}
|
|
</foreach>
|
|
)
|
|
</update>
|
|
|
|
<!-- =============================================================================================================== -->
|
|
|
|
<!-- 工程变更记录列表 -->
|
|
<select id="changeRecordSearch" parameterType="com.spring.modules.change.vo.ChangeRequestVo" resultType="com.spring.modules.change.vo.ChangeRequestVo">
|
|
SELECT
|
|
a.site,
|
|
a.bu_no,
|
|
a.change_no,
|
|
a.applicant_id,
|
|
dbo.get_userDisPlay(a.applicant_id) as applicantName,
|
|
b.department_no as applicationDepartmentId,
|
|
dbo.get_department_name(a.site, b.department_no) as applicationDepartmentName,
|
|
a.apply_date,
|
|
a.ecn_type,
|
|
a.change_impact,
|
|
a.change_impact_desc,
|
|
a.ecn_stage,
|
|
a.change_type,
|
|
a.tp_engineer_id,
|
|
dbo.get_userDisPlay(a.tp_engineer_id) as tpEngineerName,
|
|
a.change_phase_in_date,
|
|
a.df_is_product,
|
|
a.printing,
|
|
a.manufacturing_cost_is_change,
|
|
a.change_request_desc,
|
|
a.is_re_quote,
|
|
a.ul_certification_requirements,
|
|
a.ul_continue_to_meet_demand,
|
|
a.gp_certification_requirements,
|
|
a.gp_continue_to_meet_demand,
|
|
a.create_date,
|
|
a.create_by,
|
|
a.update_date,
|
|
a.update_by,
|
|
a.industrial_engineer_id,
|
|
dbo.get_userDisPlay(a.industrial_engineer_id) as industrialEngineerName,
|
|
a.change_status,
|
|
a.cqc_operator_id,
|
|
dbo.get_userDisPlay(a.cqc_operator_id) as cqcOperatorName,
|
|
a.fai_operator_id,
|
|
dbo.get_userDisPlay(a.fai_operator_id) as faiOperatorName,
|
|
a.step_id,
|
|
a.reject_flag,
|
|
a.reject_step_id,
|
|
d.is_reject,
|
|
d.node_id,
|
|
d.node_name,
|
|
dbo.get_plm_Approval_username(a.site, prh.workflow_id, d.node_id, a.change_no) as createBy2,
|
|
dbo.get_process_control(a.site, prh.workflow_id, d.node_id, 4) as tpProcessControl,
|
|
dbo.get_process_control(a.site, prh.workflow_id, d.node_id, 5) as csProcessControl
|
|
FROM plm_change_request a
|
|
LEFT JOIN sys_user as b on a.site = b.site and a.applicant_id = b.username
|
|
left join plm_request_header as prh on a.site = prh.site and prh.menu_id = #{query.menuId}
|
|
left join plm_request_node as d on a.site = d.site and prh.classification_no = d.classification_no and prh.workflow_id = d.workflow_id and a.step_id = d.step_id
|
|
<where>
|
|
a.site = #{query.site} and a.show_in_query_flag = 'Y'
|
|
<if test = "query.buNo != null and query.buNo != ''">
|
|
AND a.bu_no = #{query.buNo}
|
|
</if>
|
|
<if test = "query.changeNo != null and query.changeNo != ''">
|
|
AND a.change_no like #{query.changeNo}
|
|
</if>
|
|
<if test = "query.changeStatus != null and query.changeStatus != ''">
|
|
AND a.change_status = #{query.changeStatus}
|
|
</if>
|
|
<if test="query.nodeId != null and query.nodeId != ''">
|
|
AND d.node_id = #{query.nodeId}
|
|
</if>
|
|
<if test="query.createBy2 != null and query.createBy2 != ''">
|
|
AND dbo.get_plm_Approval_username(a.site, prh.workflow_id, d.node_id, a.change_no) like #{query.createBy2}
|
|
</if>
|
|
</where>
|
|
order by a.change_no desc
|
|
</select>
|
|
|
|
<!-- 变更单详情的列表 -->
|
|
<select id="changeDetailSearch" parameterType="com.spring.modules.change.vo.ChangeRequestDetailVo" resultType="com.spring.modules.change.vo.ChangeRequestDetailVo">
|
|
SELECT
|
|
a.site,
|
|
a.change_no,
|
|
a.code_no,
|
|
a.rev_no,
|
|
a.part_no,
|
|
a.part_desc,
|
|
a.drawing_no,
|
|
a.draft_no,
|
|
a.new_part_no,
|
|
a.new_drawing_no,
|
|
a.new_draft_no,
|
|
a.create_date,
|
|
a.create_by,
|
|
a.update_date,
|
|
a.update_by,
|
|
b.ori_code_no,
|
|
p.plm_part_no
|
|
FROM plm_change_request_detail a
|
|
left join plm_technical_specification_sheet as b on a.site = b.site and a.code_no = b.code_no
|
|
left join part as p on a.site = p.site and a.part_no = p.ifs_part_no and p.show_in_query_flag = 'Y'
|
|
where a.site = #{site} and a.change_no = #{changeNo}
|
|
</select>
|
|
|
|
<!-- 查询库存成本影响 -->
|
|
<select id="costImpactSearch" parameterType="ChangeRequestEntity" resultType="com.spring.modules.change.vo.ChangeCostImpactVo">
|
|
SELECT
|
|
site,
|
|
change_no,
|
|
production_product_flag,
|
|
inventory_product_flag,
|
|
new_order_flag,
|
|
affected_flag,
|
|
production_product_number,
|
|
production_product_opinions,
|
|
production_product_scrap_amount,
|
|
production_product_remark,
|
|
production_product_executor,
|
|
dbo.plm_get_user_display(site, production_product_executor) as productionProductExecutorName,
|
|
inventory_product_number,
|
|
inventory_product_opinions,
|
|
inventory_product_scrap_amount,
|
|
inventory_product_remark,
|
|
inventory_product_executor,
|
|
dbo.plm_get_user_display(site, inventory_product_executor) as inventoryProductExecutorName,
|
|
new_order_number,
|
|
affected_number,
|
|
affected_opinions,
|
|
affected_scrap_amount,
|
|
affected_remark,
|
|
affected_executor,
|
|
dbo.plm_get_user_display(site, affected_executor) as affectedExecutorName,
|
|
change_total_cost,
|
|
remark,
|
|
create_date,
|
|
create_by,
|
|
update_date,
|
|
update_by
|
|
FROM plm_change_cost_impact
|
|
where site = #{site} and change_no = #{changeNo}
|
|
</select>
|
|
|
|
<!-- 库存成本影响新增 -->
|
|
<insert id="costImpactSave" parameterType="ChangeCostImpactEntity">
|
|
INSERT INTO plm_change_cost_impact
|
|
(site, change_no, production_product_flag, inventory_product_flag, new_order_flag, affected_flag, production_product_number, production_product_opinions,
|
|
production_product_remark, production_product_executor, inventory_product_number, inventory_product_opinions, inventory_product_remark, inventory_product_executor,
|
|
new_order_number, affected_number, affected_opinions, affected_remark, affected_executor, change_total_cost, remark, create_date, create_by,
|
|
production_product_scrap_amount, inventory_product_scrap_amount, affected_scrap_amount)
|
|
VALUES
|
|
(#{site}, #{changeNo}, #{productionProductFlag}, #{inventoryProductFlag}, #{newOrderFlag}, #{affectedFlag}, #{productionProductNumber}, #{productionProductOpinions},
|
|
#{productionProductRemark}, #{productionProductExecutor}, #{inventoryProductNumber}, #{inventoryProductOpinions}, #{inventoryProductRemark}, #{inventoryProductExecutor},
|
|
#{newOrderNumber}, #{affectedNumber}, #{affectedOpinions}, #{affectedRemark}, #{affectedExecutor}, #{changeTotalCost}, #{remark}, getDate(), #{createBy},
|
|
#{productionProductScrapAmount}, #{inventoryProductScrapAmount}, #{affectedScrapAmount})
|
|
</insert>
|
|
|
|
<!-- 查询执行信息 -->
|
|
<select id="queryChangeExecutionInfo" parameterType="com.spring.modules.change.vo.ChangeExecutionInfoVo" resultType="ChangeExecutionInfoEntity">
|
|
SELECT
|
|
site,
|
|
change_no,
|
|
original_film_no,
|
|
new_film_no,
|
|
original_die_cutting_rule_no,
|
|
new_die_cutting_rule_no,
|
|
original_stencil_no,
|
|
new_stencil_no,
|
|
execution_date,
|
|
create_date,
|
|
create_by,
|
|
update_date,
|
|
update_by
|
|
FROM plm_change_execution_info
|
|
where site = #{site} and change_no = #{changeNo}
|
|
</select>
|
|
|
|
<!-- 执行信息新增 -->
|
|
<insert id="executionSave" parameterType="com.spring.modules.change.vo.ChangeExecutionInfoVo">
|
|
INSERT INTO plm_change_execution_info
|
|
(site, change_no, original_film_no, new_film_no, original_die_cutting_rule_no, new_die_cutting_rule_no, original_stencil_no, new_stencil_no, execution_date, create_date, create_by)
|
|
VALUES
|
|
(#{site}, #{changeNo}, #{originalFilmNo}, #{newFilmNo}, #{originalDieCuttingRuleNo}, #{newDieCuttingRuleNo}, #{originalStencilNo}, #{newStencilNo}, #{executionDate}, getDate(), #{createBy})
|
|
</insert>
|
|
|
|
<!-- 判断所选技术参数卡状态 -->
|
|
<select id="queryTechnicalSpecificationSheet" resultType="TechnicalSpecificationData">
|
|
SELECT
|
|
site,
|
|
code_no,
|
|
ECN_flag,
|
|
ECN_no
|
|
FROM plm_technical_specification_sheet
|
|
where site = #{site}
|
|
AND code_no in (
|
|
<foreach collection="ids" item="item" separator=",">
|
|
#{item}
|
|
</foreach>
|
|
)
|
|
</select>
|
|
|
|
<!-- 编辑库存成本影响 -->
|
|
<update id="costImpactUpdate" parameterType="ChangeCostImpactEntity">
|
|
update plm_change_cost_impact
|
|
set production_product_flag = #{productionProductFlag},
|
|
inventory_product_flag = #{inventoryProductFlag},
|
|
new_order_flag = #{newOrderFlag},
|
|
affected_flag = #{affectedFlag},
|
|
production_product_number = #{productionProductNumber},
|
|
production_product_opinions = #{productionProductOpinions},
|
|
production_product_remark = #{productionProductRemark},
|
|
production_product_executor = #{productionProductExecutor},
|
|
inventory_product_number = #{inventoryProductNumber},
|
|
inventory_product_opinions = #{inventoryProductOpinions},
|
|
inventory_product_remark = #{inventoryProductRemark},
|
|
inventory_product_executor = #{inventoryProductExecutor},
|
|
new_order_number = #{newOrderNumber},
|
|
affected_number = #{affectedNumber},
|
|
affected_opinions = #{affectedOpinions},
|
|
affected_remark = #{affectedRemark},
|
|
affected_executor = #{affectedExecutor},
|
|
change_total_cost = #{changeTotalCost},
|
|
remark = #{remark},
|
|
update_date = getDate(),
|
|
update_by = #{createBy},
|
|
production_product_scrap_amount = #{productionProductScrapAmount},
|
|
inventory_product_scrap_amount = #{inventoryProductScrapAmount},
|
|
affected_scrap_amount = #{affectedScrapAmount}
|
|
where site = #{site} and change_no = #{changeNo}
|
|
</update>
|
|
|
|
<!-- 查询ECN种类数据 -->
|
|
<select id="getEcnTypeHeader" parameterType="EcnTypeHeaderData" resultType="EcnTypeHeaderData">
|
|
SELECT
|
|
site,
|
|
dict_id,
|
|
dict_name,
|
|
dict_type as value
|
|
FROM sys_dict_type
|
|
where site = #{site} and dict_type like 'change_ecn_type_%' and status = 'Y'
|
|
</select>
|
|
|
|
<!-- 查询ECN种类数据 -->
|
|
<select id="getEcnTypeDetail" parameterType="EcnTypeHeaderData" resultType="EcnTypeDetailData">
|
|
SELECT
|
|
site,
|
|
dict_value as value
|
|
FROM sys_dict_data
|
|
where site = #{site} and dict_type = #{value} and status = 'Y'
|
|
</select>
|
|
|
|
<!-- 新增ECN种类header -->
|
|
<insert id="saveEcnTypeHeader">
|
|
insert into plm_change_ecn_type_header
|
|
(site, change_no, header_value, flag) VALUES
|
|
<foreach collection="list" item="item" index="index" separator=",">
|
|
(#{item.site}, #{item.changeNo}, #{item.value}, #{item.flag})
|
|
</foreach>
|
|
</insert>
|
|
|
|
<!-- 新增ECN种类detail -->
|
|
<insert id="saveEcnTypeDetail">
|
|
insert into plm_change_ecn_type_detail
|
|
(site, change_no, header_value, value, flag) VALUES
|
|
<foreach collection="list" item="item" index="index" separator=",">
|
|
(#{item.site}, #{item.changeNo}, #{item.headerValue}, #{item.value}, #{item.flag})
|
|
</foreach>
|
|
</insert>
|
|
|
|
<!-- 查询ECN的模板 -->
|
|
<select id="getEcnModel" parameterType="PlmPropertiesModelHeaderData" resultType="PlmPropertiesModelHeaderData">
|
|
SELECT
|
|
site,
|
|
function_type,
|
|
code_no,
|
|
code_desc
|
|
FROM plm_properties_model_header
|
|
<where>
|
|
site = #{site} and function_type = #{functionType} and code_no = #{codeNo}
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 查询模板属性 -->
|
|
<select id="getItemList" parameterType="PlmPropertiesModelHeaderData" resultType="ChangeItemData">
|
|
SELECT
|
|
a.site,
|
|
a.properties_item_no as itemNo,
|
|
b.ItemDesc as itemDesc,
|
|
a.code_no,
|
|
b.ValueChooseFlag,
|
|
a.function_type
|
|
FROM plm_properties_model_detail as a
|
|
left join plm_properties_item as b on a.site = b.site and a.properties_item_no = b.ItemNo and a.function_type = b.ItemType
|
|
<where>
|
|
a.site = #{site} and a.function_type = #{functionType} and a.code_no = #{codeNo}
|
|
<if test="itemNo != null and itemNo != ''">
|
|
AND a.properties_item_no like #{itemNo}
|
|
</if>
|
|
<if test="itemDesc != null and itemDesc != ''">
|
|
AND b.ItemDesc like #{itemDesc}
|
|
</if>
|
|
</where>
|
|
</select>
|
|
|
|
<!-- 获取属性可选值 -->
|
|
<select id="getAvailableValueList" parameterType="ChangeItemData" resultType="PlmPropertiesItemAvailableData">
|
|
select
|
|
ItemNo,
|
|
ValueNo,
|
|
AvailableValue
|
|
from plm_properties_item_available
|
|
where itemNo = #{itemNo} and site = #{site} and ItemType = #{functionType}
|
|
</select>
|
|
|
|
<!-- 获取属性可选值 -->
|
|
<select id="getAvailableValueList2" parameterType="ChangeItemEntity" resultType="PlmPropertiesItemAvailableData">
|
|
select
|
|
ItemNo,
|
|
ValueNo,
|
|
AvailableValue
|
|
from plm_properties_item_available
|
|
where itemNo = #{itemNo} and site = #{site} and ItemType = 'ECN'
|
|
</select>
|
|
|
|
<!-- 新增变更单属性 -->
|
|
<insert id="chooseItemSave">
|
|
insert into plm_change_item
|
|
(site, change_no, item_no, item_desc, execute_flag, executor, item_execution_date, item_remark, create_date, create_by, code_no) VALUES
|
|
<foreach collection="list" item="item" index="index" separator=",">
|
|
(#{item.site}, #{item.changeNo}, #{item.itemNo}, #{item.itemDesc}, #{item.executeFlag}, #{item.executor}, #{item.itemExecutionDate,jdbcType=TIMESTAMP}, #{item.itemRemark}, getDate(), #{item.createBy}, #{item.codeNo})
|
|
</foreach>
|
|
</insert>
|
|
|
|
<!-- 新增可行性属性 -->
|
|
<insert id="chooseItemSave2">
|
|
insert into plm_change_FA_item
|
|
(site, change_no, item_no, item_desc, execute_flag, executor, item_execution_date, item_remark, create_date, create_by, code_no, choose_value) VALUES
|
|
<foreach collection="list" item="item" index="index" separator=",">
|
|
(#{item.site}, #{item.changeNo}, #{item.itemNo}, #{item.itemDesc}, #{item.executeFlag}, #{item.executor}, #{item.itemExecutionDate,jdbcType=TIMESTAMP}, #{item.itemRemark}, getDate(), #{item.createBy}, #{item.codeNo}, #{item.chooseValue})
|
|
</foreach>
|
|
</insert>
|
|
|
|
|
|
<!-- 查询执行对象 -->
|
|
<select id="executionInfoSearch" parameterType="ChangeRequestEntity" resultType="ChangeExecutionInfoEntity">
|
|
SELECT
|
|
site,
|
|
change_no,
|
|
original_film_no,
|
|
new_film_no,
|
|
original_die_cutting_rule_no,
|
|
new_die_cutting_rule_no,
|
|
original_stencil_no,
|
|
new_stencil_no,
|
|
execution_date,
|
|
create_date,
|
|
create_by,
|
|
update_date,
|
|
update_by
|
|
FROM plm_change_execution_info
|
|
where site = #{site} and change_no = #{changeNo}
|
|
</select>
|
|
|
|
<!-- 查询变更单属性 -->
|
|
<select id="changeItemSearch" parameterType="ChangeRequestEntity" resultType="ChangeItemEntity">
|
|
SELECT
|
|
site,
|
|
change_no,
|
|
item_no,
|
|
item_desc,
|
|
execute_flag,
|
|
executor,
|
|
item_execution_date,
|
|
item_remark,
|
|
create_date,
|
|
create_by,
|
|
update_date,
|
|
update_by,
|
|
code_no
|
|
FROM plm_change_item
|
|
where site = #{site} and change_no = #{changeNo}
|
|
</select>
|
|
|
|
<!-- 查询变更单属性 -->
|
|
<select id="changeItemSearch2" parameterType="ChangeRequestEntity" resultType="ChangeItemEntity">
|
|
SELECT
|
|
a.site,
|
|
a.change_no,
|
|
a.item_no,
|
|
a.item_desc,
|
|
a.execute_flag,
|
|
a.executor,
|
|
a.item_execution_date,
|
|
a.item_remark,
|
|
a.create_date,
|
|
a.create_by,
|
|
a.update_date,
|
|
a.update_by,
|
|
a.code_no,
|
|
a.choose_value,
|
|
b.ValueChooseFlag
|
|
FROM plm_change_FA_item as a
|
|
left join plm_properties_item as b on a.site = b.site and a.item_no = b.ItemNo and b.ItemType = 'ECN'
|
|
where a.site = #{site} and a.change_no = #{changeNo}
|
|
</select>
|
|
|
|
<!-- 查询变更单会签属性 -->
|
|
<select id="changeCSItemSearch" parameterType="ChangeRequestEntity" resultType="ChangeCountersignatureItemEntity">
|
|
SELECT
|
|
site,
|
|
change_no,
|
|
item_no,
|
|
item_desc,
|
|
execute_flag,
|
|
executor,
|
|
item_execution_date,
|
|
item_remark,
|
|
create_date,
|
|
create_by,
|
|
update_date,
|
|
update_by,
|
|
code_no
|
|
FROM plm_change_countersignature_item
|
|
where site = #{site} and change_no = #{changeNo}
|
|
</select>
|
|
|
|
<!-- 查询变更明细 -->
|
|
<select id="requestDetailSearch" parameterType="ChangeRequestEntity" resultType="ChangeRequestDetailEntity">
|
|
SELECT
|
|
a.site,
|
|
a.change_no,
|
|
a.code_no,
|
|
a.rev_no,
|
|
a.part_no,
|
|
a.part_desc,
|
|
a.drawing_no,
|
|
a.draft_no,
|
|
a.new_part_no,
|
|
a.new_drawing_no,
|
|
a.new_draft_no,
|
|
a.create_date,
|
|
a.create_by,
|
|
a.update_date,
|
|
a.update_by,
|
|
b.plm_part_no,
|
|
b.ifs_part_no
|
|
FROM plm_change_request_detail as a
|
|
left join part as b on a.site = b.site and a.part_no = b.ifs_part_no and b.show_in_query_flag ='Y'
|
|
where a.site = #{site} and a.change_no = #{changeNo}
|
|
</select>
|
|
|
|
<!-- 删除变更明细 -->
|
|
<delete id="deleteChangeDetail" parameterType="ChangeRequestDetailEntity">
|
|
delete from plm_change_request_detail
|
|
where site = #{site} and change_no = #{changeNo} and code_no = #{codeNo}
|
|
</delete>
|
|
|
|
<!-- 查询所选ECN种类Header -->
|
|
<select id="getChooseEcnTypeHeader" parameterType="ChangeRequestEntity" resultType="EcnTypeHeaderData">
|
|
SELECT
|
|
site,
|
|
change_no,
|
|
header_value as value,
|
|
flag
|
|
FROM plm_change_ecn_type_header
|
|
where site = #{site} and change_no = #{changeNo}
|
|
</select>
|
|
|
|
<!-- 查询所选ECN种类Detail -->
|
|
<select id="getChooseEcnTypeDetail" parameterType="EcnTypeHeaderData" resultType="EcnTypeDetailData">
|
|
SELECT
|
|
site,
|
|
change_no,
|
|
header_value,
|
|
value,
|
|
flag
|
|
FROM plm_change_ecn_type_detail
|
|
where site = #{site} and change_no = #{changeNo} and header_value = #{value}
|
|
</select>
|
|
|
|
<!-- 删除变更明细 -->
|
|
<delete id="deleteChangeDetails" parameterType="com.spring.modules.change.vo.ChangeRequestVo">
|
|
delete from plm_change_request_detail
|
|
where site = #{site} and change_no = #{changeNo}
|
|
</delete>
|
|
|
|
<!-- 删除种类Header -->
|
|
<delete id="deleteEcnTypeHeaderByChangeNo" parameterType="com.spring.modules.change.vo.ChangeRequestVo">
|
|
delete from plm_change_ecn_type_header
|
|
where site = #{site} and change_no = #{changeNo}
|
|
</delete>
|
|
|
|
<!-- 删除种类Detail -->
|
|
<delete id="deleteEcnTypeDetailByChangeNo" parameterType="com.spring.modules.change.vo.ChangeRequestVo">
|
|
delete from plm_change_ecn_type_detail
|
|
where site = #{site} and change_no = #{changeNo}
|
|
</delete>
|
|
|
|
<!-- 查询工程变更记录 -->
|
|
<select id="selectChangeRequest" parameterType="com.spring.modules.change.vo.ChangeRequestVo" resultType="com.spring.modules.change.vo.ChangeRequestVo">
|
|
SELECT
|
|
a.site,
|
|
a.bu_no,
|
|
a.change_no,
|
|
a.applicant_id,
|
|
dbo.get_userDisPlay(a.applicant_id) as applicantName,
|
|
b.department_no as applicationDepartmentId,
|
|
dbo.get_department_name(a.site, b.department_no) as applicationDepartmentName,
|
|
a.apply_date,
|
|
a.ecn_type,
|
|
a.change_impact,
|
|
a.change_impact_desc,
|
|
a.ecn_stage,
|
|
a.change_type,
|
|
a.tp_engineer_id,
|
|
dbo.get_userDisPlay(a.tp_engineer_id) as tpEngineerName,
|
|
a.change_phase_in_date,
|
|
a.df_is_product,
|
|
a.printing,
|
|
a.manufacturing_cost_is_change,
|
|
a.change_request_desc,
|
|
a.is_re_quote,
|
|
a.ul_certification_requirements,
|
|
a.ul_continue_to_meet_demand,
|
|
a.gp_certification_requirements,
|
|
a.gp_continue_to_meet_demand,
|
|
a.create_date,
|
|
a.create_by,
|
|
a.update_date,
|
|
a.update_by,
|
|
a.industrial_engineer_id,
|
|
dbo.get_userDisPlay(a.industrial_engineer_id) as industrialEngineerName,
|
|
a.change_status,
|
|
a.cqc_operator_id,
|
|
dbo.get_userDisPlay(a.cqc_operator_id) as cqcOperatorName,
|
|
a.fai_operator_id,
|
|
dbo.get_userDisPlay(a.fai_operator_id) as faiOperatorName,
|
|
a.step_id,
|
|
a.reject_flag,
|
|
a.reject_step_id,
|
|
d.is_Reject,
|
|
d.node_id,
|
|
d.node_name,
|
|
dbo.get_plm_Approval_username(a.site, prh.workflow_id, d.node_id, a.change_no) as createBy2,
|
|
dbo.get_process_control(a.site, prh.workflow_id, d.node_id, 4) as tpProcessControl,
|
|
dbo.get_process_control(a.site, prh.workflow_id, d.node_id, 5) as csProcessControl,
|
|
a.show_in_query_flag
|
|
FROM plm_change_request a
|
|
LEFT JOIN sys_user as b on a.site = b.site and a.applicant_id = b.username
|
|
left join plm_request_header as prh on a.site = prh.site and prh.menu_id = #{menuId}
|
|
left join plm_request_node as d on a.site = d.site and prh.classification_no = d.classification_no and prh.workflow_id = d.workflow_id and a.step_id = d.step_id
|
|
where a.site = #{site} and a.change_no = #{changeNo}
|
|
</select>
|
|
|
|
<!-- 编辑库存成本影响 -->
|
|
<update id="executionUpdate" parameterType="com.spring.modules.change.vo.ChangeExecutionInfoVo">
|
|
update plm_change_execution_info
|
|
set original_film_no = #{originalFilmNo},
|
|
new_film_no = #{newFilmNo},
|
|
original_die_cutting_rule_no = #{originalDieCuttingRuleNo},
|
|
new_die_cutting_rule_no = #{newDieCuttingRuleNo},
|
|
original_stencil_no = #{originalStencilNo},
|
|
new_stencil_no = #{newStencilNo},
|
|
execution_date = #{executionDate},
|
|
update_date = getDate(),
|
|
update_by = #{createBy}
|
|
where site = #{site} and change_no = #{changeNo}
|
|
</update>
|
|
|
|
<!-- 编辑变更单属性 -->
|
|
<update id="chooseItemUpdate" parameterType="ChangeItemEntity">
|
|
update plm_change_item
|
|
set execute_flag = #{executeFlag},
|
|
executor = #{executor},
|
|
item_execution_date = #{itemExecutionDate},
|
|
item_remark = #{itemRemark},
|
|
update_date = getDate(),
|
|
update_by = #{createBy}
|
|
where site = #{site} and change_no = #{changeNo} and item_no = #{itemNo}
|
|
</update>
|
|
|
|
<!-- 编辑变更单属性 -->
|
|
<update id="chooseItemUpdate2" parameterType="ChangeItemEntity">
|
|
update plm_change_FA_item
|
|
set execute_flag = #{executeFlag},
|
|
executor = #{executor},
|
|
item_execution_date = #{itemExecutionDate},
|
|
item_remark = #{itemRemark},
|
|
update_date = getDate(),
|
|
update_by = #{createBy},
|
|
choose_value = #{chooseValue}
|
|
where site = #{site} and change_no = #{changeNo} and item_no = #{itemNo}
|
|
</update>
|
|
|
|
<!-- 编辑变更单属性 -->
|
|
<update id="chooseCSItemUpdate" parameterType="ChangeCountersignatureItemEntity">
|
|
update plm_change_countersignature_item
|
|
set execute_flag = #{executeFlag},
|
|
executor = #{executor},
|
|
item_execution_date = #{itemExecutionDate},
|
|
item_remark = #{itemRemark},
|
|
update_date = getDate(),
|
|
update_by = #{createBy}
|
|
where site = #{site} and change_no = #{changeNo} and item_no = #{itemNo}
|
|
</update>
|
|
|
|
<!-- 新增会签属性 -->
|
|
<insert id="chooseCSItemSave">
|
|
insert into plm_change_countersignature_item
|
|
(site, change_no, item_no, item_desc, execute_flag, executor, item_execution_date, item_remark, create_date, create_by, code_no) VALUES
|
|
<foreach collection="list" item="item" index="index" separator=",">
|
|
(#{item.site}, #{item.changeNo}, #{item.itemNo}, #{item.itemDesc}, #{item.executeFlag}, #{item.executor}, #{item.itemExecutionDate,jdbcType=TIMESTAMP}, #{item.itemRemark}, getDate(), #{item.createBy}, #{item.codeNo})
|
|
</foreach>
|
|
</insert>
|
|
|
|
<select id="queryRequestHeader" parameterType="string" resultType="com.spring.modules.request.vo.PlmRequestHeaderVo">
|
|
SELECT
|
|
a.site,
|
|
a.bu,
|
|
a.classification_no,
|
|
a.classification_name,
|
|
a.menu_id,
|
|
a.workflow_id,
|
|
b.workflowname,
|
|
a.status,
|
|
a.remark,
|
|
a.create_by,
|
|
a.create_date,
|
|
a.update_by,
|
|
a.update_date,
|
|
c.url,
|
|
c.name
|
|
FROM plm_request_header a
|
|
LEFT JOIN [VIEW_Process_management_OA_PLM] b ON a.workflow_id = b.workflowid
|
|
left join sys_menu as c on a.menu_id = c.menu_id
|
|
WHERE a.site = #{site} and a.menu_id = #{menuId} and a.status = 'Y'
|
|
</select>
|
|
|
|
<select id="queryNodeDetailFirst" parameterType="string" resultType="com.spring.modules.request.vo.PlmRequestDetailVo">
|
|
SELECT
|
|
a.id,
|
|
a.site,
|
|
a.bu,
|
|
a.classification_no,
|
|
b.node_id,
|
|
a.node_name,
|
|
a.create_date,
|
|
a.create_by,
|
|
a.update_date,
|
|
a.update_by,
|
|
a.remark,
|
|
a.plm_field,
|
|
a.oa_field,
|
|
a.field_value,
|
|
a.order_ref1,
|
|
a.order_ref2,
|
|
a.order_ref3,
|
|
a.order_ref4,
|
|
a.field_desc,
|
|
a.workflow_id,
|
|
a.plm_table,
|
|
a.field_type,
|
|
b.step_id,
|
|
a.review
|
|
FROM plm_request_header as c
|
|
left join plm_request_node as b on c.site = b.site and c.bu = b.bu and c.classification_no = b.classification_no
|
|
LEFT JOIN plm_request_node_detail as a on a.site = b.site and a.classification_no = b.classification_no and a.node_id = b.node_id
|
|
WHERE b.site = #{site} and b.workflow_id = #{workflowId} and c.menu_id = #{menuId}
|
|
and b.node_id = (select top 1 node_id from plm_request_node where site = #{site} and workflow_id = #{workflowId} order by seq_no)
|
|
</select>
|
|
|
|
<select id="getSeqNo" parameterType="ProcessFormEntity" resultType="int">
|
|
SELECT
|
|
case when max(seq_no) is null THEN 1 ELSE max(seq_no) + 1 end
|
|
FROM plm_process_form
|
|
WHERE site = #{site} and bu = #{bu} and request_id = #{requestId} and ISNULL(process_intervention_flag ,' ') <![CDATA[<>]]> 'Y'
|
|
</select>
|
|
|
|
<insert id="saveProcessForm" parameterType="ProcessFormEntity">
|
|
INSERT INTO plm_process_form
|
|
(site, bu, request_id, workflow_id, node_id, domain_control_account, document_no, document_type, seq_no, reject_flag, reject_node_id, node_conclusion, submit_date, submitted_by, create_date, create_by, is_remark, classification_no, step_id, menu_id, process_intervention_flag)
|
|
VALUES
|
|
(#{site}, #{bu}, #{requestId}, #{workflowId}, #{nodeId}, #{domainControlAccount}, #{documentNo}, #{documentType}, #{seqNo}, #{rejectFlag}, #{rejectNodeId}, #{nodeConclusion}, #{submitDate}, #{submittedBy}, getDate(), #{createBy}, #{isRemark}, #{classificationNo}, #{stepId}, #{menuId}, #{processInterventionFlag})
|
|
</insert>
|
|
|
|
<!-- 编辑变更单属性 -->
|
|
<update id="updateChangeStatus" parameterType="com.spring.modules.change.vo.ChangeRequestVo">
|
|
update plm_change_request
|
|
set change_status = #{changeStatus},
|
|
update_date = getDate(),
|
|
update_by = #{userName}
|
|
where site = #{site} and change_no = #{changeNo}
|
|
</update>
|
|
|
|
<select id="queryRequestId" parameterType="string" resultType="ProcessFormEntity">
|
|
SELECT
|
|
a.id,
|
|
a.site,
|
|
a.bu,
|
|
a.request_id,
|
|
a.workflow_id,
|
|
b.workflowname,
|
|
a.node_id,
|
|
a.domain_control_account,
|
|
a.document_no,
|
|
a.document_type,
|
|
a.seq_no,
|
|
a.reject_flag,
|
|
a.reject_node_id,
|
|
a.node_conclusion,
|
|
a.submit_date,
|
|
a.submitted_by,
|
|
a.is_remark,
|
|
a.classification_no,
|
|
a.menu_id,
|
|
c.url,
|
|
b.nodename as nodeName,
|
|
c.name
|
|
FROM plm_process_form as a
|
|
LEFT JOIN [VIEW_Process_management_OA_PLM] as b ON a.workflow_id = b.workflowid and a.node_id = b.nodeid
|
|
left join sys_menu as c on a.menu_id = c.menu_id
|
|
WHERE a.site = #{site} and a.bu = #{bu} and a.document_no = #{documentNo} and a.is_remark = 0 and ISNULL(a.process_intervention_flag ,' ') <![CDATA[<>]]> 'Y'
|
|
</select>
|
|
|
|
<select id="queryNodeDetails" resultType="com.spring.modules.request.vo.PlmRequestDetailVo">
|
|
SELECT
|
|
id,
|
|
site,
|
|
bu,
|
|
classification_no,
|
|
node_id,
|
|
node_name,
|
|
create_date,
|
|
create_by,
|
|
update_date,
|
|
update_by,
|
|
remark,
|
|
plm_field,
|
|
oa_field,
|
|
field_value,
|
|
order_ref1,
|
|
order_ref2,
|
|
order_ref3,
|
|
order_ref4,
|
|
field_desc,
|
|
workflow_id,
|
|
plm_table,
|
|
field_type,
|
|
review
|
|
FROM plm_request_node_detail
|
|
WHERE site = #{site} and workflow_id = #{workflowId} and node_id = #{nodeId} and classification_no = #{classificationNo}
|
|
</select>
|
|
|
|
<!-- 编辑变更单属性 -->
|
|
<update id="updateProcessForm" parameterType="com.spring.modules.change.vo.ChangeRequestVo">
|
|
update plm_process_form
|
|
set is_remark = 1,
|
|
update_date = getDate(),
|
|
update_by = #{userName}
|
|
where site = #{site} and document_no = #{changeNo} and is_remark = 0
|
|
</update>
|
|
|
|
<!-- 编辑变更单属性 -->
|
|
<update id="updateStepId" parameterType="com.spring.modules.change.vo.ChangeRequestVo">
|
|
update plm_change_request
|
|
set step_id = #{stepId}
|
|
<if test='rejectFlag == "Y"'>
|
|
reject_flag = 'Y',
|
|
</if>
|
|
where site = #{site} and change_no = #{changeNo}
|
|
</update>
|
|
|
|
<select id="getStepId" parameterType="string" resultType="int">
|
|
SELECT step_id
|
|
FROM plm_request_node
|
|
WHERE classification_no = #{classificationNo} and node_id = #{nodeId} and site = #{site}
|
|
</select>
|
|
|
|
<!-- 编辑变更单的驳回标识 -->
|
|
<update id="updateChangeReject" parameterType="com.spring.modules.change.vo.ChangeRequestVo">
|
|
update plm_change_request
|
|
set reject_flag = 'Y',
|
|
reject_step_id = #{rejectStepId}
|
|
where site = #{site} and change_no = #{changeNo}
|
|
</update>
|
|
|
|
<!-- 编辑流程记录的驳回标识 -->
|
|
<update id="updateProcessReject" parameterType="string">
|
|
update plm_process_form
|
|
set reject_flag = 'Y'
|
|
where site = #{site} and bu = #{bu} and request_id = #{requestId} and is_remark = 0
|
|
</update>
|
|
|
|
<select id="getProcessNodeId" parameterType="string" resultType="ProcessFormEntity">
|
|
SELECT
|
|
id,
|
|
site,
|
|
bu,
|
|
request_id,
|
|
workflow_id,
|
|
node_id,
|
|
domain_control_account,
|
|
document_no,
|
|
document_type,
|
|
seq_no,
|
|
reject_flag,
|
|
reject_node_id,
|
|
is_remark,
|
|
classification_no,
|
|
step_id
|
|
FROM plm_process_form
|
|
WHERE site = #{site} and bu = #{bu} and request_id = #{requestId} and domain_control_account = #{domainControlAccount} and is_remark = 0
|
|
</select>
|
|
|
|
<select id="getNodeName" parameterType="string" resultType="string">
|
|
select
|
|
node_name
|
|
from plm_request_node
|
|
where site = #{site} and classification_no = #{classificationNo} and node_id = #{nodeId}
|
|
</select>
|
|
|
|
<select id="getNodeInformation" parameterType="com.spring.modules.change.vo.ChangeRequestVo" resultType="PlmRequestDetailEntity">
|
|
select
|
|
b.id,
|
|
b.site,
|
|
b.bu,
|
|
b.classification_no,
|
|
b.node_id,
|
|
b.node_name,
|
|
b.node_type,
|
|
b.remark,
|
|
b.workflow_id,
|
|
b.seq_no,
|
|
b.step_id
|
|
from plm_request_header as a
|
|
left join plm_request_node as b on a.site = b.site and a.bu = b.bu and a.classification_no = b.classification_no and a.workflow_id = b.workflow_id
|
|
where a.site = #{site} and a.menu_id = #{menuId} and a.status = 'Y' and b.step_id = #{stepId}
|
|
</select>
|
|
<select id="getAllNodeAuthority" parameterType="PlmRequestDetailEntity" resultType="RequestNodeAuthorityEntity">
|
|
select distinct
|
|
a.site,
|
|
a.bu,
|
|
a.classification_no,
|
|
a.field_id,
|
|
a.update_flag,
|
|
a.table_id,
|
|
max( a.required) required,
|
|
b.fieldName
|
|
from plm_request_node_authority as a
|
|
left join (SELECT
|
|
col.name AS fieldId,
|
|
CONVERT(varchar(50), comm.value) AS fieldName,
|
|
tbl.name as tableId
|
|
FROM
|
|
sys.columns AS col
|
|
INNER JOIN
|
|
sys.tables AS tbl ON col.object_id = tbl.object_id
|
|
INNER JOIN
|
|
sys.types AS typ ON col.user_type_id = typ.user_type_id
|
|
LEFT JOIN
|
|
sys.extended_properties AS comm ON col.object_id = comm.major_id AND col.column_id = comm.minor_id) as b
|
|
on a.table_id = b.tableId and a.field_id = b.fieldId
|
|
where a.site = #{site} and a.bu = #{bu} and a.classification_no = #{classificationNo}
|
|
group by a.site,
|
|
a.bu,
|
|
a.classification_no,
|
|
a.field_id,
|
|
a.update_flag,
|
|
a.table_id, b.fieldName
|
|
</select>
|
|
<select id="getNodeAuthority" parameterType="PlmRequestDetailEntity" resultType="RequestNodeAuthorityEntity">
|
|
select
|
|
a.site,
|
|
a.bu,
|
|
a.classification_no,
|
|
a.node_id,
|
|
a.node_name,
|
|
a.field_id,
|
|
a.update_flag,
|
|
a.table_id,
|
|
a.required,
|
|
b.fieldName
|
|
from plm_request_node_authority as a
|
|
left join (SELECT
|
|
col.name AS fieldId,
|
|
CONVERT(varchar(50), comm.value) AS fieldName,
|
|
tbl.name as tableId
|
|
FROM
|
|
sys.columns AS col
|
|
INNER JOIN
|
|
sys.tables AS tbl ON col.object_id = tbl.object_id
|
|
INNER JOIN
|
|
sys.types AS typ ON col.user_type_id = typ.user_type_id
|
|
LEFT JOIN
|
|
sys.extended_properties AS comm ON col.object_id = comm.major_id AND col.column_id = comm.minor_id) as b
|
|
on a.table_id = b.tableId and a.field_id = b.fieldId
|
|
where a.site = #{site} and a.bu = #{bu} and a.classification_no = #{classificationNo} and a.node_id = #{nodeId}
|
|
</select>
|
|
|
|
<!-- 编辑变更单属性 -->
|
|
<update id="updateStepId2" parameterType="com.spring.modules.change.entity.ParamData">
|
|
update ${tableName}
|
|
set step_id = #{stepId}
|
|
<if test='rejectFlag == "Y"'>
|
|
,reject_flag = 'Y'
|
|
</if>
|
|
<where>
|
|
site = #{site} and ${fieldName1} = #{docNo}
|
|
<if test="revisionNo != null and revisionNo != ''">
|
|
AND rev_no = #{revisionNo}
|
|
</if>
|
|
</where>
|
|
</update>
|
|
|
|
<!-- 编辑变更单属性 -->
|
|
<update id="updateStepId3" parameterType="com.spring.modules.change.entity.ParamData">
|
|
update ${tableName}
|
|
set
|
|
<choose>
|
|
<when test="tableName == 'plm_technical_specification_sheet'">
|
|
${fieldName2} = 'spz'
|
|
</when>
|
|
<otherwise>
|
|
${fieldName2} = '审批中'
|
|
</otherwise>
|
|
</choose>
|
|
<where>
|
|
site = #{site} and ${fieldName1} = #{docNo}
|
|
<if test="revisionNo != null and revisionNo != ''">
|
|
AND rev_no = #{revisionNo}
|
|
</if>
|
|
</where>
|
|
</update>
|
|
|
|
<!-- 编辑变更单属性 -->
|
|
<!-- <update id="updateProcessForm2" parameterType="ParamData">-->
|
|
<!-- update plm_process_form-->
|
|
<!-- set is_remark = 1,-->
|
|
<!-- update_date = getDate(),-->
|
|
<!-- update_by = #{userName}-->
|
|
<!-- where site = #{site} and document_no = #{docNo} and is_remark = 0-->
|
|
<!-- </update>-->
|
|
<update id="updateProcessForm2" parameterType="ParamData">
|
|
update a
|
|
set A.is_remark = 1,
|
|
A.update_date = getDate(),
|
|
A.update_by = #{userName}
|
|
from plm_process_form a
|
|
left join sys_user b on a.domain_control_account = B.domain_control_account
|
|
where A.site = #{site} and document_no = #{docNo} and is_remark = 0 AND B.username = #{userName}
|
|
</update>
|
|
|
|
<update id="updateProcessForm3" parameterType="ParamData">
|
|
update plm_process_form
|
|
set is_remark = 1,
|
|
update_date = getDate(),
|
|
update_by = #{userName}
|
|
where site = #{site} and document_no = #{docNo} and is_remark = 0
|
|
</update>
|
|
|
|
<!-- 编辑变更单属性 -->
|
|
<update id="updateChangeStatus2" parameterType="ParamData">
|
|
update ${tableName}
|
|
set ${fieldName2} = #{status},
|
|
update_date = getDate(),
|
|
update_by = #{userName},
|
|
step_id = #{stepId}
|
|
<where>
|
|
site = #{site} and ${fieldName1} = #{docNo}
|
|
<if test="revisionNo != null and revisionNo != ''">
|
|
AND rev_no = #{revisionNo}
|
|
</if>
|
|
</where>
|
|
</update>
|
|
|
|
<!-- 编辑变更单的驳回标识 -->
|
|
<update id="updateChangeReject2" parameterType="ParamData">
|
|
update ${tableName}
|
|
set reject_flag = 'Y',
|
|
reject_step_id = #{rejectStepId}
|
|
where site = #{site} and ${fieldName1} = #{docNo}
|
|
</update>
|
|
|
|
<select id="queryNodeDetailLast" parameterType="string" resultType="com.spring.modules.request.vo.PlmRequestDetailVo">
|
|
SELECT
|
|
step_id
|
|
FROM plm_request_node
|
|
where site = #{site} and classification_no = #{classificationNo} and workflow_id = #{workflowId}
|
|
order by seq_no desc
|
|
</select>
|
|
|
|
<delete id="chooseItemDel">
|
|
delete from plm_change_item
|
|
where site = #{site} and change_no = #{changeNo}
|
|
</delete>
|
|
|
|
<delete id="chooseItemDel2">
|
|
delete from plm_change_FA_item
|
|
where site = #{site} and change_no = #{changeNo}
|
|
</delete>
|
|
|
|
<delete id="chooseItemCSDel">
|
|
delete from plm_change_countersignature_item
|
|
where site = #{site} and change_no = #{changeNo}
|
|
</delete>
|
|
|
|
<delete id="deleteChangeCostImpact">
|
|
delete from plm_change_cost_impact
|
|
where site = #{site} and change_no = #{changeNo}
|
|
</delete>
|
|
|
|
<delete id="deleteChangeExecutionInfo">
|
|
delete from plm_change_execution_info
|
|
where site = #{site} and change_no = #{changeNo}
|
|
</delete>
|
|
|
|
<update id="updateProcessNode">
|
|
update plm_process_form
|
|
set node_conclusion = #{nodeConclusion},
|
|
reject_opinion = #{rejectOpinion}
|
|
where site = #{site} and bu = #{bu} and request_id = #{requestId}
|
|
and classification_no = #{classificationNo}
|
|
and node_id = #{nodeId}
|
|
and domain_control_account = #{domainControlAccount}
|
|
and (node_conclusion is null or node_conclusion = '')
|
|
</update>
|
|
|
|
<update id="updateProcessNodeForReject">
|
|
update plm_process_form
|
|
set node_conclusion = #{nodeConclusion},
|
|
reject_opinion = #{rejectOpinion}
|
|
where site = #{site} and bu = #{bu} and request_id = #{requestId}
|
|
and classification_no = #{classificationNo}
|
|
and node_id = #{nodeId}
|
|
and (node_conclusion is null or node_conclusion = '')
|
|
</update>
|
|
|
|
<select id="getApprovalList" parameterType="com.spring.modules.change.vo.ProcessFormVo" resultType="com.spring.modules.change.vo.ProcessFormVo">
|
|
<!-- WITH cte AS (-->
|
|
<!-- SELECT-->
|
|
<!-- a.classification_no,-->
|
|
<!-- b.node_id,-->
|
|
<!-- b.node_name,-->
|
|
<!-- c.reject_flag,-->
|
|
<!-- CASE WHEN c.reject_flag = 'Y' THEN '是' ELSE '否' END AS rejectFlagDesc,-->
|
|
<!-- CASE WHEN c.process_intervention_flag = 'Y' THEN '是' ELSE '否' END AS process_intervention_flag,-->
|
|
<!-- c.reject_node_id,-->
|
|
<!-- dbo.plm_get_nodeName(a.site, c.reject_node_id, a.classification_no) AS rejectNodeName,-->
|
|
<!-- c.node_conclusion,-->
|
|
<!-- CASE-->
|
|
<!-- WHEN c.node_conclusion = 'Y' THEN '同意'-->
|
|
<!-- WHEN c.node_conclusion = 'N' THEN '驳回'-->
|
|
<!-- ELSE ''-->
|
|
<!-- END AS nodeConclusionDesc,-->
|
|
<!-- CAST(c.update_date AS DATETIME2(0)) AS update_date,-->
|
|
<!-- d.username AS create_by,-->
|
|
<!-- c.reject_opinion,-->
|
|
<!-- ISNULL(c.update_by, d.username) AS updateBy,-->
|
|
<!-- CAST(c.create_date AS DATETIME2(0)) AS create_date-->
|
|
<!-- FROM plm_request_header a-->
|
|
<!-- LEFT JOIN plm_request_node b-->
|
|
<!-- ON a.site = b.site-->
|
|
<!-- AND a.classification_no = b.classification_no-->
|
|
<!-- AND a.workflow_id = b.workflow_id-->
|
|
<!-- LEFT JOIN plm_process_form c-->
|
|
<!-- ON b.site = c.site-->
|
|
<!-- AND b.classification_no = c.classification_no-->
|
|
<!-- AND b.workflow_id = c.workflow_id-->
|
|
<!-- AND b.node_id = c.node_id-->
|
|
<!-- AND c.document_no = #{documentNo}-->
|
|
<!-- LEFT JOIN sys_user d-->
|
|
<!-- ON c.domain_control_account = d.domain_control_account-->
|
|
<!-- WHERE-->
|
|
<!-- a.site = #{site} AND a.menu_id = #{menuId}-->
|
|
<!-- AND c.create_date IS NOT NULL-->
|
|
<!-- ),-->
|
|
<!-- cte_dedup AS (-->
|
|
<!-- SELECT *,-->
|
|
<!-- ROW_NUMBER() OVER (-->
|
|
<!-- PARTITION BY classification_no, node_id, update_date-->
|
|
<!-- ORDER BY create_date DESC -- 保留每组最新创建的那条-->
|
|
<!-- ) AS rn-->
|
|
<!-- FROM cte-->
|
|
<!-- )-->
|
|
<!-- SELECT-->
|
|
<!-- classification_no,-->
|
|
<!-- node_id,-->
|
|
<!-- node_name,-->
|
|
<!-- reject_flag,-->
|
|
<!-- rejectFlagDesc,-->
|
|
<!-- reject_node_id,-->
|
|
<!-- rejectNodeName,-->
|
|
<!-- node_conclusion,-->
|
|
<!-- nodeConclusionDesc,-->
|
|
<!-- update_date,-->
|
|
<!-- create_by,-->
|
|
<!-- reject_opinion,-->
|
|
<!-- updateBy,-->
|
|
<!-- process_intervention_flag-->
|
|
<!-- FROM cte_dedup-->
|
|
<!-- WHERE rn = 1-->
|
|
<!-- ORDER BY-->
|
|
<!-- CASE WHEN update_date IS NULL THEN 1 ELSE 0 END,-->
|
|
<!-- update_date-->
|
|
<!-- 2025-05-22 海波要求替换成存储过程-->
|
|
exec dbo.get_process_form #{site},#{menuId},#{documentNo}
|
|
</select>
|
|
|
|
<select id="getTechnicalSpecification" resultType="PlmTechnicalSpecificationSheetData">
|
|
SELECT
|
|
id,
|
|
site,
|
|
code_no,
|
|
rev_no,
|
|
ori_code_no
|
|
FROM plm_technical_specification_sheet
|
|
where site = #{site} and code_no = #{codeNo}
|
|
</select>
|
|
|
|
<update id="updatePartActive">
|
|
update part
|
|
set active = 'N'
|
|
where site = #{site} and part_no = #{partNo}
|
|
</update>
|
|
|
|
<select id="getBuBySite" parameterType="Bu" resultType="Bu">
|
|
SELECT
|
|
id,
|
|
site,
|
|
bu_no,
|
|
bu_desc,
|
|
remark
|
|
FROM BU
|
|
where site = #{site} and active = 'Y'
|
|
<if test = "buNo != null and buNo != ''">
|
|
AND bu_no like #{buNo}
|
|
</if>
|
|
</select>
|
|
|
|
<select id="getReviewByNodeId" resultType="com.spring.modules.request.vo.PlmRequestDetailVo">
|
|
select
|
|
site,
|
|
bu,
|
|
classification_no,
|
|
node_id,
|
|
node_name,
|
|
create_date,
|
|
create_by,
|
|
update_date,
|
|
update_by,
|
|
remark,
|
|
plm_field,
|
|
oa_field,
|
|
field_value,
|
|
field_desc,
|
|
workflow_id,
|
|
order_ref1,
|
|
order_ref2,
|
|
order_ref3,
|
|
order_ref4,
|
|
plm_table,
|
|
field_type,
|
|
review
|
|
from plm_request_node_detail
|
|
where site = #{site}
|
|
AND classification_no = #{classificationNo}
|
|
AND workflow_id = #{workflowId}
|
|
AND node_id = #{reviewNodeId}
|
|
</select>
|
|
|
|
<!-- 编辑变更单属性 -->
|
|
<update id="updateProcessFormToAgree">
|
|
update plm_process_form
|
|
set node_conclusion = 'Y',
|
|
update_date = getDate(),
|
|
update_by = #{userName}
|
|
where site = #{site} and bu = #{bu} and menu_id = #{menuId} and document_no = #{docNo} and step_id = #{stepId}
|
|
</update>
|
|
|
|
<select id="getProcessFormByIsRemark" parameterType="string" resultType="com.spring.modules.change.vo.ProcessFormVo">
|
|
SELECT
|
|
a.id,
|
|
a.site,
|
|
a.bu,
|
|
a.request_id,
|
|
a.workflow_id,
|
|
b.workflowname as workflowName,
|
|
a.node_id,
|
|
b.nodename as nodeName,
|
|
a.domain_control_account,
|
|
a.document_no,
|
|
a.document_type,
|
|
a.seq_no,
|
|
a.reject_flag,
|
|
a.reject_node_id,
|
|
a.is_remark,
|
|
a.classification_no,
|
|
a.step_id
|
|
FROM plm_process_form as a
|
|
LEFT JOIN [VIEW_Process_management_OA_PLM] as b ON a.workflow_id = b.workflowid and a.node_id = b.nodeid
|
|
WHERE a.site = #{site} and a.bu = #{bu} and a.document_no = #{docNo} and a.is_remark = #{isRemark}
|
|
</select>
|
|
|
|
<select id="getRequestNameByFunction" parameterType="string" resultType="string">
|
|
SELECT dbo.get_Process_heading(#{site}, #{classificationNo}, #{workflowId}, #{workflowName}, #{nodeId}, #{nodeName}, #{documentNo}, #{nodeConclusion}, #{updateBy}, #{updateDate}, #{rejectOpinion}, #{menuName}, #{type})
|
|
</select>
|
|
|
|
<!-- 根据视图查物料 -->
|
|
<select id="choosePartNoList" parameterType="PlmProjectPartData" resultType="PlmProjectPartData">
|
|
SELECT
|
|
a.Final_Part_No,
|
|
a.Test_part_no,
|
|
a.Part_desc,
|
|
pcpi.customer_part_no,
|
|
a.bu_no,
|
|
a.site
|
|
FROM view_Project_final_Part as a
|
|
left join plm_project_info as c on a.site = c.site and a.project_id = c.project_id
|
|
left join plm_customer_part_info as pcpi on a.site = pcpi.site and a.test_part_no = pcpi.part_no and c.customer_id = pcpi.customer_no
|
|
left join plm_technical_specification_sheet d on a.site = d.site and a.test_part_no = d.test_part_no
|
|
left join plm_change_request_detail T ON A.SITE = T.SITE AND A.FINAL_PART_NO = T.PART_NO
|
|
<where>
|
|
a.site = #{query.site}
|
|
and d.test_part_no is null
|
|
and T.PART_NO is null
|
|
<if test="query.buNo != null and query.buNo != ''">
|
|
AND a.bu_no = #{query.buNo}
|
|
</if>
|
|
<if test="query.finalPartNo != null and query.finalPartNo != ''">
|
|
AND a.Final_Part_No like #{query.finalPartNo}
|
|
</if>
|
|
<if test="query.customerPartNo != null and query.customerPartNo != ''">
|
|
AND pcpi.customer_part_no like #{query.customerPartNo}
|
|
</if>
|
|
<if test="query.testPartNo != null and query.testPartNo != ''">
|
|
AND a.Test_part_no like #{query.testPartNo}
|
|
</if>
|
|
<if test="query.partDesc != null and query.partDesc != ''">
|
|
AND a.Part_desc like #{query.partDesc}
|
|
</if>
|
|
and a.RealFlag = 'Y'
|
|
</where>
|
|
</select>
|
|
|
|
<select id="getOaUserIdByIsRemark" resultType="com.spring.modules.base.data.OaUserData">
|
|
SELECT
|
|
b.id,
|
|
b.loginId
|
|
FROM plm_process_form as a
|
|
inner JOIN view_oa_HrmResource as b ON a.domain_control_account = b.loginid
|
|
WHERE a.site = #{site} and a.document_no = #{docNo} and (a.is_remark = #{isRemark} OR A.step_id = 10)
|
|
</select>
|
|
|
|
<select id="getRequestNodeByNodeId" resultType="com.spring.modules.request.vo.PlmRequestDetailVo">
|
|
SELECT
|
|
site,
|
|
countersignature_item
|
|
FROM plm_request_node
|
|
where classification_no = #{classificationNo} and site = #{site} and node_id = #{nodeId}
|
|
</select>
|
|
|
|
<select id="technicalSpecificationSearchAny"
|
|
resultType="com.spring.modules.change.entity.TechnicalSpecificationData">
|
|
SELECT
|
|
a.site,
|
|
b.bu_no,
|
|
b.final_part_no as partNo,
|
|
b.part_desc,
|
|
a.project_id,
|
|
c.project_name as project_desc,
|
|
c.customer_id,
|
|
j.customer_desc,
|
|
a.code_no,
|
|
a.ori_code_no,
|
|
a.rev_no,
|
|
case when a.ECN_flag = 'Y' then '变更中' else '未发起' end as ecnFlag,
|
|
a.ECN_no,
|
|
a.ECN_address,
|
|
b.test_part_no
|
|
FROM plm_technical_specification_sheet a
|
|
LEFT JOIN plm_project_info c ON a.site = c.site AND a.project_id = c.project_id
|
|
LEFT JOIN plm_customer_information j ON j.site = c.site and j.customer_no = c.customer_id
|
|
left join view_Project_final_Part b on a.site = b.site and a.project_id = b.project_id and a.test_part_no = b.test_part_no
|
|
<if test="params.whereClause != null and params.whereClause != ''">
|
|
WHERE ${params.whereClause}
|
|
</if>
|
|
<if test="params.orderClause != null and params.orderClause != ''">
|
|
ORDER BY ${params.orderClause}
|
|
</if>
|
|
<if test="params.orderClause == null or params.orderClause == ''">
|
|
order by a.ori_code_no
|
|
</if>
|
|
</select>
|
|
<select id="changeRecordSearchAny" resultType="com.spring.modules.change.vo.ChangeRequestVo">
|
|
SELECT
|
|
a.site,
|
|
a.bu_no,
|
|
a.change_no,
|
|
a.applicant_id,
|
|
dbo.get_userDisPlay(a.applicant_id) as applicantName,
|
|
b.department_no as applicationDepartmentId,
|
|
dbo.get_department_name(a.site, b.department_no) as applicationDepartmentName,
|
|
a.apply_date,
|
|
a.ecn_type,
|
|
a.change_impact,
|
|
a.change_impact_desc,
|
|
a.ecn_stage,
|
|
a.change_type,
|
|
a.tp_engineer_id,
|
|
dbo.get_userDisPlay(a.tp_engineer_id) as tpEngineerName,
|
|
a.change_phase_in_date,
|
|
a.df_is_product,
|
|
a.printing,
|
|
a.manufacturing_cost_is_change,
|
|
a.change_request_desc,
|
|
a.is_re_quote,
|
|
a.ul_certification_requirements,
|
|
a.ul_continue_to_meet_demand,
|
|
a.gp_certification_requirements,
|
|
a.gp_continue_to_meet_demand,
|
|
a.create_date,
|
|
a.create_by,
|
|
a.update_date,
|
|
a.update_by,
|
|
a.industrial_engineer_id,
|
|
dbo.get_userDisPlay(a.industrial_engineer_id) as industrialEngineerName,
|
|
a.change_status,
|
|
a.cqc_operator_id,
|
|
dbo.get_userDisPlay(a.cqc_operator_id) as cqcOperatorName,
|
|
a.fai_operator_id,
|
|
dbo.get_userDisPlay(a.fai_operator_id) as faiOperatorName,
|
|
a.step_id,
|
|
a.reject_flag,
|
|
a.reject_step_id,
|
|
d.is_reject,
|
|
d.node_id,
|
|
d.node_name,
|
|
dbo.get_plm_Approval_username(a.site, prh.workflow_id, d.node_id, a.change_no) as createBy2,
|
|
dbo.get_process_control(a.site, prh.workflow_id, d.node_id, 4) as tpProcessControl,
|
|
dbo.get_process_control(a.site, prh.workflow_id, d.node_id, 5) as csProcessControl
|
|
FROM plm_change_request a
|
|
LEFT JOIN sys_user as b on a.site = b.site and a.applicant_id = b.username
|
|
left join plm_request_header as prh on a.site = prh.site and prh.menu_id = #{params.menuId}
|
|
left join plm_request_node as d on a.site = d.site and prh.classification_no = d.classification_no and prh.workflow_id = d.workflow_id and a.step_id = d.step_id
|
|
<if test="params.whereClause != null and params.whereClause != ''">
|
|
WHERE ${params.whereClause}
|
|
</if>
|
|
<if test="params.orderClause != null and params.orderClause != ''">
|
|
ORDER BY ${params.orderClause}
|
|
</if>
|
|
<if test="params.orderClause == null or params.orderClause == ''">
|
|
order by a.change_no desc
|
|
</if>
|
|
</select>
|
|
|
|
<insert id="saveProcessFormBySql">
|
|
insert into plm_process_form (site, bu, request_id, workflow_id, node_id, domain_control_account, document_no, document_type, classification_no,
|
|
seq_no, node_conclusion, is_remark, step_id, menu_id, create_by, create_date, update_by, update_date)
|
|
SELECT
|
|
TOP 1
|
|
a.site,
|
|
a.bu,
|
|
a.request_id,
|
|
a.workflow_id,
|
|
b.node_id,
|
|
domain_control_account,
|
|
document_no,
|
|
a.document_type,
|
|
A.classification_no,
|
|
a.seq_no + 10 AS seq_no,
|
|
'Y' AS node_conclusion,
|
|
'1' AS is_remark,
|
|
b.step_id,
|
|
A.menu_id,
|
|
a.create_by,
|
|
a.create_date,
|
|
a.update_by,
|
|
a.update_date
|
|
FROM
|
|
plm_process_form A
|
|
LEFT JOIN (
|
|
SELECT
|
|
TOP 1
|
|
SITE,
|
|
classification_no,
|
|
node_id,
|
|
node_name,
|
|
step_id
|
|
FROM plm_request_node
|
|
WHERE SITE = #{site} AND classification_no = #{classificationNo}
|
|
ORDER BY step_id DESC
|
|
) B ON A.site = B.site AND A.classification_no = B.classification_no
|
|
WHERE A.site = #{site} AND document_no = #{docNo} AND a.classification_no IS NOT NULL
|
|
ORDER BY A.ID DESC
|
|
</insert>
|
|
|
|
<update id="updateBMShowInQueryFlag">
|
|
update plm_technical_specification_sheet
|
|
set show_in_query_flag = #{showInQueryFlag}
|
|
where site = #{site} and code_no = #{codeNo}
|
|
</update>
|
|
|
|
<select id="getChangeRecordByPartNo" resultType="com.spring.modules.change.vo.ChangeRequestDetailVo">
|
|
select
|
|
a.site,
|
|
a.change_no,
|
|
b.plm_part_no,
|
|
b.ifs_part_no
|
|
from plm_change_request_detail a
|
|
left join part b on a.site = b.site and a.part_no = b.part_no
|
|
where a.site = #{site}
|
|
<if test="testPartNo != null and testPartNo != ''">
|
|
and b.plm_part_no = #{testPartNo}
|
|
</if>
|
|
<if test="finalPartNo != null and finalPartNo != ''">
|
|
and b.ifs_part_no = #{finalPartNo}
|
|
</if>
|
|
</select>
|
|
</mapper>
|