select T.*,st.qty 现有量 from ( select '" + strDate + @"' 统计周期,OD.SKU 物料编码, s.descr 物料名称, s.susr1 物料组, SUM(OD.ORIGINALQTY) 需求数, SUM(OD.OPENQTY) 未发运, SUM(OD.QTYALLOCATED) 分配量, SUM(OD.QTYPICKED) 剩余拣货量, SUM(OD.SHIPPEDQTY) 发运量 FROM ORDERS O LEFT JOIN ORDERDETAIL OD ON O.ORDERKEY = OD.ORDERKEY LEFT JOIN sku s ON od.sku = s.sku where (O.STATUS!='95' or (O.STATUS='95' and OD.SHIPPEDQTY>0)) and (:v_Group is null or s.susr1 =:v_Group) and O.Requestedshipdate >= to_date(:v_startdate, 'yyyymmddhh24miss') - 8 / 24 and O.Requestedshipdate <= to_date(:v_enddate, 'yyyymmddhh24miss') - 8 / 24 group by OD.SKU, s.descr,s.susr1 )T left join skuqty st on T.物料编码=st.sku order by T.物料编码; |
最佳回答 |
||||
0
|
|