SVN r1056

SVN-Revision: r1056
This commit is contained in:
tdx
2025-11-24 06:14:46 +00:00
parent d11096f254
commit 6b0aeb6229
2 changed files with 49 additions and 33 deletions
+13 -5
View File
@@ -184,7 +184,7 @@ namespace Lskj.PubBomImport
throw new Exception($"MX中只能存在一个ZZQD,请进行合并");
}
}
GetFileCodeInfo(code, out string sourceCode, out string sourceName, out string sourceBB, out int sourceBC);
GetFileCodeInfo(code, out string sourceCode, out string sourceName, out string sourceBB, out int sourceBC, true);
if (sourceBC > 0)
{
throw new Exception($"MX中的{code}不允许有版次");
@@ -197,7 +197,7 @@ namespace Lskj.PubBomImport
string fileName = fileRow["sname"] + "";
string fileId = fileRow["fileId"] + "";
string sname = fileRow["sname"] + "";
GetFileCodeInfo(fileName, out string fileCode, out string name, out string fileBB, out int fileBC);
GetFileCodeInfo(fileName, out string fileCode, out string name, out string fileBB, out int fileBC, false);
if (fileBC >= childMaxBc)
{
childMaxBc = fileBC;
@@ -222,7 +222,7 @@ namespace Lskj.PubBomImport
}
foreach (var selectFile in selectFiles)
{
GetFileCodeInfo(Path.GetFileNameWithoutExtension(selectFile), out string fileCode, out string name, out string fileBB, out int fileBC);
GetFileCodeInfo(selectFile, out string fileCode, out string name, out string fileBB, out int fileBC, false);
if (fileBC >= childMaxBc)
{
maxBc = fileBC;
@@ -2262,7 +2262,7 @@ namespace Lskj.PubBomImport
/// <param name="name"></param>
/// <param name="bb"></param>
/// <param name="bc"></param>
private void GetFileCodeInfo(string sourceCode, out string code, out string name, out string bb, out int bc)
private void GetFileCodeInfo(string sourceCode, out string code, out string name, out string bb, out int bc, bool withoutExtension)
{
string namepattern = @"^(.*-S[A-Z]\d*)(.*)$";
string pattern = @"^(.*?)(\d+)?$";
@@ -2271,7 +2271,15 @@ namespace Lskj.PubBomImport
string childsourceCode = "";
string childsourceBB = "";
int childsourceBC = 0;
Match namematch = Regex.Match(Path.GetFileNameWithoutExtension(sourceCode).Trim(), namepattern);
Match namematch;
if (withoutExtension)
{
namematch = Regex.Match(sourceCode.Trim(), namepattern);
}
else
{
namematch = Regex.Match(Path.GetFileNameWithoutExtension(sourceCode).Trim(), namepattern);
}
if (namematch.Success)
{
childcode = namematch.Groups[1].Value.Trim();