select id, order_id, doc_no, mainitem_code, mainitem_figure, customer_name, business_type, demand_type, doc_status, item_code, item_figure, item_figure_version, pruduct_qty, work_qty, op_num, work_center, dept, start_date, complete_date, next_dept, is_hold_release, is_out_source, org, page_num, page_index, del_flag, create_by, create_time, update_by, update_time , process_status,org_code, std_op, op_status, next_op_name, low_order_code, order_create_time, approve_on, start_work_date from aps_work_order_job insert into aps_work_order_job order_id, doc_no, mainitem_code, mainitem_figure, customer_name, business_type, demand_type, doc_status, item_code, item_figure, item_figure_version, pruduct_qty, work_qty, op_num, work_center, dept, start_date, complete_date, next_dept, is_hold_release, is_out_source, org, page_num, page_index, del_flag, create_by, create_time, update_by, update_time, org_code, process_status, std_op, op_status, next_op_name, #{orderId}, #{docNo}, #{mainitemCode}, #{mainitemFigure}, #{customerName}, #{businessType}, #{demandType}, #{docStatus}, #{itemCode}, #{itemFigure}, #{itemFigureVersion}, #{pruductQty}, #{workQty}, #{opNum}, #{workCenter}, #{dept}, #{startDate}, #{completeDate}, #{nextDept}, #{isHoldRelease}, #{isOutSource}, #{org}, #{pageNum}, #{pageIndex}, #{delFlag}, #{createBy}, #{createTime}, #{updateBy}, #{updateTime}, #{orgCode}, #{processStatus}, #{stdOp}, #{opStatus}, #{nextOpName}, update aps_work_order_job order_id = #{orderId}, doc_no = #{docNo}, mainitem_code = #{mainitemCode}, mainitem_figure = #{mainitemFigure}, customer_name = #{customerName}, business_type = #{businessType}, demand_type = #{demandType}, doc_status = #{docStatus}, item_code = #{itemCode}, item_figure = #{itemFigure}, item_figure_version = #{itemFigureVersion}, pruduct_qty = #{pruductQty}, work_qty = #{workQty}, op_num = #{opNum}, work_center = #{workCenter}, dept = #{dept}, start_date = #{startDate}, complete_date = #{completeDate}, next_dept = #{nextDept}, is_hold_release = #{isHoldRelease}, is_out_source = #{isOutSource}, org = #{org}, page_num = #{pageNum}, page_index = #{pageIndex}, del_flag = #{delFlag}, create_by = #{createBy}, create_time = #{createTime}, update_by = #{updateBy}, update_time = #{updateTime}, org_code= #{orgCode}, process_status= #{processStatus}, std_op= #{stdOp}, op_status= #{opStatus}, next_op_name= #{nextOpName}, where id = #{id} delete from aps_work_order_job where id = #{id} delete from aps_work_order_job where id in #{id} insert into aps_work_order_job id, order_id, doc_no, mainitem_code, mainitem_figure, customer_name, business_type, demand_type, doc_status, item_code, item_figure, item_figure_version, pruduct_qty, work_qty, op_num, work_center, dept, start_date, complete_date, next_dept, is_hold_release, is_out_source, org, page_num, page_index, del_flag, create_by, create_time, update_by, update_time, org_code, process_status, std_op, op_status, next_op_name, low_order_code, order_create_time, approve_on, start_work_date values ( #{job.id}, #{job.orderId}, #{job.docNo}, #{job.mainitemCode}, #{job.mainitemFigure}, #{job.customerName}, #{job.businessType}, #{job.demandType}, #{job.docStatus}, #{job.itemCode}, #{job.itemFigure}, #{job.itemFigureVersion}, #{job.pruductQty}, #{job.workQty}, #{job.opNum}, #{job.workCenter}, #{job.dept}, #{job.startDate}, #{job.completeDate}, #{job.nextDept}, #{job.isHoldRelease}, #{job.isOutSource}, #{job.org}, #{job.pageNum}, #{job.pageIndex}, #{job.delFlag}, #{job.createBy}, #{job.createTime}, #{job.updateBy}, #{job.updateTime}, #{job.orgCode}, #{job.processStatus}, #{job.stdOp}, #{job.opStatus}, #{job.nextOpName}, #{job.lowOrderCode}, #{job.orderCreateTime}, #{job.approveOn}, #{job.startWorkDate} ) delete from aps_work_order_job where order_id in #{id} update aps_work_order_job set process_status = #{status} where doc_no in #{docNo} delete from aps_part_plan where del_flag in ('0','1') insert into aps_part_plan ( document_number,main_part_number,main_part_drawing_number, customer,business_type,requirement_type, document_status,item_number,drawing_no, version_number,production_quantity,good_products_quantity, process_number,work_center,department, plan_start_day,plan_end_day,next_process_deparment, is_suspended,is_outsourcing,account, id,create_time,del_flag,plant,order_status,std_op,op_status,next_op_name ) select doc_no,mainitem_code,mainitem_figure, customer_name,business_type,demand_type, doc_status,item_code,item_figure, item_figure_version,pruduct_qty,work_qty, op_num,work_center,dept, start_date,complete_date,next_dept, is_hold_release,is_out_source,org_code, order_id,now(),'0',org_code,doc_status,std_op,op_status,next_op_name from aps_work_order_job where ( doc_status in (0,1,2,4) and is_hold_release='0' and (item_code like 'M01%' or item_code like 'M02%'or item_code like 'M05%' or item_code like 'M10%' or item_code like 'M14%'or item_code like 'M15%' or item_code like 'F%' or item_code like 'Z%' ) ); delete from aps_plate_plan where del_flag in ('0','1') insert into aps_plate_plan ( document_number,main_part_number,main_part_drawing_number, customer,business_type,requirement_type, document_status,item_number,drawing_no, version_number,production_quantity,good_products_quantity, process_number,work_center,department, plan_start_day,plan_end_day,next_process_deparment, is_suspended,is_outsourcing,account, id,create_time,del_flag,plant,order_status,std_op,op_status,next_op_name, professional_affiliation,order_create_time,approve_on,start_work_date,low_order_code ) select doc_no,mainitem_code,mainitem_figure, customer_name,business_type,demand_type, doc_status,item_code,item_figure, item_figure_version,pruduct_qty,work_qty, op_num,work_center,dept, start_date,complete_date,next_dept, is_hold_release,is_out_source,org_code, cast(order_id as bigint) as id,now(),'0',org_code,doc_status,std_op,op_status,next_op_name, (case when low_order_code='0' then 'main' else 'sub' end ) as professional_affiliation, order_create_time, approve_on, start_work_date, low_order_code from aps_work_order_job where ( doc_status in (0,1,2,4) and is_hold_release='0' and (item_code like 'M03%' or item_code like 'M04%'or item_code like 'A75%') ); delete from aps_gas_piping_plan where del_flag in ('0','1') insert into aps_gas_piping_plan ( document_number,main_part_number,main_part_drawing_number, customer,business_type,requirement_type, document_status,item_number,drawing_no, version_number,production_quantity,good_products_quantity, process_number,work_center,department, plan_start_day,plan_end_day,next_process_deparment, is_suspended,is_outsourcing,account, id,create_time,del_flag,plant,order_status,std_op,op_status,next_op_name,plan_type, order_create_time, approve_on, start_work_date, low_order_code ) select doc_no,mainitem_code,mainitem_figure, customer_name,business_type,demand_type, doc_status,item_code,item_figure, item_figure_version,pruduct_qty,work_qty, op_num,work_center,dept, start_date,complete_date,next_dept, is_hold_release,is_out_source,org_code, order_id,now(),'0',org_code,doc_status,std_op,op_status,next_op_name, case when substr(item_code,0,4)='A65' then 'gas' else 'piping' end as plan_type, order_create_time, approve_on, start_work_date, low_order_code from aps_work_order_job where ( doc_status in (0,1,2,4) and is_hold_release='0' and (item_code like 'A65%' or item_code like 'W%')); delete from aps_work_order_job where del_flag in ('0','1')