package cn.estsh.i3plus.pojo.model.wms.engine.domain;

import lombok.Getter;
import lombok.Setter;
import org.optaplanner.core.api.domain.entity.PlanningEntity;
import org.optaplanner.core.api.domain.lookup.PlanningId;
import org.optaplanner.core.api.domain.variable.PlanningVariable;


/**
 * 库位
 */
@PlanningEntity(difficultyComparatorClass = LocateStrengthComparator.class)
public class WmsThreeDimenLocateModel {
    /**
     * 工厂代码
     */
    @Getter
    @Setter
    private String organizeCode;
    /**
     * 仓库编码
     */
    @Getter
    @Setter
    private String whNo;
    /**
     * 存储区编码
     */
    @Getter
    @Setter
    private String zoneNo;
    /**
     * 家具编码
     */
    @Getter
    @Setter
    private String furnitureNo;
    /**
     * 库位代码
     */
    @Getter
    @Setter
    @PlanningId
    private String locateNo;
    /**
     * X
     */
    @Getter
    @Setter
    private int x;

    /**
     * X
     */
    @Getter
    @Setter
    private int y;

    /**
     * X
     */
    @Getter
    @Setter
    private int z;
    /*
    库位在指定时间内的移动频率
     */
    @Getter
    @Setter
    private int frequency;
    /**
     * 库位的原始坐标
     */
    @Getter
    @Setter
    private int originSeq;
    /**
     * 库位当前的坐标，此处只用了一纬坐标，二维坐标需要映射到一纬空间内
     */
    private int destSeq;


    public WmsThreeDimenLocateModel() {
    }

    //3D仓库-库位移动频率热力图
    public WmsThreeDimenLocateModel(String organizeCode, String whNo, String zoneNo,
                                    String locateNo, Integer seq, Long frequency, String furnitureNo,
                                    Integer x, Integer y, Integer z) {
        this.organizeCode = organizeCode;
        this.whNo = whNo;
        this.zoneNo = zoneNo;
        this.locateNo = locateNo;
        this.originSeq = seq;
        this.destSeq = seq;
        this.frequency = Integer.parseInt(frequency.toString());
        this.furnitureNo = furnitureNo;
        this.x = x;
        this.y = y;
        this.z = z;
    }

    @PlanningVariable(valueRangeProviderRefs = {"locationRange"},
            strengthComparatorClass = LocationStrengthComparator.class)
    public Integer getDestSeq() {
        return this.destSeq;
    }

    public void setDestSeq(Integer destSeq) {
        this.destSeq = destSeq;
    }

}
