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

import cn.estsh.i3plus.pojo.base.annotation.AnnoOutputColumn;
import cn.estsh.i3plus.pojo.base.bean.BaseBean;
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.Index;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.List;

/**
 * @Description : 作业任务表信息
 * @Reference :
 * @Author : silliter.yuan
 * @CreateDate : 2018-11-06 15:58
 * @Modify:
 **/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name = "WMS_TASK",indexes = {
        @Index(columnList = "TASK_STATUS"),
        @Index(columnList = "TRANS_TYPE_CODE")
})
@Api("作业任务表")
public class WmsTaskInfo extends BaseBean {

    private static final long serialVersionUID = -5462013707601937183L;
    @Column(name = "ORDER_NO")
    @ApiParam("单号")
    public String orderNo;

    @Column(name = "MOVE_NO")
    @ApiParam("移动单号")
    public String moveNo;

    @Column(name = "USER_NO")
    @ApiParam("作业人员")
    public String userNo;

    @Column(name = "OP_TYPE_CODE")
    @ApiParam("作业类型")
    public String opTypeCode;

    @Column(name = "REMARK")
    @ApiParam("备注")
    public String remark;

    /**
     * 状态:1=创建,10=待处理,20=已处理
     */
    @Column(name = "TASK_STATUS")
    @ApiParam(value = "任务状态", example = "1")
    @AnnoOutputColumn(refClass = WmsEnumUtil.TASK_INFO_STATUS.class,refForeignKey = "value",value = "description")
    public Integer taskStatus;

    @Column(name = "TRANS_TYPE_CODE")
    @ApiParam("交易类型")
    public String transTypeCode;

    @Column(name = "PRE_USE_TIME")
    @ApiParam(value = "预计作业时间(分钟)", example = "1")
    public Integer preUseTime;

    @Column(name = "IS_ONE_STEP")
    @ApiParam("是否一步法操作")
    @AnnoOutputColumn(refClass = WmsEnumUtil.TRUE_OR_FALSE.class,refForeignKey = "value",value = "description")
    public Integer isOneStep;

    @ApiParam("作业类型名称")
    @Transient
    @AnnoOutputColumn(refClass = WmsEnumUtil.OP_TYPE_CODE.class,refForeignKey = "value",value = "description")
    public String opTypeName;

    @ApiParam("作业任务明细")
    @Transient
    public List<WmsTaskDetails> taskDetailsList;

    @Column(name = "IS_CHECK_SN")
    @ApiParam("是否校验条码")
    @AnnoOutputColumn(refClass = WmsEnumUtil.TRUE_OR_FALSE.class,refForeignKey = "value",value = "description")
    public Integer isCheckSn;

    @Column(name = "SYNC_STATUS")
    @ApiParam("是否同步")
    public Integer syncStatus = 10;

    @Column(name = "SYNC_DATE_TIME")
    @ApiParam(value = "同步时间", example = "1")
    public String syncDateTime;

    @Column(name = "SYNC_USER")
    @ApiParam(value = "同步人", example = "1")
    public String syncUser;

    @Transient
    @ApiParam("计划日期")
    private String zdate;

    @Transient
    @ApiParam("计划时间")
    private String ztime;

    @Transient
    @ApiParam(value = "客户编号")
    private String custNo;

    @Transient
    @ApiParam(value = "供应商编号")
    private String vendorNo;

    @Transient
    @ApiParam("工厂集合")
    private List<String> organizeCodeList;

    @Transient
    @ApiParam("业务类型代码")
    public String busiTypeCode;

    public WmsTaskInfo(){};

    public WmsTaskInfo(String orderNo ,Integer taskStatus , String zdate ,String ztime,String custNo,String vendorNo){
        this.orderNo = orderNo;
        this.taskStatus = taskStatus;
        this.zdate = zdate;
        this.ztime = ztime;
        this.custNo = custNo;
        this.vendorNo = vendorNo;
    }
}
