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

import cn.estsh.i3plus.pojo.base.annotation.DynamicField;
import cn.estsh.i3plus.pojo.base.bean.BaseBean;
import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil;
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;

/**
 * @Description : 库区物料
 * @Reference :
 * @Author : jessica.chen
 * @CreateDate : 2018-11-07 14:21
 * @Modify:
 **/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name="WMS_ZONE_PART")
@Api("库区物料")
public class WmsZonePart extends BaseBean{

    private static final long serialVersionUID = 9214639813072592546L;
    @Column(name="ZONE_NO")
    @ApiParam("存储区编号")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.LIST,  getValWay = CommonEnumUtil.DYNAMIC_FIELD_GET_WAY.OBJ,
            dataSrc = "cn.estsh.i3plus.pojo.wms.bean.WmsZones",
            searchColumnName = "zoneNo,zoneName", listColumnName = "zoneNo,zoneName", explicitColumnName = "zoneNo")
    private String zoneNo;

    @Column(name="PART_NO")
    @ApiParam("物料编码")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.LIST,  getValWay = CommonEnumUtil.DYNAMIC_FIELD_GET_WAY.OBJ,
            dataSrc = "cn.estsh.i3plus.pojo.wms.bean.WmsPart",
            searchColumnName = "partNo,partName", listColumnName = "partNo,partName", explicitColumnName = "partNo")
    private String partNo;

    @Column(name="PART_NAME_RDD")
    @ApiParam("物料名称")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.LIST, isRequire = 2,  getValWay = CommonEnumUtil.DYNAMIC_FIELD_GET_WAY.OBJ,
            dataSrc = "cn.estsh.i3plus.pojo.wms.bean.WmsPart",
            searchColumnName = "partNo,partName", listColumnName = "partNo,partName", explicitColumnName = "partName")
    private String partNameRdd;

    @Column(name="PULL_QTY", columnDefinition = "decimal(18,8)")
    @ColumnDefault("0")
    @ApiParam(value = "拉动数量", example = "0")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.NUMBER)
    private Double pullQty;

    @Column(name="MAX", columnDefinition = "decimal(18,8)")
    @ColumnDefault("0")
    @ApiParam(value = "最大值", example = "0")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.NUMBER)
    private Double max;

    @Column(name="MIN", columnDefinition = "decimal(18,8)")
    @ColumnDefault("0")
    @ApiParam(value = "最小值", example = "0")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.NUMBER)
    private Double min;

    @Column(name = "IS_GENERATE_PICKLIST")
    @ApiParam(value = "是否生成领料单", example = "2")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.SELECT, dataSrc = "TRUE_OR_FALSE")
    private Integer isGeneratePickList;

    @Column(name="MOQ", columnDefinition = "decimal(18,8)")
    @ColumnDefault("0")
    @ApiParam(value = "起订量", example = "0")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.NUMBER)
    private Double moq;

    @Column(name="SAFETY_QTY", columnDefinition = "decimal(18,8)")
    @ColumnDefault("0")
    @ApiParam(value = "安全量", example = "0")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.NUMBER, isRequire = 2)
    private Double safetyQty;

    @Transient
    @ApiParam(value = "总件数")
    private Double totalSnQty ;

    @Transient
    @ApiParam(value = "库存是否正常")
    private Integer isNormal ;

    public WmsZonePart() {
    }

    public WmsZonePart(String zoneNo, String partNo, String partNameRdd, Double min, Double max, Double totalSnQty) {
        this.zoneNo = zoneNo;
        this.partNo = partNo;
        this.partNameRdd = partNameRdd;
        this.min = min;
        this.max = max;
        this.totalSnQty = totalSnQty;
    }
}