using iWareOpc.Opc.Service; using iWareOpc.Properties; using OpcAccess.Access.Entity; using OpcAccess.Access.Service; using System.Collections.Generic; namespace iWareOpc.Cache.Entity { public class CacheEntity { private static object dbNameGroupDictLock = new object(); private static Dictionary dbNameGroupDict = null; public static Dictionary DbNameGroupDict { get { if (dbNameGroupDict == null) { lock(dbNameGroupDictLock) { if (dbNameGroupDict == null) { dbNameGroupDict = new Dictionary { //stacker1 {"S7:[S7_Connection_1]DB540,W2","OPC1"},// 1Srm编号 {"S7:[S7_Connection_1]DB540,W34","OPC1"},// 2任务号 {"S7:[S7_Connection_1]DB540,W6","OPC1"},// 3源列 {"S7:[S7_Connection_1]DB540,W8","OPC1"},// 4源层 {"S7:[S7_Connection_1]DB540,W10","OPC1"},//5源排 {"S7:[S7_Connection_1]DB540,W12","OPC1"},// 6宿列 {"S7:[S7_Connection_1]DB540,W14","OPC1"},// 7宿层 {"S7:[S7_Connection_1]DB540,W16","OPC1"},// 8宿排 {"S7:[S7_Connection_1]DB540,W18","OPC1"},// 9发送命令 {"S7:[S7_Connection_1]DB540,W20","OPC1"},// 10紧急停止 {"S7:[S7_Connection_1]DB540,W22","OPC1"},// 11解除告警 {"S7:[S7_Connection_1]DB540,W30","OPC1"},// 12WCS通讯位 {"S7:[S7_Connection_1]DB540,W32","OPC1"},// 13SRM 应答位 {"S7:[S7_Connection_1]DB540,W0","OPC1"},// 14心跳 {"S7:[S7_Connection_1]DB540,W4","OPC1"},// 15批次 {"S7:[S7_Connection_1]DB541,W2","OPC1"},// 1Srm编号 {"S7:[S7_Connection_1]DB541,W4","OPC1"},// 2模式 {"S7:[S7_Connection_1]DB541,W6","OPC1"},// 3告警 {"S7:[S7_Connection_1]DB541,W8","OPC1"},// 4载货工位是否有货 {"S7:[S7_Connection_1]DB541,W10","OPC1"},// 5当前列 {"S7:[S7_Connection_1]DB541,W12","OPC1"},// 6当前层 {"S7:[S7_Connection_1]DB541,W14","OPC1"},// 7货叉位置 {"S7:[S7_Connection_1]DB541,DINT16","OPC1"},// 8当前列坐标 {"S7:[S7_Connection_1]DB541,DINT20","OPC1"},// 9当前层坐标 {"S7:[S7_Connection_1]DB541,DINT24","OPC1"}, //10当前货叉坐标 {"S7:[S7_Connection_1]DB541,W28","OPC1"},//11完成取货信号 {"S7:[S7_Connection_1]DB541,W30","OPC1"},// 12完成放货信号 {"S7:[S7_Connection_1]DB541,W32","OPC1"},// 13任务完成 {"S7:[S7_Connection_1]DB541,W48","OPC1"},// 14当前任务号 {"S7:[S7_Connection_1]DB541,W36","OPC1"},// 15当前任务执行状态 {"S7:[S7_Connection_1]DB541,W38","OPC1"},// 16当前巷道号 {"S7:[S7_Connection_1]DB541,W40","OPC1"},// 17告警代码 {"S7:[S7_Connection_1]DB541,W0","OPC1"},// 18心跳 }; } } } return CacheEntity.dbNameGroupDict; } set { CacheEntity.dbNameGroupDict = value; } } private static object OpcAccessServiceLock = new object(); /// /// 获取opc服务 /// private static OpcAccessService opcAccessService = null; public static OpcAccessService OpcAccessService { get { if (opcAccessService == null) { lock (OpcAccessServiceLock) { if (opcAccessService == null) { var groups = new List() { new OpcGroupEntity { Name = "OPC1", Items = new List { //stacker1 new OpcItemEntity {Db = "S7:[S7_Connection_1]DB540,W2"},// 1Srm编号 new OpcItemEntity {Db = "S7:[S7_Connection_1]DB540,W34"},// 2任务号 new OpcItemEntity {Db = "S7:[S7_Connection_1]DB540,W6"},// 3源列 new OpcItemEntity {Db = "S7:[S7_Connection_1]DB540,W8"},// 4源层 new OpcItemEntity {Db = "S7:[S7_Connection_1]DB540,W10"},//5源排 new OpcItemEntity {Db = "S7:[S7_Connection_1]DB540,W12"},// 6宿列 new OpcItemEntity {Db = "S7:[S7_Connection_1]DB540,W14"},// 7宿层 new OpcItemEntity {Db = "S7:[S7_Connection_1]DB540,W16"},// 8宿排 new OpcItemEntity {Db = "S7:[S7_Connection_1]DB540,W18"},// 9发送命令 new OpcItemEntity {Db = "S7:[S7_Connection_1]DB540,W20"},// 10紧急停止 new OpcItemEntity {Db = "S7:[S7_Connection_1]DB540,W22"},// 11解除告警 new OpcItemEntity {Db = "S7:[S7_Connection_1]DB540,W30"},// 12WCS通讯位 new OpcItemEntity {Db = "S7:[S7_Connection_1]DB540,W32"},// 13SRM 应答位 new OpcItemEntity {Db = "S7:[S7_Connection_1]DB540,W0"},// 14心跳 new OpcItemEntity {Db = "S7:[S7_Connection_1]DB540,W4"},// 15批次 new OpcItemEntity {Db = "S7:[S7_Connection_1]DB541,W2"},// 1Srm编号 new OpcItemEntity {Db = "S7:[S7_Connection_1]DB541,W4"},// 2模式 new OpcItemEntity {Db = "S7:[S7_Connection_1]DB541,W6"},// 3告警 new OpcItemEntity {Db = "S7:[S7_Connection_1]DB541,W8"},// 4载货工位是否有货 new OpcItemEntity {Db = "S7:[S7_Connection_1]DB541,W10"},// 5当前列 new OpcItemEntity {Db = "S7:[S7_Connection_1]DB541,W12"},// 6当前层 new OpcItemEntity {Db = "S7:[S7_Connection_1]DB541,W14"},// 7货叉位置 new OpcItemEntity {Db = "S7:[S7_Connection_1]DB541,DINT16"},// 8当前列坐标 new OpcItemEntity {Db = "S7:[S7_Connection_1]DB541,DINT20"},// 9当前层坐标 new OpcItemEntity {Db = "S7:[S7_Connection_1]DB541,DINT24"}, //10当前货叉坐标 new OpcItemEntity {Db = "S7:[S7_Connection_1]DB541,W28"},//11完成取货信号 new OpcItemEntity {Db = "S7:[S7_Connection_1]DB541,W30"},// 12完成放货信号 new OpcItemEntity {Db = "S7:[S7_Connection_1]DB541,W32"},// 13任务完成 new OpcItemEntity {Db = "S7:[S7_Connection_1]DB541,W48"},// 14当前任务号 new OpcItemEntity {Db = "S7:[S7_Connection_1]DB541,W36"},// 15当前任务执行状态 new OpcItemEntity {Db = "S7:[S7_Connection_1]DB541,W38"},// 16当前巷道号 new OpcItemEntity {Db = "S7:[S7_Connection_1]DB541,W40"},// 17告警代码 new OpcItemEntity {Db = "S7:[S7_Connection_1]DB541,W0"},// 18心跳 }}, }; opcAccessService = OpcService.GetInstance().GetOpcAccessService("192.168.1.200", groups);//Resources.OpcIp } } } return CacheEntity.opcAccessService; } set { CacheEntity.opcAccessService = value; } } } }