采购订单:单据编号自动更新为:订单类型+当前年份+单据编号
小于 1 分钟
代码示例
--采购订单:单据编号自动更新为:订单类型+当前年份+单据编号
IF @object_type = '22'
BEGIN
IF @transaction_type = 'A'
OR @transaction_type = 'U'
BEGIN
IF EXISTS (
SELECT T1.[U_LSCK]
FROM OPOR T1
WHERE T1.[DocEntry] = @list_of_cols_val_tab_del
AND T1.U_LSCK IS NULL
)
BEGIN
UPDATE T0
SET T0.[U_LSCK] = T1.[Code] + CAST(year(getdate()) AS NVARCHAR) + CAST(T0.[DocNum] AS NVARCHAR)
FROM OPOR T0
INNER JOIN [dbo].[@DJBH] T1 ON T1.NAME = T0.[U_CKMS]
WHERE T0.[DocEntry] = @list_of_cols_val_tab_del;
END;
END;
END