杨前锦
2025-07-01 a93b0e99036c24b9bd58c79bf5e7364b1ba28bae
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
using HH.WCS.Mobox3.ZS7412
    .util;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static HH.WCS.Mobox3.ZS7412.wms.LocationHelper;
 
namespace HH.WCS.Mobox3.ZS7412.wms {
    internal class ItemHelper {
        private static Dictionary<string,ItemInfo > itemInfos = null;
 
        static ItemHelper() {
            try {
                //初始化Location加入到字典缓存
                itemInfos = new Dictionary<string, ItemInfo>();
                var list = GetAllItemList();
                if (list.Count > 0) {
                    list.ForEach(a => {
                        if (!itemInfos.ContainsKey(a.S_ITEM_CODE)) {
                            itemInfos.Add(a.S_ITEM_CODE, a);
                        }
                    });
                }
            }
            catch (Exception ex) {
                Console.WriteLine(ex.Message);
            }
        }
        internal static ItemInfo GetItemInfo(string code) {
            if (itemInfos.ContainsKey(code)) {
                return itemInfos[code];
            }
            else {
                return null;
            }
        }
        internal static List<ItemInfo> GetAllItemList() {
            var db = new SqlHelper<object>().GetInstance();
            return db.Queryable<ItemInfo>().ToList();
        }
 
    }
}