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

import cn.estsh.i3plus.pojo.base.bean.BaseBean;
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 : jimmy.zeng
 * @CreateDate : 2018-11-07 10:35
 * @Modify:
 **/
@Data
@Entity
@Table(name = "WMS_LOCATE")
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Api(value = "库位表", description = "库位表")
public class WmsLocate extends BaseBean {

    private static final long serialVersionUID = -8425904594036746967L;
    @Column(name = "LOCATE_NO")
    @ApiParam(value = "库位代码")
    private String locateNo;

    @Column(name = "LOCATE_NAME")
    @ApiParam(value = "库位名称")
    private String locateName;

    /**
     * 库位类型:10=收货库,20=基础库,30=机动库,40=组合库,50=线边库,60=NC库，70=溢料,80=在途库位
     */
    @Column(name = "LOCATE_TYPE")
    @ApiParam(value = "库位类型")
    private Integer locateType;

    @Column(name = "WH_NO")
    @ApiParam(value = "仓库代码")
    private String whNo;

    @Column(name = "ZONE_NO")
    @ApiParam(value = "存储区代码")
    private String zoneNo;

    @Column(name = "X")
    @ApiParam(value = "X", example = "-1")
    private Integer x;

    @Column(name = "Y")
    @ApiParam(value = "Y", example = "-1")
    private Integer y;

    @Column(name = "Z")
    @ApiParam(value = "Z", example = "-1")
    private Integer z;

    @Column(name = "SEQ")
    @ApiParam(value = "序号", example = "-1")
    private Integer seq;

    @Column(name = "STATUS")
    @ApiParam(value = "库位状态", example = "-1")
    private Integer status;

    @Column(name = "MAX_PACKAGE_QTY")
    @ApiParam(value = "最大包装数量", example = "-1")
    private Integer maxPackageQty;

    @Column(name = "MAX_PART_QTY", columnDefinition = "decimal(18,8)")
    @ApiParam(value = "最大零件数量", example = "-1")
    private Double maxPartQty;

    @Column(name = "STOCK_UNIT")
    @ApiParam(value = "存放单位")
    private String stockUnit;

    @Column(name = "LINE_CODE")
    @ApiParam(value = "生产线")
    private String lineCode;

    @Column(name = "BOX_QTY")
    @ApiParam(value = "箱数", example = "-1")
    private Integer boxQty;

    @Column(name = "PART_QTY", columnDefinition = "decimal(18,8)")
    @ApiParam(value = "零件数", example = "-1")
    private Double partQty;

    // 导入用
    @ApiParam(value = "工厂")
    @Transient
    private String factory;

    @Transient
    @ApiParam(value = "入库箱数", example = "-1")
    private Integer destBoxQty;

    @Transient
    @ApiParam(value = "错误信息", example = "-1")
    private String errorMsg;

    @Column(name = "ENCRYPTION_NO")
    @ApiParam(value = "加密编码")
    private String encryptionNo;

    @Column(name = "LAST_CS_TIME")
    @ApiParam(value = "末次盘点时间")
    private String lastCsTime;

    @Transient
    @ApiParam(value = "末次盘点开始时间")
    private String lastCsTimeStart ;

    @Transient
    @ApiParam(value = "末次盘点结束时间")
    private String lastCsTimeEnd;

    public WmsLocate() {
    }

    public WmsLocate(String locateNo,Integer destBoxQty) {
        this.locateNo = locateNo;
        this.destBoxQty = destBoxQty;
    }

    public Integer getMaxPackageQty() {
        return this.maxPackageQty == null ? 0 : this.maxPackageQty.intValue();
    }

    public Double getMaxPartQty() {
        return this.maxPartQty == null ? 0 : this.maxPartQty.doubleValue();
    }

    public Integer getBoxQty() {
        return this.boxQty == null ? 0 : this.boxQty.intValue();
    }

    public Double getPartQty() {
        return this.partQty == null ? 0 : this.partQty.doubleValue();
    }

    public Integer getLocateType() {
        return this.locateType== null ? 0 : this.locateType.intValue();
    }
}
