package com.prolog.eis.model.container;


import com.prolog.framework.core.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDateTime;

import static com.prolog.eis.utils.GoodsPropertyUtils.getGoodsProperty;

/**
 * 出库容器任务表
 */
@ApiModel(value = "出库容器任务表")
@Data
@Table(value = "container_task")
public class ContainerTask {
    /**
     * id
     */
    @Id
    @Column("id")
    @AutoKey(type = AutoKey.TYPE_IDENTITY)
    @ApiModelProperty(value = "id")
    private Integer id;

    /**
     * 容器号
     */
    @Column(value = "container_no")
    @ApiModelProperty(value = "容器号")
    private String containerNo;

    /**
     * 子容器号
     */
    @Column(value = "container_sub_no")
    @ApiModelProperty(value = "子容器号")
    private String containerSubNo;

    /**
     * 任务类型
     */
    @Column(value = "task_type")
    @ApiModelProperty(value = "任务类型EIS订单类型 20 销售出库  30补货  40盘点出库 50 养护出库")
    private Integer taskType;


    /**
     * 下发pms拣选任务ID
     */
    @Column(value = "task_id")
    @ApiModelProperty(value = "下发pms拣选任务ID")
    private String taskId;


    /**
     * 波次号
     */
    @Column(value = "wave_no")
    @ApiModelProperty(value = "波次号")
    private String waveNo;


    /**
     * 客户
     */
    @Column(value = "company_id")
    @ApiModelProperty(value = "客户")
    private String companyId;

    /**
     * 出库任务id
     */
    @Column(value = "outbound_id")
    @ApiModelProperty(value = "出库任务id")
    private Integer outboundId;

    /**
     * 出库任务明细id
     */
    @Column(value = "outbound_detail_id")
    @ApiModelProperty(value = "出库任务明细id")
    private Integer outboundDetailId;

    /**
     * 容器类型
     */
    @Column(value = "container_type")
    @ApiModelProperty(value = "容器类型")
    private Integer containerType;

    /**
     * 拣选单id
     */
    @Column(value = "pick_order_id")
    @ApiModelProperty(value = "拣选单id")
    private Integer pickOrderId;

    /**
     * 数量
     */
    @Column(value = "qty")
    @ApiModelProperty(value = "数量")
    private BigDecimal qty;

    /**
     * 数量
     */
    @Column(value = "inv_qty")
    @ApiModelProperty(value = "盘点数量")
    private BigDecimal invQty;
    /**
     * 状态
     */
    @Column(value = "status")
    @ApiModelProperty(value = "状态(0:创建，1：开始--已发送出库任务，2：容器到位，3：拣选完成)")
    private Integer status;

    /**
     * 创建时间
     */
    @Column(value = "create_time")
    @ApiModelProperty(value = "创建时间")
    private LocalDateTime createTime;

    /**
     * 库区（四向库：SX01;AGV托盘：AGVTP01;AGV货架：AGVHJ01 ）
     */
    @Column(value = "warehouse_area")
    @ApiModelProperty(value = "库区（四向库：SX01;AGV托盘：AGVTP01;AGV货架：AGVHJ01 ）")
    private String warehouseArea;

    /**
     * 优先级
     */
    @Column(value = "priorty")
    @ApiModelProperty(value = "优先级")
    private Integer priorty;

    /**
     * 修改时间
     */
    @Column(value = "update_time")
    @ApiModelProperty(value = "修改时间")
    private LocalDateTime updateTime;

    /**
     * 完成时间
     */
    @Column(value = "finish_time")
    @ApiModelProperty(value = "完成时间")
    private LocalDateTime finishTime;

    /**
     * 回告时间
     */
    @Column(value = "call_back_time")
    @ApiModelProperty(value = "回告时间")
    private LocalDateTime callBackTime;

    /**
     * 错误消息
     */
    @Column(value = "error_msg")
    @ApiModelProperty(value = "错误消息")
    private String errorMsg;

    /**
     * 拓展字段1
     */
    @Column(value = "extend_1")
    @ApiModelProperty(value = "拓展字段1")
    private String extend1;

    /**
     * 拓展字段2
     */
    @Column(value = "extend_2")
    @ApiModelProperty(value = "拓展字段2")
    private String extend2;

    /**
     * 拓展字段3
     */
    @Column(value = "extend_3")
    @ApiModelProperty(value = "拓展字段3")
    private String extend3;

    /**
     * 物料id
     */
    @Column(value = "item_id")
    @ApiModelProperty(value = "物料id")
    private String itemId;

    /**
     * 货主
     */
    @Column(value = "owner_id")
    @ApiModelProperty(value = "货主")
    private String ownerId;

    /**
     * 批号
     */
    @Column(value = "lot_id")
    @ApiModelProperty(value = "批号")
    private String lotId;

    /**
     * 包装ID
     */
    @Column(value = "pack_id")
    @ApiModelProperty(value = "包装ID")
    private String packId;


    /**
     * wms大货位
     */
    @Column(value = "wms_location_code")
    @ApiModelProperty(value = "wms大货位")
    private String wmsLocationCode;


    @Column("grid_no")
    @ApiModelProperty("格口号")
    private String gridNo;

    @Column("shelves_state")
    @ApiModelProperty("上架状态 1已上架")
    private Integer shelvesState;

    @Column("station_id")
    @ApiModelProperty("索取的站台id")
    private Integer stationId;

    @Column("station_loc")
    @ApiModelProperty("站台位置编号")
    private Integer stationLoc;

    @Column("yh_result")
    @ApiModelProperty("养护结果")
    private String yhResult;

    @Ignore
    private String billNo;
    @Ignore
    private Integer orderId;
    @Ignore
    @ApiModelProperty("EIS内部波次")
    private String eisWaveNo;
    @Ignore
    @ApiModelProperty("是否绑定格口")
    private Integer isBindGrid;
    @Ignore
    @ApiModelProperty("此任务是否达到配置的超时时间 1是 0否")
    private int isTimeOut;
    @Ignore
    @ApiModelProperty("此任务满足的订单数量")
    private int orderNum;
    @Ignore
    @ApiModelProperty("此任务满足的订单明细数量")
    private int orderDetailNum;
    @Ignore
    private String abcType;

    public String getBusinessProperty() {
        return getGoodsProperty(this.itemId, this.lotId, this.ownerId, this.packId);
    }
}