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;
|
}
|
}
|
}
|