取数脚本分析:
SELECT T0.FMATERIALID,T0.FNUMBER AS FSNNUMBER FROM T_BD_SERIALMASTER T0 INNER JOIN T_BD_SERIALBILLTRACE T1 ON T0.FSERIALID = T1.FSERIALID INNER JOIN (SELECT MAX(T3.FBILLTRACEID) AS FBILLTRACEID FROM T_BD_SERIALBILLTRACE T3 INNER JOIN (SELECT DISTINCT FSERIALID FROM T_BD_SERIALBILLTRACE WHERE FINVID IN ('XXXX')) T4 ON T4.FSERIALID = T3.FSERIALID WHERE ISNULL(T3.FINVID, ' ') <> ' ' GROUP BY T3.FSERIALID) T2 ON T1.FBILLTRACEID = T2.FBILLTRACEID WHERE T0.FFORBIDSTATUS = 'A' AND T1.FSTATE = '1' AND T1.FINVID IN ('XXXX') ORDER BY T1.FINVID,T0.FNUMBER |
以上为当前版本中即时库存联查序列号取数脚本,如果需要取得即时库存其他维度信息的话,
仅需要再关联 T_STK_INVENTORY IT ON T1.FINVID = IT.FID 即可。
推荐阅读