فهرست منبع

贴片日志解析、钢网刮刀、吞吐量测试

yhluo 2 روز پیش
والد
کامیت
372993baa4

+ 31 - 28
UAS_MES_HYSX/FunctionCode/Make/Make_ParseLog.cs

@@ -52,7 +52,7 @@ namespace UAS_MES_NEW.Make
             dh = SystemInf.dh;
             Choose.Enabled = false;
             fileList.Add("E:\\AOIMes\\Mes");
-            fileList.Add("C:\\Users\\MI\\Desktop");
+            fileList.Add("E:\\UAS");
             fileList.Add("C:\\Users\\MI\\Desktop");
 
             ChangeWoTimer = new Timer();
@@ -381,23 +381,26 @@ namespace UAS_MES_NEW.Make
                     }
                     else if (equiType == "Xray")
                     {
-                        string[] floderFile = Directory.GetFiles(file, $"*.{currFileType}");
-                        foreach(string floderFileItem in floderFile)
+                        if (Path.GetFileName(file).Contains('_'))
                         {
-                            SN = Path.GetFileName(floderFileItem).Split('_')[1];
-                            if (UploadImageToFtp(floderFileItem, SN))
+                            SN = Path.GetFileName(file).Split('_')[1].Replace(";", ";");
+                            string[] floderFile = Directory.GetFiles(file, $"*.{currFileType}");
+                            foreach (string floderFileItem in floderFile)
                             {
-                                if (!LogicHandler.CheckStepSNAndMacode("", User.UserSourceCode, SN, User.UserCode, out omakeCode, out oMsid, out oErrorMessage))
+                                if (UploadImageToFtp(floderFileItem, SN))
                                 {
-                                    LogMessage(0, $"核对NG:{oErrorMessage}");
-                                }
-                                dh.ExecuteSql($@"INSERT INTO steptestmain (sm_id, sm_sn,sm_makecode,sm_stepcode,sm_indate,sm_machinecode,sm_result) 
-                                    VALUES ( steptestmain_seq.NEXTVAL,'{SN}','{omakeCode}','{User.UserSourceCode}', sysdate,'Xray', 'http://192.168.1.5:8099/ftp/xray/{DateTime.Now.ToString("yyyyMMdd")}/{Path.GetFileName(floderFileItem)}' )", "insert");
+                                    //if (!LogicHandler.CheckStepSNAndMacode("", User.UserSourceCode, SN, User.UserCode, out omakeCode, out oMsid, out oErrorMessage))
+                                    //{
+                                    //    LogMessage(0, $"核对NG:{oErrorMessage}");
+                                    //}
+                                    dh.ExecuteSql($@"INSERT INTO steptestmain (sm_id, sm_sn,sm_makecode,sm_stepcode,sm_indate,sm_machinecode,sm_result) 
+                                    VALUES ( steptestmain_seq.NEXTVAL,'{SN}','{ma_code.Text.Trim()}','{User.UserSourceCode}', sysdate,'Xray', 'http://192.168.1.5:8099/ftp/xray/{DateTime.Now.ToString("yyyyMMdd")}/{SN}/{Path.GetFileName(floderFileItem)}' )", "insert");
 
-                                if (Array.IndexOf(floderFile, floderFileItem) == floderFile.Length - 1)
-                                {
-                                    string newFloderName = Path.GetDirectoryName(file);
-                                    Directory.Move(file, Path.Combine(newFloderName, "Log_" + Path.GetFileName(file)));
+                                    if (Array.IndexOf(floderFile, floderFileItem) == floderFile.Length - 1)
+                                    {
+                                        string newFloderName = Path.GetDirectoryName(file);
+                                        Directory.Move(file, Path.Combine(newFloderName, "Log_" + Path.GetFileName(file)));
+                                    }
                                 }
                             }
                         }
@@ -620,8 +623,8 @@ namespace UAS_MES_NEW.Make
             string password = "vsftpd3ef41637hy";
 
             string currentDate = DateTime.Now.ToString("yyyyMMdd");
-            string ftpFullPath = $"{ftpServer.TrimEnd('/')}/{currentDate}";
-            /*string ftpFullPath = $"{ftpServer.TrimEnd('/')}/{Sn}";*/
+            //string ftpFullPath = $"{ftpServer.TrimEnd('/')}/{currentDate}";
+            string ftpFullPath = $"{ftpServer.TrimEnd('/')}/{currentDate}/{Sn}";
             string outResult = CreateFtpDirectoryIfNotExists(ftpFullPath, username, password);
             if (outResult.Substring(0, 2) == "NG")
             {
@@ -715,12 +718,12 @@ namespace UAS_MES_NEW.Make
                 return;
             }
             List<string> DeleteList = new List<string>() { };
-            DeleteList.Add("1-1_" + SN1.Text);
-            DeleteList.Add("1-2_" + SN2.Text);
-            DeleteList.Add("1-3_" + SN3.Text);
-            DeleteList.Add("2-1_" + SN4.Text);
-            DeleteList.Add("2-2_" + SN5.Text);
-            DeleteList.Add("2-3_" + SN6.Text);
+            if (!string.IsNullOrEmpty(SN1.Text)) DeleteList.Add("1-1_" + SN1.Text);
+            if (!string.IsNullOrEmpty(SN2.Text)) DeleteList.Add("1-2_" + SN2.Text);
+            if (!string.IsNullOrEmpty(SN3.Text)) DeleteList.Add("1-3_" + SN3.Text);
+            if (!string.IsNullOrEmpty(SN4.Text)) DeleteList.Add("2-1_" + SN4.Text);
+            if (!string.IsNullOrEmpty(SN5.Text)) DeleteList.Add("2-2_" + SN5.Text);
+            if (!string.IsNullOrEmpty(SN6.Text)) DeleteList.Add("2-3_" + SN6.Text);
 
             string DeletePath;
             int DeleteCount = 0;
@@ -790,12 +793,12 @@ namespace UAS_MES_NEW.Make
             }
 
             List<string> GenerateList = new List<string>() { };
-            GenerateList.Add("1-1_" + SN1.Text);
-            GenerateList.Add("1-2_" + SN2.Text);
-            GenerateList.Add("1-3_" + SN3.Text);
-            GenerateList.Add("2-1_" + SN4.Text);
-            GenerateList.Add("2-2_" + SN5.Text);
-            GenerateList.Add("2-3_" + SN6.Text);
+            if (!string.IsNullOrEmpty(SN1.Text)) GenerateList.Add("1-1_" + SN1.Text);
+            if (!string.IsNullOrEmpty(SN2.Text)) GenerateList.Add("1-2_" + SN2.Text);
+            if (!string.IsNullOrEmpty(SN3.Text)) GenerateList.Add("1-3_" + SN3.Text);
+            if (!string.IsNullOrEmpty(SN4.Text)) GenerateList.Add("2-1_" + SN4.Text);
+            if (!string.IsNullOrEmpty(SN5.Text)) GenerateList.Add("2-2_" + SN5.Text);
+            if (!string.IsNullOrEmpty(SN6.Text)) GenerateList.Add("2-3_" + SN6.Text);
 
             string GeneratePath;
             int GenerateCount = 0;

+ 5 - 2
UAS_MES_HYSX/FunctionCode/Make/Make_SMTStencil.cs

@@ -60,7 +60,7 @@ namespace UAS_MES_NEW.Make
 
             li_code.TableName = "Line";
             li_code.SelectField = "li_code # 线别编号,li_name # 线别名称";
-            li_code.Condition = "li_wccode='SMT'";
+            li_code.Condition = "li_wcname = 'SMT车间' and instr(li_name,'YAMAHA') = 0 order by li_indate,li_code";
             li_code.FormName = Name;
             li_code.SetValueField = new string[] { "li_code", "li_name" };
             li_code.DbChange += Li_code_DbChange;
@@ -375,6 +375,9 @@ namespace UAS_MES_NEW.Make
 
         private bool CheckTension()
         {
+            DataTable dt = (DataTable)dh.ExecuteSql($"select * from stencil where st_code = '{SU_DEVCODE1.Text.Trim()}' and st_kind = '刮刀'", "select");
+            if (dt.Rows.Count > 0) return false;
+
             List<string> Num = new List<string>();
             Num.Add(ST_ENSIONA.Text);
             Num.Add(ST_ENSIONB.Text);
@@ -382,7 +385,7 @@ namespace UAS_MES_NEW.Make
             Num.Add(ST_ENSIOND.Text);
             Num.Add(ST_ENSIONE.Text);
 
-            DataTable dt = (DataTable)dh.ExecuteSql($"SELECT st_tension_min min,st_tension_max max FROM stencil WHERE st_statuscode = 'AUDITED' AND st_code = '{SU_DEVCODE1.Text.Trim()}'", "select");
+            dt = (DataTable)dh.ExecuteSql($"SELECT st_tension_min min,st_tension_max max FROM stencil WHERE st_statuscode = 'AUDITED' AND st_code = '{SU_DEVCODE1.Text.Trim()}'", "select");
             if (dt.Rows.Count == 0)
             {
                 MessageBox.Show("钢网编号" + SU_DEVCODE1.Text + "不存在或者未审核");

+ 44 - 16
UAS_MES_HYSX/FunctionCode/Make/Make_WirelessThroughput.Designer.cs

@@ -79,6 +79,8 @@
             this.textBox1 = new System.Windows.Forms.TextBox();
             this.label11 = new System.Windows.Forms.Label();
             this.OperatResult = new UAS_MES_NEW.CustomControl.RichText.RichTextAutoBottom();
+            this.label20 = new System.Windows.Forms.Label();
+            this.comboBox1 = new System.Windows.Forms.ComboBox();
             this.SNDetails.SuspendLayout();
             this.tableLayoutPanel1.SuspendLayout();
             this.ProtDetails.SuspendLayout();
@@ -245,6 +247,8 @@
             // 
             // panel1
             // 
+            this.panel1.Controls.Add(this.comboBox1);
+            this.panel1.Controls.Add(this.label20);
             this.panel1.Controls.Add(this.ExePath);
             this.panel1.Controls.Add(this.ProductList);
             this.panel1.Controls.Add(this.IPList);
@@ -320,7 +324,7 @@
             this.Locat3.AutoSize = true;
             this.Locat3.Cursor = System.Windows.Forms.Cursors.Hand;
             this.Locat3.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.Locat3.Location = new System.Drawing.Point(882, 70);
+            this.Locat3.Location = new System.Drawing.Point(839, 160);
             this.Locat3.Name = "Locat3";
             this.Locat3.Size = new System.Drawing.Size(187, 32);
             this.Locat3.TabIndex = 16;
@@ -333,7 +337,7 @@
             this.Locat2.AutoSize = true;
             this.Locat2.Cursor = System.Windows.Forms.Cursors.Hand;
             this.Locat2.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.Locat2.Location = new System.Drawing.Point(697, 70);
+            this.Locat2.Location = new System.Drawing.Point(667, 160);
             this.Locat2.Name = "Locat2";
             this.Locat2.Size = new System.Drawing.Size(166, 32);
             this.Locat2.TabIndex = 15;
@@ -346,7 +350,7 @@
             this.Locat1.AutoSize = true;
             this.Locat1.Cursor = System.Windows.Forms.Cursors.Hand;
             this.Locat1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.Locat1.Location = new System.Drawing.Point(545, 71);
+            this.Locat1.Location = new System.Drawing.Point(539, 160);
             this.Locat1.Name = "Locat1";
             this.Locat1.Size = new System.Drawing.Size(122, 32);
             this.Locat1.TabIndex = 14;
@@ -359,7 +363,7 @@
             this.Radio2.AutoSize = true;
             this.Radio2.Cursor = System.Windows.Forms.Cursors.Hand;
             this.Radio2.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.Radio2.Location = new System.Drawing.Point(702, 187);
+            this.Radio2.Location = new System.Drawing.Point(696, 198);
             this.Radio2.Name = "Radio2";
             this.Radio2.Size = new System.Drawing.Size(108, 32);
             this.Radio2.TabIndex = 13;
@@ -372,7 +376,7 @@
             this.Radio1.AutoSize = true;
             this.Radio1.Cursor = System.Windows.Forms.Cursors.Hand;
             this.Radio1.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.Radio1.Location = new System.Drawing.Point(545, 187);
+            this.Radio1.Location = new System.Drawing.Point(539, 198);
             this.Radio1.Name = "Radio1";
             this.Radio1.Size = new System.Drawing.Size(125, 32);
             this.Radio1.TabIndex = 12;
@@ -402,7 +406,7 @@
             // 
             this.label10.AutoSize = true;
             this.label10.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label10.Location = new System.Drawing.Point(732, 131);
+            this.label10.Location = new System.Drawing.Point(714, 66);
             this.label10.Name = "label10";
             this.label10.Size = new System.Drawing.Size(103, 28);
             this.label10.TabIndex = 10;
@@ -418,7 +422,7 @@
             // 
             // TestTime
             // 
-            this.TestTime.Location = new System.Drawing.Point(663, 125);
+            this.TestTime.Location = new System.Drawing.Point(645, 60);
             this.TestTime.Name = "TestTime";
             this.TestTime.Size = new System.Drawing.Size(63, 39);
             this.TestTime.TabIndex = 9;
@@ -437,7 +441,7 @@
             // 
             this.label9.AutoSize = true;
             this.label9.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
-            this.label9.Location = new System.Drawing.Point(551, 131);
+            this.label9.Location = new System.Drawing.Point(533, 66);
             this.label9.Name = "label9";
             this.label9.Size = new System.Drawing.Size(101, 28);
             this.label9.TabIndex = 8;
@@ -671,6 +675,28 @@
             this.OperatResult.TabIndex = 89;
             this.OperatResult.Text = "";
             // 
+            // label20
+            // 
+            this.label20.AutoSize = true;
+            this.label20.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
+            this.label20.Location = new System.Drawing.Point(534, 115);
+            this.label20.Name = "label20";
+            this.label20.Size = new System.Drawing.Size(159, 28);
+            this.label20.TabIndex = 24;
+            this.label20.Text = "测试指令模式:";
+            // 
+            // comboBox1
+            // 
+            this.comboBox1.FormattingEnabled = true;
+            this.comboBox1.Items.AddRange(new object[] {
+            "指令一",
+            "指令二"});
+            this.comboBox1.Location = new System.Drawing.Point(678, 110);
+            this.comboBox1.Name = "comboBox1";
+            this.comboBox1.Size = new System.Drawing.Size(227, 39);
+            this.comboBox1.TabIndex = 25;
+            this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
+            // 
             // Make_WirelessThroughput
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
@@ -683,18 +709,18 @@
             this.Name = "Make_WirelessThroughput";
             this.Text = "Make_WirelessThroughput";
             this.Load += new System.EventHandler(this.Make_WirelessThroughput_Load);
-            this.SNDetails.ResumeLayout(true);
-            this.tableLayoutPanel1.ResumeLayout(true);
+            this.SNDetails.ResumeLayout(false);
+            this.tableLayoutPanel1.ResumeLayout(false);
             this.tableLayoutPanel1.PerformLayout();
-            this.ProtDetails.ResumeLayout(true);
-            this.tableLayoutPanel2.ResumeLayout(true);
-            this.panel1.ResumeLayout(true);
+            this.ProtDetails.ResumeLayout(false);
+            this.tableLayoutPanel2.ResumeLayout(false);
+            this.panel1.ResumeLayout(false);
             this.panel1.PerformLayout();
-            this.panel2.ResumeLayout(true);
+            this.panel2.ResumeLayout(false);
             this.panel2.PerformLayout();
-            this.tableLayoutPanel3.ResumeLayout(true);
+            this.tableLayoutPanel3.ResumeLayout(false);
             this.tableLayoutPanel3.PerformLayout();
-            this.ResumeLayout(true);
+            this.ResumeLayout(false);
 
         }
 
@@ -751,5 +777,7 @@
         private System.Windows.Forms.TextBox ProductList;
         private System.Windows.Forms.TextBox ExePath;
         private System.Windows.Forms.Label label19;
+        private System.Windows.Forms.Label label20;
+        private System.Windows.Forms.ComboBox comboBox1;
     }
 }

+ 54 - 9
UAS_MES_HYSX/FunctionCode/Make/Make_WirelessThroughput.cs

@@ -124,7 +124,7 @@ namespace UAS_MES_NEW.Make
                 Directory.CreateDirectory(logsPath);
             }
 
