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

import com.sw.mes.base.factory.init.entity.Equipment;
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_accessory_return")
@DynamicUpdate
@DynamicInsert
public class AccessoryReturn {
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;

    /**
     * 辅料信息
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @NotFound(action = NotFoundAction.IGNORE)
    @JoinColumn(name = "material_id", foreignKey = @ForeignKey(name = "none", value = ConstraintMode.NO_CONSTRAINT))
    private AccessoryMaterial material;

    /**
     * 设备
     */
    @ManyToOne(fetch = FetchType.LAZY)
    @NotFound(action = NotFoundAction.IGNORE)
    @JoinColumn(name = "equipment_id", foreignKey = @ForeignKey(name = "none", value = ConstraintMode.NO_CONSTRAINT))
    private Equipment equipment;

	/**
	 * 申请人
	 */
    @Column(length=50)
    private String applyUser;

	/**
	 * 申请时间
	 */
    @Column(length=19)
	@Temporal(TemporalType.TIMESTAMP)
    private Date applyDate;

	/**
	 * 状态更新时间
	 */
    @Column(length=19)
	@Temporal(TemporalType.TIMESTAMP)
    private Date stateDate;

	/**
	 * 状态
	 */
    @Column(length=50)
    private String state;

    @ManyToOne(fetch = FetchType.LAZY)
    @NotFound(action = NotFoundAction.IGNORE)
    @JoinColumn(name = "accessory_id", foreignKey = @ForeignKey(name = "none", value = ConstraintMode.NO_CONSTRAINT))
    private EquipmentAccessory equipmentAccessory;

    @ManyToOne(fetch = FetchType.LAZY)
    @NotFound(action = NotFoundAction.IGNORE)
    @JoinColumn(name = "feedback_id", foreignKey = @ForeignKey(name = "none", value = ConstraintMode.NO_CONSTRAINT))
    private AccessoryReturnFeedback accessoryReturnFeedback;

	/**
	 * 热场条码（唯一）
	 */
    @Column(length=50)
    private String goodsCode;

    /**
     * 退库原因
     */
    @Column(length = 255)
    private String reason;

    /**
     * 已使用寿命
     */
    @Column
    private BigDecimal useTime;

    /**
     * 申请人工号
     */
    @Column(length = 50)
    private String applyWorkNo;

    /**
     * 退料单号
     */
    @Column(length = 50)
    private String orderNum;

    /**
     * 数量
     */
    @Column(length = 11)
    private Integer num;

    /**
     * 出库地点
     */
    @Column(length = 11)
    private String lgort;

    @ManyToOne(fetch = FetchType.LAZY)
    @NotFound(action = NotFoundAction.IGNORE)
    @JoinColumn(name = "spare_id", foreignKey = @ForeignKey(name = "none", value = ConstraintMode.NO_CONSTRAINT))
    private AccessorySpare accessorySpare;


    /**
     * 班次
     */
    @Column
    private String userClassNo;

    /**
     * 班组
     */
    @Column
    private String userTeamGroup;

    /**
     * 批次号
     */
    @Column
    private String batchNo;

    /**
     * 刻码
     */
    @Column
    private String engraving;

    /**
     * 碳毡
     */
    @Column
    private String carbonFelt;

    public AccessoryReturn() {
	}

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