|
@@ -36,10 +36,11 @@ namespace WCS.Service.Extensions
|
|
|
/// <param name="act"></param>
|
|
|
public void EX(Action<StationDeviceGroup> act)
|
|
|
{
|
|
|
+ var key = $"WCS:Lock:{Entity.CODE}";
|
|
|
try
|
|
|
{
|
|
|
- if (ExDevice.Any(v => v == Entity.CODE)) throw new WarnException($"[{Entity.CODE}]--触发并发管控");
|
|
|
- OperateExDevice(Entity.CODE);
|
|
|
+ if (ProtocolProxy.YG150Redis.Get(key) != null) throw new WarnException($"[{Entity.CODE}]--触发并发管控");
|
|
|
+ ProtocolProxy.YG150Redis.Set(key, Entity.CODE);
|
|
|
act(this);
|
|
|
}
|
|
|
catch (DoException ex)
|
|
@@ -56,7 +57,7 @@ namespace WCS.Service.Extensions
|
|
|
}
|
|
|
finally
|
|
|
{
|
|
|
- OperateExDevice(Entity.CODE);
|
|
|
+ ProtocolProxy.YG150Redis.Del(key);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -266,10 +267,12 @@ namespace WCS.Service.Extensions
|
|
|
/// <param name="act"></param>
|
|
|
public void EX(Action<StationDevice> act)
|
|
|
{
|
|
|
+ var key = $"WCS:Lock:{Entity.CODE}";
|
|
|
+
|
|
|
try
|
|
|
{
|
|
|
- if (ExDevice.Any(v => v == Entity.CODE)) throw new WarnException($"[{Entity.CODE}]--触发并发管控");
|
|
|
- OperateExDevice(Entity.CODE);
|
|
|
+ if (ProtocolProxy.YG150Redis.Get(key) != null) throw new WarnException($"[{Entity.CODE}]--触发并发管控");
|
|
|
+ ProtocolProxy.YG150Redis.Set(key, Entity.CODE);
|
|
|
act(this);
|
|
|
}
|
|
|
catch (DoException ex)
|
|
@@ -286,7 +289,7 @@ namespace WCS.Service.Extensions
|
|
|
}
|
|
|
finally
|
|
|
{
|
|
|
- OperateExDevice(Entity.CODE);
|
|
|
+ ProtocolProxy.YG150Redis.Del(key);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -362,10 +365,12 @@ namespace WCS.Service.Extensions
|
|
|
/// <param name="act"></param>
|
|
|
public void EX(Action<RGVDevice> act)
|
|
|
{
|
|
|
+ var key = $"WCS:Lock:{Entity.CODE}";
|
|
|
+
|
|
|
try
|
|
|
{
|
|
|
- if (ExDevice.Any(v => v == Entity.CODE)) throw new WarnException($"[{Entity.CODE}]--触发并发管控");
|
|
|
- OperateExDevice(Entity.CODE);
|
|
|
+ if (ProtocolProxy.YG150Redis.Get(key) != null) throw new WarnException($"[{Entity.CODE}]--触发并发管控");
|
|
|
+ ProtocolProxy.YG150Redis.Set(key, Entity.CODE);
|
|
|
act(this);
|
|
|
}
|
|
|
catch (DoException ex)
|
|
@@ -382,7 +387,7 @@ namespace WCS.Service.Extensions
|
|
|
}
|
|
|
finally
|
|
|
{
|
|
|
- OperateExDevice(Entity.CODE);
|
|
|
+ ProtocolProxy.YG150Redis.Del(key);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -668,10 +673,12 @@ namespace WCS.Service.Extensions
|
|
|
/// <param name="act"></param>
|
|
|
public void EX(Action<SRMDevice> act)
|
|
|
{
|
|
|
+ var key = $"WCS:Lock:{Entity.CODE}";
|
|
|
+
|
|
|
try
|
|
|
{
|
|
|
- if (ExDevice.Any(v => v == Entity.CODE)) throw new WarnException($"[{Entity.CODE}]--触发并发管控");
|
|
|
- OperateExDevice(Entity.CODE);
|
|
|
+ if (ProtocolProxy.YG150Redis.Get(key) != null) throw new WarnException($"[{Entity.CODE}]--触发并发管控");
|
|
|
+ ProtocolProxy.YG150Redis.Set(key, Entity.CODE);
|
|
|
act(this);
|
|
|
}
|
|
|
catch (DoException ex)
|
|
@@ -688,7 +695,7 @@ namespace WCS.Service.Extensions
|
|
|
}
|
|
|
finally
|
|
|
{
|
|
|
- OperateExDevice(Entity.CODE);
|
|
|
+ ProtocolProxy.YG150Redis.Del(key);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -698,36 +705,36 @@ namespace WCS.Service.Extensions
|
|
|
/// <param name="act"></param>
|
|
|
public void EXOutStock(Action<SRMDevice> act)
|
|
|
{
|
|
|
+ var key = "WCS:Lock:";
|
|
|
try
|
|
|
{
|
|
|
- var code = "";
|
|
|
if (Entity.CODE == "SRM3" || Entity.CODE == "SRM4")
|
|
|
{
|
|
|
- code = "SRM3-SRM4-Out";
|
|
|
- if (ExDevice.Any(v => v == code)) throw new WarnException($"触发出库并发管控--[{code}]");
|
|
|
- OperateExDevice(code);
|
|
|
+ key += "SRM3-SRM4-Out";
|
|
|
+ if (ProtocolProxy.YG150Redis.Get(key) != null) throw new WarnException($"触发出库并发管控--[{Entity.CODE}]");
|
|
|
+ ProtocolProxy.YG150Redis.Set(key, Entity.CODE);
|
|
|
}
|
|
|
if (Entity.CODE == "SRM5" || Entity.CODE == "SRM6")
|
|
|
{
|
|
|
- code = "SRM5-SRM6-Out";
|
|
|
- if (ExDevice.Any(v => v == code)) throw new WarnException($"触发出库并发管控--[{code}]");
|
|
|
- OperateExDevice(code);
|
|
|
+ key += "SRM5-SRM6-Out";
|
|
|
+ if (ProtocolProxy.YG150Redis.Get(key) != null) throw new WarnException($"触发出库并发管控--[{Entity.CODE}]");
|
|
|
+ ProtocolProxy.YG150Redis.Set(key, Entity.CODE);
|
|
|
}
|
|
|
|
|
|
if (Entity.CODE == "SRM7" || Entity.CODE == "SRM8")
|
|
|
{
|
|
|
- code = "SRM7-SRM8-Out";
|
|
|
- if (ExDevice.Any(v => v == code)) throw new WarnException($"触发出库并发管控--[{code}]");
|
|
|
- OperateExDevice(code);
|
|
|
+ key += "SRM7-SRM8-Out";
|
|
|
+ if (ProtocolProxy.YG150Redis.Get(key) != null) throw new WarnException($"触发出库并发管控--[{Entity.CODE}]");
|
|
|
+ ProtocolProxy.YG150Redis.Set(key, Entity.CODE);
|
|
|
}
|
|
|
|
|
|
act(this);
|
|
|
}
|
|
|
finally
|
|
|
{
|
|
|
- if (Entity.CODE == "SRM3" || Entity.CODE == "SRM4") OperateExDevice("SRM3-SRM4-Out");
|
|
|
- if (Entity.CODE == "SRM5" || Entity.CODE == "SRM6") OperateExDevice("SRM5-SRM6-Out");
|
|
|
- if (Entity.CODE == "SRM7" || Entity.CODE == "SRM8") OperateExDevice("SRM7-SRM8-Out");
|
|
|
+ if (Entity.CODE == "SRM3" || Entity.CODE == "SRM4") ProtocolProxy.YG150Redis.Del($"{key}SRM3-SRM4-Out");
|
|
|
+ if (Entity.CODE == "SRM5" || Entity.CODE == "SRM6") ProtocolProxy.YG150Redis.Del($"{key}SRM5-SRM6-Out");
|
|
|
+ if (Entity.CODE == "SRM7" || Entity.CODE == "SRM8") ProtocolProxy.YG150Redis.Del($"{key}SRM7-SRM8-Out");
|
|
|
}
|
|
|
}
|
|
|
|