From 74dd800ab00da9481f3818cf387296a123aed8cc Mon Sep 17 00:00:00 2001 From: wyf Date: Wed, 14 May 2025 13:41:12 +0000 Subject: [PATCH] SVN r578 SVN-Revision: r578 --- 插件库/Lskj.PubBomImport/FrmProgress.cs | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/插件库/Lskj.PubBomImport/FrmProgress.cs b/插件库/Lskj.PubBomImport/FrmProgress.cs index bcd4632..300ce9f 100644 --- a/插件库/Lskj.PubBomImport/FrmProgress.cs +++ b/插件库/Lskj.PubBomImport/FrmProgress.cs @@ -509,7 +509,7 @@ namespace Lskj.PubBomImport { try { - string namepattern = @"^([A-Z]+(?:-[A-Z]+)*(?:-\d+)+-[A-Z]+\d*)\s*(.*)$"; + string namepattern = @"^(.*-S[A-Z]\d*)(.*)$"; //string namepattern = @"^(.+?)\s+(.+)$"; string pattern = @"^(.*?)(\d+)?$"; string primaryValue = StaticControl.RightMenuMyControl.PrimaryValue; @@ -649,6 +649,12 @@ namespace Lskj.PubBomImport //如果是ZZQD文件 else if (parentInfo != null && (parentInfo.Name.Trim().StartsWith("ZZQD"))) { + ControlModel topcontrolModel = StaticControl.RightMenuMyControl.ControlModels.Where(n => n.LabelText.Equals("顶级编码")).FirstOrDefault(); + if (topcontrolModel == null) + { + MessageUtil.Show($"物料编码不存在"); + } + productCode = StaticControl.RightMenuMyControl.GetControlValue(topcontrolModel); string code = ""; string name = ""; string sourceCode = ""; @@ -737,6 +743,12 @@ namespace Lskj.PubBomImport //如果是MX文件 else if (parentInfo != null && (parentInfo.Name.Trim().StartsWith("MX"))) { + ControlModel topcontrolModel = StaticControl.RightMenuMyControl.ControlModels.Where(n => n.LabelText.Equals("顶级编码")).FirstOrDefault(); + if (topcontrolModel == null) + { + MessageUtil.Show($"物料编码不存在"); + } + productCode = StaticControl.RightMenuMyControl.GetControlValue(topcontrolModel); string code = ""; string name = ""; string sourceCode = ""; @@ -1006,7 +1018,7 @@ namespace Lskj.PubBomImport string name = ""; string newcode = newProductCode.Trim(); string newname = ""; - string namepattern = @"^(.+?)\s+(.+)$"; + string namepattern = @"^(.*-S[A-Z]\d*)(.*)$"; Match newProductCodematch = Regex.Match(Path.GetFileNameWithoutExtension(newProductCode).Trim(), namepattern); Match namematch = Regex.Match(Path.GetFileNameWithoutExtension(parentInfo.Name).Trim(), namepattern); if (namematch.Success) @@ -1680,6 +1692,7 @@ namespace Lskj.PubBomImport string execGuid = sourceRow["qms_wjgg_uuid"] + ""; string productid = sourceRow["qms_wjgg_productid"] + ""; string afterFilename = sourceRow["qms_wjgg_NewFileName"] + ""; + string topProductId = sourceRow["qms_wjgg_Top"] + ""; int.TryParse(sourceRow["fileId"] + "", out int copyFileId); int.TryParse(sourceRow["qms_wjgg_fileId"] + "", out int coverFileId); int coverTag = (sourceRow["qms_wjgg_iscover"] + "").Equals("True") ? 1 : 0; @@ -1702,6 +1715,7 @@ namespace Lskj.PubBomImport { GetFileCodeInfo(afterFilename, out string fileCode, out string name, out string fileBB, out int fileBC); BaseImpl.ExecSqlValue($"update p_bomImportExecTab set success = 1 where guid = '{execGuid}'"); + //BaseImpl.ExecSqlValue($"insert into FileAttachmentMapping(MaterialCode, MxFileName, RelatedAttachmentName) values('{topProductId}', '', '{fileCode}');"); List sqlParamList = new List(); sqlParamList.Add(new SqlParameter("@copyFileId", SqlDbType.Int) { Value = copyFileId }); sqlParamList.Add(new SqlParameter("@copyToModule", SqlDbType.VarChar, 100) { Value = "1000202" }); @@ -2246,7 +2260,7 @@ namespace Lskj.PubBomImport string userId = ERPInfo.Instance.UserId; DateTime uploadTime = DateTime.Now; string code = ""; - string namepattern = @"^(.+?)\s+(.+)$"; + string namepattern = @"^(.*-S[A-Z]\d*)(.*)$"; Match namematch = Regex.Match(Path.GetFileNameWithoutExtension(fileInfo.Name).Trim(), namepattern); if (namematch.Success) { @@ -2393,7 +2407,7 @@ namespace Lskj.PubBomImport /// private void GetFileCodeInfo(string sourceCode, out string code, out string name, out string bb, out int bc) { - string namepattern = @"^([A-Z]+(?:-[A-Z0-9]+)*)(?:\s+(.*))?$"; + string namepattern = @"^(.*-S[A-Z]\d*)(.*)$"; string pattern = @"^(.*?)(\d+)?$"; string childcode = ""; string childname = "";