package com.wms_main.model.vo.wms;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.wms_main.model.po.TAppPickPlan;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class PickPlanVo {
    /**
     * 主键
     */
    @JsonProperty(value = "planId")
    private String planId;
    /**
     * 载具号
     */
    @JsonProperty(value = "vehicleId")
    private String vehicleId;
    /**
     * 料号
     */
    @JsonProperty(value = "goodsId")
    private String goodsId;
    /**
     * 计划拣选数量
     */
    @JsonProperty(value = "planPickQty")
    private Integer planPickQty;
    /**
     * 拣选类型
     * 1. 工作拣选
     * 2. 出库单
     */
    @JsonProperty(value = "pickType")
    private Integer pickType;
    /**
     * 工作index/出库单
     */
    @JsonProperty(value = "workIndex")
    private String workIndex;
    /**
     * 工作index/出库单
     */
    @JsonProperty(value = "standId")
    private String standId;

    /**
     * 将Po转化为Vo
     * @param po 数据库实体
     * @return 转化结果
     */
    public static PickPlanVo of(TAppPickPlan po) {
        if (po == null) {
            return new PickPlanVo();
        }
        return new PickPlanVo(
                po.getPlanId(),
                po.getVehicleId(),
                po.getGoodsId(),
                po.getPlanPickQty(),
                po.getPickType(),
                po.getWorkIndex(),
                po.getStandId()
        );
    }
}
