123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851 |
- 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
- {
- /// <summary>
- ///
- /// </summary>
- 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<AliyunOssLibrary.Model.SimplifyBranch> listbranch = null;
- public List<AliyunOssLibrary.Model.SimplifyBranch> ListBranch
- {
- get
- {
- return listbranch;
- }
- set
- {
- listbranch = value;
- }
- }
- #endregion
- /// <summary>
- /// 是否上传N8选版;
- /// </summary>
- private int _uploadN8Type = -1;
- /// <summary>
- ///
- /// </summary>
- /// <param name="uploadN8Type">-1表示不上传任何N8内容, 0表示上传N8完整的选版目录, 1表示上传N8选版结果(用于同步)</param>
- 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<string> 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<string>();
- }
- 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<string>();
- // 获取选择的分店名称;
- 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<string> 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<string> 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<string> Raw_List = new List<string>();
- List<string> Original_List = new List<string>();
- List<string> Preview_List = new List<string>();
- List<string> Small_List = new List<string>();
- 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 );
- }
- }
- }
- /// <summary>
- /// 获取要上传的相片;
- /// </summary>
- /// <param name="handling"></param>
- /// <param name="UpArtwork">是否要上传原始相片</param>
- /// <param name="dirTypeData">要上传的景点列表</param>
- /// <param name="listUploadfiles"></param>
- void GetUploadFile( SelectPhotoHandling handling, string orderType, bool UpArtwork, string dirTypeData, out List<string> listUploadfiles )
- {
- listUploadfiles = null;
- List<string> listRaw = new List<string>();
- // 原始相片(未压缩);
- List<string> Original_List = new List<string>();
- // 预览图(中图);
- List<string> Preview_List = new List<string>();
- // 小图;
- List<string> Small_List = new List<string>();
- 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<string>();
- 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();
- }
- /// <summary>
- /// 获取要上传的订单的N8选版文件集
- /// </summary>
- /// <param name="strOrderNumber">订单号</param>
- /// <param name="strOrderType">订单类型:儿童什么的</param>
- /// <param name="strGrowthStage">如果是儿童订单,则是成长阶段的串联,以逗号分隔; 否则为空</param>
- /// <param name="IsSynUploadResult">false表示上传整个订单(指定成长阶段)N8选版文件; true表示同步选版结果, 只上传选版结果即可</param>
- /// <returns></returns>
- List<string> 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<string> listFiles = new List<string>();
- List<string> 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<string> 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,
- });
- }
- }*/
- }
- /// <summary>
- /// 获取文件类型
- /// </summary>
- /// <param name="type"></param>
- /// <returns></returns>
- 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;
- }
- }
- }
|