Compare commits

..

No commits in common. "2a2c1439b308fb8467327c9c7ca466abf2be17d2" and "005095401f749c1498356fbefcd274a81335ce31" have entirely different histories.

6 changed files with 32 additions and 73 deletions

View File

@ -34,7 +34,7 @@
//
// btnStopLaneIn
//
this.btnStopLaneIn.Location = new System.Drawing.Point(1205, 408);
this.btnStopLaneIn.Location = new System.Drawing.Point(1221, 88);
this.btnStopLaneIn.Name = "btnStopLaneIn";
this.btnStopLaneIn.Size = new System.Drawing.Size(75, 23);
this.btnStopLaneIn.TabIndex = 0;
@ -44,7 +44,7 @@
//
// btnStartLaneIn
//
this.btnStartLaneIn.Location = new System.Drawing.Point(1205, 449);
this.btnStartLaneIn.Location = new System.Drawing.Point(1221, 129);
this.btnStartLaneIn.Name = "btnStartLaneIn";
this.btnStartLaneIn.Size = new System.Drawing.Size(75, 23);
this.btnStartLaneIn.TabIndex = 0;

View File

@ -1,5 +1,4 @@
using System;
using System.Windows.Forms;
using System.Windows.Forms;
namespace AIParkingApplication
{
@ -10,9 +9,6 @@ namespace AIParkingApplication
private IDoorControlAccess c3Device;
private LaneIn laneIn;
private LaneOut laneOut;
private StatusBar statusBar;
private Statistic statistic;
public AIParkingApplicationForm()
{
@ -27,19 +23,10 @@ namespace AIParkingApplication
laneOut.Location = new System.Drawing.Point(450, 0);
Controls.Add(laneOut);
statusBar = new StatusBar("192.168.1.122", "192.168.1.200", TimeSpan.FromSeconds(1));
statusBar.Location = new System.Drawing.Point(0, 692);
statusBar.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
Controls.Add(statusBar);
statistic = new Statistic(apiController, TimeSpan.FromMinutes(10));
statistic.Location = new System.Drawing.Point(laneIn.Width + laneOut.Width + 10, 0);
statistic.Anchor = AnchorStyles.Top | AnchorStyles.Left;
Controls.Add(statistic);
StartLanes();
}
private void btnStopLaneIn_Click(object sender, EventArgs e)
private void btnStopLaneIn_Click(object sender, System.EventArgs e)
{
laneIn.Stop();
laneOut.Stop();
@ -51,7 +38,7 @@ namespace AIParkingApplication
laneOut.Start();
}
private void btnStartLaneIn_Click(object sender, EventArgs e)
private void btnStartLaneIn_Click(object sender, System.EventArgs e)
{
StartLanes();
}

View File

@ -85,11 +85,9 @@ namespace AIParkingApplication
pictureBoxOverviewImage.UpdateImage(overviewVideoFrame.ToBitmap());
var cardInformation = await apiController.GetCardInformation(cardNumber);
var saveLogResult = await apiController.SaveLog(LaneDirection.In, cardInformation.CardRealID.ToString(), "1", result.PlateType, DateTime.Now.GetTimeFormatted(), result.PlateString, result.PlateImage, result.PlateImage, result.PlateImage, overviewVideoFrame);
ShowCardInfoOnUI(cardNumber, result.PlateString, cardInformation.CardType, DateTime.Now.GetTimeFormatted());
var saveLogResult = await apiController.SaveLog(LaneDirection.In, cardInformation.CardRealID.ToString(), "1", result.PlateType, DateTime.Now.GetTimeFormatted(), result.PlateString, result.PlateImage, result.PlateImage, result.PlateImage, overviewVideoFrame);
if (saveLogResult.Status)
{
if (isAutoOpenDoor && this.doorId == doorId)

View File

@ -1,10 +1,10 @@
using System;
using OpenCvSharp;
using OpenCvSharp.Extensions;
using System;
using System.Drawing;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using OpenCvSharp;
using OpenCvSharp.Extensions;
namespace AIParkingApplication
{
@ -95,7 +95,7 @@ namespace AIParkingApplication
var saveLogResult = await apiController.SaveLog(LaneDirection.Out, cardInformation.CardRealID.ToString(), "1", result.PlateType, DateTime.Now.GetTimeFormatted(), result.PlateString, result.PlateImage, result.PlateImage, result.PlateImage, overviewVideoFrame, cardInformation.LogID.ToString());
ShowCardInfoOnUI(cardNumber, result.PlateString, cardInformation.PlateString, cardInformation.CardType, cardInformation.TimeIn, DateTime.Now.GetTimeFormatted(), saveLogResult.Cost);
ShowCardInfoOnUI(cardNumber, result.PlateString, cardInformation.CardType, cardInformation.TimeIn, DateTime.Now.GetTimeFormatted(), saveLogResult.Cost);
if (saveLogResult.Status)
{
@ -180,10 +180,10 @@ namespace AIParkingApplication
overviewCamera.Start();
}
private void ShowCardInfoOnUI(string cardNumber, string plateStringEngine, string plateInString, string cardType, string cardTimeIn, string cardTimeOut, string money)
private void ShowCardInfoOnUI(string cardNumber, string plateString, string cardType, string cardTimeIn, string cardTimeOut, string money)
{
lblCardNumber.UpdateLabel($"Số thẻ: {cardNumber}");
lblPlateString.UpdateLabel($"Biển số: {plateStringEngine}");
lblPlateString.UpdateLabel($"Biển số: {plateString}");
lblCardType.UpdateLabel($"Loại thẻ: {cardType}");
lblCardTime.UpdateLabel($"Vào: {cardTimeIn}");
lblCardTimeOut.UpdateLabel($"Ra: {cardTimeOut}");
@ -191,21 +191,7 @@ namespace AIParkingApplication
int.TryParse(money, out int moneyAmount);
lblMoneyAmount.UpdateLabel($"Số tiền: {string.Format("{0:n0}", moneyAmount)} vnđ");
if (string.IsNullOrEmpty(plateStringEngine))
{
lblStatusInfo.UpdateLabel("KHÔNG NHẬN DIỆN ĐƯỢC BIỂN SỐ", Color.Red);
}
else
{
if (plateStringEngine != plateInString)
{
lblStatusInfo.UpdateLabel("SO KHỚP BIỂN SỐ KHÔNG CHÍNH XÁC", Color.Red);
}
else
{
lblStatusInfo.UpdateLabel($"MỜI XE {plateStringEngine} QUA", Color.Red);
}
}
lblStatusInfo.UpdateLabel(string.IsNullOrEmpty(plateString) ? "KHÔNG NHẬN DIỆN ĐƯỢC BIỂN SỐ" : $"MỜI XE {plateString} QUA", string.IsNullOrEmpty(plateString) ? Color.Red : Color.Green);
}
private void OverviewCameraOnVideoFrameReceived(Mat videoFrame)

View File

@ -45,8 +45,6 @@
//
// grbVehicleStatistics
//
this.grbVehicleStatistics.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.grbVehicleStatistics.Controls.Add(this.label4);
this.grbVehicleStatistics.Controls.Add(this.label3);
this.grbVehicleStatistics.Controls.Add(this.lblVehicleTotalOut);
@ -55,7 +53,7 @@
this.grbVehicleStatistics.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.grbVehicleStatistics.Location = new System.Drawing.Point(1, 1);
this.grbVehicleStatistics.Name = "grbVehicleStatistics";
this.grbVehicleStatistics.Size = new System.Drawing.Size(191, 178);
this.grbVehicleStatistics.Size = new System.Drawing.Size(290, 189);
this.grbVehicleStatistics.TabIndex = 0;
this.grbVehicleStatistics.TabStop = false;
this.grbVehicleStatistics.Text = "Thống kê xe";
@ -63,7 +61,7 @@
// label4
//
this.label4.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.label4.Location = new System.Drawing.Point(112, 125);
this.label4.Location = new System.Drawing.Point(183, 133);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(60, 20);
this.label4.TabIndex = 2;
@ -73,7 +71,7 @@
// label3
//
this.label3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.label3.Location = new System.Drawing.Point(21, 125);
this.label3.Location = new System.Drawing.Point(42, 133);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(60, 20);
this.label3.TabIndex = 2;
@ -84,7 +82,7 @@
//
this.lblVehicleTotalOut.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.lblVehicleTotalOut.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblVehicleTotalOut.Location = new System.Drawing.Point(112, 153);
this.lblVehicleTotalOut.Location = new System.Drawing.Point(183, 161);
this.lblVehicleTotalOut.Name = "lblVehicleTotalOut";
this.lblVehicleTotalOut.Size = new System.Drawing.Size(60, 20);
this.lblVehicleTotalOut.TabIndex = 1;
@ -95,7 +93,7 @@
//
this.lblVehicleTotalIn.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.lblVehicleTotalIn.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblVehicleTotalIn.Location = new System.Drawing.Point(21, 153);
this.lblVehicleTotalIn.Location = new System.Drawing.Point(42, 161);
this.lblVehicleTotalIn.Name = "lblVehicleTotalIn";
this.lblVehicleTotalIn.Size = new System.Drawing.Size(60, 20);
this.lblVehicleTotalIn.TabIndex = 1;
@ -104,8 +102,6 @@
//
// tlpStatisticTable
//
this.tlpStatisticTable.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.tlpStatisticTable.ColumnCount = 2;
this.tlpStatisticTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.tlpStatisticTable.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
@ -115,13 +111,11 @@
this.tlpStatisticTable.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tlpStatisticTable.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tlpStatisticTable.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tlpStatisticTable.Size = new System.Drawing.Size(180, 100);
this.tlpStatisticTable.Size = new System.Drawing.Size(278, 100);
this.tlpStatisticTable.TabIndex = 0;
//
// grbLoginInfo
//
this.grbLoginInfo.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.grbLoginInfo.Controls.Add(this.lblAuthorization);
this.grbLoginInfo.Controls.Add(this.lblUsername);
this.grbLoginInfo.Controls.Add(this.label2);
@ -129,10 +123,10 @@
this.grbLoginInfo.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.grbLoginInfo.Location = new System.Drawing.Point(1, 198);
this.grbLoginInfo.Name = "grbLoginInfo";
this.grbLoginInfo.Size = new System.Drawing.Size(191, 93);
this.grbLoginInfo.Size = new System.Drawing.Size(290, 93);
this.grbLoginInfo.TabIndex = 1;
this.grbLoginInfo.TabStop = false;
this.grbLoginInfo.Text = "Thông tin tài khoản";
this.grbLoginInfo.Text = "Thông tin đăng nhập";
//
// lblAuthorization
//
@ -140,9 +134,9 @@
this.lblAuthorization.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblAuthorization.Location = new System.Drawing.Point(109, 60);
this.lblAuthorization.Name = "lblAuthorization";
this.lblAuthorization.Size = new System.Drawing.Size(56, 18);
this.lblAuthorization.Size = new System.Drawing.Size(127, 18);
this.lblAuthorization.TabIndex = 0;
this.lblAuthorization.Text = "Bảo Vệ";
this.lblAuthorization.Text = "Nhân Viên Bảo Vệ";
//
// lblUsername
//
@ -160,9 +154,9 @@
this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label2.Location = new System.Drawing.Point(16, 60);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(89, 18);
this.label2.Size = new System.Drawing.Size(85, 18);
this.label2.TabIndex = 0;
this.label2.Text = "Phân quyền:";
this.label2.Text = "Phân quyền";
//
// label1
//
@ -170,9 +164,9 @@
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.Location = new System.Drawing.Point(16, 27);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(77, 18);
this.label1.Size = new System.Drawing.Size(73, 18);
this.label1.TabIndex = 0;
this.label1.Text = "Tài khoản:";
this.label1.Text = "Tài khoản";
//
// Statistic
//
@ -181,7 +175,7 @@
this.Controls.Add(this.grbLoginInfo);
this.Controls.Add(this.grbVehicleStatistics);
this.Name = "Statistic";
this.Size = new System.Drawing.Size(193, 292);
this.Size = new System.Drawing.Size(292, 292);
this.Load += new System.EventHandler(this.Statistic_Load);
this.grbVehicleStatistics.ResumeLayout(false);
this.grbLoginInfo.ResumeLayout(false);

View File

@ -10,7 +10,7 @@ namespace AIParkingApplication
private readonly Thread thrStatistics;
private readonly TimeSpan updateInterval;
private ParkInfo parkInfo;
private ApiController apiController;
private string baseAddress;
private Label lblLoaiXe;
private Label lblXeMay;
@ -19,10 +19,10 @@ namespace AIParkingApplication
private Label lblSoLuongXeMay;
private Label lblSoLuongOto;
public Statistic(ApiController apiController, TimeSpan updateInterval)
public Statistic(string baseAddress, TimeSpan updateInterval)
{
InitializeComponent();
this.apiController = apiController;
this.baseAddress = baseAddress;
this.updateInterval = updateInterval;
thrStatistics = new Thread(new ThreadStart(GetStatistic)) { IsBackground = true };
thrStatistics.Start();
@ -40,6 +40,7 @@ namespace AIParkingApplication
async void GetDataFromServer()
{
ApiController apiController = new ApiController(this.baseAddress);
parkInfo = await apiController.GetStatisticInfo();
}
@ -68,13 +69,6 @@ namespace AIParkingApplication
lblSoLuongXeMay = new Label() { Text = "0", Font = labelFont };
lblSoLuongOto = new Label() { Text = "0", Font = labelFont };
lblLoaiXe.Anchor = AnchorStyles.None;
lblXeMay.Anchor = AnchorStyles.None;
lblOto.Anchor = AnchorStyles.None;
lblSoLuong.Anchor = AnchorStyles.None;
lblSoLuongXeMay.Anchor = AnchorStyles.None;
lblSoLuongOto.Anchor = AnchorStyles.None;
tlpStatisticTable.Controls.Add(lblLoaiXe, 0, 0);
tlpStatisticTable.Controls.Add(lblXeMay, 0, 1);
tlpStatisticTable.Controls.Add(lblOto, 0, 2);