直接调拨单明细仓库一致性保存校验实现
一、【业务需求】
直接调拨单控制所有明细行中调出仓库字段一致时才能保存
二、【功能实现】
方案1:BOS扩展配置
1、单据头扩展基础资料字段,绑定"仓库"类型
2、明细"调出仓库"配置值更新,将明细仓库赋值到单据头仓库
3、保存操作添加"单据合法性"校验,比较明细仓库字段和单据头仓库字段是否一致
方案2:二开保存校验器
import clr clr.AddReference('System') clr.AddReference('Kingdee.BOS') clr.AddReference('Kingdee.BOS.Core') from System import * from System import StringComparison from Kingdee.BOS.Core import * from Kingdee.BOS.Core.Metadata.EntityElement import * from Kingdee.BOS.Core.Validation import * from Kingdee.BOS.Log import Logger def OnAddValidators(e): validator = TransferDirectSrcStockIdValidator() validator.AlwaysValidate = True validator.EntityKey = "FBillHead" e.Validators.Add(validator) class TransferDirectSrcStockIdValidator(AbstractValidator): def Validate(self, dataEntities, validateContext, ctx): if len(dataEntities) == 0: return targetStockId = 0 for bill in dataEntities: billEntities = bill["TransferDirectEntry"] if len(billEntities) > 0: targetStockId = str(billEntities[0]["SrcStockId_Id"]) for bill in dataEntities: billEntities = bill["TransferDirectEntry"] countMain = list(filter(lambda x: str(x["SrcStockId_Id"]) != str(targetStockId), billEntities)); if len(countMain) > 0: errorMsg = "明细行调出仓库不一致,校验失败" info = ValidationErrorInfo("",str(bill["Id"]), bill.DataEntityIndex, bill.RowIndex, "调出仓库校验", errorMsg, str(bill["BillNo"]), ErrorLevel.Error) validateContext.AddError(None,info)
直接调拨单明细仓库一致性保存校验实现
一、【业务需求】直接调拨单控制所有明细行中调出仓库字段一致时才能保存二、【功能实现】方案1:BOS扩展配置1、单据头扩展基础资料字段,...
点击下载文档
本文2024-09-16 19:03:53发表“云星空知识”栏目。
本文链接:https://wenku.my7c.com/article/kingdee-k3cloud-26160.html
您需要登录后才可以发表评论, 登录登录 或者 注册
最新文档
热门文章