INSERT INTO plm_routing_detail
(site, 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, official_flag)
VALUES
(#{site}, #{partNo}, #{routingRevision}, #{routingType}, #{alternativeNo}, #{alternativeDescription}, #{fixedLeadTimeDay}, #{fixedLeadTimeHour}, #{variableLeadTimeDay}, #{variableLeadTimeHour}, #{forStdLotByDay}, #{forLotByDay}, #{minLotQty}, #{detailNoteText}, getDate(), #{createBy}, #{status}, #{officialFlag})
INSERT INTO plm_routing_component
(site, 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)
VALUES
(#{site}, #{partNo}, #{routingRevision}, #{routingType}, #{alternativeNo}, #{operationName}, #{operationNo}, #{efficiencyFactor}, #{machRunFactor}, #{machSetupTime}, #{runTimeCode}, #{laborRunFactor}, #{laborSetupTime}, #{crewSize}, #{setupCrewSize}, #{outsideOpItem}, #{machineNo}, #{workCenterNo}, #{laborClassNo}, #{setupLaborClassNo}, #{overlap}, #{noteText}, getDate(), #{createBy})
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 part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo}
delete from plm_routing_component
where site = #{site} 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 part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo}
delete from plm_routing_component
where site = #{site}
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},
setup_crew_size = #{setupCrewSize},
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}
where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo} and operation_id = #{operationId}
update plm_routing_detail
set status = #{status},
update_date = getDate(),
update_by = #{updateBy}
where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo}
INSERT INTO routing_tool
(site, part_no, routing_revision, routing_type, alternative_no, operation_id, tool_id, tool_qty, remark, create_date, create_by)
VALUES
(#{site}, #{partNo}, #{routingRevision}, #{routingType}, #{alternativeNo}, #{operationId}, #{toolId}, #{toolQty}, #{remark}, getDate(), #{createBy})
update routing_tool
set tool_qty = #{toolQty},
remark = #{remark},
update_date = getDate(),
update_by = #{updateBy}
where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo} and operation_id = #{operationId} and tool_id = #{toolId}
delete from routing_tool
where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo} and operation_id = #{operationId} and tool_id = #{toolId}
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}
update plm_routing_header
set phase_out_date = #{phaseOutDate},
update_date = getDate(),
update_by = #{createBy}
where site = #{site} and part_no = #{partNo} and routing_type = #{routingType} and routing_revision = #{routingRevision}
insert into routing_tool
(site, part_no, routing_revision, routing_type, alternative_no, operation_id, tool_id, tool_qty, remark, create_date, create_by) VALUES
(#{item.site}, #{item.partNo}, #{item.routingRevision}, #{item.routingType}, #{item.alternativeNo}, #{item.operationId}, #{item.toolId}, #{item.toolQty}, #{item.remark}, getDate(), #{item.createBy})
insert into plm_routing_work_guide
(site, part_no, routing_revision, routing_type, alternative_no, guideline_seq, guideline_desc, guideline_text, guideline_type, sign_off_required, inspection_sign_off_required, operation_id, create_date, create_by) VALUES
(#{item.site}, #{item.partNo}, #{item.routingRevision}, #{item.routingType}, #{item.alternativeNo}, #{item.guidelineSeq}, #{item.guidelineDesc}, #{item.guidelineText}, #{item.guidelineType}, #{item.signOffRequired}, #{item.inspectionSignOffRequired}, #{item.operationId}, getDate(), #{item.createBy})
delete from routing_tool
where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo} and operation_id = #{operationId}
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} 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}