去除系统内置的实体服务规则-物料去除默认仓库对发料仓库的影响
应用场景:去除标准系统内置的实体服务规则,减少业务关联。eg:物料去除默认仓库对发料仓库的影响
1,二开表单插件
using System.Text;
using System.ComponentModel;
using Kingdee.BOS.Core.Bill.PlugIn;
using Kingdee.BOS.Core.DependencyRules;
using Kingdee.BOS.Util;
using Kingdee.BOS.Core.DynamicForm.PlugIn.Args;
using Kingdee.BOS.Core.Metadata.EntityElement;
using Kingdee.BOS.Orm.DataEntity;
using Kingdee.K3.Core.MFG.EntityHelper;
namespace JTSK.Kingdee.K3.MFG.PRD.Business.PlugIn
{
public class MoQtyChangeEdit : AbstractBillPlugIn
{
public override void OnInitialize(global::Kingdee.BOS.Core.DynamicForm.PlugIn.Args.InitializeEventArgs e)
{
base.OnInitialize(e);
System.Collections.ObjectModel.Collection<BOSRule> rules = new System.Collections.ObjectModel.Collection<BOSRule>();
foreach (var rule in this.View.RuleContainer.Rules)
{
if (rule.DependencyFields.Count == 1)
{
string fieldKey = rule.DependencyFields.FirstOrDefault().Field.Key;
//去除默认仓库对发料仓库的影响
//区分是bos配置的还是系统内置,两种形式(实体上配置的服务规则,插件创建的服务规则)
if (fieldKey.EqualsIgnoreCase("FStockId")&&rule.ToString().ConTains("插件创建的服务规则"))
{
rules.Add(rule);
break;
}
}
}
if (!rules.IsEmpty()&&rules.Count<=2)
{
this.View.RuleContainer.Rules.Remove(rules);
}
}
}
}
2,注册到对应单据的表单插件中
去除系统内置的实体服务规则-物料去除默认仓库对发料仓库的影响
本文2024-09-16 17:20:14发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-15040.html