|
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。如果您注册时有任何问题请联系客服QQ: 83569622 。
您需要 登录 才可以下载或查看,没有帐号?注册
x
不含标准成本:
SELECT
mh.MONumber
,mh.Planner AS PLN
,mh.WorkCenter AS WC
,mh.MOCreatedDate AS CreatedDate
,ml.MOLineNumber AS LNO
,ml.MOLineType AS LType
,ml.MOLineStatus AS LStat
,ml.NeededDate
,itemp.ItemNumber
,itemp.ItemUM AS UM
,ml.ItemOrderedQuantity AS Qty_Ordered
,ml.ReceiptQuantity AS Qty_Recvd
,itemc.ItemNumber AS Component
,itemc.ItemDescription AS CompDesc
,itemc.ItemUM AS CompUM
,ROUND(dd.RequiredQuantity,itemc.DecimalPrecision) AS Qty_TotalReq
,dd.IssuedQuantity AS Qty_Issued
,CASE WHEN ml.ItemOrderedQuantity<>0 THEN ROUND((dd.IssuedQuantity -dd.RequiredQuantity/ml.ItemOrderedQuantity
* ml.ReceiptQuantity), itemc.DecimalPrecision) ELSE ROUND(dd.IssuedQuantity,itemc.DecimalPrecision) END AS Qty_WIP
,dd.PointOfUseID AS PT_USE
,dd.DemandLevel AS NLVS
,dd.ComponentType AS COM_TYP
FROM
FSDBMR.dbo.FS_MOHeader AS mh,
FSDBMR.dbo.FS_MOLine AS ml,
FSDBMR.dbo.FS_Item AS itemp,
FSDBMR.dbo.FS_Demand AS dd,
FSDBMR.dbo.FS_Item AS itemc
WHERE
mh.MOHeaderKey = ml.MOHeaderKey
AND ml.ItemKey = itemp.ItemKey
AND ml.MOLineKey = dd.TopLevelDemandSupplyKey
AND (dd.ComponentType<>'Y' AND dd.RequiredQuantity>0)
AND dd.ItemKey = itemc.ItemKey
含标准成本:
SELECT
mh.MONumber
,mh.Planner AS PLN
,mh.WorkCenter AS WC
,mh.MOCreatedDate AS CreatedDate
,ml.MOLineNumber AS LNO
,ml.MOLineType AS LType
,ml.MOLineStatus AS LStat
,ml.NeededDate
,itemp.ItemNumber
,itemp.ItemUM AS UM
,ml.ItemOrderedQuantity AS Qty_Ordered
,ml.ReceiptQuantity AS Qty_Recvd
,itemc.ItemNumber AS Component
,itemc.ItemDescription AS CompDesc
,itemc.ItemUM AS CompUM
,ROUND(dd.RequiredQuantity,itemc.DecimalPrecision) AS Qty_TotalReq
,dd.IssuedQuantity AS Qty_Issued
,CASE WHEN ml.ItemOrderedQuantity<>0 THEN ROUND((dd.IssuedQuantity - dd.RequiredQuantity/ml.ItemOrderedQuantity * ml.ReceiptQuantity),itemc.DecimalPrecision) ELSE ROUND(dd.IssuedQuantity,itemc.DecimalPrecision) END AS Qty_WIP
,dd.PointOfUseID AS PT_USE
,dd.DemandLevel AS NLVS
,dd.ComponentType AS COM_TYP
,itmc.TotalRolledCost AS StdCost
FROM
FSDBMR.dbo.FS_MOHeader AS mh,
FSDBMR.dbo.FS_MOLine AS ml,
FSDBMR.dbo.FS_Item AS itemp,
FSDBMR.dbo.FS_Demand AS dd,
FSDBMR.dbo.FS_Item AS itemc
FSDBMR.dbo.FS_ItemCost AS itmc
WHERE
mh.MOHeaderKey = ml.MOHeaderKey
AND ml.ItemKey = itemp.ItemKey
AND ml.MOLineKey = dd.TopLevelDemandSupplyKey
AND (dd.ComponentType<>'Y' AND dd.RequiredQuantity>0)
AND dd.ItemKey = itemc.ItemKey
AND dd.ItemKey=itmc.ItemKey AND (itmc.CostType='0' AND itmc.CostCode='4')
注:查询时,要加上限定条件,对于当前WIP,一般是查询行状态=4
即:AND ml.MOLineStatus=4
[ 本帖最后由 FrankXu 于 2008-10-9 15:15 编辑 ] |
|