ke_junjie
2025-06-04 84620534eb627e95811b971a4b552b6a177829bf
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
using iWareCommon.Utils;
using iWareModel;
using System.Collections.Generic;
using System;
using System.Linq;
 
namespace iWareSda
{
    /// <summary>
    /// 输送线实体类
    /// </summary>
    public static class HuscoLine_CacheEntity
    {
        public static LogType curLogType = LogType.LineSdaService;
 
        #region 输送线
 
        /// <summary>
        /// 写入DB
        /// </summary>
        public static string W_DBHeader = "";
        /// <summary>
        /// 读取DB
        /// </summary>
        public static string R_DBHeader = "C1Sta130.PartData.Track.";
        private static HuscoLineDBForWrite _dbBlockForWrite = new HuscoLineDBForWrite()
        {
            //TODO:这里写配置的DB地址
 
 
        };
        private static HuscoLineDBForRead _dbBlockForRead = new HuscoLineDBForRead()
        {
            //TODO:这里写配置的DB地址
 
 
 
        };
        private static HslCommunicationParam hslCommunicationParam = new HslCommunicationParam()
        {
            ip = WareSdaStruct.HuscoLine_Address,
            port=44818
        };
        private static SS7Param s7Param = null;
        private static PLCService PLCService = PLCFactory.GetOPCService(WareSdaStruct.System_PlcServiceTypeEnum, s7Param, hslCommunicationParam);
        private static HuscoLineEntity line1 = new HuscoLineEntity("HuscoLine", (int)EDevice.堆垛机, _dbBlockForWrite, _dbBlockForRead, PLCService);
 
        #endregion
 
        private static List<HuscoLineEntity> _deviceObjList = null;
        private static object objLock = new object();
 
        /// <summary>
        /// 生成设备实体类
        /// </summary>
        public static List<HuscoLineEntity> DeviceObjs
        {
            get
            {
                if (_deviceObjList == null)
                {
                    lock (objLock)
                    {
                        if (_deviceObjList == null)
                        {
                            _deviceObjList = new List<HuscoLineEntity>();
                            _deviceObjList.Add(line1);
                        }
                    }
                }
                return HuscoLine_CacheEntity._deviceObjList;
            }
            set { HuscoLine_CacheEntity._deviceObjList = value; }
        }
 
        public static T GetDeviceObj<T>(int deviceId)
        {
            var device = HuscoLine_CacheEntity.DeviceObjs.FirstOrDefault(x => x.View.DeviceId == deviceId);
            return (T)(Object)device;
        }
    }
}