打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
EBS销售订单挑库发放处理程序(转载)

在EBS实施中,经常遇到从外部传进来一个被登记的销售订单,需要通过程序进行销售订单的挑库发放

下面是对SO挑库发放的实现步骤的详细实现:

1. 对销售订单的有效性验证

    1)检查销售订单的行是否被完全传回客户化表

    2)验证销售订单的关键字段

    3)检查子库存是否启用了货位控制,如果启用了货位控制,没有生成货位,则调用API生成货位

    4)调用API检查子库存中的某一个物料的现用量和可用量

2. 销售订单发放

     调用API进行销售订单发放

     发放成功:        返回一个批号,这个批号作为挑库发放的参数

3.  销售订单挑库发放

     调用API进行挑库发放

     发放前             行状态:准备发放           下一步:挑库发放             判断依据:销售订单发放生成的批号作为挑库发放的参数

     发放成功          行状态:已发放至仓库     下一步:处理物料搬运单    判断依据:返回一个批号,这个批号作为挑库发放的参数

     发放失败          行状态:已延交              下一步:挑库发放             判断依据:未成功返回一个批号

     说明:订单发放是按照整个订单发放的。

4. 处理物料搬运单

    处理成功:         行状态:发运                 下一步:                                  判断依据:返回成功的处理状态

    处理成失败         行状态:                       下一步:处理物料搬运单             判断依据:未返回成功的处理状态

5.  得到销售订单的交货号(delivery_id)

     调用API 查看是否产生发运号

     成功:返回发运号

     失败:未返回发运号

6.  发运确认

     处理成功           订单状态为:关闭

     说明:如果发运确认已经成功,则会自动调用 连接形成停靠站 接口程序 

具体实现代码

  1. 对销售订单的有效性验证

      调用API验证货位的代码:

[c-sharp] view plaincopy

  1. fnd_profile.put('MFG_ORGANIZATION_ID',p_organization_id);  

  2. l_locator_type := get_locator_type(p_sub_inv,p_organization_id);          

  3. IF l_locator_type != 1  THEN  

  4.   l_locator  := p_sub_inv || '.' ||  

  5.                 p_project || '.' ||   

  6.                 p_task;  

  7.   inv_loc_wms_pub.create_locator(x_return_status            => l_status,  

  8.                                  x_msg_count                => l_msg_count,  

  9.                                  x_msg_data                 => l_msg_data,  

  10.                                  x_inventory_location_id    => l_locator_id,  

  11.                                  x_locator_exists           => l_locator_exists,  

  12.                                  p_organization_id          => p_organization_id,  

  13.                                  p_organization_code        => p_organization_code,  

  14.                                  p_concatenated_segments    => l_locator,  

  15.                                  p_description              => NULL,  

  16.                                  p_inventory_location_type  => l_locator_type,  

  17.                                  p_picking_order            => NULL,  

  18.                                  p_location_maximum_units   => NULL,  

  19.                                  p_subinventory_code        => p_sub_inv,  

  20.                                  p_location_weight_uom_code => NULL,  

  21.                                  p_max_weight               => NULL,  

  22.                                  p_volume_uom_code          => NULL,  

  23.                                  p_max_cubic_area           => NULL,  

  24.                                  p_x_coordinate             => NULL,  

  25.                                  p_y_coordinate             => NULL,  

  26.                                  p_z_coordinate             => NULL,  

  27.                                  p_physical_location_id     => NULL,  

  28.                                  p_pick_uom_code            => NULL,  

  29.                                  p_dimension_uom_code       => NULL,  

  30.                                  p_length                   => NULL,  

  31.                                  p_width                    => NULL,  

  32.                                  p_height                   => NULL,  

  33.                                  p_status_id                => 1,  

  34.                                  p_dropping_order           => NULL);  

  35.   IF l_locator_id IS NULL THEN  

  36.     o_err_code := g_error;  

  37.     o_err_msg  := '创建(获取)货位弹性域发生错误';  

  38.   ELSE  

  39.     o_locator_id := l_locator_id;  

  40.   END IF;  

