Class Sync1cConnector

java.lang.Object
org.bgerp.plugin.inventoru.sync1c.model.Sync1cConnector

public class Sync1cConnector extends Object
1C connector (organization / region) — one configured way to exchange stock data with one 1C base. Stored in inventoru_sync1c_connector table.
  • Field Details

    • PROTOCOL_HS

      public static final String PROTOCOL_HS
      ERP calls 1C's custom HTTP service (/hs/gtd_numbers/*) — requires a 1C developer.
      See Also:
    • PROTOCOL_FILE

      public static final String PROTOCOL_FILE
      Manual CSV file exchange — no 1C-side development needed.
      See Also:
    • PROTOCOL_ODATA

      public static final String 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

      public String getTitle()
    • setTitle

      public void setTitle(String title)
    • getApiUrl

      public String getApiUrl()
    • setApiUrl

      public void setApiUrl(String apiUrl)
    • getUsername

      public String getUsername()
    • setUsername

      public void setUsername(String username)
    • getPassword

      public String getPassword()
    • setPassword

      public void setPassword(String password)
    • 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

      public String getProtocol()
    • setProtocol

      public void setProtocol(String protocol)
    • getConfig

      public String getConfig()
    • setConfig

      public void setConfig(String config)
    • 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

      public String getODataBalancePath()
    • getODataCatalogPath

      public String getODataCatalogPath()
    • getODataItemKeyField

      public String getODataItemKeyField()
    • getODataQtyField

      public String getODataQtyField()
    • getODataWarehouseKeyField

      public String getODataWarehouseKeyField()
    • getODataBarcodePath

      public String getODataBarcodePath()
      Empty = barcode import disabled for this connector.
    • getODataBarcodeCodeField

      public String getODataBarcodeCodeField()
    • getODataBarcodeItemKeyField

      public String getODataBarcodeItemKeyField()
    • getCsvDelimiter

      public Character getCsvDelimiter()
      CSV delimiter override for the file protocol, null to 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

      public String 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. 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

      public String getHsStocksPath()
      Path of the stocks method of the HS service, appended to getApiUrl(). 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

      public String getHsWriteoffPath()
      Path of the write-off method, see getHsStocksPath().
    • getStoreGuidParamId

      public int getStoreGuidParamId()
      Parameter of a store holding its GUID in 1C. Kept apart from getStoreExtIdParamId() 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

      public int getImportItemTypeId(String kind)
      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

      public Charset getCsvCharset()
      CSV charset override, null to detect. Accepts any JVM charset name, e.g. windows-1251.