跳至主要內容

生产发料明细查询

五六零网校小于 1 分钟

提示

逻辑:查询生产发料明细 条件:日期范围必选

代码示例

SELECT T0.[DocNum] AS '发料单号', T0.[DocDate], T1.[BaseRef] AS '生产订单号'
	, CASE 
		WHEN T1.[ItemType] = '290' THEN N'资源'
		WHEN T1.[ItemType] = '4' THEN N'物料'
	END AS '物料类型', T1.[ItemCode], T1.[Dscription], T1.[Quantity], T1.[WhsCode]
	, T2.[WhsName], T1.[Price] AS '物料成本', T1.[LineTotal]
FROM OIGE T0
	INNER JOIN IGE1 T1 ON T0.[DocEntry] = T1.[DocEntry]
	INNER JOIN OWHS T2 ON T1.[WhsCode] = T2.[WhsCode]
WHERE T1.[BaseType] = '202'
	AND T0.[DocDate] >= [%0]
	AND T0.[DocDate] <= [%1]
ORDER BY T0.[DocNum] DESC