Crate inventory_mgt

Source
Expand description

§Inventory Management

This crate is a port of an existing python project. It allows one to sync the current quantities from a supply inventory csv file to a filtered down view they have created of their own truncated “master inventory” (their own inventory)

§This program will update the quantity in master inventory with the quantity found in supply inventory based for each part in master inventory

  • The default filenames that program accepts are:

    • “SupplyInventory.csv” for the supply list
    • “MasterInventory.csv” for the master list
  • You can set your own filenames but you must specify their name and location in command line arguments

    • See how to use command line arguments below
  • Both csv files must include the following columns:

    VenCodePartNumberTotalQty

§Installation

You can install this application in one of two ways. Either clone the repo and build the release version with cargo, or simply use cargo install:

$ cargo install inventory-mgt

§Use

To use this application, simply run it with the generate command to generate a new master csv with updated quantity fields:

$ inventory_mgt generate

Make sure you are in the root folder where your SupplyInventory.csv and MasterInventory.csv files are. You can grab sample ones from the github repo.

Optionally you can pass in custom filenames with flags after the generate command:

$ inventory_mgt generate -m masterinv.csv -s supplyinv.csv

That’s it! Enjoy!

Structs§

MasterCache
MasterCache & Methods Holds the master inventory in a hashmap, where the key is the ven_code, and the value is a MasterPart struct. This is for efficiency when searching through the master cache.
MasterPart
CSV Structs Provides the structures for a part from the Master csv list

Enums§

InventoryConfig
Command Line Parsing InventoryConfig provides a structure for structopt to take in commands.

Functions§

run
run will take in an InventoryConfig enum config (parsed in main) and execute the appropriate program logic
update_master
Creates a new master csv file called “newmaster.csv” with the updated quantities, pulled from the supply csv file