Przeglądaj źródła

增加车位显示,待调试

yc_t 6 lat temu
rodzic
commit
4d8962bd22

+ 4 - 0
PLCLinker/centralController/App.config

@@ -6,6 +6,10 @@
   <appSettings>
     <add key="retryCount" value="3"/>
     <add key="defaultLic" value="鄂ZZZZZZ"/>
+    <!--停车位显示相关配置-->
+    <add key="floors" value="12"/>
+    <add key="rows" value="2"/>
+    <add key="spacesInRow" value="8"/>
     <!--数据库信息-->
     <!--<add key="remoteDBConnStr" value="Data Source=59.175.148.85;port=3306;uid=root;pooling=true;max pool size=1024;pwd=x5;database=zxpark_cloud_2;CharSet=utf8;Allow Zero Datetime=true;"/>-->
     <!--<add key="remoteDBConnStr" value="Data Source=192.168.0.152;port=3306;uid=root;pooling=true;max pool size=1024;pwd=x5;database=zxpark_cloud_2;CharSet=utf8;Allow Zero Datetime=true;"/>-->

Plik diff jest za duży
+ 498 - 449
PLCLinker/centralController/FormCentralController.Designer.cs


+ 93 - 0
PLCLinker/centralController/FormCentralController.cs

@@ -76,6 +76,10 @@ namespace centralController
                             {
                                 UpdateAllTerms();
                             });
+                            Task.Factory.StartNew(() =>
+                            {
+                                UpdateParkingSpaceView();
+                            });
                         }));
                         break;
                     }
@@ -266,6 +270,79 @@ namespace centralController
                     tm.pbNum.Visible = false;
             }
         }
+        /// <summary>
+        /// 更新立体停车位显示
+        /// </summary>
+        private void UpdateParkingSpaceView()
+        {
+            while (!closing)
+            {
+                List<ParkingSpaceStru> psList = Monitor.Monitor.parkingSpaceInfo;
+                TableLayoutPanel tlp = new TableLayoutPanel();
+                tlp.Name = "tlp_ParkingSpace";
+                tlp.ColumnCount = Monitor.Monitor.rows;
+                this.Invoke(new Action(() =>
+                {
+                    //List<TableLayoutPanel> tlpList = new List<TableLayoutPanel>();
+                    int blockSize = Monitor.Monitor.spacesInRow * Monitor.Monitor.floors * Monitor.Monitor.rows;
+                    for (int i = 0; i < Monitor.Monitor.rows; i++)
+                    {
+                        TableLayoutPanel temp = new TableLayoutPanel();
+                        temp.Name = "tlp_ParkingSpaceSection" + (i + 1).ToString();
+                        temp.RowCount = Monitor.Monitor.spacesInRow;
+                        temp.ColumnCount = Monitor.Monitor.floors;
+                            
+                        for (int j = Math.Max(psList.Count, blockSize) - 1; j >= 0; j--)
+                        {
+                            Label lb = new Label();
+                            lb.Anchor = (((((AnchorStyles.Top | AnchorStyles.Bottom)| AnchorStyles.Left)| AnchorStyles.Right)));
+                            lb.AutoSize = true;
+                            lb.Location = new Point(10, 10);
+                            lb.Margin = new Padding(10);
+                            lb.Name = "lb_parkingSpace"+j;
+                            lb.TextAlign = ContentAlignment.MiddleCenter;
+                            if (j > psList.Count - 1)
+                            {
+                                lb.Text = "";
+                                temp.Controls.Add(lb);
+                            }
+                            else
+                            {
+                                if ((j / Monitor.Monitor.spacesInRow) % Monitor.Monitor.rows == i)
+                                {
+                                    lb.Text = "车位" + psList[j].parkingSpace;
+                                    lb.BackColor = GetPSColor(psList[j].spaceStatus);
+                                    temp.Controls.Add(lb);
+                                    //int row = Monitor.Monitor.floors - 1 - j / (Monitor.Monitor.spacesInRow * Monitor.Monitor.rows);
+                                    //int column = (j % (Monitor.Monitor.spacesInRow * Monitor.Monitor.rows)) % Monitor.Monitor.spacesInRow;
+                                    //Control ctl = temp.GetControlFromPosition(column, row);
+
+                                    //ctl.Controls.Add();
+                                }
+                            }
+                        }
+                        tlp.Controls.Add(temp);
+                        //tlpList.Add(temp);
+                    }
+                    ParkingSpaceMonitorPanel.Controls.Clear();
+                    ParkingSpaceMonitorPanel.Controls.Add(tlp);
+                }));
+                Thread.Sleep(5000);
+            }
+        }
+
+        private Color GetPSColor(int status)
+        {
+            switch (status)
+            {
+                case 0:return Color.White;
+                case 1:return Color.Yellow;
+                case 2:return Color.SkyBlue;
+                case 3:return Color.Blue;
+                case 4:return Color.Red;
+                default:return Color.Violet;
+            }
+        }
 
         #region 测试
         /// <summary>
