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

import cn.estsh.i3plus.pojo.base.bean.BaseBean;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
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 :作业记录明细表
 * @Reference :
 * @Author : hansen.ke
 * @CreateDate : 2018-11-23 13:34
 * @Modify:
 **/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name = "WMS_ACTION_LOG_DETAILS")
@Api(value = "作业记录明细表", description = "作业记录表")
public class WmsActionLogDetails extends BaseBean {

    private static final long serialVersionUID = 680681221361042296L;
    @Column(name = "AL_ID")
    @ApiParam(value = "作业记录ID", example = "1")
    @JsonSerialize(using = ToStringSerializer.class)
    public Long alId;

    @Column(name = "AG_ID")
    @ApiParam(value = "流程ID")
    public Long agId;

    @Column(name = "SEQ")
    @ApiParam(value = "序号", example = "1")
    public Integer seq;

    @Column(name = "OK_SEQ")
    @ApiParam(value = "成功跳转步骤", example = "1")
    public Integer okSeq;

    @Column(name = "NG_SEQ")
    @ApiParam(value = "失败跳转步骤", example = "1")
    public Integer ngSeq;

    /**
     * 10=只输入一次,20=输入多次,
     * 30=输入多次不允许重复,40=本流程结束
     */
    @Column(name = "VALUE_TYPE")
    @ApiParam(value = "动作类型", example = "1")
    public Integer valueType;

    /**
     * 1=是,2=否
     */
    @Column(name = "TO_UPPER")
    @ApiParam(value = "是否转为大写", example = "1")
    public Integer toUpper;

    @Column(name = "LEN_CHECK")
    @ApiParam(value = "长度检查", example = "1")
    public Integer lenCheck;

    @Column(name = "AS_ID")
    @ApiParam(value = "作业步骤", example = "1")
    @JsonSerialize(using = ToStringSerializer.class)
    public Long asId;

    @Column(name = "AT_ID")
    @ApiParam(value = "步骤类型编号", example = "0")
    @JsonSerialize(using = ToStringSerializer.class)
    public Long atId;

    @Column(name = "ALD_STATUS")
    @ApiParam(value = "执行状态", example = "1")
    public Integer aldStatus;

    @Column(name = "START_TIME")
    @ApiParam(value = "开始执行时间")
    public String startTime;

    @Column(name = "END_TIME")
    @ApiParam(value = "结束执行时间")
    public String endTime;

    @Column(name = "GOTO_BTN_CODE")
    @ApiParam(value = "跳转按钮代码")
    public String goToBtnCode;

    @Column(name = "GOTO_BTN_NAME")
    @ApiParam(value = "跳转按钮名称")
    public String goToBtnName;

    @Column(name = "PRE_SHOW")
    @ApiParam(value = "是否预显示", example = "1")
    public Integer preShow;

    @Column(name = "SHOW_AM_ID")
    @ApiParam(value = "回显组件方法ID", example = "1")
    public Long showAmId;

    @Column(name = "AGD_ID")
    @ApiParam(value = "作业流程明细ID", example = "1")
    public Long agdId;

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

    @Column(name = "DURATION")
    @ApiParam(value = "执行耗时，单位：毫秒", example = "0")
    public Integer duration = 0;

    public Long getAsId() {
        if (asId != null) {
            return asId.longValue();
        } else {
            return asId;
        }
    }

    public Long getAlId() {
        if (alId != null) {
            return alId.longValue();
        } else {
            return alId;
        }
    }
}
