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.ColumnDefault;
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;
import javax.persistence.Version;

/**
 * @Description : 质检单明细信息
 * @Reference :
 * @Author : silliter.yuan
 * @CreateDate : 2018-11-06 15:58
 * @Modify:
 **/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name = "WMS_QC_DETAILS")
@Api("质检单明细信息")
public class WmsQCDetails extends BaseBean {
    private static final long serialVersionUID = 7442224593652923072L;
    @Column(name = "PART_NO")
    @ApiParam("物料编码")
    public String partNo;

    @Column(name = "PART_NAME_RDD")
    @ApiParam("物料名称")
    public String partNameRdd;

    @Column(name = "ITEM")
    @ApiParam("行号")
    public String item;

    @Column(name = "QTY", columnDefinition = "decimal(18,8)", nullable = false)
    @ColumnDefault("0")
    @ApiParam(value = "需求数量", example = "0")
    public Double qty;

    @Column(name = "UNIT")
    @ApiParam("单位")
    public String unit;

    @Column(name = "ORDER_NO")
    @ApiParam("订单号")
    public String orderNo;

    /**
     * 状态:N=正常,C=行取消
     */
    @Column(name = "ITEM_STATUS")
    @ApiParam(value = "状态", example = "1")
    @AnnoOutputColumn(refClass = WmsEnumUtil.QC_ITEM_STATUS.class, refForeignKey = "value", value = "description")
    public Integer itemStatus;

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


    @Column(name = "FACT_QTY", columnDefinition = "decimal(18,8)", nullable = false)
    @ColumnDefault("0")
    @ApiParam(value = "实检数量", example = "0")
    public Double factQty;

    @Column(name = "PASS_QTY", columnDefinition = "decimal(18,8)", nullable = false)
    @ColumnDefault("0")
    @ApiParam(value = "合格数量", example = "0")
    public Double passQty;

    @Column(name = "REJECT_QTY", columnDefinition = "decimal(18,8)", nullable = false)
    @ColumnDefault("0")
    @ApiParam(value = "不合格数量", example = "0")
    public Double rejectQty;

    @Version
    @Column(name = "LOCK_VERSION", columnDefinition = "int default 0")
    @ApiParam(value = "乐观锁", example = "1")
    public transient Integer lockVersion;

    @Transient
    @ApiParam(value = "单据状态")
    public Integer orderStatus;

    @Transient
    @ApiParam(value = "供应商编号")
    public String vendorNo;

    @Transient
    @ApiParam(value = "供应商名称")
    public String vendorDesc;

    public WmsQCDetails() {
    }

    public WmsQCDetails(String organizeCode, String partNo, String partNameRdd, String item,
                        Double qty, String unit, String orderNo,
                        Integer itemStatus, String remark, Double factQty,
                        Double passQty, Double rejectQty,
                        Integer orderStatus, String vendorNo, String vendorDesc,
                        String createUser, String createDatetime,String modifyUser,String modifyDatetime) {
        this.organizeCode = organizeCode;
        this.partNo = partNo;
        this.partNameRdd = partNameRdd;
        this.item = item;
        this.qty = qty;
        this.unit = unit;
        this.orderNo = orderNo;
        this.itemStatus = itemStatus;
        this.remark = remark;
        this.factQty = factQty;
        this.passQty = passQty;
        this.rejectQty = rejectQty;
        this.orderStatus = orderStatus;
        this.vendorNo = vendorNo;
        this.vendorDesc = vendorDesc;
        this.createUser = createUser;
        this.createDatetime = createDatetime;
        this.modifyUser = modifyUser;
        this.modifyDatetime = modifyDatetime;
    }

    public WmsQCDetails(String partNo, String partNameRdd, String item,
                        Double qty, String unit, String orderNo,
                        Integer itemStatus, String remark, Double factQty,
                        Double passQty, Double rejectQty,
                        Integer orderStatus, String vendorNo,String vendorDesc) {
        this.partNo = partNo;
        this.partNameRdd = partNameRdd;
        this.item = item;
        this.qty = qty;
        this.unit = unit;
        this.orderNo = orderNo;
        this.itemStatus = itemStatus;
        this.remark = remark;
        this.factQty = factQty;
        this.passQty = passQty;
        this.rejectQty = rejectQty;
        this.orderStatus = orderStatus;
        this.vendorNo = vendorNo;
        this.vendorDesc = vendorDesc;
    }
}
