Tims Service Install

The Tims Service was developed to send and retrieve data from the TIMS Application to integrate CERES and TIMS together.

 

Node.js & Code Editor Instructions

  1. Install Visual Studio Code — https://code.visualstudio.com/

  2. Install Node.js — https://nodejs.org/en/

  3. Install Git — https://git-scm.com/downloads

  4. Open Visual Studio Code.

  5. Use the following Shortcut to open the terminal window.

Ctrl + ` (Tilda is located under the esc key)
  1. In the select box in the top right of the terminal window. Open the select box and then click “Select Default Shell”

  2. Select “Git Bash” as default shell. (This may require a restart)

  3. If it does require a restart, go ahead and restart.

  4. If you had to restart Visual Studio Code, open the terminal window again.

Ctrl + `
  1. Make sure Node.js is installed properly.
node --version

  - if you get a response like “v12.0.0” Its installed correctly.

 

 

 

Setting Up SQL Server Browser and TCP Info

  1. Go To The Windows Search Box and search for the following.
SQL Server
  1. You should see an option labeled as SQL Server (Year) Configuration Manager. Open This.

    • Ex: SQL Server (2017) Configuration Manager
  2. Click the arrow to the left of “SQL Server Network Configuration Not the 32 bit option

  3. Right click “Protocols for SQLEXPRESS” and click “Open”

  4. Right Click TCP/IP and click “Enable”

    • If it tells you changes won’t change until its restarted, you can disregard that for now. We will do that later on.
  5. Right Click TCP/IP again and click “Properties”

  6. At the top of the box that pops up, select the “IP Addresses” tab

  7. Scroll all the way to the bottom of the list.

    • You will see a section labeled “IPALL”
    • Inside that section, type in 1433 in the TCP Port Box.
    • Click apply and ok.
      • Again, if it tells you changes won’t change until its restarted disregard for now. We will do that later on.

 

 

Setting Up SQL Server Services

  1. Look over to the menu all the way to the left. You should see a list of options:

    • SQL Server Services
    • SQL Server Network Configuration (32Bit)
    • SQL Native Client 11.0 Configuration (32Bit)
    • SQL Server Network Configuration
    • SQL Native Client 11.0 Configuration
  2. You want to right click the “SQL Server Services”and click “Open”

  3. Right click the “SQL Server Browser” and click “properties”

  4. At the top is 3 tabs, click the “Service” tab.

  5. Change the “Start Mode” option to automatic

  6. Click “Apply” and “Ok”

  7. Right click SQL Server (SQLEXPRESS) and click “Restart” Not The Agent Option

  8. Then right click SQL Server Browser and click “Start”

 

You should now be able to connect to the database with sequelize now using SQL Server Authentication.

 

 

Getting Project Files

  1. You will now get the project files.
  • Open a bash command line or open visual studio code and open the terminal
  • Navigate to the C: drive on the computer.
  • Then enter the line below
git clone https://github.com/ItsYaBoyFish/Tims-API-Service.git 
  • This will put the project files on the computer in the C: drive. Do not close the terminal window you will need it for the next step.

 

 

Initial Project Setup

  1. You will want to open the project using Visual Studio Code to do the rest.
  • With your terminal from the previous step still open, run the following command.
code .
  • In the event that the code command doesn’t work. You can simply open Visual Studio Code and Open the folder manually.
File -> Open Folder
  1. Next, install the project dependencies.
  • At this point, I would close any terminal windows and just work from inside Visual Studio Code.
  • Just in case you forget, here is how you open the terminal window inside VS Code. Make sure that you are using the bash terminal. (See above if you don’t have the bash terminal set by default.)
