package org.nl.acs.instruction.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.Accessors;
import org.nl.acs.common.base.CommonModel;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;

/**
 * @author jiaolm
 * @date 2023-05-09
 */
@Data
@Builder
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
@TableName("acs_instruction")
public class InstructionMybatis extends CommonModel<InstructionMybatis> implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "指令标识")
    @TableId(type= IdType.ASSIGN_ID)
    private String instruction_id;

    @ApiModelProperty(value = "任务标识")
    private String task_id;

    @ApiModelProperty(value = "指令编码")
    @NotBlank
    private String instruction_code;

    @ApiModelProperty(value = "关联编号")
    private String link_num;

    @ApiModelProperty(value = "指令由哪台设备做")
    private String execute_device_code;

    @ApiModelProperty(value = "执行状态")
    private String execute_status;

    @ApiModelProperty(value = "执行状态描述")
    private String execute_status_description;

    @ApiModelProperty(value = "下一条指令由哪台设备做")
    private String follow_device_code;

    @ApiModelProperty(value = "复合任务")
    @NotBlank
    private String compound_inst;

    @ApiModelProperty(value = "复合任务数据")
    private String compound_inst_data;

    @ApiModelProperty(value = "物料类型")
    private String material;

    @ApiModelProperty(value = "物料数量")
    @NotNull
    private BigDecimal quantity;

    @ApiModelProperty(value = "指令类型")
    private String instruction_type;

    @ApiModelProperty(value = "指令状态")
    private String instruction_status;

    @ApiModelProperty(value = "创建类型")
    private String create_type;

    @ApiModelProperty(value = "完成类型")
    private String finish_type;

    @ApiModelProperty(value = "优先级")
    private String priority;

    @ApiModelProperty(value = "执行编码")
    private String execute_code;

    @ApiModelProperty(value = "执行信息")
    private String execute_message;

    @ApiModelProperty(value = "起始点位编码")
    private String start_point_code;

    @ApiModelProperty(value = "起始设备编码")
    private String start_device_code;

    @ApiModelProperty(value = "起始点位编码2")
    private String start_point_code2;

    @ApiModelProperty(value = "起始设备编码2")
    private String start_device_code2;

    @ApiModelProperty(value = "目标点位编码")
    private String next_point_code;

    @ApiModelProperty(value = "目标设备编码")
    private String next_device_code;

    @ApiModelProperty(value = "目标点位编码2")
    private String next_point_code2;

    @ApiModelProperty(value = "目标设备编码2")
    private String next_device_code2;

    @ApiModelProperty(value = "放货点位编码")
    private String put_point_code;

    @ApiModelProperty(value = "放货设备编码")
    private String put_device_code;

    @ApiModelProperty(value = "任务号")
    private String task_code;

    @ApiModelProperty(value = "载具号")
    private String vehicle_code;

    @ApiModelProperty(value = "载具类型")
    private String vehicle_type;

    @ApiModelProperty(value = "排")
    private String from_x;

    @ApiModelProperty(value = "列")
    private String from_y;

    @ApiModelProperty(value = "层")
    private String from_z;

    @ApiModelProperty(value = "排2")
    private String from_x2;

    @ApiModelProperty(value = "列2")
    private String from_y2;

    @ApiModelProperty(value = "层2")
    private String from_z2;

    @ApiModelProperty(value = "排")
    private String put_x;

    @ApiModelProperty(value = "列")
    private String put_y;

    @ApiModelProperty(value = "层")
    private String put_z;

    @ApiModelProperty(value = "排")
    private String to_x;

    @ApiModelProperty(value = "列")
    private String to_y;

    @ApiModelProperty(value = "层")
    private String to_z;

    @ApiModelProperty(value = "排2")
    private String to_x2;

    @ApiModelProperty(value = "列2")
    private String to_y2;

    @ApiModelProperty(value = "层2")
    private String to_z2;

    @ApiModelProperty(value = "最后一条指令标识")
    private String last_instruction_id;

    @ApiModelProperty(value = "是否允许修改")
    @NotBlank
    private String can_modify;

    @ApiModelProperty(value = "备注")
    private String remark;

    @ApiModelProperty(value = "是否启用")
    @NotBlank
    private String is_active;

    @ApiModelProperty(value = "是否删除")
    @NotBlank
    private String is_delete;

    @ApiModelProperty(value = "创建者")
    @NotBlank
    @TableField(fill= FieldFill.INSERT)
    private String create_by;

    @ApiModelProperty(value = "创建时间")
    @NotBlank
    @TableField(fill= FieldFill.INSERT)
    private String create_time;

    @ApiModelProperty(value = "修改者")
    @TableField(fill= FieldFill.INSERT_UPDATE)
    private String update_by;

    @ApiModelProperty(value = "修改时间")
    @TableField(fill= FieldFill.INSERT_UPDATE)
    private String update_time;

    @ApiModelProperty(value = "车号")
    private String carno;

    @ApiModelProperty(value = "AGV任务号")
    private String agv_jobno;

    @ApiModelProperty(value = "下发AGV状态")
    private String send_status;

    @ApiModelProperty(value = "重量")
    private String weight;

    @ApiModelProperty(value = "路由方案编码")
    private String route_plan_code;

    @ApiModelProperty(value = "空盘数量")
    private String emptypallet_num;

    @ApiModelProperty(value = "AGV指令类型")
    private String agv_inst_type;

    @ApiModelProperty(value = "AGV系统类型")
    private String agv_system_type;

    /**
     * lms任务id
     */
    private String ext_task_id;

    public void copyFrom(Instruction source) {
        BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
