SVN r633
SVN-Revision: r633
This commit is contained in:
@@ -175,7 +175,7 @@ namespace Lskj.PubBomImport
|
|||||||
int count = parentTable.AsEnumerable().Where(n => (n["图号"] + "").Trim().StartsWith(code)).Count();
|
int count = parentTable.AsEnumerable().Where(n => (n["图号"] + "").Trim().StartsWith(code)).Count();
|
||||||
if (count > 1)//只允许存在一个
|
if (count > 1)//只允许存在一个
|
||||||
{
|
{
|
||||||
throw new Exception($"MX中的{code}重复");
|
throw new Exception($"MX中的{code}重复,请修改");
|
||||||
}
|
}
|
||||||
if (code.StartsWith("ZZQD"))
|
if (code.StartsWith("ZZQD"))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -967,10 +967,16 @@ namespace Lskj.PubBomImport
|
|||||||
StringBuilder insertbulider = new StringBuilder();
|
StringBuilder insertbulider = new StringBuilder();
|
||||||
insertbulider.AppendLine($"delete FileAttachmentMapping where MaterialCode = '{productId}';");
|
insertbulider.AppendLine($"delete FileAttachmentMapping where MaterialCode = '{productId}';");
|
||||||
//insertbulider.AppendLine($"insert into FileAttachmentMapping (MaterialCode,MxFileName,RelatedAttachmentName,OperatorUser,ChangeStatus) values ('{productId}','{mxsourceCode }','{mxsourceCode}','{ERPInfo.Instance.UserName}','新增');");
|
//insertbulider.AppendLine($"insert into FileAttachmentMapping (MaterialCode,MxFileName,RelatedAttachmentName,OperatorUser,ChangeStatus) values ('{productId}','{mxsourceCode }','{mxsourceCode}','{ERPInfo.Instance.UserName}','新增');");
|
||||||
|
var mxCodeRows = parentTable.AsEnumerable();
|
||||||
foreach (DataRow parentRow in parentTable.Rows)
|
foreach (DataRow parentRow in parentTable.Rows)
|
||||||
{
|
{
|
||||||
int.TryParse(parentRow["套数"] + "", out int tamount);
|
int.TryParse(parentRow["套数"] + "", out int tamount);
|
||||||
string code = (parentRow["图号"] + "").Trim();
|
string code = (parentRow["图号"] + "").Trim();
|
||||||
|
int codeCount = mxCodeRows.Where(n => (n["图号"] + "").Trim().StartsWith(code)).Count();
|
||||||
|
if (codeCount > 1)//只允许存在一个
|
||||||
|
{
|
||||||
|
throw new Exception($"MX中的{code}重复,请修改");
|
||||||
|
}
|
||||||
insertbulider.AppendLine($"insert into FileAttachmentMapping (MaterialCode,MxFileName,RelatedAttachmentName,OperatorUser,ChangeStatus) values ('{productId}','{mxsourceCode }','{code}','{ERPInfo.Instance.UserName}','新增');");
|
insertbulider.AppendLine($"insert into FileAttachmentMapping (MaterialCode,MxFileName,RelatedAttachmentName,OperatorUser,ChangeStatus) values ('{productId}','{mxsourceCode }','{code}','{ERPInfo.Instance.UserName}','新增');");
|
||||||
DataTable filetable = BaseImpl.GetDataTableResult($"select sname,fileId,webpath from p_fm_filetab where parentid in (select dirid from P_fm_DirectoryTab where pid = '{code}' and dllcoid = '1000202') and speciesno = '010106' and sname like '{code}%'");
|
DataTable filetable = BaseImpl.GetDataTableResult($"select sname,fileId,webpath from p_fm_filetab where parentid in (select dirid from P_fm_DirectoryTab where pid = '{code}' and dllcoid = '1000202') and speciesno = '010106' and sname like '{code}%'");
|
||||||
fileTableDic[code] = filetable;
|
fileTableDic[code] = filetable;
|
||||||
@@ -1032,10 +1038,10 @@ namespace Lskj.PubBomImport
|
|||||||
throw new Exception($"{childsourceCode}的版次为{childsourceBC},大于最大版次{childMaxBc}\r\n请进行变更");
|
throw new Exception($"{childsourceCode}的版次为{childsourceBC},大于最大版次{childMaxBc}\r\n请进行变更");
|
||||||
}
|
}
|
||||||
childsourceBC = childsourceBC >= childMaxBc ? childsourceBC : childMaxBc;
|
childsourceBC = childsourceBC >= childMaxBc ? childsourceBC : childMaxBc;
|
||||||
if (code.StartsWith("ZZQD"))
|
if (code.StartsWith("QD") || code.StartsWith("ZZQD"))
|
||||||
{
|
{
|
||||||
DataTable zzqdTable = ExcelToDatatable(childInfo.FullName, Model, "", index);
|
DataTable qdTable = ExcelToDatatable(childInfo.FullName, Model, "", index);
|
||||||
DataView filterDataView = new DataView(zzqdTable);
|
DataView filterDataView = new DataView(qdTable);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (!string.IsNullOrEmpty(Model.ReadTableCond))
|
if (!string.IsNullOrEmpty(Model.ReadTableCond))
|
||||||
@@ -1046,8 +1052,20 @@ namespace Lskj.PubBomImport
|
|||||||
catch (Exception)
|
catch (Exception)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
zzqdTable = filterDataView.ToTable();
|
qdTable = filterDataView.ToTable();
|
||||||
foreach (DataRow zzqdItem in zzqdTable.Rows)
|
var qdCodeRows = qdTable.AsEnumerable();
|
||||||
|
foreach (DataRow qdItem in qdTable.Rows)
|
||||||
|
{
|
||||||
|
string qdCode = (qdItem["物料编码"] + "").Trim();
|
||||||
|
int qdCount = qdCodeRows.Where(n => (n["物料编码"] + "").Trim().StartsWith(qdCode)).Count();
|
||||||
|
if (qdCount > 1)//只允许存在一个
|
||||||
|
{
|
||||||
|
throw new Exception($"{childsourceCode}中的{qdCode}重复,请修改");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (code.StartsWith("ZZQD"))
|
||||||
|
{
|
||||||
|
foreach (DataRow zzqdItem in qdTable.Rows)
|
||||||
{
|
{
|
||||||
DataRow childRow = childTable.NewRow();
|
DataRow childRow = childTable.NewRow();
|
||||||
childRow["ProductId"] = (zzqdItem["物料编码"] + "").Trim();
|
childRow["ProductId"] = (zzqdItem["物料编码"] + "").Trim();
|
||||||
@@ -1074,6 +1092,7 @@ namespace Lskj.PubBomImport
|
|||||||
childTable.Rows.Add(childRow);
|
childTable.Rows.Add(childRow);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (filetable.Rows.Count == 0)
|
if (filetable.Rows.Count == 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user