浏览代码

modify:调整代码显示

runming56 1 年之前
父节点
当前提交
7d39f774d9

二进制
.vs/lqnet/FileContentIndex/21840ef2-080e-4cb8-a09d-d630e29fcaad.vsidx


二进制
.vs/lqnet/FileContentIndex/2479889f-5131-41b9-9d7a-cacf25e6b076.vsidx


二进制
.vs/lqnet/FileContentIndex/90c2b3e7-bdbc-40ca-bf89-1d4f9a7d703c.vsidx


二进制
.vs/lqnet/FileContentIndex/9ed424c7-f4cb-42a0-9c22-4e37d24ee0d9.vsidx


二进制
.vs/lqnet/v17/.suo


+ 4 - 1
lqnet/Api/CallApi.cs

@@ -78,12 +78,15 @@ namespace lqnet.Api
         /// 读取文件配置
         /// </summary>
         /// <param name="propertyCode"></param>
+        /// <param name="prodtCode"></param>
+        /// <param name="configs"></param>
         /// <returns></returns>
-        public static R saveDeviceConfig(String propertyCode, string configs)
+        public static R saveDeviceConfig(String propertyCode, string prodtCode, string configs)
         {
             return CommonApi.PostApi("equit/test-device/config/save", new Dictionary<string, string>()
             {
                 {"assetNo",propertyCode },
+                {"prodts", prodtCode },
                 {"configs", configs }
             });
         }

+ 4 - 0
lqnet/Entities/DeviceConfigs.cs

@@ -16,6 +16,10 @@ namespace lqnet.Entities
         /// </summary>
         public string assetNo { set; get; }
         /// <summary>
+        /// 适用产品信息
+        /// </summary>
+        public string prodts { set; get; }
+        /// <summary>
         /// 配置信息
         /// </summary>
         public string configs { set; get; }

+ 5 - 0
lqnet/Entities/Dto/TaskSelectDTO.cs

@@ -1,4 +1,5 @@
 using Newtonsoft.Json;
+using System.Collections.Generic;
 
 namespace lqnet.Entities.Dto
 {
@@ -9,6 +10,10 @@ namespace lqnet.Entities.Dto
     {
         [JsonProperty(PropertyName = "prodtDesig")]
         public string ProdtDesig { get; set; }
+        /// <summary>
+        /// 适用产品信息
+        /// </summary>
+        public string ProdtCodes { get; set; }
 
         [JsonProperty(PropertyName = "pageNum")]
         public int PageNum { get; set; }

+ 3 - 3
lqnet/Forms/LoginForm.cs

@@ -257,6 +257,8 @@ namespace lqnet
 
         }
 
+        public List<DeviceInfo> devices = new List<DeviceInfo>(1);
+
         private void chooseDeviceBtn_Click(object sender, EventArgs e)
         {
             DevicePopupForm devicePopup = new DevicePopupForm();
@@ -268,11 +270,9 @@ namespace lqnet
                 if(selectedData != null)
                 {
                     this.deviceListCombox.Items.Clear();
-                    List<DeviceInfo> devices = new List<DeviceInfo>(1);
-                    devices.Add(selectedData);
+                    this.deviceListCombox.Items.Add(selectedData);
                     this.deviceListCombox.DisplayMember = "equitName";
                     this.deviceListCombox.ValueMember = "propertyCode";
-                    this.deviceListCombox.DataSource = devices;
                     this.deviceListCombox.SelectedIndex = 0;
                 }
                // MessageBox.Show("选择的数据是:" + selectedData);

+ 13 - 26
lqnet/Forms/MainForm.Designer.cs

@@ -51,8 +51,8 @@ namespace lqnet.Forms
         private void InitializeComponent()
         {
             this.components = new System.ComponentModel.Container();
-            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle();
-            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle();
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
+            System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
             this.prodtDesig_sel = new System.Windows.Forms.TextBox();
             this.dataGridView1 = new System.Windows.Forms.DataGridView();
             this.Index = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -91,7 +91,6 @@ namespace lqnet.Forms
             this.linkLabel1 = new System.Windows.Forms.LinkLabel();
             this.label3 = new System.Windows.Forms.Label();
             this.label2 = new System.Windows.Forms.Label();
-            this.resetBtn = new System.Windows.Forms.Button();
             ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.taskListBindingSource)).BeginInit();
             ((System.ComponentModel.ISupportInitialize)(this.mergeCountTextbox)).BeginInit();
@@ -118,8 +117,8 @@ namespace lqnet.Forms
             this.dataGridView1.AutoGenerateColumns = false;
             this.dataGridView1.BackgroundColor = System.Drawing.Color.SkyBlue;
             this.dataGridView1.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
-            dataGridViewCellStyle11.Font = new System.Drawing.Font("宋体", 12F);
-            this.dataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle11;
+            dataGridViewCellStyle1.Font = new System.Drawing.Font("宋体", 12F);
+            this.dataGridView1.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle1;
             this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
             this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
             this.Index,
@@ -255,7 +254,7 @@ namespace lqnet.Forms
             this.slectBt.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
             this.slectBt.Font = new System.Drawing.Font("宋体", 10F);
             this.slectBt.ForeColor = System.Drawing.Color.White;
-            this.slectBt.Location = new System.Drawing.Point(505, 30);
+            this.slectBt.Location = new System.Drawing.Point(419, 27);
             this.slectBt.Name = "slectBt";
             this.slectBt.Size = new System.Drawing.Size(91, 39);
             this.slectBt.TabIndex = 7;
@@ -369,9 +368,9 @@ namespace lqnet.Forms
             this.dataGridView2.AutoGenerateColumns = false;
             this.dataGridView2.BackgroundColor = System.Drawing.Color.SkyBlue;
             this.dataGridView2.ColumnHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.Single;
-            dataGridViewCellStyle12.Font = new System.Drawing.Font("宋体", 12F);
-            this.dataGridView2.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle12;
-            this.dataGridView2.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+            dataGridViewCellStyle2.Font = new System.Drawing.Font("宋体", 12F);
+            this.dataGridView2.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
+            this.dataGridView2.ColumnHeadersHeight = 40;
             this.dataGridView2.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
             this.indexDataGridViewTextBoxColumn,
             this.importColLabelDataGridViewTextBoxColumn,
@@ -383,11 +382,14 @@ namespace lqnet.Forms
             this.dataGridView2.Name = "dataGridView2";
             this.dataGridView2.RowHeadersVisible = false;
             this.dataGridView2.RowHeadersWidth = 82;
-            this.dataGridView2.RowTemplate.Height = 40;
+            this.dataGridView2.RowTemplate.Height = 50;
+            this.dataGridView2.Font = new Font("宋体", 14); // 设置单元格的文字大小
             this.dataGridView2.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect;
             this.dataGridView2.ShowCellToolTips = false;
             this.dataGridView2.Size = new System.Drawing.Size(781, 391);
             this.dataGridView2.TabIndex = 34;
+            // 设置单元格的文字大小
+            dataGridView1.DefaultCellStyle.Font = new Font("宋体", 14); // 设置单元格的文字大小
             // 
             // indexDataGridViewTextBoxColumn
             // 
@@ -414,6 +416,7 @@ namespace lqnet.Forms
             this.lineColLabelDataGridViewTextBoxColumn.MinimumWidth = 8;
             this.lineColLabelDataGridViewTextBoxColumn.Name = "lineColLabelDataGridViewTextBoxColumn";
             this.lineColLabelDataGridViewTextBoxColumn.Width = 250;
+            this.lineColLabelDataGridViewTextBoxColumn.DefaultCellStyle.Padding = new Padding(0, (dataGridView1.RowTemplate.Height - 21) / 2, 0, 0); // 设置单元格内边距
             // 
             // reportColListBindingSource
             // 
@@ -480,7 +483,6 @@ namespace lqnet.Forms
             // 
             // groupBox2
             // 
-            this.groupBox2.Controls.Add(this.resetBtn);
             this.groupBox2.Controls.Add(this.label1);
             this.groupBox2.Controls.Add(this.pageHelper2);
             this.groupBox2.Controls.Add(this.prodtDesig_sel);
@@ -558,20 +560,6 @@ namespace lqnet.Forms
             this.label2.TabIndex = 0;
             this.label2.Text = "成都晶格智汇科技有限公司";
             // 
-            // resetBtn
-            // 
-            this.resetBtn.FlatAppearance.BorderColor = System.Drawing.Color.Blue;
-            this.resetBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
-            this.resetBtn.Font = new System.Drawing.Font("宋体", 10F);
-            this.resetBtn.ForeColor = System.Drawing.Color.Blue;
-            this.resetBtn.Location = new System.Drawing.Point(395, 30);
-            this.resetBtn.Name = "resetBtn";
-            this.resetBtn.Size = new System.Drawing.Size(91, 39);
-            this.resetBtn.TabIndex = 36;
-            this.resetBtn.Text = "重置";
-            this.resetBtn.UseVisualStyleBackColor = true;
-            this.resetBtn.Click += new System.EventHandler(this.resetBtn_Click);
-            // 
             // MainForm
             // 
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
@@ -642,6 +630,5 @@ namespace lqnet.Forms
         private LinkLabel linkLabel1;
         private Label label3;
         private Label label2;
-        private Button resetBtn;
     }
 }

+ 55 - 38
lqnet/Forms/MainForm.cs

@@ -16,6 +16,7 @@ using lqnet.Entities;
 using lqnet.Entities.Dto;
 using lqnet.Entities.To;
 using lqnet.Utils;
+using Microsoft.VisualBasic.Devices;
 using Newtonsoft.Json;
 using Org.BouncyCastle.Pqc.Crypto.Lms;
 
@@ -53,6 +54,10 @@ namespace lqnet.Forms
         /// </summary>
         public List<DeviceConfigContext> _configContexts;
         /// <summary>
+        /// 适配产品列表
+        /// </summary>
+        public string prodts;
+        /// <summary>
         /// 指标上下文
         /// </summary>
         public List<ItemIndx> indexList;
@@ -146,32 +151,34 @@ namespace lqnet.Forms
         /// </summary>
         private void reloadDeviceConfig()
         {
-            //先查询本地是否存在
-            string filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "configs");
-            if(!Directory.Exists(filePath))
-            {
-                //不存在则创建目录
-                Directory.CreateDirectory(filePath);
-            }
-            string cofigPath = Path.Combine(filePath, _device.propertyCode + ".json");
-            if(!File.Exists(cofigPath))
-            {
-                readConfigFromRemote();
-            } else
-            {
-                //读取配置文件
-                using (System.IO.StreamReader file = System.IO.File.OpenText(cofigPath))
-                {
-                    try
-                    {
-                        _configContexts = JsonConvert.DeserializeObject<List<DeviceConfigContext>>(file.ReadToEnd());
-                    }
-                    catch
-                    {
-                        //配置文件读取失败
-                    }
-                }
-            }
+            //每次进入必须重新读取以获得适配产品信息
+            readConfigFromRemote();
+            ////先查询本地是否存在
+            //string filePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "configs");
+            //if(!Directory.Exists(filePath))
+            //{
+            //    //不存在则创建目录
+            //    Directory.CreateDirectory(filePath);
+            //}
+            //string cofigPath = Path.Combine(filePath, _device.propertyCode + ".json");
+            //if(!File.Exists(cofigPath))
+            //{
+            //    readConfigFromRemote();
+            //} else
+            //{
+            //    //读取配置文件
+            //    using (System.IO.StreamReader file = System.IO.File.OpenText(cofigPath))
+            //    {
+            //        try
+            //        {
+            //            _configContexts = JsonConvert.DeserializeObject<List<DeviceConfigContext>>(file.ReadToEnd());
+            //        }
+            //        catch
+            //        {
+            //            //配置文件读取失败
+            //        }
+            //    }
+            //}
         }
         /// <summary>
         /// 从远程服务器读取配置
@@ -187,12 +194,16 @@ namespace lqnet.Forms
                 {
                     config = JsonConvert.DeserializeObject<DeviceConfigs>(rs.Data.ToString());
                     _configContexts = JsonConvert.DeserializeObject<List<DeviceConfigContext>>(config.configs);
+                    prodts = string.IsNullOrEmpty(config.prodts) || string.IsNullOrWhiteSpace(config.prodts)? string.Empty: config.prodts;
                     //读取到文件后写入本地文件路径中
                     writeConfigToLocal();
                 }
                 catch
                 {
                 }
+            } else
+            {
+                MessageBox.Show("读取远程配置失败", "提示", MessageBoxButtons.OK);
             }
         }
         /// <summary>
