|
|
using iWareCommon.Common.Entity;
|
using iWareDataCore.DEV.Entity;
|
using iWareDataCore.DEV.Service;
|
using iWareDataCore.RBAC.Entity;
|
using iWareDataCore.RBAC.Service;
|
using iWareExcel.EXCEL.Entity;
|
using iWareExcel.EXCEL.Service;
|
using System.Collections.Generic;
|
namespace iWareWms.Code.Common.Entity
|
{
|
/// <summary>
|
/// 系统缓存类
|
/// </summary>
|
public class CacheEntity
|
{
|
private static object FactoryLock = new object();
|
private static object WorkShopLock = new object();
|
private static object WorkCenterLock = new object();
|
private static object CellLock = new object();
|
private static object UnitLock = new object();
|
private static object OpcWcfServiceLock = new object();
|
private static object RedisWcfServiceLock = new object();
|
private static object ContentLock = new object();
|
private static object ShiftLock = new object();
|
private static object ProcessRoutingLock = new object();
|
private static object WorkBookLock = new object();
|
private static object EquipmentLock = new object();
|
private static object ControlCenterWcfServiceLock = new object();
|
|
/// <summary>
|
/// 菜单
|
/// </summary>
|
private static Dictionary<int, ContentEntity> contentDict = null;
|
|
public static Dictionary<int, ContentEntity> ContentDict
|
{
|
get
|
{
|
if (contentDict == null)
|
{
|
lock (ContentLock)
|
{
|
if (contentDict == null)
|
{
|
string msg;
|
contentDict = ContentService.GetInstance().ToDictionary(new QueryParam(), out msg);
|
}
|
}
|
}
|
return contentDict;
|
}
|
set { CacheEntity.contentDict = value; }
|
}
|
|
|
/// <summary>
|
/// 以工作簿的名称为键,工作簿为值的字典
|
/// </summary>
|
private static Dictionary<string, WorkBookEntity> workBookDict = null;
|
|
|
public static Dictionary<string, WorkBookEntity> WorkBookDict
|
{
|
get
|
{
|
if (workBookDict == null)
|
{
|
lock (WorkBookLock)
|
{
|
if (workBookDict == null)
|
{
|
string msg;
|
var workBooks = WorkBookService.GetInstance().QueryByParam(new QueryParam(), out msg);
|
workBookDict = new Dictionary<string, WorkBookEntity>();
|
workBooks.ForEach(x => workBookDict.Add(x.Name, x));
|
}
|
}
|
}
|
return CacheEntity.workBookDict;
|
}
|
set { CacheEntity.workBookDict = value; }
|
}
|
|
|
/// <summary>
|
/// 设备
|
/// </summary>
|
private static Dictionary<int, EquipmentEntity> equipmentDict = null;
|
|
public static Dictionary<int, EquipmentEntity> EquipmentDict
|
{
|
get
|
{
|
if (equipmentDict == null)
|
{
|
lock (EquipmentLock)
|
{
|
if (equipmentDict == null)
|
{
|
string msg;
|
equipmentDict = EquipmentService.GetInstance().ToDictionary(new QueryParam(), out msg);
|
}
|
}
|
}
|
return equipmentDict;
|
}
|
set { CacheEntity.equipmentDict = value; }
|
}
|
|
|
|
|
}
|
}
|