供应商协同开发案例 —— 通用列表与内容过滤原创
金蝶云社区-MiLai
MiLai
6人赞赏了该文章 951次浏览 未经作者许可,禁止转载编辑于2020年08月03日 18:20:40

案例背景:

客户想发布自己的单据到供应商协同模块,并且实现供应商的内容过滤


错误解读:

直接发布企业端单据,无法过滤内容,许可占用等问题。


开发案例:

复制对应业务单据到供应商协同模块,并发布在供应商协同模块。

比如,通版的来料检验单,复制的制造模块的检验单。修改对应的FormId。

image.png


  • 列表过滤代码可以参考如下。

基本思路,借助基类插件AbstractSCPListPlugIn里面的,可以实现FSupplierId的标识过滤,当然了,你可以自己 PrepareFilterParameter 方法,拼接 SQLString 即可实现自定义标识过滤

using Kingdee.BOS.Core.List.PlugIn;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Kingdee.K3.SCM.SCP.Business.PlugIn;

namespace BHR.K3.PSPB.BusinessPlugIn
{
    public class SCPBillList : AbstractSCPListPlugIn
    {
        public override string BillEntryKey
        {
            get { return "EntryKey"; }
        }
    }
    public override void PrepareFilterParameter(Bos.Core.List.PlugIn.Args.FilterArgs e)
    {
        e.AppendQueryFilter(string.Format(" FSupplierId in (SELECT FSUPPLIERID FROM T_BD_SUPPLIER WHERE FMASTERID  = {0}) ", SupplierMasterId));
    }
}

  • 分录过滤的实现思路是在绑定数据后,对不是当前供应商的数据,进行删除

    对分录不符合当前供应商的FSupplierId的进行删除,然后把模型变更设置为false

 public override void BeforeBindData(EventArgs e)
        {
            Entity entity = this.View.BusinessInfo.GetEntryEntity("FEntity");
            DynamicObjectCollection docEntity = this.View.Model.GetEntityDataObject(entity);
            int count = this.View.Model.GetEntryRowCount("FEntity");
            long supplierMasterid = SupplierServiceHelper.GetSupplierMasterIdByUserId(this.Context, this.Context.UserId);
            List<long> lstSupplier = SupplierServiceHelper.GetSupplierIdsByMasterId(this.Context, supplierMasterid);
            for (int i = count - 1; i >= 0; i--)
            {
                if (!lstSupplier.Contains(Convert.ToInt64(docEntity[i]["SupplierId_Id"])))
                {
                    this.View.Model.DeleteEntryRow("FEntity", i);
                }
            }
            this.Model.DataChanged = false;
        }




赞 6