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

import cn.estsh.i3plus.pojo.base.annotation.AnnoOutputColumn;
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.*;

/**
 * @Description : 作业步骤调用
 * @Reference :
 * @Author : jimmy.zeng
 * @CreateDate : 2018-11-22 14:18
 * @Modify:
 **/
@Data
@Entity
@DynamicInsert
@DynamicUpdate
@EqualsAndHashCode(callSuper = true)
@Table(name = "WMS_ACTION_STEP_CALL", indexes = {
        @Index(columnList = "ORGANIZE_CODE"),
        @Index(columnList = "AS_ID"),
        @Index(columnList = "AM_ID")
})
@Api("作业步骤调用信息")
public class WmsActionStepCall extends BaseBean {

    private static final long serialVersionUID = -6013283534745803464L;
    @Column(name = "AS_ID",nullable = false)
    @ApiParam(value = "作业步骤ID", example = "0")
    @JsonSerialize(using = ToStringSerializer.class)
    @AnnoOutputColumn
    public Long asId;

    @Column(name = "SEQ",nullable = false)
    @ApiParam(value = "序号", example = "0")
    @AnnoOutputColumn
    public Integer seq;

    @Column(name = "AM_ID", nullable = false)
    @ApiParam(value = "处理组件ID", example = "0")
    @JsonSerialize(using = ToStringSerializer.class)
    @AnnoOutputColumn
    public Long amId;

    @Transient
    @ApiParam(value = "组件名称")
    public String amName;

    @Transient
    @ApiParam(value = "组件描述")
    public String amDesc;

    @Column(name = "AM_TYPE",nullable = false)
    @ApiParam(value = "组件类型")
    @AnnoOutputColumn
    public Integer amType;

    @Column(name = "OK_VALUE", nullable = false)
    @ApiParam(value = "成功标志")
    @AnnoOutputColumn
    public Integer okValue;

    public int getAmTypeVal() {
        return this.amType == null ? 0 : this.amType;
    }

    public int getOkValueVal() {
        return this.okValue == null ? 0 : this.okValue;
    }
}
