ITPub博客

首页 > Linux操作系统 > Linux操作系统 > SO保留库存

SO保留库存

原创 Linux操作系统 作者:qgw521 时间:2013-07-17 14:55:33 0 删除 编辑

-- Created on 2013-7-8 by ADMINISTRATOR
declare
  -- Local variables here
  l_rsv_rec inv_reservation_global.mtl_reservation_rec_type;
  l_dummy_sn inv_reservation_global.serial_number_tbl_type;
  x_dummy_sn inv_reservation_global.serial_number_tbl_type;
  l_org_id number := 4555;
  l_item_id number := 212959;
  l_header_id number := 3556857; /*mtl_sales_orders.sales_order_id,注意不是oe_order_headers_all.header_id*/
  l_line_id number := 389037;
  x_qty_reserved number;
  x_reserved_id number;
  x_msg_count number;
  x_return_status varchar2(1);
  x_msg_data varchar2(2000);
begin
  -- Test statements here
     mo_global.init('AR');
    mo_global.set_policy_context('S', 4555);
    fnd_global.apps_initialize(1013475,
                               59166,
                               660);
 
    mo_global.init('ONT');
    oe_msg_pub.initialize;
     /*l_rsv_rec.requirement_date := sysdate;
    l_rsv_rec.organization_id := l_org_id;
    l_rsv_rec.inventory_item_id := l_item_id;
    l_rsv_rec.demand_source_type_id := inv_reservation_global.g_source_type_oe; 
    l_rsv_rec.demand_source_name := null;
    l_rsv_rec.demand_source_header_id := l_header_id;
    l_rsv_rec.demand_source_line_id := l_line_id;
  --  l_rsv_rec.primary_uom_code := 'Ea';
  --  l_rsv_rec.reservation_uom_code := 'Ea';
    l_rsv_rec.reservation_quantity := 1;
    l_rsv_rec.primary_reservation_quantity := 1;
    l_rsv_rec.supply_source_type_id := inv_reservation_global.g_source_type_inv;
   l_rsv_rec.ship_ready_flag := null;
    l_rsv_rec.attribute15 := null;
    l_rsv_rec.attribute14 := null;
    l_rsv_rec.attribute13 := null;
    l_rsv_rec.attribute12 := null;
    l_rsv_rec.attribute11 := null;
    l_rsv_rec.attribute10 := null;
    l_rsv_rec.attribute9 := null;
    l_rsv_rec.attribute8 := null;
    l_rsv_rec.attribute7 := null;
    l_rsv_rec.attribute6 := null;
    l_rsv_rec.attribute5 := null;
    l_rsv_rec.attribute4 := null;
    l_rsv_rec.attribute3 := null;
    l_rsv_rec.attribute2 := null;
    l_rsv_rec.attribute1 := null;
    l_rsv_rec.attribute_category := null;
    l_rsv_rec.lpn_id := null;
    l_rsv_rec.pick_slip_number := null;
    l_rsv_rec.lot_number_id := null;
    l_rsv_rec.lot_number := null;
    l_rsv_rec.locator_id := null;
    l_rsv_rec.subinventory_id := null;
    l_rsv_rec.subinventory_code := null;
    l_rsv_rec.revision := null;
    l_rsv_rec.supply_source_line_detail := null;
    l_rsv_rec.supply_source_name := null;
    l_rsv_rec.supply_source_line_id := null;
    l_rsv_rec.supply_source_header_id := null;
    l_rsv_rec.external_source_line_id := null;
    l_rsv_rec.external_source_code := null;
    l_rsv_rec.autodetail_group_id := null;
    l_rsv_rec.reservation_uom_id := null;
    l_rsv_rec.reservation_uom_code := null;
    l_rsv_rec.primary_uom_id := null;
    l_rsv_rec.demand_source_delivery := null;*/
   /* inv_reservation_pub.create_reservation(p_api_version_number => 1.0
                                          ,p_init_msg_lst => fnd_api.G_TRUE
                                          ,x_return_status => x_return_status
                                          ,x_msg_count => x_msg_count
                                          ,x_msg_data => x_msg_data
                                          ,p_rsv_rec => l_rsv_rec
                                          ,p_serial_number => l_dummy_sn
                                          ,x_serial_number => x_dummy_sn
                                          ,x_quantity_reserved => x_qty_reserved
                                          ,x_reservation_id => x_reserved_id);*/
      inv_quantity_tree_pub.clear_quantity_cache; --明明系统上查询物料有保留量,但是保留的时候确说没有保留量,加此语句                                  
      inv_reservation_form_pkg.create_reservation(p_api_version_number   => 1.0,
                                                      p_init_msg_lst         => fnd_api.g_true,
                                                      x_return_status        => x_return_status,
                                                      x_msg_count            => x_msg_count,
                                                      x_msg_data             => x_msg_data,
                                                      p_requirement_date     => SYSDATE,
                                                      p_organization_id      => l_org_id,
                                                      p_inventory_item_id    => l_item_id,
                                                      p_demand_type_id       =>inv_reservation_global.g_source_type_oe,
                                                      p_demand_name          => null, --'Sales order',
                                                      p_demand_header_id     => l_header_id, --MT_SALES_ORDERS --sales_order_id
                                                      p_demand_line_id       => l_line_id, --so_line_id
                                                      p_demand_delivery_id   => NULL,
                                                      p_primary_uom_code     => NULL, --'PCS',
                                                      p_primary_uom_id       => NULL,
                                                      p_reservation_uom_code => NULL, --'PCS',
                                                      p_reservation_uom_id   => NULL,
                                                      p_reservation_quantity => 1,
                                                      p_primary_rsv_quantity => 1,
                                                      p_autodetail_group_id  => NULL,
                                                      p_external_source_code => NULL,
                                                      p_external_source_line => NULL,
                                                      p_supply_type_id       => inv_reservation_global.g_source_type_inv, --17, --pr
                                                      --po_header_id--                                             
                                                      p_supply_header_id => null,
                                                      -- po lication_id
                                                      -- pr requisition_line_id
                                                      p_supply_line_id           => null,
                                                      p_supply_name              => NULL,
                                                      p_supply_line_detail       => NULL,
                                                      p_revision                 => NULL,
                                                      p_subinventory_code        => NULL,
                                                      p_subinventory_id          => NULL,
                                                      p_locator_id               => NULL,
                                                      p_lot_number               => NULL,
                                                      p_lot_number_id            => NULL,
                                                      p_pick_slip_number         => NULL,
                                                      p_lpn_id                   => NULL,
                                                      p_ship_ready_flag          => NULL,
                                                      p_attribute_category       => NULL,
                                                      p_attribute1               => NULL,
                                                      p_attribute2               => NULL,
                                                      p_attribute3               => NULL,
                                                      p_attribute4               => NULL,
                                                      p_attribute5               => NULL,
                                                      p_attribute6               => NULL,
                                                      p_attribute7               => NULL,
                                                      p_attribute8               => NULL,
                                                      p_attribute9               => NULL,
                                                      p_attribute10              => NULL,
                                                      p_attribute11              => NULL,
                                                      p_attribute12              => NULL,
                                                      p_attribute13              => NULL,
                                                      p_attribute14              => NULL,
                                                      p_attribute15              => NULL,
                                                      p_partial_reservation_flag => fnd_api.g_false,
                                                      p_force_reservation_flag   => fnd_api.g_false,
                                                      p_validation_flag          => fnd_api.g_true,
                                                      x_quantity_reserved        => x_qty_reserved,
                                                      x_reservation_id           => x_reserved_id);                                     
    if x_return_status = 'S' then
      dbms_output.put_line('qty reserved:'||x_qty_reserved);
      dbms_output.put_line('reservation id:'||x_reserved_id);
    else
      fnd_msg_pub.Count_And_Get(p_encoded => fnd_api.G_FALSE
                                ,p_count => x_msg_count
                                ,p_data => x_msg_data);
      dbms_output.put_line('msg data:'||x_msg_data);  
      if x_msg_count > 0 then
        for i in 1 .. x_msg_count loop
          dbms_output.put_line(i||':'||substr(fnd_msg_pub.Get(p_msg_index => i,p_encoded => fnd_api.G_FALSE),1,255));
        end loop;
      end if;                      
    end if;                                                             
end;

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/13387766/viewspace-766489/,如需转载,请注明出处,否则将追究法律责任。

上一篇: 创建SO
下一篇: SO保留PO
请登录后发表评论 登录
全部评论

注册时间:2008-06-06

  • 博文量
    128
  • 访问量
    276732