package com.sw.mes.yb.pc.entity;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.sw.mes.base.factory.material.entity.MaterialModel;
import lombok.Data;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import javax.persistence.*;
import java.math.BigDecimal;

@Entity
@Data
@DynamicUpdate
@DynamicInsert
@Table(name = "store_mix_info_item")
public class StoreMixInfoItem {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    /**
     * 数量
     **/
    @Column(name = "count")
    private BigDecimal count;

    /**
     * 物品条码
     **/
    @Column(name = "goods_code")
    private String goodsCode;

    /**
     * 备注
     **/
    @Column(name = "remark")
    private String remark;

    @JsonIgnore
    @ManyToOne(fetch = FetchType.LAZY)
    @NotFound(action = NotFoundAction.IGNORE)
    @JoinColumn(name = "material_model_id", foreignKey = @ForeignKey(name = "none", value = ConstraintMode.NO_CONSTRAINT))
    private MaterialModel materialModel;

    /**
     * 扩展属性
     **/
    @Column(name = "properties")
    private String properties;

//    /**
//     * 库位id
//     **/
//    @JsonIgnore
//    @ManyToOne(fetch = FetchType.LAZY)
//    @NotFound(action = NotFoundAction.IGNORE)
//    @JoinColumn(name = "store_location_id", foreignKey = @ForeignKey(name = "none", value = ConstraintMode.NO_CONSTRAINT))
//    private StoreLocation storeLocation;

    /**
     * 配料id
     **/
    @JsonIgnore
    @ManyToOne(fetch = FetchType.LAZY)
    @NotFound(action = NotFoundAction.IGNORE)
    @JoinColumn(name = "store_mix_info_id", foreignKey = @ForeignKey(name = "none", value = ConstraintMode.NO_CONSTRAINT))
    private StoreMixInfo storeMixInfo;

    /**
     * 批次
     * 钡粉使用
     **/
    @Column(name = "pici")
    private String pici;

    /**
     * 厂牌
     * 原料使用
     **/
    @Column(name = "changpai")
    private String changpai;

    /**
     * 浓度
     * 合金使用
     **/
    @Column(name = "nongdu")
    private String nongdu;

    /**
     * 目标电阻率
     * 合金使用
     **/
    @Column(name = "mbdzl")
    private String mbdzl;

    /**
     * 称量者
     * 合金使用
     **/
    @Column(name = "weight_user")
    private String weightUser;


    /**
     * 是否写入gi表 0否 1是
     */
    @Column(name = "is_gi")
    private Integer isGi;

}