-            string Msg = tester.TestStart(SN.Text.Trim(), ExePath.Text.Trim(), logsPath);
+            string Msg = tester.TestStart(SN.Text.Trim(), ExePath.Text.Trim(), logsPath, comboBox1.SelectedIndex.ToString());
             if (Msg.StartsWith("NG"))
             {
                 ShowMsg(0, Msg);
@@ -139,7 +139,7 @@ namespace UAS_MES_NEW.Make
             CheckPassStation(SN.Text, "PASS", tDetail);
         }
 
-        private void CheckPassStation(string sn, string testRes,string testDetail)
+        private void CheckPassStation(string sn, string testRes, string testDetail)
         {
             List<string> param = new List<string>() { };
             string outMsg = "";
@@ -226,6 +226,11 @@ namespace UAS_MES_NEW.Make
                 ShowMsg(0, "请输入测试时长");
                 return true;
             }
+            if (comboBox1.SelectedIndex == -1)
+            {
+                ShowMsg(0, "请选择指令模式");
+                return true;
+            }
 
             //if (Locat1.Checked == false || Locat2.Checked == false || Locat3.Checked == false)
             //{
@@ -294,7 +299,7 @@ namespace UAS_MES_NEW.Make
                 this.iperfServerPort = iperfServerPort;
             }
 
