跳至主要內容

生产订单库存批次查询

五六零网校小于 1 分钟

按所有仓库多行显示

代码示例

SELECT T0.[DocNum] AS '订单号', T0.[PlannedQty], T0.[CmpltQty], T0.[ItemCode], T1.[ItemName]
	, TS.[DistNumber], TS.[WhsCode], TS.[Quantity]
FROM OWOR T0
	INNER JOIN OITM T1 ON T1.itemcode = t0.itemcode
	INNER JOIN (
		SELECT T0.[ItemCode], T0.[DistNumber], T1.[WhsCode], T1.[Quantity]
		FROM OBTN T0
			INNER JOIN OBTQ T1
			ON T0.ITEMCODE = T1.ITEMCODE
				AND T1.[MDAbsEntry] = T0.absentry
	) TS
	ON TS.itemcode = t0.itemcode
ORDER BY TS.[DistNumber]