Compare commits
5 Commits
8ae4adae0a
...
2c559d26b9
Author | SHA1 | Date | |
---|---|---|---|
2c559d26b9 | |||
5c13a5c5e0 | |||
f0a64d9034 | |||
4bf3ddea5d | |||
b50ea3c97c |
|
@ -87,6 +87,7 @@
|
||||||
<HintPath>..\packages\OpenCvSharp4.4.3.0.20200524\lib\net461\OpenCvSharp.Extensions.dll</HintPath>
|
<HintPath>..\packages\OpenCvSharp4.4.3.0.20200524\lib\net461\OpenCvSharp.Extensions.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
|
<Reference Include="System.Configuration" />
|
||||||
<Reference Include="System.Core" />
|
<Reference Include="System.Core" />
|
||||||
<Reference Include="System.Net.Http.Formatting, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
<Reference Include="System.Net.Http.Formatting, Version=5.2.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Microsoft.AspNet.WebApi.Client.5.2.7\lib\net45\System.Net.Http.Formatting.dll</HintPath>
|
<HintPath>..\packages\Microsoft.AspNet.WebApi.Client.5.2.7\lib\net45\System.Net.Http.Formatting.dll</HintPath>
|
||||||
|
|
|
@ -62,28 +62,28 @@
|
||||||
// toolStripMenuItemSwitchLaneInIn
|
// toolStripMenuItemSwitchLaneInIn
|
||||||
//
|
//
|
||||||
this.toolStripMenuItemSwitchLaneInIn.Name = "toolStripMenuItemSwitchLaneInIn";
|
this.toolStripMenuItemSwitchLaneInIn.Name = "toolStripMenuItemSwitchLaneInIn";
|
||||||
this.toolStripMenuItemSwitchLaneInIn.Size = new System.Drawing.Size(180, 22);
|
this.toolStripMenuItemSwitchLaneInIn.Size = new System.Drawing.Size(123, 22);
|
||||||
this.toolStripMenuItemSwitchLaneInIn.Text = "Vào - Vào";
|
this.toolStripMenuItemSwitchLaneInIn.Text = "Vào - Vào";
|
||||||
this.toolStripMenuItemSwitchLaneInIn.Click += new System.EventHandler(this.toolStripMenuItemSwitchLaneInIn_Click);
|
this.toolStripMenuItemSwitchLaneInIn.Click += new System.EventHandler(this.toolStripMenuItemSwitchLaneInIn_Click);
|
||||||
//
|
//
|
||||||
// toolStripMenuItemSwitchLaneInOut
|
// toolStripMenuItemSwitchLaneInOut
|
||||||
//
|
//
|
||||||
this.toolStripMenuItemSwitchLaneInOut.Name = "toolStripMenuItemSwitchLaneInOut";
|
this.toolStripMenuItemSwitchLaneInOut.Name = "toolStripMenuItemSwitchLaneInOut";
|
||||||
this.toolStripMenuItemSwitchLaneInOut.Size = new System.Drawing.Size(180, 22);
|
this.toolStripMenuItemSwitchLaneInOut.Size = new System.Drawing.Size(123, 22);
|
||||||
this.toolStripMenuItemSwitchLaneInOut.Text = "Vào - Ra";
|
this.toolStripMenuItemSwitchLaneInOut.Text = "Vào - Ra";
|
||||||
this.toolStripMenuItemSwitchLaneInOut.Click += new System.EventHandler(this.toolStripMenuItemSwitchLaneInOut_Click);
|
this.toolStripMenuItemSwitchLaneInOut.Click += new System.EventHandler(this.toolStripMenuItemSwitchLaneInOut_Click);
|
||||||
//
|
//
|
||||||
// toolStripMenuItemSwitchLaneOutOut
|
// toolStripMenuItemSwitchLaneOutOut
|
||||||
//
|
//
|
||||||
this.toolStripMenuItemSwitchLaneOutOut.Name = "toolStripMenuItemSwitchLaneOutOut";
|
this.toolStripMenuItemSwitchLaneOutOut.Name = "toolStripMenuItemSwitchLaneOutOut";
|
||||||
this.toolStripMenuItemSwitchLaneOutOut.Size = new System.Drawing.Size(180, 22);
|
this.toolStripMenuItemSwitchLaneOutOut.Size = new System.Drawing.Size(123, 22);
|
||||||
this.toolStripMenuItemSwitchLaneOutOut.Text = "Ra - Ra";
|
this.toolStripMenuItemSwitchLaneOutOut.Text = "Ra - Ra";
|
||||||
this.toolStripMenuItemSwitchLaneOutOut.Click += new System.EventHandler(this.toolStripMenuItemSwitchLaneOutOut_Click);
|
this.toolStripMenuItemSwitchLaneOutOut.Click += new System.EventHandler(this.toolStripMenuItemSwitchLaneOutOut_Click);
|
||||||
//
|
//
|
||||||
// toolStripMenuItemSwitchLaneOutIn
|
// toolStripMenuItemSwitchLaneOutIn
|
||||||
//
|
//
|
||||||
this.toolStripMenuItemSwitchLaneOutIn.Name = "toolStripMenuItemSwitchLaneOutIn";
|
this.toolStripMenuItemSwitchLaneOutIn.Name = "toolStripMenuItemSwitchLaneOutIn";
|
||||||
this.toolStripMenuItemSwitchLaneOutIn.Size = new System.Drawing.Size(180, 22);
|
this.toolStripMenuItemSwitchLaneOutIn.Size = new System.Drawing.Size(123, 22);
|
||||||
this.toolStripMenuItemSwitchLaneOutIn.Text = "Ra - Vào";
|
this.toolStripMenuItemSwitchLaneOutIn.Text = "Ra - Vào";
|
||||||
this.toolStripMenuItemSwitchLaneOutIn.Click += new System.EventHandler(this.toolStripMenuItemSwitchLaneOutIn_Click);
|
this.toolStripMenuItemSwitchLaneOutIn.Click += new System.EventHandler(this.toolStripMenuItemSwitchLaneOutIn_Click);
|
||||||
//
|
//
|
||||||
|
@ -100,6 +100,7 @@
|
||||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||||
this.Text = "AIParking - Phần mềm quản lý bãi đỗ xe";
|
this.Text = "AIParking - Phần mềm quản lý bãi đỗ xe";
|
||||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.AIParkingApplicationForm_FormClosing);
|
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.AIParkingApplicationForm_FormClosing);
|
||||||
|
this.Load += new System.EventHandler(this.AIParkingApplicationForm_Load);
|
||||||
this.menuStrip.ResumeLayout(false);
|
this.menuStrip.ResumeLayout(false);
|
||||||
this.menuStrip.PerformLayout();
|
this.menuStrip.PerformLayout();
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Configuration;
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
@ -17,21 +18,33 @@ namespace AIParkingApplication
|
||||||
private Sidebar sidebar;
|
private Sidebar sidebar;
|
||||||
private Config configOnWeb;
|
private Config configOnWeb;
|
||||||
private EngineApiController engineApiController;
|
private EngineApiController engineApiController;
|
||||||
|
private string doorAccessControlDeviceIP;
|
||||||
|
|
||||||
public AIParkingApplicationForm(ApiController apiController, Config configOnWeb)
|
public AIParkingApplicationForm(ApiController apiController, Config configOnWeb)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
this.apiController = apiController;
|
this.apiController = apiController;
|
||||||
this.configOnWeb = configOnWeb;
|
this.configOnWeb = configOnWeb;
|
||||||
c3Device = new C3DeviceController("192.168.1.200");
|
|
||||||
|
|
||||||
sidebar = new Sidebar(apiController);
|
ReadAccessControlDeviceIPConfiguration();
|
||||||
sidebar.Location = new Point(0, 0);
|
if (string.IsNullOrEmpty(doorAccessControlDeviceIP))
|
||||||
|
{
|
||||||
|
MessageBox.Show("Kiểm tra lại cấu hình IP thiết bị mở cửa! (C3200)", "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
Application.Exit();
|
||||||
|
}
|
||||||
|
|
||||||
|
c3Device = new C3DeviceController(doorAccessControlDeviceIP);
|
||||||
|
sidebar = new Sidebar(apiController)
|
||||||
|
{
|
||||||
|
Location = new Point(0, 0)
|
||||||
|
};
|
||||||
Controls.Add(sidebar);
|
Controls.Add(sidebar);
|
||||||
|
|
||||||
statusBar = new StatusBar("192.168.1.122", "192.168.1.200", TimeSpan.FromSeconds(1));
|
statusBar = new StatusBar("192.168.1.122", doorAccessControlDeviceIP, TimeSpan.FromSeconds(1))
|
||||||
statusBar.Location = new Point(0, sidebar.Location.Y + sidebar.Height + 26);
|
{
|
||||||
statusBar.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
|
Location = new Point(0, sidebar.Location.Y + sidebar.Height + 26),
|
||||||
|
Anchor = AnchorStyles.Bottom | AnchorStyles.Left
|
||||||
|
};
|
||||||
Controls.Add(statusBar);
|
Controls.Add(statusBar);
|
||||||
|
|
||||||
try
|
try
|
||||||
|
@ -44,7 +57,7 @@ namespace AIParkingApplication
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
InitAllLanes();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitAllLanes()
|
private void InitAllLanes()
|
||||||
|
@ -185,9 +198,27 @@ namespace AIParkingApplication
|
||||||
laneOut78?.Hide();
|
laneOut78?.Hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ReadAccessControlDeviceIPConfiguration()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
doorAccessControlDeviceIP = ConfigurationManager.AppSettings["DOOR_ACCESS_DEVICE_CONTROL_IP"].Trim();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"{DateTime.Now.GetTimeFormatted()}\tReadAccessControlDeviceIPConfiguration\t{ex.Message}");
|
||||||
|
doorAccessControlDeviceIP = string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void AIParkingApplicationForm_FormClosing(object sender, FormClosingEventArgs e)
|
private void AIParkingApplicationForm_FormClosing(object sender, FormClosingEventArgs e)
|
||||||
{
|
{
|
||||||
Application.Exit();
|
Application.Exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void AIParkingApplicationForm_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
InitAllLanes();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ namespace AIParkingApplication
|
||||||
httpClient = new HttpClient
|
httpClient = new HttpClient
|
||||||
{
|
{
|
||||||
BaseAddress = new Uri(baseAddress),
|
BaseAddress = new Uri(baseAddress),
|
||||||
Timeout = TimeSpan.FromSeconds(1)
|
Timeout = TimeSpan.FromSeconds(5)
|
||||||
};
|
};
|
||||||
isHttpClientDisposabled = false;
|
isHttpClientDisposabled = false;
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ namespace AIParkingApplication
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Console.WriteLine($"GetStatisticInfo Exception:\t{DateTime.Now.GetTimeFormatted()} \t {ex.Message}");
|
Console.WriteLine($"GetStatisticInfo Exception:\t{DateTime.Now.GetTimeFormatted()} \t {ex.Message}");
|
||||||
return new Statistic.ParkInfo();
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,12 +87,12 @@ namespace AIParkingApplication
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
response = await httpClient.PostAsJsonAsync("/api/check-card", request);
|
response = await httpClient.PostAsJsonAsync("/api/check-card", request);
|
||||||
|
response.EnsureSuccessStatusCode();
|
||||||
requestCounter += 1;
|
requestCounter += 1;
|
||||||
await Task.Delay(100);
|
await Task.Delay(100);
|
||||||
}
|
}
|
||||||
while (response.StatusCode != HttpStatusCode.OK && requestCounter < MAX_REQUEST);
|
while (response.StatusCode != HttpStatusCode.OK && requestCounter < MAX_REQUEST);
|
||||||
|
|
||||||
response.EnsureSuccessStatusCode();
|
|
||||||
var cardValication = await response.Content.ReadAsAsync<CardInformation>();
|
var cardValication = await response.Content.ReadAsAsync<CardInformation>();
|
||||||
return cardValication;
|
return cardValication;
|
||||||
}
|
}
|
||||||
|
@ -108,8 +108,8 @@ namespace AIParkingApplication
|
||||||
{
|
{
|
||||||
string plateImageBase64 = Convert.ToBase64String(plateImage.ToBytes());
|
string plateImageBase64 = Convert.ToBase64String(plateImage.ToBytes());
|
||||||
string plateImageResultBase64 = Convert.ToBase64String(plateImageResult.ToBytes());
|
string plateImageResultBase64 = Convert.ToBase64String(plateImageResult.ToBytes());
|
||||||
string PlateFrameImageBase64 = Convert.ToBase64String(plateFrameImage.ToBytes());
|
string plateFrameImageBase64 = Convert.ToBase64String(plateFrameImage.ToBytes());
|
||||||
string FrameImageBase64 = Convert.ToBase64String(frameImage.ToBytes());
|
string frameImageBase64 = Convert.ToBase64String(frameImage.ToBytes());
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var request = new SaveLogModel
|
var request = new SaveLogModel
|
||||||
|
@ -123,18 +123,18 @@ namespace AIParkingApplication
|
||||||
Timestamp = timestamp,
|
Timestamp = timestamp,
|
||||||
PlateImage = plateImageBase64,
|
PlateImage = plateImageBase64,
|
||||||
PlateResultImage = plateImageResultBase64,
|
PlateResultImage = plateImageResultBase64,
|
||||||
PlateFrameImage = PlateFrameImageBase64,
|
PlateFrameImage = plateFrameImageBase64,
|
||||||
FrameImage = FrameImageBase64
|
FrameImage = frameImageBase64
|
||||||
};
|
};
|
||||||
HttpResponseMessage response;
|
HttpResponseMessage response;
|
||||||
int requestCounter = 1;
|
int requestCounter = 1;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
response = await httpClient.PostAsJsonAsync("/api/save-logs", request);
|
response = await httpClient.PostAsJsonAsync("/api/save-logs", request);
|
||||||
|
response.EnsureSuccessStatusCode();
|
||||||
requestCounter += 1;
|
requestCounter += 1;
|
||||||
await Task.Delay(100);
|
await Task.Delay(100);
|
||||||
} while (response.StatusCode != HttpStatusCode.OK && requestCounter < MAX_REQUEST);
|
} while (response.StatusCode != HttpStatusCode.OK && requestCounter < MAX_REQUEST);
|
||||||
response.EnsureSuccessStatusCode();
|
|
||||||
SaveLogRespone saveLogRespone = await response.Content.ReadAsAsync<SaveLogRespone>();
|
SaveLogRespone saveLogRespone = await response.Content.ReadAsAsync<SaveLogRespone>();
|
||||||
return saveLogRespone;
|
return saveLogRespone;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,14 +1,17 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<configuration>
|
<configuration>
|
||||||
<startup>
|
<appSettings>
|
||||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
|
<add key="DOOR_ACCESS_DEVICE_CONTROL_IP" value="192.168.1.200" />
|
||||||
</startup>
|
</appSettings>
|
||||||
<runtime>
|
<startup>
|
||||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
|
||||||
<dependentAssembly>
|
</startup>
|
||||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
<runtime>
|
||||||
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
</dependentAssembly>
|
<dependentAssembly>
|
||||||
</assemblyBinding>
|
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||||
</runtime>
|
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
|
||||||
|
</dependentAssembly>
|
||||||
|
</assemblyBinding>
|
||||||
|
</runtime>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user