|
原帖由 Floating_Bottle 于 2009-3-12 09:38 发表 ![]()
looric :
公司用的移动平均成本法.
我想写一个关于仓库价值的查询,库存表whinr140和物料单位成本表whina131找到了,但是我找不到这两个表是通过哪个表关联的.
请问whina131(MAUC)表中的GUID是在哪个表中与item关联的?
谢谢
我们用的是批次成本法。
表whina131中没有数据。以我看来似乎也与此表不会有关系。
下面是一个SQL语句,公司号是104,你可以参考一下。
- select trim(baan.twhwmd215104.t$item) 料号,
- baan.ttcibd001104.t$dsca 描述,
- baan.twhwmd215104.t$cwar || baan.ttcmcs003104.t$dsca 仓库,
- baan.twhinr140104.t$loca || baan.twhwmd300104.t$dsca 库位,
- baan.twhinr140104.t$clot 批次,
- PRICE1.t$pric$1 + nvl(PRICE2.t$pric$1, 0) 合计批次价格,
- baan.twhinr140104.t$qhnd 现有库存,
- (PRICE1.t$pric$1 + nvl(PRICE2.t$pric$1, 0)) *
- baan.twhinr140104.t$qhnd 库存价值
- from baan.twhwmd215104
- left join baan.ttcibd001104 on (baan.twhwmd215104.t$item =
- baan.ttcibd001104.t$item)
- left join baan.twhinr140104 on (baan.twhwmd215104.t$cwar =
- baan.twhinr140104.t$cwar and
- baan.twhwmd215104.t$item =
- baan.twhinr140104.t$item)
- left join baan.ttcmcs003104 on (baan.twhinr140104.t$cwar =
- baan.ttcmcs003104.t$cwar)
- left join baan.twhwmd300104 on (baan.twhinr140104.t$loca =
- baan.twhwmd300104.t$loca)
- left join (select T$ITEM, T$CLOT, SUM(T$PRIC$1) T$PRIC$1
- from baan.twhltc101104
- group by t$item, baan.twhltc101104.t$clot) PRICE1 on (PRICE1.t$clot =
- baan.twhinr140104.t$clot and
- PRICE1.t$item =
- baan.twhinr140104.t$item)
- left join (select T$ITEM, T$CLOT, SUM(T$PRIC$1) T$PRIC$1
- from baan.twhltc104104
- group by t$item, baan.twhltc104104.t$clot) PRICE2 on (PRICE2.t$clot =
- baan.twhinr140104.t$clot and
- PRICE2.t$item =
- baan.twhinr140104.t$item)
- where baan.twhinr140104.t$qhnd <> 0
- order by trim(baan.twhwmd215104.t$item);
复制代码 |
|