[c-sharp] view plain copy

  1. fnd_profile.put('MFG_ORGANIZATION_ID',p_organization_id);  

  2. l_locator_type := get_locator_type(p_sub_inv,p_organization_id);          

  3. IF l_locator_type != 1  THEN  

  4.   l_locator  := p_sub_inv || '.' ||  

  5.                 p_project || '.' ||   

  6.                 p_task;  

  7.   inv_loc_wms_pub.create_locator(x_return_status            => l_status,  

  8.                                  x_msg_count                => l_msg_count,  

  9.                                  x_msg_data                 => l_msg_data,  

  10.                                  x_inventory_location_id    => l_locator_id,  

  11.                                  x_locator_exists           => l_locator_exists,  

  12.                                  p_organization_id          => p_organization_id,  

  13.                                  p_organization_code        => p_organization_code,  

  14.                                  p_concatenated_segments    => l_locator,  

  15.                                  p_description              => NULL,  

  16.                                  p_inventory_location_type  => l_locator_type,  

  17.                                  p_picking_order            => NULL,  

  18.                                  p_location_maximum_units   => NULL,  

  19.                                  p_subinventory_code        => p_sub_inv,  

  20.                                  p_location_weight_uom_code => NULL,  

  21.                                  p_max_weight               => NULL,  

  22.                                  p_volume_uom_code          => NULL,  

  23.                                  p_max_cubic_area           => NULL,  

  24.                                  p_x_coordinate             => NULL,  

  25.                                  p_y_coordinate             => NULL,  

  26.                                  p_z_coordinate             => NULL,  

  27.                                  p_physical_location_id     => NULL,  

  28.                                  p_pick_uom_code            => NULL,  

  29.                                  p_dimension_uom_code       => NULL,  

  30.                                  p_length                   => NULL,  

  31.                                  p_width                    => NULL,  

  32.                                  p_height                   => NULL,  

  33.                                  p_status_id                => 1,  

  34.                                  p_dropping_order           => NULL);  

  35.   IF l_locator_id IS NULL THEN  

  36.     o_err_code := g_error;  

  37.     o_err_msg  := '创建(获取)货位弹性域发生错误';  

  38.   ELSE  

  39.     o_locator_id := l_locator_id;  

  40.   END IF;  

     调用API验证库存现用量和可用量的代码:

[c-sharp] view plaincopy

  1. inv_quantity_tree_pub.query_quantities(p_api_version_number  => 1.0,  

  2.                                             x_return_status       => l_return_status,  

  3.                                             x_msg_count           => l_msg_count,  

  4.                                             x_msg_data            => l_msg_data,  

  5.                                             p_organization_id     => l_organization_id,  

  6.                                             p_inventory_item_id   => rec_data.item_id,--item id  

  7.                                             p_tree_mode           => 2,  

  8.                                             p_is_revision_control => FALSE,  

  9.                                             p_is_lot_control      => l_lot_control_flag,  

  10.                                             p_lot_expiration_date => rec_data.transaction_date,  

  11.                                             p_is_serial_control   => FALSE,  

  12.                                             p_grade_code          => NULL, -- INVCONV      NOT NEEDED NOW                                          

  13.                                             p_revision            => NULL,  

  14.                                             p_lot_number          => NULL,  

  15.                                             p_subinventory_code   => rec_data.pick_from_subinventory,  

  16.                                             p_locator_id          => l_locator_id,  

  17.                                             x_qoh                 => l_qoh,  

  18.                                             x_rqoh                => l_rqoh,  

  19.                                             x_qr                  => l_qr,  

  20.                                             x_qs                  => l_qs,  

  21.                                             x_att                 => l_att,  

  22.                                             x_atr                 => l_atr,  

  23.                                             x_sqoh                => l_sqoh, -- INVCONV                                    

  24.                                             x_srqoh               => l_srqoh, -- INVCONV  

  25.                                             x_sqr                 => l_sqr, -- INVCONV  

  26.                                             x_sqs                 => l_sqs, -- INVCONV  

  27.                                             x_satt                => l_satt, -- INVCONV  

  28.                                             x_satr                => l_satr); -- INVCONV  

  29.      IF nvl(l_atr,0) = 0 THEN  

  30.        GOTO end_loop;  

  31.      END IF;  

[c-sharp] view plain copy

  1. inv_quantity_tree_pub.query_quantities(p_api_version_number  => 1.0,  

  2.                                             x_return_status       => l_return_status,  

  3.                                             x_msg_count           => l_msg_count,  

  4.                                             x_msg_data            => l_msg_data,  

  5.                                             p_organization_id     => l_organization_id,  

  6.                                             p_inventory_item_id   => rec_data.item_id,--item id  

  7.                                             p_tree_mode           => 2,  

  8.                                             p_is_revision_control => FALSE,  

  9.                                             p_is_lot_control      => l_lot_control_flag,  

  10.                                             p_lot_expiration_date => rec_data.transaction_date,  

  11.                                             p_is_serial_control   => FALSE,  

  12.                                             p_grade_code          => NULL, -- INVCONV      NOT NEEDED NOW                                          

  13.                                             p_revision            => NULL,  

  14.                                             p_lot_number          => NULL,  

  15.                                             p_subinventory_code   => rec_data.pick_from_subinventory,  

  16.                                             p_locator_id          => l_locator_id,  

  17.                                             x_qoh                 => l_qoh,  

  18.                                             x_rqoh                => l_rqoh,  

  19.                                             x_qr                  => l_qr,  

  20.                                             x_qs                  => l_qs,  

  21.                                             x_att                 => l_att,  

  22.                                             x_atr                 => l_atr,  

  23.                                             x_sqoh                => l_sqoh, -- INVCONV                                    

  24.                                             x_srqoh               => l_srqoh, -- INVCONV  

  25.                                             x_sqr                 => l_sqr, -- INVCONV  

  26.                                             x_sqs                 => l_sqs, -- INVCONV  

  27.                                             x_satt                => l_satt, -- INVCONV  

  28.                                             x_satr                => l_satr); -- INVCONV  

  29.      IF nvl(l_atr,0) = 0 THEN  

  30.        GOTO end_loop;  

  31.      END IF;  

 2. 销售订单发放

     调用API进行销售订单发放的代码:

