diff --git a/插件库/Lskj.PubBomImport/FrmProgress.cs b/插件库/Lskj.PubBomImport/FrmProgress.cs index 0c48bf1..a676aa0 100644 --- a/插件库/Lskj.PubBomImport/FrmProgress.cs +++ b/插件库/Lskj.PubBomImport/FrmProgress.cs @@ -599,9 +599,9 @@ namespace Lskj.PubBomImport } StringBuilder insertbulider = new StringBuilder(); - string mxCode = BaseImpl.GetResult($"select MxFileName from FileAttachmentMapping where MaterialCode = '{productCode}' and RelatedAttachmentName = '{beforeSourceCode}';") + ""; - insertbulider.AppendLine($"delete FileAttachmentMapping where MaterialCode = '{productCode}' and RelatedAttachmentName = '{beforeSourceCode}';"); - insertbulider.AppendLine($"insert into FileAttachmentMapping (MaterialCode,MxFileName,RelatedAttachmentName,OperatorUser,ChangeStatus) values ('{productCode}','{mxCode}','{sourceCode}','{ERPInfo.Instance.UserName}','变更');"); + string mxCode = BaseImpl.GetResult($"select MxFileName from FileAttachmentMapping where MaterialCode = '{topProductId}' and RelatedAttachmentName = '{beforeSourceCode}';") + ""; + insertbulider.AppendLine($"delete FileAttachmentMapping where MaterialCode = '{topProductId}' and RelatedAttachmentName = '{beforeSourceCode}';"); + insertbulider.AppendLine($"insert into FileAttachmentMapping (MaterialCode,MxFileName,RelatedAttachmentName,OperatorUser,ChangeStatus) values ('{topProductId}','{mxCode}','{sourceCode}','{ERPInfo.Instance.UserName}','变更');"); //更新或新增并备份清单 int.TryParse(Model.FirstRowIndex, out int index); @@ -685,9 +685,9 @@ namespace Lskj.PubBomImport throw new Exception($"变更版次{sourceBC}小于最大版次{childMaxBc}\r\n不允许变更"); } StringBuilder insertbulider = new StringBuilder(); - string mxCode = BaseImpl.GetResult($"select MxFileName from FileAttachmentMapping where MaterialCode = '{productCode}' and RelatedAttachmentName = '{beforeSourceCode}';") + ""; - insertbulider.AppendLine($"delete FileAttachmentMapping where MaterialCode = '{productCode}' and RelatedAttachmentName = '{beforeSourceCode}';"); - insertbulider.AppendLine($"insert into FileAttachmentMapping (MaterialCode,MxFileName,RelatedAttachmentName,OperatorUser,ChangeStatus) values ('{productCode}','{mxCode}','{sourceCode}','{ERPInfo.Instance.UserName}','变更');"); + string mxCode = BaseImpl.GetResult($"select MxFileName from FileAttachmentMapping where MaterialCode = '{topProductId}' and RelatedAttachmentName = '{beforeSourceCode}';") + ""; + insertbulider.AppendLine($"delete FileAttachmentMapping where MaterialCode = '{topProductId}' and RelatedAttachmentName = '{beforeSourceCode}';"); + insertbulider.AppendLine($"insert into FileAttachmentMapping (MaterialCode,MxFileName,RelatedAttachmentName,OperatorUser,ChangeStatus) values ('{topProductId}','{mxCode}','{sourceCode}','{ERPInfo.Instance.UserName}','变更');"); //更新或新增并备份清单 int.TryParse(Model.FirstRowIndex, out int index); frmMain.FirstRowIndex = index; @@ -844,13 +844,13 @@ namespace Lskj.PubBomImport SetProcessMsg($"正在导入:{Path.GetFileName(parentInfo.FullName)}"); DataTable childTable = frmBillInfo.GcMainView.GridControl.DataSourceTable().Clone(); StringBuilder insertbulider = new StringBuilder(); - insertbulider.AppendLine($"delete FileAttachmentMapping where MaterialCode = '{productCode}';"); + insertbulider.AppendLine($"delete FileAttachmentMapping where MaterialCode = '{topProductId}';"); //insertbulider.AppendLine($"insert into FileAttachmentMapping (MaterialCode,MxFileName,RelatedAttachmentName,OperatorUser,ChangeStatus) values ('{productCode}','{sourceCode }','{sourceCode}','{ERPInfo.Instance.UserName}','变更');"); foreach (DataRow parentRow in parentTable.Rows) { int.TryParse(parentRow["套数"] + "", out int tamount); string childCode = parentRow["图号"] + ""; - insertbulider.AppendLine($"insert into FileAttachmentMapping (MaterialCode,MxFileName,RelatedAttachmentName,OperatorUser,ChangeStatus) values ('{productCode}','{sourceCode }','{childCode}','{ERPInfo.Instance.UserName}','变更');"); + insertbulider.AppendLine($"insert into FileAttachmentMapping (MaterialCode,MxFileName,RelatedAttachmentName,OperatorUser,ChangeStatus) values ('{topProductId}','{sourceCode }','{childCode}','{ERPInfo.Instance.UserName}','变更');"); if (childCode.StartsWith("QD") || childCode.StartsWith("ZZQD")) { string tempFileName = childFileDic[childCode];