frmFileImportModel.cs 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. using LYFZ.Helper;
  2. using System;
  3. using System.Collections;
  4. using System.Collections.Generic;
  5. using System.Data.SqlClient;
  6. using System.Linq;
  7. using System.Text;
  8. namespace LYFZ.Software.MainBusiness.MultipleFileImport
  9. {
  10. public class SqlCommandInfo
  11. {
  12. public string sqlInfo { get; set; }
  13. public Hashtable paramList = new Hashtable();
  14. public string nextType { get; set; }
  15. }
  16. public class frmFileImportBaseModel
  17. {
  18. public string strDirectoryType { get; set; }
  19. /// <summary>
  20. /// 景点名称
  21. /// </summary>
  22. public string takenName { get; set; }
  23. /// <summary>
  24. /// 数码编号
  25. /// </summary>
  26. public string OrdViceNumber { get; set; }
  27. /// <summary>
  28. /// 订单编号
  29. /// </summary>
  30. public string OrdNumber { get; set; }
  31. /// <summary>
  32. /// 服务器路径
  33. /// </summary>
  34. public string service_Path { get; set; }
  35. /// <summary>
  36. /// 文件本地路基
  37. /// </summary>
  38. public List<frmFileImportItemModel> local_Path =null;
  39. public string CurrentCompanyInfoID { get; set; }
  40. public string comeDirectoryPath { get; set; }
  41. public bool importGenerateThumbnails { get; set; }
  42. public string okActive = "";
  43. /// <summary>
  44. /// 是否导入成功
  45. /// </summary>
  46. public bool Success { get; set; }
  47. /// <summary>
  48. /// 错误信息
  49. /// </summary>
  50. public string errorMsg { get; set; }
  51. /// <summary>
  52. /// 状态
  53. /// </summary>
  54. public string StrStatus { get; set; }
  55. public string JID { get; set; }
  56. public Hashtable htdata { get; set; }
  57. public List<SqlCommandInfo> CusFrmClist { get; set; }
  58. }
  59. public class frmFileImportModel :frmFileImportBaseModel
  60. {
  61. //public string
  62. public LYFZ.Model.Model_ErpOrder erpOrder { get; set; }
  63. public LYFZ.Model.Model_ErpOrderDigital erpDigOrder { get; set; }
  64. public LYFZ.BLL.SelectPhotoHandling sPh { get; set; }
  65. public List<CommandInfo> FrmClist { get; set; }
  66. public Hashtable htdata { get; set; }
  67. string _cusName { get; set; }
  68. /// <summary>
  69. /// 客户名称
  70. /// </summary>
  71. public string cusName
  72. {
  73. get
  74. {
  75. if (string.IsNullOrEmpty(_cusName))
  76. {
  77. _cusName = new BLL.BLL_ErpCustomer().GetCustomerNameList(erpOrder.Ord_Number);
  78. }
  79. return _cusName;
  80. }
  81. }
  82. /// <summary>
  83. /// 文件类型
  84. /// </summary>
  85. public LYFZ.Model.Model_ErpOrder.DirectoryType directoryType { get; set; }
  86. public string directoryTypeDis()
  87. {
  88. switch(directoryType)
  89. {
  90. case LYFZ.Model.Model_ErpOrder.DirectoryType.DesignPiece:
  91. return "设计";
  92. //break;
  93. case Model.Model_ErpOrder.DirectoryType.EarlyRetouch:
  94. return "初修";
  95. //break;
  96. case Model.Model_ErpOrder.DirectoryType.FineRetouch:
  97. return "精修";
  98. // break;
  99. case Model.Model_ErpOrder.DirectoryType.PrimitivePicture:
  100. return "原片";
  101. // break;
  102. }
  103. return "";
  104. }
  105. public EffentNextType EffentNextTypeInfo(string txt)
  106. {
  107. switch (txt)
  108. {
  109. case "None":
  110. return EffentNextType.None;
  111. case "WhenHaveContine":
  112. return EffentNextType.WhenHaveContine;
  113. case "WhenNoHaveContine":
  114. return EffentNextType.WhenNoHaveContine;
  115. case "ExcuteEffectRows":
  116. return EffentNextType.ExcuteEffectRows;
  117. case "SolicitationEvent":
  118. return EffentNextType.SolicitationEvent;
  119. }
  120. return EffentNextType.None;
  121. }
  122. public frmFileImportModel()
  123. {
  124. local_Path = new List<frmFileImportItemModel>();
  125. FrmClist = new List<CommandInfo>();
  126. CusFrmClist = new List<SqlCommandInfo>();
  127. errorMsg = "";
  128. }
  129. public frmFileImportBaseModel CloneBaseData()
  130. {
  131. frmFileImportBaseModel baseMod = new frmFileImportBaseModel()
  132. {
  133. local_Path = this.local_Path.FindAll(p => p.code == 0 || p.code == -1),
  134. OrdNumber = this.OrdNumber,
  135. OrdViceNumber = this.OrdViceNumber,
  136. service_Path = this.service_Path,
  137. takenName = this.takenName,
  138. strDirectoryType=this.directoryType.ToString(),
  139. comeDirectoryPath = this.comeDirectoryPath,
  140. CurrentCompanyInfoID = this.CurrentCompanyInfoID,
  141. importGenerateThumbnails = this.importGenerateThumbnails,
  142. okActive = this.okActive,
  143. Success =this.Success,
  144. errorMsg=this.errorMsg,
  145. StrStatus = this.StrStatus,
  146. htdata = this.htdata,
  147. JID = this.JID,
  148. };
  149. ///村粗sql信息
  150. baseMod.CusFrmClist = new List<SqlCommandInfo>();
  151. foreach(var mod in this.FrmClist)
  152. {
  153. SqlCommandInfo comInfo = new SqlCommandInfo()
  154. {
  155. sqlInfo = mod.CommandText,
  156. nextType = mod.EffentNextType.ToString(),
  157. };
  158. comInfo.paramList = new Hashtable();
  159. foreach(var paramMod in mod.Parameters)
  160. {
  161. if (paramMod.Value==null)
  162. {
  163. comInfo.paramList[paramMod.ParameterName] = paramMod.Value;
  164. }
  165. else
  166. {
  167. comInfo.paramList[paramMod.ParameterName] = paramMod.Value.ToString();
  168. }
  169. }
  170. baseMod.CusFrmClist.Add(comInfo);
  171. }
  172. if (baseMod.htdata != null)
  173. {
  174. baseMod.htdata.Remove("clist");
  175. }
  176. return baseMod;
  177. }
  178. public void BindBaseDataToModel(frmFileImportBaseModel baseData)
  179. {
  180. LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
  181. LYFZ.BLL.BLL_ErpOrderDigital dbll = new BLL.BLL_ErpOrderDigital();
  182. this.local_Path = baseData.local_Path;
  183. this.OrdNumber = baseData.OrdNumber;
  184. this.OrdViceNumber = baseData.OrdViceNumber;
  185. this.service_Path = baseData.service_Path;
  186. this.takenName = baseData.takenName;
  187. this.comeDirectoryPath = baseData.comeDirectoryPath;
  188. this.CurrentCompanyInfoID = baseData.CurrentCompanyInfoID;
  189. this.importGenerateThumbnails = baseData.importGenerateThumbnails;
  190. this.okActive = baseData.okActive;
  191. this.Success = baseData.Success;
  192. this.errorMsg = baseData.errorMsg;
  193. this.StrStatus = baseData.StrStatus;
  194. this.htdata = baseData.htdata;
  195. this.JID = baseData.JID;
  196. this.CusFrmClist = baseData.CusFrmClist;
  197. this.erpOrder = orbll.GetModel("Ord_Number", OrdNumber);
  198. this.erpDigOrder = dbll.GetModel("Ordv_ViceNumber", OrdViceNumber);
  199. this.sPh = new BLL.SelectPhotoHandling(erpOrder, erpDigOrder);
  200. this.FrmClist = new List<CommandInfo>();
  201. foreach (var frmMod in this.CusFrmClist)
  202. {
  203. List<SqlParameter> sqlParamList=new List<SqlParameter>();
  204. foreach(string key in frmMod.paramList.Keys)
  205. {
  206. sqlParamList.Add(new SqlParameter(key,frmMod.paramList[key]));
  207. }
  208. CommandInfo comInfo = new CommandInfo(frmMod.sqlInfo, sqlParamList.ToArray(), EffentNextTypeInfo(frmMod.nextType));
  209. this.FrmClist.Add(comInfo);
  210. }
  211. switch (baseData.strDirectoryType)
  212. {
  213. case "PrimitivePicture":
  214. this.directoryType = Model.Model_ErpOrder.DirectoryType.PrimitivePicture;
  215. break;
  216. case "EarlyRetouch":
  217. this.directoryType = Model.Model_ErpOrder.DirectoryType.EarlyRetouch;
  218. break;
  219. case "FineRetouch":
  220. this.directoryType = Model.Model_ErpOrder.DirectoryType.FineRetouch;
  221. break;
  222. case "DesignPiece":
  223. this.directoryType = Model.Model_ErpOrder.DirectoryType.DesignPiece;
  224. break;
  225. }
  226. }
  227. }
  228. }