From ba700dab46dd85ad9717997ccfcf965a4dd73437 Mon Sep 17 00:00:00 2001 From: wanli Date: Fri, 11 Nov 2022 15:44:40 +0800 Subject: [PATCH] =?UTF-8?q?[Backend]=20=E6=9B=B4=E6=94=B9N4=E5=8F=96?= =?UTF-8?q?=E5=80=BC=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Backend/N4v1021.xml | 96 +++++++++++++++++++ .../Services/Implement/webRequestService.cs | 23 ++++- z01_WinAPP/Service/webRequestSvc.cs | 24 ++++- 3 files changed, 137 insertions(+), 6 deletions(-) create mode 100644 Backend/N4v1021.xml diff --git a/Backend/N4v1021.xml b/Backend/N4v1021.xml new file mode 100644 index 0000000..d7b1b16 --- /dev/null +++ b/Backend/N4v1021.xml @@ -0,0 +1,96 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Backend/Services/Implement/webRequestService.cs b/Backend/Services/Implement/webRequestService.cs index aa56566..57022a0 100644 --- a/Backend/Services/Implement/webRequestService.cs +++ b/Backend/Services/Implement/webRequestService.cs @@ -26,7 +26,7 @@ namespace Backend.Services.Implement XmlDocument xmlDoc = new XmlDocument(); //xmlDoc.LoadXml(responseString); - xmlDoc.Load("N4.xml");//N4v1021 + xmlDoc.Load("N4v1021.xml");//N4v1021 //xmlDoc.Save("N4.xml"); @@ -40,7 +40,24 @@ namespace Backend.Services.Implement string[] s1 = item.Val.Split(','); string[] s2 = s1[0].Split('/'); - foreach (var ss in s2) + row.tag_name = ""; + + for (int i = 0; i < s2.Length; i++) + { + if (i == s2.Length - 2) + { + row.point_name = s2[i]; + } + else if (i == 1) + { + row.tag_name += s2[i]; + } + else if (i > 1 && i < s2.Length - 2) + { + row.tag_name += "_" + s2[i]; + } + } + /*foreach (var ss in s2) { if (ss.Contains('_')) { @@ -52,7 +69,7 @@ namespace Backend.Services.Implement break; } } - } + }*/ result.Add(row); } diff --git a/z01_WinAPP/Service/webRequestSvc.cs b/z01_WinAPP/Service/webRequestSvc.cs index c101447..cf8da19 100644 --- a/z01_WinAPP/Service/webRequestSvc.cs +++ b/z01_WinAPP/Service/webRequestSvc.cs @@ -166,7 +166,7 @@ namespace tpDomeWinAPP.Service XmlDocument xmlDoc = new XmlDocument(); //xmlDoc.LoadXml(responseString); - xmlDoc.Load("N4.xml"); + xmlDoc.Load("N4v1021.xml");//N4v1021 //xmlDoc.Save("N4.xml"); @@ -182,9 +182,26 @@ namespace tpDomeWinAPP.Service device_value2 row = new device_value2(); row.value = item.Val; string[] s1 = item.Val.Split(','); - string[] s2 = s1[0].Split('/'); - foreach (var ss in s2) + row.tag_name = ""; + + for (int i = 0; i < s2.Length; i++) + { + if (i == s2.Length - 2) + { + row.point_name = s2[i]; + } + else if (i == 1) + { + row.tag_name += s2[i]; + } + else if (i > 1 && i < s2.Length - 2) + { + row.tag_name += "_" + s2[i]; + } + } + + /*foreach (var ss in s2) { if (ss.Contains('_')) { @@ -208,6 +225,7 @@ namespace tpDomeWinAPP.Service // //} //} } + */ result.Add(row); //row.tag_name = s2.Where( x => x.Contains("_") && // (x.Contains("H") || x.Contains("O") || x.Contains("C") || x.Contains("D") || x.Contains("M")))