Compare commits
8 Commits
53f457b020
...
7f61711e61
Author | SHA1 | Date | |
---|---|---|---|
7f61711e61 | |||
5b3d0f95c8 | |||
cc6df6ac2b | |||
a00d77133f | |||
fbee2526c5 | |||
44ee429ae6 | |||
315d2fd03a | |||
5f7ac10f22 |
|
@ -141,6 +141,7 @@
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="PlateDetector.cs" />
|
<Compile Include="PlateDetector.cs" />
|
||||||
<Compile Include="PlateProcessor.cs" />
|
<Compile Include="PlateProcessor.cs" />
|
||||||
|
<Compile Include="Printer.cs" />
|
||||||
<Compile Include="Program.cs" />
|
<Compile Include="Program.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Sidebar.cs">
|
<Compile Include="Sidebar.cs">
|
||||||
|
@ -223,6 +224,9 @@
|
||||||
<Content Include="plateLong.xml">
|
<Content Include="plateLong.xml">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
<Content Include="PrinterForm.html">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<BootstrapperPackage Include=".NETFramework,Version=v4.6.1">
|
<BootstrapperPackage Include=".NETFramework,Version=v4.6.1">
|
||||||
|
|
|
@ -29,23 +29,89 @@
|
||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AIParkingApplicationForm));
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AIParkingApplicationForm));
|
||||||
|
this.menuStrip = new System.Windows.Forms.MenuStrip();
|
||||||
|
this.toolStripMenuItemSwitchLane = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.toolStripMenuItemSwitchLaneInIn = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.toolStripMenuItemSwitchLaneInOut = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.toolStripMenuItemSwitchLaneOutOut = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.toolStripMenuItemSwitchLaneOutIn = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
this.menuStrip.SuspendLayout();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
|
// menuStrip
|
||||||
|
//
|
||||||
|
this.menuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
|
this.toolStripMenuItemSwitchLane});
|
||||||
|
this.menuStrip.Location = new System.Drawing.Point(0, 0);
|
||||||
|
this.menuStrip.Name = "menuStrip";
|
||||||
|
this.menuStrip.Size = new System.Drawing.Size(1366, 24);
|
||||||
|
this.menuStrip.TabIndex = 0;
|
||||||
|
this.menuStrip.Text = "menuStrip1";
|
||||||
|
//
|
||||||
|
// toolStripMenuItemSwitchLane
|
||||||
|
//
|
||||||
|
this.toolStripMenuItemSwitchLane.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||||
|
this.toolStripMenuItemSwitchLaneInIn,
|
||||||
|
this.toolStripMenuItemSwitchLaneInOut,
|
||||||
|
this.toolStripMenuItemSwitchLaneOutOut,
|
||||||
|
this.toolStripMenuItemSwitchLaneOutIn});
|
||||||
|
this.toolStripMenuItemSwitchLane.Name = "toolStripMenuItemSwitchLane";
|
||||||
|
this.toolStripMenuItemSwitchLane.Size = new System.Drawing.Size(59, 20);
|
||||||
|
this.toolStripMenuItemSwitchLane.Text = "Đảo làn";
|
||||||
|
//
|
||||||
|
// toolStripMenuItemSwitchLaneInIn
|
||||||
|
//
|
||||||
|
this.toolStripMenuItemSwitchLaneInIn.Name = "toolStripMenuItemSwitchLaneInIn";
|
||||||
|
this.toolStripMenuItemSwitchLaneInIn.Size = new System.Drawing.Size(180, 22);
|
||||||
|
this.toolStripMenuItemSwitchLaneInIn.Text = "Vào - Vào";
|
||||||
|
this.toolStripMenuItemSwitchLaneInIn.Click += new System.EventHandler(this.toolStripMenuItemSwitchLaneInIn_Click);
|
||||||
|
//
|
||||||
|
// toolStripMenuItemSwitchLaneInOut
|
||||||
|
//
|
||||||
|
this.toolStripMenuItemSwitchLaneInOut.Name = "toolStripMenuItemSwitchLaneInOut";
|
||||||
|
this.toolStripMenuItemSwitchLaneInOut.Size = new System.Drawing.Size(180, 22);
|
||||||
|
this.toolStripMenuItemSwitchLaneInOut.Text = "Vào - Ra";
|
||||||
|
//
|
||||||
|
// toolStripMenuItemSwitchLaneOutOut
|
||||||
|
//
|
||||||
|
this.toolStripMenuItemSwitchLaneOutOut.Name = "toolStripMenuItemSwitchLaneOutOut";
|
||||||
|
this.toolStripMenuItemSwitchLaneOutOut.Size = new System.Drawing.Size(180, 22);
|
||||||
|
this.toolStripMenuItemSwitchLaneOutOut.Text = "Ra - Ra";
|
||||||
|
//
|
||||||
|
// toolStripMenuItemSwitchLaneOutIn
|
||||||
|
//
|
||||||
|
this.toolStripMenuItemSwitchLaneOutIn.Name = "toolStripMenuItemSwitchLaneOutIn";
|
||||||
|
this.toolStripMenuItemSwitchLaneOutIn.Size = new System.Drawing.Size(180, 22);
|
||||||
|
this.toolStripMenuItemSwitchLaneOutIn.Text = "Ra - Vào";
|
||||||
|
//
|
||||||
// AIParkingApplicationForm
|
// AIParkingApplicationForm
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(1366, 737);
|
this.ClientSize = new System.Drawing.Size(1366, 737);
|
||||||
|
this.Controls.Add(this.menuStrip);
|
||||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||||
|
this.MainMenuStrip = this.menuStrip;
|
||||||
this.MinimumSize = new System.Drawing.Size(1382, 776);
|
this.MinimumSize = new System.Drawing.Size(1382, 776);
|
||||||
this.Name = "AIParkingApplicationForm";
|
this.Name = "AIParkingApplicationForm";
|
||||||
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.menuStrip.ResumeLayout(false);
|
||||||
|
this.menuStrip.PerformLayout();
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
private System.Windows.Forms.MenuStrip menuStrip;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemSwitchLane;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemSwitchLaneInIn;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemSwitchLaneInOut;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemSwitchLaneOutOut;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemSwitchLaneOutIn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ namespace AIParkingApplication
|
||||||
private StatusBar statusBar;
|
private StatusBar statusBar;
|
||||||
private Sidebar sidebar;
|
private Sidebar sidebar;
|
||||||
private Config configOnWeb;
|
private Config configOnWeb;
|
||||||
|
private EngineApiController engineApiController;
|
||||||
|
|
||||||
public AIParkingApplicationForm(ApiController apiController, Config configOnWeb)
|
public AIParkingApplicationForm(ApiController apiController, Config configOnWeb)
|
||||||
{
|
{
|
||||||
|
@ -25,7 +26,6 @@ namespace AIParkingApplication
|
||||||
Controls.Add(sidebar);
|
Controls.Add(sidebar);
|
||||||
|
|
||||||
c3Device = new C3DeviceController("192.168.1.200");
|
c3Device = new C3DeviceController("192.168.1.200");
|
||||||
EngineApiController engineApiController = null;
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -38,12 +38,12 @@ namespace AIParkingApplication
|
||||||
}
|
}
|
||||||
laneIn = new LaneIn(1, this.configOnWeb.CameraData1.StreamUrl, this.configOnWeb.CameraData2.StreamUrl, c3Device, this.apiController, engineApiController, true, false, true);
|
laneIn = new LaneIn(1, this.configOnWeb.CameraData1.StreamUrl, this.configOnWeb.CameraData2.StreamUrl, c3Device, this.apiController, engineApiController, true, false, true);
|
||||||
laneIn.BorderStyle = BorderStyle.FixedSingle;
|
laneIn.BorderStyle = BorderStyle.FixedSingle;
|
||||||
laneIn.Location = new System.Drawing.Point(sidebar.Location.X + sidebar.Width + 20, 0);
|
laneIn.Location = new System.Drawing.Point(sidebar.Location.X + sidebar.Width + 20, menuStrip.Height);
|
||||||
Controls.Add(laneIn);
|
Controls.Add(laneIn);
|
||||||
|
|
||||||
laneOut = new LaneOut(2, this.configOnWeb.CameraData3.StreamUrl, this.configOnWeb.CameraData4.StreamUrl, c3Device, this.apiController, engineApiController, true, false, true);
|
laneOut = new LaneOut(2, this.configOnWeb.CameraData3.StreamUrl, this.configOnWeb.CameraData4.StreamUrl, c3Device, this.apiController, engineApiController, true, false, true);
|
||||||
laneOut.BorderStyle = BorderStyle.FixedSingle;
|
laneOut.BorderStyle = BorderStyle.FixedSingle;
|
||||||
laneOut.Location = new System.Drawing.Point(laneIn.Location.X + laneIn.Width + 20, 0);
|
laneOut.Location = new System.Drawing.Point(laneIn.Location.X + laneIn.Width + 20, menuStrip.Height);
|
||||||
Controls.Add(laneOut);
|
Controls.Add(laneOut);
|
||||||
|
|
||||||
statusBar = new StatusBar("192.168.1.122", "192.168.1.200", TimeSpan.FromSeconds(1));
|
statusBar = new StatusBar("192.168.1.122", "192.168.1.200", TimeSpan.FromSeconds(1));
|
||||||
|
@ -54,17 +54,38 @@ namespace AIParkingApplication
|
||||||
StartLanes();
|
StartLanes();
|
||||||
}
|
}
|
||||||
|
|
||||||
~AIParkingApplicationForm()
|
|
||||||
{
|
|
||||||
laneIn.Stop();
|
|
||||||
laneOut.Stop();
|
|
||||||
Application.Exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void StartLanes()
|
private void StartLanes()
|
||||||
{
|
{
|
||||||
laneIn.Start();
|
laneIn.Start();
|
||||||
laneOut.Start();
|
laneOut.Start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void toolStripMenuItemSwitchLaneInIn_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
laneIn.Stop();
|
||||||
|
laneOut.Stop();
|
||||||
|
laneIn.Hide();
|
||||||
|
laneOut.Hide();
|
||||||
|
LaneIn laneIn1, laneIn2;
|
||||||
|
laneIn1 = new LaneIn(1, this.configOnWeb.CameraData1.StreamUrl, this.configOnWeb.CameraData2.StreamUrl, c3Device, this.apiController, engineApiController, true, false, true);
|
||||||
|
laneIn1.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
laneIn1.Location = new System.Drawing.Point(sidebar.Location.X + sidebar.Width + 20, menuStrip.Height);
|
||||||
|
Controls.Add(laneIn1);
|
||||||
|
|
||||||
|
laneIn2 = new LaneIn(2, this.configOnWeb.CameraData1.StreamUrl, this.configOnWeb.CameraData2.StreamUrl, c3Device, this.apiController, engineApiController, true, false, true);
|
||||||
|
laneIn2.BorderStyle = BorderStyle.FixedSingle;
|
||||||
|
laneIn2.Location = new System.Drawing.Point(laneIn1.Location.X + laneIn1.Width + 20, menuStrip.Height);
|
||||||
|
Controls.Add(laneIn2);
|
||||||
|
|
||||||
|
laneIn1.Start();
|
||||||
|
laneIn2.Start();
|
||||||
|
this.MinimumSize = new System.Drawing.Size(500, 768);
|
||||||
|
this.Width = 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AIParkingApplicationForm_FormClosing(object sender, FormClosingEventArgs e)
|
||||||
|
{
|
||||||
|
Application.Exit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,6 +117,9 @@
|
||||||
<resheader name="writer">
|
<resheader name="writer">
|
||||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
</resheader>
|
</resheader>
|
||||||
|
<metadata name="menuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||||
|
<value>17, 17</value>
|
||||||
|
</metadata>
|
||||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||||
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||||
<value>
|
<value>
|
||||||
|
|
|
@ -42,7 +42,8 @@ namespace AIParkingApplication
|
||||||
Console.WriteLine($"Login Exception:\t{DateTime.Now.GetTimeFormatted()} \t {ex.Message}");
|
Console.WriteLine($"Login Exception:\t{DateTime.Now.GetTimeFormatted()} \t {ex.Message}");
|
||||||
return new LoginDataModel
|
return new LoginDataModel
|
||||||
{
|
{
|
||||||
IsLoginSuccess = false
|
IsLoginSuccess = false,
|
||||||
|
Exception = ex
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -94,7 +95,7 @@ namespace AIParkingApplication
|
||||||
}
|
}
|
||||||
|
|
||||||
//Neu Dicrection la Out thi logID la logID lay ve khi check the
|
//Neu Dicrection la Out thi logID la logID lay ve khi check the
|
||||||
public async Task<SaveLogRespone> SaveLog(LaneDirection direction, string cardID, string cameraID, PlateType plateType, string timestamp, string plateString, Mat plateImage, Mat plateImageResult, Mat plateFrameImage, Mat frameImage, string logID = "")
|
public async Task<SaveLogRespone> SaveLog(LaneDirection direction, string cardID, string cameraID, PlateType plateType, string timestamp, string plateString, Mat plateImage, Mat plateImageResult, Mat plateFrameImage, Mat frameImage, string logID = "")
|
||||||
{
|
{
|
||||||
string plateImageBase64 = Convert.ToBase64String(plateImage.ToBytes());
|
string plateImageBase64 = Convert.ToBase64String(plateImage.ToBytes());
|
||||||
string plateImageResultBase64 = Convert.ToBase64String(plateImageResult.ToBytes());
|
string plateImageResultBase64 = Convert.ToBase64String(plateImageResult.ToBytes());
|
||||||
|
@ -109,7 +110,7 @@ namespace AIParkingApplication
|
||||||
CardID = cardID,
|
CardID = cardID,
|
||||||
TextPlate = plateString,
|
TextPlate = plateString,
|
||||||
CameraID = cameraID,
|
CameraID = cameraID,
|
||||||
ModePlate = plateType == PlateType.Square ? "1":"0",
|
ModePlate = plateType == PlateType.Square ? "1" : "0",
|
||||||
Timestamp = timestamp,
|
Timestamp = timestamp,
|
||||||
PlateImage = plateImageBase64,
|
PlateImage = plateImageBase64,
|
||||||
PlateResultImage = plateImageResultBase64,
|
PlateResultImage = plateImageResultBase64,
|
||||||
|
@ -259,6 +260,8 @@ namespace AIParkingApplication
|
||||||
|
|
||||||
[JsonProperty("data")]
|
[JsonProperty("data")]
|
||||||
public Config LoginData { get; set; }
|
public Config LoginData { get; set; }
|
||||||
|
|
||||||
|
public Exception Exception { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Config
|
public class Config
|
||||||
|
|
|
@ -42,14 +42,6 @@ namespace AIParkingApplication
|
||||||
plateCamera = new Camera(plateStream);
|
plateCamera = new Camera(plateStream);
|
||||||
this.apiController = apiController;
|
this.apiController = apiController;
|
||||||
this.doorControlAccess = doorControlAccess;
|
this.doorControlAccess = doorControlAccess;
|
||||||
this.doorControlAccess.OnNewCardReceived += C3Device_OnNewCardReceived;
|
|
||||||
|
|
||||||
plateCamera.OnVideoFrameReceived += PlateCameraOnVideoFrameReceived;
|
|
||||||
plateCamera.OnOpenVideoStreamFailed += PlateCamera_OnOpenVideoStreamFailed;
|
|
||||||
|
|
||||||
overviewCamera.OnVideoFrameReceived += OverviewCameraOnVideoFrameReceived;
|
|
||||||
overviewCamera.OnOpenVideoStreamFailed += OverviewCamera_OnOpenVideoStreamFailed;
|
|
||||||
|
|
||||||
plateProcessor = new PlateProcessor(engineApiController, this.isSupportSquarePlate, this.isSupportLongPlate);
|
plateProcessor = new PlateProcessor(engineApiController, this.isSupportSquarePlate, this.isSupportLongPlate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,9 +180,9 @@ namespace AIParkingApplication
|
||||||
|
|
||||||
private void ConnectToDoorAccessControl()
|
private void ConnectToDoorAccessControl()
|
||||||
{
|
{
|
||||||
if (!this.doorControlAccess.Connect().HasError)
|
if (!doorControlAccess.Connect().HasError)
|
||||||
{
|
{
|
||||||
_ = this.doorControlAccess.GetLogToReceiveNewCard();
|
_ = doorControlAccess.GetLogToReceiveNewCard();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -200,6 +192,12 @@ namespace AIParkingApplication
|
||||||
|
|
||||||
private void LaneIn_Load(object sender, EventArgs e)
|
private void LaneIn_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
doorControlAccess.OnNewCardReceived += C3Device_OnNewCardReceived;
|
||||||
|
plateCamera.OnVideoFrameReceived += PlateCameraOnVideoFrameReceived;
|
||||||
|
plateCamera.OnOpenVideoStreamFailed += PlateCamera_OnOpenVideoStreamFailed;
|
||||||
|
|
||||||
|
overviewCamera.OnVideoFrameReceived += OverviewCameraOnVideoFrameReceived;
|
||||||
|
overviewCamera.OnOpenVideoStreamFailed += OverviewCamera_OnOpenVideoStreamFailed;
|
||||||
ConnectToDoorAccessControl();
|
ConnectToDoorAccessControl();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
1
AIParkingApplication/LaneOut.Designer.cs
generated
1
AIParkingApplication/LaneOut.Designer.cs
generated
|
@ -267,6 +267,7 @@
|
||||||
this.Controls.Add(this.grbPlateRefernce);
|
this.Controls.Add(this.grbPlateRefernce);
|
||||||
this.Name = "LaneOut";
|
this.Name = "LaneOut";
|
||||||
this.Size = new System.Drawing.Size(680, 692);
|
this.Size = new System.Drawing.Size(680, 692);
|
||||||
|
this.Load += new System.EventHandler(this.LaneOut_Load);
|
||||||
this.grbPlateRefernce.ResumeLayout(false);
|
this.grbPlateRefernce.ResumeLayout(false);
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxOverviewImageIn)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.pictureBoxOverviewImageIn)).EndInit();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxPlateImageIn)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.pictureBoxPlateImageIn)).EndInit();
|
||||||
|
|
|
@ -20,6 +20,7 @@ namespace AIParkingApplication
|
||||||
private bool isRetryMode;
|
private bool isRetryMode;
|
||||||
private IDoorControlAccess doorControlAccess;
|
private IDoorControlAccess doorControlAccess;
|
||||||
private ApiController apiController;
|
private ApiController apiController;
|
||||||
|
private Printer printer;
|
||||||
|
|
||||||
public LaneOut(int doorId,
|
public LaneOut(int doorId,
|
||||||
string plateStream,
|
string plateStream,
|
||||||
|
@ -42,14 +43,7 @@ namespace AIParkingApplication
|
||||||
plateCamera = new Camera(plateStream);
|
plateCamera = new Camera(plateStream);
|
||||||
this.apiController = apiController;
|
this.apiController = apiController;
|
||||||
this.doorControlAccess = doorControlAccess;
|
this.doorControlAccess = doorControlAccess;
|
||||||
this.doorControlAccess.OnNewCardReceived += C3Device_OnNewCardReceived;
|
printer = new Printer();
|
||||||
|
|
||||||
plateCamera.OnVideoFrameReceived += PlateCameraOnVideoFrameReceived;
|
|
||||||
plateCamera.OnOpenVideoStreamFailed += PlateCamera_OnOpenVideoStreamFailed;
|
|
||||||
|
|
||||||
overviewCamera.OnVideoFrameReceived += OverviewCameraOnVideoFrameReceived;
|
|
||||||
overviewCamera.OnOpenVideoStreamFailed += OverviewCamera_OnOpenVideoStreamFailed;
|
|
||||||
|
|
||||||
plateProcessor = new PlateProcessor(engineApiController, this.isSupportSquarePlate, this.isSupportLongPlate);
|
plateProcessor = new PlateProcessor(engineApiController, this.isSupportSquarePlate, this.isSupportLongPlate);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,6 +97,14 @@ namespace AIParkingApplication
|
||||||
{
|
{
|
||||||
OpenDoor(doorId);
|
OpenDoor(doorId);
|
||||||
}
|
}
|
||||||
|
PrinterData printerData = new PrinterData
|
||||||
|
{
|
||||||
|
PlateString = result.PlateString,
|
||||||
|
MoneyAmount = saveLogResult.Cost,
|
||||||
|
TimeParkingIn = cardInformation.TimeIn,
|
||||||
|
TimeParkingOut = DateTime.Now.GetTimeFormatted()
|
||||||
|
};
|
||||||
|
printer.DoPrint(printerData);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -234,9 +236,9 @@ namespace AIParkingApplication
|
||||||
|
|
||||||
private void ConnectToDoorAccessControl()
|
private void ConnectToDoorAccessControl()
|
||||||
{
|
{
|
||||||
if (!this.doorControlAccess.Connect().HasError)
|
if (!doorControlAccess.Connect().HasError)
|
||||||
{
|
{
|
||||||
_ = this.doorControlAccess.GetLogToReceiveNewCard();
|
_ = doorControlAccess.GetLogToReceiveNewCard();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -248,5 +250,15 @@ namespace AIParkingApplication
|
||||||
{
|
{
|
||||||
ConnectToDoorAccessControl();
|
ConnectToDoorAccessControl();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void LaneOut_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
doorControlAccess.OnNewCardReceived += C3Device_OnNewCardReceived;
|
||||||
|
plateCamera.OnVideoFrameReceived += PlateCameraOnVideoFrameReceived;
|
||||||
|
plateCamera.OnOpenVideoStreamFailed += PlateCamera_OnOpenVideoStreamFailed;
|
||||||
|
|
||||||
|
overviewCamera.OnVideoFrameReceived += OverviewCameraOnVideoFrameReceived;
|
||||||
|
overviewCamera.OnOpenVideoStreamFailed += OverviewCamera_OnOpenVideoStreamFailed;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,15 +55,26 @@ namespace AIParkingApplication
|
||||||
}
|
}
|
||||||
|
|
||||||
var loginResult = await apiController.Login(new LoginModel { Username = username, Password = password });
|
var loginResult = await apiController.Login(new LoginModel { Username = username, Password = password });
|
||||||
|
if (loginResult.Exception != null)
|
||||||
|
{
|
||||||
|
var execeptioMessage = loginResult.Exception.Message;
|
||||||
|
if (execeptioMessage.Contains("Error converting value"))
|
||||||
|
{
|
||||||
|
lblLoginStatus.UpdateLabel("Tên tài khoản hoặc mật khẩu không đúng!", Color.Red);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (execeptioMessage.Contains("An error occurred while sending the request"))
|
||||||
|
{
|
||||||
|
lblLoginStatus.UpdateLabel("Không có kết nối tới server!\r\nKiểm tra lại kết nối tới server!", Color.Red, Color.White);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (loginResult.IsLoginSuccess)
|
if (loginResult.IsLoginSuccess)
|
||||||
{
|
{
|
||||||
new AIParkingApplicationForm(apiController, loginResult.LoginData).Show();
|
new AIParkingApplicationForm(apiController, loginResult.LoginData).Show();
|
||||||
Hide();
|
Hide();
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
lblLoginStatus.Text = "Tên tài khoản hoặc mật khẩu không đúng!";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnLogin_Click(object sender, System.EventArgs e)
|
private void btnLogin_Click(object sender, System.EventArgs e)
|
||||||
|
|
71
AIParkingApplication/Printer.cs
Normal file
71
AIParkingApplication/Printer.cs
Normal file
|
@ -0,0 +1,71 @@
|
||||||
|
using Microsoft.Win32;
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using System.Windows.Forms;
|
||||||
|
|
||||||
|
namespace AIParkingApplication
|
||||||
|
{
|
||||||
|
public class Printer
|
||||||
|
{
|
||||||
|
public Printer()
|
||||||
|
{
|
||||||
|
SetupPrinterPageSetting();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DoPrint(PrinterData printData)
|
||||||
|
{
|
||||||
|
WebBrowser webBrowser = new WebBrowser();
|
||||||
|
webBrowser.Left = 0;
|
||||||
|
string documentText = ProcessingString("PrinterForm.html", printData);
|
||||||
|
if (!string.IsNullOrEmpty(documentText))
|
||||||
|
{
|
||||||
|
webBrowser.DocumentText = documentText;
|
||||||
|
webBrowser.DocumentCompleted += WebBrowser_DocumentCompleted;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void WebBrowser_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
|
||||||
|
{
|
||||||
|
((WebBrowser)sender).Print();
|
||||||
|
}
|
||||||
|
|
||||||
|
private string ProcessingString(string path, PrinterData printerField)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
string htmlStr = File.ReadAllText(path);
|
||||||
|
htmlStr = htmlStr.Replace("{PLATE_STRING}", printerField.PlateString)
|
||||||
|
.Replace("{TIME_PARKING_IN}", printerField.TimeParkingIn)
|
||||||
|
.Replace("{TIME_PARKING_OUT}", printerField.TimeParkingOut)
|
||||||
|
.Replace("{MONEY_AMOUNT}", printerField.MoneyAmount);
|
||||||
|
return htmlStr;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"ProcessingString\texMessage:{ex.Message}");
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetupPrinterPageSetting()
|
||||||
|
{
|
||||||
|
RegistryKey key = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Microsoft\Internet Explorer\PageSetup", RegistryKeyPermissionCheck.ReadWriteSubTree);
|
||||||
|
|
||||||
|
key.SetValue("footer", string.Empty, RegistryValueKind.String);
|
||||||
|
key.SetValue("header", string.Empty, RegistryValueKind.String);
|
||||||
|
key.SetValue("margin_top", 0);
|
||||||
|
key.SetValue("margin_right", 0.2);
|
||||||
|
key.SetValue("margin_bottom", 0.5);
|
||||||
|
key.SetValue("margin_left", 0.2);
|
||||||
|
key.Close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class PrinterData
|
||||||
|
{
|
||||||
|
public string PlateString { get; set; }
|
||||||
|
public string TimeParkingIn { get; set; }
|
||||||
|
public string TimeParkingOut { get; set; }
|
||||||
|
public string MoneyAmount { get; set; }
|
||||||
|
}
|
||||||
|
}
|
1
AIParkingApplication/Statistic.Designer.cs
generated
1
AIParkingApplication/Statistic.Designer.cs
generated
|
@ -256,6 +256,7 @@
|
||||||
this.Controls.Add(this.grbVehicleStatistics);
|
this.Controls.Add(this.grbVehicleStatistics);
|
||||||
this.Name = "Statistic";
|
this.Name = "Statistic";
|
||||||
this.Size = new System.Drawing.Size(192, 292);
|
this.Size = new System.Drawing.Size(192, 292);
|
||||||
|
this.Load += new System.EventHandler(this.Statistic_Load);
|
||||||
this.grbVehicleStatistics.ResumeLayout(false);
|
this.grbVehicleStatistics.ResumeLayout(false);
|
||||||
this.tlpStatisticTable.ResumeLayout(false);
|
this.tlpStatisticTable.ResumeLayout(false);
|
||||||
this.tlpStatisticTable.PerformLayout();
|
this.tlpStatisticTable.PerformLayout();
|
||||||
|
|
|
@ -17,7 +17,6 @@ namespace AIParkingApplication
|
||||||
this.apiController = apiController;
|
this.apiController = apiController;
|
||||||
this.updateInterval = updateInterval;
|
this.updateInterval = updateInterval;
|
||||||
statisticsThread = new Thread(new ThreadStart(GetStatistic)) { IsBackground = true };
|
statisticsThread = new Thread(new ThreadStart(GetStatistic)) { IsBackground = true };
|
||||||
statisticsThread.Start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void GetStatistic()
|
private void GetStatistic()
|
||||||
|
@ -55,5 +54,10 @@ namespace AIParkingApplication
|
||||||
[JsonProperty("total_out")]
|
[JsonProperty("total_out")]
|
||||||
public string TotalOut { get; set; }
|
public string TotalOut { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Statistic_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
statisticsThread.Start();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
1
AIParkingApplication/StatusBar.Designer.cs
generated
1
AIParkingApplication/StatusBar.Designer.cs
generated
|
@ -136,6 +136,7 @@
|
||||||
this.MinimumSize = new System.Drawing.Size(1366, 24);
|
this.MinimumSize = new System.Drawing.Size(1366, 24);
|
||||||
this.Name = "StatusBar";
|
this.Name = "StatusBar";
|
||||||
this.Size = new System.Drawing.Size(1366, 24);
|
this.Size = new System.Drawing.Size(1366, 24);
|
||||||
|
this.Load += new System.EventHandler(this.StatusBar_Load);
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ namespace AIParkingApplication
|
||||||
private string doorAccessControlDeviceIP;
|
private string doorAccessControlDeviceIP;
|
||||||
private TimeSpan updateInterval;
|
private TimeSpan updateInterval;
|
||||||
private const string engineFilePath = @"\engine.bat";
|
private const string engineFilePath = @"\engine.bat";
|
||||||
|
private Thread updateInfoThread;
|
||||||
|
|
||||||
public StatusBar(string webServerIP, string doorAccessControlDeviceIP, TimeSpan updateInterval)
|
public StatusBar(string webServerIP, string doorAccessControlDeviceIP, TimeSpan updateInterval)
|
||||||
{
|
{
|
||||||
|
@ -20,9 +21,7 @@ namespace AIParkingApplication
|
||||||
this.webServerIP = webServerIP;
|
this.webServerIP = webServerIP;
|
||||||
this.doorAccessControlDeviceIP = doorAccessControlDeviceIP;
|
this.doorAccessControlDeviceIP = doorAccessControlDeviceIP;
|
||||||
this.updateInterval = updateInterval;
|
this.updateInterval = updateInterval;
|
||||||
Thread thrStatus = new Thread(new ThreadStart(UpdateStatus));
|
updateInfoThread = new Thread(new ThreadStart(UpdateStatus)) { IsBackground = true };
|
||||||
thrStatus.IsBackground = true;
|
|
||||||
thrStatus.Start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateStatus()
|
private void UpdateStatus()
|
||||||
|
@ -98,6 +97,11 @@ namespace AIParkingApplication
|
||||||
public Color BackColor { get; set; }
|
public Color BackColor { get; set; }
|
||||||
public Color ForeColor { get; set; }
|
public Color ForeColor { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void StatusBar_Load(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
updateInfoThread.Start();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
31
AIParkingApplication/printerForm.html
Normal file
31
AIParkingApplication/printerForm.html
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>Document</title>
|
||||||
|
<style>
|
||||||
|
@media only print {
|
||||||
|
@page {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
margin: 0 20px;
|
||||||
|
height: 100px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body style="">
|
||||||
|
<h3 style="text-align: center;"><em>BỆNH VIỆN BẠCH MAI</em></h3>
|
||||||
|
<h2 style="text-align: center;"><strong>Biên lai thu tiền</strong></h2>
|
||||||
|
<p>Biển số xe: <em><strong>{PLATE_STRING}</strong></em></p>
|
||||||
|
<p>Thời gian vào: <em><strong>{TIME_PARKING_IN}</strong></em></p>
|
||||||
|
<p>Thời gian ra: <strong><em>{TIME_PARKING_OUT}</em></strong></p>
|
||||||
|
<p>Số tiền: <strong><em>{MONEY_AMOUNT}</em></strong></p>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
Loading…
Reference in New Issue
Block a user