/// <summary> /// 获取事件要显示的信息 /// </summary> /// <param name="msg">返回显示信息</param> /// <param name="parkID">停車場ID</param> /// <param name="entranceID">通道ID</param> /// <param name="msgType">显示类型</param> /// <param name="report">事件</param> /// <returns>成功或失败,当不需要显示事件信息时,返回失败</returns> private bool GetSendMessage(ref string msg, int parkID, int entranceID, VehicleLEDMessageType msgType, ReportBase report) { if (report is CardEventReport) { return(GetSendMessage(ref msg, parkID, entranceID, msgType, report as CardEventReport)); } else if (report is ParkVacantReport) { return(GetSendMessage(ref msg, parkID, entranceID, msgType, report as ParkVacantReport)); } msg = string.Empty; return(false); }
/// <summary> /// 获取车辆信息LED屏显示信息的文字描述 /// </summary> /// <param name="type"></param> /// <returns></returns> public static string GetDescription(VehicleLEDMessageType type) { switch (type) { case VehicleLEDMessageType.Department: return(Resource1.VehicleLEDMessageType_Department); case VehicleLEDMessageType.OwnerName: return(Resource1.VehicleLEDMessageType_OwnerName); case VehicleLEDMessageType.CardCarPlate: return(Resource1.VehicleLEDMessageType_CardCarPlate); case VehicleLEDMessageType.RegCarPlate: return(Resource1.VehicleLEDMessageType_RegCarPlate); case VehicleLEDMessageType.CardCertificate: return(Resource1.VehicleLEDMessageType_CardCertificate); case VehicleLEDMessageType.LastCarPlate: return(Resource1.VehicleLEDMessageType_LastCarPlate); case VehicleLEDMessageType.LastDateTime: return(Resource1.VehicleLEDMessageType_LastDateTime); case VehicleLEDMessageType.LastEntrance: return(Resource1.VehicleLEDMessageType_LastEntrance); case VehicleLEDMessageType.ValidDate: return(Resource1.VehicleLEDMessageType_ValidDate); case VehicleLEDMessageType.Balance: return(Resource1.VehicleLEDMessageType_Balance); case VehicleLEDMessageType.TotalPosition: return(Resource1.VehicleLEDMessageType_TotalPosition); case VehicleLEDMessageType.Vacant: return(Resource1.VehicleLEDMessageType_Vacant); case VehicleLEDMessageType.Park: return(Resource1.VehicleLEDMessageType_Park); case VehicleLEDMessageType.Entrance: return(Resource1.VehicleLEDMessageType_Entrance); default: return(string.Empty); } }
/// <summary> /// 显示信息是否刷卡事件信息 /// </summary> /// <param name="msgType"></param> /// <returns></returns> private bool IsCardEventMsg(VehicleLEDMessageType msgType) { switch (msgType) { case VehicleLEDMessageType.Department: case VehicleLEDMessageType.OwnerName: case VehicleLEDMessageType.CardCarPlate: case VehicleLEDMessageType.RegCarPlate: case VehicleLEDMessageType.CardCertificate: case VehicleLEDMessageType.LastCarPlate: case VehicleLEDMessageType.LastDateTime: case VehicleLEDMessageType.LastEntrance: case VehicleLEDMessageType.ValidDate: case VehicleLEDMessageType.Balance: return(true); default: return(false); } }
/// <summary> /// 获取车位数事件的显示信息 /// </summary> /// <param name="msg">返回显示信息</param> /// <param name="msgType">显示类型</param> /// <param name="report">事件</param> /// <returns>>成功或失败,当不需要显示车位信息时,返回失败</returns> private bool GetSendMessage(ref string msg, int parkID, int entranceID, VehicleLEDMessageType msgType, ParkVacantReport report) { ParkInfo park = null; EntranceInfo entrance = null; switch (msgType) { case VehicleLEDMessageType.Vacant: msg = report.ParkVacant > 0 ? report.ParkVacant.ToString() : "0"; return(true); case VehicleLEDMessageType.TotalPosition: if (parkID > 0) { park = ParkBuffer.Current.GetPark(parkID); } msg = park != null?park.TotalPosition.ToString() : string.Empty; return(true); case VehicleLEDMessageType.Park: if (parkID > 0) { park = ParkBuffer.Current.GetPark(parkID); } msg = park != null ? park.ParkName : string.Empty; return(true); case VehicleLEDMessageType.Entrance: if (entranceID > 0) { entrance = ParkBuffer.Current.GetEntrance(entranceID); } msg = entrance != null ? entrance.EntranceName : string.Empty; return(true); default: msg = string.Empty; return(false); } }
/// <summary> /// 获取初始化LED屏信息 /// </summary> /// <param name="msg"></param> /// <param name="msgType"></param> /// <returns></returns> private string GetInitLedMessage(int parkID, int entranceID, VehicleLEDMessageType msgType) { ParkInfo park = null; EntranceInfo entrance = null; string empty = " "; switch (msgType) { case VehicleLEDMessageType.TotalPosition: if (parkID > 0) { park = ParkBuffer.Current.GetPark(parkID); } return(park != null?park.TotalPosition.ToString() : empty); case VehicleLEDMessageType.Vacant: if (parkID > 0) { park = ParkBuffer.Current.GetPark(parkID); } int vacant = park != null && park.Vacant > 0 ? park.Vacant : 0; return(park != null?vacant.ToString() : empty); case VehicleLEDMessageType.Park: if (parkID > 0) { park = ParkBuffer.Current.GetPark(parkID); } return(park != null ? park.ParkName : empty); case VehicleLEDMessageType.Entrance: if (entranceID > 0) { entrance = ParkBuffer.Current.GetEntrance(entranceID); } return(entrance != null ? entrance.EntranceName : empty); default: return(empty); } }
/// <summary> /// 车辆信息显示屏显示信息 /// </summary> /// <param name="comPort">串口号</param> /// <param name="showTitle">显示标题</param> /// <param name="address">子屏地址</param> /// <param name="msgType">显示类型</param> /// <param name="report">事件</param> /// <returns>true:已发送,false:不需发送</returns> private bool VehicleLedItemDisplay(int parkID, int entranceID, byte comPort, bool showTitle, byte address, string title, int interval, VehicleLEDMessageType msgType, ReportBase report) { if (address > 0) { string msg = string.Empty; if (GetSendMessage(ref msg, parkID, entranceID, msgType, report)) { if (showTitle) { msg = title + ":" + msg; } DisplayMsg(comPort, address, interval, msg); return(true); } } return(false); }
/// <summary> /// 获取刷卡事件要显示的信息 /// </summary> /// <param name="msg">返回显示信息</param> /// <param name="msgType">显示类型</param> /// <param name="report">事件</param> /// <returns>成功或失败,当不需要显示刷卡信息时,返回失败</returns> private bool GetSendMessage(ref string msg, int parkID, int entranceID, VehicleLEDMessageType msgType, CardEventReport report) { ParkInfo park = null; EntranceInfo entrance = null; switch (msgType) { case VehicleLEDMessageType.Department: msg = report.Department; return(true); case VehicleLEDMessageType.OwnerName: msg = report.OwnerName; return(true); case VehicleLEDMessageType.CardCarPlate: msg = report.CardCarPlate; return(true); case VehicleLEDMessageType.RegCarPlate: msg = report.CarPlate; return(true); case VehicleLEDMessageType.CardCertificate: msg = report.CardCertificate; return(true); case VehicleLEDMessageType.LastCarPlate: if (report.IsExitEvent) { msg = report.LastCarPlate; } else { //如果是入场事件,入场车牌为识别车牌 msg = report.CarPlate; } return(true); case VehicleLEDMessageType.LastDateTime: if (report.IsExitEvent) { //只有只有出场事件并且有入场时间时,才会返回入场时间 msg = report.IsExitEvent && report.LastDateTime != null?report.LastDateTime.Value.ToString("yyyy-MM-dd HH:mm:ss") : string.Empty; } else { //如果是入场事件,返回事件时间 msg = report.EventDateTime.ToString("yyyy-MM-dd HH:mm:ss"); } return(true); case VehicleLEDMessageType.LastEntrance: if (report.IsExitEvent) { EntranceInfo entrace = ParkBuffer.Current.GetEntrance(report.LastEntrance); msg = entrace != null ? entrace.EntranceName : string.Empty; } else { //如果是入场事件,返回事件的通道 EntranceInfo entrace = ParkBuffer.Current.GetEntrance(report.EntranceID); msg = entrace != null ? entrace.EntranceName : string.Empty; } return(true); case VehicleLEDMessageType.ValidDate: msg = report.ValidDate.ToString("yyyy-MM-dd"); return(true); case VehicleLEDMessageType.Balance: msg = report.Balance.ToString(); return(true); case VehicleLEDMessageType.TotalPosition: if (parkID > 0) { park = ParkBuffer.Current.GetPark(parkID); } msg = park != null?park.TotalPosition.ToString() : string.Empty; return(true); case VehicleLEDMessageType.Park: if (parkID > 0) { park = ParkBuffer.Current.GetPark(parkID); } msg = park != null ? park.ParkName : string.Empty; return(true); case VehicleLEDMessageType.Entrance: if (entranceID > 0) { entrance = ParkBuffer.Current.GetEntrance(entranceID); } msg = entrance != null ? entrance.EntranceName : string.Empty; return(true); default: msg = string.Empty; return(false); } }
/// <summary> /// 车辆信息显示屏显示指定信息 /// </summary> /// <param name="comPort">串口号</param> /// <param name="showTitle">显示标题</param> /// <param name="address">子屏地址</param> /// <param name="msgType">显示类型</param> /// <param name="displayMsg">显示信息</param> /// <returns>true:已发送,false:不需发送</returns> private bool VehicleLedItemDisplayMsg(byte comPort, bool showTitle, byte address, string title, int interval, VehicleLEDMessageType msgType, string displayMsg) { if (address > 0) { string msg = displayMsg; if (showTitle && msgType != VehicleLEDMessageType.None) { msg = title + ":" + msg; } DisplayMsg(comPort, address, interval, msg); return(true); } return(false); }