Python实现对单据体某个字段使用正则表达式校验原创
金蝶云社区-_空白_
_空白_
2人赞赏了该文章 552次浏览 未经作者许可,禁止转载编辑于2021年07月28日 17:37:44
from Kingdee.BOS.Core import *
from System.Text.RegularExpressions import *
def BeforeUpdateValue(e):
    if "FDefValue" == e.Key:
        entry = this.View.BusinessInfo.GetEntryEntity("FEntity")
        entryData = this.Model.GetEntityDataObject(entry,e.Row)
        if "A" == str(entryData["ParamId"]["ParamType"]) and not Regex.Match(str(e.Value), "^(0|[1-9][0-9]*)$").Success :
            this.View.ShowErrMessage("数值类型数字!")
            e.Cancel = True
	elif "B" == str(entryData["ParamId"]["ParamType"]) and not Regex.Match(str(e.Value), "^[01]$").Success:
	    this.View.ShowErrMessage("复选框只能输入0或1")
	    e.Cancel = True


赞 2