select id, task_id, status, next_node_code, next_node_name, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time, factory_code, del_flag from qc_check_unqualified insert into qc_check_unqualified id, task_id, status, type, next_node_code, next_node_name, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time, factory_code, del_flag, requestid, #{id}, #{taskId}, #{status}, #{type}, #{nextNodeCode}, #{nextNodeName}, #{remark}, #{attr1}, #{attr2}, #{attr3}, #{attr4}, #{createBy}, #{createTime}, #{updateBy}, #{updateTime}, #{factoryCode}, #{delFlag}, #{requestid}, insert into qc_check_task( record_id,check_no,income_batch_no,order_no, material_code,material_name,quality,unit, supplier_code,supplier_name,income_time, check_status, create_by,create_time,factory_code,del_flag, check_type,noOk_quality,sample_quality,type_code,order_type ) select #{recordId},concat(check_no,FORMAT(GETDATE(),'HHmmss')),income_batch_no ,order_no , material_code,material_name,quality ,unit , supplier_code,supplier_name,income_time, '0', #{createBy},#{createTime},factory_code,del_flag, check_type,noOk_quality,sample_quality,type_code ,'reCheckCS' from qc_check_task where record_id = #{oldBelongTo} and del_flag = '0' insert qc_check_task_defect( record_id, defect_code,defect_subclass, create_by,create_time, factory_code,del_flag, belong_to,noOk_quality) select REPLACE(NEWID(), '-',''), defect_code,defect_subclass, #{createBy},#{createTime}, factory_code,del_flag, #{belongTo},noOk_quality from qc_check_task_defect where belong_to = #{oldBelongTo} and del_flag = '0' insert into qc_check_task_detail( record_id,belong_to,order_num,rule_name,property_code, check_mode,check_tool,unit_code,check_standard,actual_value, create_by,create_time,factory_code,del_flag, project_id,project_no,type_project_id,defect_code,status ) select REPLACE(NEWID(), '-',''),#{belongTo},order_num,rule_name,property_code, check_mode,check_tool,unit_code,check_standard,actual_value, #{createBy},#{createTime},factory_code,del_flag, project_id,project_no,type_project_id,defect_code,'Y' from qc_check_task_detail where belong_to = #{oldBelongTo} and del_flag = '0' insert into qc_check_task_user( record_id,check_no, check_man_code,check_man_name, create_by,create_time, factory_code,del_flag,belong_to ) select REPLACE(NEWID(), '-',''),check_no, check_man_code,check_man_name, #{createBy},#{createTime}, factory_code,del_flag,#{belongTo} from qc_check_task_user where belong_to = #{oldBelongTo} and del_flag = '0' update qc_check_unqualified task_id = #{taskId}, status = #{status}, next_node_code = #{nextNodeCode}, next_node_name = #{nextNodeName}, remark = #{remark}, attr1 = #{attr1}, attr2 = #{attr2}, attr3 = #{attr3}, attr4 = #{attr4}, create_by = #{createBy}, create_time = #{createTime}, update_by = #{updateBy}, update_time = #{updateTime}, factory_code = #{factoryCode}, del_flag = #{delFlag}, start_man_code = #{startManCode}, requestid = #{requestid}, start_oa_status = #{startOaStatus}, start_oa_msg = #{startOaMsg}, start_man_code = #{startManCode}, start_time = #{startTime}, where id = #{id} update wms_raw_order_in set quality_status = #{checkResult} where order_no = #{orderNo} update pro_order_workorder_batch set qc_status = #{status} where batch_code = #{incomeBatchNo} update wms_product_put set check_status = #{status} where batch_number = #{incomeBatchNo} delete from qc_check_unqualified where id = #{id} delete from qc_check_unqualified where id in #{id}