limit #{page.pageOffset} , #{page.rows} select Site_code, ID, Produce_Code, Material_Code, Material_Desc, Plan_Date, Plan_Number, Unit, COALESCE(Out_Number, 0) as Out_Number , Loc_Code, Loc_Desc, Production_Line_Desc, Production_Line_Code, Order_Status, User_Defined1, User_Defined2, User_Defined3, User_Defined4, User_Defined5, User_Defined6, User_Defined7, User_Defined8, User_Defined9, User_Defined10, User_Defined11, Supplier_Code, Supplier_Name, Create_By, Create_Date, Last_Update_By, Last_Update_Date, Active, Enterprise_Id, Enterprise_Code from ods_procure_out_order insert into ods_procure_out_order Site_code, ID, Produce_Code, Material_Code, Material_Desc, Plan_Date, Plan_Number, Unit, Out_Number, Loc_Code, Loc_Desc, Production_Line_Desc, Production_Line_Code, Order_Status, User_Defined1, User_Defined2, User_Defined3, User_Defined4, User_Defined5, User_Defined6, User_Defined7, User_Defined8, User_Defined9, User_Defined10, User_Defined11, Supplier_Code, Supplier_Name, Create_By, Create_Date, Last_Update_By, Last_Update_Date, Active, Enterprise_Id, Enterprise_Code, #{siteCode}, #{ID}, #{produceCode}, #{materialCode}, #{materialDesc}, #{planDate}, #{planNumber}, #{Unit}, #{outNumber}, #{locCode}, #{locDesc}, #{productionLineDesc}, #{productionLineCode}, #{orderStatus}, #{userDefined1}, #{userDefined2}, #{userDefined3}, #{userDefined4}, #{userDefined5}, #{userDefined6}, #{userDefined7}, #{userDefined8}, #{userDefined9}, #{userDefined10}, #{userDefined11}, #{supplierCode}, #{supplierName}, #{createBy}, #{createDate}, #{lastUpdateBy}, #{lastUpdateDate}, #{Active}, #{enterpriseId}, #{enterpriseCode}, update ods_procure_out_order Site_code = #{siteCode}, Produce_Code = #{produceCode}, Material_Code = #{materialCode}, Material_Desc = #{materialDesc}, Plan_Date = #{planDate}, Plan_Number = #{planNumber}, Unit = #{Unit}, Out_Number = #{outNumber}, Loc_Code = #{locCode}, Loc_Desc = #{locDesc}, Production_Line_Desc = #{productionLineDesc}, Production_Line_Code = #{productionLineCode}, Order_Status = #{orderStatus}, User_Defined1 = #{userDefined1}, User_Defined2 = #{userDefined2}, User_Defined3 = #{userDefined3}, User_Defined4 = #{userDefined4}, User_Defined5 = #{userDefined5}, User_Defined6 = #{userDefined6}, User_Defined7 = #{userDefined7}, User_Defined8 = #{userDefined8}, User_Defined9 = #{userDefined9}, User_Defined10 = #{userDefined10}, User_Defined11 = #{userDefined11}, Supplier_Code = #{supplierCode}, Supplier_Name = #{supplierName}, Create_By = #{createBy}, Create_Date = #{createDate}, Last_Update_By = #{lastUpdateBy}, Last_Update_Date = #{lastUpdateDate}, Active = #{Active}, Enterprise_Id = #{enterpriseId}, Enterprise_Code = #{enterpriseCode}, where ID = #{ID} delete from ods_procure_out_order where ID = #{ID} delete from ods_procure_out_order where ID in #{ID} insert into wms_raw_mission_out(id, prd_order, material_code, material_desc, unit, user_defined1, sn, amount, origin_location, factory_code, active_flag, create_by, gmt_create )values ( #{ID}, #{produceCode}, #{materialCode}, #{materialDesc}, #{Unit}, #{userDefined1}, #{sn}, #{planNumber}, #{locCode}, #{factoryCode}, #{Active}, #{createBy}, #{createDate} ) update ods_procure_out_order set User_Defined10 = #{userDefined10}, User_Defined9 = #{userDefined9}, User_Defined11 = #{userDefined11} where ID = #{ID} update ods_procure_out_order set User_Defined10 = #{order.userDefined10}, User_Defined9 = #{order.userDefined9}, User_Defined11 = #{order.userDefined11} where ID in #{item.ID}