销售订单:限制行物料单价必须大于对应特殊价格
小于 1 分钟
图片说明
![](/assets/11.5-FKjvwKID.png)
代码示例
--销售订单:限制行物料单价必须大于对应特殊价格
IF @object_type = '17'
BEGIN
IF @transaction_type = 'A'
OR @transaction_type = 'U'
BEGIN
DECLARE @ITEM_560 NVARCHAR(50);;
DECLARE @LINENUM NVARCHAR(20);;
DECLARE @TSPRICE NVARCHAR(50);;
DECLARE @DCPRICE NVARCHAR(20);;
SELECT @ITEM_560 = T1.[ItemCode], @LINENUM = T1.LineNum + 1
, @DCPRICE = T1.Price, @TSPRICE = T2.Price
FROM ORDR T0
INNER JOIN RDR1 T1 ON T0.[DocEntry] = T1.[DocEntry]
INNER JOIN OSPP T2
ON T2.CardCode = T0.CardCode
AND T2.ItemCode = T1.ItemCode
WHERE T1.Price < T2.Price
AND T0.DocEntry = @list_of_cols_val_tab_del
ORDER BY T1.LineNum DESC;;
BEGIN
IF @ITEM_560 IS NOT NULL
BEGIN
SET @error = 1;;
SET @error_message = N'第 ' + @LINENUM + N'行 物料代码: '
+ @ITEM_560 + N' 单价低于特殊价格, ' + N'单据价格: '
+ @DCPRICE + N' 特殊价格为:' + @TSPRICE + N' 请注意检查!';
END;
END;;
END;
END