Parcourir la source

日志筛选、保存与导出窗体添加

yc_t il y a 6 ans
Parent
commit
ad57912d60
30 fichiers modifiés avec 417 ajouts et 55 suppressions
  1. 1 3
      .gitignore
  2. BIN
      PLCLinker/PLCLinker/bin/Release/PLCLinker.exe
  3. BIN
      PLCLinker/PLCLinker/bin/Release/PLCLinker.pdb
  4. BIN
      PLCLinker/PLCLinker/obj/Release/PLCLinker.exe
  5. BIN
      PLCLinker/PLCLinker/obj/Release/PLCLinker.pdb
  6. BIN
      PLCLinker/PLCS7/bin/Release/PLCS7.dll
  7. BIN
      PLCLinker/PLCS7/bin/Release/PLCS7.pdb
  8. BIN
      PLCLinker/PLCS7/obj/Release/PLCS7.dll
  9. BIN
      PLCLinker/PLCS7/obj/Release/PLCS7.pdb
  10. 23 23
      PLCLinker/centralController/FormCentralController.Designer.cs
  11. 3 2
      PLCLinker/centralController/FormCentralController.cs
  12. 219 16
      PLCLinker/centralController/FormRecordsManager.Designer.cs
  13. 150 1
      PLCLinker/centralController/FormRecordsManager.cs
  14. 15 5
      PLCLinker/centralController/Monitor/Monitor.cs
  15. 1 1
      PLCLinker/centralController/Program.cs
  16. BIN
      PLCLinker/centralController/bin/Release/centralController.exe
  17. BIN
      PLCLinker/centralController/bin/Release/centralController.pdb
  18. 1 0
      PLCLinker/centralController/centralController.csproj
  19. BIN
      PLCLinker/centralController/obj/Release/DesignTimeResolveAssemblyReferences.cache
  20. BIN
      PLCLinker/centralController/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache
  21. 1 1
      PLCLinker/centralController/obj/Release/centralController.csproj.CoreCompileInputs.cache
  22. 3 3
      PLCLinker/centralController/obj/Release/centralController.csproj.FileListAbsolute.txt
  23. BIN
      PLCLinker/centralController/obj/Release/centralController.csproj.GenerateResource.Cache
  24. BIN
      PLCLinker/centralController/obj/Release/centralController.csprojResolveAssemblyReference.cache
  25. BIN
      PLCLinker/centralController/obj/Release/centralController.exe
  26. BIN
      PLCLinker/centralController/obj/Release/centralController.pdb
  27. BIN
      PLCLinker/socketTest/bin/Release/socketTest.exe
  28. BIN
      PLCLinker/socketTest/bin/Release/socketTest.pdb
  29. BIN
      PLCLinker/socketTest/obj/Release/socketTest.exe
  30. BIN
      PLCLinker/socketTest/obj/Release/socketTest.pdb

+ 1 - 3
.gitignore

@@ -1,4 +1,4 @@
-## Ignore Visual Studio temporary files, build results, and
+## Ignore Visual Studio temporary files, build results, and
 ## files generated by popular Visual Studio add-ons.
 
 # User-specific files
@@ -183,5 +183,3 @@ obj/
 .vs/
 #Nuget packages folder
 packages/
-/parkMonitor/App.config
-/modbus_PLC_laser_test/新plc模拟.mbs

BIN
PLCLinker/PLCLinker/bin/Release/PLCLinker.exe


BIN
PLCLinker/PLCLinker/bin/Release/PLCLinker.pdb


BIN
PLCLinker/PLCLinker/obj/Release/PLCLinker.exe


BIN
PLCLinker/PLCLinker/obj/Release/PLCLinker.pdb


BIN
PLCLinker/PLCS7/bin/Release/PLCS7.dll


BIN
PLCLinker/PLCS7/bin/Release/PLCS7.pdb


BIN
PLCLinker/PLCS7/obj/Release/PLCS7.dll


BIN
PLCLinker/PLCS7/obj/Release/PLCS7.pdb


+ 23 - 23
PLCLinker/centralController/FormCentralController.Designer.cs

@@ -37,7 +37,6 @@
             this.bar_mainWin = new DevComponents.DotNetBar.Bar();
             this.NumMachineMonitorPanel = new DevComponents.DotNetBar.PanelDockContainer();
             this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
-            this.ParkingSpaceMonitorPanel = new DevComponents.DotNetBar.PanelDockContainer();
             this.testPanel = new DevComponents.DotNetBar.PanelDockContainer();
             this.button1 = new System.Windows.Forms.Button();
             this.textBox2 = new System.Windows.Forms.TextBox();
@@ -45,6 +44,7 @@
             this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
             this.pictureBox1 = new System.Windows.Forms.PictureBox();
             this.labelX1 = new DevComponents.DotNetBar.LabelX();
+            this.ParkingSpaceMonitorPanel = new DevComponents.DotNetBar.PanelDockContainer();
             this.paymentPanel = new DevComponents.DotNetBar.PanelDockContainer();
             this.dci_NumMachine = new DevComponents.DotNetBar.DockContainerItem();
             this.dci_payment = new DevComponents.DotNetBar.DockContainerItem();
@@ -84,7 +84,7 @@
             this.btn_files = new DevComponents.DotNetBar.ButtonItem();
             this.btn_openFile = new DevComponents.DotNetBar.ButtonItem();
             this.btn_advertUpdate = new DevComponents.DotNetBar.ButtonItem();
