schangxiang@126.com
2024-09-02 3b3e3bcf1345197670c82988ceb3e8d34be3b5f1
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
namespace iWare.Wms.Application.Mapper
{
    public static class DataHandler
    {
        public static List<DictTreeOutput> Dicts;
 
        private static object lockDicts = new object();
        public static string GetDictForName(string dictcode, object code)
        {
            lock (lockDicts)
            {
                string str = "";
                if (Dicts == null|| code==null || dictcode==null)
                {
                    return str;
                }
                else
                {
                    try
                    {
                        Dicts.ForEach(u =>
                        {
                            if (u.Code == dictcode)
                            {
                                var date = u.Children.Where(o => o.Code.Equals(code.ToString()));
                                if (date != null)
                                {
                                    str = date.FirstOrDefault().Name;
                                }
                                else
                                {
                                    str = code.ToString();
                                }
                            }
                        });
 
                    }
                    catch (Exception ex)
                    {
                        str=  code.ToString();
                    }
                    return str;
                }
            }
        }
    }
}