package com.uas.platform.b2b.model;

import com.uas.platform.core.model.Status;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * 记录验收单等查询对应采购单明细不存在的单号，序号
 *
 * Created by hejq on 2018-06-19.
 */
@Table(name = "erp$orders")
@Entity
public class NotExistOrders implements Serializable {

    /**
     * default serialVersionUID
     */
    private static final long serialVersionUID = 1L;

    /**
     * id
     */
    @Column(name = "or_id")
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;

    /**
     * 单据编号
     */
    @Column(name = "or_code")
    private String code;

    /**
     * 企业UU
     */
    @Column(name = "or_enuu")
    private Long enUU;

    /**
     * 明细序号,默认0
     */
    @Column(name = "or_detno")
    private Short detno = 0;

    /**
     * 记录日期
     */
    @Column(name = "or_date")
    private Date date;

    /**
     * 处理状态
     * <pre>
     *     202: 待下载
     *     203: 已下载
     * </pre>
     */
    @Column(name = "or_status")
    private Integer status;

    /**
     * 单据类型
     * <pre>
     *     saleItem: 销售订单明细
     *     makeItem: 委外订单明细
     *     saleMain: 销售订单
     *     makeMain: 委外订单
     * </pre>
     */
    @Column(name = "or_type")
    private String type;

    /**
     * 标识，用于查询信息
     */
    @Column(name = "or_sign")
    private String sign;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public Long getEnUU() {
        return enUU;
    }

    public void setEnUU(Long enUU) {
        this.enUU = enUU;
    }

    public Short getDetno() {
        return detno;
    }

    public void setDetno(Short detno) {
        this.detno = detno;
    }

    public Date getDate() {
        return date;
    }

    public void setDate(Date date) {
        this.date = date;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getSign() {
        return sign;
    }

    public void setSign(String sign) {
        this.sign = sign;
    }

    public NotExistOrders() {

    }

    /**
     * 构建不存在单据信息
     *
     * @param enUU 企业UU
     * @param code 单据编号
     * @param type 类型
     * @param detno 明细编号
     * @param sign 标识
     */
    public NotExistOrders(Long enUU, String code, String type, Short detno, String sign) {
        this.enUU = enUU;
        this.code = code;
        this.detno = detno;
        this.type = type;
        this.status = Status.NOT_UPLOAD.value();
        this.date = new Date(System.currentTimeMillis());
        this.sign = sign;
    }
}