-            this.btn_refreshRecords = new DevComponents.DotNetBar.ButtonItem();
+            this.btn_recordManagement = new DevComponents.DotNetBar.ButtonItem();
             this.btn_exportRecords = new DevComponents.DotNetBar.ButtonItem();
             this.btn_setScheme = new DevComponents.DotNetBar.ButtonItem();
             this.btn_views = new DevComponents.DotNetBar.ButtonItem();
@@ -209,8 +209,8 @@
             this.bar_mainWin.CanDockTop = false;
             this.bar_mainWin.CanHide = true;
             this.bar_mainWin.Controls.Add(this.NumMachineMonitorPanel);
-            this.bar_mainWin.Controls.Add(this.ParkingSpaceMonitorPanel);
             this.bar_mainWin.Controls.Add(this.paymentPanel);
+            this.bar_mainWin.Controls.Add(this.ParkingSpaceMonitorPanel);
             this.bar_mainWin.Controls.Add(this.testPanel);
             this.bar_mainWin.DockTabAlignment = DevComponents.DotNetBar.eTabStripAlignment.Top;
             this.bar_mainWin.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
@@ -256,19 +256,6 @@
             this.flowLayoutPanel1.TabIndex = 1;
             this.flowLayoutPanel1.Resize += new System.EventHandler(this.flowLayoutPanel1_Resize);
             // 
-            // ParkingSpaceMonitorPanel
-            // 
-            this.ParkingSpaceMonitorPanel.DisabledBackColor = System.Drawing.Color.Empty;
-            this.ParkingSpaceMonitorPanel.Location = new System.Drawing.Point(3, 28);
-            this.ParkingSpaceMonitorPanel.Name = "ParkingSpaceMonitorPanel";
-            this.ParkingSpaceMonitorPanel.Size = new System.Drawing.Size(518, 314);
-            this.ParkingSpaceMonitorPanel.Style.Alignment = System.Drawing.StringAlignment.Center;
-            this.ParkingSpaceMonitorPanel.Style.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground;
-            this.ParkingSpaceMonitorPanel.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder;
-            this.ParkingSpaceMonitorPanel.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.ItemText;
-            this.ParkingSpaceMonitorPanel.Style.GradientAngle = 90;
-            this.ParkingSpaceMonitorPanel.TabIndex = 9;
-            // 
             // testPanel
             // 
             this.testPanel.Controls.Add(this.button1);
@@ -346,6 +333,19 @@
             this.labelX1.Text = "label1\r\nlable2";
             this.labelX1.TextAlignment = System.Drawing.StringAlignment.Center;
             // 
+            // ParkingSpaceMonitorPanel
+            // 
+            this.ParkingSpaceMonitorPanel.DisabledBackColor = System.Drawing.Color.Empty;
+            this.ParkingSpaceMonitorPanel.Location = new System.Drawing.Point(3, 28);
+            this.ParkingSpaceMonitorPanel.Name = "ParkingSpaceMonitorPanel";
+            this.ParkingSpaceMonitorPanel.Size = new System.Drawing.Size(518, 314);
+            this.ParkingSpaceMonitorPanel.Style.Alignment = System.Drawing.StringAlignment.Center;
+            this.ParkingSpaceMonitorPanel.Style.BackColor1.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarBackground;
+            this.ParkingSpaceMonitorPanel.Style.BorderColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.BarDockedBorder;
+            this.ParkingSpaceMonitorPanel.Style.ForeColor.ColorSchemePart = DevComponents.DotNetBar.eColorSchemePart.ItemText;
+            this.ParkingSpaceMonitorPanel.Style.GradientAngle = 90;
+            this.ParkingSpaceMonitorPanel.TabIndex = 9;
+            // 
             // paymentPanel
             // 
             this.paymentPanel.DisabledBackColor = System.Drawing.Color.Empty;
@@ -777,7 +777,7 @@
             this.btn_files.SubItems.AddRange(new DevComponents.DotNetBar.BaseItem[] {
             this.btn_openFile,
             this.btn_advertUpdate,
-            this.btn_refreshRecords,
+            this.btn_recordManagement,
             this.btn_exportRecords,
             this.btn_setScheme});
             this.btn_files.Text = "文件";
@@ -794,11 +794,11 @@
             this.btn_advertUpdate.Text = "手动更新广告";
             this.btn_advertUpdate.Click += new System.EventHandler(this.btn_advertUpdate_Click);
             // 
-            // btn_refreshRecords
+            // btn_recordManagement
             // 
-            this.btn_refreshRecords.Name = "btn_refreshRecords";
-            this.btn_refreshRecords.Text = "刷新出入记录";
-            this.btn_refreshRecords.Click += new System.EventHandler(this.btn_refreshRecords_Click);
+            this.btn_recordManagement.Name = "btn_recordManagement";
+            this.btn_recordManagement.Text = "记录管理";
+            this.btn_recordManagement.Click += new System.EventHandler(this.btn_recordManagement_Click);
             // 
             // btn_exportRecords
             // 
@@ -857,7 +857,7 @@
             // btn_records
             // 
             this.btn_records.Name = "btn_records";
-            this.btn_records.Text = "停取记录";
+            this.btn_records.Text = "记录视图";
             this.btn_records.Click += new System.EventHandler(this.btn_records_Click);
             // 
             // btn_devices
@@ -1201,7 +1201,7 @@
         private DevComponents.DotNetBar.PanelDockContainer warningPanel;
         private DevComponents.DotNetBar.DockContainerItem dci_warning;
         private System.Windows.Forms.ProgressBar progressBar1;
