BaseDbCls.cs 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using Core.StlMes.Client.LgCommon;
  6. using System.IO;
  7. using Core.StlMes.Client.LgResMgt.Mcms.entity;
  8. using System.Reflection;
  9. namespace Core.StlMes.Client.LgResMgt.Mcms
  10. {
  11. /// <summary>
  12. /// 基础数据获取
  13. /// </summary>
  14. public class BaseDbCls
  15. {
  16. Log lg = Log.GetInstance();
  17. public bool getBaseDb()
  18. {
  19. #region 读取音频文件名称
  20. List<string> ls = new List<string>();
  21. DirectoryInfo folder = new DirectoryInfo(PbCache.path + "\\Sound");
  22. foreach (FileInfo file in folder.GetFiles("*.wav"))
  23. {
  24. ls.Add(file.Name.Replace(".wav", ""));
  25. }
  26. PbCache.voiceInfo = ls;
  27. #endregion
  28. return true;
  29. }
  30. /// <summary>
  31. /// 将基础数据全部载入缓存中
  32. /// </summary>
  33. /// <returns></returns>
  34. public bool setBaseDb()
  35. {
  36. #region 初始化一次缓存类
  37. PbCache.Load();
  38. #endregion
  39. #region 历史皮重计算配置表
  40. #endregion
  41. #region 期限皮重计算配置表
  42. //MeterBaseTermTareCountService termTareCountService = new MeterBaseTermTareCountService();
  43. //RESTfulResult<List<MeterBaseTermTareCount>> rmTe = termTareCountService.doQueryWf(new MeterBaseTermTareCount { valueFlag = "0", typeNo = "001033001" }); //0有效 1无效 //db.doOption<List<MeterBaseHisTareCount>>("MeterBaseHisTareCountService", "doQueryWf", new object[] { mbhtc }, 0);
  44. //if (rmTe.Succeed && rmTe.Data != null && rmTe.Data.Count > 0)
  45. //{
  46. // PbCache.termTareCount = rmTe.Data[0];
  47. //}
  48. //else
  49. //{
  50. // lg.WriteLog(1, "未找到期限皮重配置信息MeterBaseHisTareCount");
  51. // return false;
  52. //}
  53. #endregion
  54. #region 危化品限载配置
  55. /*
  56. MeterBaseLimitChemicalService limitService = new MeterBaseLimitChemicalService();
  57. RESTfulResult<List<MeterBaseLimitChemical>> rmL = limitService.doQueryWf(new MeterBaseLimitChemical { valueFlag = "1" });
  58. if (rmL.Succeed)
  59. {
  60. PbCache.limit = rmL.Data;
  61. }
  62. else
  63. {
  64. lg.WriteLog(5, "未找到危化品限载配置信息MeterBaseLimitChemical");
  65. return false;
  66. }
  67. //*/
  68. #endregion
  69. #region 两次计量时间间隔配置
  70. /*
  71. MeterBaseTimeSpaceService spaceService = new MeterBaseTimeSpaceService();
  72. RESTfulResult<List<MeterBaseTimeSpace>> rmS = spaceService.doQueryWf(new MeterBaseTimeSpace { spotTypeNo = "001002001" });//汽车衡
  73. if (rmS.Succeed)
  74. {
  75. PbCache.timeSpace = rmS.Data;
  76. }
  77. else
  78. {
  79. lg.WriteLog(5, "未找到两次计量时间间隔配置信息MeterBaseTimeSpace");
  80. return false;
  81. }
  82. //*/
  83. #endregion
  84. #region 所有计量点数据
  85. PbCache.sportInfos = new List<CmmBaseSpotInfoEntity>();
  86. #endregion
  87. #region 计量卸货时间
  88. #endregion
  89. #region 校秤计量关联,用于获取是否限制
  90. /*
  91. string sql = @"select base_spot_no baseSpotNo,
  92. base_spot_name baseSpotName,
  93. up_weight upWeight,
  94. is_meter isMeter
  95. from METER_BASE_CALIBRA_NUM_REL
  96. group by base_spot_no, base_spot_name, UP_WEIGHT, is_meter";
  97. PbModelDbService<List<MeterBaseCalibraNumRel>> pbNumRel = new PbModelDbService<List<MeterBaseCalibraNumRel>>();
  98. RESTfulResult<List<MeterBaseCalibraNumRel>> rmNumRel = pbNumRel.executeSqlDataWf(sql);
  99. if (rmNumRel.Succeed && rmNumRel.Data != null && rmNumRel.Data.Count > 0)
  100. {
  101. PbCache.ltBaseCalibraNumRel = rmNumRel.Data;
  102. }
  103. else
  104. {
  105. lg.WriteLog(1, "未找到秤点关联表METER_BASE_CALIBRA_NUM_REL信息");
  106. return false;
  107. }
  108. //*/
  109. #endregion
  110. return true;
  111. }
  112. public bool getSpot()
  113. {
  114. //#region 获取摄像头数据用于截图
  115. //if (PbCache.ltVideoInfo != null && PbCache.ltVideoInfo.Count > 0)
  116. //{
  117. // PbCache.videoInfo = PbCache.ltVideoInfo.Where(s => s.pointid == PbCache.sportInfo.BaseSpotNo).FirstOrDefault();
  118. // List<MeterBaseVideoChild> videoChild = new List<MeterBaseVideoChild>();
  119. // Type postType = PbCache.videoInfo.GetType();
  120. // PropertyInfo[] postTypeInfos = postType.GetProperties(); //返回为当前 Type 的所有公共属性,PropertyInfo[] PropertyInfo 的所有公共属性的 Type 对象数组
  121. // foreach (PropertyInfo p in postTypeInfos)
  122. // {
  123. // if (p.Name.Contains("position"))
  124. // {
  125. // string str = (string)p.GetValue(PbCache.videoInfo, null);
  126. // if (str != "" && str != null)
  127. // {
  128. // videoChild.Add(
  129. // new MeterBaseVideoChild
  130. // {
  131. // pointid = PbCache.videoInfo.pointid,
  132. // p_ip = str,
  133. // p_rate = "0",//************解码率直接给定了,这里没取配置值*************
  134. // vdo_port = PbCache.videoInfo.vdoPort,
  135. // vdo_pwd = PbCache.videoInfo.vdoPwd,
  136. // vdo_user = PbCache.videoInfo.vdoUser
  137. // }
  138. // );
  139. // }
  140. // }
  141. // }
  142. // PbCache.videoChild = videoChild;
  143. // if (videoChild.Count == 0)
  144. // {
  145. // return false;
  146. // }
  147. // else
  148. // {
  149. // //将摄像头操作类存储再缓存中
  150. // List<DhCameraShot> list = new List<DhCameraShot>();
  151. // foreach (MeterBaseVideoChild child in PbCache.videoChild)
  152. // {
  153. // DhCameraShot cameraShot = new DhCameraShot();
  154. // cameraShot.ip = child.p_ip;
  155. // cameraShot.port = child.vdo_port;
  156. // cameraShot.uid = child.vdo_user;
  157. // cameraShot.pwd = child.vdo_pwd;
  158. // list.Add(cameraShot);
  159. // }
  160. // CarCache.cameraShots = list;
  161. // }
  162. //}
  163. //#endregion
  164. return true;
  165. }
  166. }
  167. }