schangxiang@126.com
2024-04-26 6e6b156bb0100043214c170d7171eb79e0d7e344
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace Admin.NET.Core
{
    /// <summary>
    /// 公共方法
    /// </summary>
    public static class SysCommUtil
    {
        /// <summary>
        /// 生成出入库单号流水
        /// </summary>
        /// <param name="maxInvoiceNumber"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public static string GenerateNewInvoiceNumber(string maxInvoiceNumber,int type)
        {
 
            if (string.IsNullOrEmpty(maxInvoiceNumber))
            {
                string today = DateTime.Today.ToString("yyyyMMdd");
                //判断是入库还是出库
                if (type == 1)
                {
                    return "RUKU" + today + "0001";
                }
                else
                {
                    return "CHUKU" + today + "0001";
                }
         
            }
            else
            {
                var before = maxInvoiceNumber.Substring(0, 12);
                var queen = maxInvoiceNumber.Substring(12);
                int maxNumber = int.Parse(queen);
                return before + (maxNumber+1).ToString("D4");
            }
        }
 
        /// <summary>
        /// 验证日期查询范围字符串数组是否符合查询值
        /// </summary>
        /// <param name="list"></param>
        /// <returns>true:符合查询值,false:不符合查询值</returns>
        public static bool ValidateListForQueryTimeArray(List<string> list)
        {
            if (list == null) return false;
            if (list.Count != 2) return false;
            if (string.IsNullOrEmpty(list[0]) || string.IsNullOrEmpty(list[1])) return false;
            return true;
        }
    }
}