INV*账户别名接收发放
DECLARE
--p_old_new_flag OLD 为导出 NEW 为导入
l_iface_rec inv.mtl_transactions_interface%ROWTYPE;
l_iface_lot_rec inv.mtl_transaction_lots_interface%ROWTYPE;
l_timeout NUMBER;
l_outcome BOOLEAN;
l_error_code VARCHAR2(100);
l_error_explanation VARCHAR2(100);
l_request_id NUMBER;
l_sqlerrm VARCHAR2(1000); l_inventory_item_id NUMBER;
l_organization_id NUMBER;
l_uom VARCHAR2(240);
l_disposition_id NUMBER;
l_subinventory_code VARCHAR2(240);
l_count NUMBER;
l_locator_id NUMBER;
l_error_msg VARCHAR2(32767); CURSOR cur IS
SELECT t.import_id,
t.organization_code,
t.item_number,
t.subinventory_code,
t.transaction_type transaction_type1,
decode(t.transaction_type,
'帐户别名接收',
41,
'帐户别名发放',
31,
NULL) transaction_type,
t.account_alias,
t.transaction_uom,
t.transaction_date,
t.lot_number,
decode(t.transaction_type,
'帐户别名接收',
t.transaction_quantity,
'帐户别名发放',
t.transaction_quantity * (-1),
NULL) transaction_quantity,
t.attribute1,
t.attribute2,
t.attribute3,
t.attribute4,
t.attribute5
FROM cux_inv_mmt_account_temp t
WHERE 1 = 1
--AND t.item_number = '1515453000051'
;
BEGIN mo_global.init('INV');
fnd_global.apps_initialize(user_id => 1318,
resp_id => 50559,
resp_appl_id => 222);
mo_global.set_policy_context('S',
83); l_count := 0;
FOR rec IN cur
LOOP l_error_msg := NULL;
l_iface_rec.last_update_date := SYSDATE;
l_iface_rec.last_updated_by := -1;
l_iface_rec.creation_date := SYSDATE;
l_iface_rec.created_by := -1;
l_iface_rec.last_update_login := -1;
l_iface_lot_rec.last_update_date := SYSDATE;
l_iface_lot_rec.last_updated_by := -1;
l_iface_lot_rec.creation_date := SYSDATE;
l_iface_lot_rec.created_by := -1;
l_iface_lot_rec.last_update_login := -1; SELECT mtl_material_transactions_s.nextval
INTO l_iface_rec.transaction_interface_id
FROM dual; BEGIN
SELECT msi.inventory_item_id,
msi.organization_id,
msi.primary_uom_code
INTO l_inventory_item_id, l_organization_id, l_uom
FROM mtl_system_items_b msi, org_organization_definitions ood
WHERE 1 = 1
AND msi.organization_id = ood.organization_id
AND ood.organization_code = rec.organization_code
AND msi.segment1 = rec.item_number;
EXCEPTION
WHEN OTHERS THEN
l_error_msg := l_error_msg || '物料' || rec.item_number || '不存在';
END; BEGIN
SELECT mgd.disposition_id
INTO l_disposition_id
FROM mtl_generic_dispositions mgd
WHERE 1 = 1
AND mgd.organization_id = l_organization_id
AND mgd.segment1 = rec.account_alias;
EXCEPTION
WHEN OTHERS THEN
l_error_msg := l_error_msg || '账户别名不存在';
END; BEGIN
SELECT msi.secondary_inventory_name
INTO l_subinventory_code
FROM mtl_secondary_inventories msi
WHERE 1 = 1
AND msi.organization_id = l_organization_id
AND msi.secondary_inventory_name = rec.subinventory_code;
EXCEPTION
WHEN OTHERS THEN
l_error_msg := l_error_msg || '子库存不存在';
END; IF (rec.attribute1 IS NOT NULL) THEN
BEGIN
SELECT mik.inventory_location_id
INTO l_locator_id
FROM mtl_item_locations_kfv mik
WHERE mik.concatenated_segments = rec.attribute1
AND mik.organization_id = l_organization_id
AND mik.subinventory_code = rec.subinventory_code;
EXCEPTION
WHEN no_data_found THEN
l_error_msg := l_error_msg || '货位不存在';
END;
END IF; --dbms_output.put_line('1!'); l_iface_rec.transaction_header_id := l_iface_rec.transaction_interface_id;
l_iface_rec.transaction_mode := 3;
l_iface_rec.process_flag := 1;
l_iface_rec.transaction_type_id := rec.transaction_type; --41 帐户别名接收 31 帐户别名发放
l_iface_rec.transaction_source_id := l_disposition_id; --来源
l_iface_rec.organization_id := l_organization_id;
l_iface_rec.inventory_item_id := l_inventory_item_id;
l_iface_rec.subinventory_code := rec.subinventory_code;
l_iface_rec.locator_id := l_locator_id;
l_iface_rec.transaction_quantity := rec.transaction_quantity; --出库数量为负数 入库数量为正数
l_iface_rec.primary_quantity := rec.transaction_quantity;
l_iface_rec.transaction_uom := l_uom;
l_iface_rec.transaction_date := rec.transaction_date;
l_iface_rec.source_code := '账户别名接收/发放';
l_iface_rec.source_header_id := to_number(to_char(SYSDATE,
'YYYYMMDDHH24MISS'));
l_iface_rec.source_line_id := to_number(to_char(SYSDATE,
'YYYYMMDDHH24MISS')); IF (l_error_msg IS NULL) THEN
INSERT INTO inv.mtl_transactions_interface VALUES l_iface_rec;
END IF; IF (rec.lot_number IS NOT NULL) THEN
l_iface_lot_rec.transaction_interface_id := l_iface_rec.transaction_interface_id;
l_iface_lot_rec.lot_number := rec.lot_number;
l_iface_lot_rec.transaction_quantity := l_iface_rec.transaction_quantity;
l_iface_lot_rec.source_code := l_iface_rec.source_code;
l_iface_lot_rec.source_line_id := l_iface_rec.source_line_id; IF (l_error_msg IS NULL) THEN
INSERT INTO inv.mtl_transaction_lots_interface
VALUES l_iface_lot_rec;
END IF;
END IF; IF (l_error_msg IS NULL) THEN
l_timeout := 10;
l_outcome := mtl_online_transaction_pub.process_online(p_transaction_header_id => l_iface_rec.transaction_header_id,
p_timeout => l_timeout,
p_error_code => l_error_code,
p_error_explanation => l_error_explanation); IF (l_outcome = FALSE) THEN
dbms_output.put_line('Failed*******Import_id:' || rec.import_id);
dbms_output.put_line('Failed!');
dbms_output.put_line('l_error_code:' || l_error_code);
dbms_output.put_line('l_error_explanation:' || l_error_explanation);
ELSIF (l_outcome = TRUE) THEN
l_count := l_count + 1;
END IF;
END IF; IF (l_error_msg IS NOT NULL) THEN
dbms_output.put_line('l_error_msg:' || l_error_msg);
END IF; END LOOP;
dbms_output.put_line('SuccessFul:' || l_count); EXCEPTION
WHEN OTHERS THEN
dbms_output.put_line('Exception!' || SQLERRM);
END;
--期初数据导入,创建表存储
create table cux_inv_mmt_account_temp(
IMPORT_ID NUMBER,
ORGANIZATION_CODE VARCHAR2(),
ITEM_NUMBER VARCHAR2(),
SUBINVENTORY_CODE VARCHAR2(),
TRANSACTION_TYPE VARCHAR2(),
ACCOUNT_ALIAS VARCHAR2(),
TRANSACTION_UOM VARCHAR2(),
TRANSACTION_DATE DATE,
LOT_NUMBER VARCHAR2(),
TRANSACTION_QUANTITY NUMBER,
ATTRIBUTE1 VARCHAR2(),
ATTRIBUTE2 VARCHAR2(),
ATTRIBUTE3 VARCHAR2(),
ATTRIBUTE4 VARCHAR2(),
ATTRIBUTE5 VARCHAR2()
)
INV*账户别名接收发放的更多相关文章
- 物料事务处理接口表 MTL_TRANSACTIONS_INTERFACE 账户别名使用 及 提示无效的分配账户字段
实例: PROCEDURE MAIN(P_ORGANIZATION_ID NUMBER, P_PERIOD_NAME VARCHAR2, XV_STATUS OUT VARCHAR, XV_MESG ...
- 所有标准API
序号 系统版本 模块 应用场景 类型 API/接口 参数规格 样例代码 备注 登记者 登记时间 关键字 1 12.1.3 AP 付款核销 API ap_pay_invoice_pkg.ap_pay_i ...
- Oracle EBS-SQL (INV-2):检查帐户别名发放记录.sql
SELECT FU.description 操作者, ITM.SEGMENT1 物料编码, ITM.DESC ...
- ORACLE EBS常用表及查询语句(最终整理版)
建议去看参考二 参考一: call fnd_global.APPS_INITI ...
- PMS与orcalebs结合之字段
call fnd_global.APPS_INITIALIZE(1318,50583,401) select fnd_profile.VALUE('ORG_ID') FROM DUAL select ...
- Oracle常用标准表
一.INV(库存) 子库存:mtl_secondary_inventories 事物处理:mtl_material_transactions mmt 事务处理来源类型:mtl_txn_source_t ...
- EBS常用表_Dictionary
EBS常用表:转载于 https://blog.csdn.net/xiariqingcao/article/details/8775827 . OU.库存组织 SELECT hou.organizat ...
- 具体解释EBS接口开发之WIP模块接口
整体说明 文档目的 本文档针对WIP模块业务功能和接口进行分析和研究,对採用并发请求方式和调用API方式分别进行介绍 内容 WIP模块经常使用标准表简单介绍 WIP事物处理组成 WIP相关业务流程 W ...
- 详解EBS接口开发之WIP模块接口
总体说明 文档目的 本文档针对WIP模块业务功能和接口进行分析和研究,对采用并发请求方式和调用API方式分别进行介绍 内容 WIP模块常用标准表简介 WIP事物处理组成 WIP相关业务流程 WIP相关 ...
随机推荐
- 14-Flutter移动电商实战-ADBanner组件的编写
拨打电话的功能在app里也很常见,比如一般的外卖app都会有这个才做.其实Flutter本身是没给我们提供拨打电话的能力的,那我们如何来拨打电话那? 1.编写店长电话模块 这个小伙伴们一定轻车熟路了, ...
- 学习Spring-Data-Jpa(十二)---投影Projections-对查询结果的扩展
Spring-Data数据查询方法的返回通常的是Repository管理的聚合根的一个或多个实例.但是,有时候我们只需要返回某些特定的属性,不需要全部返回,或者只返回一些复合型的字段.Spring-D ...
- LeetCode 838. Push Dominoes
原题链接在这里:https://leetcode.com/problems/push-dominoes/ 题目: There are N dominoes in a line, and we plac ...
- Github搭建简单的博客
1)安装pelcan和markdown pip install pelican markdown --upgrade 2)创建一个文件夹用来作为博客的目录 mkdir 博客目录 3)cd到该目录下运行 ...
- php web开发——文件夹的上传和下载
核心原理: 该项目核心就是文件分块上传.前后端要高度配合,需要双方约定好一些数据,才能完成大文件分块,我们在项目中要重点解决的以下问题. * 如何分片: * 如何合成一个文件: * 中断了从哪个分片开 ...
- WinDbg常用命令系列---显示当前异常处理程序链!exchain
!exchain 这个!exchain扩展命令显示当前异常处理程序链. !exchain [Options] 参数: Options下列值之一: /c 如果检测到异常,则显示与调试C++ try/c ...
- Building a Service Mesh with HAProxy and Consul
转自:https://www.haproxy.com/blog/building-a-service-mesh-with-haproxy-and-consul/ HashiCorp added a s ...
- 23-ESP8266 SDK开发基础入门篇--编写Android TCP客户端 , 加入消息处理
https://www.cnblogs.com/yangfengwu/p/11203546.html 先做接收消息 然后接着 public class MainActivity extends App ...
- [学习笔记] kd-tree
本文参考这位dalao的题解 前置技能:二叉查找树 其实kd-tree很简单的啦 和BST都差不多的啦 就是在划分的时候把每一维都比较一下就行啦 (\(dalao\)的kd-tree教程) 然而本蒟蒻 ...
- docker 部署jar包
docker volume create j1ls /var/lib/docker/volumes/j1/_data 上传jardocker run -it -d --name j1 -v j1:/h ...