package com.uas.platform.b2b.manage.model;


import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.uas.platform.core.model.Constant;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;

/**
 * ERP操作发货提醒记录明细
 *
 * @author hejq
 * @date 2018-08-24 11:19
 */
@Entity
@Table(name = "purc$notice$record$detail", indexes = {
        @Index(name = "purc$notice$record$detail_noid_IDX", columnList = "nod_noid"),
        @Index(name = "purc$notice$record$detail_b2bid_IDX", columnList = "nod_b2bid"),
        @Index(name = "purc$notice$record$detail_okstatus_IDX", columnList = "nod_okstatus")
})
public class NoticeRecordDetail implements Serializable {

    /**
     * 序列号
     */
    private static final long serialVersionUID = 1L;

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

    /**
     * 主记录
     */
    @ManyToOne(cascade = { CascadeType.REFRESH, CascadeType.PERSIST })
    @JoinColumn(name = "nod_noid")
    private NoticeRecord record;

    /**
     * erpID
     */
    @Column(name = "nod_erpid")
    @NotNull
    private Long erpId;

    /**
     * b2bID
     * <pre>
     *     -1标识B2B未找到相应的ID，为异常数据
     * </pre>
     */
    @Column(name = "nod_b2bid")
    private Long b2bId = -1L;

    /**
     * 发货状态
     */
    @Column(name = "nod_status")
    private Short status = 200;

    /**
     * 结案状态
     * <per>
     *     1. 结案
     *     0. 未结案
     * </per>
     */
    @Column(name = "nod_end")
    private Short end = 0;

    /**
     * 需求数量
     */
    @Column(name = "nod_needqty")
    private Double needQty = 0.00;

    /**
     * 已发货数量
     */
    @Column(name = "nod_sendqty")
    private Double sendQty = 0.00;

    /**
     * 记录日期
     */
    @Column(name = "nod_date")
    private Date date = new Date(System.currentTimeMillis());

    /**
     * 状态，是否正常
     *  <pre>
     *      1. YES
     *      0. NO
     *  </pre>
     */
    @Column(name = "nod_okstatus")
    private Short okStatus = Constant.YES;

    /**
     * 发货提醒单录入时间
     */
    @Column(name = "nod_nodate")
    private Date noDate;

    /**
     * 单据操作备注
     */
    @Column(name = "nod_remark")
    private String remark = "";

    public Long getId() {
        return id;
    }

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

    @JSONField(serialize = false)
    @JsonIgnore
    public NoticeRecord getRecord() {
        return record;
    }

    public void setRecord(NoticeRecord record) {
        this.record = record;
    }

    public Long getErpId() {
        return erpId;
    }

    public void setErpId(Long erpId) {
        this.erpId = erpId;
    }

    public Long getB2bId() {
        return b2bId;
    }

    public void setB2bId(Long b2bId) {
        this.b2bId = b2bId;
    }

    public Short getStatus() {
        return status;
    }

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

    public Short getEnd() {
        return end;
    }

    public void setEnd(Short end) {
        this.end = end;
    }

    public Double getNeedQty() {
        return needQty;
    }

    public void setNeedQty(Double needQty) {
        this.needQty = needQty;
    }

    public Double getSendQty() {
        return sendQty;
    }

    public void setSendQty(Double sendQty) {
        this.sendQty = sendQty;
    }

    public Date getDate() {
        return date;
    }

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

    public Short getOkStatus() {
        return okStatus;
    }

    public void setOkStatus(Short okStatus) {
        this.okStatus = okStatus;
    }

    public Date getNoDate() {
        return noDate;
    }

    public void setNoDate(Date noDate) {
        this.noDate = noDate;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }
}