-        private DevComponents.DotNetBar.ButtonItem btn_refreshRecords;
+        private DevComponents.DotNetBar.ButtonItem btn_recordManagement;
         private DevComponents.DotNetBar.ButtonItem btn_exportRecords;
         private DevComponents.DotNetBar.Bar bar_bottom;
         private DevComponents.DotNetBar.Bar bar_notification;

+ 3 - 2
PLCLinker/centralController/FormCentralController.cs

@@ -131,9 +131,10 @@ namespace centralController
         /// </summary>
         /// <param name="sender"></param>
         /// <param name="e"></param>
-        private void btn_refreshRecords_Click(object sender, EventArgs e)
+        private void btn_recordManagement_Click(object sender, EventArgs e)
         {
-            RefreshRecords(null, null);
+            FormRecordsManager formRecordsManager = new FormRecordsManager();
+            formRecordsManager.ShowDialog();
         }
         /// <summary>
         /// 导出停车记录按钮

+ 219 - 16
PLCLinker/centralController/FormRecordsManager.Designer.cs

@@ -30,8 +30,8 @@
         {
             System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
             this.stc_recordManager = new DevComponents.DotNetBar.SuperTabControl();
-            this.sti_parkingRecords = new DevComponents.DotNetBar.SuperTabItem();
             this.superTabControlPanel1 = new DevComponents.DotNetBar.SuperTabControlPanel();
+            this.tlp_parkingRecord = new System.Windows.Forms.TableLayoutPanel();
             this.dgvx_parkingRecords = new DevComponents.DotNetBar.Controls.DataGridViewX();
             this.parkingRecordsID = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.userID = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -41,10 +41,25 @@
             this.realGetTime = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.receiptNum = new System.Windows.Forms.DataGridViewTextBoxColumn();
             this.parkingPrice = new System.Windows.Forms.DataGridViewTextBoxColumn();
+            this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
+            this.mtb_endDate = new System.Windows.Forms.MaskedTextBox();
+            this.lbx_startDate = new DevComponents.DotNetBar.LabelX();
+            this.labelX1 = new DevComponents.DotNetBar.LabelX();
+            this.mtb_startDate = new System.Windows.Forms.MaskedTextBox();
+            this.btnx_parkingRecordSearch = new DevComponents.DotNetBar.ButtonX();
+            this.btnx_export = new DevComponents.DotNetBar.ButtonX();
+            this.sti_parkingRecords = new DevComponents.DotNetBar.SuperTabItem();
+            this.superTabControlPanel3 = new DevComponents.DotNetBar.SuperTabControlPanel();
+            this.sti_dailySummary = new DevComponents.DotNetBar.SuperTabItem();
+            this.sti_carRecords = new DevComponents.DotNetBar.SuperTabItem();
+            this.labelX2 = new DevComponents.DotNetBar.LabelX();
+            this.tb_license = new System.Windows.Forms.TextBox();
             ((System.ComponentModel.ISupportInitialize)(this.stc_recordManager)).BeginInit();
             this.stc_recordManager.SuspendLayout();
             this.superTabControlPanel1.SuspendLayout();
+            this.tlp_parkingRecord.SuspendLayout();
             ((System.ComponentModel.ISupportInitialize)(this.dgvx_parkingRecords)).BeginInit();
+            this.tableLayoutPanel1.SuspendLayout();
             this.SuspendLayout();
             // 
             // stc_recordManager
@@ -65,37 +80,47 @@
             this.stc_recordManager.ControlBox.MenuBox,
             this.stc_recordManager.ControlBox.CloseBox});
             this.stc_recordManager.Controls.Add(this.superTabControlPanel1);
+            this.stc_recordManager.Controls.Add(this.superTabControlPanel3);
             this.stc_recordManager.Dock = System.Windows.Forms.DockStyle.Fill;
             this.stc_recordManager.Location = new System.Drawing.Point(0, 0);
             this.stc_recordManager.Name = "stc_recordManager";
             this.stc_recordManager.ReorderTabsEnabled = true;
             this.stc_recordManager.SelectedTabFont = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold);
             this.stc_recordManager.SelectedTabIndex = 0;
-            this.stc_recordManager.Size = new System.Drawing.Size(913, 349);
+            this.stc_recordManager.Size = new System.Drawing.Size(943, 464);
             this.stc_recordManager.TabAlignment = DevComponents.DotNetBar.eTabStripAlignment.Left;
             this.stc_recordManager.TabFont = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
             this.stc_recordManager.TabIndex = 0;
             this.stc_recordManager.Tabs.AddRange(new DevComponents.DotNetBar.BaseItem[] {
-            this.sti_parkingRecords});
+            this.sti_parkingRecords,
+            this.sti_dailySummary});
             this.stc_recordManager.Text = "superTabControl1";
             // 
-            // sti_parkingRecords
-            // 
-            this.sti_parkingRecords.AttachedControl = this.superTabControlPanel1;
-            this.sti_parkingRecords.GlobalItem = false;
-            this.sti_parkingRecords.Name = "sti_parkingRecords";
-            this.sti_parkingRecords.Text = "停取记录";
-            // 
             // superTabControlPanel1
             // 
-            this.superTabControlPanel1.Controls.Add(this.dgvx_parkingRecords);
+            this.superTabControlPanel1.Controls.Add(this.tlp_parkingRecord);
             this.superTabControlPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
-            this.superTabControlPanel1.Location = new System.Drawing.Point(69, 0);
+            this.superTabControlPanel1.Location = new System.Drawing.Point(93, 0);
             this.superTabControlPanel1.Name = "superTabControlPanel1";