-            public string TestStart(string sn, string iP, string lD)
+            public string TestStart(string sn, string iP, string lD,string cmdType)
             {
                 StringBuilder Msg = new StringBuilder();
 
@@ -306,7 +311,7 @@ namespace UAS_MES_NEW.Make
                 logDirectory = lD;
 
                 Msg.Clear();
-                Msg.Append(StartIperfTest()); 
+                Msg.Append(StartIperfTest(cmdType));
                 if (Msg.ToString().StartsWith("NG")) return Msg.ToString();
 
 
@@ -363,14 +368,14 @@ namespace UAS_MES_NEW.Make
                 }
             }
 
-            public string StartIperfTest()
+            public string StartIperfTest(string cmdType)
             {
                 try
                 {
                     StringBuilder streamTxt = new StringBuilder();
                     string upRate, downRate, cmdLog, upLog, downLog;
 
-                    if (username.ToUpper() == "ROOT")
+                    if (cmdType == "0")
                     {
                         WriteStream(_telnetStream, "killall iperf3");
                         streamTxt.Append(ReadStream(_telnetStream));
@@ -499,7 +504,7 @@ namespace UAS_MES_NEW.Make
                         sVal2 = match.Groups[2].Value;
                     }
                 }
-                if (logItem.Count > 0 && logItem[logItem.Count -1].Contains("receiver"))
+                if (logItem.Count > 0 && logItem[logItem.Count - 1].Contains("receiver"))
                 {
                     var match = Regex.Match(logItem[logItem.Count - 1], @"(\d+\.\d+\s+MBytes).*?(\d+\.\d+\s+Mbits/sec)");
                     if (match.Success)
@@ -565,7 +570,7 @@ namespace UAS_MES_NEW.Make
                     return $"NG,读取数据时发生错误: {ex.Message}";
                 }
             }
