You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
843 B
C#

2 years ago
using Khd.Core.EntityFramework;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
2 years ago
namespace Khd.Core.Wcs
2 years ago
{
public class SystemData
{
public static long _serialNo { get; set; } = 1;
public static object serialLock = new object();
public static long GetSerialNo(DefaultDbContext dbContext)
{
lock (serialLock)
{
List<long?> list = dbContext.WcsTask.Select(t => t.serialNo).ToList();
while (list.Contains(_serialNo))
{
_serialNo++;
2 years ago
if (_serialNo > 9999)
2 years ago
{
_serialNo = 1;
}
}
return _serialNo;
}
}
2 years ago
2 years ago
}
}