-            this.superTabControlPanel1.Size = new System.Drawing.Size(844, 349);
+            this.superTabControlPanel1.Size = new System.Drawing.Size(850, 464);
             this.superTabControlPanel1.TabIndex = 1;
             this.superTabControlPanel1.TabItem = this.sti_parkingRecords;
             // 
+            // tlp_parkingRecord
+            // 
+            this.tlp_parkingRecord.ColumnCount = 1;
+            this.tlp_parkingRecord.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
+            this.tlp_parkingRecord.Controls.Add(this.dgvx_parkingRecords, 0, 1);
+            this.tlp_parkingRecord.Controls.Add(this.tableLayoutPanel1, 0, 0);
+            this.tlp_parkingRecord.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.tlp_parkingRecord.Location = new System.Drawing.Point(0, 0);
+            this.tlp_parkingRecord.Name = "tlp_parkingRecord";
+            this.tlp_parkingRecord.RowCount = 2;
+            this.tlp_parkingRecord.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 15F));
+            this.tlp_parkingRecord.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 85F));
+            this.tlp_parkingRecord.Size = new System.Drawing.Size(850, 464);
+            this.tlp_parkingRecord.TabIndex = 2;
+            // 
             // dgvx_parkingRecords
             // 
             this.dgvx_parkingRecords.BackgroundColor = System.Drawing.SystemColors.ActiveCaption;
@@ -119,10 +144,12 @@
             this.dgvx_parkingRecords.DefaultCellStyle = dataGridViewCellStyle1;
             this.dgvx_parkingRecords.Dock = System.Windows.Forms.DockStyle.Fill;
             this.dgvx_parkingRecords.GridColor = System.Drawing.Color.FromArgb(((int)(((byte)(208)))), ((int)(((byte)(215)))), ((int)(((byte)(229)))));
-            this.dgvx_parkingRecords.Location = new System.Drawing.Point(0, 0);
+            this.dgvx_parkingRecords.Location = new System.Drawing.Point(3, 72);
+            this.dgvx_parkingRecords.MinimumSize = new System.Drawing.Size(389, 0);
             this.dgvx_parkingRecords.Name = "dgvx_parkingRecords";
             this.dgvx_parkingRecords.RowTemplate.Height = 23;
-            this.dgvx_parkingRecords.Size = new System.Drawing.Size(844, 349);
+            this.dgvx_parkingRecords.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
+            this.dgvx_parkingRecords.Size = new System.Drawing.Size(844, 389);
             this.dgvx_parkingRecords.TabIndex = 1;
             // 
             // parkingRecordsID
@@ -195,18 +222,181 @@
             this.parkingPrice.Name = "parkingPrice";
             this.parkingPrice.ReadOnly = true;
             // 
