昨天User要求撈Shipping資料.同事給了我一段SQL,但因為需要串客製的Table效能不好,資料需求中有一個實際出貨日欄位,為了避免又串到OE_ORDER_LINES_ALL影響效能,於是我抓了wsh_new_deliveries.ultimate_dropoff_date (預計出貨日),同事告訴我,那個欄位不是實際的出貨日期,我才去研究了一下出貨資料表的<實際出貨日>到底是那一個,總結如下:

當Ultimate Ship to Date(Ultimate_dropoff_date )小於Ship Confirm的Actual Depature Date時,系統會保留原值,

但當Ultimate Ship to Date(Ultimate_dropoff_date )大於Ship Confirm的Actual Depature Date時,系統會將他update為實際出貨日

但不管怎麼樣,wsh_new_deliveries.中的(initial_pickup_date)一定會被更新成實際出貨日。

所以呢~~各位如果只需要出貨資料與實際出貨日,抓(initial_pickup_date)就可以了..不用串到OE_ORDER_LINES_ALL

這是我的測試結果與大家分享之~~

『驗證使用SQL』

SELECT wnd.NAME
     , wdd.item_description
     , requested_quantity
     , ooha.order_number "SO"
     , oola.line_number "SO Line"
   --  , oola.line_id
     , oola.actual_shipment_date
     , wnd.ultimate_dropoff_date
     , wnd.initial_pickup_date
  FROM oe_order_headers_all ooha
     , oe_order_lines_all oola
     , wsh_delivery_details wdd
     , wsh_delivery_assignments wda
     , wsh_new_deliveries wnd
 WHERE wdd.source_code = 'OE'
   AND ooha.org_id = 86
   AND ooha.header_id = oola.header_id
   AND wdd.source_line_id = oola.line_id
   AND wdd.source_header_id = ooha.header_id
   AND wdd.delivery_detail_id = wda.delivery_detail_id
   AND wda.delivery_id = wnd.delivery_id
  AND oola.actual_shipment_date <> wnd.initial_pickup_date

arrow
arrow
    全站熱搜

    Somebaby 發表在 痞客邦 留言(0) 人氣()