Class Api1cClient
java.lang.Object
org.bgerp.plugin.inventoru.sync1c.service.Api1cClient
HTTP client for 1C ERP REST API.
One instance per 1C instance (holds auth credentials).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classSingle item in the write-off request. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCalls POST /hs/gtd_numbers/stocks and returns the list of stock records.sendWriteoff(int processId, String warehouseId, List<Api1cClient.WriteoffItem> items) Calls POST /hs/gtd_numbers/writeoff and sends write-off items to 1C.testConnection(String warehouseName) Checks that this connector really talks to 1C — and talks about stocks.
-
Constructor Details
-
Api1cClient
-
-
Method Details
-
getStocks
Calls POST /hs/gtd_numbers/stocks and returns the list of stock records.- Parameters:
warehouseName- 1C warehouse name (engineer full name or warehouse title)locationName- 1C location (construction site / object)- Returns:
- the stock rows of the warehouse, empty when it holds nothing
- Throws:
Exception- when 1C could not be reached or answered with something that is not a list
-
testConnection
Checks that this connector really talks to 1C — and talks about stocks. What it used to check was that the address answered something other than 401 or a server error; a 404, a 405 and a page of HTML all passed as success. That is how a broken exchange kept reporting a working one for a day. Now the answer goes through the same parsing the import does, and a warehouse name is asked for by name, so what is verified is the call the poller will make.- Parameters:
warehouseName- name of a warehouse in 1C to ask about, empty to ask about none- Returns:
nullwhen 1C answered with a list of stocks, otherwise what went wrong
-
sendWriteoff
Calls POST /hs/gtd_numbers/writeoff and sends write-off items to 1C.- Parameters:
processId- BGERP process ID (used as external reference in 1C)warehouseId- 1C UUID of the warehouseitems- list of items to write off- Returns:
- null on success, error message on failure
-