Ctrl + `
  • Inside the VS Code Terminal type the following command to install all of the project dependencies.
npm install
  1. Once the project dependencies are downloaded, run the following command:
node server
  • You should see a terminal output that says a config file has been created.

  • If you see an error relating to a port not being available, skip to the “Configuring The Config File” section to fix this. Then return back to this step.

  • Go ahead and open this file. We will make some changes here.

service_config.json

 

 

Configuring The Config File

If you change any values while the application server is running, you must restart it before the changes to the config file will show.

  1. The PORT value can be changed to just about any value. However, I would pick something in either the 3000, 5000 or 8080 - 8090. If the system allows the default, you can just leave it.

  2. Editing Config File Values

Config KeyDescription
IPThis is the IP Address the site can be accessed by.
AppReadyThis is used when the server starts. If this value is false when the server starts, which is its default value, it will not start any of the service intervals. If this value is true, the system assumes you have everything ready to go and to start all services.
PORTThis is the port number the app can be accessed by.
LocationThis is directly tied to TIMS Location data. Ask them for this.
UsingACMThis is an internal flag used to tell the service whether or not to consider ACM Tracking during operation.
TimeBetweenSyncThis is how many minutes between production inventory checks
TimeForDistributionSyncThis is what time to do the distribution sync. This is a number between 0 - 23 representing hours of the day.
SecondsTilNextAssetVerificationThis is how many seconds the system will wait before calling the Asset Verification Functionality.
SecondsTilNextWorkflowChangeThis is how many seconds the system will wait before calling the Asset Workflow State Update Functionality.
Workflow_State_StatusThis is the Filled Asset Status Value to be used during service operation.
Workflow_State_StateThis is the Filled Asset State Value to be used during service operation.
AcceptableStateThis is an array containing the list of acceptable status values to compare against
DB.PortThis is to explicitly set the port number for the SQL connection. In the event port 1433 can not be used, you will set that here.
SiteDBSThis is an array that contains all of the info needed for every db connection the service would use. There are two things you have to be concerned about. That is the Using & SettingUp keys. If the Using flag is set to true, the system will load the db connection when the service is started. Otherwise, it is ignored. The SettingUp key is there for us to allow the system to load the db connection, but it will not attempt to retrieve data for inventory unless that flag is set to false. This lets us configure the tank sizes with integration PN’s without having to worry about the system trying to send inventory.
  • ** You must leave the TimsDB and Timeclock Databases active, with both of them having a Using value of true and a SettingUp value of false. These are set with the sql scripts ran earlier.

 

 

Running SQL Script To Prep Database

  1. DO A BACKUP OF THE ENTIRE DATABASE BEFORE MOVING FORWARD
  • In VSCode with the project open, open the Terminal Window again if it was closed.
    Ctrl + `
  • Make sure you have made the changes to the SitesDB field in the config file as this next step pulls its info from here. (Enabling or Disabling Databases that are needed)

  • Run this command in the terminal to generate the sql file.

npm run sql
  • This will generate a file named SQL Install Script.sql in the Installs directory of the project files., you will take and drag this in Sql Server Management Studio

  • Once the file has loaded, click the execute button to run the whole file.

 

 

Project First Start

  1. You can now use the terminal inside of VS Code to run the following command again.
node server
  • This time you should see messages telling you that databases have connected.
  • You are ready to open the UI and begin changing the TIMS API Data.
  • Open a web browser and type the following in
http://{IP}:{PORT}
  • Replace the {PORT} with the port number used in the config file.

  • Replace the {IP} with the IP value used in the config file.

  • In addition, one of the messages in the console will tell you what the port the system is using. It will read something like “Server Started on Port 8080”

  • Next, you will see a login screen for you to put in a password.

  • The Password is Ce%1405 Do Not share this with anyone

Setting TIMS Credentials

  1. Setting API Credentials
  • Once you login, you will be greated with a menu.
  • Select the “New Site” option.
  • You will then enter the data TIMS provides for all of there API info. Then Click Save.
  1. Setting Integration Part Numbers
  • Click the “Set Tims Part Numbers” button on the Dashboard.

  • You have to have a Supplier Code from the customer for each gas. You can’t enter any info for part numbers until you have this.

  • Once you have the code, type it in the Supplier input box.

  • Then select whether it is a liquid or compressed production type.

  • Then the database selection will become available. Select your database and your sizes will populate.

  • You will have an input box to the right side of every size that is shown to you. Here you can enter the part number for TIMS.

  • Once you are done, click the Update Sizes button to save the changes.

** If you are ever having to change this data in the future, you can click the “Load Supplier Code From Records” in the bottom left. This will let you use the Integration PN’s that already exist to prepopulate the Supplier for you.

  1. On the Dashboard, you have access to 2 utilities. They allow you to trigger a manual inventory upload or manual distribution data retrieve. Just in case it is ever needed.