edit
This commit is contained in:
@@ -149,7 +149,7 @@ public partial class supplierDownload : System.Web.UI.Page
|
||||
try
|
||||
{
|
||||
StringBuilder sql = new StringBuilder();
|
||||
sql.AppendFormat("select ctid,seller_memo,FinishDesignTime,OrderState,SupplierName,FileMd5,OrderSn,tid from view_erptradecell where FinishDesignTime is not null and ctid in ({0}) {1}", ("'" + tids.Replace(",", "','") + "'"), ((onlyDownFile == 1 || isFromClient == 1) ? "" : " and OrderState=5 "));
|
||||
sql.AppendFormat("select ctid,seller_memo,FinishDesignTime,OrderState,SupplierName,FileMd5,OrderSn,tid,SupplierId from view_erptradecell where FinishDesignTime is not null and ctid in ({0}) {1}", ("'" + tids.Replace(",", "','") + "'"), ((onlyDownFile == 1 || isFromClient == 1) ? "" : " and OrderState=5 "));
|
||||
DataTable dt = CeErpTradeCell.ExecuteDataset(sql.ToString()).Tables[0];
|
||||
if (dt == null || dt.Rows.Count < 1)
|
||||
{
|
||||
@@ -170,12 +170,10 @@ public partial class supplierDownload : System.Web.UI.Page
|
||||
string fname = df_name + ext;
|
||||
string tid = dr["tid"].ToString();
|
||||
string orderSn = dr["OrderSn"].ToString();
|
||||
string rname = "";
|
||||
if (!string.IsNullOrEmpty(tid) && !string.IsNullOrEmpty(orderSn))
|
||||
string rname = formatMemo(dr["seller_memo"]) + ext;
|
||||
if ("14".Equals(dr["SupplierId"].ToString()))
|
||||
{
|
||||
rname = formatMemo(dr["seller_memo"]).Replace(orderSn, tid);
|
||||
rname = rname + "《" + orderSn + "》";
|
||||
rname = rname + ext;
|
||||
rname = dealMemoName(rname);
|
||||
}
|
||||
int IsFileEncrypt = IsFileEncrypted(fname);
|
||||
if (IsFileEncrypt == 1 && File.Exists(fname))
|
||||
@@ -284,7 +282,35 @@ public partial class supplierDownload : System.Web.UI.Page
|
||||
return;
|
||||
}
|
||||
}
|
||||
private string dealMemoName(string name)
|
||||
{
|
||||
string[] al = name.Split('-');
|
||||
List<string> list = new List<string>();
|
||||
string pa = string.Empty;
|
||||
for (int i = 0; i < al.Length; i++)
|
||||
{
|
||||
if (i == 1)
|
||||
{
|
||||
if (al[i].Contains("(") || al[i].Contains("("))
|
||||
{
|
||||
string tname = al[i].Replace(")", "").Replace(")", "").Replace("(", "").Replace("(", "");
|
||||
if (!string.IsNullOrEmpty(tname))
|
||||
{
|
||||
pa = al[i];
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
list.Add(al[i]);
|
||||
}
|
||||
if (!string.IsNullOrEmpty(pa))
|
||||
{
|
||||
list.Insert(3, pa);
|
||||
}
|
||||
name = string.Join("-", list);
|
||||
return name;
|
||||
}
|
||||
|
||||
private string formatMemo(object memo)
|
||||
{
|
||||
@@ -361,13 +387,13 @@ public partial class supplierDownload : System.Web.UI.Page
|
||||
{
|
||||
try
|
||||
{
|
||||
file.Add(files[i]);
|
||||
file.Add(files[i], rnameList[i]);
|
||||
addFiles.Add(files[i]);
|
||||
addCtid.Add(ctidLst[i]);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
XLog.SaveLog(0, "supplierdownload_ZipFileDownload:" + ex.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -420,7 +446,7 @@ public partial class supplierDownload : System.Web.UI.Page
|
||||
//通知浏览器下载文件而不是打开\\fileDownload=true; path=/
|
||||
Response.AddHeader("Set-Cookie", "fileDownload=true; path=/;");
|
||||
//Response.AddHeader("Cache-Control", "no-cache, no-store, must-revalidate");
|
||||
Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(dfile, System.Text.Encoding.UTF8));
|
||||
Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(fname, System.Text.Encoding.UTF8));
|
||||
Response.AddHeader("Content-Length", bytes.Length.ToString());
|
||||
Response.AddHeader("Access-Control-Expose-Headers", "Content-Disposition");
|
||||
Response.BinaryWrite(bytes);
|
||||
|
||||
Reference in New Issue
Block a user