devexpress XtraReport报表 ---主从报表

Posted 在delphi路上

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了devexpress XtraReport报表 ---主从报表相关的知识,希望对你有一定的参考价值。

private void GetWqpWorkPrinter(List<ReelListMagt> list, string WorkDate, User user)
    {
        ReelListMagtService service = new ReelListMagtService();
        #region 数据源
        DataSet ds = new DataSet();
        DataTable dt_Main = service.GetWqpWorkHeader(list, WorkDate, user).Tables[0];
        dt_Main.TableName = "parent";
        ds.Tables.Add(dt_Main.Copy());
        DataTable dt_detail = service.GetWqpWorkDetailed(list).Tables[0];
        dt_detail.TableName = "child";
        ds.Tables.Add(dt_detail.Copy());
        //设置主表和从表的父子关系  
        DataColumn parentColumn = ds.Tables["parent"].Columns["REEL_NO"];
        DataColumn childColumn = ds.Tables["child"].Columns["REEL_NO"];
        DataRelation R1 = new DataRelation("R1", parentColumn, childColumn);
        ds.Relations.Add(R1);
        #endregion

        this.GroupHeader1.GroupFields.Add(new GroupField("REEL_NO", XRColumnSortOrder.Ascending));

        #region Main
        this.DetailReport.DataSource = ds;
        this.DetailReport.DataMember = "parent";

        LINE_INFO.DataBindings.Add("Text", ds, "LINE_INFO");
        BASIC_MODEL_CODE.DataBindings.Add("Text", ds, "BASIC_MODEL_CODE");
        PO.DataBindings.Add("Text", ds, "PO");
        PGM_ID.DataBindings.Add("Text", ds, "PGM_ID");
        TB_CODE.DataBindings.Add("Text", ds, "TB_CODE");
        MODEL_CODE.DataBindings.Add("Text", ds, "MODEL_CODE");
        PCB.DataBindings.Add("Text", ds, "PCB");
        FW.DataBindings.Add("Text", ds, "FW_NM");
        //
        Barcode.DataBindings.Add("Text", ds, "BARCODE");
        LBLEQUIPID.DataBindings.Add("Text", ds, "EQUIP_ID");//Text = EQUIP_ID;
        LBLLINECODE.DataBindings.Add("Text", ds, "LINE_CODE");//Text = LINE_CODE;
        LBLPRINTER.Text = user.USER_NM;
        LBLPRINTDATE.Text = DateTime.Now.ToString("yyyy-MM-dd hh:MM:ss");
        //--------------------条形码-------------------
        xrBarCode1.DataBindings.Add("Text", ds, "REEL_NO");
        xrBarCode4.DataBindings.Add("Text", ds, "LINE_CODE_EQUIP_ID");//Text = "CHN" + LINE_CODE + EQUIP_ID;
        xrBarCode3.DataBindings.Add("Text", ds, "PGM_ID");
        #endregion

        DetailReport1.DataSource = ds;
        DetailReport1.DataMember = "R1";

        LBLSLOT.DataBindings.Add("Text", ds, "R1.SLOT");
        LBLMATERIAL_CODE.DataBindings.Add("Text", ds, "R1.MATERIAL_CODE");
        LBLDESCRIPTION.DataBindings.Add("Text", ds, "R1.DESCRIPTION");
        LBLSTORAGED_LOC.DataBindings.Add("Text", ds, "R1.STORAGED_LOC");
        LBLUNIT_QTY.DataBindings.Add("Text", ds, "R1.UNIT_QTY");
        LBLFEEDER.DataBindings.Add("Text", ds, "R1.FEEDER_NM");
        LBLLOCATION.DataBindings.Add("Text", ds, "R1.MNTNG_LOC_DESC");
        //------------------条形码-----------------
        xrBarCode2.DataBindings.Add("Text", ds, "R1.BARCODE");
        //在页脚之后设置分页符  
        GroupFooter2.PageBreak = PageBreak.AfterBand;
    }

  

以上是关于devexpress XtraReport报表 ---主从报表的主要内容,如果未能解决你的问题,请参考以下文章

DevExpress XtraReport 报表设计 添加DetailReport

如何在DevExpress XtraReport报表中实现分组行号从新计算

请教devexpress xtrareport问题

DevExpress XtraReport GDI+ 一般错误

XtraReport报表入库单数字转中文大写数字

我用DevExpress 2010.1的ReportViewer做数据显示,但是数据显示不全,是否XtraReport有啥需要设置?