INSERT INTO plm_routing_header (site, part_no, routing_revision, routing_type, note_text, phase_in_date, phase_out_date, create_date, create_by, official_flag) VALUES (#{site}, #{partNo}, #{routingRevision}, #{routingType}, #{noteText}, #{phaseInDate}, #{phaseOutDate}, getDate(), #{createBy}, #{officialFlag}) 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, ifs_row_id, ifs_row_version) 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}, #{ifsRowId}, #{ifsRowVersion}) 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, ifs_row_id, ifs_row_version) VALUES (#{item.site}, #{item.partNo}, #{item.routingRevision}, #{item.routingType}, #{item.alternativeNo}, #{item.operationName}, #{item.operationNo}, #{item.efficiencyFactor}, #{item.machRunFactor}, #{item.machSetupTime}, #{item.runTimeCode}, #{item.laborRunFactor}, #{item.laborSetupTime}, #{item.crewSize}, #{item.setupCrewSize}, #{item.outsideOpItem}, #{item.machineNo}, #{item.workCenterNo}, #{item.laborClassNo}, #{item.setupLaborClassNo}, #{item.overlap}, #{item.noteText}, getDate(), #{item.createBy}, #{item.ifsRowId}, #{item.ifsRowVersion}) update plm_routing_header set phase_in_date = #{phaseInDate}, phase_out_date = #{phaseOutDate}, note_text = #{noteText}, update_date = getDate(), update_by = #{updateBy} where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} 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} delete from plm_routing_header 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}, ifs_row_id = #{ifsRowId}, ifs_row_version = #{ifsRowVersion} 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}) update routing_tool set ifs_row_id = #{ifsRowId}, ifs_row_version = #{ifsRowVersion} where id = #{id} update plm_routing_work_guide set ifs_row_id = #{ifsRowId}, ifs_row_version = #{ifsRowVersion} where id = #{id} 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} update plm_routing_component set ifs_row_id = #{ifsRowId}, ifs_row_version = #{ifsRowVersion} where site = #{contract} and part_no = #{partNo} and routing_type = #{routingType} and routing_revision = #{routingRevision} and alternative_no = #{alternativeNo} and operation_id = #{operationId} update routing_tool set ifs_row_id = #{ifsRowId}, ifs_row_version = #{ifsRowVersion} where id = #{id} update plm_routing_header set official_flag = 'Y' where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} update plm_routing_detail set official_flag = 'Y' where site = #{site} and part_no = #{partNo} and routing_revision = #{routingRevision} and routing_type = #{routingType} and alternative_no = #{alternativeNo} update plm_routing_component set ifs_row_id = #{ifsRowId}, ifs_row_version = #{ifsRowVersion} where site = #{site} and part_no = #{partNo} and routing_type = #{routingType} and routing_revision = #{routingRevision} and alternative_no = #{alternativeNo} and operation_id = #{operationId} DELETE FROM location WHERE location_id = #{item.locationId} AND site = #{item.site} INSERT INTO location (site, location_id, location_name, warehouse_id, active, location_type, ifs_row_version) VALUES (#{item.site}, #{item.locationId}, #{item.locationName}, #{item.warehouseId}, #{item.active}, #{item.locationType}, #{item.ifsRowVersion}) UPDATE location SET location_name = CASE location_id WHEN #{item.locationId} THEN #{item.locationName} ELSE location_name END, active = CASE location_id WHEN #{item.locationId} THEN #{item.active} ELSE active END, warehouse_id = CASE location_id WHEN #{item.locationId} THEN #{item.warehouseId} ELSE warehouse_id END, location_type = CASE location_id WHEN #{item.locationId} THEN #{item.locationType} ELSE location_type END, ifs_row_version = CASE location_id WHEN #{item.locationId} THEN #{item.ifsRowVersion} ELSE ifs_row_version END WHERE location_id IN #{item.locationId} AND site = #{list[0].site} DELETE FROM labor_class WHERE level_id = #{item.levelId} AND site = #{item.site} INSERT INTO labor_class (site, level_id, level_desc, level_cost, active, ifs_row_version) VALUES (#{item.site}, #{item.levelId}, #{item.levelDesc}, #{item.levelCost}, #{item.active}, #{item.ifsRowVersion}) UPDATE labor_class SET level_desc = CASE level_id WHEN #{item.levelId} THEN #{item.levelDesc} ELSE level_desc END, active = CASE level_id WHEN #{item.levelId} THEN #{item.active} ELSE active END, level_cost = CASE level_id WHEN #{item.levelId} THEN #{item.levelCost} ELSE level_cost END, ifs_row_version = CASE level_id WHEN #{item.levelId} THEN #{item.ifsRowVersion} ELSE ifs_row_version END WHERE level_id IN #{item.levelId} AND site = #{list[0].site} DELETE FROM work_center WHERE work_center_no = #{item.workCenterNo} AND site = #{item.site} INSERT INTO work_center (site, work_center_no, work_center_desc, work_center_type_db, work_center_type, average_capacity, efficiency, utilization, capacity_type_db, capacity_type, um_id, active, remark, pro_line_no, can_create_new_roll_flag, need_setup_flag, ifs_row_version) VALUES (#{item.site}, #{item.workCenterNo}, #{item.workCenterDesc}, #{item.workCenterTypeDB}, #{item.workCenterType}, #{item.averageCapacity,jdbcType=DECIMAL}, #{item.efficiency,jdbcType=DECIMAL}, #{item.utilization,jdbcType=DECIMAL}, #{item.capacityTypeDB}, #{item.capacityType}, #{item.umId}, #{item.active}, #{item.remark}, #{item.proLineNo}, #{item.canCreateNewRollFlag}, #{item.needSetupFlag}, #{item.ifsRowVersion}) UPDATE work_center SET work_center_desc = CASE work_center_no WHEN #{item.workCenterNo} THEN #{item.workCenterDesc} ELSE work_center_desc END, work_center_type_db = CASE work_center_no WHEN #{item.workCenterNo} THEN #{item.workCenterTypeDB} ELSE work_center_type_db END, work_center_type = CASE work_center_no WHEN #{item.workCenterNo} THEN #{item.workCenterType} ELSE work_center_type END, average_capacity = CASE work_center_no WHEN #{item.workCenterNo} THEN #{item.averageCapacity,jdbcType=DECIMAL} ELSE average_capacity END, efficiency = CASE work_center_no WHEN #{item.workCenterNo} THEN #{item.efficiency,jdbcType=DECIMAL} ELSE efficiency END, utilization = CASE work_center_no WHEN #{item.workCenterNo} THEN #{item.utilization,jdbcType=DECIMAL} ELSE utilization END, capacity_type_db = CASE work_center_no WHEN #{item.workCenterNo} THEN #{item.capacityTypeDB} ELSE capacity_type_db END, capacity_type = CASE work_center_no WHEN #{item.workCenterNo} THEN #{item.capacityType} ELSE capacity_type END, um_id = CASE work_center_no WHEN #{item.workCenterNo} THEN #{item.umId} ELSE um_id END, active = CASE work_center_no WHEN #{item.workCenterNo} THEN #{item.active} ELSE active END, remark = CASE work_center_no WHEN #{item.workCenterNo} THEN #{item.remark} ELSE remark END, pro_line_no = CASE work_center_no WHEN #{item.workCenterNo} THEN #{item.proLineNo} ELSE pro_line_no END, can_create_new_roll_flag = CASE work_center_no WHEN #{item.workCenterNo} THEN #{item.canCreateNewRollFlag} ELSE can_create_new_roll_flag END, need_setup_flag = CASE work_center_no WHEN #{item.workCenterNo} THEN #{item.needSetupFlag} ELSE need_setup_flag END, ifs_row_version = CASE work_center_no WHEN #{item.workCenterNo} THEN #{item.ifsRowVersion} ELSE ifs_row_version END WHERE work_center_no IN #{item.workCenterNo} AND site = #{list[0].site} INSERT INTO work_center_cost (site, work_center_no, item_no, unit_cost, overhead1_cost, overhead2_cost, um_id, begin_date, end_date, remark, current_work_center_cost, ifs_row_id, ifs_row_version, cost_set, cost_set_desc, wc_rate, wc_cost_code, overhead1_fac, overhead2_fac, overhead1_appl, overhead2_appl) VALUES (#{item.site}, #{item.workCenterNo}, #{item.itemNo,jdbcType=FLOAT}, #{item.unitCost,jdbcType=FLOAT}, #{item.overhead1Cost,jdbcType=FLOAT}, #{item.overhead2Cost,jdbcType=FLOAT}, #{item.umId}, #{item.beginDate,jdbcType=DATE}, #{item.endDate,jdbcType=DATE}, #{item.remark}, #{item.currentWorkCenterCost,jdbcType=DECIMAL}, #{item.ifsRowId}, #{item.ifsRowVersion}, #{item.costSet}, #{item.costSetDesc}, #{item.wcRate}, #{item.wcCostCode}, #{item.overhead1Fac}, #{item.overhead2Fac}, #{item.overhead1Appl}, #{item.overhead2Appl}) UPDATE work_center_cost SET item_no = CASE ifs_row_id WHEN #{item.ifsRowId} THEN #{item.itemNo,jdbcType=FLOAT} ELSE item_no END, unit_cost = CASE ifs_row_id WHEN #{item.ifsRowId} THEN #{item.unitCost,jdbcType=FLOAT} ELSE unit_cost END, overhead1_cost = CASE ifs_row_id WHEN #{item.ifsRowId} THEN #{item.overhead1Cost,jdbcType=FLOAT} ELSE overhead1_cost END, overhead2_cost = CASE ifs_row_id WHEN #{item.ifsRowId} THEN #{item.overhead2Cost,jdbcType=FLOAT} ELSE overhead2_cost END, um_id = CASE ifs_row_id WHEN #{item.ifsRowId} THEN #{item.umId} ELSE um_id END, begin_date = CASE ifs_row_id WHEN #{item.ifsRowId} THEN #{item.beginDate} ELSE begin_date END, end_date = CASE ifs_row_id WHEN #{item.ifsRowId} THEN #{item.endDate} ELSE end_date END, remark = CASE ifs_row_id WHEN #{item.ifsRowId} THEN #{item.remark} ELSE remark END, current_work_center_cost = CASE ifs_row_id WHEN #{item.ifsRowId} THEN #{item.currentWorkCenterCost} ELSE current_work_center_cost END, ifs_row_version = CASE ifs_row_id WHEN #{item.ifsRowId} THEN #{item.ifsRowVersion} ELSE ifs_row_version END, cost_set = CASE ifs_row_id WHEN #{item.ifsRowId} THEN #{item.costSet} ELSE cost_set END, cost_set_desc = CASE ifs_row_id WHEN #{item.ifsRowId} THEN #{item.costSetDesc} ELSE cost_set_desc END, wc_rate = CASE ifs_row_id WHEN #{item.ifsRowId} THEN #{item.wcRate} ELSE wc_rate END, wc_cost_code = CASE ifs_row_id WHEN #{item.ifsRowId} THEN #{item.wcCostCode} ELSE wc_cost_code END, overhead1_fac = CASE ifs_row_id WHEN #{item.ifsRowId} THEN #{item.overhead1Fac} ELSE overhead1_fac END, overhead2_fac = CASE ifs_row_id WHEN #{item.ifsRowId} THEN #{item.overhead2Fac} ELSE overhead2_fac END, overhead1_appl = CASE ifs_row_id WHEN #{item.ifsRowId} THEN #{item.overhead1Appl} ELSE overhead1_appl END, overhead2_appl = CASE ifs_row_id WHEN #{item.ifsRowId} THEN #{item.overhead2Appl} ELSE overhead2_appl END WHERE ifs_row_id IN #{item.ifsRowId} INSERT INTO plm_routing_header (site, part_no, routing_revision, routing_type, note_text, phase_in_date, phase_out_date, create_date, create_by, official_flag) VALUES (#{item.site}, #{item.partNo}, #{item.routingRevision}, #{item.routingType}, #{item.noteText}, #{item.phaseInDate}, #{item.phaseOutDate}, getDate(), #{item.createBy}, #{item.officialFlag}) 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 (#{item.site}, #{item.partNo}, #{item.routingRevision}, #{item.routingType}, #{item.alternativeNo}, #{item.alternativeDescription}, #{item.fixedLeadTimeDay}, #{item.fixedLeadTimeHour}, #{item.variableLeadTimeDay}, #{item.variableLeadTimeHour}, #{item.forStdLotByDay}, #{item.forLotByDay}, #{item.minLotQty}, #{item.detailNoteText}, getDate(), #{item.createBy}, #{item.status}, #{item.officialFlag}) TRUNCATE TABLE work_center_cost