E10——常用函数——SqlValidate

Context.SqlValidate (“SQL语句”,参数列表,参数值列表)

举例:

工单单头“生产批号”字段在维护的时候校验是否存在工单状态是未生产,已发料,生产中的工单引用过该生产批号,如果引用过给警告会保存。

not IsEmpty(ActiveObject.ITEM_LOT_ID) and

Context.SqlValidate("select ITEM_LOT_ID from MO where STATUS in('1','2','3') and ITEM_LOT_ID = @A and MO_ID <> @B",('A','B'),(ActiveObject.ITEM_LOT_ID,ActiveObject.MO_ID))

not IsEmpty(ActiveObject.ITEM_LOT_ID) and

Context.SqlValidate("select ITEM_LOT_ID from MO where STATUS in('1','2','3') and ITEM_LOT_ID = @A and MO_ID <> @B",('A','B'),(ActiveObject.ITEM_LOT_ID,ActiveObject.MO_ID))

 

posted @ 2022-09-05 15:35  AaronLi  阅读(253)  评论(0编辑  收藏  举报