日期:2014-05-17 浏览次数:21072 次
select p.rackingstarttime intoTime,s.partcode,s.partname,s.factory,s.house, s.mlotno,s.vendorlot,pd.stockinqty intoQty,s.revisionno,'入库' intoType,to_char(U.Fullname) opearterName, null orderNo,s.orderno sapOrderNo,s.reference sapreference,s.movementtype,wm.remark from Pickingdetail pd join Picking p on p.pickingid=pd.pickingid left join sapmlot s on s.sapmlotid=pd.sapmlotid left join "USER" U on U.Userid=pd.racker left join wminventory wm on wm.sapmlotid=pd.sapmlotid [color=#FF0000]and wm.createdtime=min(wm.createdtime)[/color] Where (pd.state=6)
left join (select row_number() over(partition by sapmlotid order by createdtime) rn,sapmlotid,remark from wminventory) wm on wm.sapmlotid=pd.sapmlotid and wm.rn=1