AdviceCache.cs 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575
  1. using GDNXFD.Data;
  2. using GDNXFD.Data.Model;
  3. using GDNXFD.Data.Repositories;
  4. using GDNXFD.WcfService.RealtimeState;
  5. using GDNXFD.WcfService.RealtimeState.Domain;
  6. using System;
  7. using System.Collections.Generic;
  8. using System.Configuration;
  9. using System.Linq;
  10. using System.Text;
  11. using System.Threading.Tasks;
  12. using WisdomClient.data;
  13. namespace GDNXFD.WcfService
  14. {
  15. public class AdviceCache
  16. {
  17. #region 单例方法
  18. public static AdviceCache Instance
  19. {
  20. get { return SingletonCreator.instance; }
  21. }
  22. class SingletonCreator
  23. {
  24. internal static readonly AdviceCache instance = new AdviceCache();
  25. }
  26. #endregion
  27. /// <summary>
  28. /// 实时状态计算结果(最终计算结果,报警,状态,风速)
  29. /// </summary>
  30. public IList<AdviceModel> AdviceList { get; set; }
  31. /// <summary>
  32. /// 预测结果
  33. /// </summary>
  34. public IList<AdviceModel> PredictAdviceList { get; set; }
  35. /// <summary>
  36. /// 风机信息(包含统一编码和测点实时数据)
  37. /// </summary>
  38. ///
  39. public Dictionary<string, WindturbineInfo> dicWindturbineInfo;
  40. Dictionary<string, TagInfo> dicTag;
  41. private static string windSpeedCode_Up82 = ConfigurationManager.AppSettings["WindSpeed_Up82"];
  42. private static string windSpeedCode_Up105 = ConfigurationManager.AppSettings["WindSpeed_Up105"];
  43. private static string windSpeedCode_FiveMin = ConfigurationManager.AppSettings["WindSpeedCode_FiveMin"];
  44. //用户取消后的有效时间(毫秒)
  45. private static int UserCancelTime = Convert.ToInt32(ConfigurationManager.AppSettings["UserCancelTime"]);
  46. /// <summary>
  47. /// key=风机编号,value 风机状态测点
  48. /// </summary>
  49. private Dictionary<string, string> pointDic;
  50. private Object AdviceListAddLock = new object();
  51. /// <summary>
  52. /// 计算结果合并
  53. /// </summary>
  54. /// <param name="list">实时计算结果</param>
  55. public void AdviceListAdd(IList<AdviceModel> list)
  56. {
  57. lock (AdviceListAddLock)// 多线程锁
  58. {
  59. if (AdviceList == null)
  60. AdviceList = new List<AdviceModel>();
  61. //预测结果,与当前状态,与预测时间比较后的结果
  62. IList<AdviceModel> allowList = new List<AdviceModel>();
  63. if (pointDic == null)
  64. GetStatusPoint();
  65. if (PredictAdviceList != null)
  66. {
  67. DateTime nowTime = DateTime.Now;
  68. IList<AdviceModel> alist = PredictAdviceList.Where(s => s.AdviceExecuteTime < nowTime).ToList();
  69. for (int i = 0; i < alist.Count; i++)
  70. {
  71. double? statusValue = null;
  72. double? hungTypeValue = null;
  73. if (dicWindturbineInfo[alist[i].WindturbineId].StatusCode.TagData.doubleValue.HasValue)
  74. statusValue = dicWindturbineInfo[alist[i].WindturbineId].StatusCode.TagData.doubleValue.Value;
  75. if (dicWindturbineInfo[alist[i].WindturbineId].LockCode.TagData.doubleValue.HasValue)
  76. hungTypeValue = dicWindturbineInfo[alist[i].WindturbineId].LockCode.TagData.doubleValue.Value;
  77. if (statusValue.HasValue && hungTypeValue.HasValue)
  78. {
  79. WStatus status = HelpperMethod.GetWindturbineStatus(statusValue.Value);
  80. HungType hungType = HelpperMethod.GetHungType(hungTypeValue.Value);
  81. //如果建议启动,风机未挂牌,且风机当前状态为待机,
  82. if (alist[i].AdviseOperation == OperateStyle.Start && status == WStatus.Standby && hungType == HungType.UnLock)
  83. {
  84. allowList.Add(alist[i]);
  85. }
  86. WStatus[] statusArr = { WStatus.Online, WStatus.OnPower, WStatus.Start };
  87. //如果建议停机,风机未挂牌,且当前风机状态为 并网、上电、启动中的一种
  88. if (alist[i].AdviseOperation == OperateStyle.Stop && statusArr.Contains(status) && hungType == HungType.UnLock)
  89. {
  90. allowList.Add(alist[i]);
  91. }
  92. }
  93. }
  94. }
  95. //最终合并结果
  96. IList<AdviceModel> finalList = list;
  97. for (int i = 0; i < allowList.Count; i++)
  98. {
  99. string windturbineId = allowList[i].WindturbineId;
  100. int count = finalList.Where(s => s.WindturbineId == windturbineId).ToList().Count;
  101. if (count == 0)
  102. finalList.Add(allowList[i]);
  103. }
  104. for (int i = 0; i < finalList.Count; i++)
  105. {
  106. string windturbineId = finalList[i].WindturbineId;
  107. AdviceModel m = AdviceList.Where(s => s.WindturbineId == windturbineId).FirstOrDefault();
  108. if (m == null)
  109. {
  110. AdviceList.Add(finalList[i]);
  111. //添加计算流水表数据
  112. InsertAdviceModelHistory(finalList[i]);
  113. }
  114. else
  115. {
  116. //如果m的状态为用户取消
  117. if (m.Status == 3)
  118. {
  119. TimeSpan sp = DateTime.Now - m.ExecuteTime.Value;
  120. //如果m的取消时间已经失效,则继续将计算结果合并到AdviceList中
  121. if (sp.TotalMilliseconds > UserCancelTime)
  122. {
  123. m.AdviseOperation = finalList[i].AdviseOperation;
  124. m.AdviceType = finalList[i].AdviceType;
  125. m.LastUpdateTime = finalList[i].LastUpdateTime;
  126. m.AdviceExecuteTime = finalList[i].AdviceExecuteTime;
  127. m.ExecuteTime = finalList[i].ExecuteTime;
  128. m.ExecuteOperation = finalList[i].ExecuteOperation;
  129. m.Operater = finalList[i].Operater;
  130. m.Status = finalList[i].Status;
  131. m.Notes = finalList[i].Notes;
  132. //添加新的计算流水表信息
  133. InsertAdviceModelHistory(finalList[i]);
  134. }
  135. }
  136. //如果m的状态为未执行
  137. else if (m.Status == 1)
  138. {
  139. //如果本次推荐和上次推荐结果不一致,则更新推荐结果,
  140. if (m.AdviseOperation != finalList[i].AdviseOperation)
  141. {
  142. m.AdviseOperation = finalList[i].AdviseOperation;
  143. m.AdviceType = finalList[i].AdviceType;
  144. m.LastUpdateTime = finalList[i].LastUpdateTime;
  145. m.AdviceExecuteTime = finalList[i].AdviceExecuteTime;
  146. m.ExecuteTime = finalList[i].ExecuteTime;
  147. m.ExecuteOperation = finalList[i].ExecuteOperation;
  148. m.Operater = finalList[i].Operater;
  149. m.Status = finalList[i].Status;
  150. m.Notes = finalList[i].Notes;
  151. //将上一次的流水信息更新
  152. UpdateAdviceModelHistory(finalList[i].WindturbineId, 4, "系统", "0");
  153. //添加新的计算流水表信息
  154. InsertAdviceModelHistory(finalList[i]);
  155. }
  156. }
  157. //如果m的状态为用户执行
  158. else if (m.Status == 2)
  159. {
  160. //如果本次推荐和上次推荐结果不一致,则更新推荐结果,
  161. if (m.AdviseOperation != finalList[i].AdviseOperation)
  162. {
  163. m.AdviseOperation = finalList[i].AdviseOperation;
  164. m.AdviceType = finalList[i].AdviceType;
  165. m.LastUpdateTime = finalList[i].LastUpdateTime;
  166. m.AdviceExecuteTime = finalList[i].AdviceExecuteTime;
  167. m.ExecuteTime = finalList[i].ExecuteTime;
  168. m.ExecuteOperation = finalList[i].ExecuteOperation;
  169. m.Operater = finalList[i].Operater;
  170. m.Status = finalList[i].Status;
  171. m.Notes = finalList[i].Notes;
  172. //添加新的计算流水表信息
  173. InsertAdviceModelHistory(finalList[i]);
  174. }
  175. }
  176. //如果m的状态为系统取消
  177. else
  178. {
  179. //如果本次推荐和上次推荐结果不一致,则更新推荐结果,
  180. if (m.AdviseOperation != finalList[i].AdviseOperation)
  181. {
  182. m.AdviseOperation = finalList[i].AdviseOperation;
  183. m.AdviceType = finalList[i].AdviceType;
  184. m.LastUpdateTime = finalList[i].LastUpdateTime;
  185. m.AdviceExecuteTime = finalList[i].AdviceExecuteTime;
  186. m.ExecuteTime = finalList[i].ExecuteTime;
  187. m.ExecuteOperation = finalList[i].ExecuteOperation;
  188. m.Operater = finalList[i].Operater;
  189. m.Status = finalList[i].Status;
  190. m.Notes = finalList[i].Notes;
  191. //添加新的计算流水表信息
  192. InsertAdviceModelHistory(finalList[i]);
  193. }
  194. }
  195. }
  196. }
  197. //排除已失效的计算结果, 如果finalList没有的风机,但AdviceList有的风机,说明上次风机的计算结果已失效,其中失效包括 用户已执行,和系统取消
  198. IList<string> finalWindturbineIdList = finalList.Select(s => s.WindturbineId).ToList();
  199. for (int i = 0; i < AdviceList.Count; i++)
  200. {
  201. if (!finalWindturbineIdList.Contains(AdviceList[i].WindturbineId))
  202. {
  203. if (AdviceList[i].Status == 1&& (AdviceList[i].AdviseOperation==OperateStyle.Start|| AdviceList[i].AdviseOperation == OperateStyle.Stop))
  204. {
  205. AdviceList[i].Status = 4;
  206. UpdateAdviceModelHistory(AdviceList[i].WindturbineId, 4, "系统", "0");
  207. }
  208. }
  209. }
  210. #region 运行结果打印
  211. //Console.WriteLine("*********************************************");
  212. //for (int i = 0; i < AdviceList.Count; i++)
  213. //{
  214. // string infoString = "";
  215. // infoString = infoString + "风机当前状态为" + HelpperMethod.GetWindturbineStatus(dicWindturbineInfo[AdviceList[i].WindturbineId].StatusCode.TagData.doubleValue.Value).ToString();
  216. // infoString = infoString + "风机当前风速为" + dicWindturbineInfo[AdviceList[i].WindturbineId].WindSpeedCode.TagData.doubleValue.Value.ToString("f2") + "m/s";
  217. // //获取切入风
  218. // double putSpeed = CalcStateSvc.Instance.inputSpeedDic[AdviceList[i].WindturbineId];
  219. // string s = "是否失效" + AdviceList[i].Status + "-" + AdviceList[i].WindturbineId + "--推荐动作:" + AdviceList[i].AdviseOperation.ToString() + "----" + infoString + "切入风:" + putSpeed.ToString("");
  220. // Console.WriteLine(s);
  221. //}
  222. //Console.WriteLine("*********************************************");
  223. #endregion
  224. }
  225. }
  226. /// <summary>
  227. /// 计算结果合并--待机状态的风机推荐维护和维护状态下的推荐取消维护
  228. /// </summary>
  229. /// <param name="list">实时计算结果</param>
  230. public void AddMaintainAdvice(IList<AdviceModel> list)
  231. {
  232. lock (AdviceListAddLock)// 多线程锁
  233. {
  234. if (AdviceList == null)
  235. AdviceList = new List<AdviceModel>();
  236. // 全局列表中所有建议维护的设备
  237. var tmpMaintainCopy = AdviceList.Where(a => a.AdviseOperation == OperateStyle.Maintain).ToArray();
  238. AdviceModel[] copyTmpMaintain = new AdviceModel[tmpMaintainCopy.Length];
  239. tmpMaintainCopy.CopyTo(copyTmpMaintain, 0);
  240. // 以风机编号为key,风机信息为Value
  241. var tmpMaintainDictionary = copyTmpMaintain.Select(c => new KeyValuePair<string, AdviceModel>(c.WindturbineId, c)).ToDictionary(k => k.Key, v => v.Value);
  242. // 全局列表中所有建议取消维护的设备
  243. var tmpCancelMaintainCopy = AdviceList.Where(a => a.AdviseOperation == OperateStyle.UnMaintain).ToArray();
  244. AdviceModel[] copyTmpCancelMaintain = new AdviceModel[tmpCancelMaintainCopy.Length];
  245. tmpCancelMaintainCopy.CopyTo(copyTmpCancelMaintain, 0);
  246. // 以风机编号为key,风机信息为Value
  247. var tmpCancelMaintainDictionary = copyTmpCancelMaintain.Select(c => new KeyValuePair<string, AdviceModel>(c.WindturbineId, c)).ToDictionary(k => k.Key, v => v.Value);
  248. foreach (var l in list)
  249. {
  250. // 上次要维护,这次也维护 ---> 不做操作
  251. if (tmpMaintainDictionary.ContainsKey(l.WindturbineId) && l.AdviseOperation == OperateStyle.Maintain)
  252. {
  253. //
  254. tmpMaintainDictionary.Remove(l.WindturbineId);//移除
  255. //
  256. }
  257. // 上次要维护,这次却取消维护--->
  258. else if (tmpMaintainDictionary.ContainsKey(l.WindturbineId) && l.AdviseOperation == OperateStyle.UnMaintain)
  259. {
  260. // 查看上次取消维护中有没有这个记录,如果有,上次取消维护就不做更改 ----> 对应的,删除推荐维护的记录,并将流水变更掉
  261. // 如果没有,添加上这个维护记录,添加流水 ----> 对应的,删除推荐维护记录,并将流水变更掉
  262. if (!tmpCancelMaintainDictionary.ContainsKey(l.WindturbineId))
  263. {
  264. AdviceList.Add(l);
  265. //添加计算流水表数据
  266. InsertAdviceModelHistory(l);
  267. }
  268. }
  269. // 上次要取消维护,这次也取消维护
  270. else if (tmpCancelMaintainDictionary.ContainsKey(l.WindturbineId) && l.AdviseOperation == OperateStyle.UnMaintain)
  271. {
  272. tmpCancelMaintainDictionary.Remove(l.WindturbineId);
  273. }
  274. // 上次要取消维护,这次却要维护
  275. else if (tmpCancelMaintainDictionary.ContainsKey(l.WindturbineId) && l.AdviseOperation == OperateStyle.Maintain)
  276. {
  277. //
  278. if (tmpMaintainDictionary.ContainsKey(l.WindturbineId))
  279. {
  280. AdviceList.Add(l);
  281. //添加计算流水表数据
  282. InsertAdviceModelHistory(l);
  283. }
  284. }
  285. // 上次没有维护 ---> ADD 加流水
  286. else
  287. {
  288. AdviceList.Add(l);
  289. //添加计算流水表数据
  290. InsertAdviceModelHistory(l);
  291. //
  292. }
  293. }
  294. // 上次有维护,这次没有维护 ---> 删除没有老记录,流水变更为系统取消
  295. // cancelMaintainArray 剩下的就是老记录了 需要取消推荐并移除
  296. foreach (var v in tmpMaintainDictionary.Values)
  297. {
  298. //将上一次的流水信息更新
  299. UpdateAdviceModelHistory(v.WindturbineId, 4, "系统", "0");
  300. AdviceList.Remove(v);
  301. }
  302. // 上次有取消维护,这次没有取消维护 -->删除老记录,流水变更为系统取消
  303. foreach (var v in tmpCancelMaintainDictionary.Values)
  304. {
  305. //将上一次的流水信息更新
  306. UpdateAdviceModelHistory(v.WindturbineId, 4, "系统", "0");
  307. AdviceList.Remove(v);
  308. }
  309. Console.WriteLine("全场无风 维护&取消维护 运行完成");
  310. }
  311. }
  312. /// <summary>
  313. /// 获取风机状态测点
  314. /// </summary>
  315. private void GetStatusPoint()
  316. {
  317. if (pointDic == null)
  318. pointDic = new Dictionary<string, string>();
  319. using (GDNXFDDbContext ctx = new GDNXFDDbContext())
  320. {
  321. IList<WindTurbineTestingPointAI> pointList = ctx.WindTurbineTestingPointAI.Where(s => s.UniformCode == "FJZT8").ToList();
  322. for (int i = 0; i < pointList.Count; i++)
  323. {
  324. if (!pointDic.ContainsKey(pointList[i].WindturbineId))
  325. {
  326. pointDic.Add(pointList[i].WindturbineId, pointList[i].Id);
  327. }
  328. }
  329. }
  330. }
  331. public void GetWindturbinInfo()
  332. {
  333. if (dicWindturbineInfo == null)
  334. {
  335. dicWindturbineInfo = new Dictionary<string, WindturbineInfo>();
  336. using (GDNXFDDbContext ctx = new GDNXFDDbContext())
  337. {
  338. IList<WindTurbine> list = ctx.WindTurbine.Where(s => s.WindPowerStationId.Contains("_FDC") && s.WindPowerStationId != "QS_FDC").ToList().ToList();
  339. for (int i = 0; i < list.Count; i++)
  340. {
  341. WindturbineInfo d = new WindturbineInfo();
  342. d.Windturbine = list[i];
  343. d.WindturbineId = list[i].Id;
  344. d.StatusCode = new TagInfo();
  345. d.StatusCode.UniformCode = "FJZT8";
  346. d.BoxTemperature = new TagInfo();
  347. d.BoxTemperature.UniformCode = "AI057";
  348. d.WindturbinePower = new TagInfo();
  349. d.WindturbinePower.UniformCode = "AI130";
  350. d.WindSpeedCode = new TagInfo();
  351. d.WindSpeedCodeFiveMin = new TagInfo();
  352. if (list[i].ModelId == "UP105-2000-S")
  353. d.WindSpeedCode.UniformCode = windSpeedCode_Up105;
  354. else
  355. d.WindSpeedCode.UniformCode = windSpeedCode_Up82;
  356. d.LockCode = new TagInfo();
  357. d.LockCode.UniformCode = "XDSL";
  358. d.WindSpeedCodeFiveMin.UniformCode = windSpeedCode_FiveMin;
  359. d.WindDirectionCode = new TagInfo();
  360. string[] stationIdArr = { "SBQ_FDC", "MHS_FDC" };
  361. if (stationIdArr.Contains(list[i].WindPowerStationId) && list[i].ModelId == "UP105-2000-S")
  362. d.WindDirectionCode.UniformCode = "AI010";
  363. else
  364. d.WindDirectionCode.UniformCode = "AI008";
  365. if (!dicWindturbineInfo.ContainsKey(list[i].Id))
  366. dicWindturbineInfo.Add(d.WindturbineId, d);
  367. string[] arr = { d.StatusCode.UniformCode, d.WindSpeedCode.UniformCode, d.WindDirectionCode.UniformCode, d.LockCode.UniformCode,d.WindSpeedCodeFiveMin.UniformCode,d.BoxTemperature.UniformCode,d.WindturbinePower.UniformCode };
  368. string windturbineId = list[i].Id;
  369. IList<WindTurbineTestingPointAI> aiList = ctx.WindTurbineTestingPointAI.Where(s => s.WindturbineId == windturbineId && arr.Contains(s.UniformCode)).ToList();
  370. if (dicTag == null)
  371. dicTag = new Dictionary<string, TagInfo>();
  372. for (int j = 0; j < aiList.Count; j++)
  373. {
  374. if (!dicTag.ContainsKey(aiList[j].Id))
  375. {
  376. if (aiList[j].UniformCode == d.WindSpeedCode.UniformCode)
  377. dicTag.Add(aiList[j].Id, d.WindSpeedCode);
  378. if (aiList[j].UniformCode == d.WindDirectionCode.UniformCode)
  379. dicTag.Add(aiList[j].Id, d.WindDirectionCode);
  380. if (aiList[j].UniformCode == d.StatusCode.UniformCode)
  381. dicTag.Add(aiList[j].Id, d.StatusCode);
  382. if (aiList[j].UniformCode == d.LockCode.UniformCode)
  383. dicTag.Add(aiList[j].Id, d.LockCode);
  384. if (aiList[j].UniformCode == d.WindSpeedCodeFiveMin.UniformCode)
  385. dicTag.Add(aiList[j].Id, d.WindSpeedCodeFiveMin);
  386. if (aiList[j].UniformCode == d.BoxTemperature.UniformCode)// 机舱温度
  387. {
  388. dicTag.Add(aiList[j].Id, d.BoxTemperature);
  389. }
  390. if (aiList[j].UniformCode == d.WindturbinePower.UniformCode)// 机舱温度
  391. {
  392. dicTag.Add(aiList[j].Id, d.WindturbinePower);
  393. }
  394. }
  395. }
  396. }
  397. }
  398. }
  399. Dictionary<string, TsData> resultDic = WisdomClient.RestfulClient.findLatestByTagNames(dicTag.Keys.ToArray());
  400. foreach (var item in resultDic)
  401. {
  402. if (dicTag.ContainsKey(item.Key))
  403. dicTag[item.Key].TagData = item.Value;
  404. }
  405. Console.WriteLine(" [|]");
  406. }
  407. public void GetPredictAdviceModel(WindTurbine wt)
  408. {
  409. if (PredictAdviceList == null)
  410. PredictAdviceList = new List<AdviceModel>();
  411. foreach (var am in PredictAdviceList)
  412. {
  413. if (am.WindturbineId == wt.Id)
  414. {
  415. am.LastUpdateTime = DateTime.Now;
  416. am.Status = 1;
  417. am.AdviseOperation = OperateStyle.Start;
  418. am.AdviceExecuteTime = DateTime.Now;
  419. return;
  420. }
  421. }
  422. AdviceModel adm = new AdviceModel();
  423. adm.AdviceExecuteTime = DateTime.Now;
  424. adm.AdviceType = CalculationOriginType.PowerForecast;
  425. adm.AdviseOperation = OperateStyle.Start;
  426. adm.LastUpdateTime = DateTime.Now;
  427. adm.ModelId = wt.ModelId;
  428. adm.StationId = wt.WindPowerStationId;
  429. adm.Status = 1;
  430. adm.WindturbineId = wt.Id;
  431. PredictAdviceList.Add(adm);
  432. }
  433. /// <summary>
  434. /// 添加计算流水表信息
  435. /// </summary>
  436. /// <param name="model">更新数据</param>
  437. /// <param name="typeString">更新类型:1=未执行,2=用户执行,3=用户取消,4=系统取消</param>
  438. /// <param name="userName">操作人姓名</param>
  439. /// <param name="userId">操作人用户编号,系统用户编号为0</param>
  440. public void InsertAdviceModelHistory(AdviceModel model)
  441. {
  442. AdviceHistoryModel hisModel = new AdviceHistoryModel();
  443. hisModel.Id = Guid.NewGuid().ToString();
  444. hisModel.WindturbineId = model.WindturbineId;
  445. hisModel.StationId = model.StationId;
  446. hisModel.ModelId = model.ModelId;
  447. hisModel.AdviseOperation = model.AdviseOperation;
  448. hisModel.AdviceType = model.AdviceType;
  449. hisModel.LastUpdateTime = model.LastUpdateTime;
  450. hisModel.AdviceExecuteTime = model.AdviceExecuteTime;
  451. hisModel.ExecuteTime = model.ExecuteTime;
  452. hisModel.ExecuteOperation = model.ExecuteOperation;
  453. hisModel.Status = model.Status;
  454. IList<AdviceHistoryModel> list = new List<AdviceHistoryModel>();
  455. list.Add(hisModel);
  456. AdviceHistoryModelRepository.InsertHistory(list);
  457. }
  458. /// <summary>
  459. /// 更新计算流水信息
  460. /// </summary>
  461. /// <param name="windturbineId">风机编号</param>
  462. /// <param name="actionType">更新类型:1=未执行,2=用户执行,3=用户取消,4=系统取消<</param>
  463. /// <param name="userName">操作人姓名</param>
  464. /// <param name="userId">操作人用户编号,系统用户编号为0</param>
  465. public void UpdateAdviceModelHistory(string windturbineId, int actionType, string userName, string userId)
  466. {
  467. AdviceHistoryModelRepository.UpdateHistory(windturbineId, userId, userName, actionType);
  468. }
  469. }
  470. }