+            // tableLayoutPanel1
+            // 
+            this.tableLayoutPanel1.ColumnCount = 8;
+            this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 85F));
+            this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33334F));
+            this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 85F));
+            this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33334F));
+            this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 85F));
+            this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
+            this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 80F));
+            this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 80F));
+            this.tableLayoutPanel1.Controls.Add(this.mtb_endDate, 3, 0);
+            this.tableLayoutPanel1.Controls.Add(this.lbx_startDate, 0, 0);
+            this.tableLayoutPanel1.Controls.Add(this.labelX1, 2, 0);
+            this.tableLayoutPanel1.Controls.Add(this.mtb_startDate, 1, 0);
+            this.tableLayoutPanel1.Controls.Add(this.btnx_parkingRecordSearch, 6, 0);
+            this.tableLayoutPanel1.Controls.Add(this.btnx_export, 7, 0);
+            this.tableLayoutPanel1.Controls.Add(this.labelX2, 4, 0);
+            this.tableLayoutPanel1.Controls.Add(this.tb_license, 5, 0);
+            this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.tableLayoutPanel1.Location = new System.Drawing.Point(3, 3);
+            this.tableLayoutPanel1.Name = "tableLayoutPanel1";
+            this.tableLayoutPanel1.RowCount = 1;
+            this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
+            this.tableLayoutPanel1.Size = new System.Drawing.Size(844, 63);
+            this.tableLayoutPanel1.TabIndex = 2;
+            // 
+            // mtb_endDate
+            // 
+            this.mtb_endDate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
+            this.mtb_endDate.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.mtb_endDate.Location = new System.Drawing.Point(316, 17);
+            this.mtb_endDate.Mask = "0000年00月00日";
+            this.mtb_endDate.Name = "mtb_endDate";
+            this.mtb_endDate.ShortcutsEnabled = false;
+            this.mtb_endDate.Size = new System.Drawing.Size(137, 29);
+            this.mtb_endDate.TabIndex = 6;
+            this.mtb_endDate.Text = "20181020";
+            this.mtb_endDate.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
+            // 
+            // lbx_startDate
+            // 
+            // 
+            // 
+            // 
+            this.lbx_startDate.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
+            this.lbx_startDate.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.lbx_startDate.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.lbx_startDate.Location = new System.Drawing.Point(3, 3);
+            this.lbx_startDate.Name = "lbx_startDate";
+            this.lbx_startDate.Size = new System.Drawing.Size(79, 57);
+            this.lbx_startDate.TabIndex = 3;
+            this.lbx_startDate.Text = "起始日期:";
+            // 
+            // labelX1
+            // 
+            // 
+            // 
+            // 
+            this.labelX1.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
+            this.labelX1.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.labelX1.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.labelX1.Location = new System.Drawing.Point(231, 3);
+            this.labelX1.Name = "labelX1";
+            this.labelX1.Size = new System.Drawing.Size(79, 57);
+            this.labelX1.TabIndex = 4;
+            this.labelX1.Text = "截止日期:";
+            // 
+            // mtb_startDate
+            // 
+            this.mtb_startDate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
+            this.mtb_startDate.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.mtb_startDate.Location = new System.Drawing.Point(88, 17);
+            this.mtb_startDate.Mask = "0000年00月00日";
+            this.mtb_startDate.Name = "mtb_startDate";
+            this.mtb_startDate.ShortcutsEnabled = false;
+            this.mtb_startDate.Size = new System.Drawing.Size(137, 29);
+            this.mtb_startDate.TabIndex = 5;
+            this.mtb_startDate.Text = "20180920";
+            this.mtb_startDate.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
+            // 
+            // btnx_parkingRecordSearch
+            // 
+            this.btnx_parkingRecordSearch.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
+            this.btnx_parkingRecordSearch.Anchor = System.Windows.Forms.AnchorStyles.Left;
+            this.btnx_parkingRecordSearch.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
+            this.btnx_parkingRecordSearch.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.btnx_parkingRecordSearch.Location = new System.Drawing.Point(686, 14);
+            this.btnx_parkingRecordSearch.Name = "btnx_parkingRecordSearch";
+            this.btnx_parkingRecordSearch.Size = new System.Drawing.Size(74, 35);
+            this.btnx_parkingRecordSearch.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
+            this.btnx_parkingRecordSearch.TabIndex = 7;
+            this.btnx_parkingRecordSearch.Text = "查询";
+            this.btnx_parkingRecordSearch.Click += new System.EventHandler(this.btnx_parkingRecordSearch_Click);
+            // 
+            // btnx_export
+            // 
+            this.btnx_export.AccessibleRole = System.Windows.Forms.AccessibleRole.PushButton;
+            this.btnx_export.Anchor = System.Windows.Forms.AnchorStyles.Left;
+            this.btnx_export.ColorTable = DevComponents.DotNetBar.eButtonColor.OrangeWithBackground;
+            this.btnx_export.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.btnx_export.Location = new System.Drawing.Point(766, 14);
+            this.btnx_export.Name = "btnx_export";
+            this.btnx_export.Size = new System.Drawing.Size(75, 35);
+            this.btnx_export.Style = DevComponents.DotNetBar.eDotNetBarStyle.StyleManagerControlled;
+            this.btnx_export.TabIndex = 8;
+            this.btnx_export.Text = "导出";
+            this.btnx_export.Click += new System.EventHandler(this.btnx_parkingRecrodExport_Click);
+            // 
+            // sti_parkingRecords
+            // 
+            this.sti_parkingRecords.AttachedControl = this.superTabControlPanel1;
+            this.sti_parkingRecords.GlobalItem = false;
+            this.sti_parkingRecords.Name = "sti_parkingRecords";
+            this.sti_parkingRecords.Text = "原始停取记录";
+            // 
+            // superTabControlPanel3
+            // 
+            this.superTabControlPanel3.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.superTabControlPanel3.Location = new System.Drawing.Point(92, 0);
+            this.superTabControlPanel3.Name = "superTabControlPanel3";
+            this.superTabControlPanel3.Size = new System.Drawing.Size(851, 464);
+            this.superTabControlPanel3.TabIndex = 0;
+            this.superTabControlPanel3.TabItem = this.sti_dailySummary;
+            // 
+            // sti_dailySummary
+            // 
+            this.sti_dailySummary.AttachedControl = this.superTabControlPanel3;
+            this.sti_dailySummary.GlobalItem = false;
+            this.sti_dailySummary.Name = "sti_dailySummary";
+            this.sti_dailySummary.Text = "按日总结";
+            // 
+            // sti_carRecords
+            // 
+            this.sti_carRecords.GlobalItem = false;
+            this.sti_carRecords.Name = "sti_carRecords";
+            this.sti_carRecords.Text = "车辆停取记录";
+            // 
+            // labelX2
+            // 
+            // 
+            // 
+            // 
+            this.labelX2.BackgroundStyle.CornerType = DevComponents.DotNetBar.eCornerType.Square;
+            this.labelX2.Dock = System.Windows.Forms.DockStyle.Fill;
+            this.labelX2.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.labelX2.Location = new System.Drawing.Point(459, 3);
+            this.labelX2.Name = "labelX2";
+            this.labelX2.Size = new System.Drawing.Size(79, 57);
+            this.labelX2.TabIndex = 9;
+            this.labelX2.Text = "车辆号牌:";
+            // 
+            // tb_license
+            // 
+            this.tb_license.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
+            this.tb_license.Location = new System.Drawing.Point(544, 21);
+            this.tb_license.Name = "tb_license";
+            this.tb_license.Size = new System.Drawing.Size(136, 21);
+            this.tb_license.TabIndex = 10;
+            // 
             // FormRecordsManager
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(913, 349);
+            this.ClientSize = new System.Drawing.Size(943, 464);
             this.Controls.Add(this.stc_recordManager);
             this.Name = "FormRecordsManager";
             this.Text = "FormRecordsManager";
             ((System.ComponentModel.ISupportInitialize)(this.stc_recordManager)).EndInit();
             this.stc_recordManager.ResumeLayout(false);
             this.superTabControlPanel1.ResumeLayout(false);
+            this.tlp_parkingRecord.ResumeLayout(false);
             ((System.ComponentModel.ISupportInitialize)(this.dgvx_parkingRecords)).EndInit();
+            this.tableLayoutPanel1.ResumeLayout(false);
+            this.tableLayoutPanel1.PerformLayout();
             this.ResumeLayout(false);
 
         }
