CChartViewModel.cs 46 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217
  1. using FINANCEPRICELib;
  2. using GalaSoft.MvvmLight;
  3. using GalaSoft.MvvmLight.Command;
  4. using GalaSoft.MvvmLight.Ioc;
  5. using Muchinfo.MTPClient.Data;
  6. using Muchinfo.MTPClient.Data.Chart;
  7. using Muchinfo.MTPClient.Data.DTO;
  8. using Muchinfo.MTPClient.Data.Enums;
  9. using Muchinfo.MTPClient.Data.Model;
  10. using Muchinfo.MTPClient.Data.Quote;
  11. using Muchinfo.MTPClient.Infrastructure.Cache;
  12. using Muchinfo.MTPClient.Infrastructure.Helpers;
  13. using Muchinfo.MTPClient.Infrastructure.MessageBox;
  14. using Muchinfo.MTPClient.Infrastructure.Utilities;
  15. using Muchinfo.MTPClient.IService;
  16. using Muchinfo.PC.Common.Helpers;
  17. using System;
  18. using System.Collections.Generic;
  19. using System.IO;
  20. using System.Linq;
  21. using System.Runtime.InteropServices;
  22. using System.Text;
  23. //----------------------------------------------------------------
  24. //Module Name: $safeprojectname$
  25. //Purpose:
  26. //CopyRight: Muchinfo
  27. //History:
  28. //----------------------------------------------------------------
  29. //DateTime 2017/2/4 10:25:33
  30. //Author
  31. //Description Create
  32. //----------------------------------------------------------------
  33. using System.Windows.Input;
  34. using Muchinfo.MTPClient.Data.Model.Account;
  35. namespace Muchinfo.MTPClient.Analysis.ViewModels
  36. {
  37. public class CChartViewModel : ChartViewModelBase, IDisposable
  38. {
  39. private ICommonQueryService _commonQueryService;
  40. static CChartViewModel()
  41. {
  42. Init();
  43. }
  44. public static void Init()
  45. {
  46. //关于图表管理静态类初始化问题 以后考虑放到外面同意初始化
  47. //Exception ex=null;
  48. string SysteFile = System.IO.Path.Combine(UserManager.SysConfigFolderPath, "SystemFile.dat");
  49. string UserFile = System.IO.Path.Combine(UserManager.SysConfigFolderPath, "UserFile.dat");
  50. try
  51. {
  52. FinanceGlobal = new GlobalAttribClass();
  53. FinanceGlobal.SetDllType((int)DLLEDITIONTYPE.DllEditionType_MUCHINFO_MTP);
  54. FinanceGlobal.SetUseVirtualVolume(1);
  55. FinanceGlobal.SetUserFileName(UserFile);
  56. FinanceGlobal.SetSystemFileName(SysteFile);
  57. //FinanceChart.FilePath(UserIniFile);
  58. // FinanceChart.FilePath(UserIniFile);
  59. //STDMETHOD(SetSystemFileName)(/*[in]*/ BSTR strFileName);
  60. //STDMETHOD(SetUserFileName)(/*[in]*/ BSTR strFileName);
  61. #if !Futury
  62. FinanceGlobal.SetHistoryEdition((int)HistoryEdition.HistoryEdition_Muchinfo_MTP_WITH_SETTLE);
  63. #else
  64. FinanceGlobal.SetHistoryEdition((int)HistoryEdition.HistoryEdition_Muchinfo_MTP_WITH_SETTLE); //3
  65. #endif
  66. FinanceGlobal.SetSystemDateTime(ApplicationParameter.ServerTimeNow.ToString("yyyyMMddHHmmss"));
  67. FinanceGlobal.SetUseSingleViewConfig(1);
  68. }
  69. catch (COMException ex)
  70. {
  71. MessageBoxHelper.ShowQuestion(string.Format(Resources.Client_Resource.ChartRegisterError,
  72. Path.Combine(ChartPathDir, c_chartRegitFile)), Resources.Client_Resource.APP_Tips);
  73. LogHelper.WriteError(typeof(CChartViewModel), ex.ToString());
  74. }
  75. }
  76. private static GlobalAttribClass FinanceGlobal; ////图表配置
  77. private PriceChartClass _financeChart; ////图表对象
  78. private int _controlHandle;
  79. private CycleType _cycleType;
  80. private const string c_chartRegitFile = "regchart.bat"; ///注册图表控件的文件路径
  81. private ChartCycleType _chartCycleType = ChartCycleType.MinuteTik;
  82. ///图表路径目录
  83. public static string ChartPathDir
  84. {
  85. get
  86. {
  87. return Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "COM");
  88. }
  89. }
  90. public CChartViewModel(QuoteGoods goods, int handle):base(goods)
  91. {
  92. try
  93. {
  94. if (_commonQueryService == null)
  95. {
  96. _commonQueryService = SimpleIoc.Default.GetInstance<ICommonQueryService>();
  97. /*废弃,不需要这个逻辑了
  98. if (CacheManager.QuoteSourceGroupMarketDatas == null ||
  99. CacheManager.QuoteSourceGroupMarketDatas.Count == 0)
  100. {
  101. _commonQueryService.QuoteSourceGroupMarketDate((list =>
  102. {
  103. }), entity =>
  104. {
  105. });
  106. }*/
  107. }
  108. RegiterMsg();
  109. _controlHandle = handle;
  110. string UserIniFile = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "FinancePrice.ini");
  111. _financeChart = new PriceChartClass();
  112. _financeChart.OnMenuMessage += new _IPriceChartEvents_OnMenuMessageEventHandler(Chart_OnMenuMessage);
  113. _financeChart.RequestHistoryPrice +=
  114. new _IPriceChartEvents_RequestHistoryPriceEventHandler(RequestHistoryPrice);
  115. PriceViewModel = new QuotePriceViewModel();
  116. _financeChart.FilePath = UserIniFile;
  117. _quoteDataService = SimpleIoc.Default.GetInstance<IQuoteDataService>();
  118. _currentGoods = goods;
  119. CommandTypes = SimpleIoc.Default.GetInstance<ISystemService>().GetIndicator();
  120. QueryGoodsReckonPlan(goods);
  121. InitSetChartColorStyle();
  122. ChartCycle =(int) ChartCycleType.MinuteTik;
  123. SetIndecatorEnable(0);
  124. }
  125. catch (Exception ex)
  126. {
  127. LogHelper.WriteError(typeof(CChartViewModel), ex.ToString());
  128. }
  129. }
  130. /// <summary>
  131. /// 图表请求数据
  132. /// </summary>
  133. /// <param name="lExchangeCode">交易所代码</param>
  134. /// <param name="strWareCode">商品代码</param>
  135. /// <param name="strStartDate">开始时间</param>
  136. /// <param name="strEndDate">结束时间</param>
  137. /// <param name="lPriceNum">请求数量</param>
  138. /// <param name="lDataCycle">周期</param>
  139. private void RequestHistoryPrice(int lExchangeCode, string strWareCode, string strStartDate, string strEndDate,
  140. int lPriceNum, int lDataCycle)
  141. {
  142. // Console.WriteLine("请求:" + lDataCycle);
  143. //var dataCycle = lDataCycle;
  144. //格式化开始时间
  145. string strStart = FormatSeverTime(strStartDate);
  146. //格式化结束时间
  147. string strEnd = FormatSeverTime(strEndDate);
  148. DateTime starTime; //取当前时间之前的
  149. if (string.IsNullOrWhiteSpace(strStart) || !DateTime.TryParse(strStart, out starTime))
  150. {
  151. starTime = ApplicationParameter.ServerTimeNow;
  152. }
  153. DateTime endTime;
  154. if (string.IsNullOrWhiteSpace(strEnd) || !DateTime.TryParse(strEnd, out endTime))
  155. {
  156. endTime = ApplicationParameter.BasicDateTime;
  157. }
  158. short count = (short)lPriceNum;
  159. _quoteDataService.GetHistoryCycleData(_currentGoods, (CycleType)lDataCycle, starTime, endTime, count,
  160. QueryHistorySuccess,
  161. ErrorSuccess);
  162. SetIndecatorEnable(0);
  163. }
  164. /// <summary>
  165. /// 历史数据回应
  166. /// </summary>
  167. /// <param name="data"></param>
  168. private void QueryHistorySuccess(byte[] data)
  169. {
  170. if (data == null || data.Length == 0)
  171. {
  172. LogHelper.WriteInfo("历史回应数据为空");
  173. }
  174. if (_financeChart != null && data != null)
  175. {
  176. _financeChart.ResponseHistoryPrice(data, data.Length);
  177. }
  178. }
  179. private List<SysMenuItem> _commandTypes;
  180. /// <summary>
  181. /// 底部菜单列表
  182. /// </summary>
  183. public List<SysMenuItem> CommandTypes
  184. {
  185. get { return _commandTypes; }
  186. set { Set(() => CommandTypes, ref _commandTypes, value); }
  187. }
  188. private SysMenuItem _currentIndexMenu;
  189. /// <summary>
  190. /// 当前选择的指标
  191. /// </summary>
  192. public SysMenuItem CurrentIndexMenu
  193. {
  194. get { return _currentIndexMenu; }
  195. set
  196. {
  197. Set(() => CurrentIndexMenu, ref _currentIndexMenu, value);
  198. SetChartIndecator(value);
  199. }
  200. }
  201. /// <summary>
  202. /// 设置图表指标
  203. /// </summary>
  204. /// <param name="menuItem"></param>
  205. private void SetChartIndecator(SysMenuItem menuItem)
  206. {
  207. if (_financeChart != null)
  208. {
  209. string index1 = string.Empty, index2 = string.Empty;
  210. _financeChart.GetFrameMessage2(_controlHandle, (int)UserDefineWindowsMessage.SetAddIndex, ref index1, ref index2);
  211. var hasIndex = string.IsNullOrWhiteSpace(index1);
  212. INDEX_TYPE indextype = INDEX_TYPE.INDEX_TYPE_MA;
  213. switch (menuItem.SysCommandType)
  214. {
  215. case MenuCommandType.MA:
  216. indextype = INDEX_TYPE.INDEX_TYPE_MA;
  217. if (!hasIndex && index1.Contains("MA"))
  218. {
  219. return; ///已存在MA
  220. }
  221. break;
  222. case MenuCommandType.BOLL:
  223. indextype = INDEX_TYPE.INDEX_TYPE_BOLL;
  224. if (!hasIndex && index1.Contains("BOLL"))
  225. {
  226. return; ///已存在BOLL
  227. }
  228. break;
  229. case MenuCommandType.MACD:
  230. indextype = INDEX_TYPE.INDEX_TYPE_MACD;
  231. if (!hasIndex && index1.Contains("MACD"))
  232. {
  233. return; ///已存在
  234. }
  235. break;
  236. case MenuCommandType.KDJ:
  237. indextype = INDEX_TYPE.INDEX_TYPE_KDJ;
  238. if (!hasIndex && index1.Contains("KDJ"))
  239. {
  240. return; ///已存在
  241. }
  242. break;
  243. case MenuCommandType.RSI:
  244. indextype = INDEX_TYPE.INDEX_TYPE_RSI;
  245. if (!hasIndex && index1.Contains("RSI"))
  246. {
  247. return; ///已存在
  248. }
  249. break;
  250. case MenuCommandType.PSY:
  251. indextype = INDEX_TYPE.INDEX_TYPE_PSY;
  252. if (!hasIndex && index1.Contains("PSY"))
  253. {
  254. return; ///已存在
  255. }
  256. break;
  257. case MenuCommandType.DMI:
  258. indextype = INDEX_TYPE.INDEX_TYPE_DMI;
  259. if (!hasIndex && index1.Contains("DMI"))
  260. {
  261. return; ///已存在
  262. }
  263. break;
  264. case MenuCommandType.VOL:
  265. indextype = INDEX_TYPE.INDEX_TYPE_VOLUME;
  266. if (!hasIndex && index1.Contains("VOL"))
  267. {
  268. return; ///已存在
  269. }
  270. break;
  271. default:
  272. break;
  273. }
  274. if (!hasIndex)
  275. {
  276. index1 = index1.Trim(';');
  277. var indexArray= index1.Split(';');
  278. if (indexArray.Any())
  279. {
  280. var indicator = indexArray[indexArray.Length - 1];
  281. var formulaArr = indicator.Split(',');
  282. if (formulaArr.Any())
  283. {
  284. bool isExist = false;
  285. var index= ChartIndecator(formulaArr[0],ref isExist);
  286. if (isExist)
  287. {
  288. _financeChart.PostFrameMessage(_controlHandle,
  289. (int) UserDefineWindowsMessage.SetDeleteIndex,
  290. (int) index, 0);
  291. }
  292. }
  293. }
  294. }
  295. _financeChart.PostFrameMessage(_controlHandle, (int) UserDefineWindowsMessage.SetAddIndex,
  296. (int) indextype, 0);
  297. }
  298. }
  299. private INDEX_TYPE ChartIndecator(string formula,ref bool isExist)
  300. {
  301. isExist = true;
  302. var indextype = INDEX_TYPE.INDEX_TYPE_VOLUME;
  303. switch (formula)
  304. {
  305. case "MA":
  306. indextype = INDEX_TYPE.INDEX_TYPE_MA;
  307. break;
  308. case "BOLL":
  309. indextype = INDEX_TYPE.INDEX_TYPE_BOLL;
  310. break;
  311. case "MACD":
  312. indextype = INDEX_TYPE.INDEX_TYPE_MACD;
  313. break;
  314. case "KDJ":
  315. indextype = INDEX_TYPE.INDEX_TYPE_KDJ;
  316. break;
  317. case "RSI":
  318. indextype = INDEX_TYPE.INDEX_TYPE_RSI;
  319. break;
  320. case "PSY":
  321. indextype = INDEX_TYPE.INDEX_TYPE_PSY;
  322. break;
  323. case "DMI":
  324. indextype = INDEX_TYPE.INDEX_TYPE_DMI;
  325. break;
  326. case "VOL":
  327. indextype = INDEX_TYPE.INDEX_TYPE_VOLUME;
  328. break;
  329. default:
  330. isExist = false;
  331. break;
  332. }
  333. return indextype;
  334. }
  335. private void ErrorSuccess(ErrorEntity errorEntity)
  336. {
  337. LogHelper.WriteError(typeof(CChartViewModel), errorEntity.ReturnCode.ToString());
  338. }
  339. /// <summary>
  340. /// 设置图表的样式
  341. /// </summary>
  342. private void InitSetChartColorStyle()
  343. {
  344. var colorStyle = UserManager.GetCurrentColorStyle();
  345. switch (colorStyle)
  346. {
  347. case ColorStyle.BlueWhite:
  348. FinanceGlobal.SetDefaultColorType((int)KLine_ColorType.KLine_COLOR_LCB_Red_RGB);
  349. break;
  350. case ColorStyle.DarkBlue:
  351. case ColorStyle.CoolBlack:
  352. FinanceGlobal.SetDefaultColorType((int)KLine_ColorType.KLine_COLOR_TDX_Red_Black);
  353. break;
  354. default:
  355. break;
  356. }
  357. }
  358. /// <summary>
  359. /// 图表周期
  360. /// </summary>
  361. public int ChartCycle { get; set; }
  362. /// <summary>
  363. /// 格式化服务器时间
  364. /// </summary>
  365. /// <param name="clienttime">客户端时间</param>
  366. /// <returns></returns>
  367. public string FormatSeverTime(string clienttime)
  368. {
  369. if (!string.IsNullOrEmpty(clienttime))
  370. {
  371. StringBuilder sb = new StringBuilder();
  372. sb.Append(clienttime.Substring(0, 4));
  373. if (clienttime.Length > 5)
  374. {
  375. sb.Append("-");
  376. sb.Append(clienttime.Substring(4, 2));
  377. }
  378. if (clienttime.Length > 7)
  379. {
  380. sb.Append("-");
  381. sb.Append(clienttime.Substring(6, 2));
  382. }
  383. if (clienttime.Length > 9)
  384. {
  385. sb.Append(" ");
  386. sb.Append(clienttime.Substring(8, 2));
  387. }
  388. if (clienttime.Length > 11)
  389. {
  390. sb.Append(":");
  391. sb.Append(clienttime.Substring(10, 2));
  392. }
  393. if (clienttime.Length > 13)
  394. {
  395. sb.Append(":");
  396. sb.Append(clienttime.Substring(12, 2));
  397. }
  398. return sb.ToString();
  399. }
  400. return string.Empty;
  401. }
  402. #region "转换商品类型"
  403. /// <summary>
  404. /// 商品类型转换
  405. /// </summary>
  406. /// <param name="goods"></param>
  407. /// <returns></returns>
  408. private WareAttributeClass ConverWare(QuoteGoods goods)
  409. {
  410. WareAttributeClass war = new WareAttributeClass();
  411. war.Name = goods.Name;
  412. war.Ware = goods.GoodsCode;
  413. war.Type = "0";
  414. war.HqKind = "1";
  415. war.Rate = (double)1;
  416. war.SellPoint = (double)0;
  417. war.PriceDigit = 7;
  418. war.PriceType = "1";
  419. war.HqWare = goods.GoodsCode;
  420. war.Logo = goods.MarketCode;
  421. war.HqDecimal = Math.Pow(10, -goods.DecimalPlaces); //GetWareTailLength(goods.DecimalPlaces.ToString());
  422. war.ShowDecimal = Math.Pow(10, -goods.DecimalPlaces); //GetWareTailLength(goods.DecimalPlaces.ToString());
  423. int exchange = 0;
  424. int.TryParse(goods.ExchHqCode, out exchange);
  425. war.HqExchangeCode = exchange;
  426. war.HqExchange = goods.ExchHqCode;
  427. //if (!string.IsNullOrEmpty(Mark))
  428. // war.TradeHour = Mark;
  429. //if (goods.Config != null)
  430. //{
  431. // //若历史开收盘时段不为空,则图表使用历史开收盘 by yxw 2014-12-01
  432. // if (!goods.Config.IsHistory || string.IsNullOrEmpty(goods.Config.HistoryMark))
  433. // war.TradeHour = goods.Config.Mark;
  434. // else
  435. // {
  436. // war.TradeHour = goods.Config.HistoryMark;
  437. // goods.Config.HistoryMark = string.Empty; //更新完后需释放,不影响下一次判定
  438. // }
  439. //}
  440. #if DEBUG
  441. if (CacheManager.TradeDayPlan.ContainsKey(goods.GoodsParameters.GoodsId))
  442. {
  443. var tradedates = CacheManager.TradeDayPlan[goods.GoodsParameters.GoodsId];
  444. war.TradeDate = tradedates.TradeDay.ToString("yyyyMMdd");
  445. war.TradeHour = ConvertTradeHour(tradedates.OpenCloseDates);
  446. }
  447. #else
  448. if (CacheManager.TradeDayPlan.ContainsKey(goods.GoodsParameters.GoodsId))
  449. {
  450. var tradedates = CacheManager.TradeDayPlan[goods.GoodsParameters.GoodsId];
  451. war.TradeDate = tradedates.TradeDay.ToString("yyyyMMdd");
  452. war.TradeHour = ConvertTradeHour(tradedates.OpenCloseDates);
  453. }
  454. #endif
  455. war.IsHasVolume = goods.TradeMode == eTradeMode.TRADEMODE_MARKETMAKE ? 0 : 1; ////是否是有量商品
  456. war.HighLimit = (double)goods.RaisesPrice;
  457. war.LowLimit = (double)goods.FallsPrice;
  458. //if (IsKLineMinuteTik)
  459. //{
  460. // if (goods.ExchangeCode == Exchange.Sge)
  461. // {
  462. // war.TradeDayCloseOffset = -1;
  463. // }
  464. // war.TradeDate = KLineMinuteDate;
  465. //}
  466. //else
  467. //{
  468. // if (goods.Config != null)
  469. // {
  470. // if (goods.ExchangeCode == Exchange.Sge && goods.Config.TradeDate >= ApplicationParamater.ServerTimeNow.Date)
  471. // {
  472. // war.TradeDayCloseOffset = -1;
  473. // }
  474. // war.TradeDate = goods.Config.TradeDate.ToString(FormatHelper.DateFormat2);
  475. // }
  476. //}
  477. //if (goods.ExchangeCode == Exchange.Sse || goods.ExchangeCode == Exchange.Szse)
  478. //{
  479. // war.HighLimit = (double)goods.Preclose * 1.1;
  480. // war.LowLimit = (double)goods.Preclose * 0.9;
  481. //}
  482. try
  483. {
  484. if (CacheManager.TradeDayPlan.ContainsKey(goods.GoodsParameters.GoodsId))
  485. {
  486. QuoteTradePlan tradedates = CacheManager.TradeDayPlan[goods.GoodsParameters.GoodsId];
  487. if (tradedates.OpenCloseDates.Count > 0)// 太白说一定会有index 0的值
  488. {
  489. OpenCloseDate index0 = tradedates.OpenCloseDates[0];
  490. war.TradeDayCloseOffset = index0.OpenDate.Day - tradedates.TradeDay.Day;// TradeDayCloseOffset -1表示向前偏移,1表示向后偏移。0不偏移
  491. }
  492. }
  493. }
  494. catch (Exception ex)
  495. {
  496. LogHelper.WriteError(typeof(UserManager), "处理TradeDayCloseOffset偏移量问题失败(CChartViewModel.cs 563行左右):" + ex.ToString());
  497. }
  498. return war;
  499. }
  500. /// <summary>
  501. /// 转换开收市时间
  502. /// </summary>
  503. /// <param name="openCloseDates">开收市时间</param>
  504. /// <returns></returns>
  505. private string ConvertTradeHour(List<OpenCloseDate> openCloseDates)
  506. {
  507. if (openCloseDates == null || !openCloseDates.Any())
  508. {
  509. return string.Empty;
  510. }
  511. var dateList = new List<string>();
  512. foreach (var openCloseDate in openCloseDates)
  513. {
  514. dateList.Add(openCloseDate.OpenDate.ToString("HHmm"));
  515. dateList.Add(openCloseDate.CloseDate.ToString("HHmm"));
  516. }
  517. return string.Join(",", dateList);
  518. }
  519. #endregion
  520. /// <summary>
  521. /// 图表添加商品
  522. /// </summary>
  523. /// <param name="goods"></param>
  524. private void AddWare(QuoteGoods goods)
  525. {
  526. var war = ConverWare(goods);
  527. _financeChart.AddWare(war);
  528. _financeChart.SetWareName(war.Ware, war.Name);
  529. // SetWareFlag(war.HqExchange.ToString(), war.Ware.ToString(), false);
  530. CreateChartView(goods);
  531. }
  532. /// <summary>
  533. /// 更新商品
  534. /// </summary>
  535. /// <param name="goods"></param>
  536. public void UpdateWare(QuoteGoods goods)
  537. {
  538. _currentGoods = goods;
  539. // var ware = ConverWare(goods);
  540. // _financeChart.AddWare(ware);
  541. // _financeChart.SetWareName(ware.Ware, ware.Name);
  542. QueryGoodsReckonPlan(goods);
  543. PriceViewModel.UpdateGoods(goods);
  544. // CreateChartView(goods, true);
  545. }
  546. /// <summary>
  547. /// 切换商品
  548. /// </summary>
  549. /// <param name="isNext"> true:切换下一个商品,false:切换上一个商品</param>
  550. public void ChangeGoodsNextFront(bool isNext)
  551. {
  552. var goodsList = new List<QuoteGoods>();
  553. var currentLayout = UserManager.GetCurrentLayoutStyle();
  554. if (currentLayout == LayoutStyle.PersonalCenter)
  555. {
  556. goodsList =
  557. CacheManager.CacheGoodsBaseInfos.Where((item) => item.TradeMode == eTradeMode.TRADEMODE_BIDDING)
  558. .ToList();
  559. }
  560. else
  561. {
  562. goodsList =
  563. CacheManager.CacheGoodsBaseInfos.Where((item) => item.TradeMode != eTradeMode.TRADEMODE_SALE)
  564. .ToList();
  565. }
  566. if (goodsList.Any())
  567. {
  568. QuoteGoods nextGoods;
  569. var index = goodsList.FindIndex((goods) => goods.Symbol == _currentGoods.Symbol);
  570. if (isNext)
  571. {
  572. nextGoods = (index == -1 || index == goodsList.Count - 1) ? goodsList[0] : goodsList[index + 1];
  573. }
  574. else
  575. {
  576. nextGoods = (index == -1 || index == 0) ? goodsList[goodsList.Count - 1] : goodsList[index - 1];
  577. }
  578. if (nextGoods != null)
  579. {
  580. UpdateWare(nextGoods);
  581. var dto = new QuoteGoodsDTO(nextGoods);
  582. MessengerHelper.DefaultSend<QuoteGoodsDTO>(dto, MessengerTokens.SelectGoodsChange);
  583. }
  584. }
  585. }
  586. /// <summary>
  587. /// 选中某个单据触发的图表显示问题
  588. /// </summary>
  589. /// <param name="quoteGoods"></param>
  590. public void SelectGoodsOrder(QuoteGoodsForSelectOrder quoteGoods)
  591. {
  592. if (quoteGoods != null && _currentGoods.GoodsId != quoteGoods.QuoteGoods.GoodsId)// 如果是相同的商品,就不要再做任何事情了
  593. {
  594. UpdateWare(quoteGoods.QuoteGoods);
  595. var dto = new QuoteGoodsDTO(quoteGoods.QuoteGoods);
  596. MessengerHelper.DefaultSend<QuoteGoodsDTO>(dto, MessengerTokens.SelectGoodsChange);
  597. }
  598. }
  599. private void Chart_OnMenuMessage(int lMessageType, int lSubMessageType, int lExchangeCode, string strWare,
  600. string strParam)
  601. {
  602. switch ((UserDefineWindowsMessage) lMessageType)
  603. {
  604. #region 暂时不使用
  605. case UserDefineWindowsMessage.None:
  606. break;
  607. case UserDefineWindowsMessage.Start:
  608. break;
  609. case UserDefineWindowsMessage.ChangeStyleCycle:
  610. break;
  611. case UserDefineWindowsMessage.DrawLine:
  612. break;
  613. case UserDefineWindowsMessage.ChangeViewCycle:
  614. break;
  615. case UserDefineWindowsMessage.ChangeViewFQ:
  616. break;
  617. case UserDefineWindowsMessage.Set_ShowRect:
  618. break;
  619. case UserDefineWindowsMessage.SetEnableDraw:
  620. break;
  621. case UserDefineWindowsMessage.SetDeleteIndex:
  622. break;
  623. case UserDefineWindowsMessage.SetAddIndex:
  624. break;
  625. case UserDefineWindowsMessage.SetRemoveAllIndex:
  626. break;
  627. case UserDefineWindowsMessage.GetCurIndexCount:
  628. break;
  629. case UserDefineWindowsMessage.SetMouseEvent:
  630. break;
  631. case UserDefineWindowsMessage.SetTradeDate:
  632. break;
  633. case UserDefineWindowsMessage.SetPreclose:
  634. break;
  635. case UserDefineWindowsMessage.SetMouseButtonRightUp:
  636. break;
  637. case UserDefineWindowsMessage.SetAddWare:
  638. break;
  639. case UserDefineWindowsMessage.SetSacle:
  640. break;
  641. case UserDefineWindowsMessage.DelAppendWare:
  642. break;
  643. case UserDefineWindowsMessage.SetVolumeUnit:
  644. break;
  645. case UserDefineWindowsMessage.SetOpenPrice:
  646. break;
  647. case UserDefineWindowsMessage.SetAppendWareClosePrice:
  648. break;
  649. case UserDefineWindowsMessage.FormulaInfo:
  650. break;
  651. case UserDefineWindowsMessage.ShowFormula:
  652. break;
  653. case UserDefineWindowsMessage.TRADEHOURDELAY:
  654. break;
  655. case UserDefineWindowsMessage.OPENPRICETIME:
  656. break;
  657. case UserDefineWindowsMessage.SHOWMATIK:
  658. break;
  659. case UserDefineWindowsMessage.TIKVOLUMEUNIT:
  660. break;
  661. case UserDefineWindowsMessage.MeanType:
  662. break;
  663. case UserDefineWindowsMessage.ViewPY:
  664. break;
  665. case UserDefineWindowsMessage.DrawIsdisplay:
  666. break;
  667. case UserDefineWindowsMessage.SetAutoScroll:
  668. break;
  669. case UserDefineWindowsMessage.ClearInvestLog:
  670. break;
  671. case UserDefineWindowsMessage.SetAxisShow:
  672. break;
  673. case UserDefineWindowsMessage.ClearInvestLogByViewHandler:
  674. break;
  675. case UserDefineWindowsMessage.ChartDispose:
  676. break;
  677. case UserDefineWindowsMessage.CloseStatFrom:
  678. break;
  679. case UserDefineWindowsMessage.CreateTime:
  680. break;
  681. case UserDefineWindowsMessage.ClearCache:
  682. break;
  683. case UserDefineWindowsMessage.OpenOrder:
  684. break;
  685. case UserDefineWindowsMessage.OpenMine:
  686. break;
  687. case UserDefineWindowsMessage.OpenDrawTool:
  688. break;
  689. case UserDefineWindowsMessage.AddToCustomBoard:
  690. break;
  691. case UserDefineWindowsMessage.OpenChartHide:
  692. break;
  693. case UserDefineWindowsMessage.OpenMouseOut:
  694. break;
  695. case UserDefineWindowsMessage.OpenMouseIn:
  696. break;
  697. case UserDefineWindowsMessage.OpenCycle:
  698. ChartCycle = lSubMessageType;
  699. SetIndecatorEnable(0);
  700. break;
  701. case UserDefineWindowsMessage.OpenReceiveHistory:
  702. break;
  703. case UserDefineWindowsMessage.OpenRequestMine:
  704. break;
  705. case UserDefineWindowsMessage.OpenKLineNode:
  706. break;
  707. case UserDefineWindowsMessage.DeleteFromCustomBoard:
  708. break;
  709. case UserDefineWindowsMessage.OpenAlarmCondition:
  710. break;
  711. case UserDefineWindowsMessage.OpenMouseEvent:
  712. break;
  713. case UserDefineWindowsMessage.OpenClickExportData:
  714. break;
  715. case UserDefineWindowsMessage.UNKNOWN_WARE_INFO:
  716. break;
  717. #endregion
  718. case UserDefineWindowsMessage.View_ZOOM_IN:
  719. IsPriceBoard = false;
  720. break;
  721. case UserDefineWindowsMessage.View_ZOOM_OUT:
  722. var currentLayout = UserManager.GetCurrentLayoutStyle();
  723. if (currentLayout != LayoutStyle.PersonalCenter)
  724. {
  725. IsPriceBoard = true;
  726. }
  727. break;
  728. default:
  729. break;
  730. }
  731. }
  732. private bool _isPriceBoard = true;
  733. /// <summary>
  734. /// 是否显示报价牌
  735. /// </summary>
  736. public bool IsPriceBoard
  737. {
  738. get { return _isPriceBoard; }
  739. set { Set(() => IsPriceBoard, ref _isPriceBoard, value); }
  740. }
  741. private bool isUpdate = false;
  742. #region "创建图表"
  743. /// <summary>
  744. /// 创建图表
  745. /// </summary>
  746. /// <param name="quoteChart">控件对象</param>
  747. internal void CreateChartView(QuoteGoods goods )
  748. {
  749. int exchange = 0;
  750. int.TryParse(goods.ExchHqCode, out exchange);
  751. if (!isUpdate)
  752. {
  753. ////图表 参数2是分时图
  754. //_financeChart.CreateChartView2(_controlHandle, goods.GoodsCode, (int)_chartCycleType, exchange);
  755. // 要使用的OutGoodsCode查历史数据(暂时大写处理)
  756. _financeChart.CreateChartView2(_controlHandle, goods.GoodsCode.ToUpper(), (int)_chartCycleType, exchange);
  757. isUpdate = true;
  758. RegisterMessage();
  759. _financeChart.PostFrameMessage(_controlHandle, (int)UserDefineWindowsMessage.SetSacle,
  760. 60, 0); ////设置分时图刻度
  761. }
  762. else
  763. {
  764. _financeChart.UpdateWareOfView2(_controlHandle, goods.GoodsCode, exchange);
  765. }
  766. if (CacheManager.TradeDayPlan.ContainsKey(goods.GoodsParameters.GoodsId))
  767. {
  768. var tradedates = CacheManager.TradeDayPlan[goods.GoodsParameters.GoodsId];
  769. _financeChart.PostFrameMessage2(_controlHandle, (int) UserDefineWindowsMessage.SetTradeDate,
  770. tradedates.TradeDay.ToString("yyyyMMdd"), string.Empty); ////设置交易日
  771. }
  772. _financeChart.PostFrameMessage2(_controlHandle, (int)UserDefineWindowsMessage.SetPreclose,
  773. goods.LastCloseDisplay, string.Empty); ////设置交易日
  774. var lastCalc = goods.TradeMode == eTradeMode.TRADEMODE_BIDDING ? MA_TIK_CALC_MODE.MA_TIK_CALC_MODE_TURNOVER_VOLUME : MA_TIK_CALC_MODE.MA_TIK_CALC_MODE_PRECLOSE; ////是否是有量商品
  775. // var lastCalc = 2; ////因图表按卖一价来累K线,第一按无量商品计算均线,
  776. _financeChart.PostFrameMessage(_controlHandle, (int)UserDefineWindowsMessage.MeanType,
  777. (int)lastCalc, 0); ///设置均线计算方式
  778. _financeChart.PostFrameMessage2(_controlHandle, (int)UserDefineWindowsMessage.TIKVOLUMEUNIT,
  779. goods.GoodsParameters.AgreeUnit+string.Empty, string.Empty);
  780. // FinanceChart.FilePath
  781. //FinanceChart.CreateChartView3(quoteChart.ViewHanlde, quoteChart.Goods.GoodsCode.ToString(), (int)quoteChart.CycleType, exchange, 0);
  782. // FinanceChart.
  783. //鼠标中轴滚动
  784. //FinanceChart.PostFrameMessage(quoteChart.ViewHanlde, (int)FUN_SET_MOUSE_EVENT, WM_MOUSEWHEEL, 0);
  785. ////右键事件放开
  786. //FinanceChart.PostFrameMessage(quoteChart.ViewHanlde, (int)FUN_SET_MOUSE_EVENT, WM_RBUTTONUP, 0);
  787. //InitDataBaseInfrom(quoteChart);
  788. }
  789. #endregion
  790. private void RegisterMessage()
  791. {
  792. MessengerHelper.QuoteUnregister<List<QuoteGoods>>(this, MessengerTokens.ReceiveRealTikQuote);
  793. MessengerHelper.QuoteRegister<List<QuoteGoods>>(this, MessengerTokens.ReceiveRealTikQuote, (quoteList) =>
  794. {
  795. if (quoteList == null || !quoteList.Any()) return;
  796. foreach (var item in quoteList)
  797. {
  798. if (item == null) continue;
  799. QuoteTradePlan qp = CacheManager.TradeDayPlan[_currentGoods.GoodsId];
  800. if (qp != null)
  801. {
  802. if (item.TradeDate != null)
  803. {
  804. if (!qp.TradeDay.ToString("yyyyMMdd").Equals(item.TradeDate)) // 如果交易日不一样,就重新设置一下交易日
  805. {
  806. AddWare(_currentGoods);
  807. _financeChart.PostFrameMessage2(_controlHandle, (int)UserDefineWindowsMessage.SetTradeDate,
  808. item.TradeDate, string.Empty); ////设置交易日
  809. }
  810. }
  811. }
  812. if (_currentGoods.Symbol.ToLower() == item.Symbol.ToLower() && item.CurrentPrice != 0)
  813. {
  814. //交易所代码
  815. string exchangeCode = _currentGoods.ExchHqCode;
  816. //int divid = 1;
  817. //if (exchangeCode == Exchange.Sge)
  818. //{
  819. // divid = goods.LotSize;
  820. // if (goods.PriceUnit == "千克")
  821. // {
  822. // divid = divid * 1000 ;
  823. // }
  824. //}
  825. //商品代码
  826. string goodCode = _currentGoods.GoodsCode;
  827. //if (goods.HasVolume)
  828. //{
  829. // if (goods.Volume <= 0)
  830. // return;
  831. //}
  832. double iVolume = item.CurrentVolume; // *divid;
  833. //商品买入价
  834. double dbBid = (double)item.BidPrice;
  835. //商品卖价
  836. double dbAsk = (double)item.AskPrice;
  837. //行情最高价
  838. double dbHiPr = (double)item.High;
  839. //行情最高价
  840. double dbLowPr = (double)item.Low;
  841. //现价
  842. double dbPr = (double)item.CurrentPrice;
  843. //昨收
  844. double dbPrLast = (double)_currentGoods.LastClose;
  845. //今开
  846. double dbOpen = (double)item.Open;
  847. ////总额
  848. //double dbTrd = (double)goods.TotalTurnover;
  849. //现量
  850. //double dbVolume = (double)goods.Volume * divid;
  851. //现额
  852. double dbNowSum = (double)item.TradeTurnover;
  853. //持仓量
  854. double dbHolVolm = 0; // (double)item.Positions; --图表有成交量时,不支持持仓量
  855. //买量
  856. double dbBidVolume = (double)item.BidVolume; // *divid;
  857. //卖量
  858. double dbAskVolume = (double)item.AskVolume; // *divid;
  859. //当前时间
  860. string time = item.Date.ToString("yyyyMMddHHmmss");
  861. _financeChart.UpdateTickPrice3(goodCode, dbBid, dbAsk, dbHiPr, dbLowPr, dbPr, dbPrLast, dbOpen,
  862. iVolume, dbHolVolm, dbBidVolume, dbAskVolume, time, int.Parse(exchangeCode), dbNowSum);
  863. }
  864. }
  865. });
  866. MessengerHelper.DefaultRegister<string>(this, MessengerTokens.RegisterResourceChange, (e) =>
  867. {
  868. InitSetChartColorStyle();
  869. // RegisterResourceChange(e);
  870. });
  871. ////市场开市信号(清盘信号)
  872. MessengerHelper.DefaultRegister<string>(this, MessengerTokens.Market_OpenToken, (e) =>
  873. {
  874. MarketOpenChangeSettle();
  875. });
  876. }
  877. /// <summary>
  878. /// 注册消息
  879. /// </summary>
  880. private void RegiterMsg()
  881. {
  882. MessengerHelper.DefaultRegister<bool>(this, MessengerTokens.ChartGoodsChange, ChangeGoodsNextFront);
  883. MessengerHelper.DefaultRegister<QuoteGoodsForSelectOrder>(this, MessengerTokens.SelectGoodsOrderChange, SelectGoodsOrder);
  884. }
  885. private void MarketOpenChangeSettle()
  886. {
  887. CacheManager.TradeDayPlan.Clear();
  888. if (_currentGoods != null)
  889. {
  890. ChartInitTradePlan();
  891. }
  892. }
  893. /// <summary>
  894. ///
  895. /// </summary>
  896. /// <param name="tradeDays"></param>
  897. protected override void QueryReckenSuccess(List<QuoteTradePlan> tradeDays)
  898. {
  899. base.QueryReckenSuccess(tradeDays);
  900. AddWare(_currentGoods); ////添加商品
  901. //tradeDays = tradeDays.OrderBy((item) => item.OpenWeekDay).ToList();
  902. var goodsPlan = tradeDays.FirstOrDefault((item) => item.GoodsId == _currentGoods.GoodsId);
  903. if (goodsPlan == null)
  904. {
  905. goodsPlan = tradeDays.FirstOrDefault((item) => item.GoodsId == 0);
  906. }
  907. if (PriceViewModel != null)
  908. {
  909. PriceViewModel.TaskInitQuotePriceView(goodsPlan, _currentGoods);
  910. }
  911. }
  912. protected override void QueryTradeTimeSuccess(List<QuoteTradeTime> quoteTimes)
  913. {
  914. base.QueryTradeTimeSuccess(quoteTimes);
  915. AddWare(_currentGoods); ////添加商品
  916. //tradeDays = tradeDays.OrderBy((item) => item.OpenWeekDay).ToList();
  917. var tradeDays = SetDefautTradePlan();
  918. if (CacheManager.TradeDayPlan.ContainsKey(_currentGoods.GoodsParameters.GoodsId))
  919. {
  920. tradeDays = CacheManager.TradeDayPlan[_currentGoods.GoodsParameters.GoodsId];
  921. }
  922. if (PriceViewModel != null)
  923. {
  924. PriceViewModel.TaskInitQuotePriceView(tradeDays, _currentGoods);
  925. }
  926. }
  927. /// <summary>
  928. /// 查询结算时间失败
  929. /// </summary>
  930. /// <param name="errorEntity"></param>
  931. protected override void QueryReckenError(ErrorEntity errorEntity)
  932. {
  933. //todo:查询结算时间失败计算
  934. var tradeDays = SetDefautTradePlan();
  935. AddWare(_currentGoods); ////添加商品
  936. if (PriceViewModel != null)
  937. {
  938. PriceViewModel.TaskInitQuotePriceView(tradeDays, _currentGoods);
  939. }
  940. LogHelper.WriteError(typeof(CChartViewModel), string.Format(ErrorManager.FormatErrorMsg(errorEntity)));
  941. }
  942. /// <summary>
  943. /// 查询结算时间失败使用默认时间(使用8-22)
  944. /// </summary>
  945. private QuoteTradePlan SetDefautTradePlan()
  946. {
  947. //查询结算时间失败使用默认时间(使用8-22)
  948. var goodsOpenCloses = new QuoteTradePlan();
  949. goodsOpenCloses.ExchangeCode = this._currentGoods.ExchHqCode;
  950. var openClose = new OpenCloseDate()
  951. {
  952. CloseDate = ApplicationParameter.ServerTimeNow.Date.AddHours(22),
  953. OpenDate = ApplicationParameter.ServerTimeNow.Date.AddHours(8)
  954. };
  955. goodsOpenCloses.OpenCloseDates = new List<OpenCloseDate>() { openClose };
  956. return goodsOpenCloses;
  957. }
  958. private void QueryGoodsReckonPlan(QuoteGoods goods)
  959. {
  960. /*if (CacheManager.TradeDayPlan.ContainsKey(goods.GoodsParameters.GoodsId))
  961. {
  962. AddWare(goods); ////添加商品
  963. // SetChartControlCycle(_goodsOpenCloses);
  964. if (PriceViewModel != null)
  965. {
  966. PriceViewModel.TaskInitQuotePriceView(CacheManager.TradeDayPlan[goods.GoodsParameters.GoodsId], goods);
  967. }
  968. }
  969. else
  970. {*/
  971. ChartInitTradePlan();
  972. /*}*/
  973. }
  974. public void Dispose()
  975. {
  976. if (_financeChart != null)
  977. {
  978. _financeChart.Destory();
  979. }
  980. MessengerHelper.DefaultUnregister<List<QuoteGoods>>(this, MessengerTokens.ReceiveRealTikQuote);
  981. MessengerHelper.DefaultUnregister<bool>(this, MessengerTokens.ChartGoodsChange);
  982. this.Cleanup();
  983. }
  984. private QuotePriceViewModel _priceViewModel;
  985. /// <summary>
  986. /// 报价牌视图模型
  987. /// </summary>
  988. public QuotePriceViewModel PriceViewModel
  989. {
  990. get { return _priceViewModel; }
  991. set { Set(() => PriceViewModel, ref _priceViewModel, value); }
  992. }
  993. private ICommand _enterCommand;
  994. public RelayCommand<int> EnterCommand
  995. {
  996. get
  997. {
  998. return new RelayCommand<int>((keyV) =>
  999. {
  1000. ////分时图与日线切换
  1001. if (_financeChart != null)
  1002. {
  1003. var pressKey = (Key)keyV;
  1004. // Console.WriteLine("回车:" + _cycleType);
  1005. //_chartCycleType = _chartCycleType == ChartCycleType.MinuteTik ? ChartCycleType.Day : ChartCycleType.MinuteTik;
  1006. //_financeChart.PostFrameMessage(_controlHandle, (int)UserDefineWindowsMessage.ChangeViewCycle, (int)_chartCycleType, 0);
  1007. switch (pressKey)
  1008. {
  1009. case Key.Enter:
  1010. case Key.F5:
  1011. _chartCycleType = _chartCycleType == ChartCycleType.MinuteTik
  1012. ? ChartCycleType.Day
  1013. : ChartCycleType.MinuteTik;
  1014. _financeChart.PostFrameMessage(_controlHandle, (int)UserDefineWindowsMessage.ChangeViewCycle, (int)_chartCycleType, 0);
  1015. break;
  1016. case Key.PageDown:
  1017. ChangeGoodsNextFront(true);
  1018. break;
  1019. case Key.PageUp:
  1020. ChangeGoodsNextFront(false);
  1021. break;
  1022. }
  1023. }
  1024. }, SetIndecatorEnable);
  1025. }
  1026. }
  1027. /// <summary>
  1028. /// 指标是否可用
  1029. /// </summary>
  1030. public bool IsIndecatorEnable
  1031. {
  1032. get
  1033. {
  1034. return ChartCycle != (int)ChartCycleType.MinuteTik;
  1035. }
  1036. }
  1037. public bool SetIndecatorEnable(int paramter)
  1038. {
  1039. RaisePropertyChanged(() => IsIndecatorEnable);
  1040. return true;
  1041. }
  1042. //public ICommand EnterCommand
  1043. //{
  1044. // get
  1045. // {
  1046. // return new RelayCommand(() =>
  1047. // {
  1048. // ////分时图与日线切换
  1049. // if (_financeChart != null)
  1050. // {
  1051. // // Console.WriteLine("回车:" + _cycleType);
  1052. // _chartCycleType = _chartCycleType == ChartCycleType.MinuteTik ? ChartCycleType.Day : ChartCycleType.MinuteTik;
  1053. // _financeChart.PostFrameMessage(_controlHandle, (int)UserDefineWindowsMessage.ChangeViewCycle, (int)_chartCycleType, 0);
  1054. // }
  1055. // });
  1056. // }
  1057. //}
  1058. //public ICommand PageDownCommand
  1059. //{
  1060. // get
  1061. // {
  1062. // return new RelayCommand(() =>
  1063. // {
  1064. // ChangeGoodsNextFront(true);
  1065. // });
  1066. // }
  1067. //}
  1068. //public ICommand PageUpCommand
  1069. //{
  1070. // get
  1071. // {
  1072. // return new RelayCommand(() =>
  1073. // {
  1074. // ChangeGoodsNextFront(false);
  1075. // });
  1076. // }
  1077. //}
  1078. }
  1079. }