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.