using iWareCommon.Utils;
using iWareModel;
using System.Collections.Generic;
using System;
using System.Linq;
namespace iWareSda
{
///
/// 输送线实体类
///
public static class HuscoLine_CacheEntity
{
public static LogType curLogType = LogType.LineSdaService;
#region 输送线
///
/// 写入DB
///
public static string W_DBHeader = "";
///
/// 读取DB
///
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 _deviceObjList = null;
private static object objLock = new object();
///
/// 生成设备实体类
///
public static List DeviceObjs
{
get
{
if (_deviceObjList == null)
{
lock (objLock)
{
if (_deviceObjList == null)
{
_deviceObjList = new List();
_deviceObjList.Add(line1);
}
}
}
return HuscoLine_CacheEntity._deviceObjList;
}
set { HuscoLine_CacheEntity._deviceObjList = value; }
}
public static T GetDeviceObj(int deviceId)
{
var device = HuscoLine_CacheEntity.DeviceObjs.FirstOrDefault(x => x.View.DeviceId == deviceId);
return (T)(Object)device;
}
}
}