hn_zw_back_main/Service/Execute/Utils/SwapOrderNoGenerator.cs

20 lines
467 B

namespace Swapping.Business.Common;
public class SwapOrderNoGenerator
{
private static UInt16 Seq = 0;
private static Object Locker = new object();
public static string GenerateOrderNo(string stationNo)
{
lock (Locker)
{
if (Seq > 9999)
{
Seq = 0;
}
return $"{stationNo}{DateTime.Now.ToString("yyyyMMddHHmmss")}{Seq++.ToString().PadLeft(6, '0')}";
}
}
}