-            
+
             private void Close()
             {
                 _telnetClient?.Close();
@@ -651,7 +656,7 @@ namespace UAS_MES_NEW.Make
             {
                 openFileDialog.Title = "选择iperf3启动文件";
                 openFileDialog.Filter = "可执行文件 (*.exe)|*.exe|所有文件 (*.*)|*.*";
-                openFileDialog.FilterIndex = 1; 
+                openFileDialog.FilterIndex = 1;
                 openFileDialog.RestoreDirectory = true;
 
                 // 设置初始目录(可选)
@@ -676,5 +681,45 @@ namespace UAS_MES_NEW.Make
         {
             OperatResult.Clear();
         }
+
+        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
+        {
+            if (comboBox1.SelectedIndex == -1)  return;
+
+            if (string.IsNullOrEmpty(IPList.Text))
+            {
+                ShowMsg(0, $"请先选择iperf服务地址");
+                comboBox1.SelectedIndex = -1;
+                return;
+            }
+
+            if (string.IsNullOrEmpty(ProductList.Text))
+            {
+                ShowMsg(0, $"请先选择产品IP地址");
+                comboBox1.SelectedIndex = -1;
+                return;
+            }
+            string iperfServerPort = IPList.Text.Trim().Split(':')[1];
+            string cameraIp = ProductList.Text.Trim().Split(':')[0];
+
+            if (comboBox1.SelectedIndex == 0)
+            {
+                ShowMsg(1, $"指令一:");
+                ShowMsg(1, $"           killall iperf3");
+                ShowMsg(1, $"           iperf3 -s -p {iperfServerPort} -i 1&");
+                ShowMsg(1, $"           -c {cameraIp} -p {iperfServerPort} -t 10 -w 1M -i 1 -P 8 -R");
+                ShowMsg(1, $"           -c {cameraIp} -p {iperfServerPort} -t 10 -w 1M -i 1 -P 8");
+            }
+            else if (comboBox1.SelectedIndex == 1) 
+            {
+                ShowMsg(1, $"指令二:");
+                ShowMsg(1, $"         killall iperf3_mstar");
+                ShowMsg(1, $"         cp /mnt/tf/usb1_1/iperf3_mstar /var/tmp/ -f");
+                ShowMsg(1, $"         chmod a+x /var/tmp/iperf3_mstar");
+                ShowMsg(1, $"         /var/tmp/iperf3_mstar -s -p {iperfServerPort} -i 1 &");
+                ShowMsg(1, $"         /var/tmp/iperf3 -c {cameraIp} -p {iperfServerPort} -t 6 -w 1M -i 1 -l 1518 -P 8 -R");
+                ShowMsg(1, $"         /var/tmp/iperf3 -c {cameraIp} -p {iperfServerPort} -t 6 -w 1M -i 1 -l 1518 -P 8");
+            }
+        }
     }
 }