package com.sw.mes.agv.entity;


import com.fasterxml.jackson.annotation.JsonIgnore;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.*;

@Entity
@DynamicInsert
@DynamicUpdate
@Table(name="mobile_charge_item")
public class MobileChargeItem {
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

	/**
	 * 物料编码
	 */
    @Column(length=80)
    private String materialCode;

    /**
     * 物料模型ID
     */
    @Column
    private Integer materialId;


    /**
     * 是否写到gi表 0否 1是
     */
    @Column
    private Integer isGi;

	/**
	 * 物料模型名称
	 */
    @Column(length=80)
    private String materialName;

	/**
	 * 规格
	 */
    @Column(length=80)
    private String norms;

	/**
	 * 数量
	 */
    @Column(length=22)
    private Double count;

	/**
	 * 单位
	 */
    @Column(length=40)
    private String unit;

    @Column(length=19, updatable=false, insertable=false)
    private Long chargeId;

    @JsonIgnore
    @ManyToOne(fetch= FetchType.LAZY)
    @JoinColumn(name = "chargeId")
    private MobileCharge charge;

    @Column(length=19, updatable=false, insertable=false)
    private Long rechargeId;

    @JsonIgnore
    @ManyToOne(fetch= FetchType.LAZY)
    @JoinColumn(name = "rechargeId")
    private MobileRecharge recharge;

    public MobileChargeItem(){}

    public MobileChargeItem(String materialCode, String materialName, String norms, String unit){
        this.materialCode = materialCode;
        this.materialName = materialName;
        this.norms = norms;
        this.unit = unit;
    }

    /**
	 * @return the id
	 */
	public Long getId() {
		return id;
	}

	/**
	 * @param id the id to set
	 */
	public void setId(Long id) {
		this.id = id;
	}

	/**
	 * @param materialCode the materialCode to set
	 */
    public void setMaterialCode(String materialCode){
       this.materialCode = materialCode;
    }

    /**
     * @return the materialCode
     */
    public String getMaterialCode(){
       return this.materialCode;
    }

	/**
	 * @param materialName the materialName to set
	 */
    public void setMaterialName(String materialName){
       this.materialName = materialName;
    }

    /**
     * @return the materialName
     */
    public String getMaterialName(){
       return this.materialName;
    }

	/**
	 * @param norms the norms to set
	 */
    public void setNorms(String norms){
       this.norms = norms;
    }

    /**
     * @return the norms
     */
    public String getNorms(){
       return this.norms;
    }

	/**
	 * @param count the count to set
	 */
    public void setCount(Double count){
       this.count = count;
    }

    /**
     * @return the count
     */
    public Double getCount(){
       return this.count;
    }

	/**
	 * @param unit the unit to set
	 */
    public void setUnit(String unit){
       this.unit = unit;
    }

    /**
     * @return the unit
     */
    public String getUnit(){
       return this.unit;
    }

    public Long getChargeId() {
        return chargeId;
    }

    public void setChargeId(Long chargeId) {
        this.chargeId = chargeId;
    }

    public MobileCharge getCharge() {
        return charge;
    }

    public void setCharge(MobileCharge charge) {
        this.charge = charge;
    }

    public Long getRechargeId() {
        return rechargeId;
    }

    public void setRechargeId(Long rechargeId) {
        this.rechargeId = rechargeId;
    }

    public MobileRecharge getRecharge() {
        return recharge;
    }

    public void setRecharge(MobileRecharge recharge) {
        this.recharge = recharge;
    }

    public Integer getMaterialId() {
        return materialId;
    }

    public void setMaterialId(Integer materialId) {
        this.materialId = materialId;
    }

    public Integer getIsGi(){return isGi;}

    public void setIsGi(Integer isGi){this.isGi = isGi;}
}
