SVN-Revision: r597
This commit is contained in:
wyf
2025-05-16 08:28:05 +00:00
parent a93e54b01f
commit 89bda418e7
+13 -25
View File
@@ -1272,7 +1272,6 @@ namespace Lskj.PubBomImport
DataRow parentProductRow = BaseImpl.GetDataRowResult($"select top 1 billdocument_id from bom_BillTab where productid='{productId}'"); DataRow parentProductRow = BaseImpl.GetDataRowResult($"select top 1 billdocument_id from bom_BillTab where productid='{productId}'");
Dictionary<string, DataRow> maxBcFileDic = new Dictionary<string, DataRow>(); Dictionary<string, DataRow> maxBcFileDic = new Dictionary<string, DataRow>();
Dictionary<string, DataTable> fileTableDic = new Dictionary<string, DataTable>(); Dictionary<string, DataTable> fileTableDic = new Dictionary<string, DataTable>();
List<string> notUploadFileList = new List<string>();
if (parentProductRow == null) if (parentProductRow == null)
{ {
frmBillInfo.OnBillAdd(); frmBillInfo.OnBillAdd();
@@ -1312,17 +1311,7 @@ namespace Lskj.PubBomImport
string childDirPath = childInfoRow["BomFieldNameDir"] + ""; string childDirPath = childInfoRow["BomFieldNameDir"] + "";
childInfo = new FileInfo(childDirPath); childInfo = new FileInfo(childDirPath);
} }
//如果存在附件则判断是否已经上传了附件 if ((childInfo == null || filetable.Rows.Count > 0) && maxBcFileDic.ContainsKey(code) && maxBcFileDic[code] != null)
if (childInfo != null)
{
GetFileCodeInfo(Path.GetFileNameWithoutExtension(childInfo.Name).Trim(), out string childsourceCode, out string childname, out string childsourceBB, out int childsourceBC);
if (childsourceBC <= childMaxBc && maxBcFileDic.ContainsKey(code) && maxBcFileDic[code] != null)
{
notUploadFileList.Add(code);
childInfo = null;//设置为空下载附件使用
}
}
if (childInfo == null && maxBcFileDic.ContainsKey(code) && maxBcFileDic[code] != null)
{ {
using (WebClient webClient = new WebClient()) using (WebClient webClient = new WebClient())
{ {
@@ -1480,8 +1469,7 @@ namespace Lskj.PubBomImport
DataTable filetable = fileTableDic.ContainsKey(code) ? fileTableDic[code] : null; DataTable filetable = fileTableDic.ContainsKey(code) ? fileTableDic[code] : null;
if (code.StartsWith("QD")) if (code.StartsWith("QD"))
{ {
if (!notUploadFileList.Contains(code))
{
FileInfo childInfo = null; FileInfo childInfo = null;
DataRow childInfoRow = selectRows.Where(n => (n[Model.AfterBomFieldName] + "").StartsWith(code)).FirstOrDefault(); DataRow childInfoRow = selectRows.Where(n => (n[Model.AfterBomFieldName] + "").StartsWith(code)).FirstOrDefault();
if (childInfoRow != null) if (childInfoRow != null)
@@ -1490,7 +1478,7 @@ namespace Lskj.PubBomImport
string childDirPath = childInfoRow["BomFieldNameDir"] + ""; string childDirPath = childInfoRow["BomFieldNameDir"] + "";
childInfo = new FileInfo(childDirPath); childInfo = new FileInfo(childDirPath);
} }
if (childInfo == null && maxBcFileDic.ContainsKey(code) && maxBcFileDic[code] != null) if ((childInfo == null || filetable.Rows.Count > 0) && maxBcFileDic.ContainsKey(code) && maxBcFileDic[code] != null)
{ {
using (WebClient webClient = new WebClient()) using (WebClient webClient = new WebClient())
{ {
@@ -1523,7 +1511,9 @@ namespace Lskj.PubBomImport
DataRow productRow = BaseImpl.GetDataRowResult($"select top 1 billdocument_id from bom_BillTab where productid='{code}'"); DataRow productRow = BaseImpl.GetDataRowResult($"select top 1 billdocument_id from bom_BillTab where productid='{code}'");
if (productRow == null) if (productRow == null)
{ {
if ((code.StartsWith("QD") || code.StartsWith("ZZQD"))) string childGuid = Guid.NewGuid() + "";
string uploadFileId = maxBcFileDic.ContainsKey(code) ? maxBcFileDic[code]["fileId"] + "" : "-1";
if (filetable.Rows.Count == 0)
{ {
frmBillInfo.OnBillAdd(); frmBillInfo.OnBillAdd();
SetProcessBar(0, allCount); SetProcessBar(0, allCount);
@@ -1550,7 +1540,6 @@ namespace Lskj.PubBomImport
DataRow childMasterRow = BillImpl.GetDataRowResult(childBillMasterSql); DataRow childMasterRow = BillImpl.GetDataRowResult(childBillMasterSql);
SetProcessBar(60, allCount); SetProcessBar(60, allCount);
frmBillInfo.AddOrUpdateBill(childMasterRow, detailTable); frmBillInfo.AddOrUpdateBill(childMasterRow, detailTable);
string childGuid = Guid.NewGuid() + "";
frmBillInfo.BillSaveSql(childGuid); frmBillInfo.BillSaveSql(childGuid);
SetProcessBar(80, allCount); SetProcessBar(80, allCount);
//记录历史版本号 //记录历史版本号
@@ -1564,7 +1553,6 @@ namespace Lskj.PubBomImport
//string updateChildVerSql = @"update bom_BillListTab set Ver = (select top 1 billdocument_id from bom_billListTab where ParentProduct = '{0}') where Billdocument_Id = (select top 1 billdocument_id from bom_billListTab where ParentProduct = '{1}') and ProductId='{0}'"; //string updateChildVerSql = @"update bom_BillListTab set Ver = (select top 1 billdocument_id from bom_billListTab where ParentProduct = '{0}') where Billdocument_Id = (select top 1 billdocument_id from bom_billListTab where ParentProduct = '{1}') and ProductId='{0}'";
//SqlHelper.ExecuteNonQuery(string.Format(updateChildVerSql, code, productId)); //SqlHelper.ExecuteNonQuery(string.Format(updateChildVerSql, code, productId));
SetProcessBar(80, allCount); SetProcessBar(80, allCount);
string uploadFileId = maxBcFileDic.ContainsKey(code) ? maxBcFileDic[code]["fileId"] + "" : "-1";
if (filetable.Rows.Count == 0) if (filetable.Rows.Count == 0)
{ {
isUpload = UploadFileToAudit(childInfo.FullName, qdsourceCode, "010106", out msg, out uploadFileId); isUpload = UploadFileToAudit(childInfo.FullName, qdsourceCode, "010106", out msg, out uploadFileId);
@@ -1573,6 +1561,7 @@ namespace Lskj.PubBomImport
throw new Exception($"{code}附件上传失败\r\n{msg}"); throw new Exception($"{code}附件上传失败\r\n{msg}");
} }
} }
}
StaticControl.RightMenuGridView.GridControl.Invoke(new Action(() => StaticControl.RightMenuGridView.GridControl.Invoke(new Action(() =>
{ {
if (childInfoRow.Table.Columns.Contains("qms_laddf_FileId")) if (childInfoRow.Table.Columns.Contains("qms_laddf_FileId"))
@@ -1593,7 +1582,6 @@ namespace Lskj.PubBomImport
SetProcessBar(100, finishCount); SetProcessBar(100, finishCount);
SetProcessLabelAllMsg($"总进度:{nowCount + 1}/{parentTable.Rows.Count + 1}"); SetProcessLabelAllMsg($"总进度:{nowCount + 1}/{parentTable.Rows.Count + 1}");
} }
}
else else
{ {
SetProcessBar(0, allCount); SetProcessBar(0, allCount);
@@ -1623,11 +1611,9 @@ namespace Lskj.PubBomImport
throw new Exception($"目录中不包含文件{code}"); throw new Exception($"目录中不包含文件{code}");
} }
} }
}
else else
{ {
if (!notUploadFileList.Contains(code))
{
FileInfo childInfo = null; FileInfo childInfo = null;
DataRow childInfoRow = selectRows.Where(n => (n[Model.AfterBomFieldName] + "").StartsWith(code)).FirstOrDefault(); DataRow childInfoRow = selectRows.Where(n => (n[Model.AfterBomFieldName] + "").StartsWith(code)).FirstOrDefault();
if (childInfoRow != null) if (childInfoRow != null)
@@ -1636,7 +1622,7 @@ namespace Lskj.PubBomImport
string childDirPath = childInfoRow["BomFieldNameDir"] + ""; string childDirPath = childInfoRow["BomFieldNameDir"] + "";
childInfo = new FileInfo(childDirPath); childInfo = new FileInfo(childDirPath);
} }
if (childInfo == null && maxBcFileDic.ContainsKey(code) && maxBcFileDic[code] != null) if ((childInfo == null || filetable.Rows.Count > 0) && maxBcFileDic.ContainsKey(code) && maxBcFileDic[code] != null)
{ {
using (WebClient webClient = new WebClient()) using (WebClient webClient = new WebClient())
{ {
@@ -1665,9 +1651,11 @@ namespace Lskj.PubBomImport
} }
if (childInfo != null) if (childInfo != null)
{ {
GetFileCodeInfo(Path.GetFileNameWithoutExtension(childInfo.Name).Trim(), out string qdsourceCode, out string qdname, out string qdsourceBB, out int qdsourceBC);
string uploadFileId = maxBcFileDic.ContainsKey(code) ? maxBcFileDic[code]["fileId"] + "" : "-1"; string uploadFileId = maxBcFileDic.ContainsKey(code) ? maxBcFileDic[code]["fileId"] + "" : "-1";
if (filetable.Rows.Count == 0) if (filetable.Rows.Count == 0)
{
GetFileCodeInfo(Path.GetFileNameWithoutExtension(childInfo.Name).Trim(), out string qdsourceCode, out string qdname, out string qdsourceBB, out int qdsourceBC);
if (filetable.Rows.Count == 0)
{ {
isUpload = UploadFileToAudit(childInfo.FullName, qdsourceCode, "010106", out msg, out uploadFileId); isUpload = UploadFileToAudit(childInfo.FullName, qdsourceCode, "010106", out msg, out uploadFileId);
if (!isUpload) if (!isUpload)
@@ -1675,6 +1663,7 @@ namespace Lskj.PubBomImport
throw new Exception($"{code}附件上传失败\r\n{msg}"); throw new Exception($"{code}附件上传失败\r\n{msg}");
} }
} }
}
StaticControl.RightMenuGridView.GridControl.Invoke(new Action(() => StaticControl.RightMenuGridView.GridControl.Invoke(new Action(() =>
{ {
if (childInfoRow.Table.Columns.Contains("qms_laddf_FileId")) if (childInfoRow.Table.Columns.Contains("qms_laddf_FileId"))
@@ -1692,7 +1681,6 @@ namespace Lskj.PubBomImport
} }
} }
} }
}
this.Invoke(new Action(() => this.Invoke(new Action(() =>
{ {
this.DialogResult = DialogResult.OK; this.DialogResult = DialogResult.OK;