zhoushihao
2024-12-03 c823892f961b266199731ddd365d2dd4af4bf382
1、中空线初步版本,待优化 2、fixbug 钢化后摆片顺序错乱
16个文件已修改
1个文件已添加
360 ■■■■■ 已修改文件
hangzhoumesParent/common/servicebase/src/main/java/com/mes/base/entity/HollowBigStorageCageBaseInfo.java 64 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageNewTask.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/controller/HollowGlassOutRelationInfoController.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/entity/HollowBigStorageCageDetails.java 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/entity/HollowGlassOutRelationInfo.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/entity/dto/FlowCardVirtualSlotDTO.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/mapper/HollowBigStorageCageDetailsMapper.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/service/HollowBigStorageCageDetailsService.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/service/HollowGlassOutRelationInfoService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowBigStorageCageDetailsServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassOutRelationInfoServiceImpl.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollowqueue/controller/HollowGlassQueueInfoController.java 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollowqueue/entity/HollowGlassQueueInfo.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollowqueue/service/HollowGlassQueueInfoService.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollowqueue/service/impl/HollowGlassQueueInfoServiceImpl.java 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java 104 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/howllowGlassModule/src/main/resources/mapper/HollowBigStorageCageDetailsMapper.xml 79 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/common/servicebase/src/main/java/com/mes/base/entity/HollowBigStorageCageBaseInfo.java
New file
@@ -0,0 +1,64 @@
package com.mes.base.entity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * @Author : zhoush
 * @Date: 2024/6/21 9:40
 * @Description:
 */
@Data
public class HollowBigStorageCageBaseInfo {
    /**
     * 工程号
     */
    @ApiModelProperty(value = "工程号", position = 16)
    private String engineerId;
    /**
     * 玻璃id
     */
    @ApiModelProperty(value = "玻璃id")
    private String glassId;
    /**
     * 钢化版图id
     */
    @ApiModelProperty(value = "钢化版图id", position = 12)
    private Integer temperingLayoutId;
    /**
     * 钢化版图片序
     */
    @ApiModelProperty(value = "钢化版图片序", position = 13)
    private Integer temperingFeedSequence;
    /**
     * 宽
     */
    @ApiModelProperty(value = "宽")
    private double width;
    /**
     * 宽
     */
    @ApiModelProperty(value = "高")
    private double height;
    /**
     * 格子号
     */
    @ApiModelProperty(value = "玻璃id")
    private Integer slot;
    /**
     * /*层号
     */
    private Integer layer;
    /**
     * 格子号
     */
    @ApiModelProperty(value = "玻璃id")
    private Integer isPair;
}
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageNewTask.java
@@ -90,8 +90,6 @@
    @Value("${mes.outCarMaxSize}")
    private Integer outCarMaxSize;
    @Value("${mes.sequence.order}")
    private boolean sequenceOrder;
    @Value("${mes.temperingOutTargetPosition}")
    private Integer temperingOutTargetPosition;
    @Value("${mes.artificialOutTargetPosition}")
@@ -225,7 +223,8 @@
        //是否允许钢化
        //是否有正在钢化的玻璃:钢化小片表关联历史任务表,筛选未出笼的玻璃信息
