StationExtension.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using FreeRedis;
  2. using ServiceCenter.Extensions;
  3. using ServiceCenter.Logs;
  4. using ServiceCenter.Redis;
  5. using WCS.Core;
  6. using WCS.WorkEngineering.Protocol.Station;
  7. namespace WCS.WorkEngineering.Extensions
  8. {
  9. public class Station : Device<IStation520, IStation521, IStation523>
  10. {
  11. public Station(Device device, World world) : base(device, world)
  12. {
  13. }
  14. /// <summary>
  15. /// 入库站点是否被禁止
  16. /// </summary>
  17. /// <returns></returns>
  18. public void 入库站点是否被禁止()
  19. {
  20. //RedisHub.Do(RedisSentinelClient => {
  21. //})
  22. var config = RedisHub.Default.Check("ForbidTubuEnter") ?? throw new Exception("请在Redis中配置检测门禁用");
  23. var configs = config.Split(",");
  24. if (configs.Contains(Entity.Code)) throw new KnownException("当前检测门已被禁用,请联系运维人员了解具体情况", LogLevelEnum.High);
  25. }
  26. /// <summary>
  27. /// 入库站点是否满足执行条件
  28. /// </summary>
  29. /// <returns></returns>
  30. public void 入库站点是否满足执行条件()
  31. {
  32. //if (Data.VoucherNo != Data2.VoucherNo) throw new KnownException($"凭证号不一致,DB520:{Data.VoucherNo}-DB521:{Data2.VoucherNo}", LogLevelEnum.High);
  33. if (Data3.Status.HasFlag(StationStatus.Run)) throw new KnownException("设备运行中", LogLevelEnum.Low);
  34. }
  35. }
  36. }