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