wuyouming666
2024-04-19 7357691a222745887ca1c336d8c458964a0d3ab8
hangzhoumesParent/moduleService/UnLoadGlassModule/src/main/java/com/mes/downstorage/service/impl/DownStorageCageServiceImpl.java
@@ -4,19 +4,15 @@
import com.mes.downstorage.entity.DownStorageCage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mes.downstorage.entity.DownStorageCageDetails;
import com.mes.downstorage.mapper.DownStorageCageDetailsMapper;
import com.mes.downstorage.mapper.DownStorageCageMapper;
import com.mes.downstorage.service.DownStorageCageService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.Collections;
import java.util.Comparator;
/**
 * <p>
 *  服务实现类
@@ -40,17 +36,18 @@
    @Override
    public List<Map> getCacheLeisure() {
    public List<DownStorageCageDetails> getCacheLeisure() {
        log.info(" 查询笼子内空闲");
        List<Map> map = downStorageCageMapper.selectJoinList(
                Map.class, new MPJQueryWrapper<DownStorageCageDetails>()
        List<DownStorageCageDetails> list = downStorageCageMapper.selectJoinList(
                DownStorageCageDetails.class, new MPJQueryWrapper<DownStorageCageDetails>()
                        .select("escd.*")
                        .leftJoin("down_storage_cage_details escd on t.slot = escd.slot")
                        .isNull("escd.slot")
                        .orderByAsc("escd.slot")
        );
        return map;
        return list;
    }
//    @Override
//    public List<Map> getCacheOut(int start, int end) {
@@ -72,31 +69,24 @@
    @Override
    public List<Map> getCacheOut(int start, int end) {
    public List<DownStorageCageDetails> getCacheOut(int start, int end) {
        log.info("根据传入的工位查询符合按照顺序和大小出片的小片");
        List<Map> map = downStorageCageMapper.selectJoinList(
                Map.class, new MPJQueryWrapper<DownStorageCageDetails>()
        List<DownStorageCageDetails> list = downStorageCageMapper.selectJoinList(
                DownStorageCageDetails.class, new MPJQueryWrapper<DownStorageCageDetails>()
                        .select("escd.*")
                        .leftJoin("down_storage_cage_details escd on t.slot = escd.slot")
                        .leftJoin("down_workstation dw on escd.flow_card_id = dw.flow_card_id")
                        .leftJoin("glass_info gi on dw.flow_card_id = gi.flowcard_id  and gi.flowcard_id=escd.flow_card_id ")
                        .isNotNull("escd.slot")
                        .between("dw.workstation_id", start, end)
                        .orderByAsc("escd.tempering_layout_id, escd.tempering_feed_sequence")
                        .orderByDesc("escd.width")
                        .orderByDesc("escd.height")
        );
        // 对获取的数据列表按照宽度进行排序
        Collections.sort(map, new Comparator<Map>() {
            @Override
            public int compare(Map o1, Map o2) {
                // 获取宽度并比较
                double width1 = (double) o1.get("width");
                double width2 = (double) o2.get("width");
                return Double.compare(width2, width1);
            }
        });
        return map;
        return list;
    }
    @Override
@@ -112,12 +102,11 @@
    }
    @Override
    public List<Map> getIsExistIntoCacheByLayoutAndSequence(Integer tempering_layout_id, Integer tempering_feed_sequence, double width) {
    public List<DownStorageCageDetails> getIsExistIntoCacheByLayoutAndSequence(Integer tempering_layout_id, Integer tempering_feed_sequence, double width) {
        log.info(" 查询可进此片玻璃的栅格号  找到相同版图id并且大于前面的顺序的空格");
        List<Map> map = downStorageCageMapper.selectJoinList(
                Map.class, new MPJQueryWrapper<DownStorageCageDetails>()
        List<DownStorageCageDetails> list = downStorageCageMapper.selectJoinList(
                DownStorageCageDetails.class, new MPJQueryWrapper<DownStorageCageDetails>()
                        .select("escd.*")
                        .leftJoin("down_storage_cage_details escd on t.slot = escd.slot")
                        .isNotNull("escd.slot")
@@ -126,24 +115,28 @@
                        .gt("t.remain_width", width)
                        .orderByAsc("escd.tempering_feed_sequence")
        );
        return map;
        return list;
    }
    @Override
    public List<Map> getIsExistIntoCacheByLayout(Integer tempering_layout_id, double width) {
        List<Map> map = downStorageCageMapper.selectJoinList(
                Map.class, new MPJQueryWrapper<DownStorageCageDetails>()
    public List<DownStorageCageDetails> getIsExistIntoCacheByLayout(Integer tempering_layout_id, double width) {
        log.info(" 查询可进此片玻璃的栅格号");
        List<DownStorageCageDetails> list = downStorageCageMapper.selectJoinList(
                DownStorageCageDetails.class, new MPJQueryWrapper<DownStorageCageDetails>()
                        .select("escd.*")
                        .leftJoin("down_storage_cage_details escd on t.slot = escd.slot")
                        .isNotNull("escd.slot")
                        .lt("escd.tempering_layout_id", tempering_layout_id)
                        .gt("t.remain_width", width)
                        // 条件 t.remain_width - width > 0
                        .apply("t.remain_width - " + width + " > 0")
                        .orderByDesc("escd.tempering_layout_id, escd.tempering_feed_sequence")
        );
        return map;
        return list;
    }
}