ApiController - Update Method: SaveLog. LaneIn, LaneOut - Add log
This commit is contained in:
parent
153eba219f
commit
e8fae43c1d
|
@ -150,7 +150,7 @@ namespace AIParkingApplication
|
|||
{
|
||||
Console.WriteLine($"SaveLog Exception:\t{DateTime.Now.GetTimeFormatted()} \t {ex.Message}");
|
||||
applicationLogger.Log(LogLevel.Info, string.Format("Không thể lưu log gửi xe. Làn: {0} | Mã thẻ: {1} | cameraID: {2} | Thời gian: {3} | Biển số: {4} | LogID: {5} | exMessage: ", direction == LaneDirection.In ? "IN" : "OUT", cardID, cameraID, timestamp, plateString, logID, ex.Message));
|
||||
return new SaveLogRespone();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -63,23 +63,27 @@ namespace AIParkingApplication
|
|||
if (cardInfoResult == null)
|
||||
{
|
||||
lblStatusInfo.UpdateLabel("KHÔNG THỂ KẾT NỐI SERVER", Color.Purple);
|
||||
appLogger.Log(LogLevel.Error, $"Request thẻ cổng {doorId} vào | số thẻ : {cardNumber} | lỗi: KHÔNG THỂ KẾT NỐI TỚI SERVER");
|
||||
return;
|
||||
}
|
||||
if (!cardInfoResult.IsValid)
|
||||
{
|
||||
lblStatusInfo.UpdateLabel("THẺ KHÔNG HỢP LỆ", Color.Purple);
|
||||
appLogger.Log(LogLevel.Error, $"Request thẻ cổng {doorId} vào | số thẻ : {cardNumber} | lỗi: THẺ KHÔNG HỢP LỆ");
|
||||
return;
|
||||
}
|
||||
|
||||
if (cardInfoResult.Direction != "in")
|
||||
{
|
||||
lblStatusInfo.UpdateLabel("XE ĐÃ Ở TRONG BÃI", Color.Red);
|
||||
appLogger.Log(LogLevel.Error, $"Request thẻ cổng {doorId} vào | số thẻ : {cardNumber} | lỗi: XE ĐÃ Ở TRONG BÃI");
|
||||
return;
|
||||
}
|
||||
|
||||
plateCamera.RequestCaptureOneFrame();
|
||||
overviewCamera.RequestCaptureOneFrame();
|
||||
await Task.Delay(200);
|
||||
appLogger.Log(LogLevel.Info, $"Request thẻ cổng {doorId} vào | số thẻ : {cardNumber} | Chụp ảnh camera");
|
||||
|
||||
var plateVideoFrame = plateCamera.CurrentFrame;
|
||||
FinalPlateResult result = await ProcessFrameImage(plateProcessor, plateVideoFrame, isRetryMode);
|
||||
|
@ -92,6 +96,13 @@ namespace AIParkingApplication
|
|||
|
||||
var saveLogResult = await apiController.SaveLog(LaneDirection.In, cardInformation.CardRealID.ToString(), cameraId, result.PlateType, DateTime.Now.GetTimeFormatted(), result.PlateString, result.PlateImage, result.PlateImage, result.PlateImage, overviewVideoFrame);
|
||||
|
||||
if (saveLogResult == null)
|
||||
{
|
||||
lblStatusInfo.UpdateLabel("KHÔNG CÓ KẾT NỐI ĐẾN MÁY CHỦ", Color.Red);
|
||||
appLogger.Log(LogLevel.Error, $"Request thẻ cổng {doorId} vào | số thẻ : {cardNumber} | lỗi: KHÔNG CÓ KẾT NỐI ĐẾN MÁY CHỦ - KHÔNG LƯU ĐƯỢC LOG");
|
||||
return;
|
||||
}
|
||||
|
||||
ShowCardInfoOnUI(cardNumber, result.PlateString, cardInformation.CardType, DateTime.Now.GetTimeFormatted());
|
||||
|
||||
if (saveLogResult.Status)
|
||||
|
@ -99,11 +110,13 @@ namespace AIParkingApplication
|
|||
if (isAutoOpenDoor && DoorId == doorId)
|
||||
{
|
||||
OpenDoor(doorId);
|
||||
appLogger.Log(LogLevel.Info, $"Request thẻ cổng {doorId} vào | số thẻ : {cardNumber} | biển số: {result.PlateString} | Đã mở cửa");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lblStatusInfo.UpdateLabel("KHÔNG CÓ KẾT NỐI ĐẾN MÁY CHỦ", Color.Red);
|
||||
appLogger.Log(LogLevel.Error, $"Request thẻ cổng {doorId} vào | số thẻ : {cardNumber} | lỗi: LƯU BẢN GHI LỖI");
|
||||
lblStatusInfo.UpdateLabel("LƯU BẢN GHI LỖI", Color.Red);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -163,6 +176,12 @@ namespace AIParkingApplication
|
|||
{
|
||||
plateCamera.Stop();
|
||||
overviewCamera.Stop();
|
||||
|
||||
pictureBoxPlateImage.UpdateImage(null);
|
||||
pictureBoxPlateVideo.UpdateImage(null);
|
||||
|
||||
pictureBoxOverviewImage.UpdateImage(null);
|
||||
pictureBoxOverviewVideo.UpdateImage(null);
|
||||
}
|
||||
|
||||
public void Start()
|
||||
|
|
|
@ -66,17 +66,20 @@ namespace AIParkingApplication
|
|||
if (cardInfoResult == null)
|
||||
{
|
||||
lblStatusInfo.UpdateLabel("KHÔNG THỂ KẾT NỐI SERVER", Color.Purple);
|
||||
appLogger.Log(LogLevel.Error, $"Request thẻ cổng {doorId} vào | số thẻ : {cardNumber} | lỗi: KHÔNG THỂ KẾT NỐI TỚI SERVER");
|
||||
return;
|
||||
}
|
||||
if (!cardInfoResult.IsValid)
|
||||
{
|
||||
lblStatusInfo.UpdateLabel("THẺ KHÔNG HỢP LỆ", Color.Purple);
|
||||
appLogger.Log(LogLevel.Error, $"Request thẻ cổng {doorId} vào | số thẻ : {cardNumber} | lỗi: THẺ KHÔNG HỢP LỆ");
|
||||
return;
|
||||
}
|
||||
|
||||
if (cardInfoResult.Direction != "out")
|
||||
{
|
||||
lblStatusInfo.UpdateLabel("CHƯA NHẬN THẺ VÀO", Color.Red);
|
||||
appLogger.Log(LogLevel.Error, $"Request thẻ cổng {doorId} vào | số thẻ : {cardNumber} | lỗi: XE ĐÃ Ở TRONG BÃI");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -89,6 +92,7 @@ namespace AIParkingApplication
|
|||
plateCamera.RequestCaptureOneFrame();
|
||||
overviewCamera.RequestCaptureOneFrame();
|
||||
await Task.Delay(200);
|
||||
appLogger.Log(LogLevel.Info, $"Request thẻ cổng {doorId} vào | số thẻ : {cardNumber} | Chụp ảnh camera");
|
||||
|
||||
var plateVideoFrame = plateCamera.CurrentFrame;
|
||||
FinalPlateResult result = await ProcessFrameImage(plateProcessor, plateVideoFrame, isRetryMode);
|
||||
|
@ -101,6 +105,13 @@ namespace AIParkingApplication
|
|||
|
||||
var saveLogResult = await apiController.SaveLog(LaneDirection.Out, cardInformation.CardRealID.ToString(), cameraId, result.PlateType, DateTime.Now.GetTimeFormatted(), result.PlateString, result.PlateImage, result.PlateImage, result.PlateImage, overviewVideoFrame, cardInformation.LogID.ToString());
|
||||
|
||||
if (saveLogResult == null)
|
||||
{
|
||||
lblStatusInfo.UpdateLabel("KHÔNG CÓ KẾT NỐI ĐẾN MÁY CHỦ", Color.Red);
|
||||
appLogger.Log(LogLevel.Error, $"Request thẻ cổng {doorId} vào | số thẻ : {cardNumber} | lỗi: KHÔNG CÓ KẾT NỐI ĐẾN MÁY CHỦ - KHÔNG LƯU ĐƯỢC LOG");
|
||||
return;
|
||||
}
|
||||
|
||||
ShowCardInfoOnUI(cardNumber, result.PlateString, cardInformation.PlateString, cardInformation.CardType, cardInformation.TimeIn, DateTime.Now.GetTimeFormatted(), saveLogResult.Cost);
|
||||
|
||||
if (saveLogResult.Status)
|
||||
|
@ -108,6 +119,7 @@ namespace AIParkingApplication
|
|||
if (isAutoOpenDoor)
|
||||
{
|
||||
OpenDoor(doorId);
|
||||
appLogger.Log(LogLevel.Info, $"Request thẻ cổng {doorId} vào | số thẻ : {cardNumber} | biển số: {result.PlateString} | Đã mở cửa");
|
||||
}
|
||||
PrinterData printerData = new PrinterData
|
||||
{
|
||||
|
@ -120,7 +132,8 @@ namespace AIParkingApplication
|
|||
}
|
||||
else
|
||||
{
|
||||
lblStatusInfo.UpdateLabel("KHÔNG CÓ KẾT NỐI ĐẾN MÁY CHỦ", Color.Red);
|
||||
appLogger.Log(LogLevel.Error, $"Request thẻ cổng {doorId} vào | số thẻ : {cardNumber} | lỗi: LƯU BẢN GHI LỖI");
|
||||
lblStatusInfo.UpdateLabel("LƯU BẢN GHI LỖI", Color.Red);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -186,6 +199,12 @@ namespace AIParkingApplication
|
|||
{
|
||||
plateCamera.Stop();
|
||||
overviewCamera.Stop();
|
||||
|
||||
pictureBoxPlateImage.UpdateImage(null);
|
||||
pictureBoxPlateVideo.UpdateImage(null);
|
||||
|
||||
pictureBoxOverviewImage.UpdateImage(null);
|
||||
pictureBoxOverviewVideo.UpdateImage(null);
|
||||
}
|
||||
|
||||
public void Start()
|
||||
|
|
Loading…
Reference in New Issue
Block a user