frmSelectImportVideo.cs 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. using LYFZ.Helper;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Linq;
  6. using System.Text;
  7. using System.Windows.Forms;
  8. namespace LYFZ.Software.MainBusiness.DoorCityProcess
  9. {
  10. public class frmSelectImportVideo : LYFZ.Software.UI.DoorCityProcess.frmSelectImportVideo
  11. {
  12. public frmSelectImportVideo()
  13. {
  14. this.Shown += FrmSelectImportVideo_Shown;
  15. this.btnOK.Click += BtnOK_Click;
  16. this.btnCancel.Click += BtnCancel_Click;
  17. }
  18. private void BtnCancel_Click(object sender, EventArgs e)
  19. {
  20. if (isImportIng)
  21. {
  22. MessageBoxCustom.Show("正在导入视频,不能取消");
  23. }
  24. else
  25. {
  26. this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
  27. }
  28. }
  29. /// <summary>
  30. /// 是否正在导入
  31. /// </summary>
  32. bool isImportIng = false;
  33. private void BtnOK_Click(object sender, EventArgs e)
  34. {
  35. if (isImportIng)
  36. {
  37. MessageBoxCustom.Show("正在导入视频请耐心等待...");
  38. return;
  39. }
  40. if (this.cmbtreevOrdPg_Photographer.Tag == null)
  41. {
  42. MessageBoxCustom.Show("请选择录影师");
  43. return;
  44. }
  45. string Ordv_Videographer = "";
  46. string Ordv_Editorgrapher = "";
  47. if (this.cmbtreevOrdPg_Photographer.Tag != null && this.cmbtreevOrdPg_Photographer.Text.Trim() != "")
  48. {
  49. Ordv_Videographer = this.cmbtreevOrdPg_Photographer.Tag.ToString().Trim();
  50. }
  51. if (this.cmbtreevOrdPg_PhotographyAssistant.Tag != null && this.cmbtreevOrdPg_PhotographyAssistant.Text.Trim() != "")
  52. {
  53. Ordv_Editorgrapher = this.cmbtreevOrdPg_PhotographyAssistant.Tag.ToString().Trim();
  54. }
  55. System.Windows.Forms.OpenFileDialog openFileDialog = new System.Windows.Forms.OpenFileDialog();
  56. openFileDialog.FileName = "";//
  57. openFileDialog.Filter = BLL.SelectPhotoHandling.VideoExtensionName; //"常用视频格式(*.mp4;*.avi;*.rm;*.rmvb;*.wmv;*.3gp;*.mov;*.m4v;*.mkv;*.flv;*.vob)|*.mp4;*.avi;*.rm;*.rmvb;*.wmv;*.3gp;*.mov;*.m4v;*.mkv;*.flv;*.vob";
  58. openFileDialog.Multiselect = true;
  59. //openFileDialog.FilterIndex = 2;
  60. if (openFileDialog.ShowDialog() == DialogResult.OK)
  61. {
  62. LYFZ.Model.Model_ErpOrder ord_model = null;
  63. LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate (object obj, BackgroundWorker backgroundWorker)
  64. {
  65. ord_model = orbll.GetModel("Ord_Number", _Ord_Number);
  66. });
  67. //导入视频
  68. System.IO.DirectoryInfo strprht = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.GetImportPhotoPath((EnumPublic.OrderType)Convert.ToInt32(ord_model.Ord_Type), LYFZ.BLL.SelectPhotoHandling.ImportExportType.EarlyRetouch, ord_model.Ord_Number, SightsName);
  69. if (strprht != null && ord_model != null)
  70. {
  71. // List<Helper.CommandInfo> clist = new List<CommandInfo>();
  72. LYFZ.BLL.SelectPhotoHandling sPh = new BLL.SelectPhotoHandling(ord_model, digitalModel);
  73. // if (!LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.EnableQueuingGuide)
  74. // LYFZ.PhotoSelectSystem.PhotoImportExport pe = new PhotoSelectSystem.PhotoImportExport(ord_model, digitalModel);
  75. /* LYFZ.ComponentLibrary.FrmLoadHandling.ExecutionDoWorkMethod(delegate (object obj, BackgroundWorker backgroundWorker)
  76. {
  77. }, width: 500);
  78. */
  79. string[] videoFileNames = openFileDialog.FileNames;
  80. foreach (string videoPath in videoFileNames)
  81. {
  82. if (System.IO.File.Exists(LYFZ.BLL.SelectPhotoHandling.GetServerVideoFullFilePath(strprht.FullName, videoPath)))
  83. {
  84. MessageBoxCustom.Show(String.Format("选择导入的视频在服务器上已存在,为防止误操作,请删除已存在视频后再导入"));
  85. return;
  86. }
  87. }
  88. sPh.AsynchronousCopyVideoFile(strprht.FullName, videoFileNames, (Model.CopyFileReport fileReport) =>
  89. {
  90. isImportIng = true;
  91. if (fileReport.CopyFileCompleted)
  92. {
  93. try
  94. {
  95. if (fileReport.CopyStatus)
  96. {
  97. bool isBl = false;
  98. LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate (object obj, BackgroundWorker backgroundWorker)
  99. {
  100. try
  101. {
  102. // LYFZ.BLL.BLL_PhotoImportRecordTable.UpdatePhotoImportRecordTable(Model.Model_ErpOrder.DirectoryType.EarlyRetouch, LYFZ.BLL.BLL_ErpCompanyInfo.CurrentCompanyInfoID, ord_model.Ord_Number, 1, PhotoImportRecordType.Import);
  103. if (dbll.UpdateImportVideoStatus(this.Ord_Number, this.Ordv_ViceNumber, Ordv_Videographer, Ordv_Editorgrapher, 1, SDateTime.Now))
  104. {
  105. isBl = true;
  106. LYFZ.BLL.BLL_ErpSystemLogs.WriteSystemLog(LYFZ.EnumPublic.SystemLogsType.导入视频, String.Format("订单:{0}({1}) 导入视频", _Ord_Number, Ordv_ViceNumber), LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID, LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_Name, LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.User_IP);
  107. }
  108. }
  109. catch (Exception ex)
  110. {
  111. MessageBoxCustom.Show(String.Format("更新导入视频状态时出错:{0}", ex.Message));
  112. }
  113. });
  114. if (isBl)
  115. {
  116. MessageBoxCustom.Show("视频导入成功");
  117. this.DialogResult = DialogResult.OK;
  118. }
  119. }
  120. else
  121. {
  122. MessageBoxCustom.Show(String.Format("导入失败:{0}", fileReport.ErrorMsg));
  123. }
  124. }
  125. catch (Exception ex)
  126. {
  127. MessageBoxCustom.Show(String.Format("导入出错:{0}", ex.Message));
  128. }
  129. finally
  130. {
  131. isImportIng = false;
  132. }
  133. }
  134. else
  135. {
  136. this.lbprogressBar.Text = fileReport.GetReportMsgInfo();
  137. this.progressBarValue.Value = Convert.ToInt32(fileReport.Percentage > 100 ? 100 : fileReport.Percentage);
  138. }
  139. });
  140. }
  141. }
  142. /* List<Helper.CommandInfo> clist = new List<CommandInfo>();
  143. clist.Add(slogbll.GetAddCommandInfo(LYFZ.BLL.BLL_ErpSystemLogs.GetWriteLogModel(LYFZ.EnumPublic.SystemLogsType.订单流程重置, StrContent, this.StrUserID, StrUserName, LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.User_IP)));
  144. if (clist.Count > 0)
  145. {
  146. if (LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist) > 0)
  147. {
  148. MessageBoxCustom.Show("重置成功!");
  149. }
  150. else
  151. {
  152. MessageBoxCustom.Show("重置失败!");
  153. }
  154. }*/
  155. }
  156. LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder();
  157. LYFZ.BLL.BLL_ErpOrderDigital dbll = new BLL.BLL_ErpOrderDigital();
  158. LYFZ.BLL.BLL_ErpSystemLogs slogbll = new BLL.BLL_ErpSystemLogs();
  159. LYFZ.Model.Model_ErpOrderDigital digitalModel = null;
  160. string _Ord_Number = "";
  161. string _Ordv_ViceNumber = "";
  162. string _PickupStatus = "";
  163. string _SightsName = "";
  164. LYFZ.EnumPublic.OrderType currentOrderType = EnumPublic.OrderType.写真订单;
  165. /// <summary>
  166. /// 当前订单类型
  167. /// </summary>
  168. public EnumPublic.OrderType CurrentOrderType { get => currentOrderType; set => currentOrderType = value; }
  169. /// <summary>
  170. /// 儿童订单时的阶段名
  171. /// </summary>
  172. public string SightsName { get => _SightsName; set => _SightsName = value; }
  173. /// <summary>
  174. /// 订单号
  175. /// </summary>
  176. public string Ord_Number { get => _Ord_Number; set => _Ord_Number = value; }
  177. /// <summary>
  178. /// 子订单号
  179. /// </summary>
  180. public string Ordv_ViceNumber { get => _Ordv_ViceNumber; set => _Ordv_ViceNumber = value; }
  181. /// <summary>
  182. /// 取件状态
  183. /// </summary>
  184. public string PickupStatus { get => _PickupStatus; set => _PickupStatus = value; }
  185. private void FrmSelectImportVideo_Shown(object sender, EventArgs e)
  186. {
  187. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_DepartmentAndEmployee(this.cmbtreevOrdPg_Photographer, IsFirstNodeNull: true, IsShowResign: false);
  188. LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_DepartmentAndEmployee(this.cmbtreevOrdPg_PhotographyAssistant, IsFirstNodeNull: true, IsShowResign: false);
  189. LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate (object obj, BackgroundWorker backgroundWorker)
  190. {
  191. digitalModel = dbll.GetModel("Ordv_ViceNumber", _Ordv_ViceNumber);
  192. });
  193. if (digitalModel != null)
  194. {
  195. if (digitalModel.Ordv_Videographer.Trim() != "")
  196. {
  197. this.cmbtreevOrdPg_Photographer.TextFindTag(LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetUserName(digitalModel.Ordv_Videographer));
  198. }
  199. if (digitalModel.Ordv_Editorgrapher.Trim() != "")
  200. {
  201. this.cmbtreevOrdPg_PhotographyAssistant.TextFindTag(LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetUserName(digitalModel.Ordv_Editorgrapher));
  202. }
  203. }
  204. }
  205. }
  206. }