HomeFormInfoSvc.cs 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows;
  7. using EntityDataSet;
  8. using IntelligentControlForsx.Model;
  9. using IntelligentControlForsx.MyControls;
  10. using IntelligentControlForsx.Service.HomeFormInfo.Domain;
  11. using WisdomClient;
  12. using WisdomClient.data;
  13. namespace IntelligentControlForsx.Service.HomeFormInfo
  14. {
  15. public class HomeFormInfoSvc
  16. {
  17. private static IList<PointMapModel> leftList;
  18. private static IList<PointMapModel> leftStatList;
  19. private static IList<PointMapModel> centerList;
  20. private static IList<PointMapModel> centerSBQList;
  21. private static IList<PointMapModel> centerQSList;
  22. private static IList<PointMapModel> centerMHSList;
  23. private static IList<PointMapModel> centerXSList;
  24. private static IList<PointMapModel> centerNSSList;
  25. private static IList<PointMapModel> rightList;
  26. private static IList<PointMapModel> rightSBQList;
  27. private static IList<PointMapModel> rightQSList;
  28. private static IList<PointMapModel> rightMHSList;
  29. private static IList<PointMapModel> rightXSList;
  30. private static IList<PointMapModel> rightNSSList;
  31. private static IList<PointMapModel> rightDWKList;
  32. private static IList<PointMapModel> rightPLList;
  33. private static IList<PointMapModel> rightXHList;
  34. private HomeFormInfoSvc()
  35. {
  36. }
  37. public static HomeFormInfoSvc Instance
  38. {
  39. get { return SingletonCreator.instance; }
  40. }
  41. class SingletonCreator
  42. {
  43. internal static readonly HomeFormInfoSvc instance = new HomeFormInfoSvc();
  44. }
  45. public LeftInfo GetLeftInfo()
  46. {
  47. LeftInfo info = new LeftInfo();
  48. IList<string> codeList = new List<string>();
  49. codeList.Add(Point.RFDLB);//日发电量
  50. codeList.Add(Point.YFDL);//月发电量
  51. codeList.Add(Point.NFDL);//年发电量
  52. codeList.Add(Point.YFDLB);//月发电量(升压站)
  53. codeList.Add(Point.NFDLB);//年发电量(升压站)
  54. codeList.Add(Point.SSZGL);//实时总功率
  55. codeList.Add(Point.SSFS);//全省实时风速
  56. if (leftList == null)
  57. {
  58. leftList = new List<PointMapModel>();
  59. GetTagNameList(codeList, "station", "0", ref leftList);
  60. }
  61. //风电-1
  62. Dictionary<string, TsData> dic = RestfulClient.findLatestByTagNames(leftList.Select(s => s.PointId).ToArray());
  63. foreach (KeyValuePair<string, TsData> kv in dic)
  64. {
  65. var data = leftList.Where(s => s.PointId == kv.Key).FirstOrDefault();
  66. if (data != null)
  67. data.Value = Convert.ToDouble(kv.Value.getValue());
  68. }
  69. for (int i = 0; i < leftList.Count; i++)
  70. {
  71. switch (leftList[i].UniformCode)
  72. {
  73. case "RFDLB":
  74. info.PowerByDay = leftList[i].Value.ToString("f2");
  75. break;
  76. case "YFDLB":
  77. info.PowerByMonth = leftList[i].Value.ToString("f2");
  78. break;
  79. case "NFDLB":
  80. info.PowerByYear = leftList[i].Value.ToString("f2");
  81. break;
  82. case "SSFS":
  83. info.WindSpeedNow = leftList[i].Value.ToString("f2");
  84. break;
  85. case "SSZGL":
  86. info.PowerNow = leftList[i].Value.ToString("f2");
  87. break;
  88. }
  89. }
  90. #region 全场风机状态统计
  91. IList<string> statUniformCodeList = new List<string>();
  92. statUniformCodeList.Add("YXTS");//全省运行台数
  93. statUniformCodeList.Add("GZTJ"); //全省故障台数
  94. statUniformCodeList.Add("DJTS"); //全省待机台数
  95. statUniformCodeList.Add("TXZD"); //全省离线台数
  96. statUniformCodeList.Add("TJNUM"); //全省停机台数
  97. statUniformCodeList.Add("WHTJ"); //全省维护台数
  98. if (leftStatList == null)
  99. {
  100. leftStatList = new List<PointMapModel>();
  101. GetTagNameList(statUniformCodeList, "station", "-1", ref leftStatList);
  102. }
  103. Dictionary<string, TsData> statDic = RestfulClient.findLatestByTagNames(leftStatList.Select(s => s.PointId).ToArray());
  104. foreach (KeyValuePair<string, TsData> kv in statDic)
  105. {
  106. var data = leftStatList.Where(s => s.PointId == kv.Key).FirstOrDefault();
  107. if (data != null)
  108. data.Value = Convert.ToDouble(kv.Value.getValue());
  109. }
  110. for (int i = 0; i < leftStatList.Count; i++)
  111. {
  112. switch (leftStatList[i].UniformCode)
  113. {
  114. case "YXTS":
  115. info.RunCount = leftStatList[i].Value.ToString();
  116. break;
  117. case "GZTJ":
  118. info.FaultCount = leftStatList[i].Value.ToString();
  119. break;
  120. case "WHTJ":
  121. info.MaintainCount = leftStatList[i].Value.ToString();
  122. break;
  123. case "TJNUM":
  124. info.StopCount = leftStatList[i].Value.ToString();
  125. break;
  126. case "TXZD":
  127. info.OfflineCount = leftStatList[i].Value.ToString();
  128. break;
  129. case "DJTS":
  130. info.StandByCount = leftStatList[i].Value.ToString();
  131. break;
  132. }
  133. }
  134. #endregion
  135. info.PowerAll = "674.5";
  136. double powerByMounth = Convert.ToDouble(leftList.Where(s => s.UniformCode == Point.YFDLB).FirstOrDefault().Value);
  137. double result1 = ((powerByMounth / 67.45) * 100) / 100;
  138. info.UseHourByMounth = result1.ToString("f2");
  139. double powerByyear = Convert.ToDouble(leftList.Where(s => s.UniformCode == Point.NFDL).FirstOrDefault().Value);
  140. double result2 = ((powerByyear / 67.45) * 100) / 100;
  141. info.UseHourByYear = result2.ToString("f2");
  142. info.LinkCount = "382";
  143. return info;
  144. }
  145. public CenterInfo GetCenterInfo()
  146. {
  147. CenterInfo info = new CenterInfo();
  148. IList<string> codeList = new List<string>();
  149. codeList.Add(Point.SSFS);//实时风速
  150. codeList.Add(Point.RFDL);//日发电量
  151. codeList.Add(Point.SSZGL);//实时总功率
  152. codeList.Add(Point.YXTS);//运行3
  153. codeList.Add(Point.GZTJ);//故障4
  154. codeList.Add(Point.DJTS);//待机5
  155. codeList.Add(Point.XDTS);//限电6
  156. codeList.Add(Point.WHTJ);//维护7
  157. codeList.Add(Point.LXTS);//离线8
  158. if (centerList == null)
  159. {
  160. centerList = new List<PointMapModel>();
  161. GetTagNameList(codeList, "station", "-1", ref centerList);
  162. }
  163. if (centerMHSList == null)
  164. {
  165. centerMHSList = new List<PointMapModel>();
  166. GetTagNameList(codeList, "station", "MHS_FDC", ref centerMHSList);
  167. }
  168. if (centerNSSList == null)
  169. {
  170. centerNSSList = new List<PointMapModel>();
  171. GetTagNameList(codeList, "station", "NSS_FDC", ref centerNSSList);
  172. }
  173. if (centerSBQList == null)
  174. {
  175. centerSBQList = new List<PointMapModel>();
  176. GetTagNameList(codeList, "station", "SBQ_FDC", ref centerSBQList);
  177. }
  178. if (centerQSList == null)
  179. {
  180. centerQSList = new List<PointMapModel>();
  181. GetTagNameList(codeList, "station", "QS_FDC", ref centerQSList);
  182. }
  183. if (centerXSList == null)
  184. {
  185. centerXSList = new List<PointMapModel>();
  186. GetTagNameList(codeList, "station", "XS_FDC", ref centerXSList);
  187. }
  188. Dictionary<string, TsData> dicSBQ = RestfulClient.findLatestByTagNames(centerSBQList.Select(s => s.PointId).ToArray());
  189. Dictionary<string, TsData> dicQS = RestfulClient.findLatestByTagNames(centerQSList.Select(s => s.PointId).ToArray());
  190. Dictionary<string, TsData> dicMHS = RestfulClient.findLatestByTagNames(centerMHSList.Select(s => s.PointId).ToArray());
  191. Dictionary<string, TsData> dicXS = RestfulClient.findLatestByTagNames(centerXSList.Select(s => s.PointId).ToArray());
  192. Dictionary<string, TsData> dicNSS = RestfulClient.findLatestByTagNames(centerNSSList.Select(s => s.PointId).ToArray());
  193. foreach (KeyValuePair<string, TsData> kv in dicSBQ)
  194. {
  195. var data = centerSBQList.Where(s => s.PointId == kv.Key).FirstOrDefault();
  196. if (data != null)
  197. data.Value = Convert.ToDouble(kv.Value.getValue());
  198. }
  199. foreach (KeyValuePair<string, TsData> kv in dicQS)
  200. {
  201. var data = centerQSList.Where(s => s.PointId == kv.Key).FirstOrDefault();
  202. if (data != null)
  203. data.Value = Convert.ToDouble(kv.Value.getValue());
  204. }
  205. foreach (KeyValuePair<string, TsData> kv in dicMHS)
  206. {
  207. var data = centerMHSList.Where(s => s.PointId == kv.Key).FirstOrDefault();
  208. if (data != null)
  209. data.Value = Convert.ToDouble(kv.Value.getValue());
  210. }
  211. foreach (KeyValuePair<string, TsData> kv in dicXS)
  212. {
  213. var data = centerXSList.Where(s => s.PointId == kv.Key).FirstOrDefault();
  214. if (data != null)
  215. data.Value = Convert.ToDouble(kv.Value.getValue());
  216. }
  217. foreach (KeyValuePair<string, TsData> kv in dicNSS)
  218. {
  219. var data = centerNSSList.Where(s => s.PointId == kv.Key).FirstOrDefault();
  220. if (data != null)
  221. data.Value = Convert.ToDouble(kv.Value.getValue());
  222. }
  223. info.NSS_Speed = GetValueByUniformCode(codeList[0], centerNSSList);
  224. info.NSS_PowerByDay = GetValueByUniformCode(codeList[1], centerNSSList);
  225. info.NSS_PowerByNow = GetValueByUniformCode(codeList[2], centerNSSList);
  226. info.NSS_Status = GetStatusByStation(centerNSSList);
  227. info.SBQ_Speed = GetValueByUniformCode(codeList[0], centerSBQList);
  228. info.SBQ_PowerByDay = GetValueByUniformCode(codeList[1], centerSBQList);
  229. info.SBQ_PowerByNow = GetValueByUniformCode(codeList[2], centerSBQList);
  230. info.SBQ_Status = GetStatusByStation(centerSBQList);
  231. info.MHS_Speed = GetValueByUniformCode(codeList[0], centerMHSList);
  232. info.MHS_PowerByDay = GetValueByUniformCode(codeList[1], centerMHSList); ;
  233. info.MHS_PowerByNow = GetValueByUniformCode(codeList[2], centerMHSList);
  234. info.MHS_Status = GetStatusByStation(centerMHSList);
  235. info.XS_Speed = GetValueByUniformCode(codeList[0], centerNSSList);
  236. info.XS_PowerByDay = GetValueByUniformCode(codeList[1], centerXSList);
  237. info.XS_PowerByNow = GetValueByUniformCode(codeList[2], centerXSList);
  238. info.XS_Status = GetStatusByStation(centerXSList);
  239. info.QS_Speed = GetValueByUniformCode(codeList[0], centerNSSList);
  240. info.QS_PowerByDay = GetValueByUniformCode(codeList[1], centerQSList);
  241. info.QS_PowerByNow = GetValueByUniformCode(codeList[2], centerQSList);
  242. info.QS_Status = GetStatusByStation(centerQSList);
  243. return info;
  244. }
  245. public RightInfo GetRightInfo()
  246. {
  247. RightInfo info = new RightInfo();
  248. IList<string> codeList = new List<string>();
  249. codeList.Add(Point.RFDL);
  250. //宣和日发电量
  251. IList<string> xhCodeList = new List<string>();
  252. xhCodeList.Add("RFDLB");
  253. if (rightList == null || rightList.Count == 0)
  254. {
  255. rightList = new List<PointMapModel>();
  256. GetTagNameList(codeList, "station", "-1", ref rightList);
  257. }
  258. if (rightMHSList == null || rightMHSList.Count == 0)
  259. {
  260. rightMHSList = new List<PointMapModel>();
  261. GetTagNameList(codeList, "station", "MHS_FDC", ref rightMHSList);
  262. }
  263. if (rightNSSList == null || rightNSSList.Count == 0)
  264. {
  265. rightNSSList = new List<PointMapModel>();
  266. GetTagNameList(codeList, "station", "NSS_FDC", ref rightNSSList);
  267. }
  268. if (rightSBQList == null || rightSBQList.Count == 0)
  269. {
  270. rightSBQList = new List<PointMapModel>();
  271. GetTagNameList(codeList, "station", "SBQ_FDC", ref rightSBQList);
  272. }
  273. if (rightQSList == null || rightQSList.Count == 0)
  274. {
  275. rightQSList = new List<PointMapModel>();
  276. GetTagNameList(codeList, "station", "QS_FDC", ref rightQSList);
  277. }
  278. if (rightXSList == null || rightXSList.Count == 0)
  279. {
  280. rightXSList = new List<PointMapModel>();
  281. GetTagNameList(codeList, "station", "XS_FDC", ref rightXSList);
  282. }
  283. if (rightDWKList == null || rightDWKList.Count == 0)
  284. {
  285. rightDWKList = new List<PointMapModel>();
  286. GetTagNameList(codeList, "station", "DWK_GDC", ref rightDWKList);
  287. }
  288. if (rightPLList == null || rightPLList.Count == 0)
  289. {
  290. rightPLList = new List<PointMapModel>();
  291. GetTagNameList(codeList, "station", "PL_GDC", ref rightPLList);
  292. }
  293. if (rightXHList == null || rightXHList.Count == 0)
  294. {
  295. rightXHList = new List<PointMapModel>();
  296. GetTagNameList(xhCodeList, "station", "XH_GDC", ref rightXHList);
  297. }
  298. Dictionary<string, TsData> dicSBQ = RestfulClient.findLatestByTagNames(rightSBQList.Select(s => s.PointId).ToArray());
  299. Dictionary<string, TsData> dicQS = RestfulClient.findLatestByTagNames(rightQSList.Select(s => s.PointId).ToArray());
  300. Dictionary<string, TsData> dicMHS = RestfulClient.findLatestByTagNames(rightMHSList.Select(s => s.PointId).ToArray());
  301. Dictionary<string, TsData> dicXS = RestfulClient.findLatestByTagNames(rightXSList.Select(s => s.PointId).ToArray());
  302. Dictionary<string, TsData> dicNSS = RestfulClient.findLatestByTagNames(rightNSSList.Select(s => s.PointId).ToArray());
  303. Dictionary<string, TsData> dicDWK = RestfulClient.findLatestByTagNames(rightDWKList.Select(s => s.PointId).ToArray());
  304. Dictionary<string, TsData> dicPL = RestfulClient.findLatestByTagNames(rightPLList.Select(s => s.PointId).ToArray());
  305. Dictionary<string, TsData> dicXH = RestfulClient.findLatestByTagNames(rightXHList.Select(s => s.PointId).ToArray());
  306. foreach (KeyValuePair<string, TsData> kv in dicSBQ)
  307. {
  308. var data = rightSBQList.Where(s => s.PointId == kv.Key).FirstOrDefault();
  309. if (data != null)
  310. data.Value = Convert.ToDouble(kv.Value.getValue());
  311. }
  312. foreach (KeyValuePair<string, TsData> kv in dicQS)
  313. {
  314. var data = rightQSList.Where(s => s.PointId == kv.Key).FirstOrDefault();
  315. if (data != null)
  316. data.Value = Convert.ToDouble(kv.Value.getValue());
  317. }
  318. foreach (KeyValuePair<string, TsData> kv in dicMHS)
  319. {
  320. var data = rightMHSList.Where(s => s.PointId == kv.Key).FirstOrDefault();
  321. if (data != null)
  322. data.Value = Convert.ToDouble(kv.Value.getValue());
  323. }
  324. foreach (KeyValuePair<string, TsData> kv in dicXS)
  325. {
  326. var data = rightXSList.Where(s => s.PointId == kv.Key).FirstOrDefault();
  327. if (data != null)
  328. data.Value = Convert.ToDouble(kv.Value.getValue());
  329. }
  330. foreach (KeyValuePair<string, TsData> kv in dicNSS)
  331. {
  332. var data = rightNSSList.Where(s => s.PointId == kv.Key).FirstOrDefault();
  333. if (data != null)
  334. data.Value = Convert.ToDouble(kv.Value.getValue());
  335. }
  336. foreach (KeyValuePair<string, TsData> kv in dicDWK)
  337. {
  338. var data = rightDWKList.Where(s => s.PointId == kv.Key).FirstOrDefault();
  339. if (data != null)
  340. data.Value = Convert.ToDouble(kv.Value.getValue());
  341. }
  342. foreach (KeyValuePair<string, TsData> kv in dicPL)
  343. {
  344. var data = rightPLList.Where(s => s.PointId == kv.Key).FirstOrDefault();
  345. if (data != null)
  346. data.Value = Convert.ToDouble(kv.Value.getValue());
  347. }
  348. foreach (KeyValuePair<string, TsData> kv in dicXH)
  349. {
  350. var data = rightXHList.Where(s => s.PointId == kv.Key).FirstOrDefault();
  351. if (data != null)
  352. data.Value = Convert.ToDouble(kv.Value.getValue());
  353. }
  354. IList<Info> list = new List<Info>();
  355. Info sbqInfo = new Info()
  356. {
  357. Station = "石板泉",
  358. Power = Convert.ToDouble(GetValueByUniformCode(codeList[0], rightSBQList))
  359. };
  360. Info qsInfo = new Info()
  361. {
  362. Station = "青山",
  363. Power = Convert.ToDouble(GetValueByUniformCode(codeList[0], rightQSList))
  364. };
  365. Info mhsInfo = new Info()
  366. {
  367. Station = "麻黄山",
  368. Power = Convert.ToDouble(GetValueByUniformCode(codeList[0], rightMHSList))
  369. };
  370. Info xsInfo = new Info()
  371. {
  372. Station = "香山",
  373. Power = Convert.ToDouble(GetValueByUniformCode(codeList[0], rightXSList))
  374. };
  375. Info nssInfo = new Info()
  376. {
  377. Station = "牛首山",
  378. Power = Convert.ToDouble(GetValueByUniformCode(codeList[0], rightNSSList))
  379. };
  380. Info dwkInfo = new Info()
  381. {
  382. Station = "大武口",
  383. Power = Convert.ToDouble(GetValueByUniformCode(codeList[0], rightDWKList))
  384. };
  385. Info plInfo = new Info()
  386. {
  387. Station = "平罗",
  388. Power = Convert.ToDouble(GetValueByUniformCode(codeList[0], rightPLList))
  389. };
  390. Info xhInfo = new Info()
  391. {
  392. Station = "宣和",
  393. Power = Convert.ToDouble(GetValueByUniformCode(xhCodeList[0], rightXHList))
  394. };
  395. list.Add(dwkInfo);
  396. list.Add(plInfo);
  397. list.Add(xhInfo);
  398. list.Add(sbqInfo);
  399. list.Add(qsInfo);
  400. list.Add(mhsInfo);
  401. list.Add(xsInfo);
  402. list.Add(nssInfo);
  403. info.InfoList = list;
  404. //安全生产天数
  405. Dictionary<string, TsData> aqDic = RestfulClient.findLatestByTagNames(new[] { "JSFW.NX_GD_XXX_XX_XX_XXX_XXX_CI0220" });
  406. if (aqDic.Select(s => s.Value).ToList().Count > 0)
  407. info.SafetyDayCount = aqDic.Select(s => s.Value).ToList()[0].getValue();
  408. else
  409. info.SafetyDayCount = "NAN";
  410. DateTime FirstTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1));
  411. DateTime startDateTime = DateTime.Now.AddHours(-12);
  412. long startTimeStamp = (long)(startDateTime - FirstTime).TotalMilliseconds;
  413. long endTimeStamp = (long)(DateTime.Now - FirstTime).TotalMilliseconds;
  414. List<TsData> speedList = RestfulClient.findHistorySnapByThingCodes("station", "-1", "SSFS", startTimeStamp, endTimeStamp, 3600);
  415. List<TsData> powerList = RestfulClient.findHistorySnapByThingCodes("station", "0", Point.SSZGL, startTimeStamp, endTimeStamp, 3600);
  416. if (speedList != null && powerList != null && speedList.Count == powerList.Count)
  417. {
  418. info.DateTimeArray = new DateTime[powerList.Count];
  419. info.PowerArray = new double[powerList.Count];
  420. info.SpeedArray = new double[powerList.Count];
  421. for (int i = 0; i < powerList.Count; i++)
  422. {
  423. info.DateTimeArray[i] = ConvertStringToDateTime(speedList[i].ts.ToString());
  424. info.PowerArray[i] = Convert.ToDouble(powerList[i].getValue());
  425. info.SpeedArray[i] = Convert.ToDouble(speedList[i].getValue());
  426. }
  427. }
  428. return info;
  429. }
  430. //限电5》运行1》待机0》维护4》故障2》离线3
  431. private Status GetStatusByStation(IList<PointMapModel> list)
  432. {
  433. var xdData = list.Where(s => s.UniformCode == Point.XDTS).FirstOrDefault();
  434. int xdCount = Convert.ToInt32(xdData.Value);
  435. var yxData = list.Where(s => s.UniformCode == Point.YXTS).FirstOrDefault();
  436. int yxCount = Convert.ToInt32(yxData.Value);
  437. var djData = list.Where(s => s.UniformCode == Point.DJTS).FirstOrDefault();
  438. int djCount = Convert.ToInt32(djData.Value);
  439. var whData = list.Where(s => s.UniformCode == Point.WHTJ).FirstOrDefault();
  440. int whCount = Convert.ToInt32(whData.Value);
  441. var gzData = list.Where(s => s.UniformCode == Point.GZTJ).FirstOrDefault();
  442. int gzCount = Convert.ToInt32(gzData.Value);
  443. var lxData = list.Where(s => s.UniformCode == Point.LXTS).FirstOrDefault();
  444. int lxCount = Convert.ToInt32(lxData.Value);
  445. if (xdCount > 0)
  446. return Status.Limit;
  447. else if (yxCount > 0)
  448. return Status.Run;
  449. else if (djCount > 0)
  450. return Status.StandBy;
  451. else if (whCount > 0)
  452. return Status.Maintain;
  453. else if (gzCount > 0)
  454. return Status.Falut;
  455. else if (lxCount > 0)
  456. return Status.Offline;
  457. else
  458. return Status.StandBy;
  459. }
  460. private string GetValueByUniformCode(string uniformCode, IList<PointMapModel> list)
  461. {
  462. var data = list.Where(s => s.UniformCode == uniformCode).FirstOrDefault();
  463. if (data != null)
  464. return data.Value.ToString("f2");
  465. else
  466. return "";
  467. }
  468. private DateTime ConvertStringToDateTime(string timeStamp)
  469. {
  470. DateTime dtStart = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970, 1, 1));
  471. long lTime = long.Parse(timeStamp.Substring(0,timeStamp.Length-3)+ "0000000");
  472. TimeSpan toNow = new TimeSpan(lTime);
  473. return dtStart.Add(toNow);
  474. }
  475. public void GetTagNameList(IList<string> codeList, string type, string thingId, ref IList<PointMapModel> tagNameList)
  476. {
  477. using (wisdom_cs_entity entity = new wisdom_cs_entity())
  478. {
  479. if (type == "station")
  480. {
  481. IList<windpowerstationtestingpoint> pointList =
  482. entity.windpowerstationtestingpoint.Where(
  483. s => s.WINDPOWERSTATIONID == thingId && codeList.Contains(s.UNIFORMCODE)).ToList();
  484. for (int i = 0; i < pointList.Count; i++)
  485. {
  486. PointMapModel model = new PointMapModel();
  487. model.ThingType = 0;
  488. model.DataType = 0;
  489. model.ThingId = thingId;
  490. model.PointName = pointList[i].NAME;
  491. model.PointId = pointList[i].CODE;
  492. model.UniformCode = pointList[i].UNIFORMCODE;
  493. tagNameList.Add(model);
  494. }
  495. }
  496. }
  497. }
  498. }
  499. }