[Script]Backordered Problematic delivery detail

腳本用於Backorder有問題Delivery Detail(比如關聯的Move Order丟失...),可以backorder Delivery後,再重新Pick Release;如果不想要這個訂單了,可以Backorder後,Cancel銷售訂單,並通過NOTE:1322105.1來刪除多餘的Reservation。

  1. UPDATE wsh_delivery_assignments  
  2. SET    delivery_id               = NULL,  
  3.        parent_delivery_detail_id = NULL,  
  4.        last_updated_by           = -1,  
  5.        last_update_date          = SYSDATE  
  6. WHERE  delivery_detail_id        = xxxx;  
  7.   
  8. UPDATE      wsh_delivery_details  
  9.  SET     released_status         = 'D'  
  10.   ,      source_header_id        = -(source_header_id)  
  11.   ,      source_line_id          = -(source_line_id)  
  12.   ,      source_header_number    = '-'||(source_header_number)  
  13.   ,      source_line_number      = '-'||(source_line_number)  
  14.   ,      src_requested_quantity  = 0  
  15.   ,      src_requested_quantity2 = decode(src_requested_quantity2,NULL,NULL,0)  
  16.   ,      requested_quantity      = 0  
  17.   ,      requested_quantity2     = decode(requested_quantity2,NULL,NULL,0)  
  18.   ,      shipped_quantity        = 0  
  19.   ,      shipped_quantity2       = decode(shipped_quantity2,NULL,NULL,0)  
  20.   ,      picked_quantity         = 0  
  21.   ,      picked_quantity2        = decode(picked_quantity2,NULL,NULL,0)  
  22.   ,      cycle_count_quantity    = 0  
  23.   ,      cycle_count_quantity2   = decode(src_requested_quantity2,NULL,NULL,0)  
  24.   ,      cancelled_quantity      = decode(requested_quantity,0,cancelled_quantity,requested_quantity)  
  25.   ,      cancelled_quantity2     = decode(requested_quantity2,NULL,NULL,0,cancelled_quantity2,requested_quantity2)  
  26.   ,      subinventory            = NULL  
  27.   ,      locator_id              = NULL  
  28.   ,      lot_number              = NULL  
  29.   ,      serial_number           = NULL  
  30.   ,      to_serial_number        = NULL  
  31.   ,      transaction_temp_id     = NULL  
  32.   ,      revision                = NULL  
  33.   ,      ship_set_id             = NULL  
  34.   ,      inv_interfaced_flag     = 'X'  
  35.   ,      oe_interfaced_flag      = 'X'  
  36.   ,      last_updated_by         = -1  
  37.   ,      last_update_date        = SYSDATE  
  38. WHERE  delivery_detail_id        = xxxx;  
  39.   
  40. Prompt COMMIT to save and ROLLBACK to revert the changes.  

轉自:http://blog.csdn.net/pan_tian/article/details/7697034
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章