using BPASmartClient.Model.冰淇淋.Enum; using System; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; using static BPASmartClient.GSIceCream.MessageDefine; namespace BPASmartClient.GSIceCream { /// /// 心跳下发 /// [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)] public class ICMSG_Heart_UP { public byte Header1; public byte Header2; public IC_CMD Cmd; public MORKI_MODE Mode; public byte YLWD_H; public byte YLWD_L; public byte HQWD_H; public byte HQWD_L; public byte HJWD_H; public byte HJWD_L; public byte DL_H; public byte DL_L; public byte DY_H; public byte DY_L; public byte GZ_H; public byte GZ_L; public MORKI_MODE MS; public byte DLTJ; public byte CXB; public byte DLBS_H; public byte DLBS_L; public short CalcCode; public ICMSG_Heart_UP() { Header1 = HEADER1; Header2 = HEADER2_UP; Cmd = IC_CMD.HEART; } public bool HasGZ(out string msg) { msg = string.Empty; msg += ((GZ_H >> 7) & 1) == 1 ? "通讯故障" : string.Empty; msg += ((GZ_H >> 6) & 1) == 1 ? "电流过载" : string.Empty; msg += ((GZ_H >> 5) & 1) == 1 ? "环境温度过高" : string.Empty; msg += ((GZ_H >> 4) & 1) == 1 ? "环境温度异常" : string.Empty; msg += ((GZ_H >> 3) & 1) == 1 ? "进气温度故障" : string.Empty; msg += ((GZ_H >> 2) & 1) == 1 ? "保鲜温度异常" : string.Empty; msg += ((GZ_H >> 1) & 1) == 1 ? "冷冻温度异常" : string.Empty; msg += ((GZ_L >> 7) & 1) == 1 ? "电压过高" : string.Empty; msg += ((GZ_L >> 6) & 1) == 1 ? "电压过低" : string.Empty; msg += ((GZ_L >> 5) & 1) == 1 ? "制冷不良" : string.Empty; msg += ((GZ_L >> 4) & 1) == 1 ? "转速传感器异常" : string.Empty; msg += ((GZ_L >> 3) & 1) == 1 ? "皮带打滑" : string.Empty; msg += ((GZ_L >> 2) & 1) == 1 ? "冻缸报警" : string.Empty; msg += ((GZ_L >> 1) & 1) == 1 ? "缺料报警" : string.Empty; return string.IsNullOrEmpty(msg); } public string DLTJ_Desc() { if ((DLTJ >> 7 & 1) == 1) return "有料"; if ((DLTJ >> 6 & 1) == 1) return "缺料"; if ((DLTJ >> 5 & 1) == 1) return "未使用"; if ((DLTJ >> 4 & 1) == 1) return "未使用"; if ((DLTJ >> 3 & 1) == 1) return "未使用"; if ((DLTJ >> 2 & 1) == 1) return "打料电机复位完成"; if ((DLTJ >> 1 & 1) == 1) return "未使用"; if ((DLTJ & 1) == 1) return "成型比大于或等于87"; return string.Empty; } } }