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.*;

/**
 * @Description : ASN订单明细信息
 * @Reference :
 * @Author : silliter.yuan
 * @CreateDate : 2018-11-06 15:58
 * @Modify:
 **/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name = "WMS_DOC_ASN_DETAILS", indexes = {
        @Index(columnList = "ORDER_NO"),
        @Index(columnList = "PART_NO"),
        @Index(columnList = "SN_1D"),
        @Index(columnList = "SN_2D"),
        @Index(columnList = "ORGANIZE_CODE")
})
@Api("ASN订单明细信息")
public class WmsASNMasterDetails extends BaseBean {
    private static final long serialVersionUID = -9174994369307078375L;
    @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)")
    @ColumnDefault("0")
    @ApiParam(value = "需求数量", example = "0")
    public Double qty;

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

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

    @Column(name = "PO_ITEM")
    @ApiParam("PO行号")
    public String poItem;

    @Column(name = "PLAN_DATE")
    @ApiParam("计划交货日期")
    public String planDate;

    @Column(name = "PLAN_TIME")
    @ApiParam("计划交货时间")
    public String planTime;

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

    @Column(name = "PACKAGE")
    @ApiParam("包装名称")
    public String packAge;

    /**
     * 是否免费:0=计费,1=免费
     */
    @Column(name = "IS_FREE")
    @ApiParam(value = "是否免费", example = "1")
    public Integer isFree;

    @Column(name = "DOCK")
    @ApiParam("道口")
    public String dock;

    @Column(name = "SN_1D")
    @ApiParam("一维条码")
    public String snOneBarCode;

    @Column(name = "SN_2D")
    @ApiParam("二维条码")
    public String snTwoBarCode;

    @Column(name = "GROUP_NO")
    @ApiParam("组条码")
    public String groupNo;

    @Column(name = "ERP_AREA_NO")
    @ApiParam("默认收货库存地")
    public String erpAreaNo;

    @Column(name = "VENDOR_LOT_NO")
    @ApiParam("供应商批次")
    public String vendorLotNo;

    @Column(name = "REC_QTY", columnDefinition = "decimal(18,8)")
    @ColumnDefault("0")
    @ApiParam(value = "已收数量", example = "0")
    public Double recQty;

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

    @Transient
    @ApiParam("实收数量")
    private Double rcQty;

    @Transient
    @ApiParam("ASN条码总箱数")
    public Integer totalBoxes;

    @Transient
    @ApiParam("差异")
    public Double difference;

    @Transient
    @ApiParam("标准包装")
    public Double snp;

    public WmsASNMasterDetails(){}

    public WmsASNMasterDetails(Double recQty,Double qty,String partNo,String orderNo,String partNameRdd,String item,String unit,String erpAreaNo,String organizeCode,String planDate,String planTime){
        this.recQty = recQty;
        this.qty = qty;
        this.partNo = partNo;
        this.orderNo = orderNo;
        this.partNameRdd = partNameRdd;
        this.item = item;
        this.unit = unit;
        this.erpAreaNo = erpAreaNo;
        this.organizeCode = organizeCode;
        this.planDate = planDate;
        this.planTime = planTime;
    }
}
