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)
VALUES
(#{site}, #{buNo}, #{partNo}, #{engChgLevel}, #{bomType}, #{alternativeNo}, #{alternativeDescription}, #{status}, #{minLotQty}, #{defaultFlag}, #{detailNoteText}, getDate(), #{createBy})
INSERT INTO plm_bom_component
(site, bu_no, 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_id, note_text, create_date, create_by, line_sequence, consumption_item)
VALUES
(#{site}, #{buNo}, #{partNo}, #{engChgLevel}, #{bomType}, #{alternativeNo}, #{componentPart}, #{lineItemNo}, #{printUnit}, #{qtyPerAssembly}, #{componentScrap}, #{shrinkageFactor}, #{issueType}, #{issueToLoc}, #{operationId}, #{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 bu_no = #{buNo} 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 bu_no = #{buNo} 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 bu_no = #{buNo} 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 bu_no = #{buNo}
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_id = #{operationId},
issue_to_loc = #{issueToLoc},
note_text = #{noteText},
line_sequence = #{lineSequence},
consumption_item = #{consumptionItem},
update_date = getDate(),
update_by = #{updateBy}
where site = #{site} and bu_no = #{buNo} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo} and line_item_no = #{lineItemNo}
insert into plm_bom_component
(site, bu_no, 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_id, note_text, create_date, create_by, line_sequence, consumption_item) VALUES
(#{item.site}, #{item.buNo}, #{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.operationId}, #{item.noteText}, getDate(), #{item.createBy}, #{item.lineSequence}, #{item.consumptionItem})
update plm_bom_detail
set status = #{status},
update_date = getDate(),
update_by = #{updateBy}
where site = #{site} and bu_no = #{buNo} 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}