@@ -320,6 +397,20 @@ namespace centralController
             int id = Monitor.Monitor.numMachineLinker.GetLicenseID(license);
             textBox2.Text = "终端" + id.ToString();
         }
+        
+        /// <summary>
+        /// tableLayoutPanel测试
+        /// </summary>
+        /// <param name="sender"></param>
+        /// <param name="e"></param>
+        private void button4_Click(object sender, EventArgs e)
+        {
+            Control c = tableLayoutPanel3.GetControlFromPosition(0, 0);
+            Console.WriteLine(tableLayoutPanel3.Controls.Count);
+            Control c1 = tableLayoutPanel3.GetControlFromPosition(0, 1);
+            Console.WriteLine(c1.Controls.Count);
+            Console.WriteLine("...");
+        }
         #endregion
 
         #region 系统
@@ -906,10 +997,12 @@ namespace centralController
                 {
                     Monitor.Monitor.UpdateParkingRecords(license, receiptNum, parkingFee, paymentStatus, true);
                     Monitor.Monitor.UpdateParkingRecords(license, receiptNum, parkingFee, paymentStatus, false);
+                    Monitor.Monitor.UpdateTermFeeStatus(receiptNum);
                     Monitor.Monitor.SetNotification("支付信息已修改", TextColor.Warning);
                     Log.WriteLog(LogType.process, LogFile.INFO, "手动修改支付信息,号牌:" + license + ",凭证号:" + receiptNum + ",停车费用与支付状态改为:\n" + parkingFee + "与" + paymentStatus);
                 }
             }
         }
+
     }
 }

+ 13 - 0
PLCLinker/centralController/Monitor/Monitor.cs

@@ -81,6 +81,19 @@ namespace Monitor
         public static AdvertManager advertMgr;
         public static centralController.centralController mainWin { get; set; }
         public static string defaultLic{get;set;}
+        /// <summary>
+        /// 车库层数
+        /// </summary>
+        public static int floors { get; set; }
+        /// <summary>
+        /// 每层分块数
+        /// </summary>
+        public static int rows { get; set; }
+        /// <summary>
+        /// 每块车位数
+        /// </summary>
+        public static int spacesInRow { get; set; }
+
         /// <summary>
         /// 系统初始化器句柄
         /// </summary>

+ 4 - 0
PLCLinker/centralController/Monitor/SystemInitializer.cs

@@ -63,6 +63,10 @@ namespace Monitor
                 Monitor.garageID = Convert.ToInt32(ConfigurationManager.AppSettings.Get("garageID"));
                 //广告路径
                 Monitor.advertPath = ConfigurationManager.AppSettings.Get("advertPath");
+                //停车位显示相关配置
+                Monitor.floors = Convert.ToInt32(ConfigurationManager.AppSettings.Get("floors"));
+                Monitor.rows = Convert.ToInt32(ConfigurationManager.AppSettings.Get("rows"));
+                Monitor.spacesInRow = Convert.ToInt32(ConfigurationManager.AppSettings.Get("spacesInRow"));
                 //配置文件读取结束,进入状态1
                 Monitor.initializeState = 1;
                 Monitor.globalStatus = false;

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