|
@@ -16,46 +16,7 @@ namespace WCS.WorkEngineering
|
|
|
|
|
|
public ProtocolProxy(Device dev, ProtocolInfo info, Type protocolType, World world) : base(dev, info, protocolType, world)
|
|
|
{
|
|
|
- #region 初始化Redis连接
|
|
|
-
|
|
|
- var redisConnectionStrings = RedisHub.Default.Check("RedisConnectionStrings") ?? throw new Exception("请在Redis中配置RedisConnectionStrings");
|
|
|
- var configs = JsonConvert.DeserializeObject<List<DataBaseConnectionString>>(redisConnectionStrings);
|
|
|
- if (configs != null)
|
|
|
- {
|
|
|
- if (configs.All(v => v.Key != "Monitor")) throw new Exception("请在RedisConnectionStrings中配置监控RedisDB库连接字符串");
|
|
|
- }
|
|
|
-
|
|
|
- foreach (var redisConnection in configs!)
|
|
|
- {
|
|
|
- RedisHub.CreateContext(redisConnection.ConnectionString, redisConnection.Key);
|
|
|
- switch (redisConnection.Key)
|
|
|
- {
|
|
|
- case "Monitor":
|
|
|
- RedisHub.SetMonitorContextType(redisConnection.Key);
|
|
|
- RedisHub.Monitor.Serialize = obj =>
|
|
|
- {
|
|
|
- var bytes = MessagePackSerializer.Serialize(obj);
|
|
|
- return bytes;
|
|
|
- };
|
|
|
- RedisHub.Monitor.DeserializeRaw = (bytes, type) =>
|
|
|
- {
|
|
|
- var obj = MessagePackSerializer.Deserialize(type, bytes);
|
|
|
- return obj;
|
|
|
- };
|
|
|
- break;
|
|
|
-
|
|
|
- case "DebugRedisUrl":
|
|
|
- RedisHub.SetDebugContextType(redisConnection.Key);
|
|
|
- Configs.DebugRedisUrl = redisConnection.ConnectionString;
|
|
|
- break;
|
|
|
-
|
|
|
- case "WMS":
|
|
|
- RedisHub.SetWMSContextType(redisConnection.Key);
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- #endregion 初始化Redis连接
|
|
|
+
|
|
|
}
|
|
|
|
|
|
protected override void DataChanged()
|
|
@@ -79,10 +40,10 @@ namespace WCS.WorkEngineering
|
|
|
{
|
|
|
if (!datas.ContainsKey(Device.Code)) datas[Device.Code] = new SRMData { Code = Device.Code };
|
|
|
}
|
|
|
- else if (Device.Code.Contains("Truss"))
|
|
|
- {
|
|
|
- if (!datas.ContainsKey(Device.Code)) datas[Device.Code] = new TrussData() { Code = Device.Code };
|
|
|
- }
|
|
|
+ //else if (Device.Code.Contains("Truss"))
|
|
|
+ //{
|
|
|
+ // if (!datas.ContainsKey(Device.Code)) datas[Device.Code] = new TrussData() { Code = Device.Code };
|
|
|
+ //}
|
|
|
else if (Device.Code.Contains("Robot"))
|
|
|
{
|
|
|
if (!datas.ContainsKey(Device.Code)) datas[Device.Code] = new RobotData() { Code = Device.Code };
|