//            获取当前钢化任务未完成出片的玻璃信息
        List<TemperingGlassInfo> unFinishTemperingGlassInfoList = temperingGlassInfoService.list(new LambdaQueryWrapper<TemperingGlassInfo>().eq(TemperingGlassInfo::getState, Const.TEMPERING_NEW));
        List<TemperingGlassInfo> unFinishTemperingGlassInfoList = temperingGlassInfoService.list(new LambdaQueryWrapper<TemperingGlassInfo>()
                .eq(TemperingGlassInfo::getState, Const.TEMPERING_NEW).orderByAsc(TemperingGlassInfo::getTemperingFeedSequence));
        if (CollectionUtil.isNotEmpty(unFinishTemperingGlassInfoList)) {
//            List<String> glassIdList = unFinishTemperingGlassInfoList.stream().map(TemperingGlassInfo::getGlassId).collect(Collectors.toList());
//            List<BigStorageCageHistoryTask> historyTaskList = bigStorageCageHistoryTaskService.list(new LambdaQueryWrapper<BigStorageCageHistoryTask>()
@@ -260,7 +259,7 @@
                            .eq(BigStorageCageDetails::getState, Const.GLASS_STATE_IN)
                            .eq(GlassInfo::getTemperingLayoutId, item.getTemperingLayoutId())
                            .eq(GlassInfo::getEngineerId, item.getEngineerId())
                            .orderBy(Boolean.TRUE, sequenceOrder, GlassInfo::getTemperingFeedSequence));
                            .orderByAsc(GlassInfo::getTemperingFeedSequence));
                    if (CollectionUtil.isNotEmpty(temperingGlassInfos)) {
                        temperingGlassInfoService.saveBatch(temperingGlassInfos);
                        computeOutGlassInfoByVirtualSlot(temperingGlassInfos, "big_storage_cage_out_one_task", temperingOutTargetPosition, Const.GLASS_STATE_OUT_ING, Const.BIG_STORAGE_BEFORE_OUT);
@@ -644,7 +643,7 @@
        log.info("将出片玻璃{}玻璃状态改为出片中", glassIds);
        bigStorageCageDetailsService.update(new LambdaUpdateWrapper<BigStorageCageDetails>()
                .set(BigStorageCageDetails::getState, state)
                .set(Const.RAW_GLASS_TASK_TYPE_DISPATCH.equals(taskType), BigStorageCageBaseInfo::getSlot, targetSlot)
                .set(Const.BIG_STORAGE_BEFORE_DISPATCH.equals(taskType), BigStorageCageBaseInfo::getSlot, targetSlot)
                .ne(BigStorageCageDetails::getState, Const.GLASS_STATE_OUT)
                .in(BigStorageCageDetails::getGlassId, glassIds));
        try {
hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/controller/HollowGlassOutRelationInfoController.java
@@ -26,8 +26,8 @@
    @ApiOperation("领取任务")
    @PostMapping("/receiveTask")
    public Result<HollowGlassOutRelationInfo> receiveTask(String flowCardId, int cell) {
        return Result.success(hollowGlassOutRelationInfoService.receiveTask(flowCardId, cell));
    public Result<HollowGlassOutRelationInfo> receiveTask(String flowCardId, int cell, int totalPairQuantity) {
        return Result.success(hollowGlassOutRelationInfoService.receiveTask(flowCardId, cell, totalPairQuantity));
    }
}
hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/entity/HollowBigStorageCageDetails.java
@@ -2,7 +2,7 @@
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.mes.base.entity.BigStorageCageBaseInfo;
import com.mes.base.entity.HollowBigStorageCageBaseInfo;
import lombok.Data;
import java.util.Date;
@@ -14,7 +14,7 @@
 * @since 2024-11-21 09:23:12
 */
@Data
public class HollowBigStorageCageDetails extends BigStorageCageBaseInfo {
public class HollowBigStorageCageDetails extends HollowBigStorageCageBaseInfo {
    /**
     * /*大理片笼详情表id
     */
@@ -67,10 +67,6 @@
     * /*层号
     */
    private Integer hollowSequence;
    /**
     * /*层号
     */
    private Integer layer;
    /**
     * 创建时间
@@ -80,7 +76,6 @@
     * 更新时间
     */
    private Date updateTime;
}
hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/entity/HollowGlassOutRelationInfo.java
@@ -36,6 +36,14 @@
     */
    private Integer state;
    /**
     * 总配对数量
     */
    private Integer totalPairQuantity;
    /**
     * 已完成配对数量
     */
    private Integer pairQuantity;
    /**
     * /*创建时间
     */
    private Date createTime;
hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/entity/dto/FlowCardVirtualSlotDTO.java
@@ -15,6 +15,10 @@
     */
    private String flowCardId;
    /**
     * 层号
     */
    private Integer layer;
    /**
     * /*虚拟格子
     */
    private Integer virtualSlot;
hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/mapper/HollowBigStorageCageDetailsMapper.java
@@ -26,5 +26,6 @@
    List<BigStorageSequenceDTO> queryNeedDispatchSlot(FlowCardVirtualSlotDTO flowCardVirtualSlotDTO);
    List<HollowBigStorageCageDetails> queryOutGlassList(@Param("flowCardId") String flowCardId, @Param("cell") int cell);
}
hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/service/HollowBigStorageCageDetailsService.java
@@ -26,5 +26,6 @@
    List<BigStorageSequenceDTO> queryNeedDispatchSlot(FlowCardVirtualSlotDTO flowCardVirtualSlotDTO);
    List<HollowBigStorageCageDetails> queryOutGlassList(String flowCardId, int cell);
}
hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/service/HollowGlassOutRelationInfoService.java
@@ -11,6 +11,6 @@
 */
public interface HollowGlassOutRelationInfoService extends IService<HollowGlassOutRelationInfo> {
    HollowGlassOutRelationInfo receiveTask(String flowCardId, int cell);
    HollowGlassOutRelationInfo receiveTask(String flowCardId, int cell, int totalPairQuantity);
}
hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowBigStorageCageDetailsServiceImpl.java
@@ -43,5 +43,10 @@
    public List<BigStorageSequenceDTO> queryNeedDispatchSlot(FlowCardVirtualSlotDTO flowCardVirtualSlotDTO) {
        return baseMapper.queryNeedDispatchSlot(flowCardVirtualSlotDTO);
    }
    @Override
    public List<HollowBigStorageCageDetails> queryOutGlassList(String flowCardId, int cell) {
        return baseMapper.queryOutGlassList(flowCardId, cell);
    }
}
hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassOutRelationInfoServiceImpl.java
@@ -27,7 +27,7 @@
    GlassInfoService glassInfoService;
    @Override
    public HollowGlassOutRelationInfo receiveTask(String flowCardId, int cell) {
    public HollowGlassOutRelationInfo receiveTask(String flowCardId, int cell, int totalPairQuantity) {
        GlassInfo glassInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>().eq(GlassInfo::getFlowCardId, flowCardId).last("limit 1"));
        HollowGlassOutRelationInfo info = new HollowGlassOutRelationInfo();
        if (null == glassInfo) {
@@ -39,6 +39,7 @@
        info.setTotalLayer(glassInfo.getTotalLayer());
        info.setTotalLayer(glassInfo.getTotalLayer());
        info.setState(Const.HOLLOW_FLOW_CARD_NEW);
        info.setTotalPairQuantity(totalPairQuantity);
        this.save(info);
        return info;
    }
hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollowqueue/controller/HollowGlassQueueInfoController.java
@@ -26,15 +26,8 @@
    @ApiOperation("强制出片")
    @PostMapping("/forceOutGlass")
    public Result<String> forceOutGlass(String flowCardId, int cell) {
        hollowGlassQueueInfoService.forceOutGlass(flowCardId, cell);
        return Result.success("success");
    }
    @ApiOperation("切换线路强制出片")
    @PostMapping("/changeForceOutGlass")
    public Result<String> changeForceOutGlass(String flowCardId, int cell) {
        hollowGlassQueueInfoService.changeForceOutGlass(flowCardId, cell);
    public Result<String> forceOutGlass(String flowCardId, int cell, int totalPairQuantity) {
        hollowGlassQueueInfoService.forceOutGlass(flowCardId, cell, totalPairQuantity);
        return Result.success("success");
    }
hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollowqueue/entity/HollowGlassQueueInfo.java
@@ -2,7 +2,7 @@
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.mes.base.entity.BigStorageCageBaseInfo;
import com.mes.base.entity.HollowBigStorageCageBaseInfo;
import lombok.Data;
import java.util.Date;
@@ -14,7 +14,7 @@
 * @since 2024-11-30 10:19:55
 */
@Data
public class HollowGlassQueueInfo extends BigStorageCageBaseInfo {
public class HollowGlassQueueInfo extends HollowBigStorageCageBaseInfo {
    /**
     * /*大理片笼详情表id
     */
@@ -62,10 +62,6 @@
     * /*总层号
     */
    private Integer totalLayer;
    /**
     * /*层号
     */
    private Integer layer;
    /**
     * /*创建时间
     */
hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollowqueue/service/HollowGlassQueueInfoService.java
@@ -13,9 +13,7 @@
 */
public interface HollowGlassQueueInfoService extends IService<HollowGlassQueueInfo> {
    void forceOutGlass(String flowCardId, int cell);
    void changeForceOutGlass(String flowCardId, int cell);
    void forceOutGlass(String flowCardId, int cell, int totalPairQuantity);
    List<HollowGlassQueueInfo> queryHollowGlassQueueInfo(int cell);
}
hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/hollowqueue/service/impl/HollowGlassQueueInfoServiceImpl.java
@@ -34,19 +34,13 @@
    HollowGlassOutRelationInfoService hollowGlassOutRelationInfoService;
    @Override
    public void forceOutGlass(String flowCardId, int cell) {
        hollowGlassOutRelationInfoService.receiveTask(flowCardId, cell);
    public void forceOutGlass(String flowCardId, int cell, int totalPairQuantity) {
        hollowGlassOutRelationInfoService.receiveTask(flowCardId, cell, totalPairQuantity);
        hollowGlassOutRelationInfoService.update(new LambdaUpdateWrapper<HollowGlassOutRelationInfo>()
                .eq(HollowGlassOutRelationInfo::getFlowCardId, flowCardId)
                .set(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_START)
        );
        List<HollowBigStorageCageDetails> hollowBigStorageCageDetailsList = hollowBigStorageCageDetailsService.list(new LambdaQueryWrapper<HollowBigStorageCageDetails>()
                .eq(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN)
                .eq(HollowBigStorageCageDetails::getFlowCardId, flowCardId)
                .orderByAsc(HollowBigStorageCageDetails::getVirtualSlot)
                .orderBy(Boolean.TRUE, cell != 931, HollowBigStorageCageDetails::getSequence)
                .orderByAsc(HollowBigStorageCageDetails::getHollowSequence)
        );
        List<HollowBigStorageCageDetails> hollowBigStorageCageDetailsList = hollowBigStorageCageDetailsService.queryOutGlassList(flowCardId, cell);
        List<HollowGlassQueueInfo> hollowQueues = hollowBigStorageCageDetailsList.stream().map(queue -> {
            HollowGlassQueueInfo queueInfo = new HollowGlassQueueInfo();
@@ -57,38 +51,6 @@
        }).collect(Collectors.toList());
        this.saveBatch(hollowQueues);
    }
    @Override
    public void changeForceOutGlass(String flowCardId, int cell) {
        hollowGlassOutRelationInfoService.update(new LambdaUpdateWrapper<HollowGlassOutRelationInfo>()
                .eq(HollowGlassOutRelationInfo::getFlowCardId, flowCardId)
                .set(HollowGlassOutRelationInfo::getState, Const.HOLLOW_FLOW_CARD_START)
        );
        //情况历史任务中未做完的玻璃信息
        this.remove(new LambdaQueryWrapper<HollowGlassQueueInfo>()
                .eq(HollowGlassQueueInfo::getFlowCardId, flowCardId)
                .eq(HollowGlassQueueInfo::getCell, cell)
                .eq(HollowGlassQueueInfo::getState, Const.TEMPERING_NEW)
        );
        //按照线路重新去理片笼查询玻璃信息
        List<HollowBigStorageCageDetails> hollowBigStorageCageDetailsList = hollowBigStorageCageDetailsService.list(new LambdaQueryWrapper<HollowBigStorageCageDetails>()
                .eq(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN)
                .eq(HollowBigStorageCageDetails::getFlowCardId, flowCardId)
                .orderByAsc(HollowBigStorageCageDetails::getVirtualSlot)
                .orderBy(Boolean.TRUE, cell != 931, HollowBigStorageCageDetails::getSequence)
                .orderByAsc(HollowBigStorageCageDetails::getHollowSequence)
        );
        List<HollowGlassQueueInfo> hollowQueues = hollowBigStorageCageDetailsList.stream().map(queue -> {
            HollowGlassQueueInfo queueInfo = new HollowGlassQueueInfo();
            BeanUtils.copyProperties(queue, queueInfo);
            queueInfo.setState(Const.TEMPERING_NEW);
            queueInfo.setCell(cell);
            return queueInfo;
        }).collect(Collectors.toList());
        this.saveBatch(hollowQueues);
    }
    @Override
    public List<HollowGlassQueueInfo> queryHollowGlassQueueInfo(int cell) {
        HollowGlassOutRelationInfo one = hollowGlassOutRelationInfoService.getOne(new LambdaUpdateWrapper<HollowGlassOutRelationInfo>()
hangzhoumesParent/moduleService/howllowGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java
@@ -7,7 +7,7 @@
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.kangaroohy.milo.model.ReadWriteEntity;
import com.kangaroohy.milo.service.MiloService;
import com.mes.base.entity.BigStorageCageBaseInfo;
import com.mes.base.entity.HollowBigStorageCageBaseInfo;
import com.mes.bigstoragecagetask.entity.BigStorageCageTask;
import com.mes.bigstoragecagetask.service.BigStorageCageTaskService;
import com.mes.common.config.Const;
@@ -71,6 +71,9 @@
    private HollowGlassQueueInfoService hollowGlassQueueInfoService;
    @Resource
    private HollowGlassOutRelationInfoService hollowGlassOutRelationInfoService;
    private static final String BIG_STORAGE_CAGE_IN_TWO_TASK = "big_storage_cage_in_two_task";
    private static final String BIG_STORAGE_CAGE_OUT_TWO_TASK = "big_storage_cage_out_two_task";
    @Autowired(required = false)
    MiloService miloService;
    @Resource
@@ -87,14 +90,6 @@
    @Value("${mes.outCarMaxSize}")
    private Integer outCarMaxSize;
    @Value("${mes.sequence.order}")
    private boolean sequenceOrder;
    @Value("${mes.temperingOutTargetPosition}")
    private Integer temperingOutTargetPosition;
    @Value("${mes.artificialOutTargetPosition}")
    private Integer artificialOutTargetPosition;
    @Scheduled(fixedDelay = 1000)
    public void inBigStorageTask() throws Exception {
@@ -173,7 +168,7 @@
                    .eq(HollowBigStorageCage::getSlot, bigStorageDTO.getSlot()));
            task.setTargetSlot(bigStorageDTO.getSlot());
            task.setGlassId(info.getGlassId());
            bigStorageCageTaskService.updateTaskMessage("big_storage_cage_in_two_task", task);
            bigStorageCageTaskService.updateTaskMessage(BIG_STORAGE_CAGE_IN_TWO_TASK, task);
            //存放历史任务
            HollowBigStorageCageHistoryTask historyTask = new HollowBigStorageCageHistoryTask();
            BeanUtils.copyProperties(task, historyTask);
@@ -227,7 +222,7 @@
            return;
        }
        //获取出片任务表
        List<BigStorageCageTask> outTaskList = bigStorageCageTaskService.queryTaskMessage("big_storage_cage_out_two_task");
        List<BigStorageCageTask> outTaskList = bigStorageCageTaskService.queryTaskMessage(BIG_STORAGE_CAGE_OUT_TWO_TASK);
        if (CollectionUtil.isNotEmpty(outTaskList)) {
            log.info("有正在执行的出片任务,结束本次出片任务");
            return;
@@ -270,10 +265,12 @@
            List<HollowGlassQueueInfo> unFinishHollowQueueList = hollowGlassQueueInfoService.list(new LambdaQueryWrapper<HollowGlassQueueInfo>()
                    .eq(HollowGlassQueueInfo::getFlowCardId, hollowGlassOutRelationInfo.getFlowCardId())
                    .eq(HollowGlassQueueInfo::getCell, cell)
                    .eq(HollowGlassQueueInfo::getState, Const.TEMPERING_NEW));
                    .eq(HollowGlassQueueInfo::getState, Const.TEMPERING_NEW)
                    .orderByAsc(HollowGlassQueueInfo::getHollowSequence));
            if (CollectionUtil.isNotEmpty(unFinishHollowQueueList)) {
                log.info("有正在出片的中空任务");
                computeOutGlassInfo(unFinishHollowQueueList, "big_storage_cage_out_two_task", hollowGlassOutRelationInfo.getCell(), Const.GLASS_STATE_OUT_ING, Const.BIG_STORAGE_AFTER_OUT);
                Integer isPair = unFinishHollowQueueList.get(0).getIsPair();
                hollowOutGlassByIsPair(unFinishHollowQueueList, hollowGlassOutRelationInfo.getCell(), isPair, hollowGlassOutRelationInfo.getTotalLayer());
                Date endDate = new Date();
                log.info("大理片笼出片任务结束时间:{},共耗时:{}ms,结束扫码任务", endDate, endDate.getTime() - startDate.getTime());
                return;
@@ -297,12 +294,7 @@
                        //玻璃到齐包括已出片的
                        //到齐,将玻璃小片数据存入中空小片表,逻辑生成出片任务  结束
                        for (FlowCardGlassInfoDTO item : flowCardGlassInfoDTO) {
                            List<HollowBigStorageCageDetails> hollowBigStorageCageDetailsList = hollowBigStorageCageDetailsService.list(new LambdaQueryWrapper<HollowBigStorageCageDetails>()
                                    .eq(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN)
                                    .eq(HollowBigStorageCageDetails::getFlowCardId, item.getFlowCardId())
                                    .orderByAsc(HollowBigStorageCageDetails::getHollowSequence)
                                    .orderBy(Boolean.TRUE, cell != 931, HollowBigStorageCageDetails::getLayer)
                            );
                            List<HollowBigStorageCageDetails> hollowBigStorageCageDetailsList = hollowBigStorageCageDetailsService.queryOutGlassList(item.getFlowCardId(), cell);
                            int finalCell = cell;
                            List<HollowGlassQueueInfo> hollowQueues = hollowBigStorageCageDetailsList.stream().map(queue -> {
                                HollowGlassQueueInfo queueInfo = new HollowGlassQueueInfo();
@@ -313,7 +305,8 @@
                            }).collect(Collectors.toList());
                            if (CollectionUtil.isNotEmpty(hollowQueues)) {
                                hollowGlassQueueInfoService.saveBatch(hollowQueues);
                                computeOutGlassInfo(hollowQueues, "big_storage_cage_out_two_task", cell, Const.GLASS_STATE_OUT_ING, Const.BIG_STORAGE_AFTER_OUT);
                                Integer isPair = hollowQueues.get(0).getIsPair();
                                hollowOutGlassByIsPair(hollowQueues, cell, isPair, e.getTotalLayer());
                                //将中空任务状态改为开始
                                hollowGlassOutRelationInfoService.update(new LambdaUpdateWrapper<HollowGlassOutRelationInfo>()
                                        .eq(HollowGlassOutRelationInfo::getFlowCardId, e.getFlowCardId())
@@ -327,19 +320,8 @@
                    }
                }
            }
            //是否有人工下片任务   有直接出
            List<HollowBigStorageCageDetails> artificialList = hollowBigStorageCageDetailsService.list(new LambdaQueryWrapper<HollowBigStorageCageDetails>()
                    .eq(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_ARTIFICIAL)
                    .orderByAsc(HollowBigStorageCageDetails::getSlot)
                    .orderByAsc(HollowBigStorageCageDetails::getId).last("limit " + outCarMaxSize));
            if (CollectionUtil.isNotEmpty(artificialList)) {
                computeOutGlassInfo(artificialList, "big_storage_cage_out_two_task", artificialOutTargetPosition, Const.GLASS_STATE_OUT_ING, Const.BIG_STORAGE_AFTER_OUT);
                Date endDate = new Date();
                log.info("大理片笼出片任务结束时间:{},共耗时:{}ms,结束扫码任务", endDate, endDate.getTime() - startDate.getTime());
                return;
            }
        }
//        redisUtil.setCacheObject("dispatchHollowSwitch",true);
        //是否存在需要内部调度的格子:执行内部调度任务
        if (redisUtil.getCacheObject("dispatchHollowSwitch")) {
            //todo:获取笼内单格已经到齐的玻璃格子信息
@@ -363,7 +345,7 @@
                        int targetSlot = item.getSlot();
                        list = hollowBigStorageCageDetailsService.list(new LambdaQueryWrapper<HollowBigStorageCageDetails>()
                                .eq(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN).eq(HollowBigStorageCageDetails::getSlot, startSlot));
                        computeOutGlassInfo(list, "big_storage_cage_out_two_task", targetSlot, Const.GLASS_STATE_SCHEDULE_ING, Const.BIG_STORAGE_AFTER_DISPATCH);
                        hollowOutGlassByIsPair(list, targetSlot, 0, 0);
                        List<Integer> slotList = new ArrayList<>();
                        slotList.add(targetSlot);
                        updateSlotRemainBySlots(slotList);
@@ -474,7 +456,7 @@
            return;
        }
        //获取进片任务表
        List<BigStorageCageTask> outTaskList = bigStorageCageTaskService.queryTaskMessage("big_storage_cage_out_one_task");
        List<BigStorageCageTask> outTaskList = bigStorageCageTaskService.queryTaskMessage(BIG_STORAGE_CAGE_OUT_TWO_TASK);
        if (CollectionUtil.isEmpty(outTaskList)) {
            log.info("当前大车无进片玻璃,结束完成进片任务");
            return;
@@ -553,7 +535,7 @@
            }
        }
//       重置任务表数据
        bigStorageCageTaskService.updateOutTaskMessage("big_storage_cage_out_one_task");
        bigStorageCageTaskService.updateOutTaskMessage(BIG_STORAGE_CAGE_OUT_TWO_TASK);
        //清空启动状态
        //向opc发送启动信号
        miloService.writeToOpcWord(generateReadWriteEntity("DLP2B.DLP2B.MesReply", 0));
@@ -660,29 +642,59 @@
        log.info("出片任务-无动作执行完成");
    }
    private <T extends HollowBigStorageCageBaseInfo> Boolean hollowOutGlassByIsPair(List<T> list, int targetSlot, int isPair, int totalLayer) {
        List<T> resultList = new ArrayList<>();
        int taskType = Const.BIG_STORAGE_AFTER_OUT;
        int taskState = Const.GLASS_STATE_OUT_ING;
        for (T t : list) {
            if (isPair == (t.getIsPair() == null ? 0 : t.getIsPair())) {
                resultList.add(t);
            }
        }
        if (isPair == 0) {
            taskType = Const.BIG_STORAGE_AFTER_DISPATCH;
            taskState = Const.GLASS_STATE_SCHEDULE_ING;
            totalLayer = 0;
        }
        return computeOutGlassInfo(resultList, BIG_STORAGE_CAGE_OUT_TWO_TASK, targetSlot, taskState, taskType, totalLayer);
    }
    /**
     * 出片一次仅生成一车玻璃
     *
     * @param list
     * @param <T>
     * @param list
     * @param totalLayer
     * @return
     */
    private <T extends BigStorageCageBaseInfo> Boolean computeOutGlassInfo(List<T> list, String tableName, int targetSlot, int state, int taskType) {
    private <T extends HollowBigStorageCageBaseInfo> Boolean computeOutGlassInfo(List<T> list, String tableName, int targetSlot, int state, int taskType, int totalLayer) {
        //任务数据:获取车子存放玻璃最大数量,玻璃间隔
        List<BigStorageCageTask> bigStorageCageTaskList = new ArrayList<>();
        List<BigStorageCageTask> tempList = new ArrayList<>();
        List<T> tempTList = new ArrayList<>();
        //打车剩余尺寸
        Integer remainWidth = carWidth;
        for (T e : list) {
            if (bigStorageCageTaskList.size() >= outCarMaxSize || Math.max((int) e.getWidth(), (int) e.getHeight()) > remainWidth) {
            if (tempList.size() >= outCarMaxSize || Math.max((int) e.getWidth(), (int) e.getHeight()) > remainWidth) {
                break;
            }
            //计算当前出片车剩尺寸
            remainWidth = remainWidth - Math.max((int) e.getWidth(), (int) e.getHeight()) - glassGap;
            bigStorageCageTaskList.add(new BigStorageCageTask(e.getGlassId(), e.getSlot(), targetSlot,
            tempTList.add(e);
            tempList.add(new BigStorageCageTask(e.getGlassId(), e.getSlot(), targetSlot,
                    0));
        }
        Assert.isFalse(CollectionUtil.isEmpty(bigStorageCageTaskList), "未获取出片数据,结束出片任务");
        log.info("获取出片任务数据{}条,执行保存", bigStorageCageTaskList.size());
        Assert.isFalse(CollectionUtil.isEmpty(tempList), "未获取出片数据,结束出片任务");
        log.info("获取出片任务数据{}条,执行保存", tempList.size());
        List<BigStorageCageTask> bigStorageCageTaskList = tempList;
        if (taskType == Const.BIG_STORAGE_AFTER_OUT) {
            if (tempList.size() <= totalLayer) {
                bigStorageCageTaskList = tempList;
            } else {
                int remainCount = tempList.size() % totalLayer;
//                tempList.subList(0,)
            }
        }
        List<String> glassIds = bigStorageCageTaskList.stream().map(BigStorageCageTask::getGlassId).collect(Collectors.toList());
        int glassCount = bigStorageCageTaskList.size();
        //生成出片任务条数不足6补全
@@ -704,7 +716,7 @@
        log.info("将出片玻璃{}玻璃状态改为出片中", glassIds);
        hollowBigStorageCageDetailsService.update(new LambdaUpdateWrapper<HollowBigStorageCageDetails>()
                .set(HollowBigStorageCageDetails::getState, state)
                .set(Const.RAW_GLASS_TASK_TYPE_DISPATCH.equals(taskType), BigStorageCageBaseInfo::getSlot, targetSlot)
                .set(Const.BIG_STORAGE_AFTER_DISPATCH.equals(taskType), HollowBigStorageCageDetails::getSlot, targetSlot)
                .ne(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_OUT)
                .in(HollowBigStorageCageDetails::getGlassId, glassIds));
        try {
@@ -747,4 +759,10 @@
                .value(value)
                .build();
    }
//
//    private List<BigStorageCageTask> computeOutTaskList(List<BigStorageCageTask> taskList, int totalLayer, int target) {
////        if (target == 931){}
//        if (taskList.get(0).get)
//            return null;
//    }
}
hangzhoumesParent/moduleService/howllowGlassModule/src/main/resources/mapper/HollowBigStorageCageDetailsMapper.xml
@@ -14,6 +14,7 @@
    </resultMap>
    <resultMap id="virtualSlotSequenceDTO" type="com.mes.hollow.entity.dto.FlowCardVirtualSlotDTO">
        <result column="flow_card_id" property="flowCardId"/>
        <result column="layer" property="layer"/>
        <result column="virtual_slot" property="virtualSlot"/>
    </resultMap>
    <resultMap id="baseSlotSequenceDTO" type="com.mes.hollow.entity.dto.BigStorageSequenceDTO">
@@ -135,40 +136,88 @@
    <select id="queryIsAllNeedDispatchVirtualSlot" resultMap="virtualSlotSequenceDTO">
        with relation_temp as (
            select flow_card_id, virtual_slot, count(1) as slot_count
            select flow_card_id, layer, virtual_slot, count(1) as slot_count
            from hollow_glass_relation_info
            group by flow_card_id, virtual_slot
            group by flow_card_id, layer, virtual_slot
        ),
             details_temp as (
                 select flow_card_id, virtual_slot, count(1) as slot_count
                 select flow_card_id, layer, virtual_slot, count(1) as slot_count
                 from hollow_big_storage_cage_details
                 where state = 100
                 group by flow_card_id, virtual_slot
                 group by flow_card_id, layer, virtual_slot
             ),
             result_one as (
                 select t.*, t1.slot_count as tslot_count
                 from relation_temp t
                          INNER JOIN details_temp t1 on t.flow_card_id = t1.flow_card_id and
                                                        t.layer = t1.layer and
                                                        t.virtual_slot = t1.virtual_slot
                 where t.slot_count = t1.slot_count
             )
        select flow_card_id, virtual_slot
        select flow_card_id, layer, virtual_slot
        from result_one
        order by flow_card_id, virtual_slot
        order by flow_card_id, layer, virtual_slot
    </select>
    <select id="queryNeedDispatchSlot" resultMap="baseSlotSequenceDTO">
        with glass_id_temp as (
            select glass_id
            from big_storage_glass_relation_info
            where (flow_card_id, virtual_slot) =
                  (#{flowCardId}, #{virtualSlot})
        )
        select slot, max(sequence) as max_sequence, min(sequence) as min_sequence
        from big_storage_cage_details
        where glass_id in (select * from glass_id_temp)
          and state = 100
        from hollow_big_storage_cage_details
        where (flow_card_id, layer, virtual_slot) = (#{flowCardId}, #{layer}, #{virtualSlot})
        group by slot
        order by max_sequence
    </select>
    <select id="queryOutGlassList" resultType="com.mes.hollow.entity.HollowBigStorageCageDetails">
        with flow_card_id_layer as (
        select flow_card_id, max(total_layer) as total_layer
        FROM hollow_big_storage_cage_details
        group by flow_card_id
        ),
        details_sequence_count_temp as (
        SELECT flow_card_id, hollow_sequence, count(1) as max_count
        FROM hollow_big_storage_cage_details
        and state = 100
        group by flow_card_id, hollow_sequence
        ),
        glass_out_temp as (
        select t1.*, case when t.total_layer = t1.max_count then 1 else 0 end is_pair
        from flow_card_id_layer t
        inner join details_sequence_count_temp t1 on t.flow_card_id = t1.flow_card_id
        ),
        result_detail as (
        select t.id,
        t.device_id,
        t.virtual_slot,
        t.slot,
        t.glass_id,
        t.sequence,
        t.flow_card_id,
        t.glass_type,
        t.width,
        t.height,
        t.thickness,
        t.tempering_layout_id,
        t.tempering_feed_sequence,
        t.state,
        t.gap,
        t.engineer_id,
        t.total_layer,
        t.layer,
        t.create_time,
        t.update_time,
        t.hollow_sequence,
        t.films_id,
        t1.is_pair
        from hollow_big_storage_cage_details t
        INNER JOIN glass_out_temp t1
        on t.flow_card_id = t1.flow_card_id and t.hollow_sequence = t1.hollow_sequence
        where t.state = 100
        and t.flow_card_id = #{flowCardId}
        )
        select *
        from result_detail
        order by flow_card_id, hollow_sequence
        <if test="cell != 931">
            desc
        </if>
    </select>
</mapper>