INSERT INTO plm_recipe_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, display_weight_uom, display_volume_uom, reg_unit)
VALUES
(#{site}, #{partNo}, #{engChgLevel}, #{bomType}, #{alternativeNo}, #{alternativeDescription}, #{status}, #{minLotQty}, #{defaultFlag}, #{detailNoteText}, getDate(), #{createBy}, #{officialFlag}, #{displayWeightUom}, #{displayVolumeUom}, #{regUnit})
INSERT INTO plm_recipe_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, parts_by_weight, qty_uom, issue_planned_scrap_db, issue_overreported_qty_db,
fixed_qty_flag, promise_planned, phantom_consume, oper_cost_distribution, gen_oh_cost_distribution, qty_kg, by_prod_as_supply_in_mrp_db, leadtime_offset, std_planned_item,
charged_item, last_activity_date, exclude_from_calculations_db, exclude_from_as_built_db, lot_batch_origin_db, weight_share)
VALUES
(#{site}, #{partNo}, #{engChgLevel}, #{bomType}, #{alternativeNo}, #{componentPart}, #{lineItemNo}, #{printUnit}, #{qtyPerAssembly}, #{componentScrap}, #{shrinkageFactor}, #{issueType},
#{issueToLoc}, #{operationNo}, #{noteText}, getDate(), #{createBy}, #{lineSequence}, #{consumptionItem}, #{partsByWeight}, #{qtyUom}, #{issuePlannedScrapDb}, #{issueOverreportedQtyDb},
#{fixedQtyFlag}, #{promisePlanned}, #{phantomConsume}, #{operCostDistribution}, #{genOhCostDistribution}, #{qtyKg}, #{byProdAsSupplyInMrpDb}, #{leadtimeOffset}, #{stdPlannedItem},
#{chargedItem}, getDate(), #{excludeFromCalculationsDb}, #{excludeFromAsBuiltDb}, #{lotBatchOriginDb}, #{weightShare})
update plm_recipe_detail
set alternative_description = #{alternativeDescription},
min_lot_qty = #{minLotQty},
note_text = #{detailNoteText},
status = #{status},
update_date = getDate(),
update_by = #{updateBy},
display_weight_uom = #{displayWeightUom},
display_volume_uom = #{displayVolumeUom}
where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo}
delete from plm_recipe_component
where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo}
delete from plm_recipe_detail
where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo}
delete from plm_recipe_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_recipe_component
where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType}
delete from plm_recipe_detail
where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType}
update plm_recipe_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},
weight_share = #{weightShare},
parts_by_weight = #{partsByWeight},
qty_uom = #{qtyUom},
qty_kg = #{qtyKg}
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_recipe_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_recipe_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_recipe_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_recipe_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_recipe_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_recipe_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_recipe_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, parts_by_weight, qty_uom, issue_planned_scrap_db, issue_overreported_qty_db,
fixed_qty_flag, promise_planned, phantom_consume, oper_cost_distribution, gen_oh_cost_distribution, qty_kg, by_prod_as_supply_in_mrp_db, leadtime_offset, std_planned_item,
charged_item, last_activity_date, exclude_from_calculations_db, exclude_from_as_built_db, lot_batch_origin_db, weight_share)
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}, #{item.partsByWeight}, #{item.qtyUom}, #{item.issuePlannedScrapDb}, #{item.issueOverreportedQtyDb},
#{item.fixedQtyFlag}, #{item.promisePlanned}, #{item.phantomConsume}, #{item.operCostDistribution}, #{item.genOhCostDistribution}, #{item.qtyKg}, #{item.byProdAsSupplyInMrpDb}, #{item.leadtimeOffset}, #{item.stdPlannedItem},
#{item.chargedItem}, getDate(), #{item.excludeFromCalculationsDb}, #{item.excludeFromAsBuiltDb}, #{item.lotBatchOriginDb}, #{item.weightShare})
update plm_recipe_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_recipe_manuf_struct_cost_distrib
where site = #{site} and part_no = #{partNo} and eng_chg_level = #{engChgLevel} and bom_type = #{bomType} and alternative_no = #{alternativeNo}