GlobalVar.cs 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  1. using LJLib.LocalLog;
  2. using LJLib.Net.SPI.Server;
  3. using LJLib.Tools.DEncrypt;
  4. using LJLib.Tools.File;
  5. using System;
  6. using System.Data.SqlClient;
  7. using System.Diagnostics;
  8. using System.IO;
  9. using System.Reflection;
  10. using System.Threading;
  11. using JLHHJSvr.BLL;
  12. using JLHHJSvr.Com;
  13. using JLHHJSvr.Com.APP;
  14. using JLHHJSvr.DBA;
  15. using JLHHJSvr.Excutor;
  16. using JLHHJSvr.Excutor.APP;
  17. using JLHHJSvr.LJLib.HttpServer;
  18. using LJLib;
  19. using LJLib.TextLog;
  20. namespace JLHHJSvr
  21. {
  22. public static class GlobalVar
  23. {
  24. private static ExcutorManager excutorManager = null;
  25. private static Timer _timer = null;
  26. private static object _syncRoot = new object();
  27. private static bool _initing = false;
  28. /// <summary>
  29. /// L1业务后台-HTTP端口(HTTP协议)
  30. /// </summary>
  31. public static string ERP_API_URL { get; set; }
  32. /// <summary>
  33. /// L1业务后台-登录账套名
  34. /// </summary>
  35. public static string ERP_ACCOUNT_NAME { get; set; }
  36. /// <summary>
  37. /// L1业务后台-登录账号
  38. /// </summary>
  39. public static string ERP_ACCOUNT_USERNAME { get; set; }
  40. /// <summary>
  41. /// L1业务后台-登录密码
  42. /// </summary>
  43. public static string ERP_ACCOUNT_PASSWORD { get; set; }
  44. /// <summary>
  45. /// L1业务后台-Token
  46. /// </summary>
  47. public static string ERP_TOKEN { get; set; }
  48. public static ILJServer server
  49. {
  50. get
  51. {
  52. return excutorManager;
  53. }
  54. }
  55. internal static void Init()
  56. {
  57. Trace.Listeners.Clear();
  58. Trace.Listeners.Add(new LocalTraceListener(new SyncLogger(new Logger(App_Data)),new RequestLogger()));
  59. try
  60. {
  61. _timer = new Timer((state) =>
  62. {
  63. lock (_syncRoot)
  64. {
  65. if (_initing)
  66. {
  67. return;
  68. }
  69. _initing = true;
  70. }
  71. try
  72. {
  73. if (_timer == null)
  74. {
  75. return;
  76. }
  77. // 获取数据库连接
  78. string xmlfile = GlobalVar.XmlFile;
  79. XmlConfig xmlconfig = new XmlConfig();
  80. string connectionString = xmlconfig.GetXmlFileValue(xmlfile, string.Empty, "ConnectionString", string.Empty);
  81. string L1Password = xmlconfig.GetXmlFileValue(xmlfile, string.Empty, "L1Password", "");
  82. GlobalVar.ERP_ACCOUNT_NAME = xmlconfig.GetXmlFileValue(xmlfile, string.Empty, "L1Server", "");
  83. GlobalVar.ERP_API_URL = xmlconfig.GetXmlFileValue(xmlfile, string.Empty, "L1API", "");
  84. GlobalVar.ERP_ACCOUNT_USERNAME = xmlconfig.GetXmlFileValue(xmlfile, string.Empty, "L1Usercode", "");
  85. GlobalVar.ERP_ACCOUNT_PASSWORD = DESEncrypt.Decrypt(L1Password, "4A61A8B51C3E42BCAE991F6C913A6A33");//DONE: 解密
  86. if (string.IsNullOrEmpty(connectionString))
  87. {
  88. Trace.Write("未设置数据库连接");
  89. }
  90. else
  91. {
  92. try
  93. {
  94. connectionString = DESEncrypt.Decrypt(connectionString, "4A61A8B51C3E42BCAE991F6C913A6A33");//DONE: 解密
  95. GlobalVar.ConnectionString = connectionString;
  96. // DONE: 更新数据库
  97. var version = new ParkDbVersion();
  98. version.CreateTables(GlobalVar.ConnectionString);
  99. BllHelper.InitUser(GlobalVar.ConnectionString);
  100. _timer.Dispose();
  101. _timer = null;
  102. }
  103. catch (Exception ex)
  104. {
  105. Trace.Write(ex.ToString());
  106. GlobalVar.ConnectionString = string.Empty;
  107. }
  108. }
  109. }
  110. catch (Exception ex)
  111. {
  112. Trace.Write(ex.ToString());
  113. }
  114. finally
  115. {
  116. _initing = false;
  117. }
  118. }, null, 0, 10000);
  119. // HTTP服务
  120. excutorManager = new ExcutorManager();
  121. // excutorManager.AddMap("HelloWord", typeof(HelloWordRequest), new HelloWordExcutor());
  122. excutorManager.AddMap("Login", typeof(LoginRequest), new LoginExcutor());//登陆
  123. excutorManager.AddMap("ChangePassword", typeof(ChangePasswordRequest), new ChangePasswordExcutor());
  124. excutorManager.AddMap("GetSysUserFileString", typeof(GetSysUserFileStringRequest), new GetSysUserFileStringExcutor());
  125. excutorManager.AddMap("SetSysUserFileString", typeof(SetSysUserFileStringRequest), new SetSysUserFileStringExcutor());
  126. excutorManager.AddMap("CommonDynamicSelect", typeof(CommonDynamicSelectRequest), new CommonDynamicSelectExcutor());
  127. excutorManager.AddMap("PingToken", typeof(PingTokenRequest), new PingTokenExcutor());//没啥用
  128. excutorManager.AddMap("GetFileByMd5", typeof(GetFileByMd5Request), new GetFileByMd5Excutor());//根据md5获取文件
  129. excutorManager.AddMap("PostFile", typeof(PostFileRequest), new PostFileExcutor());//上传文件
  130. excutorManager.AddMap("GetUserList", typeof(GetUserListRequest), new GetUserListExcutor());//获取用户列表
  131. excutorManager.AddMap("SaveUserList", typeof(SaveUserListRequest), new SaveUserListExcutor());//保存用户列表
  132. excutorManager.AddMap("DelUserList", typeof(DelUserListRequest), new DelUserListExcutor());//删除用户列表
  133. excutorManager.AddMap("UnLockUser", typeof(UnLockUserRequest), new UnLockUserExcutor());//删除用户列表
  134. excutorManager.AddMap("GetSysFuncPwr", typeof(GetSysFuncPwrRequest), new GetSysFuncPwrExcutor());//获取权限列表
  135. excutorManager.AddMap("GetDept", typeof(GetDeptRequest), new GetDeptExcutor());//获取部门列表
  136. excutorManager.AddMap("GetPriceList", typeof(GetPriceListRequest), new GetPriceListExcutor());//获取价格表列表
  137. excutorManager.AddMap("AuditPriceList", typeof(AuditPriceListRequest), new AuditPriceListExcutor());//审核价格表列表
  138. excutorManager.AddMap("SaveDept", typeof(SaveDeptRequest), new SaveDeptExcutor());//保存部门
  139. excutorManager.AddMap("DeleteDept", typeof(DeleteDeptRequest), new DeleteDeptExcutor());//删除部门
  140. excutorManager.AddMap("AuditDept", typeof(AuditDeptRequest), new AuditDeptExcutor());//审核部门
  141. excutorManager.AddMap("SaveProfitrate", typeof(SaveProfitrateRequest), new SaveProfitrateExcutor());// 保存工厂利润率
  142. excutorManager.AddMap("SaveWorkmanship", typeof(SaveWorkmanshipRequest), new SaveWorkmanshipExcutor());// 保存工艺加点设置
  143. excutorManager.AddMap("DeleteWorkmanship", typeof(DeleteWorkmanshipRequest), new DeleteWorkmanshipExcutor());// 删除工艺加点设置
  144. excutorManager.AddMap("AuditWorkmanship", typeof(AuditWorkmanshipRequest), new AuditWorkmanshipExcutor());// 删除工艺加点设置
  145. excutorManager.AddMap("SaveBedNetType", typeof(SaveBedNetTypeRequest), new SaveBedNetTypeExcutor());// 保存床网类别定义
  146. excutorManager.AddMap("DeleteBedNetType", typeof(DeleteBedNetTypeRequest), new DeleteBedNetTypeExcutor());// 删除床网类别定义
  147. excutorManager.AddMap("SaveMattressType", typeof(SaveMattressTypeRequest), new SaveMattressTypeExcutor());// 保存床垫类别定义
  148. excutorManager.AddMap("DeleteMattressType", typeof(DeleteMattressTypeRequest), new DeleteMattressTypeExcutor());// 删除床垫类别定义
  149. excutorManager.AddMap("SaveMattressFormula", typeof(SaveMattressFormulaRequest), new SaveMattressFormulaExcutor());// 保存床垫公式定义
  150. excutorManager.AddMap("DeleteMattressFormula", typeof(DeleteMattressFormulaRequest), new DeleteMattressFormulaExcutor());// 删除床垫公式定义
  151. excutorManager.AddMap("SaveShrinkage", typeof(SaveShrinkageRequest), new SaveShrinkageExcutor());// 保存裥棉收缩率
  152. excutorManager.AddMap("DeleteShrinkage", typeof(DeleteShrinkageRequest), new DeleteShrinkageExcutor());// 删除裥棉收缩率
  153. excutorManager.AddMap("SaveSpring", typeof(SaveSpringRequest), new SaveSpringExcutor());// 保存弹簧资料
  154. excutorManager.AddMap("DeleteSpring", typeof(DeleteSpringRequest), new DeleteSpringExcutor());// 删除弹簧资料
  155. excutorManager.AddMap("AuditSpring", typeof(AuditSpringRequest), new AuditSpringExcutor());// 审核弹簧资料
  156. excutorManager.AddMap("GetBedNetVarList", typeof(GetBedNetVarListRequest), new GetBedNetVarListExcutor());// 获取物料类型
  157. excutorManager.AddMap("SaveBedNetVar", typeof(SaveBedNetVarRequest), new SaveBedNetVarExcutor());// 保存床网/床垫变量定义
  158. excutorManager.AddMap("DeleteBedNetVar", typeof(DeleteBedNetVarRequest), new DeleteBedNetVarExcutor());// 删除床网/床垫变量定义
  159. excutorManager.AddMap("GetMtrlTypeList", typeof(GetMtrlTypeListRequest), new GetMtrlTypeListExcutor());// 获取物料类型
  160. excutorManager.AddMap("SaveMtrlType", typeof(SaveMtrlTypeRequest), new SaveMtrlTypeExcutor());// 获取物料类型
  161. excutorManager.AddMap("DeleteMtrlType", typeof(DeleteMtrlTypeRequest), new DeleteMtrlTypeExcutor());// 获取物料类型
  162. excutorManager.AddMap("GetMtrlDefList", typeof(GetMtrlDefListRequest), new GetMtrlDefListExcutor());// 获取物料资料
  163. excutorManager.AddMap("SaveMtrlDef", typeof(SaveMtrlDefRequest), new SaveMtrlDefExcutor());// 保存物料资料
  164. excutorManager.AddMap("DeleteMtrlDef", typeof(DeleteMtrlDefRequest), new DeleteMtrlDefExcutor());// 删除物料资料
  165. excutorManager.AddMap("BanMtrlDef", typeof(BanMtrlDefRequest), new BanMtrlDefExcutor());// 禁用物料资料
  166. excutorManager.AddMap("CopyMtrlDef", typeof(CopyMtrlDefRequest), new CopyMtrlDefExcutor());// 复制物料资料
  167. excutorManager.AddMap("ModifyMtrlDefList", typeof(ModifyMtrlDefListRequest), new ModifyMtrlDefListExcutor());// 复制物料资料
  168. excutorManager.AddMap("GetFormulaCompute", typeof(GetFormulaComputeRequest), new GetFormulaComputeExcutor());// 公式计算
  169. excutorManager.AddMap("SaveMultiPrice", typeof(SaveMultiPriceRequest), new SaveMultiPriceExcutor());// 保存多维度定价
  170. excutorManager.AddMap("DeleteMultiPrice", typeof(DeleteMultiPriceRequest), new DeleteMultiPriceExcutor());// 删除多维度定价
  171. excutorManager.AddMap("BanMultiPrice", typeof(BanMultiPriceRequest), new BanMultiPriceExcutor());// 禁用多维度定价
  172. excutorManager.AddMap("SaveBedNetArea", typeof(SaveBedNetAreaRequest), new SaveBedNetAreaExcutor());// 保存床网分区定义
  173. excutorManager.AddMap("DeleteBedNetArea", typeof(DeleteBedNetAreaRequest), new DeleteBedNetAreaExcutor());// 删除床网分区定义
  174. excutorManager.AddMap("SaveConfigureType", typeof(SaveConfigureTypeRequest), new SaveConfigureTypeExcutor());// 保存部件选配类型
  175. excutorManager.AddMap("DeleteConfigureType", typeof(DeleteConfigureTypeRequest), new DeleteConfigureTypeExcutor());// 删除部件选配类型
  176. excutorManager.AddMap("SaveConfigureCode", typeof(SaveConfigureCodeRequest), new SaveConfigureCodeExcutor());// 保存部件选配项
  177. excutorManager.AddMap("DeleteConfigureCode", typeof(DeleteConfigureCodeRequest), new DeleteConfigureCodeExcutor());// 删除部件选配项
  178. excutorManager.AddMap("SaveConfigureCodeMx", typeof(SaveConfigureCodeMxRequest), new SaveConfigureCodeMxExcutor());// 保存部件选配项值
  179. excutorManager.AddMap("DeleteConfigureCodeMx", typeof(DeleteConfigureCodeMxRequest), new DeleteConfigureCodeMxExcutor());// 删除部件选配项值
  180. excutorManager.AddMap("SaveConfigureBomList", typeof(SaveConfigureBomListRequest), new SaveConfigureBomListExcutor());// 删除部件选配项值
  181. excutorManager.AddMap("DeleteConfigureBomList", typeof(DeleteConfigureBomListRequest), new DeleteConfigureBomListExcutor());// 删除部件选配项值
  182. excutorManager.AddMap("GetMattressImportDW2", typeof(GetMattressImportDW2Request), new GetMattressImportDW2Excutor());// 下拉选择床垫类别
  183. excutorManager.AddMap("SaveMattress", typeof(SaveMattressRequest), new SaveMattressExcutor());// 保存床垫报价
  184. excutorManager.AddMap("SaveMattressAuditing", typeof(SaveMattressAuditingRequest), new SaveMattressAuditingExcutor());// 床垫报价:业务下单/取消
  185. excutorManager.AddMap("DelMattress", typeof(DelMattressRequest), new DelMattressExcutor());// 床垫报价:删除
  186. excutorManager.AddMap("SaveMattressBcp", typeof(SaveMattressBcpRequest), new SaveMattressBcpExcutor());// 保存半成品报价
  187. excutorManager.AddMap("DeleteMattressBcp", typeof(DeleteMattressBcpRequest), new DeleteMattressBcpExcutor());// 删除半成品报价
  188. excutorManager.AddMap("AuditMattressBcp", typeof(AuditMattressBcpRequest), new AuditMattressBcpExcutor());// 审核半成品报价
  189. excutorManager.AddMap("GetMattressPackagMx", typeof(GetMattressPackagMxRequest), new GetMattressPackagMxExcutor());// 包装方式切换
  190. excutorManager.AddMap("GetMattressSubspecs", typeof(GetMattressSubspecsRequest), new GetMattressSubspecsExcutor());// 获取主副规格
  191. excutorManager.AddMap("SaveBedNet", typeof(SaveBedNetRequest), new SaveBedNetExcutor());// 保存床网报价
  192. excutorManager.AddMap("DeleteBedNet", typeof(DeleteBedNetRequest), new DeleteBedNetExcutor());// 删除床网报价
  193. excutorManager.AddMap("AuditBedNet", typeof(AuditBedNetRequest), new AuditBedNetExcutor());// 审核床网报价
  194. excutorManager.AddMap("GetComputeMattress", typeof(GetComputeMattressRequest), new GetComputeMattressExcutor());// 计算床垫报价
  195. excutorManager.AddMap("GetComputeMattressById", typeof(GetComputeMattressByIdRequest), new GetComputeMattressByIdExcutor());// 计算床垫报价
  196. excutorManager.AddMap("GetComputeBednet", typeof(GetComputeBednetRequest), new GetComputeBednetExcutor());// 计算床网报价
  197. excutorManager.AddMap("GetComputeSpring", typeof(GetComputeSpringRequest), new GetComputeSpringExcutor());// 计算弹簧数量
  198. excutorManager.AddMap("CopyMattressAudited", typeof(CopyMattressAuditedRequest), new CopyMattressAuditedExcutor());// 复制审核床垫报价
  199. excutorManager.AddMap("ReCalculateNoAudit", typeof(ReCalculateNoAuditRequest), new ReCalculateNoAuditExcutor());// 重算床垫报价
  200. excutorManager.AddMap("ReCalculateBedNetNoAudit", typeof(ReCalculateBedNetNoAuditRequest), new ReCalculateBedNetNoAuditExcutor());// 重算床网报价
  201. excutorManager.AddMap("ReCalculateERPCost", typeof(ReCalculateERPCostRequest), new ReCalculateERPCostExcutor());// 重算床网报价
  202. excutorManager.AddMap("CoverMattressInterface", typeof(CoverMattressInterfaceRequest), new CoverMattressInterfaceExcutor());// 覆盖配置到副规格产品
  203. excutorManager.AddMap("MattressYWAudit", typeof(MattressYWAuditRequest), new MattressYWAuditExcutor());// 床垫接口业务审核撤审
  204. excutorManager.AddMap("MattressJSAudit", typeof(MattressJSAuditRequest), new MattressJSAuditExcutor());// 床垫接口产品补充审核撤审
  205. excutorManager.AddMap("MattressJS2Audit", typeof(MattressJS2AuditRequest), new MattressJS2AuditExcutor());// 床垫接口清单补充审核撤审
  206. excutorManager.AddMap("SaveMattressInterface", typeof(SaveMattressInterfaceRequest), new SaveMattressInterfaceExcutor());// 床垫接口清单补充审核撤审
  207. excutorManager.AddMap("RefreshMattressInterface", typeof(RefreshMattressInterfaceRequest), new RefreshMattressInterfaceExcutor());// 刷新床垫配置清单
  208. excutorManager.AddMap("RefreshMattressInterfaceQd", typeof(RefreshMattressInterfaceQdRequest), new RefreshMattressInterfaceQdExcutor());// 刷新床垫清单
  209. excutorManager.AddMap("CreatMtrldef", typeof(CreatMtrldefRequest), new CreatMtrldefExcutor());// 生成L1物料
  210. excutorManager.AddMap("UpdateMtrlPrice", typeof(UpdateMtrlPriceRequest), new UpdateMtrlPriceExcutor());// 更新L1计划价
  211. excutorManager.AddMap("DelMtrlPf", typeof(CreatMtrldefRequest), new DelMtrlPfExcutor());// 删除L1清单
  212. excutorManager.AddMap("CreatPrdPf", typeof(CreatPrdPfRequest), new CreatPrdPfExcutor());// 生成L1清单
  213. excutorManager.AddMap("GetERPMtrldefList", typeof(GetERPMtrldefListRequest), new GetERPMtrldefListExcutor());// 获取ERP物料资料
  214. excutorManager.AddMap("GetERPConfigureList", typeof(GetERPConfigureListRequest), new GetERPConfigureListExcutor());// 获取ERP配置资料
  215. excutorManager.AddMap("GetERPWrkGrpList", typeof(GetERPWrkGrpListRequest), new GetERPWrkGrpListExcutor());// 获取工组列表
  216. excutorManager.AddMap("GetERPMtrlTypeList", typeof(GetERPMtrlTypeListRequest), new GetERPMtrlTypeListExcutor());// 获取ERP物料类型
  217. excutorManager.AddMap("GetMattressInterfaceList", typeof(GetMattressInterfaceListRequest), new GetMattressInterfaceListExcutor());// 获取产品清单明细
  218. //excutorManager.AddMap("GetSemiFinishedMxList", typeof(GetSemiFinishedMxListRequest), new GetSemiFinishedMxListExcutor());// 获取产品清单明细
  219. //excutorManager.AddMap("ImportSpring", typeof(ImportSpringRequest), new ImportSpringExcutor());
  220. excutorManager.AddMap("SaveMattressExtra", typeof(SaveMattressExtraRequest), new SaveMattressExtraExcutor());// 保存床网分区定义
  221. excutorManager.AddMap("DeleteMattressExtra", typeof(DeleteMattressExtraRequest), new DeleteMattressExtraExcutor());// 删除床网分区定义
  222. excutorManager.AddMap("SaveMattressExtraType", typeof(SaveMattressExtraTypeRequest), new SaveMattressExtraTypeExcutor());// 保存床网分区类型
  223. excutorManager.AddMap("DeleteMattressExtraType", typeof(DeleteMattressExtraTypeRequest), new DeleteMattressExtraTypeExcutor());// 删除床网分区类型
  224. excutorManager.AddMap("GetFormulaVarList",typeof(GetFormulaVarListRequest),new GetFormulaVarListExcutor());
  225. excutorManager.AddMap("FormulaCheck", typeof(FormulaCheckRequest),new FormulaCheckExcutor());
  226. excutorManager.AddMap("JLH_FetchPrice", typeof(JLH_FetchPriceRequest), new JLH_FetchPriceExcutor());
  227. excutorManager.AddMap("GetResetWiptype", typeof(GetResetWiptypeRequest), new GetResetWiptypeExcutor());
  228. excutorManager.AddMap("ImportMtrlPriceByExcel", typeof(ImportMtrlPriceByExcelRequest), new ImportMtrlPriceByExcelExcutor()); //更新物料价格表单价
  229. excutorManager.AddMap("UpdateL1Basicinfo", typeof(UpdateL1BasicinfoRequest), new UpdateL1BasicinfoExcutor()); // 更新L1基础资料(物料、物料分类、工组)
  230. excutorManager.AddMap("GetBedNetInterfaceList", typeof(GetBedNetInterfaceListRequest), new GetBedNetInterfaceListExcutor()); // 床网清单获取
  231. excutorManager.AddMap("SaveBedNetInterface", typeof(SaveBedNetInterfaceRequest), new SaveBedNetInterfaceExcutor());// 床网接口清单补充审核撤审
  232. excutorManager.AddMap("RefreshBedNetInterface", typeof(RefreshBedNetInterfaceRequest), new RefreshBedNetInterfaceExcutor());// 刷新床网配置清单
  233. excutorManager.AddMap("RefreshBedNetInterfaceQd", typeof(RefreshBedNetInterfaceQdRequest), new RefreshBedNetInterfaceQdExcutor());// 刷新床网清单
  234. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  235. excutorManager.AddMap("CopyConfigureCodeMxList", typeof(CopyConfigureCodeMxListRequest), new CopyConfigureCodeMxListExcutor()); // 复制部件选配项值
  236. excutorManager.AddMap("SaveSoftBedQuote", typeof(SaveSoftBedQuoteRequest), new SaveSoftBedQuoteExcutor()); // 保存/修改软床报价
  237. excutorManager.AddMap("DeleteSoftBedQuote", typeof(DeleteSoftBedQuoteRequest), new DeleteSoftBedQuoteExcutor()); // 删除软床报价
  238. excutorManager.AddMap("AuditSoftBedQuote", typeof(AuditSoftBedQuoteRequest), new AuditSoftBedQuoteExcutor()); // 审核软床报价
  239. excutorManager.AddMap("GetSoftBedMxList", typeof(GetSoftBedMxListRequest), new GetSoftBedMxListExcutor()); // 获取软床报价明细
  240. excutorManager.AddMap("GetSoftBedConfigureList", typeof(GetSoftBedConfigureListRequest), new GetSoftBedConfigureListExcutor()); // 获取软床报价部件选配
  241. excutorManager.AddMap("SaveSoftBedFormula", typeof(SaveSoftBedFormulaRequest), new SaveSoftBedFormulaExcutor()); // 保存软床公式定义
  242. excutorManager.AddMap("SaveErpMtrlPriceList", typeof(SaveErpMtrlPriceListRequest), new SaveErpMtrlPriceListExcutor()); // 保存物料价格
  243. excutorManager.AddMap("GetErpMtrlPriceList", typeof(GetErpMtrlPriceListRequest), new GetErpMtrlPriceListExcutor()); // 获取ERP物料资料定义
  244. excutorManager.AddMap("GetChangeSoftBedMxList", typeof(GetChangeSoftBedMxListRequest), new GetChangeSoftBedMxListExcutor()); // 获取软床报价换料后明细
  245. excutorManager.AddMap("SaveMattressSubSpecs", typeof(SaveMattressSubSpecsRequest), new SaveMattressSubSpecsExcutor()); // 获取软床报价换料后明细
  246. excutorManager.AddMap("SaveSysPost", typeof(SaveSysPostRequest), new SaveSysPostExcutor()); // 发布公告
  247. excutorManager.AddMap("DeleteSysPostMessage", typeof(DeleteSysPostMessageRequest), new DeleteSysPostMessageExcutor()); // 删除公告
  248. excutorManager.AddMap("LockTable", typeof(LockTableRequest), new LockTableExcutor()); // 单据加锁
  249. excutorManager.AddMap("UnLockTable", typeof(UnLockTableRequest), new UnLockTableExcutor()); // 单据解锁
  250. /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  251. //excutorManager.AddMap("AdminTestFunction", typeof(AdminTestFunctionRequest), new AdminTestFunctionExcutor());
  252. }
  253. catch (Exception ex)
  254. {
  255. Trace.Write(ex.ToString());
  256. }
  257. }
  258. public static string ConnectionString { get; set; }
  259. public static string BinPath
  260. {
  261. get
  262. {
  263. return Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase).Replace("file:\\", "");
  264. }
  265. }
  266. public static bool webapp { get; set; }
  267. public static string App_Data
  268. {
  269. get
  270. {
  271. string app_data = BinPath;
  272. if (webapp)
  273. {
  274. app_data = Directory.GetParent(app_data).FullName + "\\App_Data";
  275. }
  276. if (!Directory.Exists(app_data))
  277. {
  278. Directory.CreateDirectory(app_data);
  279. }
  280. return app_data;
  281. }
  282. }
  283. /// <summary>
  284. /// 是否Web启动模式
  285. /// </summary>
  286. public static bool WebMode { get; set; }
  287. public static string XmlFile
  288. {
  289. get
  290. {
  291. return App_Data + "\\config.xml";
  292. }
  293. }
  294. public static string DataPath
  295. {
  296. get
  297. {
  298. var binpath = FilePathHelper.GetExecutingPath();
  299. string dataPath = binpath;
  300. if (WebMode)
  301. {
  302. dataPath = Directory.GetParent(binpath).FullName + "\\App_Data";
  303. }
  304. if (!Directory.Exists(dataPath))
  305. {
  306. Directory.CreateDirectory(dataPath);
  307. }
  308. return dataPath;
  309. }
  310. }
  311. public static string App_Files
  312. {
  313. get
  314. {
  315. string app_files = App_Data + "\\App_Files";
  316. if (!Directory.Exists(app_files))
  317. {
  318. Directory.CreateDirectory(app_files);
  319. }
  320. return app_files;
  321. }
  322. }
  323. public class ParkFileModel:IFileDBModel
  324. {
  325. public byte[] GetBytes(string md5)
  326. {
  327. if (!string.IsNullOrEmpty(md5))
  328. {
  329. using (var con = new SqlConnection(ConnectionString))
  330. using (var cmd = con.CreateCommand())
  331. {
  332. con.Open();
  333. cmd.CommandText = @"SELECT filedata
  334. FROM st_file
  335. WHERE filemd5 = @filemd5 ";
  336. cmd.Parameters.Clear();
  337. cmd.Parameters.AddWithValue("@filemd5", md5);
  338. using (var reader = cmd.ExecuteReader())
  339. {
  340. if (reader.Read())
  341. {
  342. return reader["fileData"] == DBNull.Value ? null : (byte[]) reader["fileData"];
  343. }
  344. }
  345. }
  346. }
  347. return null;
  348. }
  349. }
  350. }
  351. }