ShelfLoc.java 2.5 KB
package com.myproject.bean.qisda;

import com.myproject.util.StorageConstants;

/**
 * Created by sunke on 2019/12/25.
 */
public class ShelfLoc {


    /**
     * 料架号
     */
    private String rfid;

    /**
     * 架位号
     */
    private int loc;

    /**
     * 物料编码
     */
    private String barcode;

    /**
     * 物料类型:小料,大料或者包装料
     */
    private int reelType;

    /**
     * 是否为空(即物料是否已经放入)
     */
    private boolean empty = true;

    public String getBarcode() {
        return barcode;
    }

    public void setBarcode(String barcode) {
        this.barcode = barcode;
    }

    public boolean isEmpty() {
        return empty;
    }

    public void setEmpty(boolean empty) {
        this.empty = empty;
    }

    public int getLoc() {
        return loc;
    }

    public void setLoc(int loc) {
        this.loc = loc;
    }

    public int getReelType() {
        return reelType;
    }

    public void setReelType(int reelType) {
        this.reelType = reelType;
    }

    public boolean putIn(String barcode){
        boolean canPut = false;
        //库位未锁定或条码与锁定barcode一样,可放入
        if(!isLock()){
            canPut = true;
        }else if(this.getBarcode().equals(barcode)){
            canPut = true;
        }

        if(canPut){
            this.setBarcode(barcode);
            setEmpty(false);
        }
        return canPut;
    }

    public boolean isCutLoc(){
        return reelType == StorageConstants.REEL_TYPE.CUT;
    }
    /**
     * 是否是包装料料格
     */
    public boolean isPackageLoc(){
        return reelType == StorageConstants.REEL_TYPE.PACKAGE;
    }
    /**
     * 是否是大料料格
     */
    public boolean isBigLoc(){
        return reelType == StorageConstants.REEL_TYPE.BIG;
    }

    /**
     * 是否是大料料格
     */
    public boolean isSmallLoc(){
        return reelType == StorageConstants.REEL_TYPE.SMALL;
    }

    /**
     * 库位是否被锁定
     */
    public boolean isLock(){
        return this.barcode != null && !this.barcode.isEmpty();
    }

    public String getRfid() {
        return rfid;
    }

    public void setRfid(String rfid) {
        this.rfid = rfid;
    }

    /**
     * 判断该架位锁定的条码是否与给定的条码一样
     * @param barcode
     * @return
     */
    public boolean isInThisLoc(String barcode){
        if(this.isLock()){
            return this.getBarcode().equals(barcode);
        }
        return false;
    }
}