Class Sync1cConnector
java.lang.Object
org.bgerp.plugin.inventoru.sync1c.model.Sync1cConnector
1C connector (organization / region) — one configured way to exchange stock data with one 1C base.
Stored in inventoru_sync1c_connector table.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringManual CSV file exchange — no 1C-side development needed.static final StringERP calls 1C's custom HTTP service (/hs/gtd_numbers/*) — requires a 1C developer.static final StringERP reads 1C's standard OData interface (/odata/standard.odata) — no 1C-side development needed, only publishing the infobase on a web server. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCSV charset override,nullto detect.CSV delimiter override for the file protocol,nullto detect from the content.getCsvField(String key, String defaultName) Header name of a CSV column, overridable per connector because every 1C base and every export template names its columns differently.Path of the stocks method of the HS service, appended togetApiUrl().Path of the write-off method, seegetHsStocksPath().intgetId()intType given to a nomenclature position the import creates, 0 to leave it without one.intgetImportItemTypeId(String kind) Type for a position the import creates, chosen by what 1C calls its kind.intEmpty = barcode import disabled for this connector.intintParameter of a store holding its GUID in 1C.intParameter of a store holding the location (object) 1C keeps its stocks under, if any.intParameter of a store holding its name in 1C — the HS protocol asks for stocks by name, not by id, so a store that syncs over HS needs one.getTitle()booleanWhether to drop the last line of a stock CSV.booleanbooleanbooleanbooleanWhether the protocol can push a write-off to 1C on its own.voidvoidvoidsetEnabled(boolean enabled) voidsetId(int id) voidsetItemExtIdParamId(int itemExtIdParamId) voidsetPassword(String password) voidsetProtocol(String protocol) voidsetStoreExtIdParamId(int storeExtIdParamId) voidvoidsetUsername(String username)
-
Field Details
-
PROTOCOL_HS
ERP calls 1C's custom HTTP service (/hs/gtd_numbers/*) — requires a 1C developer.- See Also:
-
PROTOCOL_FILE
Manual CSV file exchange — no 1C-side development needed.- See Also:
-
PROTOCOL_ODATA
ERP reads 1C's standard OData interface (/odata/standard.odata) — no 1C-side development needed, only publishing the infobase on a web server. Prototype, import (stocks) only.- See Also:
-
-
Constructor Details
-
Sync1cConnector
public Sync1cConnector()
-
-
Method Details
-
getId
public int getId() -
setId
public void setId(int id) -
getTitle
-
setTitle
-
getApiUrl
-
setApiUrl
-
getUsername
-
setUsername
-
getPassword
-
setPassword
-
isEnabled
public boolean isEnabled() -
setEnabled
public void setEnabled(boolean enabled) -
getItemExtIdParamId
public int getItemExtIdParamId() -
setItemExtIdParamId
public void setItemExtIdParamId(int itemExtIdParamId) -
getStoreExtIdParamId
public int getStoreExtIdParamId() -
setStoreExtIdParamId
public void setStoreExtIdParamId(int storeExtIdParamId) -
getProtocol
-
setProtocol
-
getConfig
-
setConfig
-
isPushProtocol
public boolean isPushProtocol()Whether the protocol can push a write-off to 1C on its own. Only HS can; a file is carried over by a person and OData is read-only, so for those two the ERP writes the stock off locally and the export queue entry only records what has to be posted in 1C. -
isFileProtocol
public boolean isFileProtocol() -
isODataProtocol
public boolean isODataProtocol() -
getODataBalancePath
-
getODataCatalogPath
-
getODataItemKeyField
-
getODataQtyField
-
getODataWarehouseKeyField
-
getODataBarcodePath
Empty = barcode import disabled for this connector. -
getODataBarcodeCodeField
-
getODataBarcodeItemKeyField
-
getCsvDelimiter
CSV delimiter override for the file protocol,nullto detect from the content. Real 1C exports are usually semicolon-separated; detection handles that, this is the escape hatch for a file that detection gets wrong (e.g. a single-column file). -
getCsvField
Header name of a CSV column, overridable per connector because every 1C base and every export template names its columns differently. An empty override means "use the built-in names and aliases", which already cover both our own format and a typical Russian export. -
isCsvSkipLastLine
public boolean isCsvSkipLastLine()Whether to drop the last line of a stock CSV. A 1C export ends with a totals line — a name and a sum, no code — which is not a position and must not be confirmed as one. It is visible on the preview and unchecked by hand; where every file from this base carries one, the key saves that click. -
getHsStocksPath
Path of the stocks method of the HS service, appended togetApiUrl(). The name of the service itself belongs to the URL of the instance, not to the code: a 1C service is named by whoever writes it, and the plugin has no business assuming the name. -
getHsWriteoffPath
Path of the write-off method, seegetHsStocksPath(). -
getStoreGuidParamId
public int getStoreGuidParamId()Parameter of a store holding its GUID in 1C. Kept apart fromgetStoreExtIdParamId()because the two ends want different things: a write-off names the warehouse by whatever 1C can find it by — a code does — while the OData filter takes a GUID and nothing else. Where a single value serves both, this may stay unset and the ext id parameter is used. -
getStoreNameParamId
public int getStoreNameParamId()Parameter of a store holding its name in 1C — the HS protocol asks for stocks by name, not by id, so a store that syncs over HS needs one. -
getStoreLocationParamId
public int getStoreLocationParamId()Parameter of a store holding the location (object) 1C keeps its stocks under, if any. -
getImportItemTypeId
public int getImportItemTypeId()Type given to a nomenclature position the import creates, 0 to leave it without one. The set of parameters a position shows on its card comes from its type, so a position created without a type shows none at all — the code of 1C written into it stays invisible to the person, even though the export reads it fine. A 1C file has nothing to derive the type from (its "Вид номенклатуры" is not our hierarchy), so the connector names one. -
getImportItemTypeId
Type for a position the import creates, chosen by what 1C calls its kind. A single default type is a start, not an end: the type carries the accounting kind too, and a ladder and a cable are not accounted the same way. The kinds come from the file as they are written in 1C, so they are the key:import.itemType.Материалы=4 import.itemType.Инвентарь и хозяйственные принадлежности=6
Matching ignores case and surrounding spaces: the names are typed in by hand, and a mistyped case is likelier than two kinds telling each other apart by it.- Parameters:
kind- value of the kind column, may be empty- Returns:
- the type, or
getImportItemTypeId()when the kind is unknown or absent
-
getCsvCharset
CSV charset override,nullto detect. Accepts any JVM charset name, e.g. windows-1251.
-