/
库存明细

库存明细

 

基准URL: /smartfin/api/v1/stockmgmt

 

以下API的响应将以压缩形式返回。要对其进行解压缩,请安装https://www.npmjs.com/package/pako 插件并使用特定功能(inflate)来解压缩返回响应主体。

 

在实现HTTP服务时,每个请求的 HttpHeaders 需要设置为以下格式:

headers: new HttpHeaders({ 'Content-Type': 'application/json' }), responseType: 'arraybuffer' as 'json'


获取库存明细


POST /smartfin/api/v1/stockmgmt/select

获取当前用户可见的所有库存。

验证 / 授权

API密钥(令牌)

 

请求标头

架构


请求标头:

  • Content-Type: application/json

Authorization (验证):

  • string - JWT <<您的API密钥(令牌)>> (必填项)

 

请求载荷

例子:

JSON主体:

{ "s_date":"2023-01-01", "e_date":"2023-12-15", "phy_trade_ids":[], "stock_lvls": ["EX"], // 所有库存级别(stock_lvl)在库存明细中均为EX "is_ap": false //由于库存级别为EX, 这个参数就等于false }

请求架构


s_date, e_date - string
  • 根据给定的日期范围过滤库存(s_date =开始日期,e_date =结束日期)。

 

phy_trade_ids - array[number]
  • 根据在请求主体中提供的合同ID过滤库存 ( 每个库存明细都分配给一个合同ID,响应将仅返回具有给定合同ID的库存,而不考虑解析的 s_date e_date。 )

 

响应

例子:

{ "error_code": 0, "value": { "dropdown_list":{ "cost_name": ['1'], "d_port": ['1'] "delivery_rule": [], "l_port": ['1'], "match_id":[ { "bl_no": null, "brand":"INFO", "cargo_ops_id":39704, "contract_actual_price":"1", "contract_no": null, "match_id": 37427, "phy_trade_id":60538, "product":"TEST", "spec":"SPEC", ... }, "stock_type": [ { "value":1, "label": 'STOCK IN' }, ... ] "stock_type": [ { "value":1, "label": 'PHYSICAL' }, ... ] "trans_supplier": ['1'] "validation": ['stock_action', 'stock_type', 'wh_id', 'phy_trade_id'] "wh_id": [ { label: "PUR", value: 184, wh_add: "PUR", wh_entity: "PUR" }, ... ], "phy_trade_id":[ { "phy_trade_id":5546, "self_entity":"MAFINT COMPANY", "contract_no":null, "counterparty":"TEST", "qty":1007.0, "unit":"Metric Ton", "purchase_sale":"S", "product":"TEST", "spec":"SPEC", ... }, ... ], "cost_name":[ { "phy_trade_id":5546, "self_entity":"MAFINT COMPANY", "contract_no":null, "counterparty":"TEST", "qty":1007.0, "unit":"Metric Ton", "purchase_sale":"S", "product":"TEST", "spec":"SPEC" }, ... ], "stmg": [ { "bl_no": null, "brand": "INFO", "c_name": "MAF INFO", "cc_date":null, "cod_date":null, "con_stock_date": null, "contract_actual_price": 1, "contract_actual_qty": 50, "contract_no": null, "contract_tax_rate":null, "cost_amt": null, "cost_ccy":null, "cost_name": null, "counterparty": "CONCORD FORTUNE RESOURCES PTE. LIMITED", "create_by": 181, "create_time": 2023-11-01 10:14:45, "d_nor":null, "d_port":null, "do_date": null, "eta_note":null, "etd":null, "group_name": "Group A - Company Level INFO", "l_port": null, "link_phy_trade_id":null, "maf_group_id": 39 "match_id": 37426, "pair_type": null, "phy_trade_id": 60538, "phy_trade_mode": 4, "phy_trade_wh_id": null, "product": "INFO", "provisional_price": null, "purchase_sale":"P", "qty": 50, "remarks": null, "self_entity":"CONCORD FORTUNE RESOURCES PTE. LIMITED", "slot_no":null, "spec": "INFO", "stock_action": 1, "stock_brand": "INFO", "stock_contract_qty": 5000, "stock_date": "2023-11-01", "stock_e_date": null, "stock_id": 15998, "stock_qty": 1050, "stock_s_date": null, "stock_spec": "INFO", "stock_type": 1, "stock_user_id": 181, "stock_wh_id": 184, "ticket_ref_no": null, "trans_supplier": null, "u_name": null, "unit": "Metric Ton", "update_by": null, "update_time": null, "user_id": 181, "user_name": "MAF Info", "wh_add": "PUR", "wh_entity": "PUR", "wh_id": 184, "wh_name": "PUR" }, .. ] } }

返回

  • 一个名为stmg的对象列表,每个对象表示一个库存明细 ( 按stock_id降序排列 )

  • 一个名为dropdown_list的列表,其中包含在输入/更新库存明细时使用的各种选择列表。

架构


last_update_time, update_by_name, update_by - string

有关数据的最后更新时间以及更新数据的用户的信息。

 

create_time, create_by, create_by_name - string

有关数据的创建时间以及创建数据的用户的信息。

 

user_id, stock_id, phy_trade_id, wh_id - integer
  • user_id - 用户ID(数据所属的用户)

  • stock_id - 分配给数据独立ID。该ID可用于检索库存明细。

  • phy_trade_id - 与库存关联的合同ID。

 

group_name - string maf_group_id - integer
  • maf_group_id - 库存所属的独立群组ID。

 

wh_add, wh_entity, wh_name - string wh_id - integer
  • wh_id - 与库存关联的仓储ID。

  • wh_add, wh_entity, wh_name - 仓储的相关细节。

 

 

更新 / 输入库存明细


更新URL:
POST /smartfin/api/v1/stockmgmt/execution_update

输入URL:
POST /smartfin/api/v1/stockmgmt/execution_insert

 

将新的库存明细输入或更新到数据库中。

 

验证 / 授权

API密钥(令牌)

 

请求标头

架构


请求标头:

  • Content-Type: application/json

Authorization (验证):

  • string - JWT <<您的API密钥(令牌)>> (必填项)

 

请求载荷 ( 更新 )

例子:

JSON 主体:

{ "phy_trade_ids":[ 59106 ], "update_list":[ { "stock_id":35178, "stock_date":"2023-09-11", "stock_type":1, "phy_trade_id":59106, "stock_wh_id":184, "stock_action":1, "trans_supplier":"", "slot_no":"", "stock_qty":111, "match_id":35178, "stock_s_date":"", "stock_e_date":"", "eta_note":"", "cod_date":"", "cost_name":"", "cost_amt":"", "cost_ccy":"", "ticket_ref_no":"", "remarks":"", "bl_no":"9", "l_port":"", "etd":"", "d_port":"", "d_nor":"", "cc_date":"", "do_date":"", "stock_brand":"OFFSHOREP", "stock_spec":"OFFSHOREP", "cargo_ops_id":38301, "delivery_rule":"", "link_phy_trade_id":"", "stock_contract_qty":1111, "pair_type":null } ], "s_date":"2023-01-01", "e_date":"2023-12-15", "phy_products":[] }

请求载荷 ( 输入 )

例子:

JSON 主体:

{ "phy_trade_ids":[ 60667 ], "insert_list":[ { "stock_id":"", "stock_date":"2023-12-01", "stock_type":1, "phy_trade_id":60667, "stock_wh_id":183, "stock_action":2, "trans_supplier":"", "slot_no":"", "stock_qty":1000, "match_id":"", "stock_s_date":"", "stock_e_date":"", "eta_note":"", "cod_date":"", "cost_name":"", "cost_amt":"", "cost_ccy":"", "ticket_ref_no":"", "remarks":"", "bl_no":"", "l_port":"", "etd":"", "d_port":"", "d_nor":"", "cc_date":"", "do_date":"", "stock_brand":"", "stock_spec":"", "cargo_ops_id":39833, "delivery_rule":"", "link_phy_trade_id":"", "stock_contract_qty":1000 } ], "s_date":"2023-01-01", "e_date":"2023-12-15", "phy_products":[ ] }

 

请求架构


s_date, e_date - string
  • 根据给定的日期范围过滤库存(s_date =开始日期,e_date =结束日期)。

 

phy_trade_ids - array[number]
  • 将被更新的合同ID(当传递有效合同ID时,将更新合同的库存明细,如出入库数量、未出入库数量等)。

 

insert_list - array[object]

 

update_list - array[object]

响应:

 

删除库存明细


DELETE /smartfin/api/v1/stockmgmt/delete

根据其 stock_id 删除单个/多个库存明细。

 

验证 / 授权

API密钥(令牌)

 

请求标头

架构


请求标头:

  • Content-Type: application/json

Authorization (验证):

  • string - JWT <<您的API密钥(令牌)>> (必填项)

 

请求载荷

例子:

JSON 主体:

{ "del_ids":[1004], "phy_products":[], "phy_trade_ids":[54794], "s_date":"2023-01-01", "e_date":"2023-12-15", "pair_types":[], "stock_lvls": ["EX"], // all the stock lvl in stock details are EX "is_ap": false //since stock lvl is EX, this will be false }
del_ids - array[integer]
  • 包含用户删除的独立stock_id的数组。

phy_trade_ids - array[number]
  • 将被更新的合同ID(当传递有效合同ID时,将更新合同的库存明细,如出入库数量、未出入库数量等)。

 

响应:

Related content