#region 订单号生成(支持每秒1000个并发) private static object locker = new object(); private static int sn = 0; public static string GetOrderNO() { lock (locker) { if (sn == 999) sn = 0; else sn++; return DateTime.Now.ToString("yyMMddHHmmssfff") + sn.ToString().PadLeft(3, '0'); } } #endregion