在单据上定义了一个【反离岸】按钮,在操作插件里面写了校验类,为啥不能弹出提示框?
[code]public class DeclareDocAntiOffshoreValidator : AbstractValidator
{
public override void Validate(Kingdee.BOS.Core.ExtendedDataEntity[] dataEntities, ValidateContext validateContext, Kingdee.BOS.Context ctx)
{
//循环获取每张单据数据
foreach (ExtendedDataEntity dataEntity in dataEntities)
{
//来源单据Id
long sourceId = Convert.ToInt64(dataEntity.DataEntity["SourceBillId"]);
//报关单号
string billNo = Convert.ToString(dataEntity.DataEntity["BillNo"]);
//出运明细单下推销售出库单结果集
DynamicObjectCollection result = DBUtils.ExecuteDynamicObject(this.Context, string.Format("SELECT DISTINCT FSHIPDETAILNO FROM T_SAL_OUTSTOCK WHERE FSHIPDETAILNO IN (SELECT DISTINCT FSHIPDETAILNUMBER FROM TPT_FZH_STORAGEGOODSENTRY WHERE FID = '{0}')", sourceId));
if (result.Count > 0)
{
StringBuilder sb = new StringBuilder();
foreach (var obj in result)
{
sb.Append(string.Format(",{0}", Convert.ToString(obj["FSHIPDETAILNO"])));
}
string shipNos = sb.ToString().Substring(1, sb.ToString().Length - 1);
validateContext.AddError(null, new ValidationErrorInfo("AntiOffshore", dataEntity.DataEntity["Id"].ToString(), dataEntity.DataEntityIndex, dataEntity.RowIndex, "AntiOffshore", string.Format("出口报到证({0})对应的出运明细单({1})已有下游单据生成,无法反离岸!", billNo, shipNos), "反离岸确认", ErrorLevel.Error));
}
}
}
}[/code]
推荐阅读