User Tools

Site Tools


en:cobi.wms:setting_up_the_team_counting_service_inventorycountingservice

This is an old revision of the document!


Setting Up the Team Counting Service (InventoryCountingService)

The COBI.wms InventoryCountingService (team counting service) is a separate Windows service for team counts during stocktaking.
It receives the counts from the handheld scanners, stores an processes them temporarily and then transfers them to SAP Business One via the Service Layer on a schedule and step by step.
As a result, the app is not blocked after sending, users can continue working immediately, and problems caused by many simultaneous postings via the Service Layer are avoided.

The team counting service is free of charge. No additional license is required.

Important as of COBI.wms 2.43:
As of COBI.wms version 2.43, team counting lists can only be counted via the team counting service.
If the service is not installed and registered in the management database, the app shows an error message when counting team counting lists.

New in Version 1.4

  • Multi-tenant support: The service name can be chosen freely. This allows several instances of the service to be installed on one server, e.g. one per company or an additional test instance (see section 7).
  • API port in setup: The service port is now defined directly during installation.
  • Improved performance compared to versions 1.1, 1.2 and 1.3 (up to a factor of 10 possible).

If you are using an older version, see section 10 for how to update.

1. Prerequisites

  • A Windows server on which the service runs permanently and which can reach the SAP database or SAP server.
  • The server must be reachable for the handheld scanners (Wi-Fi/network) via the API port (default: 61000).
  • Administrator rights on the server.
  • Credentials of an SAP Business One user.

2. Preparing the Management Database

So that the app can find the service, the COMPANIES table of the COBI.wms management database needs two additional fields.
Run the matching script once on your management database:

MSSQL

ALTER TABLE dbo.COMPANIES ADD
INCAPIURL VARCHAR(255),
INCAPIKEY VARCHAR(255);

HANA

ALTER TABLE COBIWMS.COMPANIES ADD (
INCAPIURL VARCHAR(255),
INCAPIKEY VARCHAR(255)
);

Note: If the script reports that the columns already exist, the fields have already been created and nothing else needs to be done.
If your management database or schema is not named COBIWMS, adjust the name in the script accordingly.

3. Installing the Service

Run the setup file as administrator on the designated Windows server and follow the wizard.
The numbers in the screenshots correspond to the numbers in the description.
COBI.wms Team Counting Service 1.4.exe

3.1 Service Name

  • Service name (1): Name of the Windows service. It must be unique on the server. Letters, digits, dots, hyphens and underscores are allowed.
    Default: COBI.wms-InventoryCounting-Service. For an additional instance, choose a different name, e.g. COBI.wms-InventoryCounting-Service-Test.
  • Click Next (2) to continue.

3.2 Destination Folder

  • Default folder: C:\Program Files\COBI.wms-inventorycounting-service. At least 119 MB of free disk space is required.
  • For an additional instance, choose a separate folder, e.g. C:\Program Files\COBI.wms-inventorycounting-service-Test.
  • Click Next (3) to continue.

3.3 SAP Connection

No. Field Description
(4) Database Type Database type of the SAP server: dst_HANADB for SAP HANA, or dst_MSSQL2014, dst_MSSQL2016, dst_MSSQL2017, dst_MSSQL2019 or dst_MSSQL2022 for the matching Microsoft SQL Server version.
(5) SAP Server MSSQL: name or IP address of the SQL server (e.g. SAPServer01 or 192.168.0.1).
HANA: address and port of the HANA server (see example below).
(6) SAP Database Name of the SAP company database, e.g. SBODemoDE.
(7) SAP User SAP Business One user, e.g. manager.
(8) SAP Password Password of this user.


Click Next (9) to continue.
Example of the SAP server for HANA:

3.4 Service Configuration

No. Field Description
(10) API Port Port on which the service and the Hangfire dashboard are available (default: 61000). This port must be opened in the firewall (section 4) and entered in INCAPIURL (section 5). With several instances, each instance needs its own port.
(11) API Key A secure key of your choice. It authenticates the connection between the app and the service and must later be entered in INCAPIKEY. Please do not use the example value.
(12) Cron Expression Interval at which the service transfers the collected counts to SAP. Examples: 0 0 * * * = daily at 00:00, */30 * * * * = every 30 minutes. For help with the cron syntax, see crontab.guru.
(13) Hangfire User User name for the monitoring dashboard (section 6).
(14) Hangfire Password Password for the monitoring dashboard. Please do not use the example value.


