SVN-Revision: r612
This commit is contained in:
wyf
2025-05-21 06:12:41 +00:00
parent 83b86610bd
commit 3e96d1263f
2 changed files with 20 additions and 2 deletions
+19 -2
View File
@@ -152,7 +152,16 @@ namespace Lskj.PubBomImport
{
Properties.Settings.Default.LastSelectFolder = dialog.SelectedPath;
string[] fileNames = Directory.GetFiles(dialog.SelectedPath);
string mxFilePath = fileNames.Where(n => Path.GetFileName(n).Trim().StartsWith("MX")).FirstOrDefault();
var mxFileNames = fileNames.Where(n => Path.GetFileName(n).Trim().StartsWith("MX"));
if (mxFileNames.Count() > 1)
{
throw new Exception($"只能存在一个MX文件");
}
if (mxFileNames.Count() <= 0)
{
throw new Exception($"不存在MX文件");
}
string mxFilePath = mxFileNames.FirstOrDefault();
FileInfo parentInfo = new FileInfo(mxFilePath);
List<string> existsFileList = new List<string>();
existsFileList.Add(mxFilePath);
@@ -168,6 +177,14 @@ namespace Lskj.PubBomImport
{
throw new Exception($"MX中的{code}重复");
}
if (code.StartsWith("ZZQD"))
{
int zzqdCount = parentTable.AsEnumerable().Where(n => (n["图号"] + "").Trim().StartsWith("ZZQD")).Count();
if (zzqdCount > 1)
{
throw new Exception($"MX中只能存在一个ZZQD,请进行合并");
}
}
GetFileCodeInfo(code, out string sourceCode, out string sourceName, out string sourceBB, out int sourceBC);
if (sourceBC > 0)
{
@@ -185,7 +202,7 @@ namespace Lskj.PubBomImport
if (fileBC >= childMaxBc)
{
childMaxBc = fileBC;
childMaxSname = $"{fileCode}{(fileBC > 0 ? fileBC + "" : "")}{name}";
childMaxSname = $"{fileCode}{(fileBC > 0 ? fileBC + "" : "")} {name}";
}
}
var selectFiles = fileNames.Where(n => Path.GetFileName(n).Trim().StartsWith(code));
@@ -871,6 +871,7 @@ namespace Lskj.PubBomImport
FrmBillInfo frmBillInfo = new FrmBillInfo();
DataTable parentTable = ExcelToDatatable(mxInfo.FullName, Model, "", 5);
parentTable = parentTable.Rows.Cast<DataRow>().Where(n => int.TryParse(n["序号"] + "", out _) && !string.IsNullOrEmpty(n["图号"] + "") && !string.IsNullOrEmpty(n["名称"] + "")).ToList().CopyToDataTable();
StringBuilder stringBuilder = new StringBuilder();
foreach (DataRow dataRow in parentTable.Rows)
{