SVN-Revision: r578
This commit is contained in:
wyf
2025-05-14 13:41:12 +00:00
parent da1a53eb06
commit 74dd800ab0
+18 -4
View File
@@ -509,7 +509,7 @@ namespace Lskj.PubBomImport
{ {
try try
{ {
string namepattern = @"^([A-Z]+(?:-[A-Z]+)*(?:-\d+)+-[A-Z]+\d*)\s*(.*)$"; string namepattern = @"^(.*-S[A-Z]\d*)(.*)$";
//string namepattern = @"^(.+?)\s+(.+)$"; //string namepattern = @"^(.+?)\s+(.+)$";
string pattern = @"^(.*?)(\d+)?$"; string pattern = @"^(.*?)(\d+)?$";
string primaryValue = StaticControl.RightMenuMyControl.PrimaryValue; string primaryValue = StaticControl.RightMenuMyControl.PrimaryValue;
@@ -649,6 +649,12 @@ namespace Lskj.PubBomImport
//如果是ZZQD文件 //如果是ZZQD文件
else if (parentInfo != null && (parentInfo.Name.Trim().StartsWith("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 code = "";
string name = ""; string name = "";
string sourceCode = ""; string sourceCode = "";
@@ -737,6 +743,12 @@ namespace Lskj.PubBomImport
//如果是MX文件 //如果是MX文件
else if (parentInfo != null && (parentInfo.Name.Trim().StartsWith("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 code = "";
string name = ""; string name = "";
string sourceCode = ""; string sourceCode = "";
@@ -1006,7 +1018,7 @@ namespace Lskj.PubBomImport
string name = ""; string name = "";
string newcode = newProductCode.Trim(); string newcode = newProductCode.Trim();
string newname = ""; string newname = "";
string namepattern = @"^(.+?)\s+(.+)$"; string namepattern = @"^(.*-S[A-Z]\d*)(.*)$";
Match newProductCodematch = Regex.Match(Path.GetFileNameWithoutExtension(newProductCode).Trim(), namepattern); Match newProductCodematch = Regex.Match(Path.GetFileNameWithoutExtension(newProductCode).Trim(), namepattern);
Match namematch = Regex.Match(Path.GetFileNameWithoutExtension(parentInfo.Name).Trim(), namepattern); Match namematch = Regex.Match(Path.GetFileNameWithoutExtension(parentInfo.Name).Trim(), namepattern);
if (namematch.Success) if (namematch.Success)
@@ -1680,6 +1692,7 @@ namespace Lskj.PubBomImport
string execGuid = sourceRow["qms_wjgg_uuid"] + ""; string execGuid = sourceRow["qms_wjgg_uuid"] + "";
string productid = sourceRow["qms_wjgg_productid"] + ""; string productid = sourceRow["qms_wjgg_productid"] + "";
string afterFilename = sourceRow["qms_wjgg_NewFileName"] + ""; string afterFilename = sourceRow["qms_wjgg_NewFileName"] + "";
string topProductId = sourceRow["qms_wjgg_Top"] + "";
int.TryParse(sourceRow["fileId"] + "", out int copyFileId); int.TryParse(sourceRow["fileId"] + "", out int copyFileId);
int.TryParse(sourceRow["qms_wjgg_fileId"] + "", out int coverFileId); int.TryParse(sourceRow["qms_wjgg_fileId"] + "", out int coverFileId);
int coverTag = (sourceRow["qms_wjgg_iscover"] + "").Equals("True") ? 1 : 0; 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); 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($"update p_bomImportExecTab set success = 1 where guid = '{execGuid}'");
//BaseImpl.ExecSqlValue($"insert into FileAttachmentMapping(MaterialCode, MxFileName, RelatedAttachmentName) values('{topProductId}', '', '{fileCode}');");
List<SqlParameter> sqlParamList = new List<SqlParameter>(); List<SqlParameter> sqlParamList = new List<SqlParameter>();
sqlParamList.Add(new SqlParameter("@copyFileId", SqlDbType.Int) { Value = copyFileId }); sqlParamList.Add(new SqlParameter("@copyFileId", SqlDbType.Int) { Value = copyFileId });
sqlParamList.Add(new SqlParameter("@copyToModule", SqlDbType.VarChar, 100) { Value = "1000202" }); sqlParamList.Add(new SqlParameter("@copyToModule", SqlDbType.VarChar, 100) { Value = "1000202" });
@@ -2246,7 +2260,7 @@ namespace Lskj.PubBomImport
string userId = ERPInfo.Instance.UserId; string userId = ERPInfo.Instance.UserId;
DateTime uploadTime = DateTime.Now; DateTime uploadTime = DateTime.Now;
string code = ""; string code = "";
string namepattern = @"^(.+?)\s+(.+)$"; string namepattern = @"^(.*-S[A-Z]\d*)(.*)$";
Match namematch = Regex.Match(Path.GetFileNameWithoutExtension(fileInfo.Name).Trim(), namepattern); Match namematch = Regex.Match(Path.GetFileNameWithoutExtension(fileInfo.Name).Trim(), namepattern);
if (namematch.Success) if (namematch.Success)
{ {
@@ -2393,7 +2407,7 @@ namespace Lskj.PubBomImport
/// <param name="bc"></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)
{ {
string namepattern = @"^([A-Z]+(?:-[A-Z0-9]+)*)(?:\s+(.*))?$"; string namepattern = @"^(.*-S[A-Z]\d*)(.*)$";
string pattern = @"^(.*?)(\d+)?$"; string pattern = @"^(.*?)(\d+)?$";
string childcode = ""; string childcode = "";
string childname = ""; string childname = "";