package cn.estsh.i3plus.pojo.wms.bean;

import cn.estsh.i3plus.pojo.base.annotation.AnnoOutputColumn;
import cn.estsh.i3plus.pojo.base.bean.BaseBean;
import cn.estsh.i3plus.pojo.base.enumutil.WmsEnumUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;

/**
 * @Description : 质检单主表信息
 * @Reference :
 * @Author : silliter.yuan
 * @CreateDate : 2018-11-06 15:58
 * @Modify:
 **/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name = "WMS_QC_MASTER")
@Api("质检单主表信息")
public class WmsQCMaster extends BaseBean {

    private static final long serialVersionUID = 2701710669030092148L;
    @Column(name = "ORDER_NO")
    @ApiParam("单号")
    public String orderNo;

    /**
     * 业务类型:IQC=进料检验,IPQC=在线检验,
     * FQC=成品检验,OQC=出货检验
     */
    @Column(name = "ORDER_TYPE")
    @ApiParam(value = "业务类型", example = "0")
    @AnnoOutputColumn(refClass = WmsEnumUtil.QC_INFO_TYPE.class, refForeignKey = "value", value = "description")
    public Integer orderType;

    /**
     * 状态:1=创建,5=待处理,10=已完成,90=已关闭,91=已取消
     */
    @Column(name = "ORDER_STATUS")
    @ApiParam(value = "状态", example = "1")
    @AnnoOutputColumn(refClass = WmsEnumUtil.MASTER_ORDER_STATUS.class, refForeignKey = "value", value = "description")
    public Integer orderStatus;

    @Column(name = "REMARK")
    @ApiParam("备注")
    public String remark;

    @Column(name = "CUST_NO")
    @ApiParam("客户编号")
    public String custNo;

    @Column(name = "VENDOR_NO")
    @ApiParam("供应商编号")
    public String vendorNo;

    @Column(name = "VERSION")
    @ApiParam(value = "版本", example = "1")
    public Integer version;

    @Column(name = "REF_TYPE")
    @ApiParam("关联单号类型")
    public String refType;

    @Column(name = "REF_SRC")
    @ApiParam("关联单号")
    public String refSrc;

    @Transient
    @ApiParam(value = "客户简称")
    private String custName;

    @Transient
    @ApiParam(value = "供应商简称")
    private String VendorDesc;

    @Column(name = "IS_TASK")
    @ApiParam(value = "是否生产任务", example = "1")
    @AnnoOutputColumn(refClass = WmsEnumUtil.IS_GENERAL_TASK.class, refForeignKey = "value", value = "description")
    public Integer isTask;

    @Column(name = "IS_PART")
    @ApiParam(value = "是否散件", example = "2")
    @AnnoOutputColumn(refClass = WmsEnumUtil.TRUE_OR_FALSE.class, refForeignKey = "value", value = "description")
    public Integer isPart;

    public int getOrderStatusVal() {
        return this.orderStatus == null ? 0 : this.orderStatus;
    }
}
