StationInfoTools.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. using DbCommon.Enties.DbModels;
  2. using ProjectManagementSystem.Device.CommandCallback;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Threading.Tasks;
  8. namespace ProjectManagementSystem.DispatchPack
  9. {
  10. public static class StationInfoTools
  11. {
  12. public static byte GetDBAgvId(this StationInfo info)
  13. {
  14. return info.Online ? (byte)info.AgvId : (byte)0;
  15. }
  16. public static byte GetDBRunValues(this StationInfo info)
  17. {
  18. if(!info.Online)
  19. {
  20. return (byte)DBRunValues.Unknow;
  21. }
  22. if(info.HasCar)
  23. {
  24. return (byte)DBRunValues.StopOnStation;
  25. }
  26. if(info.AgvStausValue == (byte)EnumInfoAgvStatus.运行)
  27. {
  28. return (byte)DBRunValues.Running;
  29. }
  30. if (info.AgvStausValue == (byte)EnumInfoAgvStatus.暂停)
  31. {
  32. return (byte)DBRunValues.Pause;
  33. }
  34. return (byte)DBRunValues.Unknow;
  35. }
  36. public static byte GetDBAgvFalut(this StationInfo info)
  37. {
  38. return info.Online ? info.AgvAlarm : (byte)0;
  39. }
  40. }
  41. public enum DBControlValues : int
  42. {
  43. NoAction = 0,
  44. OKRelease = 1,
  45. NGRelease = 2,
  46. StopImmediate = 3,
  47. StopRelease = 4
  48. }
  49. public enum DBRunValues : byte
  50. {
  51. Unknow = 0,
  52. Running = 1,
  53. Pause = 2,
  54. StopOnStation = 3,
  55. EmergencyStop = 4
  56. }
  57. }