-- 仓库启用仓位的值集维度
SELECT T2.FSTOCKID, T2.FNUMBER, T3.FNAME,T1.FFLEXID 仓位值集维度内码, T31.FNUMBER 仓位值集编码,T31L.FNAME 仓位值集名称 FROM T_BD_STOCKFLEXITEM T1 JOIN T_BAS_FLEXVALUES T31 ON T1.FFLEXID = T31.FID JOIN T_BAS_FLEXVALUES_L T31L ON T31L.FID = T31.FID JOIN T_BD_STOCK T2 ON T1.FSTOCKID = T2.FSTOCKID JOIN T_BD_STOCK_L T3 ON T2.FSTOCKID = T3.FSTOCKID WHERE T2.FSTOCKID = 140723 ORDER BY T2.FSTOCKID
--查看即时库存(T_STK_INVENTORY)和仓位值集维度使用数据(T_BAS_FLEXVALUESDETAIL)
select * from T_STK_INVENTORY where FMATERIALID = 128834 and FSTOCKID = 140723 select * from T_BAS_FLEXVALUESDETAIL where FID = 100017 -- 即时库存仓位FstockLocId关联查询仓位值 select T3.FNUMBER, T31.FNAME, * from T_STK_INVENTORY T1 left JOIN T_BAS_FLEXVALUESDETAIL T2 ON T1.FSTOCKLOCID = T2.FID -- 值集资料维度数据 left join T_BAS_FLEXVALUESENTRY T3 ON T3.FENTRYID = T2.FF100001 -- 仓位值 left join T_BAS_FLEXVALUESENTRY_L T31 ON T31.FENTRYID=T3.FENTRYID and T31.FLOCALEID=2052 --仓位值 left join T_BAS_FLEXVALUES T12 on T3.FID = T12.FID and T12.FFLEXNUMBER = 'FF100001' --仓位值集 -基本信息 where FSTOCKORGID = 100003 and FMATERIALID = 128834 and FSTOCKID = 127842
--查询: 仓库启用仓位的值维度
SELECT T2.FSTOCKID, T2.FNUMBER, T3.FNAME, T4.FFLEXENTRYID AS 仓位值内码, T41.FNUMBER 仓位值编码, T41L.FNAME 仓位值名称, T1.FFLEXID 仓位值集维度内码,T31.FNUMBER 仓位值集编码,T31L.FNAME 仓位值集名称 FROM T_BD_STOCKFLEXITEM T1 JOIN T_BD_STOCKFLEXDETAIL T4 ON T1.FENTRYID = T4.FENTRYID JOIN T_BAS_FLEXVALUES T31 ON T1.FFLEXID = T31.FID JOIN T_BAS_FLEXVALUES_L T31L ON T31L.FID = T31.FID JOIN T_BAS_FLEXVALUESENTRY T41 ON T4.FFLEXENTRYID = T41.FENTRYID JOIN T_BAS_FLEXVALUESENTRY_L T41L ON T41L.FENTRYID = T41.FENTRYID JOIN T_BD_STOCK T2 ON T1.FSTOCKID = T2.FSTOCKID JOIN T_BD_STOCK_L T3 ON T2.FSTOCKID = T3.FSTOCKID WHERE T2.FSTOCKID = 140734 ORDER BY T2.FSTOCKID, T31.FNUMBER, T41.FNUMBER
--根据仓库和库位id查询
select T3.FNUMBER, T31.FNAME
from T_BAS_FLEXVALUESDETAIL T2 -- 值集资料维度数据
left join T_BAS_FLEXVALUESENTRY T3 ON T3.FENTRYID = T2.FF100012 -- 仓位值集值列表
left join T_BAS_FLEXVALUESENTRY_L T31 ON T31.FENTRYID=T3.FENTRYID and T31.FLOCALEID=2052 --仓位值集值列表
left join T_BD_STOCKFLEXDETAIL stod ON T3.FENTRYID=stod.FFLEXENTRYID --仓位
LEFT JOIN T_BD_STOCKFLEXITEM STOx ON stod.FENTRYID=STOx.FENTRYID --仓位值集
left join T_BD_STOCK_L STOL on STOL.FSTOCKID=STOX.FSTOCKID --仓库
where STOL.FSTOCKID = 236313 and T2.FID=100875
推荐阅读