123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221 |
- 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;
- }
- }
- /// <summary>
- /// 是否正在导入
- /// </summary>
- 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<Helper.CommandInfo> clist = new List<CommandInfo>();
- 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<Helper.CommandInfo> clist = new List<CommandInfo>();
- 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.写真订单;
- /// <summary>
- /// 当前订单类型
- /// </summary>
- public EnumPublic.OrderType CurrentOrderType { get => currentOrderType; set => currentOrderType = value; }
- /// <summary>
- /// 儿童订单时的阶段名
- /// </summary>
- public string SightsName { get => _SightsName; set => _SightsName = value; }
- /// <summary>
- /// 订单号
- /// </summary>
- public string Ord_Number { get => _Ord_Number; set => _Ord_Number = value; }
- /// <summary>
- /// 子订单号
- /// </summary>
- public string Ordv_ViceNumber { get => _Ordv_ViceNumber; set => _Ordv_ViceNumber = value; }
- /// <summary>
- /// 取件状态
- /// </summary>
- 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));
- }
- }
- }
- }
- }
|