From 662b935c9c27fb7f104ce49e5297d34e4bf8895c Mon Sep 17 00:00:00 2001 From: duhe <226547893@qq.com> Date: 星期一, 30 十月 2023 13:17:30 +0800 Subject: [PATCH] 委外加工单:打印只显示表格最后一行数据问题解决 --- WorkM/车间管理/WW_EntrustWorkOrderBill.cs | 8 +++++--- BLL/系统公用CLS/GridppReport.cs | 20 ++++++++++++++++++-- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git "a/BLL/\347\263\273\347\273\237\345\205\254\347\224\250CLS/GridppReport.cs" "b/BLL/\347\263\273\347\273\237\345\205\254\347\224\250CLS/GridppReport.cs" index 2923505..1477752 100644 --- "a/BLL/\347\263\273\347\273\237\345\205\254\347\224\250CLS/GridppReport.cs" +++ "b/BLL/\347\263\273\347\273\237\345\205\254\347\224\250CLS/GridppReport.cs" @@ -326,12 +326,25 @@ grd2.RowCount = 1; grd2.ColumnCount = 0; int iCol = 0; + + + //记录grd中的非空行数,并用于设置grd2的行数 + int grd2RowCount = 0; + int grd2RowIndex = 0; //作为xiang + for (int j = 0; j < grd.RowCount; j++) //循环网格1, + { + if (DBUtility.ClsPub.isStrNull(grd.Rows[j].Cells[FindCol].Value) != "")//是否空行 + { + grd2RowCount = grd2RowCount + 1; + } + } + grd2.RowCount = grd2RowCount; + for (int j = 0; j < grd.RowCount; j++) //循环网格1, { iCol = 0; if (DBUtility.ClsPub.isStrNull(grd.Rows[j].Cells[FindCol].Value) != "")//是否空行 { - grd2.RowCount = grd2.RowCount + 1; for (int i = FixCols; i < grd.Columns.Count; ++i) { foreach (IGRField fld in Report.DetailGrid.Recordset.Fields) //从记录集中找到 相同字段名 @@ -345,10 +358,13 @@ grd2.Columns[grd2.Columns.Count - 1].HeaderText = fld.Name; } if (DBUtility.ClsPub.isStrNull(grd.Rows[j].Cells[i + FixCols].Value) != "") - grd2.Rows[j].Cells[iCol - 1].Value = DBUtility.ClsPub.isStrNull(grd.Rows[j].Cells[i + FixCols].Value); + { + grd2.Rows[grd2RowIndex].Cells[iCol - 1].Value = DBUtility.ClsPub.isStrNull(grd.Rows[j].Cells[i + FixCols].Value); + } } } } + grd2RowIndex = grd2RowIndex + 1; } } //将grd2的数据写入 记录集 diff --git "a/WorkM/\350\275\246\351\227\264\347\256\241\347\220\206/WW_EntrustWorkOrderBill.cs" "b/WorkM/\350\275\246\351\227\264\347\256\241\347\220\206/WW_EntrustWorkOrderBill.cs" index fa7f01e..49cbf9a 100644 --- "a/WorkM/\350\275\246\351\227\264\347\256\241\347\220\206/WW_EntrustWorkOrderBill.cs" +++ "b/WorkM/\350\275\246\351\227\264\347\256\241\347\220\206/WW_EntrustWorkOrderBill.cs" @@ -1454,9 +1454,11 @@ { Report.FieldByName("鍗曟嵁鍙�").AsString = txtHBillNo.Text; Report.FieldByName("鏃ユ湡").AsString = dtpHDate.Value.ToString(); - Report.FieldByName("閮ㄩ棬").AsString = txtHDeptID.Text; - Report.FieldByName("涓氬姟鍛�").AsString = txtHSupID.Text; - Report.FieldByName("琛ㄥご澶囨敞").AsString = txtHRemark.Text; + Report.FieldByName("鐢宠閮ㄩ棬").AsString = txtHDeptID.Text; + Report.FieldByName("澶栧崗渚涘簲鍟�").AsString = txtHSupID.Text; + Report.FieldByName("璁㈠崟璺熻釜鍙�").AsString = txtHOrderProcNO.Text; + Report.FieldByName("瀹℃牳浜�").AsString = txtHChecker.Text; + Report.FieldByName("鍒跺崟浜�").AsString = txtHMaker.Text; } //璧嬪�艰〃浣� private void ReportFetchRecordByDataTable() -- Gitblit v1.9.1