呆滯物料表

 select t1.fnumber as 物料代碼,t1.FName as 物料名稱,t1.FModel as 規格型號 ,t2.FName as 倉庫, w1.fqty as 即時庫存
 From ICInventory w1,t_ICItem t1,t_Stock t2,t_MeasureUnit t3,t_MeasureUnit t4ide

 Where   w1.FItemID=t1.FItemID And
         w1.FStockID=t2.FItemID And
         w1.FQty<>0 And
         t1.FUnitID=t3.FMeasureUnitID And
         t1.FStoreUnitID=t4.FMeasureUnitID And
 w1.FItemID in
 (
   Select S.FItemID 
     From 
      (Select  v1.FItemID,u1.FDate 
         from ICStockBill u1 
       inner join ICStockBillEntry v1 on u1.FInterID=v1.FInterID And  u1.FCancellation=0 
       Union All 
       Select u1.FItemID,u1.FStockInDate as FDate 
     From  ICInvInitial u1 
     Where u1.Fbegqty <> 0) S 
   group by S.FItemID 
   Having DateDiff(DD, Max(FDate), GetDate()) > 91spa

 )
 And t1.FNumber>='03.01.0001' And t1.FNumber<='03.02.0262' And t2.FTypeID<>502orm

 Group By t1.FItemID,t1.FNumber,t1.FShortNumber,t1.FName,t1.FModel,w1.FBatchNo,
          w1.FStockID,t2.FNumber,t2.FShortNumber,t2.FName,
          t3.FName , t4.FName,w1.fqty
 Order By t1.FNumber,t2.FNumberblog

本文出自 「金蝶軟件技術服務」 博客,請務必保留此出處http://stkingdee.blog.51cto.com/4991988/945320get

相關文章
相關標籤/搜索