@@ -216,6 +406,7 @@
         private DevComponents.DotNetBar.SuperTabControl stc_recordManager;
         private DevComponents.DotNetBar.SuperTabControlPanel superTabControlPanel1;
         private DevComponents.DotNetBar.SuperTabItem sti_parkingRecords;
+        private System.Windows.Forms.TableLayoutPanel tlp_parkingRecord;
         private DevComponents.DotNetBar.Controls.DataGridViewX dgvx_parkingRecords;
         private System.Windows.Forms.DataGridViewTextBoxColumn parkingRecordsID;
         private System.Windows.Forms.DataGridViewTextBoxColumn userID;
@@ -225,5 +416,17 @@
         private System.Windows.Forms.DataGridViewTextBoxColumn realGetTime;
         private System.Windows.Forms.DataGridViewTextBoxColumn receiptNum;
         private System.Windows.Forms.DataGridViewTextBoxColumn parkingPrice;
+        private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
+        private DevComponents.DotNetBar.LabelX lbx_startDate;
+        private DevComponents.DotNetBar.LabelX labelX1;
+        private System.Windows.Forms.MaskedTextBox mtb_endDate;
+        private System.Windows.Forms.MaskedTextBox mtb_startDate;
+        private DevComponents.DotNetBar.ButtonX btnx_parkingRecordSearch;
+        private DevComponents.DotNetBar.ButtonX btnx_export;
+        private DevComponents.DotNetBar.SuperTabControlPanel superTabControlPanel3;
+        private DevComponents.DotNetBar.SuperTabItem sti_dailySummary;
+        private DevComponents.DotNetBar.SuperTabItem sti_carRecords;
+        private DevComponents.DotNetBar.LabelX labelX2;
+        private System.Windows.Forms.TextBox tb_license;
     }
 }

+ 150 - 1
PLCLinker/centralController/FormRecordsManager.cs

@@ -1,12 +1,16 @@
-using System;
+using DevComponents.DotNetBar.Controls;
+using System;
 using System.Collections.Generic;
 using System.ComponentModel;
 using System.Data;
 using System.Drawing;
+using System.IO;
 using System.Linq;
+using System.Runtime.InteropServices;
 using System.Text;
 using System.Threading.Tasks;
 using System.Windows.Forms;
+using Excel = Microsoft.Office.Interop.Excel;
 
 namespace centralController
 {
@@ -16,5 +20,150 @@ namespace centralController
         {
             InitializeComponent();
         }
+
+        private void btnx_parkingRecordSearch_Click(object sender, EventArgs e)
+        {
+            DateTime start, end;
+            string license="";
+            try
+            {
+                start = DateTime.Parse(mtb_startDate.Text);
+                end = DateTime.Parse(mtb_endDate.Text);
+                license = tb_license.Text;
+            }
+            catch { MessageBox.Show("日期输入异常,请重新输入");return; }
+
+            dgvx_parkingRecords.Rows.Clear();
+            List<object[]> list = Monitor.Monitor.GetParkingRecords(license,start.ToString("yyyy-MM-dd"), end.ToString("yyyy-MM-dd"));
+            List<object[]>.Enumerator listEnumer = list.GetEnumerator();
+            while (listEnumer.MoveNext())
+            {
+                dgvx_parkingRecords.Rows.Add(listEnumer.Current);
+            }
+            //Console.WriteLine(mtb_startDate.Text+","+mtb_endDate.Text);
+            //Console.WriteLine(start.ToString("yyyy-MM-dd") + "," + end.ToString("yyyy-MM-dd"));
+        }
+
+        private void btnx_parkingRecrodExport_Click(object sender, EventArgs e)
+        {
+            SaveRecord();
+        }
+
+        /// <summary>
+        /// 保存记录为xls
+        /// </summary>
+        private void SaveRecord()
+        {
+            FolderBrowserDialog dialog = new FolderBrowserDialog();
+            dialog.Description = "请选择日志将要导出的目标文件夹";
+            if (dialog.ShowDialog() == DialogResult.OK)
+            {
+                if (string.IsNullOrEmpty(dialog.SelectedPath))
+                {
+                    DialogResult answer = MessageBox.Show("文件夹路径为空\n使用默认位置" + Directory.GetCurrentDirectory() + "?", "提示", MessageBoxButtons.OKCancel);
+                    if (answer.Equals(DialogResult.OK))
+                    {
+                        Export(dgvx_parkingRecords, Directory.GetCurrentDirectory() + "\\", stc_recordManager.SelectedTab.Text);
+                    }
+                    else
+                    {
+                        return;
+                    }
+                }
+                else
+                {
+                    DialogResult answer = MessageBox.Show("将日志保存到" + dialog.SelectedPath + "?", "提示", MessageBoxButtons.OKCancel);
+                    if (answer.Equals(DialogResult.OK))
+                    {
+                        Export(dgvx_parkingRecords, dialog.SelectedPath + "\\", stc_recordManager.SelectedTab.Text);
+                    }
+                    else
+                    {
+                        return;
+                    }
+                }
+            }
+        }
+
+        /// <summary>
+        /// 导出excel文件
+        /// </summary>
+        /// <param name="dataGridView1"></param>
+        /// <param name="path">绝对路径,"D:\\abc\\xxx.xls"</param>
+        private void Export(DataGridViewX dataGridView1, string path,string name)
+        {
+            try
+            {
+                if (dataGridView1.Rows.Count == 0)
+                {
+                    return;
+                }
+                Excel.Application excel = new Excel.Application();
+                excel.Visible = false;
+                Excel.Workbook workbook = excel.Workbooks.Add(true);
+                Excel.Worksheet worksheet = (Excel.Worksheet)workbook.Worksheets[1];
+                for (int i = 0; i < dataGridView1.Columns.Count; i++)
+                {
+                    if (dataGridView1.Columns[i].Visible == true)
+                    {
+                        worksheet.Cells[1, i + 1] = dataGridView1.Columns[i].HeaderText;
+                    }
+                }
+                for (int i = 0; i < dataGridView1.Rows.Count - 1; i++)
+                {
+                    System.Windows.Forms.Application.DoEvents();
+                    for (int j = 0; j < dataGridView1.Columns.Count; j++)
+                    {
+                        if (dataGridView1.Columns[j].Visible == true)
+                        {
+                            if (dataGridView1[j, i].ValueType == typeof(string))
+                            {
+                                worksheet.Cells[i + 2, j + 1] = "'" + dataGridView1[j, i].Value.ToString();
+                            }
+                            else
+                            {
+                                worksheet.Cells[i + 2, j + 1] = dataGridView1[j, i].Value.ToString();
+                            }
+                        }
+                    }
+                }
+                //设置禁止弹出保存和覆盖的询问提示框  
+                excel.DisplayAlerts = false;
+                excel.AlertBeforeOverwriting = false;
+                worksheet.Cells.Columns.AutoFit();
+                //保存写入的数据,这里还没有保存到磁盘
+                workbook.Saved = true;
+                if (Directory.Exists(path))
+                {
+                    //设置新建文件路径及名称
+                    string savePath = path + DateTime.Now.ToString("yyyy-MM-dd") + name +".xls";
+
+                    //创建文件
+                    FileStream file = new FileStream(savePath, FileMode.CreateNew);
+
+                    //关闭释放流,不然没办法写入数据
+                    file.Close();
+                    file.Dispose();
+
+                    //保存到指定的路径
+                    workbook.SaveCopyAs(savePath);
+                }
+
+                workbook.Close(false, Type.Missing, Type.Missing);
+
+                //确保Excel进程关闭  
+                excel.Quit();
+                //释放 COM 对象
+                Marshal.ReleaseComObject(worksheet);
+                Marshal.ReleaseComObject(workbook);
+                Marshal.ReleaseComObject(excel);
+                excel = null;
+                worksheet = null;
+                workbook = null;
+                GC.Collect();//如果不使用这条语,excel会无法正常退出
+            }
+            catch (Exception e) { Console.WriteLine("导出excel文件异常," + e.Message); }
+
+        }
     }
 }

