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")))