MachineState.cs 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. using StandardLibrary;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. namespace Model
  8. {
  9. public enum Status
  10. {
  11. EMG = 1,
  12. ERROR = 2,
  13. HOMING = 3,
  14. Ready = 4,
  15. Running = 5,
  16. Paused = 6,
  17. Reserved1 = 7,
  18. Reserved2 = 8,
  19. Reserved3 = 8,
  20. }
  21. public class MachineState:IPlcAddressToPropertyPaths
  22. {
  23. /// <summary>
  24. /// 批次是否在运行
  25. /// </summary>
  26. public bool IsBatchOn { get; set; }
  27. public bool IsRunning { get; set; }
  28. public Status Status { get; set; }
  29. private Dictionary<string, string> PropertyPathPlcAddressPairs;
  30. public Dictionary<string, List<string>> PlcAddressPropertyPathsPairs { get; set; }
  31. public MachineState()
  32. {
  33. PropertyPathPlcAddressPairs = new Dictionary<string, string>()
  34. {
  35. {PropertyPathHelper.GetPath(()=>IsBatchOn),"Application.Var_state.b批次执行中" },
  36. {PropertyPathHelper.GetPath(()=>Status),"Application.Var_state.i_MachineState" },
  37. //{PropertyPathHelper.GetPath(()=>测试1.TestEnable),"Application.Var_state.站位启用[5]"},
  38. };
  39. PlcAddressPropertyPathsPairs = PropertyPathPlcAddressPairs
  40. .GroupBy(kvp => kvp.Value)
  41. .ToDictionary(
  42. g => g.Key,
  43. g => g.Select(kvp => CommonLib.RemoveUpToSecondDot(kvp.Key)).ToList()
  44. );
  45. }
  46. }
  47. }