INSERT INTO plm_routing_detail
(site, bu_no, part_no, routing_revision, routing_type, alternative_no, alternative_description, fixed_lead_time_day, fixed_lead_time_hour, variable_lead_time_day, variable_lead_time_hour, for_std_lot_by_day, for_lot_by_day, min_lot_qty, note_text, create_date, create_by, status)
VALUES
(#{site}, #{buNo}, #{partNo}, #{routingRevision}, #{routingType}, #{alternativeNo}, #{alternativeDescription}, #{fixedLeadTimeDay}, #{fixedLeadTimeHour}, #{variableLeadTimeDay}, #{variableLeadTimeHour}, #{forStdLotByDay}, #{forLotByDay}, #{minLotQty}, #{detailNoteText}, getDate(), #{createBy}, #{status})
INSERT INTO plm_routing_component
(site, bu_no, part_no, routing_revision, routing_type, alternative_no, operation_name, operation_no, efficiency_factor, mach_run_factor, mach_setup_time, run_time_code, labor_run_factor, labor_setup_time, crew_size, setup_crew_size, outside_op_item, machine_no, work_center_no, labor_class_no, setup_labor_class_no, overlap, note_text, create_date, create_by, mach_cycle_time, labor_cycle_time)
VALUES
(#{site}, #{buNo}, #{partNo}, #{routingRevision}, #{routingType}, #{alternativeNo}, #{operationName}, #{operationNo}, #{efficiencyFactor}, #{machRunFactor}, #{machSetupTime}, #{runTimeCode}, #{laborRunFactor}, #{laborSetupTime}, #{crewSize,jdbcType=FLOAT}, #{setupCrewSize,jdbcType=FLOAT}, #{outsideOpItem}, #{machineNo}, #{workCenterNo}, #{laborClassNo}, #{setupLaborClassNo}, #{overlap}, #{noteText}, getDate(), #{createBy}, #{machCycleTime}, #{laborCycleTime})
update plm_routing_detail
set alternative_description = #{alternativeDescription},
rout_template_id = #{routTemplateId},
plan_date = #{planDate},
fixed_lead_time_day = #{fixedLeadTimeDay},
fixed_lead_time_hour = #{fixedLeadTimeHour},
variable_lead_time_day = #{variableLeadTimeDay},
variable_lead_time_hour = #{variableLeadTimeHour},
for_std_lot_by_day = #{forStdLotByDay},
for_lot_by_day = #{forLotByDay},
min_lot_qty = #{minLotQty},
note_text = #{detailNoteText},
update_date = getDate(),
update_by = #{updateBy},
status = #{status}
where site = #{site} and bu_no = #{buNo} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo}
delete from plm_routing_component
where site = #{site} and bu_no = #{buNo} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo}
delete from plm_routing_detail
where site = #{site} and bu_no = #{buNo} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo}
delete from plm_routing_component
where site = #{site}
and bu_no = #{buNo}
and part_no = #{partNo}
and routing_revision = #{routingRevision}
and routing_type = #{routingType}
and alternative_no = #{alternativeNo}
and operation_id = #{operationId}
delete from plm_routing_component
where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType}
delete from plm_routing_detail
where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType}
update plm_routing_component
set efficiency_factor = #{efficiencyFactor},
mach_run_factor = #{machRunFactor},
mach_setup_time = #{machSetupTime},
run_time_code = #{runTimeCode},
labor_run_factor = #{laborRunFactor},
labor_setup_time = #{laborSetupTime},
crew_size = #{crewSize,jdbcType=FLOAT},
setup_crew_size = #{setupCrewSize,jdbcType=FLOAT},
outside_op_item = #{outsideOpItem},
machine_no = #{machineNo},
work_center_no = #{workCenterNo},
labor_class_no = #{laborClassNo},
setup_labor_class_no = #{setupLaborClassNo},
overlap = #{overlap},
note_text = #{noteText},
update_date = getDate(),
update_by = #{updateBy},
operation_no = #{operationNo},
operation_name = #{operationName},
mach_cycle_time = #{machCycleTime},
labor_cycle_time = #{laborCycleTime}
where site = #{site} and bu_no = #{buNo} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo} and operation_id = #{operationId}
delete from routing_tool
where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo}
delete from plm_routing_work_guide
where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo}
update plm_routing_detail
set status = #{status},
update_date = getDate(),
update_by = #{updateBy}
where site = #{site} and bu_no = #{buNo} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo}
update plm_routing_header
set phase_out_date = #{phaseOutDate},
update_date = getDate(),
update_by = #{createBy}
where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType}