|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册账号
×
--nc操作路径:供应链-->库存管理->库存存量查询-->现存量
select org_stockorg.code 组织编码,
org_stockorg.name 组织名称,
meta.code 物料编码,
meta.name 物料名称,
meta.materialspec 到货规则,
bd_measdoc.name 计量单位名称,
onhand.stordoccode 仓库,
onhand.stordocname 仓库名称,
sum(onhand.nonhandnum) 结存数量,
sum(onhand.nnum1) 借入量,
sum(onhand.nnum2) 借出量,
sum(onhand.nlocknum) 冻结数量,
sum(onhand.nrsnum) 预留数量
from (select hand.pk_group pk_group,
hand.pk_org pk_org,
hand.cwarehouseid cwarehouseid,
hand.cmaterialvid cmaterialvid,
hand.cmaterialoid cmaterialoid,
hand.castunitid castunitid,
hand.clocationid clocationid,
hand.pk_batchcode pk_batchcode,
hand.vbatchcode vbatchcode,
hand.vchangerate vchangerate,
hand.cvmivenderid cvmivenderid,
hand.ctplcustomerid ctplcustomerid,
hand.cstateid cstateid,
hand.cvendorid cvendorid,
hand.cprojectid cprojectid,
hand.casscustid casscustid,
hand.cproductorid cproductorid,
hand.cffileid cffileid,
hand.nonhandnum nonhandnum,
hand.nonhandastnum nonhandastnum,
hand.ngrossnum ngrossnum,
hand.nnum1 nnum1,
hand.nastnum1 nastnum1,
hand.ngrossnum1 ngrossnum1,
hand.nnum2 nnum2,
hand.nastnum2 nastnum2,
hand.ngrossnum2 ngrossnum2,
hand.nlocknum nlocknum,
hand.nlockastnum nlockastnum,
hand.nlockgrossnum nlockgrossnum,
hand.nrsnum nrsnum,
hand.nrsastnum nrsastnum,
hand.nrsgrossnum nrsgrossnum,
hand.stordoccode stordoccode,
hand.stordocname stordocname
from (select handdim.pk_group pk_group,
handdim.pk_org pk_org,
handdim.cwarehouseid cwarehouseid,
handdim.cmaterialvid cmaterialvid,
handdim.cmaterialoid cmaterialoid,
handdim.castunitid castunitid,
handdim.clocationid clocationid,
handdim.pk_batchcode pk_batchcode,
handdim.vbatchcode vbatchcode,
handdim.vchangerate vchangerate,
handdim.cvmivenderid cvmivenderid,
handdim.ctplcustomerid ctplcustomerid,
handdim.cstateid cstateid,
handdim.cvendorid cvendorid,
handdim.cprojectid cprojectid,
handdim.casscustid casscustid,
handdim.cproductorid cproductorid,
handdim.cffileid cffileid,
ic_onhandnum.nonhandnum nonhandnum,
ic_onhandnum.nonhandastnum nonhandastnum,
ic_onhandnum.ngrossnum ngrossnum,
ic_onhandnum.nnum1 nnum1,
ic_onhandnum.nastnum1 nastnum1,
ic_onhandnum.ngrossnum1 ngrossnum1,
ic_onhandnum.nnum2 nnum2,
ic_onhandnum.nastnum2 nastnum2,
ic_onhandnum.ngrossnum2 ngrossnum2,
ic_onhandnum.nlocknum nlocknum,
ic_onhandnum.nlockastnum nlockastnum,
ic_onhandnum.nlockgrossnum nlockgrossnum,
ic_onhandnum.nrsnum nrsnum,
ic_onhandnum.nrsastnum nrsastnum,
ic_onhandnum.nrsgrossnum nrsgrossnum,
bd_stordoc.code stordoccode,
bd_stordoc.name stordocname
from ic_onhandnum ic_onhandnum --现存量
inner join ic_onhanddim handdim --现存量维度
on (ic_onhandnum.pk_onhanddim = handdim.pk_onhanddim)
left outer join scm_batchcode scm_batchcode --批次档案
on (handdim.pk_batchcode = scm_batchcode.pk_batchcode)
inner join bd_stordoc bd_stordoc --仓库
on (handdim.cwarehouseid = bd_stordoc.pk_stordoc)) hand) onhand
left outer join bd_material_v meta --物料基本信息
on onhand.cmaterialoid = meta.pk_source
inner join bd_measdoc bd_measdoc
on meta.pk_measdoc = bd_measdoc.pk_measdoc
inner join org_stockorg org_stockorg
on onhand.pk_org = org_stockorg.pk_stockorg --组织_业务单元_库存组织
where org_stockorg.code = '129' --业务单元代码
--and meta.code = '20400002'
group by org_stockorg.code,
org_stockorg.name,
meta.code,
meta.materialmnecode,
meta.name,
meta.materialspec,
meta.materialtype,
meta.graphid,
bd_measdoc.name,
onhand.stordoccode,
onhand.stordocname
having sum(onhand.nonhandnum) <> 0;
|
|