Help in writing a stock management code

Is it possible to write a code for stock managing in processing? If so can i get a code for that purpose?

You can write a stock management Sketch that tells you how many books (for example) (and which books) you have in stock / store.

But I urge you to buy a professional program / software and customize it to your needs.

A stock management system is a huge project.

  • professional systems are connected to the cash Desk and register which book is sold and register in the stock -1 book.

  • You can use a bar code scanner to register incoming books. So in the stock you have +1.

  • You can make the system tell you when you need to order a book (e.g. when only 3 books are left).

All this is hard to integrate with processing.

Warm regards,

Chrisir

2 Likes

I actually want a small version of stock management which updates the stock when a sales is made and to let know when it is in re order level. It is not for usr in a commercial use. Just for a project i am working on.

Yes, you can do this with processing




int itemNumber=3;  
Table itemTable = null; 

void setup() {
  size(500, 500);

  itemTable = loadTable("stockitems.csv", "header");

  // File found? 
  if (itemTable == null) {
    // No
    itemTable = new Table();

    itemTable.addColumn("id");
    itemTable.addColumn("itemCount");

    TableRow newRow = itemTable.addRow();
    newRow.setInt("id", 0);
    newRow.setInt("itemCount", itemNumber);

    saveTable(itemTable, "data/stockitems.csv", "csv");
    println("made new table ");
  } else {
    // Yes 
    println("loaded");
    TableRow myRow = itemTable.getRow(itemTable.lastRowIndex());

    itemNumber=  myRow.getInt("itemCount");
  }//else
}

void draw() {
  background(10);
  fill(255); 
  text("Inventory Management System", 200, height/2-150);
  text(itemNumber, width/2, height/2);

  if (itemNumber<3) {
    text("Please order ! ", width/2, height/2+111);
  }
}

void keyPressed() {
  if (key=='+') {
    itemNumber++;
  } else if (key=='-') {
    itemNumber--;
  } else if (key==ESC) {
    key=0;
    return;
  } else {
    return;
  }

  // save 
  TableRow myRow = itemTable.getRow(itemTable.lastRowIndex());
  myRow.setInt("itemCount", itemNumber);
  saveTable(itemTable, "data/stockitems.csv", "csv");

  //
}//func

The Sketch has only ONE item in stock

  • it searches a csv first and loads it (and reads the number of items in your stock) OR
  • when it doesn’t find it it creates the csv

change the number of items in your stock with + and -

It saves every time you change the number of items in your stock

But I recommend to use a free stock management: Top 7 Free Inventory Management Systems | Business.org

Warm regards,

Chrisir