INSERT INTO plm_bom_detail
(site, part_no, eng_chg_level, bom_type, alternative_no, alternative_description, status, min_lot_qty, default_flag, note_text, create_date, create_by, official_flag)
VALUES
(#{site}, #{partNo}, #{engChgLevel}, #{bomType}, #{alternativeNo}, #{alternativeDescription}, #{status}, #{minLotQty}, #{defaultFlag}, #{detailNoteText}, getDate(), #{createBy}, #{officialFlag})
INSERT INTO plm_bom_component
(site, part_no, eng_chg_level, bom_type, alternative_no, component_part, line_item_no, print_unit, qty_per_assembly, component_scrap, shrinkage_factor, issue_type, issue_to_loc, operation_no, note_text, create_date, create_by, line_sequence, consumption_item)
VALUES
(#{site}, #{partNo}, #{engChgLevel}, #{bomType}, #{alternativeNo}, #{componentPart}, #{lineItemNo}, #{printUnit}, #{qtyPerAssembly}, #{componentScrap}, #{shrinkageFactor}, #{issueType}, #{issueToLoc}, #{operationNo}, #{noteText}, getDate(), #{createBy}, #{lineSequence}, #{consumptionItem})
update plm_bom_detail
set alternative_description = #{alternativeDescription},
min_lot_qty = #{minLotQty},
note_text = #{detailNoteText},
status = #{status},
update_date = getDate(),
update_by = #{updateBy}
where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo}
delete from plm_bom_component
where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo}
delete from plm_bom_detail
where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo}
delete from plm_bom_component
where site = #{site}
and part_no = #{partNo}
and eng_chg_level = #{engChgLevel}
and bom_type = #{bomType}
and alternative_no = #{alternativeNo}
and line_item_no = #{lineItemNo}
delete from plm_bom_component
where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType}
delete from plm_bom_detail
where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType}
update plm_bom_component
set qty_per_assembly = #{qtyPerAssembly},
component_scrap = #{componentScrap},
issue_type = #{issueType},
shrinkage_factor = #{shrinkageFactor},
operation_no = #{operationNo},
issue_to_loc = #{issueToLoc},
note_text = #{noteText},
line_sequence = #{lineSequence},
consumption_item = #{consumptionItem},
update_date = getDate(),
update_by = #{updateBy}
where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo} and line_item_no = #{lineItemNo}
update plm_bom_detail
set status = #{status},
update_date = getDate(),
update_by = #{updateBy}
where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo}
update plm_bom_header
set eff_phase_out_date = #{effPhaseOutDate},
update_date = getDate(),
update_by = #{createBy}
where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType}
insert into part_revision (site, part_no, eng_chg_level, eff_phase_in_date, eff_phase_out_date, revision_text, product_status, repair_status, eng_revision, create_date, create_by)
values (#{site}, #{partNo}, #{engChgLevel}, #{effPhaseInDate}, #{effPhaseOutDate}, #{noteText}, 'Not In Effect', 'Not In Effect', #{engRevision}, getDate(), #{createBy})
update part_revision
set product_status = #{productStatus},
repair_status = 'In Effect',
update_date = getDate(),
update_by = #{updateBy}
where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel}
insert into plm_bom_manuf_struct_cost_distrib
(site, part_no, eng_chg_level, bom_type, alternative_no, by_prod_line_item_no, component_line_item_no, item_cost_distribution, component_part_no, by_prod_part_no, create_date, create_by) VALUES
(#{item.site}, #{item.partNo}, #{item.engChgLevel}, #{item.bomType}, #{item.alternativeNo}, #{item.byProdLineItemNo}, #{item.componentLineItemNo}, #{item.itemCostDistribution,jdbcType=FLOAT}, #{item.componentPartNo}, #{item.byProdPartNo}, getDate(), #{item.createBy})
delete from plm_bom_manuf_struct_cost_distrib
where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo} and by_prod_line_item_no = #{lineItemNo}
delete from plm_bom_manuf_struct_cost_distrib
where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo} and component_line_item_no = #{lineItemNo}
update plm_bom_manuf_struct_cost_distrib
set item_cost_distribution = #{itemCostDistribution,jdbcType=FLOAT},
update_date = getDate(),
update_by = #{updateBy}
where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo} and by_prod_line_item_no = #{byProdLineItemNo} and component_line_item_no = #{componentLineItemNo}
insert into plm_bom_component
(site, part_no, eng_chg_level, bom_type, alternative_no, component_part, line_item_no, print_unit, qty_per_assembly, component_scrap, shrinkage_factor, issue_type, issue_to_loc, operation_no, note_text, create_date, create_by, line_sequence, consumption_item) VALUES
(#{item.site}, #{item.partNo}, #{item.engChgLevel}, #{item.bomType}, #{item.alternativeNo}, #{item.componentPart}, #{item.lineItemNo}, #{item.printUnit}, #{item.qtyPerAssembly}, #{item.componentScrap}, #{item.shrinkageFactor}, #{item.issueType}, #{item.issueToLoc}, #{item.operationNo}, #{item.noteText}, getDate(), #{item.createBy}, #{item.lineSequence}, #{item.consumptionItem})
update plm_bom_detail
set official_flag = 'Y'
where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo}
delete from plm_bom_manuf_struct_cost_distrib
where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo}