Browse Source

测试项目内容修改

callm 4 years ago
parent
commit
93a373e991

+ 24 - 0
TestProject/Form1.cs

@@ -18,7 +18,31 @@ namespace TestProject
 
         private void Form1_Load(object sender, EventArgs e)
         {
+            UMES.DLLService.MESHelper mes = new UMES.DLLService.MESHelper();
+            string Err = "";
+            string json = "";
+            if (mes.GetMobileAllInfo("FG04P1M1C2M0002446", out json, out Err)) {
+                Console.WriteLine(json);
+            }
+            else
+            {
+                Console.WriteLine(Err);
+            }
+            //if (mes.CheckRoutePassed("FGKESERIAL00000002", "ZZ_A_MMI", out Err))
+            //{
+            //    if (mes.SetPcbaData("FGKESERIAL00000002", "ZZ_A_MMI", "ADMIN", "NG", "ERR", out Err))
+            //    {
 
+
+            //    }
+            //    else {
+
+            //        Console.WriteLine(Err);
+            //    }
+            //}
+            //else {
+            //    Console.WriteLine(Err);
+            //}
         }
     }
 }

+ 1 - 1
TestProject/Program.cs

@@ -25,7 +25,7 @@ namespace TestProject
                 //如果是管理员的身份
                 if (principal.IsInRole(WindowsBuiltInRole.Administrator))
                 {
-                    Application.Run(new TaskTEST());
+                    Application.Run(new Form1());
                 }
                 else
                 {

+ 47 - 20
TestProject/TaskTEST.Designer.cs

@@ -37,77 +37,88 @@
             this.button1 = new System.Windows.Forms.Button();
             this.button2 = new System.Windows.Forms.Button();
             this.groupBox1 = new System.Windows.Forms.GroupBox();
+            this.dataGridView1 = new System.Windows.Forms.DataGridView();
             this.groupBox1.SuspendLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
             this.SuspendLayout();
             // 
             // label1
             // 
             this.label1.AutoSize = true;
-            this.label1.Location = new System.Drawing.Point(21, 27);
+            this.label1.Location = new System.Drawing.Point(42, 54);
+            this.label1.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.label1.Name = "label1";
-            this.label1.Size = new System.Drawing.Size(53, 12);
+            this.label1.Size = new System.Drawing.Size(106, 24);
             this.label1.TabIndex = 0;
             this.label1.Text = "员工姓名";
             // 
             // label2
             // 
             this.label2.AutoSize = true;
-            this.label2.Location = new System.Drawing.Point(377, 58);
+            this.label2.Location = new System.Drawing.Point(754, 116);
+            this.label2.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.label2.Name = "label2";
-            this.label2.Size = new System.Drawing.Size(35, 12);
+            this.label2.Size = new System.Drawing.Size(70, 24);
             this.label2.TabIndex = 1;
             this.label2.Text = "Data2";
             // 
             // label3
             // 
             this.label3.AutoSize = true;
-            this.label3.Location = new System.Drawing.Point(321, 58);
+            this.label3.Location = new System.Drawing.Point(642, 116);
+            this.label3.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.label3.Name = "label3";
-            this.label3.Size = new System.Drawing.Size(53, 12);
+            this.label3.Size = new System.Drawing.Size(106, 24);
             this.label3.TabIndex = 2;
             this.label3.Text = "员工编号";
             // 
             // label4
             // 
             this.label4.AutoSize = true;
-            this.label4.Location = new System.Drawing.Point(493, 58);
+            this.label4.Location = new System.Drawing.Point(986, 116);
+            this.label4.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.label4.Name = "label4";
-            this.label4.Size = new System.Drawing.Size(35, 12);
+            this.label4.Size = new System.Drawing.Size(70, 24);
             this.label4.TabIndex = 3;
             this.label4.Text = "Data3";
             // 
             // label5
             // 
             this.label5.AutoSize = true;
-            this.label5.Location = new System.Drawing.Point(437, 58);
+            this.label5.Location = new System.Drawing.Point(874, 116);
+            this.label5.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.label5.Name = "label5";
-            this.label5.Size = new System.Drawing.Size(53, 12);
+            this.label5.Size = new System.Drawing.Size(106, 24);
             this.label5.TabIndex = 4;
             this.label5.Text = "员工岗位";
             // 
             // label6
             // 
             this.label6.AutoSize = true;
-            this.label6.Location = new System.Drawing.Point(77, 27);
+            this.label6.Location = new System.Drawing.Point(154, 54);
+            this.label6.Margin = new System.Windows.Forms.Padding(6, 0, 6, 0);
             this.label6.Name = "label6";
-            this.label6.Size = new System.Drawing.Size(35, 12);
+            this.label6.Size = new System.Drawing.Size(70, 24);
             this.label6.TabIndex = 5;
             this.label6.Text = "Data1";
             // 
             // button1
             // 
-            this.button1.Location = new System.Drawing.Point(96, 183);
+            this.button1.Location = new System.Drawing.Point(192, 366);
+            this.button1.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6);
             this.button1.Name = "button1";
-            this.button1.Size = new System.Drawing.Size(75, 23);
+            this.button1.Size = new System.Drawing.Size(150, 46);
             this.button1.TabIndex = 6;
             this.button1.Text = "获取值";
             this.button1.UseVisualStyleBackColor = true;
+            this.button1.Click += new System.EventHandler(this.button1_Click);
             // 
             // button2
             // 
-            this.button2.Location = new System.Drawing.Point(191, 183);
+            this.button2.Location = new System.Drawing.Point(382, 366);
+            this.button2.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6);
             this.button2.Name = "button2";
-            this.button2.Size = new System.Drawing.Size(75, 23);
+            this.button2.Size = new System.Drawing.Size(150, 46);
             this.button2.TabIndex = 7;
             this.button2.Text = "清除值";
             this.button2.UseVisualStyleBackColor = true;
@@ -116,18 +127,30 @@
             // 
             this.groupBox1.Controls.Add(this.label1);
             this.groupBox1.Controls.Add(this.label6);
-            this.groupBox1.Location = new System.Drawing.Point(82, 31);
+            this.groupBox1.Location = new System.Drawing.Point(164, 62);
+            this.groupBox1.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6);
             this.groupBox1.Name = "groupBox1";
-            this.groupBox1.Size = new System.Drawing.Size(200, 100);
+            this.groupBox1.Padding = new System.Windows.Forms.Padding(6, 6, 6, 6);
+            this.groupBox1.Size = new System.Drawing.Size(400, 200);
             this.groupBox1.TabIndex = 9;
             this.groupBox1.TabStop = false;
             this.groupBox1.Text = "groupBox1";
             // 
+            // dataGridView1
+            // 
+            this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
+            this.dataGridView1.Location = new System.Drawing.Point(532, 158);
+            this.dataGridView1.Name = "dataGridView1";
+            this.dataGridView1.RowTemplate.Height = 37;
+            this.dataGridView1.Size = new System.Drawing.Size(840, 558);
+            this.dataGridView1.TabIndex = 10;
+            // 
             // TaskTEST
             // 
-            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
+            this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 24F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(692, 376);
+            this.ClientSize = new System.Drawing.Size(1384, 752);
+            this.Controls.Add(this.dataGridView1);
             this.Controls.Add(this.groupBox1);
             this.Controls.Add(this.button2);
             this.Controls.Add(this.button1);
@@ -135,10 +158,13 @@
             this.Controls.Add(this.label4);
             this.Controls.Add(this.label3);
             this.Controls.Add(this.label2);
+            this.Margin = new System.Windows.Forms.Padding(6, 6, 6, 6);
             this.Name = "TaskTEST";
             this.Text = "Form3";
+            this.Load += new System.EventHandler(this.TaskTEST_Load);
             this.groupBox1.ResumeLayout(false);
             this.groupBox1.PerformLayout();
+            ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
             this.ResumeLayout(false);
             this.PerformLayout();
 
@@ -155,5 +181,6 @@
         private System.Windows.Forms.Button button1;
         private System.Windows.Forms.Button button2;
         private System.Windows.Forms.GroupBox groupBox1;
+        private System.Windows.Forms.DataGridView dataGridView1;
     }
 }

+ 63 - 0
TestProject/TaskTEST.cs

@@ -5,6 +5,7 @@ using System.ComponentModel;
 using System.Data;
 using System.Diagnostics;
 using System.Drawing;
+using System.IO;
 using System.Linq;
 using System.Text;
 using System.Threading;
@@ -203,5 +204,67 @@ namespace TestProject
 
             //Console.WriteLine("Flag");
         }
+
+        private void button1_Click(object sender, EventArgs e)
+        {
+
+        }
+
+        private void TaskTEST_Load(object sender, EventArgs e)
+        {
+            DataTable dt = new DataTable();
+            OpenCSVFile(ref dt, @"C:\Users\callm\Desktop\品网\2019_04_04_19_59_18_788.csv");
+            dataGridView1.DataSource = dt;
+        }
+
+        public bool OpenCSVFile(ref DataTable mycsvdt, string filepath)
+        {
+            string strpath = filepath; //csv文件的路径
+            try
+            {
+                int intColCount = 0;
+                bool blnFlag = true;
+
+                DataColumn mydc;
+                DataRow mydr;
+
+                string strline;
+                string[] aryline;
+                StreamReader mysr = new StreamReader(strpath, System.Text.Encoding.Default);
+
+                while ((strline = mysr.ReadLine()) != null)
+                {
+                    aryline = strline.Split(new char[] { ',' });
+
+                    //给datatable加上列名
+                    if (blnFlag)
+                    {
+                        blnFlag = false;
+                        intColCount = aryline.Length;
+                        int col = 0;
+                        for (int i = 0; i < aryline.Length; i++)
+                        {
+                            col = i + 1;
+                            mydc = new DataColumn(col.ToString());
+                            mycsvdt.Columns.Add(mydc);
+                        }
+                    }
+
+                    //填充数据并加入到datatable中
+                    mydr = mycsvdt.NewRow();
+                    for (int i = 0; i < intColCount; i++)
+                    {
+                        mydr[i] = aryline[i];
+                    }
+                    if (mydr[0].ToString() != "")
+                        mycsvdt.Rows.Add(mydr);
+                }
+                return true;
+            }
+            catch (Exception e)
+            {
+                return false;
+            }
+        }
     }
 }

+ 3 - 0
TestProject/TestProject.csproj

@@ -93,6 +93,9 @@
     <Reference Include="System.Drawing" />
     <Reference Include="System.Windows.Forms" />
     <Reference Include="System.Xml" />
+    <Reference Include="UMES.DLLService">
+      <HintPath>..\UAS_MesInterface(ODLF)\bin\Debug\UMES.DLLService.dll</HintPath>
+    </Reference>
   </ItemGroup>
   <ItemGroup>
     <Compile Include="DrawHelper.cs" />

+ 1 - 1
UAS_MES_NEW/UAS_MES_NEW.csproj

@@ -4,7 +4,7 @@
   <PropertyGroup>
     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
     <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
-    <ProjectGuid>{A51914AE-791A-4385-8A17-2394C51F18B8}</ProjectGuid>
+    <ProjectGuid>{8F7287BF-B2F0-4C72-9060-C5CB290F8938}</ProjectGuid>
     <OutputType>WinExe</OutputType>
     <AppDesignerFolder>Properties</AppDesignerFolder>
     <RootNamespace>UAS_MES_NEW</RootNamespace>