|
|
@ -637,6 +637,156 @@ |
|
|
where tree_id = #{treeId} |
|
|
where tree_id = #{treeId} |
|
|
</insert> |
|
|
</insert> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 删除已存在的BOM header(用于复制前清理)--> |
|
|
|
|
|
<delete id="deleteBomHeaderForCopy"> |
|
|
|
|
|
delete from plm_bom_header |
|
|
|
|
|
where site = (select top 1 site from plm_copy_temp_bom_tree where bom_id = #{bomId} and username = #{createBy} and level = 0) |
|
|
|
|
|
and bu_no = (select top 1 bu_no from plm_copy_temp_bom_tree where bom_id = #{bomId} and username = #{createBy} and level = 0) |
|
|
|
|
|
and part_no = (select top 1 part_no from plm_copy_temp_bom_tree where bom_id = #{bomId} and username = #{createBy} and level = 0) |
|
|
|
|
|
and eng_chg_level = (select top 1 eng_chg_level from plm_copy_temp_bom_tree where bom_id = #{bomId} and username = #{createBy} and level = 0) |
|
|
|
|
|
and bom_type = (select top 1 bom_type from plm_copy_temp_bom_tree where bom_id = #{bomId} and username = #{createBy} and level = 0) |
|
|
|
|
|
</delete> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 从临时表保存BOM header --> |
|
|
|
|
|
<insert id="saveBomHeaderFromTemp"> |
|
|
|
|
|
insert into plm_bom_header |
|
|
|
|
|
(site, bu_no, part_no, eng_chg_level, bom_type, note_text, eff_phase_in_date, eng_revision, type_flag, net_weight, create_date, create_by, process_unit) |
|
|
|
|
|
select distinct |
|
|
|
|
|
site, |
|
|
|
|
|
bu_no, |
|
|
|
|
|
part_no, |
|
|
|
|
|
eng_chg_level, |
|
|
|
|
|
bom_type, |
|
|
|
|
|
null as note_text, |
|
|
|
|
|
getDate() as eff_phase_in_date, |
|
|
|
|
|
1 as eng_revision, |
|
|
|
|
|
null as type_flag, |
|
|
|
|
|
0 as net_weight, |
|
|
|
|
|
getDate() as create_date, |
|
|
|
|
|
#{createBy} as create_by, |
|
|
|
|
|
null as process_unit |
|
|
|
|
|
from plm_copy_temp_bom_tree |
|
|
|
|
|
where bom_id = #{bomId} and username = #{createBy} and change_flag = 'Y' and level = 0 |
|
|
|
|
|
</insert> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 删除已存在的BOM detail(用于复制前清理)--> |
|
|
|
|
|
<delete id="deleteBomDetailForCopy"> |
|
|
|
|
|
delete from plm_bom_detail |
|
|
|
|
|
where site = (select top 1 site from plm_copy_temp_bom_tree where bom_id = #{bomId} and username = #{createBy} and level = 0) |
|
|
|
|
|
and bu_no = (select top 1 bu_no from plm_copy_temp_bom_tree where bom_id = #{bomId} and username = #{createBy} and level = 0) |
|
|
|
|
|
and part_no = (select top 1 part_no from plm_copy_temp_bom_tree where bom_id = #{bomId} and username = #{createBy} and level = 0) |
|
|
|
|
|
and eng_chg_level = (select top 1 eng_chg_level from plm_copy_temp_bom_tree where bom_id = #{bomId} and username = #{createBy} and level = 0) |
|
|
|
|
|
and bom_type = (select top 1 bom_type from plm_copy_temp_bom_tree where bom_id = #{bomId} and username = #{createBy} and level = 0) |
|
|
|
|
|
</delete> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 从临时表保存BOM detail --> |
|
|
|
|
|
<insert id="saveBomDetailFromTemp"> |
|
|
|
|
|
insert into plm_bom_detail |
|
|
|
|
|
(site, bu_no, part_no, eng_chg_level, bom_type, alternative_no, alternative_description, status, min_lot_qty, default_flag, note_text, create_date, create_by) |
|
|
|
|
|
select distinct |
|
|
|
|
|
site, |
|
|
|
|
|
bu_no, |
|
|
|
|
|
part_no, |
|
|
|
|
|
eng_chg_level, |
|
|
|
|
|
bom_type, |
|
|
|
|
|
alternative_no, |
|
|
|
|
|
'*' as alternative_description, |
|
|
|
|
|
'Released' as status, |
|
|
|
|
|
1 as min_lot_qty, |
|
|
|
|
|
'Y' as default_flag, |
|
|
|
|
|
null as note_text, |
|
|
|
|
|
getDate() as create_date, |
|
|
|
|
|
#{createBy} as create_by |
|
|
|
|
|
from plm_copy_temp_bom_tree |
|
|
|
|
|
where bom_id = #{bomId} and username = #{createBy} and change_flag = 'Y' and level = 0 |
|
|
|
|
|
</insert> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 删除已存在的Routing header(用于复制前清理)--> |
|
|
|
|
|
<delete id="deleteRoutingHeaderForCopy"> |
|
|
|
|
|
delete from plm_routing_header |
|
|
|
|
|
where site = (select top 1 site from plm_copy_temp_bom_tree where bom_id = #{bomId} and username = #{createBy} and level = 0) |
|
|
|
|
|
and bu_no = (select top 1 bu_no from plm_copy_temp_bom_tree where bom_id = #{bomId} and username = #{createBy} and level = 0) |
|
|
|
|
|
and part_no = (select top 1 part_no from plm_copy_temp_bom_tree where bom_id = #{bomId} and username = #{createBy} and level = 0) |
|
|
|
|
|
and routing_revision = (select top 1 eng_chg_level from plm_copy_temp_bom_tree where bom_id = #{bomId} and username = #{createBy} and level = 0) |
|
|
|
|
|
and routing_type = (select top 1 bom_type from plm_copy_temp_bom_tree where bom_id = #{bomId} and username = #{createBy} and level = 0) |
|
|
|
|
|
</delete> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 从临时表保存Routing header --> |
|
|
|
|
|
<insert id="saveRoutingHeaderFromTemp"> |
|
|
|
|
|
insert into plm_routing_header |
|
|
|
|
|
(site, bu_no, part_no, routing_revision, routing_type, note_text, phase_in_date, create_date, create_by) |
|
|
|
|
|
select distinct |
|
|
|
|
|
site, |
|
|
|
|
|
bu_no, |
|
|
|
|
|
part_no, |
|
|
|
|
|
eng_chg_level as routing_revision, |
|
|
|
|
|
bom_type as routing_type, |
|
|
|
|
|
null as note_text, |
|
|
|
|
|
getDate() as phase_in_date, |
|
|
|
|
|
getDate() as create_date, |
|
|
|
|
|
#{createBy} as create_by |
|
|
|
|
|
from plm_copy_temp_bom_tree |
|
|
|
|
|
where bom_id = #{bomId} and username = #{createBy} and change_flag = 'Y' and level = 0 |
|
|
|
|
|
</insert> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 删除已存在的Routing detail(用于复制前清理)--> |
|
|
|
|
|
<delete id="deleteRoutingDetailForCopy"> |
|
|
|
|
|
delete from plm_routing_detail |
|
|
|
|
|
where site = (select top 1 site from plm_copy_temp_bom_tree where bom_id = #{bomId} and username = #{createBy} and level = 0) |
|
|
|
|
|
and bu_no = (select top 1 bu_no from plm_copy_temp_bom_tree where bom_id = #{bomId} and username = #{createBy} and level = 0) |
|
|
|
|
|
and part_no = (select top 1 part_no from plm_copy_temp_bom_tree where bom_id = #{bomId} and username = #{createBy} and level = 0) |
|
|
|
|
|
and routing_revision = (select top 1 eng_chg_level from plm_copy_temp_bom_tree where bom_id = #{bomId} and username = #{createBy} and level = 0) |
|
|
|
|
|
and routing_type = (select top 1 bom_type from plm_copy_temp_bom_tree where bom_id = #{bomId} and username = #{createBy} and level = 0) |
|
|
|
|
|
</delete> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 从临时表保存Routing detail --> |
|
|
|
|
|
<insert id="saveRoutingDetailFromTemp"> |
|
|
|
|
|
insert into plm_routing_detail |
|
|
|
|
|
(site, bu_no, part_no, routing_revision, routing_type, alternative_no, status, create_date, create_by) |
|
|
|
|
|
select distinct |
|
|
|
|
|
site, |
|
|
|
|
|
bu_no, |
|
|
|
|
|
part_no, |
|
|
|
|
|
eng_chg_level as routing_revision, |
|
|
|
|
|
bom_type as routing_type, |
|
|
|
|
|
alternative_no, |
|
|
|
|
|
'Released' as status, |
|
|
|
|
|
getDate() as create_date, |
|
|
|
|
|
#{createBy} as create_by |
|
|
|
|
|
from plm_copy_temp_bom_tree |
|
|
|
|
|
where bom_id = #{bomId} and username = #{createBy} and change_flag = 'Y' and level = 0 |
|
|
|
|
|
</insert> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 查询原BOM的节点树结构(用于复制)--> |
|
|
|
|
|
<select id="queryOriginalBomNodeTree" resultType="com.xujie.sys.modules.part.entity.PlmQuicklyBomInfoEntity"> |
|
|
|
|
|
SELECT |
|
|
|
|
|
site, |
|
|
|
|
|
template_no, |
|
|
|
|
|
node_id, |
|
|
|
|
|
node_name, |
|
|
|
|
|
part_no, |
|
|
|
|
|
id, |
|
|
|
|
|
p_id, |
|
|
|
|
|
eng_chg_level, |
|
|
|
|
|
routing_revision |
|
|
|
|
|
FROM plm_quickly_bom_Info |
|
|
|
|
|
WHERE site = #{site} |
|
|
|
|
|
AND main_part = #{originalPartNo} |
|
|
|
|
|
ORDER BY id |
|
|
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
|
|
<!-- 批量插入快速BOM节点 --> |
|
|
|
|
|
<insert id="batchInsertQuicklyBomInfo"> |
|
|
|
|
|
INSERT INTO plm_quickly_bom_Info |
|
|
|
|
|
(site, template_no, node_id, main_part, part_no, id, p_id, create_date, create_by, node_name, eng_chg_level, routing_revision) |
|
|
|
|
|
VALUES |
|
|
|
|
|
<foreach collection="list" item="item" separator=","> |
|
|
|
|
|
(#{item.site}, #{item.templateNo}, #{item.nodeId}, #{item.mainPart}, #{item.partNo}, |
|
|
|
|
|
#{item.id}, #{item.pId}, getDate(), #{item.createBy}, #{item.nodeName}, |
|
|
|
|
|
#{item.engChgLevel}, #{item.routingRevision}) |
|
|
|
|
|
</foreach> |
|
|
|
|
|
</insert> |
|
|
|
|
|
|
|
|
<update id="updateComponentPartNo"> |
|
|
<update id="updateComponentPartNo"> |
|
|
update plm_copy_temp_bom |
|
|
update plm_copy_temp_bom |
|
|
set component_part = #{newPartNo} |
|
|
set component_part = #{newPartNo} |
|
|
|