[c-sharp] view plaincopy

  1. fnd_profile.PUT('MFG_ORGANIZATION_ID',l_organization_id);  

  2.           wsh_picking_batches_pkg.insert_row(x_rowid                       => l_row_id,  

  3.                                              x_batch_id                    => l_batch_id,  

  4.                                              p_creation_date               => g_sysdate,  

  5.                                              p_created_by                  => g_user_id,  

  6.                                              p_last_update_date            => g_sysdate,  

  7.                                              p_last_updated_by             => g_user_id,  

  8.                                              p_last_update_login           => g_login_id,  

  9.                                              p_batch_name_prefix           => NULL,  

  10.                                              x_name                        => l_name,  

  11.                                              p_backorders_only_flag        => l_rule_rec.backorders_only_flag,  

  12.                                              p_document_set_id             => l_rule_rec.document_set_id,  

  13.                                              p_existing_rsvs_only_flag     => l_rule_rec.existing_rsvs_only_flag,  

  14.                                              p_shipment_priority_code      => l_rule_rec.shipment_priority_code,  

  15.                                              p_ship_method_code            => l_rule_rec.ship_method_code,  

  16.                                              p_customer_id                 => l_customer_id,  

  17.                                              p_order_header_id             => rec_data.order_header_id,  

  18.                                              p_ship_set_number             => l_rule_rec.ship_set_number,  

  19.                                              p_inventory_item_id           => NULL,  

  20.                                              p_order_type_id               => l_order_type_id,  

  21.                                              p_from_requested_date         => NULL,  

  22.                                              p_to_requested_date           => NULL,  

  23.                                              p_from_scheduled_ship_date    => NULL,  

  24.                                              p_to_scheduled_ship_date      => NULL,  

  25.                                              p_ship_to_location_id         => l_rule_rec.ship_to_location_id,  

  26.                                              p_ship_from_location_id       => l_rule_rec.ship_from_location_id/*l_stage_locator_id*/,  

  27.                                              p_trip_id                     => NULL,  

  28.                                              p_delivery_id                 => NULL,  

  29.                                              p_include_planned_lines       => l_rule_rec.include_planned_lines,  

  30.                                              p_pick_grouping_rule_id        => l_rule_rec.pick_grouping_rule_id,  

  31.                                              p_pick_sequence_rule_id       => l_rule_rec.pick_sequence_rule_id,  

  32.                                              p_autocreate_delivery_flag    => 'Y', --l_rule_rec.autocreate_delivery_flag;  

  33.                                              --无论规则是否自动创建交货号,都让系统自动创建(用shipment_number做交货号)  

  34.                                              p_attribute_category          => NULL,  

  35.                                              p_attribute1                  => NULL,  

  36.                                              p_attribute2                  => NULL,  

  37.                                              p_attribute3                  => NULL,  

  38.                                              p_attribute4                  => NULL,  

  39.                                              p_attribute5                  => NULL,  

  40.                                              p_attribute6                  => NULL,  

  41.                                              p_attribute7                  => NULL,  

  42.                                              p_attribute8                  => NULL,  

  43.                                              p_attribute9                  => NULL,  

  44.                                              p_attribute10                 => NULL,  

  45.                                              p_attribute11                 => NULL,  

  46.                                              p_attribute12                 => NULL,  

  47.                                              p_attribute13                 => NULL,  

  48.                                              p_attribute14                 => NULL,  

  49.                                              p_attribute15                 => NULL,  

  50.                                              p_autodetail_pr_flag          => l_rule_rec.autodetail_pr_flag,  

  51.                                              p_carrier_id                  => l_rule_rec.carrier_id,  

  52.                                              p_trip_stop_id                => NULL,  

  53.                                              p_default_stage_subinventory  => l_rule_rec.default_stage_subinventory,--ERP临时发货区  

  54.                                              p_default_stage_locator_id    => l_stage_locator_id,  

  55.                                              p_pick_from_subinventory      => rec_data.pick_from_subinventory,/*l_rule_rec.pick_from_subinventory,*/--ERP提货区  

  56.                                              p_pick_from_locator_id        => l_locator_id,--l_rule_rec.pick_from_locator_id,  

  57.                                              p_auto_pick_confirm_flag      => 'N'/*l_rule_rec.auto_pick_confirm_flag*/,  

  58.                                              --无论规则是否自动确认挑库,都不让系统自动挑库(可能会修改分配数)  

  59.                                              p_delivery_detail_id          => NULL,  

  60.                                              p_project_id                  => rec_data.project_id,  

  61.                                              p_task_id                     => rec_data.task_id,  

  62.                                              p_organization_id             => l_organization_id,  

  63.                                              p_ship_confirm_rule_id        => l_rule_rec.ship_confirm_rule_id,  

  64.                                              p_autopack_flag               => l_rule_rec.autopack_flag,  

  65.                                              p_autopack_level              => l_rule_rec.autopack_level,  

  66.                                              p_task_planning_flag          => l_rule_rec.task_planning_flag,  

  67.                                              p_non_picking_flag            => NULL,  

  68.                                              p_regionid                     => l_rule_rec.region_id,  

  69.                                              p_zoneid                       => l_rule_rec.zone_id,  

  70.                                              p_categoryid                   => l_rule_rec.category_id,  

  71.                                              p_categorysetid               => l_rule_rec.category_set_id,  

  72.                                              p_acdelivcriteria             => l_rule_rec.ac_delivery_criteria,  

  73.                                              p_relsubinventory             => l_rule_rec.rel_subinventory,  

  74.                                                                              --如果规则不做限制则可以任意子库中挑库  

  75.                                                                              --nvl(p_subinventory_from,l_rule_rec.rel_subinventory),  

  76.                                                                              --如果在此处修改来源子库会导致发放不成功 不能创建物料搬运单  

  77.                                              p_append_flag                 => l_rule_rec.append_flag,  

  78.                                              p_task_priority               => l_rule_rec.task_priority,  

  79.                                              p_ship_set_smc_flag           => NULL,  

  80.                                              p_actual_departure_date       => NULL,  

  81.                                              p_allocation_method           => l_rule_rec.allocation_method,  

  82.                                              p_crossdock_criteria_id       => l_rule_rec.crossdock_criteria_id,  

  83.                                              p_delivery_name_lo            => NULL,  

  84.                                              p_delivery_name_hi            => NULL,  

  85.                                              p_bol_number_lo               => NULL,  

  86.                                              p_bol_number_hi               => NULL,  

  87.                                              p_intmed_ship_to_loc_id       => NULL,  

  88.                                              p_pooled_ship_to_loc_id       => NULL,  

  89.                                              p_fob_code                    => NULL,  

  90.                                              p_freight_terms_code          => NULL,  

  91.                                              p_pickup_date_lo              => NULL,  

  92.                                              p_pickup_date_hi              => NULL,  

  93.                                              p_dropoff_date_lo             => NULL,  

  94.                                              p_dropoff_date_hi             => NULL,  

  95.                                              p_planned_flag                => NULL,  

  96.                                              p_selected_batch_id           => NULL);  

  97.           IF l_batch_id IS NULL THEN  

  98.             l_err_code := g_warning;  

  99.             l_err_msg  := '销售订单发放没有产生批号';  

  100.             GOTO next_line;  

  101.           END IF;  

