Files

stm-python-interfaces

This code base started out as simply the finished goods interface python script on the D: drive of our test server.

This location kind of stuck because a network share (INTERFACE) was created for the AS400 side of the finished goods interface and it is non-trivial to change that. From there the FTP package was created to handle the FTP transmissions between us and Maharam/Momentum that needed to be ported over for our shipping/invoicing cutover. At some point after that, it was determined it would be much easier to transmit our invoice data to Wells Fargo via FTP as opposed to true EDI and I took on that project as well which also now resides in the FTP package.

IMPORTANT When pulling changes down to production box...

Before you execute 'git pull' in the production repo; Please be sure to do the following:

  • Terminate scheduler.py job that should be running on the SUNBURYTEXTILE\Administrator account
  • Delete all .pyc files in \FTP (Technically optional. They should be refreshed either way)
  • git pull
  • Restart scheduler.py

This will force the recreation of the .pyc files when scheduler.py imports the scripts.

Failing to at least terminate the scheduler.py job before pulling changes will result in scheduler continuing to execute old code as the python source will not be recompiled until the scripts are next imported (i.e. restarting scheduler.py)

Getting a test evironment running on your machine

This code assumes that the root folder is D: just as it is on the test server. The most convenient way I've found to replicate this on my local machine is to:

  • Checkout the source into a directory on our file server.
  • Share that folder on the network with myself.
  • Mount that network folder as D: on my pc

From there, you'll need to create a few folders that the scripts will be expecting to be there:

  • D:\INTERFACE
    • \ERRORS
    • \PROCESSED
  • D:\FTP (this already should exist since theres code in it)
    • \INCOMING
    • \logs
    • \OLD
      • \KF
      • \MF
      • \MG
      • \GR
    • \SEND_KF
      • \SENT
    • \SEND_MF
      • \SENT
    • \SEND_MG
      • \SENT
    • \SEND_WF

With these folders created all of the scripts should be ready to run.

Dependencies

This list is not yet exhaustive.

Finished_Goods_Interface.py

This script, when run without any arguments, processes all CSV files located in \INTERFACE. These CSV files are generated by the AS400 when inventory is scanned in shipping. The script created Jomar inventory transactions based on this data that will keep the inventory in Jomar current.

After the script has processed a CSV it is moved into \INTERFACE\PROCESSED. If the script encountered any errors during processing the specific rows of the file that caused the errors are written to a separate CSV in \INTERFACE\ERRORS. These CSV files containing the error rows are e-mailed to Aaron automatically.

Worth noting: finishedGoodsStart.ps1 and finishedGoodsStop.ps1 start and stop a file watcher script that automatically executes Finished_Goods_Interface.py as soon as a CSV file is created in \INTERFACE. This should pretty much be running at all times.