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().Link type of the process thecontractfield is taken from, as a MySQL LIKE expression —contract:%for a contract of any billing.Value of theoperationfield of the write-off, empty to send no such field.getHsWriteoffOrganization(int valueId) Organization of 1C for a value of the process parameter — operators of one ERP are separate companies in 1C:Organization when the process parameter gives none, or the only one when no parameter is set.intList parameter of the process choosing the organization, seegetHsWriteoffOrganization(int).Path of the write-off method, seegetHsStocksPath().Name of the serial number field of a write-off line:serialunless the service calls it otherwise.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.booleanbooleanbooleanWhether the write-off names the location — the value ofgetStoreLocationParamId()of the store.booleanWhether the write-off names the organization, set by either organization key.booleanbooleanWhether 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 only reads 1C. It does not decide when the stock is written off in ERP — a file waits for the person to confirm, exactly as a push waits for 1C to accept (seeExportService.enqueue). Only OData writes off at once, because there nothing will ever confirm anything. -
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(). -
getHsWriteoffOperation
Value of theoperationfield of the write-off, empty to send no such field. -
getHsWriteoffSerialField
Name of the serial number field of a write-off line:serialunless the service calls it otherwise. -
getHsWriteoffContractLinkType
Link type of the process thecontractfield is taken from, as a MySQL LIKE expression —contract:%for a contract of any billing. Empty to send no contract. -
isHsWriteoffOrganization
public boolean isHsWriteoffOrganization()Whether the write-off names the organization, set by either organization key. -
getHsWriteoffOrganizationParamId
public int getHsWriteoffOrganizationParamId()List parameter of the process choosing the organization, seegetHsWriteoffOrganization(int). -
getHsWriteoffOrganization
Organization of 1C for a value of the process parameter — operators of one ERP are separate companies in 1C:hs.writeoff.organization.paramId=68 hs.writeoff.organization.value.1=ОМИПЛАТ ООО hs.writeoff.organization.value.2=ООО "ОМИКРОН"
- Returns:
- the name, empty when this value is not mapped — a value nobody mapped is not quietly written off in the name of the default company, it fails the entry instead.
-
getHsWriteoffOrganizationDefault
Organization when the process parameter gives none, or the only one when no parameter is set. -
isHsWriteoffLocation
public boolean isHsWriteoffLocation()Whether the write-off names the location — the value ofgetStoreLocationParamId()of the store. -
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.
-