固定资产更新接口

转自huan.gu专栏:http://blog.youkuaiyun.com/gh320/article/details/17059927
 
01.--更新资产  
02.DECLARE  
03.  
04.  l_trans_rec      fa_api_types.trans_rec_type;  
05.  l_asset_hdr_rec  fa_api_types.asset_hdr_rec_type;  
06.  l_asset_desc_rec fa_api_types.asset_desc_rec_type;  
07.  l_asset_cat_rec  fa_api_types.asset_cat_rec_type;  
08.  
09.  l_return_status VARCHAR2(1);  
10.  l_mesg_count    NUMBER;  
11.  l_mesg          VARCHAR2(512);  
12.  
13.BEGIN  
14.  --初始化  
15.  dbms_output.enable(10000000);  
16.  
17.  fa_srvr_msg.init_server_message;  
18.  --资产id  
19.  l_asset_hdr_rec.asset_id := 418;  
20.  --新的资产描述  
21.  --l_asset_desc_rec.description   := '更新';  
22.  --需要更新的新的标签号  
23.  l_asset_desc_rec.tag_number := 'test_001';  
24.  
25.  fa_asset_desc_pub.update_desc(  
26.                                -- std parameters  
27.                                p_api_version      => 1.0,  
28.                                p_init_msg_list    => fnd_api.g_false,  
29.                                p_commit           => fnd_api.g_false,  
30.                                p_validation_level => fnd_api.g_valid_level_full,  
31.                                p_calling_fn       => NULL,  
32.                                x_return_status    => l_return_status,  
33.                                x_msg_count        => l_mesg_count,  
34.                                x_msg_data         => l_mesg,  
35.                                -- api parameters  
36.                                px_trans_rec          => l_trans_rec,  
37.                                px_asset_hdr_rec      => l_asset_hdr_rec,  
38.                                px_asset_desc_rec_new => l_asset_desc_rec,  
39.                                px_asset_cat_rec_new  => l_asset_cat_rec);  
40.  --dump messages  
41.  l_mesg_count := fnd_msg_pub.count_msg;  
42.  
43.  IF l_mesg_count > 0 THEN  
44.    
45.    l_mesg := chr(10) ||  
46.              substr(fnd_msg_pub.get(fnd_msg_pub.g_first, fnd_api.g_false),  
47.                     1,  
48.                     250);  
49.    dbms_output.put_line(l_mesg);  
50.    
51.    FOR i IN 1 .. (l_mesg_count - 1) LOOP  
52.      l_mesg := substr(fnd_msg_pub.get(fnd_msg_pub.g_next, fnd_api.g_false),  
53.                       1,  
54.                       250);  
55.      
56.      dbms_output.put_line(l_mesg);  
57.    END LOOP;  
58.    
59.    fnd_msg_pub.delete_msg();  
60.    
61.  END IF;  
62.  
63.  IF (l_return_status <> fnd_api.g_ret_sts_success) THEN  
64.    dbms_output.put_line('FAILURE');  
65.  ELSE  
66.    dbms_output.put_line('SUCCESS');  
67.    dbms_output.put_line('ASSET_ID' || to_char(l_asset_hdr_rec.asset_id));  
68.  END IF;  
69.  
70.END;  

### NCC 固定资产 API 接口文档使用说明 NCC 固定资产管理模块提供了丰富的API接口来支持对固定资产的管理操作。这些接口允许用户通过编程方式执行诸如查询、创建、更新和删除固定资产业务逻辑。 #### 查询固定资产信息 为了获取特定条件下的固定资产列表,可以调用`GET /api/ncc/fixed_assets`端点。此请求接受多个参数用于过滤返回的数据集,例如部门ID、资产类别等。这使得能够精确检索所需的记录[^1]。 ```python import requests url = "http://example.com/api/ncc/fixed_assets" params = { 'department_id': 1, 'category': 'Office Equipment' } response = requests.get(url, params=params) if response.status_code == 200: assets_data = response.json() else: print(f"Error fetching data: {response.text}") ``` #### 创建新的固定资产条目 当需要录入新购入或转移至公司的设备作为固定资产时,则应向`POST /api/ncc/fixed_assets/create`发送带有必要属性(如名称、购买日期、成本金额等)的有效载荷数据包以完成登记动作。 ```json { "name": "Laptop", "purchase_date": "2023-09-01", "cost_amount": 8000.00, ... } ``` #### 更新现有固定资产详情 对于已经存在于系统中的固定资产,如果其状态发生变化或是有其他重要信息需修正的话,可通过PUT方法作用于路径`/api/ncc/fixed_assets/{id}`上来实现更新目的;其中{id}代表目标对象唯一标识符。 ```python asset_id = 45678 update_info = {"status": "In Use"} url_update = f"http://example.com/api/ncc/fixed_assets/{asset_id}" headers = {'Content-Type': 'application/json'} requests.put(url=url_update, json=update_info, headers=headers) ``` #### 删除不再使用的固定资产记录 最后,在某些情况下可能要移除那些已报废或者转让出去而不再属于本单位所有的项目,这时就该利用DELETE动词配合相应的资源地址来进行处理了——即访问`DELETE /api/ncc/fixed_assets/{id}`即可达成所愿。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值