SVN-Revision: r473
This commit is contained in:
wyf
2025-04-10 06:35:33 +00:00
parent 597e001c61
commit 6ced931f3c
+15 -5
View File
@@ -2640,7 +2640,7 @@ namespace Lskj.PubBill
dataTable.Columns.Add(afterBomFieldName);
dataTable.Columns.Add("BomFieldNameDir");
IEnumerable<DataRow> rowsIEnumerable = sourceTable.Rows.Cast<DataRow>();
string namepattern = @"^(.+?)\s+(.+)$";
string namepattern = @"([A-Za-z]+(-[A-Za-z0-9]+)*-\d+(-\d+)*)";
Dictionary<DataRow, string> filesDic = new Dictionary<DataRow, string>();
foreach (string fileName in impRtnModel.FileNames)
{
@@ -2651,11 +2651,21 @@ namespace Lskj.PubBill
if (namematch.Success)
{
string code = namematch.Groups[1].Value;
string name = namematch.Groups[2].Value;
//找到code相同的行
DataRow selectRow = rowsIEnumerable.Where(n => (n[afterBomFieldName] + "").Trim().StartsWith(code, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
if (selectRow == null)
if (!string.IsNullOrEmpty(code))
{
//找到code相同的行
DataRow selectRow = rowsIEnumerable.Where(n => (n[afterBomFieldName] + "").Trim().StartsWith(code, StringComparison.OrdinalIgnoreCase)).FirstOrDefault();
if (selectRow != null)
{
MessageUtil.Show($"{code}已存在,不允许重复创建");
return;
}
DataRow productRow = BaseImpl.GetDataRowResult($"select top 1 billdocument_id from bom_BillTab where productid like '{code}%'");
if (productRow != null)
{
MessageUtil.Show($"{code}已存在,不允许重复创建");
return;
}
DataRow addRow = dataTable.NewRow();
addRow[afterBomFieldName] = fileNameWithoutExtension;
addRow["BomFieldNameDir"] = fileName;