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 javax.persistence.Transient;

/**
 * @Description : 策略表
 * @Reference :
 * @Author : jimmy.zeng
 * @CreateDate : 2020-06-09 16:45
 * @Modify:
 **/
@Data
@Entity
@Table(name="WMS_TRACTICS")
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Api(value="策略表",description = "策略表")
public class WmsTractics extends BaseBean {

    private static final long serialVersionUID = -8203200560604263871L;
    @Column(name="TRACTICS_CODE")
    @ApiParam(value ="策略代码")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT)
    private String tracticsCode;

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

    @Column(name="TRACTICS_DESC")
    @ApiParam(value ="策略描述")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT)
    private String tracticsDesc;

    @Column(name="TRACTICS_GRADE")
    @ApiParam(value ="策略等级")
 //   @AnnoOutputColumn(refClass = WmsEnumUtil.TRACTICS_GRADE.class, refForeignKey = "value", value = "description")
//    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.SELECT, isMultiple = 1, dataSrc = "TRACTICS_GRADE")
    private Integer tracticsGrade;

    @Column(name="TRACTICS_GROUP")
    @ApiParam(value ="策略组")
//    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.SELECT, isMultiple = 1, dataSrc = "TRACTICS_GROUP")
    @AnnoOutputColumn(refClass = WmsEnumUtil.TRACTICS_GROUP.class, refForeignKey = "value", value = "description")
    private Integer tracticsGroup;

    @Column(name="TRACTICS_ITEM")
    @ApiParam(value ="策略项")
//    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.NUMBER)
    private Integer tracticsItem;

    @Column(name="TRACTICS_PART_GROUP")
    @ApiParam(value ="策略适用物料组")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.LIST,isRequire = 2, getValWay = CommonEnumUtil.DYNAMIC_FIELD_GET_WAY.OBJ,
            dataSrc = "cn.estsh.i3plus.pojo.wms.bean.WmsPartGroup",
            searchColumnName = "partGroupNo,partGroupName", listColumnName = "partGroupNo,partGroupName", explicitColumnName = "partGroupNo")
    private String tracticsPartGroup;

    @Column(name = "TRACTICS_PART_GROUP_NAME")
    @ApiParam(value = "策略适用物料组名称")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT)
    private String tracticsPartGroupName;

    @Column(name="TRACTICS_ZONE")
    @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 tracticsZone;

    @Column(name="TRACTICS_PARAM")
    @ApiParam(value ="参数")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT)
    private String tracticsParam;

    @Column(name="TRACTICS_START_TIME")
    @ApiParam(value ="策略生效日期")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.DATETIME)
    private String tracticsStartTime;

    @Column(name="TRACTICS_END_TIME")
    @ApiParam(value ="策略失效日期")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.DATETIME)
    private String tracticsEndTime;

    @Column(name="LEV1_STRATEGY_PUT")
    @ApiParam(value ="1级策略上架")
    @AnnoOutputColumn(refClass = WmsEnumUtil.INSTOCK_TRACTICS_ITEM_ONE.class, refForeignKey = "value", value = "description")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.SELECT, isMultiple = 1, dataSrc = "INSTOCK_TRACTICS_ITEM_ONE")
    private Integer lev1StrategyPut;

    @Column(name="LEV1_STRATEGY_PICKING")
    @ApiParam(value ="1级策略拣货")
    @AnnoOutputColumn(refClass = WmsEnumUtil.PICKING_TRACTICS_ITEM_ONE.class, refForeignKey = "value", value = "description")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.SELECT, isMultiple = 1, dataSrc = "PICKING_TRACTICS_ITEM_ONE")
    private Integer lev1StrategyPicking;

    @Column(name="LEV2_STRATEGY_PUT")
    @ApiParam(value ="2级策略")
    @AnnoOutputColumn(refClass = WmsEnumUtil.INSTOCK_TRACTICS_ITEM_TWO.class, refForeignKey = "value", value = "description")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.SELECT, isMultiple = 1, dataSrc = "INSTOCK_TRACTICS_ITEM_TWO")
    private Integer lev2StrategyPut;

    @Column(name="LEV3_STRATEGY_PUT")
    @ApiParam(value ="3级策略")
    @AnnoOutputColumn(refClass = WmsEnumUtil.INSTOCK_TRACTICS_ITEM_THREE.class, refForeignKey = "value", value = "description")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.SELECT, isMultiple = 1, dataSrc = "INSTOCK_TRACTICS_ITEM_THREE")
    private Integer lev3StrategyPut;

//    public String getIev1StrategyPicking (String lev1StrategyPicking) {
//        return this.lev1Strategy = lev1StrategyPicking;
//    }
}
