This commit is contained in:
2025-10-31 11:26:55 +08:00
parent 50cd510351
commit 670118a6d5
4 changed files with 128 additions and 28 deletions
+47 -5
View File
@@ -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 = "";
}
CeErpTradeLog.ExecuteNonQuery(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";