using LYFZ.Helper; using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; using System.Text; using System.Windows.Forms; namespace LYFZ.Software.MainBusiness.DoorCityProcess { public class frmSelectImportVideo : LYFZ.Software.UI.DoorCityProcess.frmSelectImportVideo { public frmSelectImportVideo() { this.Shown += FrmSelectImportVideo_Shown; this.btnOK.Click += BtnOK_Click; this.btnCancel.Click += BtnCancel_Click; } private void BtnCancel_Click(object sender, EventArgs e) { if (isImportIng) { MessageBoxCustom.Show("正在导入视频,不能取消"); } else { this.DialogResult = System.Windows.Forms.DialogResult.Cancel; } } /// /// 是否正在导入 /// bool isImportIng = false; private void BtnOK_Click(object sender, EventArgs e) { if (isImportIng) { MessageBoxCustom.Show("正在导入视频请耐心等待..."); return; } if (this.cmbtreevOrdPg_Photographer.Tag == null) { MessageBoxCustom.Show("请选择录影师"); return; } string Ordv_Videographer = ""; string Ordv_Editorgrapher = ""; if (this.cmbtreevOrdPg_Photographer.Tag != null && this.cmbtreevOrdPg_Photographer.Text.Trim() != "") { Ordv_Videographer = this.cmbtreevOrdPg_Photographer.Tag.ToString().Trim(); } if (this.cmbtreevOrdPg_PhotographyAssistant.Tag != null && this.cmbtreevOrdPg_PhotographyAssistant.Text.Trim() != "") { Ordv_Editorgrapher = this.cmbtreevOrdPg_PhotographyAssistant.Tag.ToString().Trim(); } System.Windows.Forms.OpenFileDialog openFileDialog = new System.Windows.Forms.OpenFileDialog(); openFileDialog.FileName = "";// 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"; openFileDialog.Multiselect = true; //openFileDialog.FilterIndex = 2; if (openFileDialog.ShowDialog() == DialogResult.OK) { LYFZ.Model.Model_ErpOrder ord_model = null; LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate (object obj, BackgroundWorker backgroundWorker) { ord_model = orbll.GetModel("Ord_Number", _Ord_Number); }); //导入视频 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); if (strprht != null && ord_model != null) { // List clist = new List(); LYFZ.BLL.SelectPhotoHandling sPh = new BLL.SelectPhotoHandling(ord_model, digitalModel); // if (!LYFZ.BLL.BLL_SystemGlobalSetting.SysTemGlobalSetMoel.EnableQueuingGuide) // LYFZ.PhotoSelectSystem.PhotoImportExport pe = new PhotoSelectSystem.PhotoImportExport(ord_model, digitalModel); /* LYFZ.ComponentLibrary.FrmLoadHandling.ExecutionDoWorkMethod(delegate (object obj, BackgroundWorker backgroundWorker) { }, width: 500); */ string[] videoFileNames = openFileDialog.FileNames; foreach (string videoPath in videoFileNames) { if (System.IO.File.Exists(LYFZ.BLL.SelectPhotoHandling.GetServerVideoFullFilePath(strprht.FullName, videoPath))) { MessageBoxCustom.Show(String.Format("选择导入的视频在服务器上已存在,为防止误操作,请删除已存在视频后再导入")); return; } } sPh.AsynchronousCopyVideoFile(strprht.FullName, videoFileNames, (Model.CopyFileReport fileReport) => { isImportIng = true; if (fileReport.CopyFileCompleted) { try { if (fileReport.CopyStatus) { bool isBl = false; LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate (object obj, BackgroundWorker backgroundWorker) { try { // LYFZ.BLL.BLL_PhotoImportRecordTable.UpdatePhotoImportRecordTable(Model.Model_ErpOrder.DirectoryType.EarlyRetouch, LYFZ.BLL.BLL_ErpCompanyInfo.CurrentCompanyInfoID, ord_model.Ord_Number, 1, PhotoImportRecordType.Import); if (dbll.UpdateImportVideoStatus(this.Ord_Number, this.Ordv_ViceNumber, Ordv_Videographer, Ordv_Editorgrapher, 1, SDateTime.Now)) { isBl = true; 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); } } catch (Exception ex) { MessageBoxCustom.Show(String.Format("更新导入视频状态时出错:{0}", ex.Message)); } }); if (isBl) { MessageBoxCustom.Show("视频导入成功"); this.DialogResult = DialogResult.OK; } } else { MessageBoxCustom.Show(String.Format("导入失败:{0}", fileReport.ErrorMsg)); } } catch (Exception ex) { MessageBoxCustom.Show(String.Format("导入出错:{0}", ex.Message)); } finally { isImportIng = false; } } else { this.lbprogressBar.Text = fileReport.GetReportMsgInfo(); this.progressBarValue.Value = Convert.ToInt32(fileReport.Percentage > 100 ? 100 : fileReport.Percentage); } }); } } /* List clist = new List(); clist.Add(slogbll.GetAddCommandInfo(LYFZ.BLL.BLL_ErpSystemLogs.GetWriteLogModel(LYFZ.EnumPublic.SystemLogsType.订单流程重置, StrContent, this.StrUserID, StrUserName, LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.User_IP))); if (clist.Count > 0) { if (LYFZ.BLL.BaseBllOperate.ExecuteSqlTran(clist) > 0) { MessageBoxCustom.Show("重置成功!"); } else { MessageBoxCustom.Show("重置失败!"); } }*/ } LYFZ.BLL.BLL_ErpOrder orbll = new BLL.BLL_ErpOrder(); LYFZ.BLL.BLL_ErpOrderDigital dbll = new BLL.BLL_ErpOrderDigital(); LYFZ.BLL.BLL_ErpSystemLogs slogbll = new BLL.BLL_ErpSystemLogs(); LYFZ.Model.Model_ErpOrderDigital digitalModel = null; string _Ord_Number = ""; string _Ordv_ViceNumber = ""; string _PickupStatus = ""; string _SightsName = ""; LYFZ.EnumPublic.OrderType currentOrderType = EnumPublic.OrderType.写真订单; /// /// 当前订单类型 /// public EnumPublic.OrderType CurrentOrderType { get => currentOrderType; set => currentOrderType = value; } /// /// 儿童订单时的阶段名 /// public string SightsName { get => _SightsName; set => _SightsName = value; } /// /// 订单号 /// public string Ord_Number { get => _Ord_Number; set => _Ord_Number = value; } /// /// 子订单号 /// public string Ordv_ViceNumber { get => _Ordv_ViceNumber; set => _Ordv_ViceNumber = value; } /// /// 取件状态 /// public string PickupStatus { get => _PickupStatus; set => _PickupStatus = value; } private void FrmSelectImportVideo_Shown(object sender, EventArgs e) { LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_DepartmentAndEmployee(this.cmbtreevOrdPg_Photographer, IsFirstNodeNull: true, IsShowResign: false); LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_DepartmentAndEmployee(this.cmbtreevOrdPg_PhotographyAssistant, IsFirstNodeNull: true, IsShowResign: false); LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate (object obj, BackgroundWorker backgroundWorker) { digitalModel = dbll.GetModel("Ordv_ViceNumber", _Ordv_ViceNumber); }); if (digitalModel != null) { if (digitalModel.Ordv_Videographer.Trim() != "") { this.cmbtreevOrdPg_Photographer.TextFindTag(LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetUserName(digitalModel.Ordv_Videographer)); } if (digitalModel.Ordv_Editorgrapher.Trim() != "") { this.cmbtreevOrdPg_PhotographyAssistant.TextFindTag(LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.GetUserName(digitalModel.Ordv_Editorgrapher)); } } } } }