[c-sharp] view plain copy

  1. fnd_profile.PUT('MFG_ORGANIZATION_ID',l_organization_id);  

  2.           wsh_picking_batches_pkg.insert_row(x_rowid                       => l_row_id,  

  3.                                              x_batch_id                    => l_batch_id,  

  4.                                              p_creation_date               => g_sysdate,  

  5.                                              p_created_by                  => g_user_id,  

  6.                                              p_last_update_date            => g_sysdate,  

  7.                                              p_last_updated_by             => g_user_id,  

  8.                                              p_last_update_login           => g_login_id,  

  9.                                              p_batch_name_prefix           => NULL,  

  10.                                              x_name                        => l_name,  

  11.                                              p_backorders_only_flag        => l_rule_rec.backorders_only_flag,  

  12.                                              p_document_set_id             => l_rule_rec.document_set_id,  

  13.                                              p_existing_rsvs_only_flag     => l_rule_rec.existing_rsvs_only_flag,  

  14.                                              p_shipment_priority_code      => l_rule_rec.shipment_priority_code,  

  15.                                              p_ship_method_code            => l_rule_rec.ship_method_code,  

  16.                                              p_customer_id                 => l_customer_id,  

  17.                                              p_order_header_id             => rec_data.order_header_id,  

  18.                                              p_ship_set_number             => l_rule_rec.ship_set_number,  

  19.                                              p_inventory_item_id           => NULL,  

  20.                                              p_order_type_id               => l_order_type_id,  

  21.                                              p_from_requested_date         => NULL,  

  22.                                              p_to_requested_date           => NULL,  

  23.                                              p_from_scheduled_ship_date    => NULL,  

  24.                                              p_to_scheduled_ship_date      => NULL,  

  25.                                              p_ship_to_location_id         => l_rule_rec.ship_to_location_id,  

  26.                                              p_ship_from_location_id       => l_rule_rec.ship_from_location_id/*l_stage_locator_id*/,  

  27.                                              p_trip_id                     => NULL,  

  28.                                              p_delivery_id                 => NULL,  

  29.                                              p_include_planned_lines       => l_rule_rec.include_planned_lines,  

  30.                                              p_pick_grouping_rule_id        => l_rule_rec.pick_grouping_rule_id,  

  31.                                              p_pick_sequence_rule_id       => l_rule_rec.pick_sequence_rule_id,  

  32.                                              p_autocreate_delivery_flag    => 'Y', --l_rule_rec.autocreate_delivery_flag;  

  33.                                              --无论规则是否自动创建交货号,都让系统自动创建(用shipment_number做交货号)  

  34.                                              p_attribute_category          => NULL,  

  35.                                              p_attribute1                  => NULL,  

  36.                                              p_attribute2                  => NULL,  

  37.                                              p_attribute3                  => NULL,  

  38.                                              p_attribute4                  => NULL,  

  39.                                              p_attribute5                  => NULL,  

  40.                                              p_attribute6                  => NULL,  

  41.                                              p_attribute7                  => NULL,  

  42.                                              p_attribute8                  => NULL,  

  43.                                              p_attribute9                  => NULL,  

  44.                                              p_attribute10                 => NULL,  

  45.                                              p_attribute11                 => NULL,  

  46.                                              p_attribute12                 => NULL,  

  47.                                              p_attribute13                 => NULL,  

  48.                                              p_attribute14                 => NULL,  

  49.                                              p_attribute15                 => NULL,  

  50.                                              p_autodetail_pr_flag          => l_rule_rec.autodetail_pr_flag,  

  51.                                              p_carrier_id                  => l_rule_rec.carrier_id,  

  52.                                              p_trip_stop_id                => NULL,  

  53.                                              p_default_stage_subinventory  => l_rule_rec.default_stage_subinventory,--ERP临时发货区  

  54.                                              p_default_stage_locator_id    => l_stage_locator_id,  

  55.                                              p_pick_from_subinventory      => rec_data.pick_from_subinventory,/*l_rule_rec.pick_from_subinventory,*/--ERP提货区  

  56.                                              p_pick_from_locator_id        => l_locator_id,--l_rule_rec.pick_from_locator_id,  

  57.                                              p_auto_pick_confirm_flag      => 'N'/*l_rule_rec.auto_pick_confirm_flag*/,  

  58.                                              --无论规则是否自动确认挑库,都不让系统自动挑库(可能会修改分配数)  

  59.                                              p_delivery_detail_id          => NULL,  

  60.                                              p_project_id                  => rec_data.project_id,  

  61.                                              p_task_id                     => rec_data.task_id,  

  62.                                              p_organization_id             => l_organization_id,  

  63.                                              p_ship_confirm_rule_id        => l_rule_rec.ship_confirm_rule_id,  

  64.                                              p_autopack_flag               => l_rule_rec.autopack_flag,  

  65.                                              p_autopack_level              => l_rule_rec.autopack_level,  

  66.                                              p_task_planning_flag          => l_rule_rec.task_planning_flag,  

  67.                                              p_non_picking_flag            => NULL,  

  68.                                              p_regionid                     => l_rule_rec.region_id,  

  69.                                              p_zoneid                       => l_rule_rec.zone_id,  

  70.                                              p_categoryid                   => l_rule_rec.category_id,  

  71.                                              p_categorysetid               => l_rule_rec.category_set_id,  

  72.                                              p_acdelivcriteria             => l_rule_rec.ac_delivery_criteria,  

  73.                                              p_relsubinventory             => l_rule_rec.rel_subinventory,  

  74.                                                                              --如果规则不做限制则可以任意子库中挑库  

  75.                                                                              --nvl(p_subinventory_from,l_rule_rec.rel_subinventory),  

  76.                                                                              --如果在此处修改来源子库会导致发放不成功 不能创建物料搬运单  

  77.                                              p_append_flag                 => l_rule_rec.append_flag,  

  78.                                              p_task_priority               => l_rule_rec.task_priority,  

  79.                                              p_ship_set_smc_flag           => NULL,  

  80.                                              p_actual_departure_date       => NULL,  

  81.                                              p_allocation_method           => l_rule_rec.allocation_method,  

  82.                                              p_crossdock_criteria_id       => l_rule_rec.crossdock_criteria_id,  

  83.                                              p_delivery_name_lo            => NULL,  

  84.                                              p_delivery_name_hi            => NULL,  

  85.                                              p_bol_number_lo               => NULL,  

  86.                                              p_bol_number_hi               => NULL,  

  87.                                              p_intmed_ship_to_loc_id       => NULL,  

  88.                                              p_pooled_ship_to_loc_id       => NULL,  

  89.                                              p_fob_code                    => NULL,  

  90.                                              p_freight_terms_code          => NULL,  

  91.                                              p_pickup_date_lo              => NULL,  

  92.                                              p_pickup_date_hi              => NULL,  

  93.                                              p_dropoff_date_lo             => NULL,  

  94.                                              p_dropoff_date_hi             => NULL,  

  95.                                              p_planned_flag                => NULL,  

  96.                                              p_selected_batch_id           => NULL);  

  97.           IF l_batch_id IS NULL THEN  

  98.             l_err_code := g_warning;  

  99.             l_err_msg  := '销售订单发放没有产生批号';  

  100.             GOTO next_line;  

  101.           END IF;  

   销售订单发放生成的批号作为步骤3的参数

 3. 销售订单挑库发放 

    调用API进行挑库发放的代码:

