using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace IStation.Service { public partial class CustomCronJob { /// /// 创建编号 /// private string CreateNO() { var all = GetAll(); var noList = all.Select(x => x.NO).ToList(); var number = noList.Count + 1; var no = GetFormatNO(number); while (noList.Contains(no)) { number++; no = GetFormatNO(number); } return no; } //获取格式化NO private string GetFormatNO(int number) { return $"CCJ-{number:000000}"; } } }