/**
 * There are <a href="https://github.com/ketayao/keta-custom">keta-custom</a> code generation
 */
package com.sw.mes.agv.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
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;
import java.util.Date;

/**
 * 物料搭配方案记录
 * @Author
 * @Description：
 * @Date: Create in
 * @Modified By:
 */
@Data
@Entity
@Table(name = "zhxx_recharge_art_bag_item_record")
@DynamicUpdate
@DynamicInsert
public class RechargeArtBagItemRecord {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    /**
     * 搭配方案ID
     */
    @Column
    private Long rechargeId;

    /**
     * 设备编号
     */
    @Column(length = 40)
    private String deviceNo;

    /**
     * 物料模型
     */
    @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(nullable = false, length = 10)
    private BigDecimal dosage;

    @Column
    private BigDecimal backoffWeight;

    /**
     * 已灌料重量
     */
    @Column
    private BigDecimal count;

    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @Column(length = 19)
    @Temporal(TemporalType.TIMESTAMP)
    private Date createTime;

    public RechargeArtBagItemRecord() {
    }

    public RechargeArtBagItemRecord(Integer id) {
        this.id = id;
    }

}
