How to model Product / Stock?

2

I started a modeling for Products thinking of the same as:

  • Purchased to Resell
  • Produced for Sale
  • Perishable or not

So far so good, but when I started thinking about stock control based on that model my head knotted, because of the Lots of Manufacturing control and because it was perishable.

Below the first version of my Product entity.

A brief explanation of relationships:

Supplier refers to products purchased for resale

Company for products produced by my company

MeasureProduct a table that stores whether the product is measured in KG, L or P, PP, M etc.

public class Produto implements Serializable {

    @Basic
    private int ativo;
    @Column(length=400)
    @Basic
    private String caminhoImagem;
    @Basic
    private double largura;
    @Basic
    private double peso;
    @Column(length=70)
    @Basic
    private String cor;
    @Basic
    private String valorCompra;
    @Column(length=150)
    @Basic
    private String nome;
    @Basic
    private double profundidade;
    @Column(length=200)
    @Basic
    private String descricao;
    @OneToOne(targetEntity = TipoProdutoEnum.class)
    private TipoProdutoEnum tipoProdutoEnum1;
    @Temporal(TemporalType.TIMESTAMP)
    @Basic
    private Date dataAtualizacao;
    @Basic
    private double altura;
    @Basic
    private String valorVenda;
    @OneToOne(targetEntity = MedidaProduto.class)
    private MedidaProduto medidaProduto;
    @Basic
    private double quantidadeMaxima;
    @Basic
    private double quantidadeMinima;
    @Temporal(TemporalType.TIMESTAMP)
    @Basic
    private Date dataDesativacao;
    @Id
    @GeneratedValue(generator="seq_produto",strategy=GenerationType.SEQUENCE)
    @SequenceGenerator(name="seq_produto",sequenceName="seq_produto",allocationSize=1)
    private Long id;
    @Basic
    private double quantidadeAtual;
    @OneToOne(targetEntity = Fornecedor.class)
    private Fornecedor fornecedor;
    @OneToOne(targetEntity = Empresa.class)
    private Empresa empresa;
    @Temporal(TemporalType.TIMESTAMP)
    @Basic
    private Date dataCadastro;
}

When I started thinking about stock control I saw that I mixed up the concepts a little bit and in the matter of production control I'm completely lost.

    
asked by anonymous 19.04.2016 / 20:54

1 answer

4

Yes, it mixed concepts. Product is product, lot is lot. Everything you deal with in a general way, abstract, is a product. Think of the product as a document that talks about the product. It has no relation to physical items. At least that's the understanding in most modeling.

In this document there may even be information on the existing number of units in it. I said it may because there are modeling where this is wrong. You can have warehouses. Some people think that even when you only have one warehouse (in industries it is very rare to have only one, and the description of the question seems to indicate that you have at least two) ideally this information is in the most appropriate place. I can not say which is best for you.

But if you have quantities of batches produced, if these batches have validity, specific quality control, you have to control this separately. Note that we still have something abstract here, because the batch is still just a document.

You only enter the concrete when you talk about the unit itself (even if the registration is not just a document). And there are cases in which it is necessary to register each unit produced, typical case when it needs the serial number (it is not any serial use that needs the individual cadastre).

Another example of what may not be as well as you think: It is common for the product to have multiple vendors.

Some types used in the data scare me a bit, especially the sales value being String .

You may be modeling over something not real. This is always complicated because in theory anything can be valid. There is no right or wrong modeling in the total abstract. With the real need is that you can say what is right or not, and always for that situation of the moment.

    
19.04.2016 / 21:09