详解EBS接口开发之销售订单挑库发放
1. 对销售订单的有效性验证
1)检查销售订单的行是否被完全传回客户化表
2)验证销售订单的关键字段
3)检查子库存是否启用了货位控制,如果启用了货位控制,没有生成货位,则调用API生成货位
4)调用API检查子库存中的某一个物料的现用量和可用量
2. 销售订单发放
调用API进行销售订单发放
发放成功: 返回一个批号,这个批号作为挑库发放的参数
3. 销售订单挑库发放
调用API进行挑库发放
发放前 行状态:准备发放 下一步:挑库发放 判断依据:销售订单发放生成的批号作为挑库发放的参数
发放成功 行状态:已发放至仓库 下一步:处理物料搬运单 判断依据:返回一个批号,这个批号作为挑库发放的参数
发放失败 行状态:已延交 下一步:挑库发放 判断依据:未成功返回一个批号
说明:订单发放是按照整个订单发放的。
4. 处理物料搬运单
处理成功: 行状态:发运 下一步: 判断依据:返回成功的处理状态
处理成失败 行状态: 下一步:处理物料搬运单 判断依据:未返回成功的处理状态
5. 得到销售订单的交货号(delivery_id)
调用API 查看是否产生发运号
成功:返回发运号
失败:未返回发运号
6. 发运确认
处理成功 订单状态为:关闭
说明:如果发运确认已经成功,则会自动调用 连接形成停靠站 接口程序
具体实现代码
1. 对销售订单的有效性验证
调用API验证货位的代码:
fnd_profile.put('MFG_ORGANIZATION_ID',p_organization_id);l_locator_type := get_locator_type(p_sub_inv,p_organization_id); IF l_locator_type != 1 THENl_locator := p_sub_inv || '.' ||p_project || '.' || p_task;inv_loc_wms_pub.create_locator(x_return_status => l_status,x_msg_count => l_msg_count,x_msg_data => l_msg_data,x_inventory_location_id => l_locator_id,x_locator_exists => l_locator_exists,p_organization_id => p_organization_id,p_organization_code => p_organization_code,p_concatenated_segments => l_locator,p_description => NULL,p_inventory_location_type => l_locator_type,p_picking_order => NULL,p_location_maximum_units => NULL,p_subinventory_code => p_sub_inv,p_location_weight_uom_code => NULL,p_max_weight => NULL,p_volume_uom_code => NULL,p_max_cubic_area => NULL,p_x_coordinate => NULL,p_y_coordinate => NULL,p_z_coordinate => NULL,p_physical_location_id => NULL,p_pick_uom_code => NULL,p_dimension_uom_code => NULL,p_length => NULL,p_width => NULL,p_height => NULL,p_status_id => 1,p_dropping_order => NULL);IF l_locator_id IS NULL THENo_err_code := g_error;o_err_msg := '创建(获取)货位弹性域发生错误';ELSEo_locator_id := l_locator_id;END IF;
调用API验证库存现用量和可用量的代码:
inv_quantity_tree_pub.query_quantities(p_api_version_number => 1.0,x_return_status => l_return_status,x_msg_count => l_msg_count,x_msg_data => l_msg_data,p_organization_id => l_organization_id,p_inventory_item_id => rec_data.item_id,--item idp_tree_mode => 2,p_is_revision_control => FALSE,p_is_lot_control => l_lot_control_flag,p_lot_expiration_date => rec_data.transaction_date,p_is_serial_control => FALSE,p_grade_code => NULL, -- INVCONV NOT NEEDED NOW p_revision => NULL,p_lot_number => NULL,p_subinventory_code => rec_data.pick_from_subinventory,p_locator_id => l_locator_id,x_qoh => l_qoh,x_rqoh => l_rqoh,x_qr => l_qr,x_qs => l_qs,x_att => l_att,x_atr => l_atr,x_sqoh => l_sqoh, -- INVCONV x_srqoh => l_srqoh, -- INVCONVx_sqr => l_sqr, -- INVCONVx_sqs => l_sqs, -- INVCONVx_satt => l_satt, -- INVCONVx_satr => l_satr); -- INVCONVIF nvl(l_atr,0) = 0 THENGOTO end_loop;END IF;
2. 销售订单发放
调用API进行销售订单发放的代码:
fnd_profile.PUT('MFG_ORGANIZATION_ID',l_organization_id);wsh_picking_batches_pkg.insert_row(x_rowid => l_row_id,x_batch_id => l_batch_id,p_creation_date => g_sysdate,p_created_by => g_user_id,p_last_update_date => g_sysdate,p_last_updated_by => g_user_id,p_last_update_login => g_login_id,p_batch_name_prefix => NULL,x_name => l_name,p_backorders_only_flag => l_rule_rec.backorders_only_flag,p_document_set_id => l_rule_rec.document_set_id,p_existing_rsvs_only_flag => l_rule_rec.existing_rsvs_only_flag,p_shipment_priority_code => l_rule_rec.shipment_priority_code,p_ship_method_code => l_rule_rec.ship_method_code,p_customer_id => l_customer_id,p_order_header_id => rec_data.order_header_id,p_ship_set_number => l_rule_rec.ship_set_number,p_inventory_item_id => NULL,p_order_type_id => l_order_type_id,p_from_requested_date => NULL,p_to_requested_date => NULL,p_from_scheduled_ship_date => NULL,p_to_scheduled_ship_date => NULL,p_ship_to_location_id => l_rule_rec.ship_to_location_id,p_ship_from_location_id => l_rule_rec.ship_from_location_id/*l_stage_locator_id*/,p_trip_id => NULL,p_delivery_id => NULL,p_include_planned_lines => l_rule_rec.include_planned_lines,p_pick_grouping_rule_id => l_rule_rec.pick_grouping_rule_id,p_pick_sequence_rule_id => l_rule_rec.pick_sequence_rule_id,p_autocreate_delivery_flag => 'Y', --l_rule_rec.autocreate_delivery_flag;--无论规则是否自动创建交货号,都让系统自动创建(用shipment_number做交货号)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_autodetail_pr_flag => l_rule_rec.autodetail_pr_flag,p_carrier_id => l_rule_rec.carrier_id,p_trip_stop_id => NULL,p_default_stage_subinventory => l_rule_rec.default_stage_subinventory,--ERP临时发货区p_default_stage_locator_id => l_stage_locator_id,p_pick_from_subinventory => rec_data.pick_from_subinventory,/*l_rule_rec.pick_from_subinventory,* /--ERP提货区p_pick_from_locator_id => l_locator_id,--l_rule_rec.pick_from_locator_id,p_auto_pick_confirm_flag => 'N'/*l_rule_rec.auto_pick_confirm_flag*/,--无论规则是否自动确认挑库,都不让系统自动挑库(可能会修改分配数)p_delivery_detail_id => NULL,p_project_id => rec_data.project_id,p_task_id => rec_data.task_id,p_organization_id => l_organization_id,p_ship_confirm_rule_id => l_rule_rec.ship_confirm_rule_id,p_autopack_flag => l_rule_rec.autopack_flag,p_autopack_level => l_rule_rec.autopack_level,p_task_planning_flag => l_rule_rec.task_planning_flag,p_non_picking_flag => NULL,p_regionid => l_rule_rec.region_id,p_zoneid => l_rule_rec.zone_id,p_categoryid => l_rule_rec.category_id,p_categorysetid => l_rule_rec.category_set_id,p_acdelivcriteria => l_rule_rec.ac_delivery_criteria,p_relsubinventory => l_rule_rec.rel_subinventory,--如果规则不做限制则可以任意子库中挑库--nvl(p_subinventory_from,l_rule_rec.rel_subinventory),--如果在此处修改来源子库会导致发放不成功 不能创建物料搬运单p_append_flag => l_rule_rec.append_flag,p_task_priority => l_rule_rec.task_priority,p_ship_set_smc_flag => NULL,p_actual_departure_date => NULL,p_allocation_method => l_rule_rec.allocation_method,p_crossdock_criteria_id => l_rule_rec.crossdock_criteria_id,p_delivery_name_lo => NULL,p_delivery_name_hi => NULL,p_bol_number_lo => NULL,p_bol_number_hi => NULL,p_intmed_ship_to_loc_id => NULL,p_pooled_ship_to_loc_id => NULL,p_fob_code => NULL,p_freight_terms_code => NULL,p_pickup_date_lo => NULL,p_pickup_date_hi => NULL,p_dropoff_date_lo => NULL,p_dropoff_date_hi => NULL,p_planned_flag => NULL,p_selected_batch_id => NULL);IF l_batch_id IS NULL THENl_err_code := g_warning;l_err_msg := '销售订单发放没有产生批号';GOTO next_line;END IF;
销售订单发放生成的批号作为步骤3的参数
3. 销售订单挑库发放
调用API进行挑库发放的代码:
wsh_pick_list.online_release(p_batch_id => l_batch_id,p_pick_result => l_pick_result,p_pick_phase => l_pick_phase,p_pick_skip => l_pick_skip);--F:FailureIF nvl(l_pick_result,'F') = 'F' THENIF (nvl(l_pick_phase,'START') = 'MOVE_ORDER_LINES') THENl_err_code := g_warning;l_err_msg := '联机挑库发放已部分完成。未完全处理物料搬运单:' || l_batch_id;ELSEl_err_code := g_warning;l_err_msg := '联机挑库发放失败。请在并发模式下发放订单:' || l_batch_id;END IF;ELSIF nvl(l_pick_skip,'Y') = 'Y' THENl_err_code := g_warning;l_err_msg := '联机挑库发放已结束但出现警告。请检查“发运例外报表”';--即使部分挑库成功也不继续处理ELSIF nvl(l_pick_result,'F') = 'W' THENIF nvl(l_pick_phase,'START') = 'MOVE_ORDER_LINES' THENl_err_code := g_warning;l_err_msg := '联机挑库发放已部分完成,但出现警告。';ELSEl_err_code := g_warning;l_err_msg := '联机挑库发放已结束但出现警告。请检查“发运例外报表”';END IF;ELSIF nvl(l_pick_result,'F') = 'S' THENNULL;END IF;
4. 处理物料搬运单
调用API处理物料搬运单的代码:
get_move_order_line_id(p_order_line_id => rec_data.line_id,o_move_order_line_id => l_mv_line_id,o_mv_status => l_mv_status,o_err_code => l_err_code,o_err_msg => l_err_msg);IF l_err_code IS NOT NULL THENGOTO next_line;END IF;<<move_order>>l_trolin_tbl := inv_trolin_util.query_rows(p_line_id => l_mv_line_id);l_mold_tbl := inv_mo_line_detail_util.query_rows(p_line_id => l_mv_line_id);inv_pick_wave_pick_confirm_pub.pick_confirm(p_api_version_number => 1.0,p_init_msg_list => fnd_api.g_false,p_commit => fnd_api.g_false,x_return_status => l_return_status,x_msg_count => l_msg_count,x_msg_data => l_msg_data,p_move_order_type => 3,p_transaction_mode => 1,p_trolin_tbl => l_trolin_tbl,p_mold_tbl => l_mold_tbl,x_mmtt_tbl => l_mold_tbl,x_trolin_tbl => l_trolin_tbl);IF l_return_status != fnd_api.g_ret_sts_success THENl_err_code := g_warning;l_err_msg := '处理物料搬运单失败';GOTO next_line;END IF;
5. 得到销售订单的交货号(delivery_id)
得到交货号的代码:
PROCEDURE get_delivery_line_id(p_order_line_id IN NUMBER,o_delivery_id OUT NUMBER,o_err_code OUT number,o_err_msg OUT VARCHAR2) ISBEGINSELECT wda.delivery_idINTO o_delivery_idFROM wsh_delivery_details wdd, wsh_delivery_assignments wdaWHERE wdd.source_line_id = p_order_line_idAND wdd.delivery_detail_id = wda.delivery_detail_idAND rownum = 1;EXCEPTIONWHEN NO_DATA_FOUND THENo_err_code := g_warning;o_err_msg := '无法获取订单行发运号';WHEN OTHERS THENo_err_code := g_error;o_err_msg := '获取发运行ID时发生意外错误:' || SQLERRM;END;
--调用过程得到交货号
get_delivery_line_id(p_order_line_id => rec_data.line_id,o_delivery_id => l_delivery_id,o_err_code => l_err_code,o_err_msg => l_err_msg);IF l_delivery_id IS NULL THENl_err_code := g_warning;l_err_msg := '没有为该订单成功创建发运号';GOTO next_line;END IF;
6. 发运确认
根据步骤5中返回的delivery_id确认是否进行发运确认,
如果delivery_id不为空,并且没有返回错误信息。
调用API进行发运确认的代码:
WSH_NEW_DELIVERY_ACTIONS.Confirm_Delivery(p_del_rows => l_delivery_id_tab,p_action_flag => l_action_flag,p_intransit_flag => l_intransit_flag,p_close_flag => l_close_trip_flag,p_stage_del_flag => l_stage_del_flag,p_report_set_id => l_report_set_id,p_ship_method => l_trip_ship_method,p_actual_dep_date => l_actual_dep_date,p_bol_flag => l_create_bol_flag,p_mc_bol_flag => l_mc_bill_of_lading_flag,p_defer_interface_flag => l_defer_interface_flag,p_send_945_flag => l_send_945_flag,x_return_status => l_return_status);IF l_return_status NOT IN (fnd_api.g_ret_sts_success,'') THENl_err_code := g_warning;l_err_msg := '销售订单发放确认失败';GOTO next_head;END IF;
结果: 通过以上步骤,可以成功的将一个外围系统导入的销售订单进行挑库发放,成功处理此销售订单,并将销售订单行的状态变成“关闭”
详解EBS接口开发之销售订单挑库发放相关推荐
- 详解EBS接口开发之销售订单挑库发放(转载)
1. 对销售订单的有效性验证 1)检查销售订单的行是否被完全传回客户化表 2)验证销售订单的关键字段 3)检查子库存是否启用了货位控制,如果启用了货位控制,没有生成货位,则调用 ...
- 详解EBS接口开发之采购申请导入
更多内容可以参考我的博客 详解EBS接口开发之采购订单导入 http://blog.csdn.net/cai_xingyun/article/details/17114697 /*+++++++ ...
- 详解EBS接口开发之供应商导入(转载)
详解EBS接口开发之供应商导入(转载) https://blog.csdn.net/f_zhangyu/article/details/80254191 (一)供应商常用标准表简介 1.1 常用标准表 ...
- 关于销售订单挑库发放卡接口以及发运处理卡接口的处理方式
1.关于销售订单挑库发放卡接口的处理方式: 在处理异常过程中,有时会碰到销售挑库后物料已有保留,但是交易记录就一直卡接口,到待定事务处理处提交也不成功,也没任何错误提示. 对于出现上面的情况,只能将接 ...
- oracle应收模块核销点不上,详解EBS接口开发之应收款处理
(一)应收款常用标准表简介 1.1常用标准表 如下表中列出了与应收款处理相关的表和说明: 表名 说明 其他信息 AR_BATCHES_ALL AR收款批表 AR_BATCH_SOURCES_ALL A ...
- oracle ebs应收贷记,【转】Oracle EBS 详解EBS接口开发之应收款处理
(一)应收款常用标准表简介 1.1常用标准表 如下表中列出了与应收款处理相关的表和说明: 表名 说明 其他信息 AR_BATCHES_ALL AR收款批表 AR_BATCH_SOURCES_ALL A ...
- 详解EBS接口开发之采购订单导入
https://www.cnblogs.com/wanghang/p/6299558.html 采购订单常用标准表简介 1.1 常用标准表 如下表中列出了与采购订单导入相关的表和说明: 表名 说明 ...
- 详解EBS接口开发之采购订单导入(转载)
采购订单常用标准表简介 1.1 常用标准表 如下表中列出了与采购订单导入相关的表和说明: 表名 说明 其他信息 po.po_headers_all 采购订单头 采购订单号,采购类型,供应商,地点, ...
- 详解EBS接口开发之供应商导入
(一)供应商常用标准表简介 1.1 常用标准表 如下表中列出了与供应商相关的表和说明: 表名 说明 其他信息 ap_suppliers 供应商头表 供应商的头信息如:供应商名.供应商编码.税号等 ...
最新文章
- Linux虚拟内存优化的方法
- Python中的 __name__属性的含义和作用
- Uva 11464 偶数矩阵
- 为什么百万医疗险越来越多,到底选哪款?
- gmr 通信 matlab,matlab使用TCP/IP Server Sockets
- Maven编译代码的相关命令
- No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
- 汇编跳转指令B、BL、BX、BLX 和 BXJ的区别
- c# Linq Where 抛出异常 导致 程序崩溃
- while循环(包含死循环、while嵌套)
- 如何给awk传外部参数
- mui.ajax ie8,IE8+MVVM的适配方案尝试
- 记Dorado7学习(3)
- curiosity_mars_rover调试
- 瑞萨 RA2E1 触摸按键使用例程
- String 类方法及调用案例
- [FastDFS] 文件路径M00是什么意思
- python Linux下的安装
- 基于Python3.x pandas实现大疫情的查重功能
- Zabbix5.0版本 正则表达式