BlendDispatchUtils.java

package com.mycim.utils;

import com.mycim.framework.utils.lang.collections.CollectionUtils;
import com.mycim.valueobject.wip.dto.BlendDispatchInfoDto;
import com.mycim.valueobject.wip.dto.BlendLotInfosDto;

/**
 * @author finatice.yang
 * @date 2021/11/16
 **/
public class BlendDispatchUtils {

    public static Boolean getNormalFlag(BlendLotInfosDto blendLotInfosDto) {
        return CollectionUtils.isNotEmpty(blendLotInfosDto.getNormalLotList());
    }

    public static Boolean getRunCardFlag(BlendLotInfosDto blendLotInfosDto) {
        return CollectionUtils.isNotEmpty(blendLotInfosDto.getRunCardLotList());
    }

    public static Boolean getAutoMonitorFlag(BlendLotInfosDto blendLotInfosDto) {
        return CollectionUtils.isNotEmpty(blendLotInfosDto.getAutoMonitorLotList());
    }

    public static BlendDispatchInfoDto getNormalDispatch(BlendLotInfosDto blendLotInfosDto) {
        if (!getNormalFlag(blendLotInfosDto)) {
            return null;
        }
        BlendDispatchInfoDto dispatchInfoDto = new BlendDispatchInfoDto();
        dispatchInfoDto.setLotList(blendLotInfosDto.getNormalLotList());
        dispatchInfoDto.setLotInfoDtoList(blendLotInfosDto.getNormalLotInfoDtoList());
        return dispatchInfoDto;
    }

    public static BlendDispatchInfoDto getRunCardDispatch(BlendLotInfosDto blendLotInfosDto) {
        if (!getRunCardFlag(blendLotInfosDto)) {
            return null;
        }
        BlendDispatchInfoDto dispatchInfoDto = new BlendDispatchInfoDto();
        dispatchInfoDto.setLotList(blendLotInfosDto.getRunCardLotList());
        dispatchInfoDto.setLotInfoDtoList(blendLotInfosDto.getRunCardLotInfoDtoList());
        return dispatchInfoDto;
    }

    public static BlendDispatchInfoDto getAutoMonitorDispatch(BlendLotInfosDto blendLotInfosDto) {
        if (!getAutoMonitorFlag(blendLotInfosDto)) {
            return null;
        }
        BlendDispatchInfoDto dispatchInfoDto = new BlendDispatchInfoDto();
        dispatchInfoDto.setLotList(blendLotInfosDto.getAutoMonitorLotList());
        dispatchInfoDto.setLotInfoDtoList(blendLotInfosDto.getAutoMonitorLotInfoDtoList());
        return dispatchInfoDto;
    }

}