yxj
2022-09-08 0f3a3c9c591ffcde74acce5476083e48b549f95a
条码档案列表模块打印、预览报错修改
2个文件已修改
79 ■■■■■ 已修改文件
BLL/系统公用CLS/GridppReport.cs 77 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
WarM/条码管理/Gy_BarCodeBillList.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
BLL/ϵͳ¹«ÓÃCLS/GridppReport.cs
@@ -536,6 +536,83 @@
        }
        // å°† DataGridView çš„æ•°æ®è½¬å‚¨åˆ° Grid++Report çš„æ•°æ®é›†ä¸­
        public static void FillRecordToReport_Sel(IGridppReport Report, System.Windows.Forms.DataGridView grd, DataTable dt, int FindCol)
        {
            try
            {
                MatchFieldPairType[] MatchFieldPairs = new MatchFieldPairType[Math.Min(Report.DetailGrid.Recordset.Fields.Count, grd.Columns.Count)];
                //根据字段名称与列名称进行匹配,建立DataReader字段与Grid++Report记录集的字段之间的对应关系
                int MatchFieldCount = 0;
                int FixCols = 0;
                DataRow sRow;
                DataColumn sCol;
                //将grd1的数据写入grd2,写入前提,字段名和网格标题 ç›¸åŒ,FindCol为判断是否空行
                int iCol = 0;
                bool bb = false;
                for (int j = 0; j < grd.RowCount; j++) //循环网格1,
                {
                    iCol = 0;
                    if (DBUtility.ClsPub.isStrNull(grd.Rows[j].Cells[FindCol].Value) != "")//是否空行
                    {
                        sRow = dt.NewRow();
                        for (int i = FixCols; i < grd.Columns.Count; ++i)
                        {
                            foreach (IGRField fld in Report.DetailGrid.Recordset.Fields) //从记录集中找到 ç›¸åŒå­—段名
                            {
                                if (String.Compare(fld.Name, grd.Columns[i].HeaderText, true) == 0)
                                {
                                    iCol = iCol + 1;
                                    if (bb == false)
                                    {
                                        sCol = new DataColumn();
                                        sCol.ColumnName = fld.Name;
                                        dt.Columns.Add(sCol);
                                    }
                                    if (DBUtility.ClsPub.isStrNull(grd.Rows[j].Cells[i + FixCols].Value) != "")
                                    {
                                        sRow[iCol - 1] = DBUtility.ClsPub.isStrNull(grd.Rows[j].Cells[i + FixCols].Value);
                                    }
                                }
                            }
                        }
                        dt.Rows.Add(sRow);
                        bb = true;
                    }
                }
                //
                for (int i = 0; i < dt.Columns.Count; ++i)
                {
                    foreach (IGRField fld in Report.DetailGrid.Recordset.Fields)
                    {
                        if (String.Compare(fld.Name, dt.Columns[i].ColumnName, true) == 0)
                        {
                            MatchFieldPairs[MatchFieldCount].grField = fld;
                            MatchFieldPairs[MatchFieldCount].MatchColumnIndex = i;
                            ++MatchFieldCount;
                            break;
                        }
                    }
                }
                // å°† DataTable ä¸­çš„æ¯ä¸€æ¡è®°å½•转储到 Grid++Report çš„æ•°æ®é›†ä¸­åŽ»
                foreach (DataRow dr in dt.Rows)
                {
                    Report.DetailGrid.Recordset.Append();
                    for (int i = 0; i < MatchFieldCount; ++i)
                    {
                        if (!dr.IsNull(MatchFieldPairs[i].MatchColumnIndex))
                            MatchFieldPairs[i].grField.Value = dr[MatchFieldPairs[i].MatchColumnIndex];
                    }
                    Report.DetailGrid.Recordset.Post();
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
            }
        }
        // å°† DataGridView çš„æ•°æ®è½¬å‚¨åˆ° Grid++Report çš„æ•°æ®é›†ä¸­
        public static void FillRecordToReport(IGridppReport Report, DataTable dt_Old, DataTable dt, int FindCol)
WarM/ÌõÂë¹ÜÀí/Gy_BarCodeBillList.cs
@@ -491,7 +491,7 @@
            try
            {
                DataTable ds = new DataTable();
                BLL.Utility.FillRecordToReport(Report, grdMain, ds, Fun_GetCol("选择"));
                BLL.Utility.FillRecordToReport_Sel(Report, grdMain, ds, Fun_GetCol("选择"));
            }
            catch (Exception e)
            {