package org.nl.acs.task.domain;

import org.nl.acs.common.base.CommonModel;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.IdType;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.validation.constraints.*;
import java.math.BigDecimal;
import java.io.Serializable;

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

    @ApiModelProperty(value = "任务标识")
    @TableId(type= IdType.ASSIGN_ID)
    private String task_id;

    @ApiModelProperty(value = "任务外部标识")
    private String ext_task_id;

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

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

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

    @ApiModelProperty(value = "任务类型")
    @NotBlank
    private String task_type;

    @ApiModelProperty(value = "任务状态")
    @NotBlank
    private String task_status;

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

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

    @ApiModelProperty(value = "再次请求")
    private String request_again;

    @ApiModelProperty(value = "再次请求成功")
    private String request_again_success;

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

    @ApiModelProperty(value = "是否下发")
    private String is_send;

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

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

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

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

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

    @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 = "放货点位编码")
    private String put_point_code;

    @ApiModelProperty(value = "放货设备编码")
    private String put_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 from_x;

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

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

    @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 from_x2;

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

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

    @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 route_plan_name;

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

    @ApiModelProperty(value = "是否需要反馈上位系统")
    private String is_needfeedback;

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

    @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 weight;

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

    @ApiModelProperty(value = "立库任务类型")
    private String storage_task_type;

    @ApiModelProperty(value = "温度")
    private String temperature;

    @ApiModelProperty(value = "时间")
    private String oven_time;

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