[c-sharp] view plaincopy

  1. wsh_pick_list.online_release(p_batch_id    => l_batch_id,  

  2.                                       p_pick_result => l_pick_result,  

  3.                                       p_pick_phase  => l_pick_phase,  

  4.                                       p_pick_skip   => l_pick_skip);  

  5.          --F:Failure  

  6.          IF nvl(l_pick_result,'F') = 'F' THEN  

  7.            IF (nvl(l_pick_phase,'START') = 'MOVE_ORDER_LINES') THEN  

  8.              l_err_code := g_warning;  

  9.              l_err_msg  := '联机挑库发放已部分完成。未完全处理物料搬运单:' || l_batch_id;  

  10.            ELSE  

  11.              l_err_code := g_warning;  

  12.              l_err_msg  := '联机挑库发放失败。请在并发模式下发放订单:' || l_batch_id;  

  13.            END IF;  

  14.          ELSIF nvl(l_pick_skip,'Y') = 'Y' THEN  

  15.            l_err_code := g_warning;  

  16.            l_err_msg  := '联机挑库发放已结束但出现警告。请检查“发运例外报表”';  

  17.          --即使部分挑库成功也不继续处理  

  18.          ELSIF nvl(l_pick_result,'F') = 'W' THEN  

  19.            IF nvl(l_pick_phase,'START') = 'MOVE_ORDER_LINES' THEN  

  20.              l_err_code := g_warning;  

  21.              l_err_msg  := '联机挑库发放已部分完成,但出现警告。';  

  22.            ELSE  

  23.              l_err_code := g_warning;  

  24.              l_err_msg  := '联机挑库发放已结束但出现警告。请检查“发运例外报表”';  

  25.            END IF;  

  26.          ELSIF nvl(l_pick_result,'F') = 'S' THEN  

  27.            NULL;  

  28.          END IF;  

