闸机返回车牌号

master
CZ 2 months ago
parent 3cd7a4b2ba
commit de16b3ff78

@ -20,6 +20,29 @@ namespace BrakeMachine.Brack
private const int m_WaitTime = 5000;
public static DateTime dateTime = System.DateTime.Now;
/// <summary>
///
/// </summary>
/// <returns></returns>
public static string PlateNumber
{
get
{
if ((System.DateTime.Now - dateTime).Seconds >= 30)
{
return "";
}
return PlateNumber;
}
set
{
value = PlateNumber;
}
}
#region 连接
/// <summary>
@ -63,6 +86,8 @@ namespace BrakeMachine.Brack
eventInfo.Index = info.stuFileInfo.bIndex.ToString();
eventInfo.Count = info.stuFileInfo.bCount.ToString();
eventInfo.PlateNumber = info.stTrafficCar.szPlateNumber;
PlateNumber=info.stTrafficCar.szPlateNumber;
dateTime = DateTime.Now;
eventInfo.PlateColor = info.stTrafficCar.szPlateColor;
eventInfo.PlateType = info.stTrafficCar.szPlateType;
eventInfo.VehicleColor = info.stTrafficCar.szVehicleColor;

@ -10,6 +10,9 @@ public class EventInfo
public string GroupID { get; set; }
public string Index { get; set; }
public string Count { get; set; }
/// <summary>
/// 车牌
/// </summary>
public string PlateNumber { get; set; }
public string PlateType { get; set; }
public string PlateColor { get; set; }

@ -31,15 +31,21 @@ namespace BrakeMachine.Brack
{
case "/Api/Manualsnap": //抓拍
BrackMgr.Manualsnap();
//this.WriteResponse(ctx, Unpooled.WrappedBuffer(Encoding.UTF8.GetBytes(closeRfid.ToString())), TypePlain, closeRfid?OkLength: FailLength);
string msg = "抓拍成功";
this.WriteResponse(ctx, Unpooled.WrappedBuffer(Encoding.UTF8.GetBytes(msg)), TypePlain, OkLength);
break;
case "/Api/LicensePlateNumber": //车牌号码
if(!string.IsNullOrEmpty(BrackMgr.PlateNumber))
this.WriteResponse(ctx, Unpooled.WrappedBuffer(Encoding.UTF8.GetBytes(BrackMgr.PlateNumber)), TypePlain, OkLength);
else
this.WriteResponse(ctx, Unpooled.WrappedBuffer(Encoding.UTF8.GetBytes(BrackMgr.PlateNumber)), TypePlain, FailLength);
break;
default:
response = new DefaultFullHttpResponse(HttpVersion.Http11, HttpResponseStatus.NotFound, Unpooled.Empty, false);
response = new DefaultFullHttpResponse(HttpVersion.Http11, HttpResponseStatus.NotFound,
Unpooled.Empty, false);
ctx.WriteAndFlushAsync(response);
break;
}
}
void WriteResponse(IChannelHandlerContext ctx, IByteBuffer buf, ICharSequence contentType,
@ -58,7 +64,8 @@ namespace BrakeMachine.Brack
ctx.WriteAsync(response);
}
public override void ExceptionCaught(IChannelHandlerContext context, Exception exception) => context.CloseAsync();
public override void ExceptionCaught(IChannelHandlerContext context, Exception exception) =>
context.CloseAsync();
public override void ChannelReadComplete(IChannelHandlerContext context) => context.Flush();
}

Loading…
Cancel
Save