码迷,mamicode.com
首页 > 其他好文 > 详细

自定义方法实现单据数据过滤

时间:2018-06-04 16:57:40      阅读:144      评论:0      收藏:0      [点我收藏+]

标签:数据过滤

  

本文发布的目的是想跟大家分享下在k3cloud中怎么通过方法查询自己想要的数据集合,废话少说,直接看方法:


    第一种方法:  通过调用系统方法,也就是你把条件给它,剩下的事不用自己搞定,系统帮你搞了! 

   <summary>

         获取被选择的单据行的数据;

         </summary>

         <param name="formid">单据标识</param>

         <param name="fid">主键</param>

       

        public DynamicObjectCollection GetQuerDate(string formid,string fid)

        {

            QueryBuilderParemeter par1 = new QueryBuilderParemeter();

            par1.FormId=formid;

            par1.FilterClauseWihtKey = " fid=" + fid ;

           par1.SelectItems = SelectorItemInfo.CreateItems("FSERIALID", "FMATERIALID", "FENTRYID");

            QueryBuilderParemeter par2 = par1;

            return QueryServiceHelper.GetDynamicObjectCollection(this.Context, par2);


        }


第二种方法:这种需要自己拼接条件得到自己想要的结果集合;

 public DynamicObjectCollection Getdata(string fmaterid,string fserialid)

        {

            StringBuilder str1 = new StringBuilder("/*dialect*/");

            

             str1.AppendFormat(@"select top 1 FACCTGPRICE from ( select  top 1 FBILLID,b.FBILLDATE,b.FBILLNO,b.FBILLFROMID,b.FACCTGPRICE,b.FQTY,b.FORDERNUMBER,STOCKDIM.FMATERIALID,lot.FNUMBER,tce.FNUMBER FCH,

  row_number()over(partition by FMASTERID,tce.FNUMBER order by fbilldate desc) px,b.FBILLENTRYID,FMASTERID

from (select FACCTGID,FBILLDATE,FBILLNO,FBILLFROMID,FACCTGPRICE,FORDERNUMBER,FQTY,FDimeEntryId,FBILLENTRYID,FBILLID from V_HS_OutInStockSeq where FACCTGID>1) b 

inner join (select FENTRYID,FMATERIALID,FLOT from T_HS_InivStockDimension where FENTRYID>1) STOCKDIM on b.FDimeEntryId = STOCKDIM.FENTRYID

left join (select FLOTID,isnull(FNUMBER,'') FNUMBER from T_BD_LOTMASTER where FLOTID>1) LOT on STOCKDIM.FLOT = LOT.FLOTID

left join (select FBILLENTRYID,FLOTID,FBILLFORMID,fbillno from T_BD_LOTMASTERBILLTRACE where FBILLENTRYID>1) tre on tre.FLOTID=STOCKDIM.FLOT and b.FBILLENTRYID=tre.FBILLENTRYID and b.FBILLFROMID=tre.FBILLFORMID and tre.fbillno=b.FBILLNO

left join (  select FBILLFORMID,FBILLENTRYID,fbillno,a.FSERIALID,ter.FNUMBER from T_BD_SERIALBILLTRACE a

 left join T_BD_SERIALBILLTRACE_e b on a.FBILLTRACEID=b.FBILLTRACEID

 left join (select FSERIALID,isnull(FNUMBER,'') FNUMBER from T_BD_SERIALMASTER where FSERIALID>1)  ter on b.FSERIALID=ter.FSERIALID ) tce on tre.FBILLFORMID=tre.FBILLFORMID and tce.FBILLENTRYID=tre.FBILLENTRYID  and tre.fbillno=tce.FBILLNO 

left join T_BD_MATERIAL t on t.FMATERIALID=STOCKDIM.FMATERIALID

where  b.FACCTGPRICE<>0 and t.FMASTERID={0} and  tce.FSERIALID={1}) a where a.px=1", fmaterid, fserialid);

            return DBUtils.ExecuteDynamicObject(this.Context, str1.ToString());



        }


自定义方法实现单据数据过滤

标签:数据过滤

原文地址:http://blog.51cto.com/yataigp/2124632

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!