操作插件校验器
金蝶云社区-Zw814
Zw814
0人赞赏了该文章 4,847次浏览 未经作者许可,禁止转载编辑于2016年08月29日 15:17:33

校验器中的key值是表体标识,在下面Validate方法中可以获得表体想要的信息,如果同时想获得表头一个字段“FDOCUMENTSTATUS”的信息应该怎么办

public override void OnAddValidators(AddValidatorsEventArgs e)
{
base.OnAddValidators(e);
AddExpenseBudgetAuditValidator validator = new AddExpenseBudgetAuditValidator();
validator.AlwaysValidate = true;
validator.EntityKey = "FEntity";
e.Validators.Add(validator);
}

class AddExpenseBudgetAuditValidator : AbstractValidator
{
public override void Validate(Kingdee.BOS.Core.ExtendedDataEntity[] dataEntities, ValidateContext validateContext, Kingdee.BOS.Context ctx)
{
string strEntryID = string.Empty, strActQty = string.Empty;
Dictionary dicTargetBillInfo = null;
try
{
dicTargetBillInfo = new Dictionary();
if (dataEntities != null && dataEntities.Count() > 0)
{
strEntryID = Convert.ToInt64(dataEntities[0]["Id"]).ToString(); //表体ID
strActQty = dataEntities[0]["FACTQTY"].ToString(); //实装数量
writeBackExpenseBudget(this.Context, dicTargetBillInfo);
}
}
catch (Exception ex)
{
throw new KDBusinessException("错误", "作废失败!");
}
}