package cn.estsh.i3plus.pojo.wms.modelbean;

import cn.estsh.i3plus.pojo.base.bean.BaseBean;
import cn.estsh.i3plus.pojo.wms.bean.WmsPOMaster;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiParam;
import lombok.Data;

import java.time.LocalTime;
import java.util.Map;

/**
 * @Description : 供应商收货看板信息
 * @Reference :
 * @Author : sky.meng
 * @CreateDate : 2019-06-24 15:04
 * @Modify:
 **/
@Data
@Api("供应商收货看板")
public class WmsPoAsnRecvModel extends BaseBean implements Comparable<WmsPoAsnRecvModel> {

    private static final long serialVersionUID = 7985236317993813219L;
    @ApiParam("订单号")
    private String orderNo;
    @ApiParam("供应商名称")
    private String vendorName;
    @ApiParam("收货通道")
    private String dock;
    @ApiParam("项目代码")
    private String prodCfgTypeCode;
    @ApiParam("项目名称")
    private String prodCfgTypeName;
    @ApiParam("计划收货日期")
    private String planDate;
    @ApiParam("计划收货时间")
    private String planTime;
    @ApiParam("总数量")
    private Double transQty;
    @ApiParam("已收货数量")
    private Double resQty;
    @ApiParam("最早收货时间")
    private String earliestReceTime;
    @ApiParam("最晚收货时间")
    private String latestReceTime;
    @ApiParam("供应商号码")
    private String vendorNo;
    @ApiParam("物料")
    private String partNo;
    @ApiParam("收货状态")
    private String receiveStatus;

    @ApiParam("大于等于今天的结果集")
    private Map<String, Map<Integer, WmsPOMaster>> gteCurrentDayResultMap;

    @ApiParam("小于今天的结果集")
    private Map<Integer, Map<String, Object>> ltCurrentDayResultMap;

    public WmsPoAsnRecvModel(String orderNo, String partNo, String vendorName, String dock, String prodCfgTypeName,
                             String planTime, Double transQty, Double resQty) {
        this.orderNo = orderNo;
        this.partNo = partNo;
        this.vendorName = vendorName;
        this.dock = dock;
        this.prodCfgTypeName = prodCfgTypeName;
        this.planTime = planTime;
        this.transQty = transQty;
        this.resQty = resQty;
    }

    public WmsPoAsnRecvModel() {
    }

    @Override
    public int compareTo(WmsPoAsnRecvModel o) {
        return getLocalTime(this.getPlanTime()).isAfter(getLocalTime(o.getPlanTime())) ? 1 : -1;
    }

    public static LocalTime getLocalTime(String planTime) {
        LocalTime time = null;
        try {
            time = LocalTime.parse(planTime);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return time;
    }
}