[c-sharp] view plain copy

  1. wsh_pick_list.online_release(p_batch_id    => l_batch_id,  

  2.                                       p_pick_result => l_pick_result,  

  3.                                       p_pick_phase  => l_pick_phase,  

  4.                                       p_pick_skip   => l_pick_skip);  

  5.          --F:Failure  

  6.          IF nvl(l_pick_result,'F') = 'F' THEN  

  7.            IF (nvl(l_pick_phase,'START') = 'MOVE_ORDER_LINES') THEN  

  8.              l_err_code := g_warning;  

  9.              l_err_msg  := '联机挑库发放已部分完成。未完全处理物料搬运单:' || l_batch_id;  

  10.            ELSE  

  11.              l_err_code := g_warning;  

  12.              l_err_msg  := '联机挑库发放失败。请在并发模式下发放订单:' || l_batch_id;  

  13.            END IF;  

  14.          ELSIF nvl(l_pick_skip,'Y') = 'Y' THEN  

  15.            l_err_code := g_warning;  

  16.            l_err_msg  := '联机挑库发放已结束但出现警告。请检查“发运例外报表”';  

  17.          --即使部分挑库成功也不继续处理  

  18.          ELSIF nvl(l_pick_result,'F') = 'W' THEN  

  19.            IF nvl(l_pick_phase,'START') = 'MOVE_ORDER_LINES' THEN  

  20.              l_err_code := g_warning;  

  21.              l_err_msg  := '联机挑库发放已部分完成,但出现警告。';  

  22.            ELSE  

  23.              l_err_code := g_warning;  

  24.              l_err_msg  := '联机挑库发放已结束但出现警告。请检查“发运例外报表”';  

  25.            END IF;  

  26.          ELSIF nvl(l_pick_result,'F') = 'S' THEN  

  27.            NULL;  

  28.          END IF;  

4.  处理物料搬运单

     调用API处理物料搬运单的代码:

