@livup/wms_module

LivUp Warehouse management system core - this node_module contains the basic schemas and methods for a WMS implementation

Stats

stars šŸŒŸissues āš ļøupdated šŸ› created šŸ£size šŸ‹ļøā€ā™€ļø
@livup/wms_module
Minified + gzip package size for @livup/wms_module in KB

Readme

livup-wms-module

ā”œā”€ā”€ project_root

ā”œ ā”œā”€ā”€ model

ā”œ ā”œā”€ā”€ schema

ā”œ ā”œā”€ā”€ test

ā”œ ā”œā”€ā”€ utils

ā”œ ā”œā”€ā”€ wms_module.js

ā”œ ā”œā”€ā”€ wms_error.js

ā”œ ā”œā”€ā”€ errorCodes.js

ā”œ ā”œā”€ā”€ .eslintrc

ā”œ ā”œā”€ā”€ .gitignore

ā”œ ā”œā”€ā”€ package.json

  • Running tests: npm test

  • Usage:

map: [[[]]] (variable according with the number of coordinates of the storage)

position: Object { x: Number, y: Number, z: Number} (variable according with the number of coordinates of the storage)

item: Object { itemCode: String (required)- item unique identifier, info: Object - generic info about the item, quantity: Number (required) - quantity stored }

WMSModule

  • constructor
    • parameters

ā”œ ā”œā”€ā”€ā”€ā”€ mongoose (required)

ā”œ ā”œā”€ā”€ā”€ā”€ storageModelName - String (required)

ā”œ ā”œā”€ā”€ā”€ā”€ containerModelName - String (required)

ā”œ ā”œā”€ā”€ā”€ā”€ storedCollectionName - String (required)

  • createStorageModel()

  • createContainerModel({position})

ā”œ ā”œā”€ā”€ā”€ā”€ position - Object (required)

  • createTransactionModel({transactionModelName})

ā”œ ā”œā”€ā”€ā”€ā”€ position - Object (required)

Container

Container:

  • addItems(items, code): add items array inside container identified by the code provided. If container already exists update it or creates a new one in database using code

ā”œ ā”œā”€ā”€ā”€ā”€ items - [items]

ā”œ ā”œā”€ā”€ā”€ā”€ code - String: container unique code identifier

  • findOne({code}): returns a container matching code if exists

ā”œ ā”œā”€ā”€ā”€ā”€ code - String: container unique code identifier

  • removeItem(item, code): remove item from container identified by code

ā”œ ā”œā”€ā”€ā”€ā”€ item - Object

ā”œ ā”œā”€ā”€ā”€ā”€ code - String: container unique code identifier

  • createInstance({ name, code, items, containerModelName })

ā”œ ā”œā”€ā”€ā”€ā”€ name - String (required): unique name for container

ā”œ ā”œā”€ā”€ā”€ā”€ code - String (required, unique): unique identifier for container

ā”œ ā”œā”€ā”€ā”€ā”€ items - Object

ā”œ ā”œā”€ā”€ā”€ā”€ containerModelName - Name of the model to be used to generate the instance.

Storage

  • createInstance({name, code, containerModelName, positionCapacity, mapNumberOfCoordinates ,map}: creates a new Storage in database

ā”œ ā”œā”€ā”€ā”€ā”€ name - String (required): unique name for storage

ā”œ ā”œā”€ā”€ā”€ā”€ code - String (required, unique): unique identifier for storage

ā”œ ā”œā”€ā”€ā”€ā”€ positionCapacity - Number (required): how many containers can be stored in a same position

ā”œ ā”œā”€ā”€ā”€ā”€ mapNumberOfCoordinates - Number (required): number of coordinates used in map

ā”œ ā”œā”€ā”€ā”€ā”€ map - [[[containerModelName]]](required): map of stored containers identified by position

  • findOne({code}): returns a storage matching code if exists

ā”œ ā”œā”€ā”€ā”€ā”€ code - String: storage unique code identifier

  • findOneAndPopulateMap({code}): returns a storage matching code if exists and populate map

ā”œ ā”œā”€ā”€ā”€ā”€ code - String: storage unique code identifier

  • checkIfPositionIsAvailable(containerId, position, storageCode) - check if a position is available inside storage

ā”œ ā”œā”€ā”€ā”€ā”€ containerId - String : containerId you want to store

ā”œ ā”œā”€ā”€ā”€ā”€ position - Object : position you want to check

ā”œ ā”œā”€ā”€ā”€ā”€ storageCode - String: storage you want to check position

  • addContainerToStorage(container, storageCode, position) - adds a container into a position

ā”œ ā”œā”€ā”€ā”€ā”€ container: Object - container to store

ā”œ ā”œā”€ā”€ā”€ā”€ storageCode: - String: storage unique code identifier

ā”œ ā”œā”€ā”€ā”€ā”€ position: Object - position to store

  • removeContainerFromStorage(container, storage)

ā”œ ā”œā”€ā”€ā”€ā”€ container: Object - container you want to remove

ā”œ ā”œā”€ā”€ā”€ā”€ storage: Object - storage that will have container removed

  • getPositions({ items, storageCode }) - finds items inside storage and returns an array of containers found for each item

ā”œ ā”œā”€ā”€ā”€ā”€ items: Array of Items you want to look for

ā”œ ā”œā”€ā”€ā”€ā”€ storageCode: String - code of storage you are searching

Transaction

  • createTransactionModel() - Generate the base schema and models based on the given model names. It should be called after the model names were given.

  • AddTransaction({container, storage, info, quantity, item, status, kind}) - Creates a transaction on the transaction database.

ā”œ ā”œā”€ā”€ā”€ā”€ container - Container object which is suffering the transaction

ā”œ ā”œā”€ā”€ā”€ā”€ storage - Storage object which is suffering the transaction

ā”œ ā”œā”€ā”€ā”€ā”€ info - Object that can hold any additional infomation needed.

ā”œ ā”œā”€ā”€ā”€ā”€ quantity - Total amount this transaction registers. It uses positive values to add and negative to remove

ā”œ ā”œā”€ā”€ā”€ā”€ item - : {ObjectId, Quantity}Item related to the transaction. It should hold the initial intended value of the transaction

ā”œ ā”œā”€ā”€ā”€ā”€ status - String for use of the application

ā”œ ā”œā”€ā”€ā”€ā”€ kind - Definition of the kind of transaction (redundant with the quantity signal, but easier to use for query)

Step-by-Step Example of use

  • The very first step is setting the name of the 3 kinds of models to be used. (containerModelName, storageModelName , storedCollectionName) for the container, storage and items respectively. This is done through the use creation of a WMSModule object with those names and the mongoose reference as parameters.

  • After the names are set we can create the models. The WMSModule has 3 main functions to do that: createStorageModel, createContainerModel, createTransactionModel.

The storage and the container ones return the models that can be used to instantiate the objects through the function createInstance.

The Transaction module make use of static methods to work. At anytime one can call addTransaction(whateverArguments) and the module generate the necessary transaction.

  • The instantiated stores and container are able to do several operations related to themselves and each other, please refer to the list above for a detailed explanation of each.

  • Extension of the operations can be done through the use of them as father class to any other new classes that are needed.

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.