跳至主要內容

生产订单:自动更新库存转储申请数量(10.0专用)

五六零网校小于 1 分钟

自定义字段

  • 生产订单行字段:已库存转储申请数 代码:U_YSQS
  • 生产订单行字段:未库存转储申请数 代码:U_WSQS

代码示例

--生产订单:自动更新库存转储申请数量
IF @object_type = '1250000001'
BEGIN

IF @transaction_type = 'A' OR @transaction_type = 'U' 
BEGIN
	UPDATE T0
SET T0.U_YSQS = T1.SQ ,T0.U_WSQS =ISNULL(T0.[PlannedQty],0)- ISNULL(T1.SQ,0)
FROM
	WOR1 T0
LEFT JOIN (
	SELECT
	T0.[RefDocNum] AS'SC',
	T1.[ItemCode],
	SUM (T1.[Quantity]) AS 'SQ'
FROM
	WTQ21 T0
INNER JOIN WTQ1 T1 ON T1.[DocEntry] = T0.[DocEntry]
WHERE
	T0.[RefObjType] = '202'
GROUP BY
	T0.[RefDocNum],
	T1.[ItemCode]
) T1 ON T1.sc = t0.docentry
AND T1.[ItemCode] = t0.itemcode
END
END