Click Next (15) to continue.

Note on the interval: Counts are only transferred to SAP when the job runs. Choose the interval to suit your stocktaking process. If needed, you can start the processing manually at any time in the Hangfire dashboard (section 6).

3.5 Completing the Installation

  • Check the destination folder and click Install (16).
  • The files are installed.

  • Click Finish (17) to close the setup.

3.6 Starting the Service

After installation, the service has the status “Stopped” and must be started once:

  • Open the Task Manager, go to the Services tab, right-click the service and select Start (18).
  • Alternatively, start the service in the Windows Services console (services.msc).
  • In services.msc, check that the startup type is set to Automatic so that the service starts again after the server restarts.

3.7 Registering the Service Manually

If the service does not appear in the list of services after installation, it can be installed manually using the script registerWindowsService.ps1 in the installation folder:

  1. Open PowerShell as administrator.
  2. Navigate to the installation folder:
    cd "C:\Program Files\COBI.wms-inventorycounting-service"
  3. Run the script:
    .\registerWindowsService.ps1
  4. Open Services (services.msc), check that the service has been created and start it.

If the script cannot be run (e.g. the message “running scripts is disabled on this system”), unblock the file via right-click → Properties → Unblock, or allow script execution for the current session:

Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass

4. Opening the Firewall Port

Important: The API port defined during installation (default: 61000) must be open for inbound connections in the server's Windows firewall so that the handheld scanners can reach the service.
Example (PowerShell as administrator):

New-NetFirewallRule -DisplayName "COBI.wms InventoryCounting Service" -Direction Inbound -Protocol TCP -LocalPort 61000 -Action Allow

With several instances, open every port in use.

5. Registering the Service in the Management Database

So that the app knows where to find the service, enter the address and API key in the management database.
Adjust the IP address, API port, API key and company ID to your environment:

MSSQL

UPDATE dbo.COMPANIES
SET INCAPIURL = 'http://10.10.10.20:61000/b1s/v1',
INCAPIKEY = 'YOUR_API_KEY'
WHERE COMPANYID = 'Your_SAP_Company_Name';

HANA

UPDATE COBIWMS.COMPANIES
SET INCAPIURL = 'http://10.10.10.20:61000/b1s/v1',
INCAPIKEY = 'YOUR_API_KEY'
WHERE COMPANYID = 'Your_SAP_Company_Name';
  • INCAPIURL: http://server IP address:API port/b1s/v1. The port must match the API port chosen during installation.
  • INCAPIKEY: exactly the API key defined during installation.
  • COMPANYID: the company as stored in the COMPANIES table. Each company that uses the service needs its own row.

Then restart the app on the handheld scanners.

6. Monitoring via the Hangfire Dashboard

The service includes its own dashboard for monitoring the background processes.

  1. Open a browser on the server and go to http://localhost:61000/hangfire. If you chose a different API port, replace 61000 accordingly.
  2. Log in with the Hangfire user and password you defined during installation (section 3.4).
  3. The Recurring Jobs tab shows the scheduled job. If you do not want to wait for the next interval, you can start the processing manually at any time using Trigger now.

Hangfire Dashboard - Recurring Jobs

7. Multiple Companies (Multi-Tenant)

As of version 1.4, several instances of the service can run on one server, e.g. one per company or an additional instance for a test database.
To do this, install the service again for each company and assign each instance:

  • a unique service name (section 3.1),
  • its own destination folder (section 3.2),
  • the matching SAP database (section 3.3),
  • its own API port (section 3.4).

Open each port in the firewall (section 4) and enter the matching INCAPIURL and INCAPIKEY for each company in the management database (section 5).

Example:

Company (COMPANYID) Service name API port INCAPIURL
SBODemoDE COBI.wms-InventoryCounting-Service 61000 http://10.10.10.20:61000/b1s/v1
SBODemoDE_TEST COBI.wms-InventoryCounting-Service-Test 61001 http://10.10.10.20:61001/b1s/v1

8. How It Works & Limitations

