订单建议-判断物料是否存在备选物料+仅显示Y/N
小于 1 分钟
- 示例代码
DECLARE @BX numeric(19,6)
SELECT @BX= Ts.[qty] FROM OALI T0
LEFT JOIN
(
SELECT T0.[ItemCode], SUM(T0.[OnHand]) AS'qty' FROM OITW T0
GROUP BY T0.[ItemCode]
) Ts ON TS.[ItemCode]=T0.[AltItem]
WHERE T0.[OrigItem]=$[ORCM.ITEMCODE]
IF @BX IS NOT NULL
select N'Y'
IF @BX IS NULL
SELECT N'N'