private class OperValidator : AbstractValidator
{
public override void Validate(Kingdee.BOS.Core.ExtendedDataEntity[] dataEntities, ValidateContext validateContext, Kingdee.BOS.Context ctx)
{
//load当前单据meta信息
FormMetadata meta = MetaDataServiceHelper.Load(this.Context, "Esy_IntlogisticsTransporDocument") as FormMetadata;
foreach (var dataEntity in dataEntities)
{
var entity = dataEntity.DataEntity;
//IsPushArgs
//BusinessInfo:meta.BusinessInfo
//entityKey:需要判断的单据体标识
//activeRow:当前明细行数据包
IsPushArgs isPushArgs = new IsPushArgs(meta.BusinessInfo, "FEntity", entity);
var isPush = Kingdee.BOS.ServiceHelper.BusinessFlowDataServiceHelper.IsPush(ctx, isPushArgs);
if (isPush)
{
ValidationErrorInfo ValidationErrorInfo = new ValidationErrorInfo(
string.Empty,
dataEntity["Id"].ToString(),
dataEntity.DataEntityIndex,
dataEntity.RowIndex,
dataEntity["Id"].ToString(),
"该行存在下游数据,无法进行反关闭",
"错误");
validateContext.AddError(null, ValidationErrorInfo);
continue;
}
else
{
}
}
}
}
推荐阅读