From 598854470b92f7e2919e263dedfd440e59fe8ed3 Mon Sep 17 00:00:00 2001 From: wyf Date: Tue, 29 Apr 2025 07:53:59 +0000 Subject: [PATCH] SVN r514 SVN-Revision: r514 --- 插件库/Lskj.PubBomImport/FrmBillInfo.cs | 3 +- 插件库/Lskj.PubBomImport/FrmProgress.cs | 53 ++++++++++++++++++++----- 2 files changed, 45 insertions(+), 11 deletions(-) diff --git a/插件库/Lskj.PubBomImport/FrmBillInfo.cs b/插件库/Lskj.PubBomImport/FrmBillInfo.cs index eac7908..8365c0e 100644 --- a/插件库/Lskj.PubBomImport/FrmBillInfo.cs +++ b/插件库/Lskj.PubBomImport/FrmBillInfo.cs @@ -219,7 +219,7 @@ namespace Lskj.PubBomImport //MessageUtil.Show("表格中数据内容重复,保存失败!"); return saveResult; } - string billNo = this.lblOrderNo.Text.Trim(); + string billNo = billModel.SaveState ? this.lblOrderNo.Text.Trim() : Guid.NewGuid() + ""; string detailGuid = Guid.NewGuid().ToString(); string masterSql = billModel.SaveState ? GetUpdateRecord(billNo) : GetAddRecord(ref billNo); string detailSql = GetDetailRecord(detailGuid, billNo).ToString(); @@ -341,6 +341,7 @@ namespace Lskj.PubBomImport if (!string.IsNullOrWhiteSpace(errorMessage)) SaveErrorMessage = "表头错误:" + errorMessage; // 增加主键 fieldBuilder.Append(billModel.PrimaryKey); + //valueBuilder.Append("N'" + parmaryValue + "'"); valueBuilder.Append("N'" + parmaryValue + "'"); // 增加红蓝字单标记 fieldBuilder.Append("," + billModel.RtagidKey); diff --git a/插件库/Lskj.PubBomImport/FrmProgress.cs b/插件库/Lskj.PubBomImport/FrmProgress.cs index 0fcedb3..bb33d9a 100644 --- a/插件库/Lskj.PubBomImport/FrmProgress.cs +++ b/插件库/Lskj.PubBomImport/FrmProgress.cs @@ -939,6 +939,8 @@ namespace Lskj.PubBomImport { try { + int.TryParse(Model.FirstRowIndex, out int index); + frmMain.FirstRowIndex = index; bool isUpload = false; string msg = ""; DataRow parentProductRow = BaseImpl.GetDataRowResult($"select top 1 billdocument_id from bom_BillTab where productid='{productId}'"); @@ -972,13 +974,46 @@ namespace Lskj.PubBomImport } if (childInfo != null) { - DataRow childRow = childTable.NewRow(); - childRow["ProductId"] = parentRow["图号"] + ""; - childRow["appellation"] = parentRow["名称"] + ""; - childRow["bak"] = parentRow["备注"] + ""; - childRow["tamount"] = parentRow["套数"] + ""; - childRow["amount"] = parentRow["套数"] + ""; - childTable.Rows.Add(childRow); + if (code.StartsWith("ZZQD")) + { + DataTable zzqdTable = ExcelToDatatable(childInfo.FullName, Model, "", index); + //frmMain.Invoke(new Action(() => + //{ + // zzqdTable = frmMain.ToExcelDataTable(childInfo.FullName, out int count, out int errorCount, true); + //})); + DataView filterDataView = new DataView(zzqdTable); + try + { + if (!string.IsNullOrEmpty(Model.ReadTableCond)) + { + filterDataView.RowFilter = Model.ReadTableCond; + } + } + catch (Exception) + { + } + zzqdTable = filterDataView.ToTable(); + foreach (DataRow zzqdItem in zzqdTable.Rows) + { + DataRow childRow = childTable.NewRow(); + childRow["ProductId"] = zzqdItem["物料编码"] + ""; + childRow["appellation"] = zzqdItem["名称"] + ""; + childRow["bak"] = code; + childRow["tamount"] = parentRow["套数"] + ""; + childRow["amount"] = zzqdItem["数量"] + ""; + childTable.Rows.Add(childRow); + } + } + else + { + DataRow childRow = childTable.NewRow(); + childRow["ProductId"] = parentRow["图号"] + ""; + childRow["appellation"] = parentRow["名称"] + ""; + childRow["bak"] = parentRow["备注"] + ""; + childRow["tamount"] = parentRow["套数"] + ""; + childRow["amount"] = parentRow["套数"] + ""; + childTable.Rows.Add(childRow); + } } } } @@ -1036,8 +1071,6 @@ namespace Lskj.PubBomImport } SetProcessBar(100, (1 / (parentTable.Rows.Count + 1)) * 100); SetProcessLabelAllMsg($"总进度:{1}/{parentTable.Rows.Count + 1}"); - int.TryParse(Model.FirstRowIndex, out int index); - frmMain.FirstRowIndex = index; foreach (DataRow dataRow in parentTable.Rows) { int childIndex = parentTable.Rows.IndexOf(dataRow); @@ -1259,7 +1292,7 @@ namespace Lskj.PubBomImport int.TryParse(execRow["comfirm"] + "", out int comfirm); int.TryParse(execRow["auditFlag"] + "", out int auditFlag); int.TryParse(execRow["newVer"] + "", out int newVer); - string billNo = billWay == 1 ? BillImpl.GetBillNo(billSeq) : execRow["billNo"] + ""; + string billNo = execRow["billNo"] + ""; int result = BillImpl.BillSave(masterSql, detailSql, detailTable, ref billNo, detailGuid, billSeq, billWay, comfirm, out string tipMsg, auditFlag, newVer); if (result == 1) {