@@ -200,8 +211,7 @@ namespace lqnet.Forms
         /// </summary>
         private void saveConfigToRemote()
         {
-
-            R rs = CallApi.saveDeviceConfig(_device.propertyCode, JsonConvert.SerializeObject(_configContexts));
+            R rs = CallApi.saveDeviceConfig(_device.propertyCode, this.dataGridView1.CurrentRow.Cells[2].Value.ToString().Trim(), JsonConvert.SerializeObject(_configContexts));
             if (rs.Code != MyConstants.CODE_SUCCESS_200)
             {
                 MessageBox.Show("设备配置信息保存失败", "提示", MessageBoxButtons.OK);
@@ -309,13 +319,6 @@ namespace lqnet.Forms
         {
             int radius = 2;
             //绘制按钮圆角
-            GraphicsPath path = new GraphicsPath();
-            Rectangle rect = new Rectangle(0, 0, this.resetBtn.Width, this.resetBtn.Height);
-            path.AddArc(rect.X, rect.Y, radius, radius, 180, 90);
-            path.AddArc(rect.X + rect.Width - radius, rect.Y, radius, radius, 270, 90);
-            path.AddArc(rect.X + rect.Width - radius, rect.Y + rect.Height - radius, radius, radius, 0, 90);
-            path.AddArc(rect.X, rect.Y + rect.Height - radius, radius, radius, 90, 90);
-            this.resetBtn.Region = new Region(path);
 
             GraphicsPath path2 = new GraphicsPath();
             Rectangle rect2 = new Rectangle(0, 0, this.slectBt.Width, this.slectBt.Height);
@@ -391,9 +394,20 @@ namespace lqnet.Forms
         private void SelectTaskList()
         {
             Func_My_CheckItemComboBox_ClearAndInit();
+            if (!string.IsNullOrEmpty(this.prodts)
+                && !string.IsNullOrWhiteSpace(this.prodts)
+                && !string.IsNullOrEmpty(this.prodtDesig_sel.Text)
+                && !string.IsNullOrWhiteSpace(this.prodtDesig_sel.Text)
+                && !this.prodts.Split(',').Contains(this.prodtDesig_sel.Text))
+            {
+                this.taskListBindingSource.Clear();
+                MessageBox.Show("没有查到任务结果", "提示", MessageBoxButtons.OK);
+                return;
+            }
             R r = CallApi.SelectTasksList(new TaskSelectDTO
             {
                 ProdtDesig = this.prodtDesig_sel.Text,
+                ProdtCodes = string.IsNullOrEmpty(this.prodts) || string.IsNullOrWhiteSpace(this.prodts)?null: this.prodts,
                 PageNum = this.pageHelper2.NowPage,
                 PageSize = this.pageHelper2.PageSize
             });
@@ -840,8 +854,11 @@ namespace lqnet.Forms
             {
                 foreach (var col in this.reportColListBindingSource.List)
                 {
-                    ReportCol rCol = col as ReportCol;
-                    itemNums += rCol.importColLabel + "-" + rCol.cellEn + ",";
+                    if(col != null)
+                    {
+                        ReportCol rCol = col as ReportCol;
+                        itemNums += rCol.importColLabel + "-" + rCol.cellEn + ",";
+                    }
                 }
                 return itemNums.Substring(0, itemNums.Length - 1);
             }
@@ -856,7 +873,7 @@ namespace lqnet.Forms
             CheckItem item = (CheckItem)this.CheckItemComboBox.SelectedItem;
             if (item != null && _configContexts != null && _configContexts.Count > 0)
             {
-                return _configContexts.Where(c => item.CheckCode.Equals(c.checkCode)).FirstOrDefault();
+                return _configContexts.Where(c => item.CheckName.Equals(c.checkName)).FirstOrDefault();
             }
             return null;
         }

+ 1 - 1
lqnet/Lqnet.csproj

@@ -24,7 +24,7 @@
     <UpdatePeriodically>false</UpdatePeriodically>
     <UpdateRequired>false</UpdateRequired>
     <MapFileExtensions>true</MapFileExtensions>
-    <ApplicationRevision>3</ApplicationRevision>
+    <ApplicationRevision>4</ApplicationRevision>
     <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
     <UseApplicationTrust>false</UseApplicationTrust>
     <PublishWizardCompleted>true</PublishWizardCompleted>

二进制
lqnet/bin/Debug/app.publish/lqnet.exe


文件差异内容过多而无法显示
+ 1 - 0
lqnet/bin/Debug/configs/10002.json


文件差异内容过多而无法显示
+ 3 - 3
lqnet/bin/Debug/lqnet.application


二进制
lqnet/bin/Debug/lqnet.exe


文件差异内容过多而无法显示
+ 2 - 2
lqnet/bin/Debug/lqnet.exe.manifest


二进制
lqnet/bin/Debug/lqnet.pdb


二进制
lqnet/obj/Debug/DesignTimeResolveAssemblyReferences.cache


二进制
lqnet/obj/Debug/Lqnet.csproj.GenerateResource.cache


文件差异内容过多而无法显示
+ 3 - 3
lqnet/obj/Debug/lqnet.application


二进制
lqnet/obj/Debug/lqnet.exe


文件差异内容过多而无法显示
+ 2 - 2
lqnet/obj/Debug/lqnet.exe.manifest


二进制
lqnet/obj/Debug/lqnet.pdb