using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RFrameGenerate.Common
{
    /// <summary>
    /// 唯一编号
    /// </summary>
    public class CodeManage
    {
        public static string GetOrderNO()
        {
            int id = System.Threading.Thread.CurrentThread.ManagedThreadId;
            DateTime dt = DateTime.Now;
            string strid = string.Format("{0:D4}", id);

            if (strid.Length > 4)
                throw new Exception("现在下单人数较多,请稍候再试.");

            string no = dt.ToString("yyMMdd#4ffff#3HH#2mm#1ss");//20
            no = no.Replace("#1", strid[strid.Length - 1].ToString());
            no = no.Replace("#2", strid[strid.Length - 2].ToString());
            no = no.Replace("#3", strid[strid.Length - 3].ToString());
            no = no.Replace("#4", strid[strid.Length - 4].ToString());
            System.Threading.Thread.Sleep(10);
            return no;
        }
    }
}
