delete from part_sub_properties_value_header where part_no = #{partNo} and site = #{site} and bu_no = #{buNo} and record_type = #{recordType} delete from part_sub_properties_value where part_no = #{partNo} and site = #{site} and bu_no = #{buNo} and record_type = #{recordType} insert into part_sub_properties_value_header (part_no, site, bu_no, code_no, sub_code_seq_no, sub_code_desc, record_type) select #{partNo}, #{site}, #{buNo}, #{codeNo}, 1, code_desc, #{recordType} from plm_properties_model_header where code_no = #{codeNo} and site = #{site} and bu_no = #{buNo} and function_type = #{recordType} insert into part_sub_properties_value (part_no, site, bu_no, code_no, sub_code_seq_no, sub_code_desc, item_no, properties_item_no, text_value, num_value, record_type) select #{partNo}, #{site}, #{buNo}, #{codeNo}, 1, a.code_desc, b.seq_No, b.properties_item_no, case when c.value_type_db = 'T' then c.default_value else null end, case when c.value_type_db = 'N' and c.default_value != '' then c.default_value else null end, #{recordType} from plm_properties_model_header a left join plm_properties_model_detail b on a.code_no = b.code_no and a.site = b.site and a.bu_no = b.bu_no and a.function_type = b.function_type left join plm_properties_item c on b.properties_item_no = c.item_no and b.site = c.site and b.bu_no = c.bu_no and a.function_type = c.item_type where a.code_no = #{codeNo} and a.site = #{site} and a.bu_no = #{buNo} AND B.site IS NOT NULL AND A.function_type = #{recordType} update part_sub_properties_value set text_value = #{textValue}, num_value = #{numValue, jdbcType=DOUBLE} where properties_item_no = #{propertiesItemNo} and site = #{site} and bu_no = #{buNo} and part_no = #{partNo} and record_type = #{recordType} insert into part_agent (site, part_no, agent_id, bu_no) values (#{site}, #{partNo}, #{agentId}, #{buNo}) delete from part_agent where part_no = #{partNo} and site = #{site} and bu_no = #{buNo} and agent_id = #{agentId} delete from part_agent where part_no = #{partNo} and site = #{site} and agent_id = #{agentId} and bu_no = #{buNo} insert into part_manufacturer (site, part_no, manufacturer_id, bu_no) values (#{site}, #{partNo}, #{manufacturerId}, #{buNo}) delete from part_manufacturer where part_no = #{partNo} and site = #{site} and bu_no = #{buNo} and manufacturer_id = #{manufacturerId} delete from part_manufacturer where part_no = #{partNo} and site = #{site} and manufacturer_id = #{manufacturerId} and bu_no = #{buNo} UPDATE part_sub_properties_value SET text_value = #{textValue}, num_value = #{numValue, jdbcType=DECIMAL} WHERE part_no = #{partNo} and site = #{site} and bu_no = #{buNo} and code_no = #{codeNo} and sub_code_seq_no = #{subCodeSeqNo} and item_no = #{itemNo} and record_type = #{recordType} delete from part_sub_properties_value where part_no = #{partNo} and site = #{site} and bu_no = #{buNo} and record_type = #{recordType} and code_no = #{codeNo} and sub_code_seq_no = #{subCodeSeqNo} and item_no = #{itemNo} insert into part_sub_properties_value (part_no, site, bu_no, code_no, sub_code_seq_no, sub_code_desc, item_no, properties_item_no, text_value, num_value, record_type) values (#{partNo}, #{site}, #{buNo}, #{codeNo}, #{subCodeSeqNo,jdbcType=FLOAT}, #{codeDesc}, #{itemNo, jdbcType=FLOAT}, #{itNo}, #{textValue}, #{numValue, jdbcType=FLOAT}, #{recordType}) delete from part_sub_properties_value where part_no = #{partNo} and site = #{site} and bu_no = #{buNo} and record_type = #{recordType} and code_no = #{codeNo} and sub_code_seq_no = #{subCodeSeqNo} and item_no = #{itemNo} insert into part_location (site, part_no, location_id, bu_no) values (#{site}, #{partNo}, #{locationId}, #{buNo}) delete from part_location where part_no = #{partNo} and site = #{site} and location_id = #{locationId} and bu_no = #{buNo} delete from part_agent where part_no = #{partNo} and site = #{site} delete from part_manufacturer where part_no = #{partNo} and site = #{site} delete from part_location where part_no = #{partNo} and site = #{site} and bu_no = #{buNo} insert into plm_project_part (site, project_id, test_part_no, base_no, rev_no, part_no_source) values (#{site}, #{projectId}, #{partNo}, #{baseNo}, #{revNo}, #{partNoSource}) UPDATE plm_project_part SET final_part_no = #{ifsPartNo}, update_date = getDate(), update_by = #{updateBy} WHERE site = #{site} and test_part_no = #{partNo} insert into plm_customer_part_info (site, customer_no, part_no, customer_part_no, create_date, create_by) values (#{site}, #{customerNo}, #{partNo}, #{customerPartNo}, getDate(), #{createBy}) insert into plm_project_part (site, project_id, test_part_no, create_date, create_by, part_no_source) VALUES (#{item.site}, #{item.projectId}, #{item.partNo}, getDate(), #{item.createBy}, #{item.partNoSource}) insert into plm_customer_part_info (site, customer_no, part_no, customer_part_no, create_date, create_by) VALUES (#{item.site}, #{item.customerNo}, #{item.partNo}, #{item.customerPartNo}, getDate(), #{item.createBy}) delete from plm_bom_header where site = #{site} and part_no = #{partNo} delete from plm_bom_detail where site = #{site} and part_no = #{partNo} delete from plm_bom_component where site = #{site} and part_no = #{partNo} delete from plm_bom_manuf_struct_cost_distrib where site = #{site} and part_no = #{partNo} delete from plm_routing_header where site = #{site} and part_no = #{partNo} delete from plm_routing_detail where site = #{site} and part_no = #{partNo} delete from plm_routing_component where site = #{site} and part_no = #{partNo} delete from routing_tool where site = #{site} and part_no = #{partNo} delete from plm_routing_work_guide where site = #{site} and part_no = #{partNo} insert into part_location (site, part_no, location_id, bu_no) VALUES (#{item.site}, #{item.partNo}, #{item.locationId}, #{item.buNo}) insert into tbl_base_data (site, type, base_data, base_desc, status, remark, third_type, second_type, page_control) values (#{site}, #{type}, #{baseData}, #{baseDesc}, #{status}, #{remark}, #{thirdType}, #{secondType}, #{pageControl}) UPDATE tbl_base_data SET base_data = #{baseData} WHERE site = #{site} and type = #{type} and third_type = #{thirdType} and second_type = #{secondType} insert into part_sub_properties_value (part_no, site, bu_no, code_no, sub_code_seq_no, sub_code_desc, item_no, properties_item_no, text_value, num_value, record_type) select #{partNo}, site, bu_no, code_no, 1, sub_code_desc, item_no, properties_item_no, text_value, num_value, record_type from part_sub_properties_value where site = #{site} and bu_no = #{buNo} and part_no = #{basePartNo} insert into part_sub_properties_value (part_no, site, bu_no, code_no, sub_code_seq_no, sub_code_desc, item_no, properties_item_no, text_value, num_value, record_type) VALUES (#{item.partNo}, #{item.site}, #{item.buNo}, #{item.codeNo}, #{item.subCodeSeqNo,jdbcType=FLOAT}, #{item.subCodeDesc}, #{item.itemNo,jdbcType=FLOAT}, #{item.propertiesItemNo}, #{item.textValue}, #{item.numValue,jdbcType=FLOAT}, #{item.recordType}) insert into part_agent (site, bu_no, part_no, agent_id) VALUES (#{item.site}, #{item.buNo}, #{item.partNo}, #{item.agentId}) insert into part_manufacturer (site, bu_no, part_no, manufacturer_id) VALUES (#{item.site}, #{item.buNo}, #{item.partNo}, #{item.manufacturerId}) update Part set hsCode=#{hsCode},hsCodeDesc=#{hsCodeDesc} where site = #{site} and part_no = #{partNo}