判断单据或分录是否下推过
一、说明
判断单据是否下推过,主要是通过判断关联节点表中是否存在相应的数据,由于关联节点表存在归档,压缩,所以判断起来比较复杂,故一般通过调用接口来判断
判断整张单据是否下推过
判断分录是否下推过
二、判断是否下推过的代码类
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Kingdee.BOS.Core.Metadata; using Kingdee.BOS.Core.Metadata.EntityElement; using Kingdee.BOS.Core.DependencyRules; using Kingdee.BOS.ServiceHelper; using Kingdee.BOS.Orm.DataEntity; using Kingdee.BOS.Util; using Kingdee.BOS.Core.DynamicForm; namespace Kingdee.BOS.TestPlugIn.Common { public class BillLinkUtil { /// <summary> /// 判断整单是否下推过 /// </summary> /// <param name="ctx"></param> /// <param name="bInfo"></param> /// <param name="dynObj">整单数据包</param> /// <returns></returns> public bool BillIsPush(Context ctx, BusinessInfo bInfo, DynamicObject dynObj) { var linkEntity = bInfo.GetForm().LinkSet.LinkEntitys[0]; var parentEntity = bInfo.GetEntity(linkEntity.ParentEntityKey); DynamicObject parentObj = null;//关联主实体数据包 //关联主实体是单据头,绝大部分关联主实体为单据体,少部分为单据头 if (parentEntity is HeadEntity) { parentObj = dynObj; } else { var entryDynObjs = parentEntity.DynamicProperty.GetValue(dynObj) as DynamicObjectCollection; parentObj = entryDynObjs[0]; } var isLink = this.IsLinkByInterface(ctx, bInfo, parentEntity, parentObj); return isLink; } /// <summary> /// 判断每行分录是否下推过 /// </summary> /// <param name="ctx"></param> /// <param name="bInfo"></param> /// <param name="dynObj"></param> public void EntryIsPush(Context ctx, BusinessInfo bInfo, DynamicObject dynObj) { var linkEntity = bInfo.GetForm().LinkSet.LinkEntitys[0]; var parentEntity = bInfo.GetEntity(linkEntity.ParentEntityKey); var entryDynObjs = parentEntity.DynamicProperty.GetValue(dynObj) as DynamicObjectCollection; //判断每行分录是否下推而来 foreach (var entryObj in entryDynObjs) { var isPush = this.IsLinkByInterface(ctx, bInfo, parentEntity, entryObj); } } /// <summary> /// 调用接口判断是否下推过 /// </summary> /// <param name="ctx"></param> /// <param name="bInfo"></param> /// <param name="parentEntity">关联主实体</param> /// <param name="parentObj">关联主实体对应的主数据包</param> /// <returns></returns> public bool IsLinkByInterface(Context ctx, BusinessInfo bInfo, Entity parentEntity, DynamicObject parentObj) { IResourceServiceProvider provider = bInfo.GetForm().GetFormServiceProvider(); IDynamicFormModelService modelService = provider.GetService(typeof(IDynamicFormModelService)) as IDynamicFormModelService; modelService.SetContext(ctx, bInfo, provider); IDynamicFormModel model = modelService as IDynamicFormModel; var dynamicRow = new BOSDynamicRow(parentObj, parentEntity.Key, model); var isPush = ConvertServiceHelper.IsPush(ctx, bInfo, dynamicRow); return isPush; } } }
三、插件中调用判断代码
表单插件调用判断代码
BillLinkUtil linkUtil = new BillLinkUtil(); linkUtil.BillIsPush(this.Context, this.View.BillBusinessInfo, this.Model.DataObject); linkUtil.EntryIsPush(this.Context, this.View.BillBusinessInfo, this.Model.DataObject);
2. 操作插件中调用判
BillLinkUtil linkUtil = new BillLinkUtil(); linkUtil.BillIsPush(this.Context,this.BusinessInfo, e.DataEntitys[0]); linkUtil.EntryIsPush(this.Context,this.BusinessInfo, e.DataEntitys[0]);
判断单据或分录是否下推过
一、说明判断单据是否下推过,主要是通过判断关联节点表中是否存在相应的数据,由于关联节点表存在归档,压缩,所以判断起来比较复杂,故一...
点击下载文档
本文2024-09-23 03:37:42发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-160055.html
您需要登录后才可以发表评论, 登录登录 或者 注册
最新文档
热门文章