物料号=T0.[ItemCode],
物料描述=T1.[Itemname],
仓库代码= T0.[WhsCode],
仓库名称= T2.[Whsname],
库存中=T0.[OnHand],
已承诺=T0.[IsCommited],
已订购=T0.[OnOrder],
可用库存=T0.[OnHand]- T0.[IsCommited]+T0.[OnOrder],
最小库存=T0.[MinStock],
报警库存=
case when T0.[MinStock]-(T0.[OnHand]- T0.[IsCommited]+T0.[OnOrder])<0 then 0
when T0.[MinStock]-(T0.[OnHand]- T0.[IsCommited]+T0.[OnOrder])<0 then T0.[MinStock]-(T0.[OnHand]- T0.[IsCommited]+T0.[OnOrder])
else 0
end
from oitw T0 left join oitm T1 on T0.[ItemCode]=T1.[ItemCode]
left join owhs T2 on T0.[WhsCode]=T2.[WhsCode]
where T0.[WhsCode]='010301'