Logic. Company with 2 stocks

Asked

Viewed 47 times

0

I have the following Mysql table:

`estoque_itensconsumo` (
`cod_itensconsumo` INT NOT NULL AUTO_INCREMENT,
`unidade_mendida` VARCHAR(45) NULL,
`estoque_atual` INT NULL,
`quant_minima` INT NULL,
`valor_custo` FLOAT(9,2) NULL,
`registrar_cliente` INT NULL,
`ativo` INT NULL,
PRIMARY KEY (`cod_itensconsumo`))

The company has two subsidiaries registered in another table. There is the possibility of transferring products from one subsidiary to the other. I couldn’t find an efficient way to separate the items that are in one branch and another.

Example: I have 450 routers Link One model XXXXXX-XXX where 350 are not affiliated A and another 100 in affiliate B. How could I distribute these values in the same table, or I would have to have two tables(one for each affiliate) and register the router of the example in the two?

  • 2

    Why don’t you create a unit column and create an identifier for each case? In this example, you would have 2 lines with the same item but in different locations.... Of course, their stock down routines, selects would have to consider this factor...

  • I thought about it, I even have a table 'units' where I registered the branches and I could even use as (FK), but I thought about the situation where a third branch entered the history making me so change the table structure.

  • 1

    As @Diego said you need to add affiliate to your tables and keep the data separate. If a new branch is created you do not need to change the structure of the tables, you simply add a new row to the stock, if this material also exists in that branch.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.