wangxinhui
2024-11-06 8f392cc88b0768b74efca3b68785cf5aa1c38e70
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
using WIDESEA_Common.DBHelper;
 
namespace WIDESEA_Common.Tools
{
    /// <summary>
    /// 序号管理帮助类
    /// </summary>
    public class IdenxManager
    {
        static FreeDB freeDB = new FreeDB();
        private static object lock_obj = new object();
 
        /// <summary>
        /// 获取任务编号
        /// </summary>
        /// <returns></returns>
        public static int GetTaskNo(string numType = "tasknum")
        {
            lock (lock_obj)
            {
                var oldNo = freeDB.DataBase.Ado.QuerySingle<int>("select taskno from dt_task_number where numtype=@numtype", new { numType });
                freeDB.DataBase.Ado.ExecuteNonQuery("update dt_task_number set taskno=taskno+1 where numtype=@numtype", new { numType });
                return oldNo + 1;
            }
        }
    }
}