[Script]Backordered Problematic delivery detail

脚本用于Backorder有问题Delivery Detail(比如关联的Move Order丢失...),可以backorder Delivery后,再重新Pick Release;如果不想要这个订单了,可以Backorder后,Cancel销售订单,并通过NOTE:1322105.1来删除多余的Reservation。

UPDATE wsh_delivery_assignments
SET    delivery_id               = NULL,
       parent_delivery_detail_id = NULL,
       last_updated_by           = -1,
       last_update_date          = SYSDATE
WHERE  delivery_detail_id        = xxxx;

UPDATE      wsh_delivery_details
 SET     released_status         = 'D'
  ,      source_header_id        = -(source_header_id)
  ,      source_line_id          = -(source_line_id)
  ,      source_header_number    = '-'||(source_header_number)
  ,      source_line_number      = '-'||(source_line_number)
  ,      src_requested_quantity  = 0
  ,      src_requested_quantity2 = decode(src_requested_quantity2,NULL,NULL,0)
  ,      requested_quantity      = 0
  ,      requested_quantity2     = decode(requested_quantity2,NULL,NULL,0)
  ,      shipped_quantity        = 0
  ,      shipped_quantity2       = decode(shipped_quantity2,NULL,NULL,0)
  ,      picked_quantity         = 0
  ,      picked_quantity2        = decode(picked_quantity2,NULL,NULL,0)
  ,      cycle_count_quantity    = 0
  ,      cycle_count_quantity2   = decode(src_requested_quantity2,NULL,NULL,0)
  ,      cancelled_quantity      = decode(requested_quantity,0,cancelled_quantity,requested_quantity)
  ,      cancelled_quantity2     = decode(requested_quantity2,NULL,NULL,0,cancelled_quantity2,requested_quantity2)
  ,      subinventory            = NULL
  ,      locator_id              = NULL
  ,      lot_number              = NULL
  ,      serial_number           = NULL
  ,      to_serial_number        = NULL
  ,      transaction_temp_id     = NULL
  ,      revision                = NULL
  ,      ship_set_id             = NULL
  ,      inv_interfaced_flag     = 'X'
  ,      oe_interfaced_flag      = 'X'
  ,      last_updated_by         = -1
  ,      last_update_date        = SYSDATE
WHERE  delivery_detail_id        = xxxx;

Prompt COMMIT to save and ROLLBACK to revert the changes.

转载请注明出处: http://blog.csdn.net/pan_tian/article/details/7697034

你可能感兴趣的:(script)