hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassOutRelationInfoServiceImpl.java
@@ -7,6 +7,7 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mes.common.config.Const;
import com.mes.common.config.ConstSysConfig;
import com.mes.glassinfo.entity.GlassInfo;
import com.mes.glassinfo.service.GlassInfoService;
import com.mes.hollow.controller.HollowBigStorageCageController;
@@ -23,6 +24,8 @@
import com.mes.hollow.service.HollowGlassRelationInfoService;
import com.mes.hollowqueue.entity.HollowGlassQueueInfo;
import com.mes.hollowqueue.service.HollowGlassQueueInfoService;
import com.mes.largenscreen.entity.PieChartVO;
import com.mes.sysconfig.service.SysConfigService;
import com.mes.tools.DateUtil;
import com.mes.utils.Blank;
import com.mes.utils.RedisUtil;
@@ -32,8 +35,8 @@
import freemarker.template.Version;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.io.*;
@@ -61,24 +64,28 @@
    HollowFormulaDetailsService hollowFormulaDetailsService;
    @Resource
    HollowGlassRelationInfoService hollowGlassRelationInfoService;
    @Resource
    SysConfigService sysConfigService;
    @Resource
    RedisUtil redisUtil;
    @Value("${mes.glassGap}")
    private Integer glassGap;
    @Value("${mes.carWidth}")
    private Integer carWidth;
//    @Value("${mes.glassGap}")
//    private Integer glassGap;
//
//    @Value("${mes.carWidth}")
//    private Integer carWidth;
    private static final int ID_RATIO = 10;
    @Override
    @Transactional
    public HollowGlassOutRelationInfo receiveTask(HollowTaskRequest request) {
        return childrenTask(request, 0);
    }
    @Override
    @Transactional
    public HollowGlassOutRelationInfo forceOutGlass(HollowTaskRequest request) {
        return childrenTask(request, 1);
    }
@@ -213,14 +220,16 @@
        //设置文件第一层列表数据
        //暂时生成笼内所有的玻璃信息(已配对和未配对的)
//        List<HollowGlassRelationInfo> hollowGlassRelationInfos = hollowGlassRelationInfoService.list(new LambdaQueryWrapper<HollowGlassRelationInfo>()
//                .eq(HollowGlassRelationInfo::getFlowCardId, flowCardId).orderByAsc(HollowGlassRelationInfo::getHollowSequence));
        List<HollowBigStorageCageDetails> hollowGlassRelationInfos = hollowBigStorageCageDetailsService.queryPairGlassList(flowCardId, relationInfo.getTotalLayer(), relationInfo.getTotalPairQuantity(), isOut);
        Map<Integer, List<HollowBigStorageCageDetails>> listMap = hollowGlassRelationInfos.stream().collect(Collectors.groupingBy(HollowBigStorageCageDetails::getHollowSequence));
        Map<Integer, List<HollowBigStorageCageDetails>> listMap = hollowGlassRelationInfos.stream()
                .collect(Collectors.groupingBy(HollowBigStorageCageDetails::getHollowSequence,
                        Collectors.collectingAndThen(Collectors.toList(),
                                list -> list.stream().sorted(Comparator.comparing(HollowBigStorageCageDetails::getLayer)).collect(Collectors.toList()))));
        Map<Integer, List<HollowBigStorageCageDetails>> sortListMap = new TreeMap<>();
        sortListMap.putAll(listMap);
        //设置间隔板数据共所有配对玻璃使用
        List<LisecHollowGlassAndFrameDetails> glassAndFrameList = new ArrayList<>();
        listMap.forEach((e, v) -> {
        sortListMap.forEach((e, v) -> {
            LisecHollowGlassAndFrameDetails glassAndFrame = new LisecHollowGlassAndFrameDetails();
            List<LisecHollowGlassDetails> glassList = new ArrayList<>();
            List<LisecHollowFrameDetails> frameList = new ArrayList<>();
@@ -281,10 +290,7 @@
            glassAndFrame.setFrameList(frameList);
            glassAndFrameList.add(glassAndFrame);
        });
        Collections.sort(glassAndFrameList, (s1, s2) -> Integer.parseInt(s1.getItemNum()) - Integer.parseInt(s2.getItemNum()));
        details.setGlassAndFrameList(glassAndFrameList);
        Configuration cfg = new Configuration(new Version("2.3.29"));
        cfg.setClassForTemplateLoading(HollowBigStorageCageController.class, "/templates/");
        // 创建Calculator实例
@@ -359,11 +365,15 @@
                .queryOutGlassList(request.getFlowCardId(), request.getCell());
        int isPairCount = glassInfo.getTotalLayer() * request.getTotalPairQuantity();
        List<HollowGlassQueueInfo> hollowQueues = new ArrayList<>();
        Integer carWidth = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_CAR_WIDTH);
//        Integer glassGap = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_GLASS_GAP);
        Integer glassGap = hollowGlassRelationInfoService.getGlassGapByThickness(hollowBigStorageCageDetailsList.get(0).getThickness());
        if (930 == request.getCell()) {
            Map<Integer, List<HollowBigStorageCageDetails>> listMap = hollowBigStorageCageDetailsList.stream()
                    .collect(Collectors.groupingBy(HollowBigStorageCageDetails::getHollowSequence));
            for (Map.Entry<Integer, List<HollowBigStorageCageDetails>> entry : listMap.entrySet()) {
            Map<Integer, List<HollowBigStorageCageDetails>> sortListMap = new TreeMap<>();
            sortListMap.putAll(listMap);
            for (Map.Entry<Integer, List<HollowBigStorageCageDetails>> entry : sortListMap.entrySet()) {
                //创建队列接收不满足成对情况下:一对玻璃分几次上车的次序问题
                List<HollowGlassQueueInfo> tempList = new ArrayList<>();
                //先将玻璃按照正常顺序排列,计算一车最多放几块,算好块数之后将一车的玻璃按照倒序存储
@@ -389,6 +399,7 @@
                    }
                }
            }
        } else {
            loop:
            for (HollowBigStorageCageDetails item : hollowBigStorageCageDetailsList) {
@@ -423,5 +434,10 @@
        queueInfo.setUpdateTime(new Date());
        return queueInfo;
    }
    @Override
    public List<PieChartVO> queryPieChart() {
        return baseMapper.queryPieChart();
    }
}