You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

87 lines
2.9 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Runtime.InteropServices;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using static HBLDevice.IceCream.MessageDefine;
  8. namespace HBLDevice.IceCream
  9. {
  10. /// <summary>
  11. /// 心跳下发
  12. /// </summary>
  13. [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
  14. public class ICMSG_Heart_UP
  15. {
  16. public byte Header1;
  17. public byte Header2;
  18. public IC_CMD Cmd;
  19. public MORKI_MODE Mode;
  20. public byte YLWD_H;
  21. public byte YLWD_L;
  22. public byte HQWD_H;
  23. public byte HQWD_L;
  24. public byte HJWD_H;
  25. public byte HJWD_L;
  26. public byte DL_H;
  27. public byte DL_L;
  28. public byte DY_H;
  29. public byte DY_L;
  30. public byte GZ_H;
  31. public byte GZ_L;
  32. public MORKI_MODE MS;
  33. public byte DLTJ;
  34. public byte CXB;
  35. public byte DLBS_H;
  36. public byte DLBS_L;
  37. public short CalcCode;
  38. public ICMSG_Heart_UP()
  39. {
  40. Header1 = HEADER1;
  41. Header2 = HEADER2_UP;
  42. Cmd = IC_CMD.HEART;
  43. }
  44. public bool HasGZ(out string msg)
  45. {
  46. msg = string.Empty;
  47. msg += ((GZ_H >> 7) & 1) == 1 ? "通讯故障" : string.Empty;
  48. msg += ((GZ_H >> 6) & 1) == 1 ? "电流过载" : string.Empty;
  49. msg += ((GZ_H >> 5) & 1) == 1 ? "环境温度过高" : string.Empty;
  50. msg += ((GZ_H >> 4) & 1) == 1 ? "环境温度异常" : string.Empty;
  51. msg += ((GZ_H >> 3) & 1) == 1 ? "进气温度故障" : string.Empty;
  52. msg += ((GZ_H >> 2) & 1) == 1 ? "保鲜温度异常" : string.Empty;
  53. msg += ((GZ_H >> 1) & 1) == 1 ? "冷冻温度异常" : string.Empty;
  54. msg += ((GZ_L >> 7) & 1) == 1 ? "电压过高" : string.Empty;
  55. msg += ((GZ_L >> 6) & 1) == 1 ? "电压过低" : string.Empty;
  56. msg += ((GZ_L >> 5) & 1) == 1 ? "制冷不良" : string.Empty;
  57. msg += ((GZ_L >> 4) & 1) == 1 ? "转速传感器异常" : string.Empty;
  58. msg += ((GZ_L >> 3) & 1) == 1 ? "皮带打滑" : string.Empty;
  59. msg += ((GZ_L >> 2) & 1) == 1 ? "冻缸报警" : string.Empty;
  60. msg += ((GZ_L >> 1) & 1) == 1 ? "缺料报警" : string.Empty;
  61. return string.IsNullOrEmpty(msg);
  62. }
  63. public string DLTJ_Desc()
  64. {
  65. if ((DLTJ >> 7 & 1) == 1) return "有料";
  66. if ((DLTJ >> 6 & 1) == 1) return "缺料";
  67. if ((DLTJ >> 5 & 1) == 1) return "未使用";
  68. if ((DLTJ >> 4 & 1) == 1) return "未使用";
  69. if ((DLTJ >> 3 & 1) == 1) return "未使用";
  70. if ((DLTJ >> 2 & 1) == 1) return "打料电机复位完成";
  71. if ((DLTJ >> 1 & 1) == 1) return "未使用";
  72. if ((DLTJ & 1) == 1) return "成型比大于或等于87";
  73. return string.Empty;
  74. }
  75. }
  76. }