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.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

/**
 * @Description : WMS_拉动计划任务主表
 * @Reference :
 * @Author : jessica.chen
 * @CreateDate : 2019-11-09 14:21
 * @Modify:
 **/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name="WMS_PULL_TASK_MASTER")
@Api("WMS_拉动计划任务主表")
public class WmsPullTaskMaster extends BaseBean{

    private static final long serialVersionUID = 9214639813072592736L;

    @Column(name="WROKORDER_NO")
    @ApiParam("工单号")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.TEXT)
    private String woekorderNo;

    @Column(name="PDLINE_NO")
    @ApiParam("产线代码")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.LIST, getValWay = CommonEnumUtil.DYNAMIC_FIELD_GET_WAY.OBJ,
            dataSrc = "cn.estsh.i3plus.pojo.wms.bean.WmsWorkCenter",
            searchColumnName = "workCenterCode,workCenterName", listColumnName = "workCenterCode,workCenterName", explicitColumnName = "workCenterCode")
    private String pdlineNo;

    @Column(name="PLAN_PRODUCT_TIME")
    @ApiParam("生产日期")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.DATETIME)
    private String planProductTime;

    @Column(name="SHIFT_NO")
    @ApiParam("班次代码")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.LIST,  getValWay = CommonEnumUtil.DYNAMIC_FIELD_GET_WAY.OBJ,
            dataSrc = "cn.estsh.i3plus.pojo.wms.bean.WmsShift",
            searchColumnName = "shiftNo,shiftName", listColumnName = "shiftNo,shiftName", explicitColumnName = "shiftNo")
    private String shitNo;

    @Column(name="START_PRODUCT_TIME")
    @ApiParam("开始生产时间")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.DATETIME)
    private String startProductTime;

    @Column(name="END_PRODUCT_TIME")
    @ApiParam("结束生产时间")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.DATETIME)
    private String endProductTime;

    @Column(name="ORDER_STATUS")
    @ApiParam(value = "单据状态", example = "0")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.SELECT, dataSrc = "PULL_TASK_MASTER_STATUS")
    private Integer orderStatus = 0;

    @Column(name="IS_SUSPEND")
    @ApiParam(value = "是否暂停", example = "0")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.SELECT, dataSrc = "TRUE_OR_FALSE")
    private Integer isSuspend = 2;

    @Column(name="PULL_TASK_TYPE")
    @ApiParam(value = "拉动任务类型", example = "10")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.SELECT, dataSrc = "PULL_TASK_TYPE")
    private Integer pullTaskType;

    @Column(name="SEQ")
    @ApiParam(value = "排序号", example = "0")
    @DynamicField(webFieldType = CommonEnumUtil.FIELD_TYPE.NUMBER)
    private Integer seq;

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

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