using LYFZ.BLL; using LYFZ.BLL.N8Process; using LYFZ.ComponentLibrary; using LYFZ.Model; using LYFZ.Network.FTPOperation; using LYFZ.Network.OssOperation; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.IO; using System.Linq; using System.Text; using System.Windows.Forms; namespace LYFZ.Software.MainBusiness.DoorCityProcess { public partial class FTPUpFileForm : LYFZ.Software.UI.DoorCityProcess.FTPUpFileForm { /// /// /// DataGridViewRow dgvr; LYFZ.DAL.DAL_ErpCompanyInfo compInfoDal = new DAL.DAL_ErpCompanyInfo(); LYFZ.BLL.BLL_ErpOrder orderBll = new LYFZ.BLL.BLL_ErpOrder(); BLL_ErpOrderDigital digtalBll = new BLL_ErpOrderDigital(); LYFZ.Model.Model_ErpCompanyInfo compInfo = null; string _Ord_Number, _Ordv_ViceNumber, _orderType; public string dirType = ""; public string tempType = ""; public string frmType = "RightButton"; #region 云传片 private bool useOss = false; public bool UseOss { get { return useOss; } set { useOss = value; } } private List listbranch = null; public List ListBranch { get { return listbranch; } set { listbranch = value; } } #endregion /// /// 是否上传N8选版; /// private int _uploadN8Type = -1; /// /// /// /// -1表示不上传任何N8内容, 0表示上传N8完整的选版目录, 1表示上传N8选版结果(用于同步) public FTPUpFileForm( int uploadN8Type = -1 ) { _uploadN8Type = uploadN8Type; InitializeComponent(); compInfo = compInfoDal.GetModel( LYFZ.Network.TCP_RemoteDataHandlerPassiveMode.SoftwareInfo.SDomainName.Trim() ); } public override void FTPUpFileForm_Load( object sender, EventArgs e ) { if ( this.UseOss ) { this.labelEx4.Text = "原图相片:"; this.labelEx6.Text = "上传RAW:"; this.cb_ExistCheck.Text = "RAW格式"; if ( !lab_FuncType.Text.Equals( "原片" ) ) { this.labelEx6.Enabled = false; this.cb_ExistCheck.Checked = false; this.cb_ExistCheck.Enabled = false; } } else { LYFZ.BLL.BLL_Config cBll = new BLL.BLL_Config(); LYFZ.Model.Model_Config mConfig = cBll.GetModel_SysConfig(); if ( mConfig.IsOpenLocalImportPhoto && !LYFZ.WinAPI.CustomPublicMethod.CheckInternaNetworkAddress( mConfig.ServerHostOrIP ) ) { MessageBoxCustom.Show( "不允许外网本地传片功能" ); this.Close(); } } if ( _uploadN8Type != -1 ) { // 所属类型; this.lab_FuncType.Text = _uploadN8Type == 0 ? "N8选版" : "N8选版同步"; // 隐藏原始照片一行; this.labelEx4.Enabled = false; this.tb_.Enabled = false; this.radioButtonEx2.Enabled = false; this.Text = _uploadN8Type == 0 ? "N8选版" : "N8选版同步"; } } public void BindData( DataGridViewRow dr, string type, string ftpInfo ) { dgvr = dr; lab_OrderNumber.Text = dr.Cells["Ord_Number"].Value.ToString(); if ( _uploadN8Type == -1 ) lab_FuncType.Text = type; else this.lab_FuncType.Text = "N8选版"; lab_FtpInfo.Text = ftpInfo; tempType = type; CheckFTPUpFile(); _Ord_Number = dr.Cells["Ord_Number"].Value.ToString(); _Ordv_ViceNumber = dgvr.Cells["Ordv_ViceNumber"].Value.ToString(); _orderType = dgvr.Cells["订单类型"].Value.ToString(); } public void BindData( string Ord_Number, string Ordv_ViceNumber, string orderType, string type, string ftpInfo ) { _Ord_Number = Ord_Number; _Ordv_ViceNumber = Ordv_ViceNumber; _orderType = orderType; tempType = type; lab_OrderNumber.Text = Ord_Number; lab_FuncType.Text = type.Length > 2 ? type.Substring( 0, 2 ) : type; if ( !LYFZ.BLL.BLL_ErpUser.GetRights( GetCustomAttributesType( lab_FuncType.Text ), CustomAttributes.OperatingAuthority.FTPUpLoadPhoto ) ) { MessageBoxCustom.Show( "无当前权限,不可进行传片操作!!", "提示" ); this.Close(); } //lab_FtpInfo.Text = ftpInfo; CheckFTPUpFile(); } public void CheckFTPUpFile() { LYFZ.Model.Model_ErpOrder erpOrder = orderBll.GetModel( lab_OrderNumber.Text ); LYFZ.Model.Model_ErpOrderDigital orderDigital = digtalBll.GetModel( _Ordv_ViceNumber ); SelectPhotoHandling handling = new LYFZ.BLL.SelectPhotoHandling( erpOrder, orderDigital ); List pathList = null, pathList2 = null; if ( _uploadN8Type != -1 ) {// 获取N8选版订单的共享路径; string dir = BLL.N8Process.BLL_N8Process.GetN8OrderDirecotry( (EnumPublic.OrderType)Enum.Parse( typeof( EnumPublic.OrderType ), erpOrder.Ord_Type ), erpOrder.Ord_Number, "" ); if ( dir == null || dir.Length == 0 ) { pathList = new List(); } else { // 获取该共享路径下的所有文件; pathList = Directory.GetFiles( dir, "*.*", SearchOption.AllDirectories ).ToList(); } } else { pathList = handling.GetSpecifyTypePhotoList( GetDirectoryType( lab_FuncType.Text ), SelectPhotoHandling.PhotoType.Original ); // 阿里云传; pathList2 = handling.GetSpecifyTypePhotoList( GetDirectoryType( lab_FuncType.Text ), SelectPhotoHandling.PhotoType.RawData ); } if ( lab_FuncType.Text.Equals( "原片" ) ) { foreach ( var mod in cbItems ) { bool b1 = (pathList.FindAll( p => p.IndexOf( "\\" + lab_OrderNumber.Text + "\\" + mod.Text + "\\" ) != -1 ).Count != 0); bool b2 = (pathList2.FindAll( p => p.IndexOf( "\\" + lab_OrderNumber.Text + "\\" + mod.Text + "\\" ) != -1 ).Count != 0); if ( this.useOss ? (!b1 && !b2) : (!b1 && !b2) ) { mod.Checked = false; mod.Enabled = false; } } } else { if ( _uploadN8Type != -1 ) {// 上传N8选版订单; if ( erpOrder.Ord_Type.Equals( "1" ) ) {// 儿童订单; foreach ( var mod in cbItems ) { bool b1 = (pathList.FindAll( p => p.IndexOf( "\\" + lab_OrderNumber.Text + "\\" + mod.Text + "\\" ) != -1 ).Count != 0); if ( !b1 ) { mod.Checked = false; mod.Enabled = false; } } } else {// 非儿童订单; if ( pathList.Count == 0 ) { cbItems[0].Checked = false; cbItems[0].Enabled = false; } } } else {// 上传订单相片; if ( erpOrder.Ord_Type.Equals( "1" ) ) {// 儿童订单; foreach ( var mod in cbItems ) { bool b1 = (pathList.FindAll( p => p.IndexOf( "\\" + lab_OrderNumber.Text + "\\" + mod.Text + "\\" ) != -1 ).Count != 0); bool b2 = (pathList2.FindAll( p => p.IndexOf( "\\" + lab_OrderNumber.Text + "\\" + mod.Text + "\\" ) != -1 ).Count != 0); if ( this.useOss ? (!b1 && !b2) : (!b1 && !b2) ) { mod.Checked = false; mod.Enabled = false; } } } else {// 非儿童订单; if ( pathList.Count == 0 ) { cbItems[0].Checked = false; cbItems[0].Enabled = false; } } } } } public override void ButtonUpFile( object sender, EventArgs e ) { LYFZ.Model.Model_ErpOrderDigital orderDigital = digtalBll.GetModel( _Ordv_ViceNumber ); if ( this.useOss ) { // 新建上传任务; AliyunOssLibrary.Model.UploadTask uploadTask = new AliyunOssLibrary.Model.UploadTask(); if ( uploadTask.DownloadBranchIds == null ) uploadTask.DownloadBranchIds = new List(); // 获取选择的分店名称; int nSelCount = 0; CheckBoxEx cbEx = null; foreach ( var mod in this.cbBranchItems ) { if ( mod.Checked ) { cbEx = mod; AliyunOssLibrary.Model.SimplifyBranch branch = (AliyunOssLibrary.Model.SimplifyBranch)cbEx.Tag; uploadTask.DownloadBranchIds.Add( branch.branch_id ); nSelCount++; } } if ( nSelCount == 0 ) { MessageBoxCustom.Show( "请选择上传分店!" ); return; } if ( lab_FuncType.Text.Equals( "原片" ) ) { uploadTask.UploadImageType = (int)AliyunOssLibrary.Enumerate.ImageType.OImgtype; } else if ( lab_FuncType.Text.Equals( "初修" ) ) { uploadTask.UploadImageType = (int)AliyunOssLibrary.Enumerate.ImageType.EImgtype; } else if ( lab_FuncType.Text.Equals( "精修" ) ) { uploadTask.UploadImageType = (int)AliyunOssLibrary.Enumerate.ImageType.FImgtype; } else if ( lab_FuncType.Text.Equals( "设计" ) ) { uploadTask.UploadImageType = (int)AliyunOssLibrary.Enumerate.ImageType.DImgtype; } else if ( lab_FuncType.Text.Contains( "N8选版" ) ) { uploadTask.UploadImageType = (int)AliyunOssLibrary.Enumerate.ImageType.N8Imgtype; } uploadTask.UploadOrder = _Ord_Number; // 获取成长阶段; string dirTypeList = ""; foreach ( var item in this.cbItems ) { if ( item.Checked ) { if ( dirTypeList != "" ) { dirTypeList += ","; } dirTypeList += item.Text; } } if ( !string.IsNullOrEmpty( dirTypeList ) ) { LYFZ.Model.Model_ErpOrder erpOrder = orderBll.GetModel( lab_OrderNumber.Text ); if ( _uploadN8Type != -1 ) { uploadTask.UploadImages = GetN8UploadFileList( erpOrder.Ord_Number, erpOrder.Ord_Type, dirTypeList, _uploadN8Type.IntToBool() ); } else { SelectPhotoHandling handling = new LYFZ.BLL.SelectPhotoHandling( erpOrder, orderDigital ); List uploadfiles = null; GetUploadFile( handling, erpOrder.Ord_Type, radioButtonEx2.Checked, dirTypeList, out uploadfiles ); uploadTask.UploadImages = uploadfiles; } if ( LYFZ.Network.OssOperation.OssProcess.SendOssUploadInfo( uploadTask ) ) { MessageBox.Show( "任务上传成功" ); // 退出程序; this.DialogResult = DialogResult.OK; this.Close(); } } } else { if ( frmType.Equals( "RightButton" ) ) { DataRow dr = (DataRow)dgvr.Tag; CommandData shop = new CommandData(); shop.localShopInfo = compInfo.Company_Name; shop.upShopText = dr["Company_Name"].ToString(); shop.upShopCode = dr["FTP_DividedShop"].ToString(); shop.ftpName = dr["FTP_Name"].ToString(); shop.ftpPass = dr["FTP_Pass"].ToString(); shop.hostPath = dr["FTP_ServicePath"].ToString(); shop.port = Convert.ToInt32( dr["FTP_Port"].ToString() ); shop.CommandType = "A"; shop.UpArtwork = radioButtonEx2.Checked; shop.isExist = cb_ExistCheck.Checked; string dirTypeList = ""; foreach ( var item in this.cbItems ) { if ( item.Checked ) { if ( dirTypeList != "" ) { dirTypeList += ","; } dirTypeList += item.Text; } } shop.dirTypeData = dirTypeList; if ( !string.IsNullOrEmpty( dirTypeList ) ) { LYFZ.Model.Model_ErpOrder erpOrder = orderBll.GetModel( lab_OrderNumber.Text ); UpFTPServiceFileGroup group = new UpFTPServiceFileGroup() { GuidKey = Guid.NewGuid().ToString().Replace( "-", "" ), DirFileType = lab_FuncType.Text, OrderNumber = lab_OrderNumber.Text, SinceOrderNumber = erpOrder.Ord_SinceOrderNumber, ViceNumber = _Ordv_ViceNumber, PhotoType = erpOrder.Ord_Type.Equals( "1" ) ? "儿童订单" : _orderType, bOpenStatus = 1, localServicePath = erpOrder.Ord_PhotoPath.Split( '?' )[0] }; SelectPhotoHandling handling = new LYFZ.BLL.SelectPhotoHandling( erpOrder, orderDigital ); CheckDirectoryOrFile( handling, group, shop.UpArtwork, shop.dirTypeData ); shop.items.Add( group ); string jsonStr = Json.JsonTool.ObjectToJson( shop ); SendDataToService( jsonStr ); base.ButtonUpFile( sender, e ); } else { MessageBoxCustom.Show( "场景至少要选中一个。" ); } } else if ( frmType.Equals( "ViewButton" ) ) { RadioButtonEx rbEx = null; foreach ( var mod in this.rbFtpItems ) { if ( mod.Checked ) { rbEx = mod; break; } } if ( rbEx == null ) { MessageBoxCustom.Show( "请选择ftp账户!" ); return; } DataRow dr = (DataRow)rbEx.Tag; CommandData shop = new CommandData(); shop.localShopInfo = compInfo.Company_Name; shop.upShopText = dr["Company_Name"].ToString(); shop.upShopCode = dr["FTP_DividedShop"].ToString(); shop.ftpName = dr["FTP_Name"].ToString(); shop.ftpPass = dr["FTP_Pass"].ToString(); shop.hostPath = dr["FTP_ServicePath"].ToString(); shop.port = Convert.ToInt32( dr["FTP_Port"].ToString() ); shop.CommandType = "A"; shop.UpArtwork = radioButtonEx2.Checked; shop.isExist = cb_ExistCheck.Checked; string dirTypeList = ""; foreach ( var item in this.cbItems ) { if ( item.Checked ) { if ( dirTypeList != "" ) { dirTypeList += ","; } dirTypeList += item.Text; } } shop.dirTypeData = dirTypeList; if ( !string.IsNullOrEmpty( dirTypeList ) ) { LYFZ.Model.Model_ErpOrder erpOrder = orderBll.GetModel( lab_OrderNumber.Text ); UpFTPServiceFileGroup group = new UpFTPServiceFileGroup() { GuidKey = Guid.NewGuid().ToString().Replace( "-", "" ), DirFileType = lab_FuncType.Text, OrderNumber = lab_OrderNumber.Text, SinceOrderNumber = erpOrder.Ord_SinceOrderNumber, ViceNumber = _Ordv_ViceNumber, PhotoType = erpOrder.Ord_Type.Equals( "1" ) ? "儿童订单" : _orderType, bOpenStatus = 1, localServicePath = erpOrder.Ord_PhotoPath.Split( '?' )[0] }; if (lab_FuncType.Text == "N8选版"||lab_FuncType.Text == "N8选版同步") { List upFileList = GetN8UploadFileList(erpOrder.Ord_Number, erpOrder.Ord_Type, dirTypeList, lab_FuncType.Text == "N8选版同步" ? true : false); BindImageData(group, upFileList); } else { SelectPhotoHandling handling = new LYFZ.BLL.SelectPhotoHandling(erpOrder, orderDigital); CheckDirectoryOrFile(handling, group, shop.UpArtwork, shop.dirTypeData); } shop.items.Add( group ); string jsonStr = Json.JsonTool.ObjectToJson( shop ); SendDataToService( jsonStr ); base.ButtonUpFile( sender, e ); } } } } void CheckDirectoryOrFile( SelectPhotoHandling handling, UpFTPServiceFileGroup group, bool UpArtwork, string dirTypeData ) { List Raw_List = new List(); List Original_List = new List(); List Preview_List = new List(); List Small_List = new List(); if ( UpArtwork ) { Original_List = handling.GetSpecifyTypePhotoList( GetDirectoryType( group.DirFileType ), SelectPhotoHandling.PhotoType.Original ); } Raw_List = handling.GetSpecifyTypePhotoList( GetDirectoryType( group.DirFileType ), SelectPhotoHandling.PhotoType.RawData ); Preview_List = handling.GetSpecifyTypePhotoList( GetDirectoryType( group.DirFileType ), SelectPhotoHandling.PhotoType.Preview ); Small_List = handling.GetSpecifyTypePhotoList( GetDirectoryType( group.DirFileType ), SelectPhotoHandling.PhotoType.Small ); if ( group.DirFileType.Equals( "原片" ) ) { /// string[] dirList = dirTypeData.Split( ',' ); foreach ( string dirData in dirList ) { BindImageData( group, Small_List.Where( p => p.IndexOf( "\\" + dirData + "\\" ) != -1 ).ToList() ); BindImageData( group, Preview_List.Where( p => p.IndexOf( "\\" + dirData + "\\" ) != -1 ).ToList() ); BindImageData( group, Original_List.Where( p => p.IndexOf( "\\" + dirData + "\\" ) != -1 ).ToList() ); BindImageData( group, Raw_List.Where( p => p.IndexOf( "\\" + dirData + "\\" ) != -1 ).ToList() ); } } else { if ( group.PhotoType.Equals( "儿童订单" ) ) { string[] dirList = dirTypeData.Split( ',' ); foreach ( string dirData in dirList ) { BindImageData( group, Small_List.Where( p => p.IndexOf( "\\" + dirData + "\\" ) != -1 ).ToList() ); BindImageData( group, Preview_List.Where( p => p.IndexOf( "\\" + dirData + "\\" ) != -1 ).ToList() ); BindImageData( group, Original_List.Where( p => p.IndexOf( "\\" + dirData + "\\" ) != -1 ).ToList() ); BindImageData( group, Raw_List.Where( p => p.IndexOf( "\\" + dirData + "\\" ) != -1 ).ToList() ); } } else { BindImageData( group, Small_List ); BindImageData( group, Preview_List ); BindImageData( group, Original_List ); BindImageData( group, Raw_List ); } } } /// /// 获取要上传的相片; /// /// /// 是否要上传原始相片 /// 要上传的景点列表 /// void GetUploadFile( SelectPhotoHandling handling, string orderType, bool UpArtwork, string dirTypeData, out List listUploadfiles ) { listUploadfiles = null; List listRaw = new List(); // 原始相片(未压缩); List Original_List = new List(); // 预览图(中图); List Preview_List = new List(); // 小图; List Small_List = new List(); Original_List = handling.GetSpecifyTypePhotoList( GetDirectoryType( lab_FuncType.Text ), SelectPhotoHandling.PhotoType.Original ); Preview_List = handling.GetSpecifyTypePhotoList( GetDirectoryType( lab_FuncType.Text ), SelectPhotoHandling.PhotoType.Preview ); Small_List = handling.GetSpecifyTypePhotoList( GetDirectoryType( lab_FuncType.Text ), SelectPhotoHandling.PhotoType.Small ); if ( cb_ExistCheck.Checked == true ) {// 是否上传原始格式raw; // 当单独导入原始格式时,原始相片被重命名; listRaw = handling.GetSpecifyTypePhotoList( GetDirectoryType( lab_FuncType.Text ), SelectPhotoHandling.PhotoType.RawData ); // 当由jpg等相片附加导入的原始格式相片时, 原始格式相片保持原名不变;获取原始格式文件名时需要从原片中去前缀获取; string prefix = SelectPhotoHandling.PhotoType.Original.ToString().ToLower() + "_"; foreach ( string file in Original_List ) { if ( file.ToLower().IndexOf( prefix ) != 0 ) { string rawname = System.IO.Path.GetFileNameWithoutExtension( file ).Substring( prefix.Length ); string rawpath = System.IO.Path.GetDirectoryName( file ); string[] arylist = System.IO.Directory.GetFiles( rawpath, rawname + ".*" ); listRaw.AddRange( arylist ); } } string WorryingTooExtName = ".gif|.png|.bmp|.jpg|.jpeg|.txt|.exe|.doc|.xls|.dat|.bak|.ppt|.docx|.xlsx|.pptx|.wps|.ini|.asp|.php|.jsp|.html|.css|.xml|.sql|.cs|.aspx|.rar|.zip|.7z"; for ( int i = listRaw.Count - 1; i >= 0; i-- ) { string ext = System.IO.Path.GetExtension( listRaw[i] ).ToLower(); if ( WorryingTooExtName.Contains( ext ) ) { listRaw.RemoveAt( i ); } } } listUploadfiles = new List(); if ( lab_FuncType.Text.Equals( "原片" ) ) { string[] dirList = dirTypeData.Split( ',' ); foreach ( string dirData in dirList ) {// 遍历每一个景点; listUploadfiles = listUploadfiles.Union( Small_List.Where( p => p.IndexOf( "\\" + dirData + "\\" ) != -1 ).ToList() ).ToList(); listUploadfiles = listUploadfiles.Union( Preview_List.Where( p => p.IndexOf( "\\" + dirData + "\\" ) != -1 ).ToList() ).ToList(); if ( UpArtwork ) listUploadfiles = listUploadfiles.Union( Original_List.Where( p => p.IndexOf( "\\" + dirData + "\\" ) != -1 ).ToList() ).ToList(); } } else { if ( orderType.Equals( "1" ) ) {// 儿童订单; string[] dirList = dirTypeData.Split( ',' ); foreach ( string dirData in dirList ) {// 遍历每一个景点; listUploadfiles = listUploadfiles.Union( Small_List.Where( p => p.IndexOf( "\\" + dirData + "\\" ) != -1 ).ToList() ).ToList(); listUploadfiles = listUploadfiles.Union( Preview_List.Where( p => p.IndexOf( "\\" + dirData + "\\" ) != -1 ).ToList() ).ToList(); if ( UpArtwork ) listUploadfiles = listUploadfiles.Union( Original_List.Where( p => p.IndexOf( "\\" + dirData + "\\" ) != -1 ).ToList() ).ToList(); } } else { listUploadfiles = listUploadfiles.Union( Small_List ).ToList(); listUploadfiles = listUploadfiles.Union( Preview_List ).ToList(); if ( UpArtwork ) listUploadfiles = listUploadfiles.Union( Original_List ).ToList(); } } if ( cb_ExistCheck.Checked == true ) listUploadfiles = listUploadfiles.Union( listRaw ).ToList(); } /// /// 获取要上传的订单的N8选版文件集 /// /// 订单号 /// 订单类型:儿童什么的 /// 如果是儿童订单,则是成长阶段的串联,以逗号分隔; 否则为空 /// false表示上传整个订单(指定成长阶段)N8选版文件; true表示同步选版结果, 只上传选版结果即可 /// List GetN8UploadFileList( string strOrderNumber, string strOrderType, string strGrowthStage, bool IsSynUploadResult = false ) { // N8是否可用; if ( !BLL_N8Process.IsN8ModelValid() ) return null; EnumPublic.OrderType orderType = (EnumPublic.OrderType)Enum.Parse( typeof( EnumPublic.OrderType ), strOrderType ); // 获取N8订单的根目录; string strRootDir = BLL_N8Process.GetN8OrderDirecotry( orderType, strOrderNumber ); if ( string.IsNullOrEmpty( strRootDir ) ) return null; List listFiles = new List(); List listAll = Directory.GetFiles( strRootDir, "*.*", SearchOption.AllDirectories ).ToList(); if ( orderType == EnumPublic.OrderType.儿童订单 ) { // 遍历获取成长阶段的上传文件; string[] aryGrowthStage = strGrowthStage.Split( ',' ); if ( aryGrowthStage == null || aryGrowthStage.Length == 0 ) return null; foreach ( string growthStage in aryGrowthStage ) { if ( IsSynUploadResult ) { listFiles.AddRange( listAll.Where( p => p.IndexOf( "\\" + growthStage + "\\选版结果\\" ) != -1 ).ToArray() ); listFiles.AddRange( listAll.Where( p => p.IndexOf( "\\[已选]" + growthStage + "\\选版结果\\" ) != -1 ).ToArray() ); } else { // 已选版 或 未选版, 都可以上传; listFiles.AddRange( listAll.Where( p => p.IndexOf( "\\" + growthStage + "\\" ) != -1 ).ToArray() ); listFiles.AddRange( listAll.Where( p => p.IndexOf( "\\[已选]" + growthStage + "\\" ) != -1 ).ToArray() ); } } } else { if ( IsSynUploadResult ) { listFiles.AddRange( listAll.Where( p => p.IndexOf( "\\选版结果\\" ) != -1 ).ToArray() ); } else { listFiles.AddRange( listAll ); } } return listFiles; } void BindImageData( UpFTPServiceFileGroup group, List filePathList ) { foreach ( string path in filePathList ) { group.items.Add( new UpFTPServiceFileItem() { localFilePath = path, serviceFilePath = path.Split( '$' ).Length > 1 ? path.Split( '$' )[1] : "", } ); } /* if (Directory.Exists(dirPath + "" )) { string[] fileList = Directory.GetFiles(dirPath ); foreach (string file in fileList) { string fileName = Path.GetFileName(file); group.items.Add(new UpFTPServiceFileItem() { localFilePath = file, serviceFilePath = servicePath + fileName, }); } }*/ } /// /// 获取文件类型 /// /// /// public LYFZ.Model.Model_ErpOrder.DirectoryType GetDirectoryType( string type ) { switch ( type ) { case "原片": return LYFZ.Model.Model_ErpOrder.DirectoryType.PrimitivePicture; case "初修": return LYFZ.Model.Model_ErpOrder.DirectoryType.EarlyRetouch; case "精修": return LYFZ.Model.Model_ErpOrder.DirectoryType.FineRetouch; default: return LYFZ.Model.Model_ErpOrder.DirectoryType.DesignPiece; } } public LYFZ.CustomAttributes.RightsValue GetCustomAttributesType( string type ) { switch ( type ) { case "原片": return LYFZ.BLL.BLL_ErpUser.CurrentUserRights.StoresPhotograph; case "初修": return LYFZ.BLL.BLL_ErpUser.CurrentUserRights.StoresRepairPiece; case "精修": return LYFZ.BLL.BLL_ErpUser.CurrentUserRights.StoresRefinedRepair; case "设计": return LYFZ.BLL.BLL_ErpUser.CurrentUserRights.StoresDesign; } return null; } string GetfileDirectoryType( string type ) { switch ( type ) { case "原片": return LYFZ.Model.Model_ErpOrder.DirectoryType.PrimitivePicture.ToString(); case "初修": return LYFZ.Model.Model_ErpOrder.DirectoryType.EarlyRetouch.ToString(); case "精修": return LYFZ.Model.Model_ErpOrder.DirectoryType.FineRetouch.ToString(); default: return LYFZ.Model.Model_ErpOrder.DirectoryType.DesignPiece.ToString(); } } public void SendDataToService( string jsonStr ) { LYFZ.Software.MainBusiness.MultipleFileImport.frmFtpThread.GetSingleton().SendDataToService( jsonStr ); //LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker) //{ // backgroundWorker.ReportProgress(0, "正在提交数据..."); // HPSocketCS.Extended.RequestData requestData = new HPSocketCS.Extended.RequestData((int)LYFZ.Network.TCPNetworkServer.SerializerRequestCommand.FTPCommand); // requestData.AttachedMessage = jsonStr; // HPSocketCS.Extended.ReturnData returnData = HPSocketCS.Extended.SerializerDataProcessed.HP_SendSerializerCommandToServer(requestData); // if (returnData.ReturnStatus) // { // backgroundWorker.ReportProgress(0, "数据提交成功..."); // //MessageBoxCustom.Show("提交成功!!"); // } // else // { // MessageBoxCustom.Show("提交失败!!"); // } //}); //LYFZ.Software.MainBusiness.MultipleFileImport.frmMultipFileImportThread.GetSingleton().StartFTPMsgTimer(); } public override RadioButtonEx AddCheckBoxByFtpInfo( DataRow dr ) { LYFZ.DAL.DAL_ErpCompanyInfo compInfoDal = new DAL.DAL_ErpCompanyInfo(); LYFZ.Model.Model_ErpCompanyInfo compInfo = null; compInfo = compInfoDal.GetModel( LYFZ.Network.TCP_RemoteDataHandlerPassiveMode.SoftwareInfo.SDomainName.Trim() ); frmType = "ViewButton"; lab_FtpInfo.Visible = false; if ( this.useOss && listbranch != null ) { this.gb_FTPInfo.Text = "云传片分店信息"; foreach ( AliyunOssLibrary.Model.SimplifyBranch branch in listbranch ) { CheckBoxEx cbex = new CheckBoxEx(); cbex.Text = branch.branch_name + " " + branch.branch_id; cbex.AutoSize = true; cbex.Tag = branch; cbBranchItems.Add( cbex ); this.gb_FTPInfo.Controls.Add( cbex ); } int addheight = 0; for ( int i = 0; i < cbBranchItems.Count; i++ ) { addheight = cbBranchItems[i].Height * i; cbBranchItems[i].Location = new Point( lab_FtpInfo.Location.X, lab_FtpInfo.Location.Y + cbBranchItems[i].Height * i ); } gb_FTPInfo.Size = new System.Drawing.Size( gb_FTPInfo.Size.Width, (int)(gbBoxHeight + addheight) ); this.Size = new Size( this.Size.Width, this.Size.Height + addheight ); } else { #region 2017-03-22 杨云奕 添加 获取门店配置的ftp情况 BLL.BaseBLL.BaseBLL_FTPServiceUserAccount ftpbll = new BLL.BaseBLL.BaseBLL_FTPServiceUserAccount(); DataSet ftpData = ftpbll.GetList2( "" ); foreach ( DataRow row in ftpData.Tables[0].Rows ) { RadioButtonEx cbex = base.AddCheckBoxByFtpInfo( row ); if ( compInfo.Company_DividedShop == row["FTP_DividedShop"].ToString() ) { cbex.Enabled = false; } } #endregion int addheight = 0; for ( int i = 0; i < rbFtpItems.Count; i++ ) { addheight = rbFtpItems[i].Height * i; rbFtpItems[i].Location = new Point( lab_FtpInfo.Location.X, lab_FtpInfo.Location.Y + rbFtpItems[i].Height * i ); } gb_FTPInfo.Size = new System.Drawing.Size( gb_FTPInfo.Size.Width, (int)(gbBoxHeight + addheight) ); this.Size = new Size( this.Size.Width, this.Size.Height + addheight ); } return null; } } }