SVN r588
SVN-Revision: r588
This commit is contained in:
@@ -586,9 +586,9 @@ namespace Lskj.PubBomImport
|
|||||||
}
|
}
|
||||||
|
|
||||||
StringBuilder insertbulider = new StringBuilder();
|
StringBuilder insertbulider = new StringBuilder();
|
||||||
string mxCode = BaseImpl.GetResult($"select MxFileName from FileAttachmentMapping where MaterialCode = '{productCode}' and RelatedAttachmentName = '{beforeSourceCode}';") + "";
|
string mxCode = BaseImpl.GetResult($"select MxFileName from FileAttachmentMapping where MaterialCode = '{topProductId}' and RelatedAttachmentName = '{beforeSourceCode}';") + "";
|
||||||
insertbulider.AppendLine($"delete FileAttachmentMapping where MaterialCode = '{productCode}' and RelatedAttachmentName = '{beforeSourceCode}';");
|
insertbulider.AppendLine($"delete FileAttachmentMapping where MaterialCode = '{topProductId}' and RelatedAttachmentName = '{beforeSourceCode}';");
|
||||||
insertbulider.AppendLine($"insert into FileAttachmentMapping (MaterialCode,MxFileName,RelatedAttachmentName,OperatorUser,ChangeStatus) values ('{productCode}','{mxCode}','{sourceCode}','{ERPInfo.Instance.UserName}','变更');");
|
insertbulider.AppendLine($"insert into FileAttachmentMapping (MaterialCode,MxFileName,RelatedAttachmentName,OperatorUser,ChangeStatus) values ('{topProductId}','{mxCode}','{sourceCode}','{ERPInfo.Instance.UserName}','变更');");
|
||||||
|
|
||||||
//更新或新增并备份清单
|
//更新或新增并备份清单
|
||||||
int.TryParse(Model.FirstRowIndex, out int index);
|
int.TryParse(Model.FirstRowIndex, out int index);
|
||||||
@@ -656,9 +656,9 @@ namespace Lskj.PubBomImport
|
|||||||
productCode = topProductId;
|
productCode = topProductId;
|
||||||
GetFileCodeInfo(Path.GetFileNameWithoutExtension(parentInfo.Name).Trim(), out string sourceCode, out string sourceName, out string sourceBB, out int sourceBC);
|
GetFileCodeInfo(Path.GetFileNameWithoutExtension(parentInfo.Name).Trim(), out string sourceCode, out string sourceName, out string sourceBB, out int sourceBC);
|
||||||
StringBuilder insertbulider = new StringBuilder();
|
StringBuilder insertbulider = new StringBuilder();
|
||||||
string mxCode = BaseImpl.GetResult($"select MxFileName from FileAttachmentMapping where MaterialCode = '{productCode}' and RelatedAttachmentName = '{beforeSourceCode}';") + "";
|
string mxCode = BaseImpl.GetResult($"select MxFileName from FileAttachmentMapping where MaterialCode = '{topProductId}' and RelatedAttachmentName = '{beforeSourceCode}';") + "";
|
||||||
insertbulider.AppendLine($"delete FileAttachmentMapping where MaterialCode = '{productCode}' and RelatedAttachmentName = '{beforeSourceCode}';");
|
insertbulider.AppendLine($"delete FileAttachmentMapping where MaterialCode = '{topProductId}' and RelatedAttachmentName = '{beforeSourceCode}';");
|
||||||
insertbulider.AppendLine($"insert into FileAttachmentMapping (MaterialCode,MxFileName,RelatedAttachmentName,OperatorUser,ChangeStatus) values ('{productCode}','{mxCode}','{sourceCode}','{ERPInfo.Instance.UserName}','变更');");
|
insertbulider.AppendLine($"insert into FileAttachmentMapping (MaterialCode,MxFileName,RelatedAttachmentName,OperatorUser,ChangeStatus) values ('{topProductId}','{mxCode}','{sourceCode}','{ERPInfo.Instance.UserName}','变更');");
|
||||||
//更新或新增并备份清单
|
//更新或新增并备份清单
|
||||||
int.TryParse(Model.FirstRowIndex, out int index);
|
int.TryParse(Model.FirstRowIndex, out int index);
|
||||||
frmMain.FirstRowIndex = index;
|
frmMain.FirstRowIndex = index;
|
||||||
@@ -1153,7 +1153,11 @@ namespace Lskj.PubBomImport
|
|||||||
if (mxInfo != null)
|
if (mxInfo != null)
|
||||||
{
|
{
|
||||||
GetFileCodeInfo(Path.GetFileNameWithoutExtension(mxInfo.Name).Trim(), out string mxsourceCode, out string mxname, out string mxsourceBB, out int mxsourceBC);
|
GetFileCodeInfo(Path.GetFileNameWithoutExtension(mxInfo.Name).Trim(), out string mxsourceCode, out string mxname, out string mxsourceBB, out int mxsourceBC);
|
||||||
DataTable mxfiletable = BaseImpl.GetDataTableResult($"select sname,fileId from p_fm_filetab where parentid in (select dirid from P_fm_DirectoryTab where pid = '{mxsourceCode}' and dllcoid = '1000202') and speciesno = '010106' and sname like '{mxsourceCode}%'");
|
DataTable mxfiletable = BaseImpl.GetDataTableResult($"select sname,fileId from p_fm_filetab where parentid in (select dirid from P_fm_DirectoryTab where pid = '{productId}' and dllcoid = '1000202') and speciesno = '010106' and sname like '{mxsourceCode}%'");
|
||||||
|
if (mxfiletable.Rows.Count > 0)
|
||||||
|
{
|
||||||
|
throw new Exception($"{mxsourceCode}的附件已存在\r\n请进行变更");
|
||||||
|
}
|
||||||
int mxMaxBc = 0;
|
int mxMaxBc = 0;
|
||||||
string mxMaxBcFileId = "-1";
|
string mxMaxBcFileId = "-1";
|
||||||
foreach (DataRow mxfileRow in mxfiletable.Rows)
|
foreach (DataRow mxfileRow in mxfiletable.Rows)
|
||||||
@@ -1202,7 +1206,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();
|
||||||
@@ -1234,23 +1237,15 @@ namespace Lskj.PubBomImport
|
|||||||
//判断code是否已经上传,如果已经上传则不再上传,
|
//判断code是否已经上传,如果已经上传则不再上传,
|
||||||
//如果附件不存在文件夹中,则直接使用最新的
|
//如果附件不存在文件夹中,则直接使用最新的
|
||||||
//如果附件不存在则提示
|
//如果附件不存在则提示
|
||||||
|
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)
|
||||||
{
|
{
|
||||||
string childFileName = childInfoRow[Model.AfterBomFieldName] + "";
|
string childFileName = childInfoRow[Model.AfterBomFieldName] + "";
|
||||||
string childDirPath = childInfoRow["BomFieldNameDir"] + "";
|
string childDirPath = childInfoRow["BomFieldNameDir"] + "";
|
||||||
FileInfo childInfo = new FileInfo(childDirPath);
|
childInfo = new FileInfo(childDirPath);
|
||||||
//如果存在附件则判断是否已经上传了附件
|
|
||||||
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 || filetable.Rows.Count > 0) && maxBcFileDic.ContainsKey(code) && maxBcFileDic[code] != null)
|
||||||
if (childInfo == null && maxBcFileDic.ContainsKey(code) && maxBcFileDic[code] != null)
|
|
||||||
{
|
{
|
||||||
using (WebClient webClient = new WebClient())
|
using (WebClient webClient = new WebClient())
|
||||||
{
|
{
|
||||||
@@ -1332,14 +1327,6 @@ namespace Lskj.PubBomImport
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
if (filetable.Rows.Count == 0)
|
|
||||||
{
|
|
||||||
throw new Exception($"{code}的附件不存在,请检查文件");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
SetProcessBar(20, 0);
|
SetProcessBar(20, 0);
|
||||||
if (childTable.Rows.Count == 0)
|
if (childTable.Rows.Count == 0)
|
||||||
{
|
{
|
||||||
@@ -1416,7 +1403,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))
|
if (filetable.Rows.Count == 0)
|
||||||
{
|
{
|
||||||
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();
|
||||||
@@ -1426,7 +1413,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())
|
||||||
{
|
{
|
||||||
@@ -1562,7 +1549,7 @@ namespace Lskj.PubBomImport
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!notUploadFileList.Contains(code))
|
if (filetable.Rows.Count == 0)
|
||||||
{
|
{
|
||||||
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();
|
||||||
@@ -1572,7 +1559,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())
|
||||||
{
|
{
|
||||||
@@ -2193,23 +2180,23 @@ namespace Lskj.PubBomImport
|
|||||||
}
|
}
|
||||||
if (!string.IsNullOrEmpty(token))
|
if (!string.IsNullOrEmpty(token))
|
||||||
{
|
{
|
||||||
string selectSql = $"select * from P_fm_FileTab where parentid in (select dirid from P_fm_DirectoryTab where pid = '{idValue}' and dllcoid = '1000202') and speciesno = '{speciesno}' and sname = '{name.Replace(" ", "")}'";
|
//string selectSql = $"select * from P_fm_FileTab where parentid in (select dirid from P_fm_DirectoryTab where pid = '{idValue}' and dllcoid = '1000202') and speciesno = '{speciesno}' and sname = '{name.Replace(" ", "")}'";
|
||||||
DataTable deleteTable = BaseImpl.GetDataTableResult(selectSql);
|
//DataTable deleteTable = BaseImpl.GetDataTableResult(selectSql);
|
||||||
if (deleteTable != null && deleteTable.Rows.Count > 0)
|
//if (deleteTable != null && deleteTable.Rows.Count > 0)
|
||||||
{
|
//{
|
||||||
foreach (DataRow deleteRow in deleteTable.Rows)
|
// foreach (DataRow deleteRow in deleteTable.Rows)
|
||||||
{
|
// {
|
||||||
string field = HttpUtility.UrlEncode(deleteRow["fileId"] + "");
|
// string field = HttpUtility.UrlEncode(deleteRow["fileId"] + "");
|
||||||
string webpath = HttpUtility.UrlEncode(deleteRow["webpath"] + "");
|
// string webpath = HttpUtility.UrlEncode(deleteRow["webpath"] + "");
|
||||||
//删除文件
|
// //删除文件
|
||||||
string deleteUrl = "{0}Api/FileUploadApi.ashx?fileId={1}&filename={2}&method={3}";
|
// string deleteUrl = "{0}Api/FileUploadApi.ashx?fileId={1}&filename={2}&method={3}";
|
||||||
deleteUrl = string.Format(deleteUrl, SystemInfo.Instance.OAUrl, field, webpath, "DoDelete");
|
// deleteUrl = string.Format(deleteUrl, SystemInfo.Instance.OAUrl, field, webpath, "DoDelete");
|
||||||
HttpHelper.Setting("application/x-www-form-urlencoded", null, null);
|
// HttpHelper.Setting("application/x-www-form-urlencoded", null, null);
|
||||||
Dictionary<string, string> deleteHeaderDic = new Dictionary<string, string>();
|
// Dictionary<string, string> deleteHeaderDic = new Dictionary<string, string>();
|
||||||
deleteHeaderDic.Add("Authorization", $"Bearer {token}");
|
// deleteHeaderDic.Add("Authorization", $"Bearer {token}");
|
||||||
HttpWebResponse deleteWebResponse = HttpHelper.Post(deleteUrl, fileStream, null, deleteHeaderDic, out string deleteResult);
|
// HttpWebResponse deleteWebResponse = HttpHelper.Post(deleteUrl, fileStream, null, deleteHeaderDic, out string deleteResult);
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
postUrl = string.Format(postUrl, SystemInfo.Instance.OAUrl, "1000202", HttpUtility.UrlEncode(idValue), "file", fileBytes.Length, 0, HttpUtility.UrlEncode(name), "DoWebUpload", speciesno);
|
postUrl = string.Format(postUrl, SystemInfo.Instance.OAUrl, "1000202", HttpUtility.UrlEncode(idValue), "file", fileBytes.Length, 0, HttpUtility.UrlEncode(name), "DoWebUpload", speciesno);
|
||||||
HttpTools.setting("application/x-www-form-urlencoded", null, null);
|
HttpTools.setting("application/x-www-form-urlencoded", null, null);
|
||||||
string result = "";
|
string result = "";
|
||||||
|
|||||||
@@ -34,11 +34,12 @@
|
|||||||
<Reference Include="DevExpress.Data.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
<Reference Include="DevExpress.Data.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||||
<Reference Include="DevExpress.Utils.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
<Reference Include="DevExpress.Utils.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||||
<Reference Include="DevExpress.XtraEditors.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
<Reference Include="DevExpress.XtraEditors.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||||
|
<Reference Include="DevExpress.XtraPrinting.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
|
||||||
<Reference Include="DevExpress.XtraGrid.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
|
<Reference Include="DevExpress.XtraGrid.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a, processorArchitecture=MSIL" />
|
||||||
<Reference Include="DevExpress.XtraTreeList.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
<Reference Include="DevExpress.XtraTreeList.v15.2, Version=15.2.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" />
|
||||||
<Reference Include="Newtonsoft.Json, Version=13.0.1.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>D:\工作\lserp_cs_6.0\引用DLL\Newtonsoft.Json.dll</HintPath>
|
<HintPath>..\..\引用DLL\Newtonsoft.Json.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="NPOI">
|
<Reference Include="NPOI">
|
||||||
<HintPath>..\..\..\引用DLL\NPOI.dll</HintPath>
|
<HintPath>..\..\..\引用DLL\NPOI.dll</HintPath>
|
||||||
|
|||||||
Reference in New Issue
Block a user