生产用原料超耗(数量)
小于 1 分钟
代码示例
SELECT t0.DocNum, t0.ItemCode, t3.ItemName AS 产品品名
, CASE t0.Status
WHEN 'C' THEN N'已取消'
WHEN 'L' THEN N'已关闭'
WHEN 'R' THEN N'已批准'
END AS 生产订单状态
, CASE t0.Type
WHEN 'S' THEN N'标准'
WHEN 'D' THEN N'分装'
WHEN 'P' THEN N'特殊的'
END AS 生产订单类型, t0.PlannedQty, t0.CmpltQty, t0.RjctQty AS 不合格数量, t0.PostDate
, t0.DueDate, t1.ItemCode AS 子物料, t2.ItemName, t1.BaseQty, t1.IssuedQty
, t1.IssuedQty / t1.BaseQty AS 可生产数量
, t0.CmpltQty + t0.RjctQty - t1.IssuedQty / t1.BaseQty AS 差异数量
FROM OWOR t0
INNER JOIN WOR1 t1 ON t0.DocEntry = t1.DocEntry
LEFT JOIN OITM t3 ON t0.ItemCode = t3.ItemCode
LEFT JOIN OITM t2 ON t1.ItemCode = t2.ItemCode
WHERE t0.PostDate >= '[%0]'
AND t0.PostDate <= '[%1]'
AND t0.Status <> 'P'
ORDER BY t0.docnum, t0.postdate