Setting Up the Team Counting Service (InventoryCountingService)
Table of Contents
The COBI.wms InventoryCountingService is a separate Windows service developed specifically for extensive team counting during inventory.
It receives the captured inventory counts from the handheld scanners asynchronously and processes them in the background.
This has the great advantage that the users' app is not blocked after sending, allowing them to continue working immediately.
1. Preparations (Management Database)
Before installing the service, two fields must be added to the COBI.wms management database. \ To do this, execute the following SQL script on your management database:
ALTER TABLE COBIWMS.COMPANIES ADD ( INCAPIURL VARCHAR(255), INCAPIKEY VARCHAR(255) );
Note: This SQL script can be used without modification for both Microsoft SQL Server and SAP HANA databases.
2. Installation of the Windows Service
COBI.wms Team Counting Service.exe
- Run the setup file for the Windows service (
COBI.wms.InventoryCounting.service.exe) on the designated Windows server. - During the installation, the wizard prompts for various configuration parameters:
- Database Type: Select the database type using the dropdown menu.
- SAP Server: Enter the address and port of your SAP server here (Format:
IP:PORT, e.g.,192.168.0.1:30015). - SAP Database: Enter the database name / company database here.
- SAP User: Enter the SAP username here.
- SAP Password: Enter the SAP password here.
- Cron Expression: Define the time interval at which the service should process the received counts (help on cron syntax can be found at crontab.guru).
- API Key: Set a secure API key. This will later authenticate the connection between the handheld scanners (app) and this service.
- Hangfire User & Password: Set the login credentials here. These will be required later to access the monitoring dashboard (Hangfire).
Complete the setup.
The Windows service will then be registered and started automatically.
You can verify this in the Windows Services management (services.msc).
3. Firewall & Database Update
Important: Port Forwarding
By default, the service runs on port 61000.
It is mandatory that this port is accessible for the handheld scanners (WLAN/network) in the server's Windows firewall!
After a successful installation, you must inform the COBI.wms management database where to find the service.
To do this, execute the following update script (adjust the IP address, port, API key, and Company Name to your environment):
UPDATE COBIWMS.COMPANIES SET INCAPIURL = 'http://10.10.10.20:61000/api/v1/', INCAPIKEY = 'YOUR_CHOSEN_API_KEY' WHERE COMPANY = 'Your_SAP_Company_Name';
4. Monitoring via Hangfire Dashboard
The service includes its own dashboard for monitoring background processes.
- Open a browser on the server and go to the address
http://localhost:61000/hangfire. - Log in using the Hangfire User and Password that you set during installation (Step 2).
- Under the “Recurring Jobs” tab, you will see the scheduled cron job. If you do not want to wait for the next automatic interval, you can manually trigger the processing at any time by clicking the “Trigger now” button.
5. Functionality & Limitations
When the scanners send data to the service, it initially saves the counts under “Requests”.
During processing (cron job), the following logic applies:
- Consolidation (different users): If different users count the same item, the service adds the counted quantities together.
- Overwriting (same user): If the same user counts the same item multiple times (e.g., as a correction), the older entries are ignored, and only the latest count is processed.
Performance Note:
The processing speed is primarily limited by SAP Business One, not by the COBI.wms service.
As a rough guideline: For an inventory count with approximately 5,000 rows and 11 counters, the SAP system requires about 2 hours for processing.
User Experience:
The app user does not notice this background process.
As soon as the data is successfully transferred to the service, the user can continue working in the app immediately without any wait time.
6. Subsequent Configuration (appsettings.json)
If it becomes necessary to adjust the configuration after the initial installation (e.g., if the SAP password changes or a different port is to be used for Hangfire), the setup does not need to be run again.
You can make the changes directly in the configuration file.
Navigate to the installation directory of the Windows service (usually located under C:\COBI.wms-inventorycounting-service or similar) and open the appsettings.json file with a text editor (as Administrator).
The configuration is divided into different blocks. Here is an overview of the most important fields and their functions:
- Kestrel → Endpoints → Http → Url: The port on which the service and the Hangfire dashboard run (Default:
http://0.0.0.0:61000). Change the port number at the end here if the default port is already in use. - SAP → Server: Address and port of the SAP server.
- SAP → Database: Name of the SAP company database.
- SAP → User / Password: The credentials for SAP Business One.
- SAP → DatabaseType: The selected database type (e.g.,
dst_HANADBordst_MSSQL2016). - Jobs → UpdateInventoryCountingJobCron: The interval (cron expression) for asynchronous processing.
- Hangfire → User / Password: The access data for the monitoring dashboard.
- Api → Key: The authentication key for the connection between the handheld scanner and the service.
Important: Handling Passwords
If you want to change a password (e.g., in the `“SAP”` or `“Hangfire”` block), simply enter the new password in plain text into theappsettings.jsonfile. Save the file and restart the Windows service via the Services management (services.msc).
Upon starting, the service automatically detects the plain text and immediately hashes the password. If you open the file again afterwards, you will only see the unreadable hash value instead of your password.

