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);
if (cardInfoResult.IsValid)
{
plateCamera.RequestCaptureOneFrame();
overviewCamera.RequestCaptureOneFrame();
await Task.Delay(200);
var plateVideoFrame = plateCamera.CurrentFrame;
var overviewVideoFrame = overviewCamera.CurrentFrame;
pictureBoxOverviewImage.Invoke(new Action(() =>
if (cardInfoResult.Direction == "in")
{
pictureBoxOverviewImage.Image?.Dispose();
pictureBoxOverviewImage.Image = overviewVideoFrame.ToBitmap();
}));
plateCamera.RequestCaptureOneFrame();
overviewCamera.RequestCaptureOneFrame();
await Task.Delay(200);
var plateVideoFrame = plateCamera.CurrentFrame;
var overviewVideoFrame = overviewCamera.CurrentFrame;
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));
//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)
pictureBoxOverviewImage.Invoke(new Action(() =>
{
var openDoorResult = c3Device.OpenDoor(doorId);
if (openDoorResult.HasError)
pictureBoxOverviewImage.Image?.Dispose();
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.Text = "KHÔNG THỂ MỞ CỬA";
}));
lblRecogizePlateStatus.Invoke(new Action(() =>
{
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
{
lblRecogizePlateStatus.Invoke(new Action(() =>
{
lblRecogizePlateStatus.BackColor = Color.Red;
lblRecogizePlateStatus.Text = "KHÔNG THỂ KẾT NỐI ĐẾN MÁY CHỦ";
lblRecogizePlateStatus.Text = "XE ĐÃ Ở TRONG BÃI";
}));
}
}