+ 15 - 5
PLCLinker/centralController/Monitor/Monitor.cs

@@ -369,14 +369,24 @@ namespace Monitor
         /// 返回停车记录信息
         /// </summary>
         /// <returns></returns>
-        public static List<object[]> GetParkingRecords()
+        public static List<object[]> GetParkingRecords(string license="",string startTime = "",string endTime = "")
         {
             DateTime now = DateTime.Now;
-            DateTime yesterday = DateTime.Now - (new TimeSpan(1, 0, 0, 0));
-            DateTime twoDaysAgo = DateTime.Now - (new TimeSpan(2, 0, 0, 0));
             List<object[]> result = new List<object[]>();
-            string getParkingRecordsSql = "select parkingRecordsID,userID,numberPlate,parkingSpaceID,realParkTime,realGetTime,receiptNum,parkingPrice " +
-                "from parkingrecords where realParkTime like '" + now.ToString("yyyy-MM-dd") + "%' or realParkTime like '" + yesterday.ToString("yyyy-MM-dd") + "%' or realParkTime like '" + twoDaysAgo.ToString("yyyy-MM-dd") + "%';";
+            string getParkingRecordsSql = "";
+            if (startTime == "" || endTime == "")
+            {
+                DateTime yesterday = DateTime.Now - (new TimeSpan(1, 0, 0, 0));
+                DateTime twoDaysAgo = DateTime.Now - (new TimeSpan(2, 0, 0, 0));
+                getParkingRecordsSql = "select parkingRecordsID,userID,numberPlate,parkingSpaceID,realParkTime,realGetTime,receiptNum,parkingPrice " +
+                "from parkingrecords where numberPlate "+(license==""? "like '%" : "= '"+license)+"' and (realParkTime like '" + now.ToString("yyyy-MM-dd") + "%' or realParkTime like '" + yesterday.ToString("yyyy-MM-dd") + "%' or realParkTime like '" + twoDaysAgo.ToString("yyyy-MM-dd") + "%');";
+            }
+            else
+            {
+                getParkingRecordsSql = "select parkingRecordsID,userID,numberPlate,parkingSpaceID,realParkTime,realGetTime,receiptNum,parkingPrice " +
+                "from parkingrecords where numberPlate " + (license == "" ? "like '%" : "= '" + license) + "' and realParkTime >= '" + startTime + "' and realParkTime <= '"+endTime+"';";
+            }
+            
             if (localDBOper != null)
             {
                 lock (localDBOper)

+ 1 - 1
PLCLinker/centralController/Program.cs

@@ -12,7 +12,7 @@ namespace centralController
         /// <summary>
         /// 应用程序的主入口点。
         /// </summary>
-        //[STAThread]
+        [STAThread]
         static void Main()
         {
             Application.EnableVisualStyles();

BIN
PLCLinker/centralController/bin/Release/centralController.exe


BIN
PLCLinker/centralController/bin/Release/centralController.pdb


+ 1 - 0
PLCLinker/centralController/centralController.csproj

@@ -42,6 +42,7 @@
       <SpecificVersion>False</SpecificVersion>
       <HintPath>sdk\mysql\db.dll</HintPath>
     </Reference>
+    <Reference Include="DevComponents.DotNetBar.Schedule, Version=12.5.0.2, Culture=neutral, PublicKeyToken=c39c3242a43eee2b" />
     <Reference Include="DevComponents.DotNetBar.SuperGrid, Version=12.5.0.2, Culture=neutral, PublicKeyToken=c39c3242a43eee2b" />
     <Reference Include="DevComponents.DotNetBar2, Version=12.5.0.2, Culture=neutral, PublicKeyToken=c39c3242a43eee2b, processorArchitecture=MSIL">
       <SpecificVersion>False</SpecificVersion>

BIN
PLCLinker/centralController/obj/Release/DesignTimeResolveAssemblyReferences.cache


BIN
PLCLinker/centralController/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache


+ 1 - 1
PLCLinker/centralController/obj/Release/centralController.csproj.CoreCompileInputs.cache

@@ -1 +1 @@
-b33e29961de6ff28a089d22b4030dda892eef81e
+389c91d0da495e04be995bea1260c3d22fe027f3

+ 3 - 3
PLCLinker/centralController/obj/Release/centralController.csproj.FileListAbsolute.txt

@@ -13,6 +13,7 @@ E:\superScene\智能停车项目\智能停车项目v2.0\PLCLinker\centralControl
 E:\superScene\智能停车项目\智能停车项目v2.0\PLCLinker\centralController\bin\Release\DevComponents.DotNetBar2.xml
 E:\superScene\智能停车项目\智能停车项目v2.0\PLCLinker\centralController\bin\Release\log4net.xml
 E:\superScene\智能停车项目\智能停车项目v2.0\PLCLinker\centralController\bin\Release\PLCS7.xml
+E:\superScene\智能停车项目\智能停车项目v2.0\PLCLinker\centralController\obj\Release\centralController.csprojResolveAssemblyReference.cache
 E:\superScene\智能停车项目\智能停车项目v2.0\PLCLinker\centralController\obj\Release\centralController.g.resources
 E:\superScene\智能停车项目\智能停车项目v2.0\PLCLinker\centralController\obj\Release\VzClientSDKDemo.BaseConfig_From.resources
 E:\superScene\智能停车项目\智能停车项目v2.0\PLCLinker\centralController\obj\Release\PLC_Communication.FormModbus.resources
@@ -20,6 +21,8 @@ E:\superScene\智能停车项目\智能停车项目v2.0\PLCLinker\centralControl
 E:\superScene\智能停车项目\智能停车项目v2.0\PLCLinker\centralController\obj\Release\VzClientSDKDemo.RuleCfg_Form.resources
 E:\superScene\智能停车项目\智能停车项目v2.0\PLCLinker\centralController\obj\Release\VzClientSDKDemo.RVideoCfg_Form.resources
 E:\superScene\智能停车项目\智能停车项目v2.0\PLCLinker\centralController\obj\Release\VzClientSDKDemo.VideoCfg_Form.resources
+E:\superScene\智能停车项目\智能停车项目v2.0\PLCLinker\centralController\obj\Release\centralController.FormNumberMachinePreview.resources
+E:\superScene\智能停车项目\智能停车项目v2.0\PLCLinker\centralController\obj\Release\centralController.FormRecordsManager.resources
 E:\superScene\智能停车项目\智能停车项目v2.0\PLCLinker\centralController\obj\Release\centralController.FormSysInfo.resources
 E:\superScene\智能停车项目\智能停车项目v2.0\PLCLinker\centralController\obj\Release\centralController.Form_paymentScheme.resources
 E:\superScene\智能停车项目\智能停车项目v2.0\PLCLinker\centralController\obj\Release\centralController.centralController.resources
@@ -29,6 +32,3 @@ E:\superScene\智能停车项目\智能停车项目v2.0\PLCLinker\centralControl
 E:\superScene\智能停车项目\智能停车项目v2.0\PLCLinker\centralController\obj\Release\centralController.csproj.CoreCompileInputs.cache
 E:\superScene\智能停车项目\智能停车项目v2.0\PLCLinker\centralController\obj\Release\centralController.exe
 E:\superScene\智能停车项目\智能停车项目v2.0\PLCLinker\centralController\obj\Release\centralController.pdb
-E:\superScene\智能停车项目\智能停车项目v2.0\PLCLinker\centralController\obj\Release\centralController.csprojResolveAssemblyReference.cache
-E:\superScene\智能停车项目\智能停车项目v2.0\PLCLinker\centralController\obj\Release\centralController.FormNumberMachinePreview.resources
-E:\superScene\智能停车项目\智能停车项目v2.0\PLCLinker\centralController\obj\Release\centralController.FormRecordsManager.resources

BIN
PLCLinker/centralController/obj/Release/centralController.csproj.GenerateResource.Cache


BIN
PLCLinker/centralController/obj/Release/centralController.csprojResolveAssemblyReference.cache


BIN
PLCLinker/centralController/obj/Release/centralController.exe


BIN
PLCLinker/centralController/obj/Release/centralController.pdb


BIN
PLCLinker/socketTest/bin/Release/socketTest.exe


BIN
PLCLinker/socketTest/bin/Release/socketTest.pdb


BIN
PLCLinker/socketTest/obj/Release/socketTest.exe


BIN
PLCLinker/socketTest/obj/Release/socketTest.pdb