When the scanners send data to the service, it first stores the counts under “Requests”.
During processing (job), the following logic applies:

  • Combining (different users): If different users count the same item, the service adds up the counted quantities.
  • Overwriting (same user): If the same user counts the same item several times (e.g. a correction), the older entries are ignored and only the latest count is processed.

Note on performance:
The processing speed is mainly limited by SAP Business One, not by the COBI.wms service.
As a rough guide: for a stock count with approx. 5,000 lines and 11 counters, the SAP system needs about 2 hours for processing.

User experience:
App users do not notice this background process.
As soon as the data has been successfully handed over to the service, users can continue working in the app without waiting.

9. Changing the Configuration Later (appsettings.json)

If the configuration needs to be changed after installation (e.g. because the SAP password has changed or a different port is to be used), the setup does not have to be run again.
You can make the changes directly in the configuration file.

Open the file appsettings.json in the installation folder (default: C:\Program Files\COBI.wms-inventorycounting-service) with a text editor (as administrator).
With several instances, each instance has its own appsettings.json in its installation folder.

The most important fields:

  • Kestrel → Endpoints → Http → Url: Address and port on which the service and the Hangfire dashboard run (e.g. http://0.0.0.0:61000). Change the port number at the end if a different port is to be used. Then also update INCAPIURL in the management database and the firewall rule.
  • SAP → Server: Address of the SAP server.
  • SAP → Database: Name of the SAP company database.
  • SAP → User / Password: The SAP Business One credentials.
  • SAP → DatabaseType: The selected database type (e.g. dst_HANADB or dst_MSSQL2019).
  • Jobs → UpdateInventoryCountingJobCron: The interval (cron expression) for processing.
  • Hangfire → User / Password: The credentials for the monitoring dashboard.
  • Api → Key: The authentication key for the connection between the handheld scanners and the service. Must match INCAPIKEY.

Restart the service in the Services console (services.msc) after every change.

Important: Handling passwords

To change a password (e.g. in the SAP or Hangfire block), enter the new password in plain text in appsettings.json. Save the file and restart the service.

On startup, the service automatically detects that the password is in plain text and hashes it immediately. When you open the file again, you will only see the hash value instead of your password.

10. Updating from Version 1.0, 1.2 or 1.3

  1. Note down the current settings from appsettings.json (SAP connection, API key, cron expression, port, Hangfire user) or back up the file.
    Note: The passwords are only stored there as a hash. Therefore, keep the SAP password and the Hangfire password at hand separately.
  2. Uninstall the old version as described in section 11.
  3. Install version 1.4 as described in section 3 and enter the same values.
  4. Make sure that the API port and API key match INCAPIURL and INCAPIKEY in the management database. Otherwise, update the values as described in section 5.
  5. Start the service and check in the Hangfire dashboard that the job has been created.

11. Uninstalling the Service

To remove the service (e.g. before installing a new version), proceed as follows:

  1. Stop the service: Open the Windows Services console (services.msc), right-click the service (default: COBI.wms-InventoryCounting-Service) and select Stop.
  2. Uninstall the program: Open Settings → Apps → Installed apps (or Control Panel → Programs and Features), select the COBI.wms team counting service and click Uninstall.
  3. Remove the service registration: Open a command prompt or PowerShell as administrator and run the following command. If you chose a different service name during installation, use that name.
sc.exe delete "COBI.wms-InventoryCounting-Service"

Note: In PowerShell, always type sc.exe including the extension. sc on its own is interpreted as a different command in PowerShell.
If the message “The specified service does not exist as an installed service” appears, the service has already been removed completely by the uninstallation and nothing else needs to be done.

If the service is no longer used:
Clear the fields INCAPIURL and INCAPIKEY in the management database. Otherwise, the app keeps trying to reach the service and shows an error message when team counting lists are opened.
Please note: As of COBI.wms 2.43, team counting lists can no longer be counted without the service.

MSSQL

UPDATE dbo.COMPANIES
SET INCAPIURL = NULL,
INCAPIKEY = NULL
WHERE COMPANYID = 'Your_SAP_Company_Name';

HANA

UPDATE COBIWMS.COMPANIES
SET INCAPIURL = NULL,
INCAPIKEY = NULL
WHERE COMPANYID = 'Your_SAP_Company_Name';
en/cobi.wms/setting_up_the_team_counting_service_inventorycountingservice.1796210935.txt.gz · Last modified: by thuth

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki