销售订单:限制客户参考编号不能重复
小于 1 分钟
代码示例
--销售订单:限制客户参考编号不能重复
IF @object_type = '17'
BEGIN
IF @transaction_type = 'A'
OR @transaction_type = 'U'
BEGIN
IF EXISTS (
SELECT T0.docentry, T0.[NumAtCard], ts.docentry, Ts.[NumAtCard]
FROM ORDR T0
INNER JOIN (
SELECT T0.[NumAtCard], T0.docentry
FROM ORDR T0
) Ts
ON Ts.[NumAtCard] = T0.[NumAtCard]
AND Ts.docentry <> T0.docentry
WHERE T0.[NumAtCard] IS NOT NULL
AND T0.DocEntry = @list_of_cols_val_tab_del
)
BEGIN
SET @error = 1;
SET @error_message = N'当前客户参考编号已存在! ---- 来源于单据控制:销售订单限制客户参考编号不能重复
';
END;
END;
END