LaneIn - Check CardInfomation.

This commit is contained in:
DucDangAnh 2020-06-29 13:56:04 +07:00
parent f280376752
commit ab14853d29

View File

@ -63,53 +63,63 @@ namespace AIParkingApplication
var cardInfoResult = await apiController.GetCardInformation(cardNumber); var cardInfoResult = await apiController.GetCardInformation(cardNumber);
if (cardInfoResult.IsValid) if (cardInfoResult.IsValid)
{ {
plateCamera.RequestCaptureOneFrame(); if (cardInfoResult.Direction == "in")
overviewCamera.RequestCaptureOneFrame();
await Task.Delay(200);
var plateVideoFrame = plateCamera.CurrentFrame;
var overviewVideoFrame = overviewCamera.CurrentFrame;
pictureBoxOverviewImage.Invoke(new Action(() =>
{ {
pictureBoxOverviewImage.Image?.Dispose(); plateCamera.RequestCaptureOneFrame();
pictureBoxOverviewImage.Image = overviewVideoFrame.ToBitmap(); overviewCamera.RequestCaptureOneFrame();
})); await Task.Delay(200);
var plateVideoFrame = plateCamera.CurrentFrame;
var overviewVideoFrame = overviewCamera.CurrentFrame;
FinalPlateResult result = await ProcessFrameImage(plateProcessor, plateVideoFrame, isRetryMode); pictureBoxOverviewImage.Invoke(new Action(() =>
pictureBoxPlateImage.Invoke(new Action(() =>
{
pictureBoxPlateImage.Image?.Dispose();
pictureBoxPlateImage.Image = result.PlateImage.ToBitmap();
}));
var cardInformation = await apiController.GetCardInformation(cardNumber);
ShowCardInfoOnUI(cardNumber, result.PlateString, cardInformation.CardType, DateTime.Now.ToString(AppConstant.DATETIME_FORMAT));
//TODO check saveLogResult
var saveLogResult = await apiController.SaveLog(LaneDirection.In, cardInformation.CardRealID.ToString(), "1", result.PlateType, DateTime.Now.ToString(AppConstant.DATETIME_FORMAT), result.PlateString, result.PlateImage, result.PlateImage, result.PlateImage, overviewVideoFrame);
if (saveLogResult.Status)
{
if (isAutoOpenDoor && this.doorId == doorId)
{ {
var openDoorResult = c3Device.OpenDoor(doorId); pictureBoxOverviewImage.Image?.Dispose();
if (openDoorResult.HasError) pictureBoxOverviewImage.Image = overviewVideoFrame.ToBitmap();
}));
FinalPlateResult result = await ProcessFrameImage(plateProcessor, plateVideoFrame, isRetryMode);
pictureBoxPlateImage.Invoke(new Action(() =>
{
pictureBoxPlateImage.Image?.Dispose();
pictureBoxPlateImage.Image = result.PlateImage.ToBitmap();
}));
var cardInformation = await apiController.GetCardInformation(cardNumber);
ShowCardInfoOnUI(cardNumber, result.PlateString, cardInformation.CardType, DateTime.Now.ToString(AppConstant.DATETIME_FORMAT));
var saveLogResult = await apiController.SaveLog(LaneDirection.In, cardInformation.CardRealID.ToString(), "1", result.PlateType, DateTime.Now.ToString(AppConstant.DATETIME_FORMAT), result.PlateString, result.PlateImage, result.PlateImage, result.PlateImage, overviewVideoFrame);
if (saveLogResult.Status)
{
if (isAutoOpenDoor && this.doorId == doorId)
{ {
lblRecogizePlateStatus.Invoke(new Action(() => var openDoorResult = c3Device.OpenDoor(doorId);
if (openDoorResult.HasError)
{ {
lblRecogizePlateStatus.BackColor = Color.Red; lblRecogizePlateStatus.Invoke(new Action(() =>
lblRecogizePlateStatus.Text = "KHÔNG THỂ MỞ CỬA"; {
})); lblRecogizePlateStatus.BackColor = Color.Red;
lblRecogizePlateStatus.Text = "KHÔNG THỂ MỞ CỬA";
}));
}
} }
} }
else
{
lblRecogizePlateStatus.Invoke(new Action(() =>
{
lblRecogizePlateStatus.BackColor = Color.Red;
lblRecogizePlateStatus.Text = "KHÔNG THỂ KẾT NỐI ĐẾN MÁY CHỦ";
}));
}
} }
else else
{ {
lblRecogizePlateStatus.Invoke(new Action(() => lblRecogizePlateStatus.Invoke(new Action(() =>
{ {
lblRecogizePlateStatus.BackColor = Color.Red; lblRecogizePlateStatus.BackColor = Color.Red;
lblRecogizePlateStatus.Text = "KHÔNG THỂ KẾT NỐI ĐẾN MÁY CHỦ"; lblRecogizePlateStatus.Text = "XE ĐÃ Ở TRONG BÃI";
})); }));
} }
} }