package net.vtstar.zhongtong.avi.equipment.domain;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import net.vtstar.user.search.JoinColumn;
import net.vtstar.user.search.Search;
import net.vtstar.zhongtong.avi.monitoring.domain.Skid;
import net.vtstar.zhongtong.avi.monitoring.domain.enums.Direction;
import net.vtstar.zhongtong.avi.monitoring.domain.enums.ProductionType;
import net.vtstar.zhongtong.avi.monitoring.domain.enums.StationState;
import net.vtstar.zhongtong.avi.monitoring.domain.vo.StationPos;
import org.hibernate.validator.constraints.Length;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;

/**
 * @Author: xiadongwei
 * @Date: 2019/9/20 9:31
 */
@ApiModel("喷涂车间_工位")
@Data
@Search(code = "PAINTSHOP_STATION")
@Table(name = "paintshop_station")
public class PaintshopStation implements Serializable {

    @Id
    private Long id;

    @ApiModelProperty(notes = "车间")
    @NotNull(message = "车间不能为空")
    @Length(max = 20, message = "车间名称长度不能大于{max}")
    @Column(name = "workshop_code")
    @Search
    private String workshopCode;

    @ApiModelProperty(notes = "区域ID")
    @NotNull(message = "区域ID不能为空")
    @Column(name = "area_id")
    private Long areaId;

    @ApiModelProperty(notes = "区域")
    @JoinColumn(tableName = PaintshopArea.class, name = "name")
    @Search
    private String areaName;

    @ApiModelProperty(notes = "车道ID")
    @NotNull(message = "车道ID不能为空")
    @Column(name = "lane_id")
    private Long laneId;

    @ApiModelProperty(notes = "车道编号")
    @Column(name = "vehicle_lane_code")
    @Search
    private String laneCode;

    @ApiModelProperty(notes = "从上至下车道号")
    @Column(name = "lane_no")
    @Search
    private String landNo;

    @ApiModelProperty(notes = "平移车道编号")
    @Column(name = "vehicle_lane_code")
    @Search
    private String vehicleLaneCode;

    @ApiModelProperty(notes = "工位编号")
    @NotNull(message = "工位编号不能为空")
    @Column(name = "code")
    private String code;

    @ApiModelProperty(notes = "状态")
    @Column(name = "state")
    private StationState state;

    @ApiModelProperty(notes = "滑撬ID")
    @Column(name = "skid_id")
    private String skidID;

    @ApiModelProperty(notes = "序号")
    @NotNull(message = "工位序号不能为空")
    @Column(name = "sequence")
    private Integer sequence;

    @ApiModelProperty(notes = "是否为关键工位")
    @Column(name = "key_station")
    private Boolean keyStation;

    @ApiModelProperty(notes = "车身号")
    private String busNo;

    @ApiModelProperty(notes = "工单号")
    private String workOrderNo;

    @ApiModelProperty(value = "车体类型")
    private ProductionType busType;

    @ApiModelProperty(value = "上次进车时间")
    private Date inTime;

    @ApiModelProperty(value = "过站信息ID")
    private Long passInfoId;

    @ApiModelProperty(notes = "状态", hidden = true)
    @Column(name = "status")
    private String status;

    @ApiModelProperty(notes = "旧状态", hidden = true)
    private StationState oldState;

    @ApiModelProperty(notes = "平移车到位信号", hidden = true)
    private Boolean arrive;

    @ApiModelProperty(notes = "当前绑定滑撬", hidden = true)
    private Skid skid;

    @ApiModelProperty(notes = "工位反转", hidden = true)
    private Boolean turnR;

    @ApiModelProperty(notes = "工位正转", hidden = true)
    private Boolean turnF;

    @ApiModelProperty(notes = "工艺流向", hidden = true)
    private Boolean flow;

    @Column(name = "ve_direction")
    @ApiModelProperty(notes = "相对平移车位置", hidden = true)
    private Direction direction;

    @ApiModelProperty(notes = "工位平移车位置", hidden = true)
    private StationPos pos;
}