[c-sharp] view plaincopy

  1. get_move_order_line_id(p_order_line_id      => rec_data.line_id,  

  2.                                o_move_order_line_id => l_mv_line_id,  

  3.                                o_mv_status          => l_mv_status,  

  4.                                o_err_code           => l_err_code,  

  5.                                o_err_msg            => l_err_msg);  

  6.         IF l_err_code IS NOT NULL THEN  

  7.           GOTO next_line;  

  8.         END IF;  

  9.         <<move_order>>  

  10.         l_trolin_tbl := inv_trolin_util.query_rows(p_line_id => l_mv_line_id);  

  11.         l_mold_tbl   := inv_mo_line_detail_util.query_rows(p_line_id => l_mv_line_id);  

  12.         inv_pick_wave_pick_confirm_pub.pick_confirm(p_api_version_number  => 1.0,  

  13.                                                     p_init_msg_list       => fnd_api.g_false,  

  14.                                                     p_commit              => fnd_api.g_false,  

  15.                                                     x_return_status       => l_return_status,  

  16.                                                     x_msg_count           => l_msg_count,  

  17.                                                     x_msg_data            => l_msg_data,  

  18.                                                     p_move_order_type     => 3,  

  19.                                                     p_transaction_mode    => 1,  

  20.                                                     p_trolin_tbl          => l_trolin_tbl,  

  21.                                                     p_mold_tbl            => l_mold_tbl,  

  22.                                                     x_mmtt_tbl            => l_mold_tbl,  

  23.                                                     x_trolin_tbl          => l_trolin_tbl);  

  24.         IF l_return_status != fnd_api.g_ret_sts_success THEN  

  25.           l_err_code := g_warning;  

  26.           l_err_msg  := '处理物料搬运单失败';  

  27.           GOTO next_line;  

  28.         END IF;  

[c-sharp] view plain copy

  1. get_move_order_line_id(p_order_line_id      => rec_data.line_id,  

  2.                                o_move_order_line_id => l_mv_line_id,  

  3.                                o_mv_status          => l_mv_status,  

  4.                                o_err_code           => l_err_code,  

  5.                                o_err_msg            => l_err_msg);  

  6.         IF l_err_code IS NOT NULL THEN  

  7.           GOTO next_line;  

  8.         END IF;  

  9.         <<move_order>>  

  10.         l_trolin_tbl := inv_trolin_util.query_rows(p_line_id => l_mv_line_id);  

  11.         l_mold_tbl   := inv_mo_line_detail_util.query_rows(p_line_id => l_mv_line_id);  

  12.         inv_pick_wave_pick_confirm_pub.pick_confirm(p_api_version_number  => 1.0,  

  13.                                                     p_init_msg_list       => fnd_api.g_false,  

  14.                                                     p_commit              => fnd_api.g_false,  

  15.                                                     x_return_status       => l_return_status,  

  16.                                                     x_msg_count           => l_msg_count,  

  17.                                                     x_msg_data            => l_msg_data,  

  18.                                                     p_move_order_type     => 3,  

  19.                                                     p_transaction_mode    => 1,  

  20.                                                     p_trolin_tbl          => l_trolin_tbl,  

  21.                                                     p_mold_tbl            => l_mold_tbl,  

  22.                                                     x_mmtt_tbl            => l_mold_tbl,  

  23.                                                     x_trolin_tbl          => l_trolin_tbl);  

  24.         IF l_return_status != fnd_api.g_ret_sts_success THEN  

  25.           l_err_code := g_warning;  

  26.           l_err_msg  := '处理物料搬运单失败';  

  27.           GOTO next_line;  

  28.         END IF;  

5. 得到销售订单的交货号(delivery_id)

    得到交货号的代码:

[c-sharp] view plaincopy

  1. PROCEDURE get_delivery_line_id(p_order_line_id IN NUMBER,  

  2.                                o_delivery_id   OUT NUMBER,  

  3.                                o_err_code      OUT number,  

  4.                                o_err_msg       OUT VARCHAR2) IS  

  5. BEGIN  

  6.   SELECT wda.delivery_id  

  7.     INTO o_delivery_id  

  8.     FROM wsh_delivery_details wdd, wsh_delivery_assignments wda  

  9.    WHERE wdd.source_line_id = p_order_line_id  

  10.      AND wdd.delivery_detail_id = wda.delivery_detail_id  

  11.      AND rownum = 1;  

  12. EXCEPTION  

  13.   WHEN NO_DATA_FOUND THEN  

  14.     o_err_code := g_warning;  

  15.     o_err_msg  := '无法获取订单行发运号';  

  16.   WHEN OTHERS THEN  

  17.     o_err_code := g_error;  

  18.     o_err_msg  := '获取发运行ID时发生意外错误:' || SQLERRM;  

  19. END;  

  20. --调用过程得到交货号  

  21. get_delivery_line_id(p_order_line_id => rec_data.line_id,  

  22.                              o_delivery_id   => l_delivery_id,  

  23.                              o_err_code      => l_err_code,  

  24.                              o_err_msg       => l_err_msg);  

  25.         IF l_delivery_id IS NULL THEN  

  26.           l_err_code := g_warning;  

  27.           l_err_msg  := '没有为该订单成功创建发运号';  

  28.           GOTO next_line;  

  29.         END IF;  

