SVN-Revision: r703
This commit is contained in:
wyf
2025-06-09 11:26:54 +00:00
parent be4a6e30ae
commit bf60c2b7ca
+17 -6
View File
@@ -2353,6 +2353,10 @@ namespace Lskj.PubBomImport
string mxDirPath = mxRow["BomFieldNameDir"] + "";
string productId = mxRow["BomMxMainProduct"] + "";
string addState = mxRow["BomMxAddState"] + "";
if (string.IsNullOrEmpty(Model.MainFieldDic))
{
throw new Exception($"字段对应关系配置异常");
}
if (string.IsNullOrEmpty(productId))
{
throw new Exception($"保存失败\r\n请重新进行BOM上传后保存");
@@ -2428,9 +2432,9 @@ namespace Lskj.PubBomImport
SetProcessMsg($"正在导入:{Path.GetFileName(mxInfo.FullName)}");
DataTable childTable = frmBillInfo.GcMainView.GridControl.DataSourceTable().Clone();
var mxCodeRows = parentTable.AsEnumerable();
string[] fieldDic = Model.MainFieldDic.Split(',');
foreach (DataRow parentRow in parentTable.Rows)
{
int.TryParse(parentRow["数量"] + "", out int tamount);
string code = (parentRow["物料编码"] + "").Trim();
int codeCount = mxCodeRows.Where(n => (n["物料编码"] + "").Trim().StartsWith(code)).Count();
if (codeCount > 1)//只允许存在一个
@@ -2438,11 +2442,18 @@ namespace Lskj.PubBomImport
throw new Exception($"文件中的物料编码{code}重复,请修改");
}
DataRow childRow = childTable.NewRow();
childRow["ProductId"] = parentRow["物料编码"] + "";
childRow["appellation"] = parentRow["名称"] + "";
childRow["bak"] = parentRow["备注"] + "";
childRow["tamount"] = parentRow["数量"] + "";
childRow["amount"] = parentRow["数量"] + "";
foreach (string item in fieldDic)
{
string[] fieldArray = item.Split('^');
string key0 = fieldArray[0];
string key1 = fieldArray[1];
childRow[key0] = parentRow[key1] + "";
}
//childRow["ProductId"] = parentRow["物料编码"] + "";
//childRow["appellation"] = parentRow["名称"] + "";
//childRow["bak"] = parentRow["备注"] + "";
//childRow["tamount"] = parentRow["数量"] + "";
//childRow["amount"] = parentRow["数量"] + "";
childTable.Rows.Add(childRow);
}
SetProcessBar(20, 0);