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

import cn.estsh.i3plus.pojo.base.annotation.AnnoOutputColumn;
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 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.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;

/**
 * @Description :盘点策略表
 * @Reference :
 * @Author :QianHuaSheng
 * @CreateDate : 2020-02-17 10:13 上午
 * @Modify:
 **/
@Data
@Entity
@Table(name = "WMS_CS_STRATEGY", indexes = {
})
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Api(value = "盘点策略表", description = "盘点策略表")
public class WmsCsStrategy extends BaseBean implements Serializable {

    private static final long serialVersionUID = -1692487594678973549L;

    @Column(name = "STRATEGY_NAME")
    @ApiParam(value = "策略名称")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT)
    private String strategyName;

    @Column(name = "part_type")
    @ApiParam(value = "物料分类")
    @AnnoOutputColumn(refClass = WmsEnumUtil.PART_ABC.class, refForeignKey = "value", value = "description")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.SELECT, isMultiple = 1, dataSrc = "PART_ABC")
    private String partType;

    @Column(name = "STRATEGY_TYPE")
    @ApiParam(value = "策略分类", example = "0")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.SELECT, isRequire = 2, dataSrc = "CS_STRATEGY_TYPE")
    @AnnoOutputColumn(refClass = WmsEnumUtil.CS_STRATEGY_TYPE.class)
    private Integer strategyType;

    @Column(name = "CYCLE_RULE")
    @ApiParam(value = "循环规则")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT)
    private String cycleRule;

    @Column(name = "START_DATE")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.DATETIME)
    @ApiParam(value = "开始日期", example = "0")
    private String startDate;

    @Column(name = "END_DATE")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.DATETIME)
    @ApiParam(value = "结束日期", example = "0")
    private String endDate;

    @Column(name = "NUM_MAX")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.NUMBER)
    @ApiParam(value = "明细数量上限")
    private Integer numMax;

    @Column(name = "COVERAGE_RATE")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.NUMBER)
    @ApiParam(value = "抽盘覆盖率")
    private Double coverageRate;

    @Column(name = "ZONE_NOS")
    @ApiParam(value = "存储区")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.LIST, isRequire = 2, 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 zoneNos;

    @Column(name = "LOCATES")
    @ApiParam(value = "盘点库位")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.LIST, isRequire = 2, getValWay = CommonEnumUtil.DYNAMIC_FIELD_GET_WAY.OBJ,
            dataSrc = "cn.estsh.i3plus.pojo.wms.bean.WmsLocate",
            searchColumnName = "locateNo,locateName", listColumnName = "locateNo,locateName", explicitColumnName = "locateNo")
    private String locates;

    @Column(name = "last_run_time")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.DATETIME)
    @ApiParam(value = "上次运行时间")
    private String lastRunTime;

    @Column(name = "next_run_time")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.DATETIME)
    @ApiParam(value = "下次运行时间")
    private String nextRunTime;

    @Column(name = "REMAKE")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT, isRequire = 2)
    @ApiParam(value = "备注")
    private String remake;

    @ApiParam(value = "已盘物料")
    @Column(name = "INVENTORY_MATERIAL")
    @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 = "partNo")
    private String inventoryMaterial;

    @ApiParam(value = "已盘库位")
    @Column(name = "INVENTORY_LOCATION")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.LIST, isRequire = 2, getValWay = CommonEnumUtil.DYNAMIC_FIELD_GET_WAY.OBJ,
            dataSrc = "cn.estsh.i3plus.pojo.wms.bean.WmsLocate",
            searchColumnName = "locateNo,locateName", listColumnName = "locateNo,locateName", explicitColumnName = "locateNo")
    private String inventoryLocation;
}
