Forráskód Böngészése

Merge repos.ubtob.net:usoft/mes-client

callm 1 napja
szülő
commit
72ea9a209e

+ 40 - 8
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, cmdList);
+            string Msg = tester.TestStart(SN.Text.Trim(), ExePath.Text.Trim(), logsPath, cmdList, testType);
             if (Msg.StartsWith("NG"))
             {
                 ShowMsg(0, Msg);
@@ -132,20 +132,21 @@ namespace UAS_MES_NEW.Make
             }
             string upRate = Msg.Split('|')[0].Split(',')[1];
             string downRate = Msg.Split('|')[1];
+            string signalNum = Msg.Split('|')[2];
             ShowMsg(1, $"OK,上行速率: {upRate},下行速率: {downRate}");
             ResMax.Text = upRate;
             ResMin.Text = downRate;
             if (testType == "2.4G")
             {
-                CheckPassStation(SN.Text, "PASS", upRate, downRate, testType);
+                CheckPassStation(SN.Text, "PASS", upRate, downRate, testType, signalNum);
             }
             else
             {
-                CheckPassStation(SN.Text, "PASS", upRate, downRate, testType);
+                CheckPassStation(SN.Text, "PASS", upRate, downRate, testType, signalNum);
             }
         }
 
-        private void CheckPassStation(string sn, string testRes, string upRate, string downRate, string resType)
+        private void CheckPassStation(string sn, string testRes, string upRate, string downRate, string resType,string signalNum)
         {
             List<string> param = new List<string>() { };
             string outMsg = "";
@@ -208,6 +209,22 @@ namespace UAS_MES_NEW.Make
                     '{item.Key}','100','{item.Value}',2 )", "insert");
             }
 
+            Dictionary<string, string> testArr2 = new Dictionary<string, string>();
+            testArr2.Add("测试项", $"SSID测试");
+            testArr2.Add("参数名称", $"信号强度值");
+            testArr2.Add("结果", "0");
+            testArr2.Add("结果描述", "OK");
+            testArr2.Add("产测指标门限", "-55");
+            testArr2.Add("测试时长", "1");
+            testArr2.Add("值", signalNum);
+            foreach (var item in testArr2)
+            {
+                dh.ExecuteSql($@"INSERT INTO steptestdetail (sd_id,sd_smid,sd_sn,sd_makecode,sd_machinecode,sd_indate,
+                    sd_class,sd_length,sd_actvalue,sd_detno) VALUES 
+                    ( steptestdetail_seq.NEXTVAL,'{sm_id}','{sn}','{workOrder.Text.Trim()}', 'ZTE',sysdate,
+                    '{item.Key}','100','{item.Value}',3 )", "insert");
+            }
+
             string oWO, oWOId, oErrMsg = "";
             if (LogicHandler.CheckStepSNAndMacode(workOrder.Text, User.UserSourceCode, sn, User.UserCode, out oWO, out oWOId, out oErrMsg))
             {
@@ -328,6 +345,7 @@ namespace UAS_MES_NEW.Make
             private NetworkStream _telnetStream;
 
             string sVal1, sVal2, rVal1, rVal2;
+            string signalNum;
 
             public CameraIperfTester(string timeOut, string cameraIp, int cameraPort, string username, string password, string iperfServerIp, int iperfServerPort)
             {
@@ -340,7 +358,7 @@ namespace UAS_MES_NEW.Make
                 this.iperfServerPort = iperfServerPort;
             }
 
-            public string TestStart(string sn, string iP, string lD,List<string> cmdList)
+            public string TestStart(string sn, string iP, string lD,List<string> cmdList,string testType)
             {
                 StringBuilder Msg = new StringBuilder();
 
@@ -352,7 +370,7 @@ namespace UAS_MES_NEW.Make
                 logDirectory = lD;
 
                 Msg.Clear();
-                Msg.Append(StartIperfTest(cmdList));
+                Msg.Append(StartIperfTest(cmdList, testType));
 
                 return Msg.ToString();
             }
@@ -407,7 +425,7 @@ namespace UAS_MES_NEW.Make
                 }
             }
 
-            public string StartIperfTest(List<string> cmdList)
+            public string StartIperfTest(List<string> cmdList,string testType)
             {
                 try
                 {
@@ -417,6 +435,20 @@ namespace UAS_MES_NEW.Make
                     WriteStream(_telnetStream, cmdList[2]);
                     streamTxt.Append(ReadStream(_telnetStream));
 
+                    var pattern = @"Bit Rate:\s*(\d+\s*[GMK]?b/s)";
+                    var match = Regex.Match(streamTxt.ToString(), pattern);
+                    if (match.Success)
+                    {
+                        if(testType == "2.4G")
+                        {
+                            signalNum = match.Groups[1].Value.Trim();
+                        }
+                        else
+                        {
+                            signalNum = match.Groups[2].Value.Trim();
+                        }
+                    }
+
                     WriteStream(_telnetStream, cmdList[0].Trim().Replace("Port", iperfServerPort.ToString()));
                     streamTxt.Append(ReadStream(_telnetStream));
 
@@ -437,7 +469,7 @@ namespace UAS_MES_NEW.Make
                     {
                         return $"NG,产前维护指令测试失败,请核对指令或使用吞吐量日志解析";
                     }
-                    return $"OK,{upRate}|{downRate}";
+                    return $"OK,{upRate}|{downRate}|{signalNum}";
 
                     /*if (cmdType == "0")
                     {