CageOperate.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using System;
  2. using System.Threading;
  3. using SHJX.Service.Model.Control;
  4. using SHJX.Service.Control.Modules;
  5. using SHJX.Service.Control.Interface;
  6. using SHJX.Service.Common.ReadXML;
  7. namespace SHJX.Service.Control.Route.RouteController
  8. {
  9. /// <summary>
  10. /// 冷凝管
  11. /// </summary>
  12. public class CageOperate : FlowControlOperateImp
  13. {
  14. private const string OpName = "Cage";
  15. public virtual bool Operate(ReadConfigUtil config, DataEventArgs data)
  16. {
  17. var cage = OpName.GetEquipmentState();
  18. var res = false;
  19. switch (data.Task.RouteStep)
  20. {
  21. case "CA_Down":
  22. if (cage.EquipmentState.Equals(EquipmentEnum.Normotopia))
  23. {
  24. var way = WriteWay.Antiposition;
  25. cage.EquipmentState = EquipmentEnum.Antiposition;
  26. var arg = CageWriteOperate(way);
  27. res = data.Client.Factory(OpName).Write(arg);
  28. }
  29. break;
  30. case "CA_Rise":
  31. if (cage.EquipmentState.Equals(EquipmentEnum.Antiposition))
  32. {
  33. var way = WriteWay.Normotopia;
  34. cage.EquipmentState = EquipmentEnum.Normotopia;
  35. var arg = CageWriteOperate(way);
  36. res = data.Client.Factory(OpName).Write(arg);
  37. Thread.Sleep(Convert.ToInt32(DataCentre.GetConfig.CoolingPipeWatingTime * 1000)); //提升起来后需要等待时间
  38. }
  39. break;
  40. }
  41. data.DataManager.Update(cage);
  42. return res;
  43. }
  44. private PortArgs CageWriteOperate(WriteWay way)
  45. {
  46. PortArgs portArgs = new()
  47. {
  48. TypeName = OpName,
  49. WriteWay = way
  50. };
  51. return portArgs;
  52. }
  53. }
  54. }