这个提交包含在:
2025-10-31 11:26:55 +08:00
父节点 50cd510351
当前提交 670118a6d5
修改 4 个文件,包含 128 行新增28 行删除
+4 -3
查看文件
@@ -56,7 +56,7 @@ public partial class autocopy : System.Web.UI.Page
string newctid = tArr[1].ToString();
StringBuilder sql = new StringBuilder();
sql.AppendFormat("select ctid,seller_memo,FinishDesignTime,OrderState,SupplierId,SupplierName from view_erptradecell where ctid='{0}'", oldctid);
sql.AppendFormat("select ctid,tid,seller_memo,FinishDesignTime,OrderState,SupplierId,SupplierName from view_erptradecell where ctid='{0}'", oldctid);
DataTable dt = CeErpTradeCell.ExecuteDataset(sql.ToString()).Tables[0];
if (dt == null || dt.Rows.Count < 1)
{
@@ -64,7 +64,7 @@ public partial class autocopy : System.Web.UI.Page
return;
}
StringBuilder sqlnew = new StringBuilder();
sqlnew.AppendFormat("select ctid,seller_memo,FinishDesignTime,OrderState,SupplierId,SupplierName,orderSn from view_erptradecell where (orderstate=3 or orderstate=4) and ctid='{0}'", newctid);
sqlnew.AppendFormat("select ctid,tid,seller_memo,FinishDesignTime,OrderState,SupplierId,SupplierName,orderSn from view_erptradecell where (orderstate=3 or orderstate=4) and ctid='{0}'", newctid);
DataTable dtnew = CeErpTradeCell.ExecuteDataset(sqlnew.ToString()).Tables[0];
if (dtnew == null || dtnew.Rows.Count < 1)
{
@@ -204,7 +204,8 @@ public partial class autocopy : System.Web.UI.Page
//CeErpTradeLog.ExecuteNonQuery(sqlpng);
}
CeErpTradeLog.AddLog(newctid, 5, userId, "自动上传老客户文件-" + newPathFileName);
string fileSql = string.Format("INSERT INTO [dbo].[CE_ErpTradeCellFile]([tid], [ctid], [isDel], [url], [createtime], [type]) SELECT '{0}', '{1}', isDel ,url,getdate(),type FROM [dbo].[CE_ErpTradeCellFile] WHERE tid='{2}' and ctid='{3}' and isDel = 0 and type = 'AUTH_FILE'", dtnew.Rows[0]["tid"], dtnew.Rows[0]["ctid"], dt.Rows[0]["tid"], dt.Rows[0]["ctid"]);
CeErpTradeCell.ExecuteNonQuery(fileSql);
conSuc("文件已上传到共享目录");
return;
}
+42 -11
查看文件
@@ -1,4 +1,5 @@
using BizCom;
using CorelDRAW;
using ICSharpCode.SharpZipLib.Zip;
using SQLData;
using System;
@@ -6,6 +7,7 @@ using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Web;
@@ -28,6 +30,36 @@ public partial class copydownload : System.Web.UI.Page
//Response.End();
}
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;
}
protected void Page_Load(object sender, EventArgs e)
{
if (Request["hexdata"] != null)
@@ -54,7 +86,7 @@ public partial class copydownload : System.Web.UI.Page
}
tids = string.Join(",", tLst.ToArray());
StringBuilder sql = new StringBuilder();
sql.AppendFormat("select ctid,seller_memo,FinishDesignTime,OrderState,SupplierName,OrderSn,tid from view_erptradecell where orderstate=5 and ctid in ({0})", tids);
sql.AppendFormat("select ctid,seller_memo,FinishDesignTime,OrderState,SupplierName,OrderSn,tid,SupplierId from view_erptradecell where orderstate=5 and ctid in ({0})", tids);
DataTable dt = CeErpTradeCell.ExecuteDataset(sql.ToString()).Tables[0];
if (dt == null || dt.Rows.Count < 1)
{
@@ -91,13 +123,12 @@ public partial class copydownload : System.Web.UI.Page
df_name = upPath + "\\" + dTime + "\\" + formatMemo(dr["seller_memo"]);
foreach (string ext in extArr)
{
if (!string.IsNullOrEmpty(tid) && !string.IsNullOrEmpty(orderSn))
{
rname = formatMemo(dr["seller_memo"]).Replace(orderSn, tid);
rname = rname + "《" + orderSn + "》";
}
fname = df_name + ext;
rname = rname + ext;
rname = formatMemo(dr["seller_memo"]) + ext;
if ("14".Equals(dr["SupplierId"].ToString()))
{
rname = dealMemoName(rname);
}
if (!hasFile)
{
if (File.Exists(fname))
@@ -288,13 +319,13 @@ public partial class copydownload : System.Web.UI.Page
string fname = Path.GetFileName(file);
foreach (var rule in replaceRules)
{
fname = fname.Replace(rule.Key, rule.Value);
rname = rname.Replace(rule.Key, rule.Value);
}
File.Copy(file, path + "\\" + fname, true);
if (!File.Exists(path + "\\" + fname))
File.Copy(file, path + "\\" + rname, true);
if (!File.Exists(path + "\\" + rname))
{
File.Copy(file, path + "\\" + fname, true);
File.Copy(file, path + "\\" + rname, true);
}
+47 -5
查看文件
@@ -67,6 +67,7 @@ public partial class supplierBuildFile : System.Web.UI.Page
if (!IsPostBack)
{
Response.Buffer = true;
downloadMore();
}
}
@@ -115,8 +116,9 @@ public partial class supplierBuildFile : System.Web.UI.Page
try
{
CeErpTradeLog.ExecuteNonQuery(string.Format("update CE_ErpPackData set upStatus = 1 where ID= {0} ;", packId));
DataTable itemData = CeErpTradeCell.ExecuteDataset(string.Format("select ctid,seller_memo,FinishDesignTime,OrderState,SupplierName,OrderSn,tid from view_erptradecell where FinishDesignTime is not null and ctid in (SELECT ctid FROM CE_ErpPackDataItem WHERE packId = {0})", packId)).Tables[0];
DataTable itemData = CeErpTradeCell.ExecuteDataset(string.Format("select ctid,seller_memo,FinishDesignTime,OrderState,SupplierName,OrderSn,tid,SupplierId from view_erptradecell where FinishDesignTime is not null and ctid in (SELECT ctid FROM CE_ErpPackDataItem WHERE packId = {0})", packId)).Tables[0];
List<string> files = new List<string>();
List<string> supplierIds = new List<string>();
List<string> tids = new List<string>();
int upStatus = 3;
string url = "";
@@ -133,6 +135,7 @@ public partial class supplierBuildFile : System.Web.UI.Page
//不存在则打包失败
updateSql += string.Format("update CE_ErpPackDataItem set message = '文件不存在!' where packId= {0} and ctid='{1}' ;", packId, ctid);
files = new List<string>();
supplierIds = new List<string>();
break;
}
string fname = df_name + ext;
@@ -172,6 +175,7 @@ public partial class supplierBuildFile : System.Web.UI.Page
{
copyFile(getDesignDate(row["FinishDesignTime"]), row["SupplierName"].ToString(), fname);
files.Add(fname);
supplierIds.Add(row["SupplierId"].ToString());
tids.Add("'" + ctid + "'");
}
catch (Exception ex)
@@ -179,6 +183,7 @@ public partial class supplierBuildFile : System.Web.UI.Page
writeLog("打包复制文件出错!" + ex.Message);
updateSql += string.Format("update CE_ErpPackDataItem set message = '复制文件出错!{2}' where packId= {0} and ctid='{1}' ;", packId, ctid, ex.Message);
files = new List<string>();//清空数据
supplierIds = new List<string>();
break;
}
}
@@ -204,7 +209,13 @@ public partial class supplierBuildFile : System.Web.UI.Page
{
try
{
file.Add(files[i]);
string fname = Path.GetFileName(files[i]);
if ("14".Equals(supplierIds[i]))
{
fname = dealMemoName(fname);
}
file.Add(files[i], fname);
}
catch (Exception ex)
{
@@ -238,9 +249,9 @@ public partial class supplierBuildFile : System.Web.UI.Page
writeLog("打包文件出错!" + ex.Message);
updateSql += string.Format("update CE_ErpPackData set upStatus = 3 where ID= {0} ;", packId);
}
}
CeErpTradeLog.ExecuteNonQuery(updateSql);
updateSql = "";
}
}
running = false;
}
@@ -250,7 +261,35 @@ public partial class supplierBuildFile : System.Web.UI.Page
//FileOssUp();
}
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)
{
string m = memo.ToString();
@@ -292,8 +331,11 @@ public partial class supplierBuildFile : System.Web.UI.Page
var accessKeySecret = "NnutvWhKl4HbQFSad3HosYbCkEkbjN";
// 填写Bucket名称,例如examplebucket。
var bucketName = "dfdiyfile";
int year = DateTime.Now.Year;
int month = DateTime.Now.Month;
int day = DateTime.Now.Day;
// 填写Object完整路径,完整路径中不能包含Bucket名称,例如exampledir/exampleobject.txt。
var objectName = "supplierFile/" + fileName;
var objectName = "supplierFile/" + year + "/" + month + "/" + day + "/" + fileName;
// 填写Bucket所在地域对应的Region。以华东1(杭州)为例,Region填写为cn-hangzhou。
string region = "cn-fuzhou";
+35 -9
查看文件
@@ -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);