[c-sharp] view plain copy

  1. PROCEDURE get_delivery_line_id(p_order_line_id IN NUMBER,  

  2.                                o_delivery_id   OUT NUMBER,  

  3.                                o_err_code      OUT number,  

  4.                                o_err_msg       OUT VARCHAR2) IS  

  5. BEGIN  

  6.   SELECT wda.delivery_id  

  7.     INTO o_delivery_id  

  8.     FROM wsh_delivery_details wdd, wsh_delivery_assignments wda  

  9.    WHERE wdd.source_line_id = p_order_line_id  

  10.      AND wdd.delivery_detail_id = wda.delivery_detail_id  

  11.      AND rownum = 1;  

  12. EXCEPTION  

  13.   WHEN NO_DATA_FOUND THEN  

  14.     o_err_code := g_warning;  

  15.     o_err_msg  := '无法获取订单行发运号';  

  16.   WHEN OTHERS THEN  

  17.     o_err_code := g_error;  

  18.     o_err_msg  := '获取发运行ID时发生意外错误:' || SQLERRM;  

  19. END;  

  20. --调用过程得到交货号  

  21. get_delivery_line_id(p_order_line_id => rec_data.line_id,  

  22.                              o_delivery_id   => l_delivery_id,  

  23.                              o_err_code      => l_err_code,  

  24.                              o_err_msg       => l_err_msg);  

  25.         IF l_delivery_id IS NULL THEN  

  26.           l_err_code := g_warning;  

  27.           l_err_msg  := '没有为该订单成功创建发运号';  

  28.           GOTO next_line;  

  29.         END IF;  

6.  发运确认  

     根据步骤5中返回的delivery_id确认是否进行发运确认,

     如果delivery_id不为空,并且没有返回错误信息。

     调用API进行发运确认的代码:

[c-sharp] view plaincopy

  1. WSH_NEW_DELIVERY_ACTIONS.Confirm_Delivery(p_del_rows              => l_delivery_id_tab,  

  2.                                                   p_action_flag           => l_action_flag,  

  3.                                                   p_intransit_flag        => l_intransit_flag,  

  4.                                                   p_close_flag            => l_close_trip_flag,  

  5.                                                   p_stage_del_flag        => l_stage_del_flag,  

  6.                                                   p_report_set_id         => l_report_set_id,  

  7.                                                   p_ship_method           => l_trip_ship_method,  

  8.                                                   p_actual_dep_date       => l_actual_dep_date,  

  9.                                                   p_bol_flag              => l_create_bol_flag,  

  10.                                                   p_mc_bol_flag           => l_mc_bill_of_lading_flag,  

  11.                                                   p_defer_interface_flag  => l_defer_interface_flag,  

  12.                                                   p_send_945_flag         => l_send_945_flag,  

  13.                                                   x_return_status         => l_return_status);  

  14.         IF l_return_status NOT IN (fnd_api.g_ret_sts_success,'') THEN  

  15.           l_err_code := g_warning;  

  16.           l_err_msg  := '销售订单发放确认失败';  

  17.           GOTO next_head;  

  18.         END IF;  

[c-sharp] view plain copy

  1. WSH_NEW_DELIVERY_ACTIONS.Confirm_Delivery(p_del_rows              => l_delivery_id_tab,  

  2.                                                   p_action_flag           => l_action_flag,  

  3.                                                   p_intransit_flag        => l_intransit_flag,  

  4.                                                   p_close_flag            => l_close_trip_flag,  

  5.                                                   p_stage_del_flag        => l_stage_del_flag,  

  6.                                                   p_report_set_id         => l_report_set_id,  

  7.                                                   p_ship_method           => l_trip_ship_method,  

  8.                                                   p_actual_dep_date       => l_actual_dep_date,  

  9.                                                   p_bol_flag              => l_create_bol_flag,  

  10.                                                   p_mc_bol_flag           => l_mc_bill_of_lading_flag,  

  11.                                                   p_defer_interface_flag  => l_defer_interface_flag,  

  12.                                                   p_send_945_flag         => l_send_945_flag,  

  13.                                                   x_return_status         => l_return_status);  

  14.         IF l_return_status NOT IN (fnd_api.g_ret_sts_success,'') THEN  

  15.           l_err_code := g_warning;  

  16.           l_err_msg  := '销售订单发放确认失败';  

  17.           GOTO next_head;  

  18.         END IF;  

 转载出处:http://blog.csdn.net/cunxiyuan108/article/details/6014769

  结果:通过以上步骤,可以成功的将一个外围系统导入的销售订单进行挑库发放,成功处理此销售订单,并将销售订单行的状态变成“关闭”

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
Export BOM
通过传XML格式导入到ORACLE的销售订单
日记账导入API
R12 WEBADI 开发实例 (EBS 版本:12.1.3)
网页内容获取
电商项目中的优惠券系统这样设计,同事直呼 666 !
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服