lixiaojun
2022-08-18 9d0a6e97890b44f2b71d2425684082100bed07a9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace IStation.Service
{
    public partial class CustomRealJob 
    {
        /// <summary>
        /// 创建编号
        /// </summary>
        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 $"CRJ-{number:000000}";
        }
 
    }
}