Class ODataClient
java.lang.Object
org.bgerp.plugin.inventoru.sync1c.service.ODataClient
PROTOTYPE client for the 1C standard OData interface (/odata/standard.odata).
Unlike the HS protocol (
Api1cClient), OData requires NO custom code on the 1C side —
only publishing the infobase on a web server with the standard OData interface enabled.
The trade-off: metadata object names (register, catalog, field names) differ between 1C
configurations (УТ/УНФ/КА/ERP/БП), so they are passed in as parameters configured by the
admin instead of being hard-coded into a 1C-side service.
Reads stock balances in two requests:
1. GET {apiUrl}/{balancePath}?$format=json[&$filter={warehouseKeyField} eq guid'...']
— the accumulation register balance virtual table, e.g.
AccumulationRegister_ЗапасыНаСкладах/Balance(). Rows carry item/warehouse GUIDs
and the quantity, but no human-readable names.
2. GET {apiUrl}/{catalogPath}?$format=json&$select=Ref_Key,Description
— the nomenclature catalog, to resolve item GUIDs to names.
Errors are thrown (not swallowed into an empty list as in Api1cClient) — this client is
called from the interactive admin preview where the admin must see what went wrong.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfetchBarcodes(String barcodePath, String codeField, String itemKeyField) Fetches the nomenclature barcode register: barcode → item GUID.fetchStocks(String balancePath, String catalogPath, String itemKeyField, String qtyField, String warehouseKeyField, String warehouseGuid) Fetches stock balances over OData and maps them to the protocol-agnosticApi1cStockshape consumed byImportService.importFromRows(Sync1cConnector, EngineerWarehouse, List).testConnection(String balancePath) Tests the connection by fetching one row of the balance table.
-
Constructor Details
-
ODataClient
-
-
Method Details
-
fetchStocks
public List<Api1cStock> fetchStocks(String balancePath, String catalogPath, String itemKeyField, String qtyField, String warehouseKeyField, String warehouseGuid) throws Exception Fetches stock balances over OData and maps them to the protocol-agnosticApi1cStockshape consumed byImportService.importFromRows(Sync1cConnector, EngineerWarehouse, List).- Parameters:
balancePath- resource path of the balance virtual table, e.g.AccumulationRegister_ЗапасыНаСкладах/Balance()catalogPath- resource path of the nomenclature catalog, e.g.Catalog_Номенклатура; empty = skip name resolution (product_name falls back to the GUID)itemKeyField- balance row field with the item GUID, e.g.Номенклатура_KeyqtyField- balance row field with the quantity, e.g.КоличествоBalancewarehouseKeyField- balance row field with the warehouse GUID, e.g.Склад_KeywarehouseGuid- optional warehouse GUID to filter by ($filter); empty = all warehouses- Throws:
Exception
-
fetchBarcodes
public Map<String,String> fetchBarcodes(String barcodePath, String codeField, String itemKeyField) throws Exception Fetches the nomenclature barcode register: barcode → item GUID. In typical configurations this isInformationRegister_ШтрихкодыНоменклатурыwith fieldsШтрихкодandНоменклатура_Key(overridable per connector).- Throws:
Exception
-
testConnection
-