huang
2025-10-09 d4a06fc08b6e6e215bbf1771d204c3b7d773bc29
Merge branch 'master' of http://10.153.19.25:10105/r/YiWuProject
12个文件已修改
250 ■■■■■ 已修改文件
hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/job/OpcCacheGlassNewTask.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/HollowGlassApplication.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/mapper/HollowGlassOutRelationInfoMapper.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/mapper/HollowGlassRelationInfoMapper.java 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/HollowGlassOutRelationInfoService.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/HollowGlassRelationInfoService.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassOutRelationInfoServiceImpl.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassRelationInfoServiceImpl.java 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java 13 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/mapper/HollowBigStorageCageDetailsMapper.xml 121 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/mapper/HollowGlassOutRelationInfoMapper.xml 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/mapper/HollowGlassRelationInfoMapper.xml 32 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/job/OpcCacheGlassNewTask.java
@@ -138,10 +138,11 @@
        log.info("二线卧理: {}", s7DataWLTwo);
        Boolean oneInkageEntity = s7DataWLOne.getDeviceState();
        int cellFlag = 1;
        if (!oneInkageEntity  && !Const.OUT_DISABLE.equals(s7DataWLExtraTwo.getD06SlotState())) {
        if (!oneInkageEntity && !Const.OUT_DISABLE.equals(s7DataWLExtraTwo.getD06SlotState())) {
            cellFlag = 2;
        }
        startOneOpcTaskChild(s7DataWLTwo, 2, cellFlag);
    }
    private void startOneOpcTaskChild(S7DataWL task, int device, int cellFlag) throws Exception {
@@ -352,7 +353,7 @@
        //状态有3中情况:0空闲 1忙碌 2禁用
        //两条线都为禁用则不出玻璃
        if (Const.OUT_DISABLE.equals(oneOutState) && Const.OUT_DISABLE.equals(twoOutState)) {
            log.info("A09、A10为{},{}非自动状态,无法出片", oneOutState, oneOutState);
            log.info("设备{}:A09、A10为{},{}非自动状态,无法出片", deviceId, oneOutState, oneOutState);
            return Boolean.FALSE;
        }
        //获取d06片台状态
@@ -382,6 +383,7 @@
                cell = Const.TWO_OUT_TARGET_POSITION;
            }
        }
        log.info("{}线路计算完成:{}", deviceId, cell);
        if (cellFlag == 2) {
            if (!outChildTask(task, deviceId, cell, startDate)) {
                cell = cell == Const.ONE_OUT_TARGET_POSITION ? Const.TWO_OUT_TARGET_POSITION : Const.ONE_OUT_TARGET_POSITION;
@@ -398,6 +400,7 @@
        //笼内是版图相差是否超过阈值
        boolean flag = queryMaxMinDiffByDevice(threshold, deviceId);
        log.info("{}阈值计算完成:{}", deviceId, flag);
        if (flag) {
            //先找最小版图版序的玻璃小片
            EdgStorageCageDetails minEdgDetails = edgStorageCageDetailsService.getOne(new LambdaQueryWrapper<EdgStorageCageDetails>()
@@ -421,15 +424,18 @@
                );
            }
        }
        log.info("{}按照阈值查找结果:{}", deviceId, edgStorageCageDetails);
        if (null == edgStorageCageDetails) {
//        获取历史表中上次任务最后一片尺寸
            EdgStorageDeviceTaskHistory edgeData = edgStorageDeviceTaskHistoryService.getOne(new LambdaQueryWrapper<EdgStorageDeviceTaskHistory>()
                    .eq(EdgStorageDeviceTaskHistory::getDeviceId, cell)
                    .in(EdgStorageDeviceTaskHistory::getTaskType, Const.GLASS_CACHE_TYPE_OUT, Const.GLASS_CACHE_TYPE_THROUGH)
                    .orderByDesc(EdgStorageDeviceTaskHistory::getId).last("limit 1"));
            log.info("{}获取上次任务信息:{}", deviceId, edgeData);
            if (null != edgeData) {
                GlassInfo glassOutInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>().eq(GlassInfo::getGlassId, edgeData.getGlassIdOut()));
                //笼内的玻璃的尺寸是否和上一次任务一致
                edgStorageCageDetails = edgStorageCageDetailsService.queryEdgStorageDetailsBySize(deviceId, task.getCurrentCell(), glassOutInfo.getWidth(), glassOutInfo.getHeight(), cell, maxThickness);
                if (null == edgStorageCageDetails && StringUtils.isNotBlank(task.getGlassIdIn())) {
                    GlassInfo glassInInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>()
@@ -445,11 +451,13 @@
                }
            }
        }
        log.info("{}获取历史表中上次任务最后一片尺寸:{}", deviceId, edgStorageCageDetails);
        //前面已经尺寸问题处理完毕,开始计算无相同尺寸的新玻璃小片
        if (null == edgStorageCageDetails) {
            edgStorageCageDetails = edgStorageCageDetailsService.queryEdgStorageDetailsByLimitSize(deviceId, Integer.parseInt(task.getCurrentCell().toString()), 0, 0,
                    cell, minOneFirstLength, minOneSecondLength, maxTwoFirstLength, maxTwoSecondLength, maxThickness);
        }
        log.info("{}开始计算无相同尺寸的新玻璃小片:{}", deviceId, edgStorageCageDetails);
        if (edgStorageCageDetails == null && StringUtils.isNotBlank(task.getGlassIdIn())) {
            //和上次任务不存在相同尺寸
            GlassInfo glassInInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>().eq(GlassInfo::getGlassId, task.getGlassIdIn()));
@@ -466,6 +474,7 @@
                log.info("直通任务目标线路为{},进片玻璃尺寸为{}*{},不符合出片条件", cell, maxLength, minLength);
            }
        }
        log.info("{}直通任务:{}", deviceId, edgStorageCageDetails);
        if (edgStorageCageDetails == null) {
            //和上次任务不存在相同尺寸
            log.info("笼内没有玻璃了");
@@ -477,7 +486,7 @@
            if (3 != task.getTaskState()) {
                return Boolean.FALSE;
            }
            log.info("5、直通任务,将玻璃信息插入卧式理片笼,当前玻璃信息:{}", edgStorageCageDetails);
            log.info("5、{}直通任务,将玻璃信息插入卧式理片笼,当前玻璃信息:{}", edgStorageCageDetails);
            if (glassInIdOne.equals(task.getGlassIdIn()) || glassInIdTwo.equals(task.getGlassIdIn())) {
                log.info("玻璃id与上次相同,禁止进片");
                return Boolean.FALSE;
@@ -491,11 +500,7 @@
                GlassInfo one = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>().eq(GlassInfo::getGlassId, glassId));
                BeanUtils.copyProperties(one, edgStorageCageDetails);
            }
            EdgStorageCage storageCage = edgStorageCageService.getOne(new LambdaQueryWrapper<EdgStorageCage>()
                    .eq(EdgStorageCage::getDeviceId, deviceId)
                    .eq(EdgStorageCage::getEnableState, Const.SLOT_ON)
                    .ge(EdgStorageCage::getRemainWidth, cellLength)
                    .last("order by abs(slot - " + task.getCurrentCell() + ") limit 1"));
            EdgStorageCage storageCage = edgStorageCageService.selectNearestEmpty(Integer.parseInt(task.getCurrentCell().toString()), deviceId, Boolean.TRUE);
            Assert.isTrue(null != storageCage, "格子已满,无法执行直通任务");
            log.info("3、查询卧式理片笼里面的空格:{}", storageCage);
            edgStorageCageDetails.setSlot(storageCage.getSlot());
hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/HollowGlassApplication.java
@@ -4,6 +4,7 @@
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.scheduling.annotation.EnableScheduling;
import springfox.documentation.swagger2.annotations.EnableSwagger2WebMvc;
@@ -19,6 +20,7 @@
@EnableDiscoveryClient
@MapperScan(basePackages = "com.mes.*.mapper")
@EnableScheduling
@EnableCaching
public class HollowGlassApplication {
    public static void main(String[] args) {
hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/mapper/HollowGlassOutRelationInfoMapper.java
@@ -3,6 +3,7 @@
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mes.hollow.entity.HollowGlassOutRelationInfo;
import com.mes.hollow.entity.dto.OrderDTO;
import com.mes.hollow.entity.dto.OrderDetailsDTO;
import com.mes.largenscreen.entity.PieChartVO;
import org.apache.ibatis.annotations.Param;
@@ -19,5 +20,13 @@
    OrderDTO queryOrderByFlowCardId(@Param("flowCardId") String flowCardId);
    List<PieChartVO> queryPieChart();
    /**
     * 按照流程卡获取产品名称
     *
     * @param flowCardId
     * @return
     */
    OrderDetailsDTO queryProductNameByFlowCardId(String flowCardId);
}
hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/mapper/HollowGlassRelationInfoMapper.java
@@ -6,6 +6,7 @@
import com.mes.hollow.entity.dto.LackDetailsDTO;
import com.mes.hollow.entity.dto.OrderDetailsDTO;
import org.apache.ibatis.annotations.Param;
import org.springframework.cache.annotation.Cacheable;
import java.util.List;
@@ -29,12 +30,6 @@
    void clearDirtyFlowCardData(@Param("flowCardId") String flowCardId, @Param("layer") int layer);
    /**
     * 按照流程卡获取产品名称
     *
     * @param flowCardId
     * @return
     */
    OrderDetailsDTO queryProductNameByFlowCardId(@Param("flowCardId") String flowCardId,@Param("productName") String productName,@Param("customerName") String customerName);
}
hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/HollowGlassOutRelationInfoService.java
@@ -3,6 +3,7 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mes.hollow.entity.HollowGlassOutRelationInfo;
import com.mes.hollow.entity.dto.OrderDetailsDTO;
import com.mes.hollow.entity.request.HollowHistoryTaskRequest;
import com.mes.hollow.entity.request.HollowTaskRequest;
import com.mes.hollowqueue.entity.HollowGlassQueueInfo;
@@ -30,7 +31,7 @@
    List<String> hollowTaskList(int cell);
    Map<String, List<HollowGlassQueueInfo>> appointHollowTaskDetails( int cell);
    Map<String, List<HollowGlassQueueInfo>> appointHollowTaskDetails(int cell);
    Boolean startTask(int cell);
@@ -45,5 +46,7 @@
    Page<HollowGlassOutRelationInfo> queryHollowHistoryTask(HollowHistoryTaskRequest request);
    List<PieChartVO> queryPieChart();
    OrderDetailsDTO queryProductNameByFlowCardId(String flowCardId);
}
hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/HollowGlassRelationInfoService.java
@@ -6,6 +6,7 @@
import com.mes.hollow.entity.dto.FlowCardGlassInfoDTO;
import com.mes.hollow.entity.dto.HollowBigStorageDTO;
import com.mes.hollow.entity.dto.LackDetailsDTO;
import com.mes.hollow.entity.dto.OrderDetailsDTO;
import com.mes.hollow.entity.vo.HollowAllFlowCardVO;
import com.mes.hollow.entity.vo.HollowBigStorageDetailsQueryVO;
@@ -50,5 +51,7 @@
    Integer getGlassGapByThickness(Double thickness);
    Boolean hollowBigStorageGlassDamage(DamageRequest request);
    OrderDetailsDTO queryProductNameByFlowCardId(String flowCardId, String productName, String customerName);
}
hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassOutRelationInfoServiceImpl.java
@@ -35,6 +35,7 @@
import freemarker.template.Version;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -342,6 +343,12 @@
        return this.page(page, wrapper);
    }
    @Override
    @Cacheable(value = "orderDetails", key = "#flowCardId")
    public OrderDetailsDTO queryProductNameByFlowCardId(String flowCardId) {
        log.info("查询数据库一次:{}", flowCardId);
        return baseMapper.queryProductNameByFlowCardId(flowCardId);
    }
    private HollowGlassOutRelationInfo childrenTask(HollowTaskRequest request, int isForce) {
        GlassInfo glassInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>().eq(GlassInfo::getFlowCardId, request.getFlowCardId()).last("limit 1"));
hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassRelationInfoServiceImpl.java
@@ -26,6 +26,7 @@
import com.mes.sysconfig.service.SysConfigService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@@ -104,7 +105,9 @@
                    .last("limit 1")
            );
        }
        Assert.isTrue(null != relationInfoOne, "相关流程卡未找到对应的组号信息,玻璃流程卡:{},序号:{},总层数:{},层数:{}", flowCardId, glassType, totalLayer, layer);
        if (null == relationInfoOne) {
            throw new RuntimeException("相关流程卡未找到对应的组号信息,玻璃流程卡:" + flowCardId + ",序号:" + glassType + ",总层数:" + totalLayer + ",层数:" + layer);
        }
        Integer slotWidth = sysConfigService.queryConfigValue(ConstSysConfig.HOLLOW_SLOT_WIDTH);
        //详情表内获取本组是否已经有玻璃在笼子内(0表示提前占用)
        int taskCount = hollowGlassOutRelationInfoService.count(new LambdaQueryWrapper<HollowGlassOutRelationInfo>()
@@ -324,7 +327,7 @@
            HollowAllFlowCardVO hollowAllFlowCardVO = new HollowAllFlowCardVO();
            HollowBigStorageCageDetails cageDetails = v.get(0);
            //按照流程卡获取对应的产品名称
            OrderDetailsDTO orderDetails = baseMapper.queryProductNameByFlowCardId(cageDetails.getFlowCardId(), query.getProductName(), query.getCustomerName());
            OrderDetailsDTO orderDetails = this.queryProductNameByFlowCardId(cageDetails.getFlowCardId(), query.getProductName(), query.getCustomerName());
            if (null != orderDetails) {
                BeanUtils.copyProperties(orderDetails, hollowAllFlowCardVO);
                hollowAllFlowCardVO.setFlowCardId(e);
@@ -438,6 +441,16 @@
        return Boolean.TRUE;
    }
    @Override
    public OrderDetailsDTO queryProductNameByFlowCardId(String flowCardId, String productName, String customerName) {
        OrderDetailsDTO dto = hollowGlassOutRelationInfoService.queryProductNameByFlowCardId(flowCardId);
        if ((StringUtils.isBlank(productName) || dto.getProductName().contains(productName)) && (StringUtils.isBlank(customerName) || dto.getCustomerName().contains(customerName))) {
            return dto;
        }
        return null;
    }
    private void sortFlowCardIdList(List<HollowAllFlowCardVO> list) {
        Pattern pattern = Pattern.compile("^NG(\\d+)([A-Za-z]+)(\\d+)$");
hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/job/OpcPlcStorageCageHollowTask.java
@@ -1041,10 +1041,19 @@
                    }
                    baseInfoList = resultList;
                } else {
                    //大于总层数先取totalLyaer倍数数量的玻璃,保证大车上的玻璃成对传
                    //大于总层数先取totalLayer倍数数量的玻璃,保证大车上的玻璃成对传
                    int remainCount = templist.size() % totalLayer;
                    if (targetSlot == 930) {
                        baseInfoList = templist.subList(0, totalLayer);
                        int tempSequence = templist.get(0).getHollowSequence();
                        List<T> resultList = new ArrayList<>();
                        for (int i = 0; i < templist.size(); i++) {
                            if (tempSequence == list.get(i).getHollowSequence()) {
                                resultList.add(templist.get(i));
                            } else {
                                break;
                            }
                        }
                        baseInfoList = resultList;
                    } else {
                        baseInfoList = templist.subList(0, templist.size() - remainCount);
                    }
hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/mapper/HollowBigStorageCageDetailsMapper.xml
@@ -50,77 +50,72 @@
    </update>
    <select id="hollowIsAll" resultMap="baseMap">
        WITH sum_flow_layer_count AS ( SELECT flow_card_id, layer, min( films_id ) AS films_id, min(thickness) as
        thickness,count(*) AS sum_count FROM hollow_glass_relation_info GROUP BY flow_card_id, layer ),
        real_flow_layer_count AS ( SELECT flow_card_id, layer, count(*) AS real_count, count(distinct slot) as
        slot_count FROM
        hollow_big_storage_cage_details t WHERE state = 100 GROUP BY flow_card_id, layer ),
        damage_flow_layer_count AS ( SELECT process_id AS flow_card_id, technology_number AS layer, count(*) as
        damage_count FROM damage where type in(8,9) GROUP BY process_id, technology_number ),
        lack_flow_layer_count AS (
        WITH flow_layer_stats AS (
        SELECT
        t.flow_card_id,
        t.layer,
        ifnull((sum_count - real_count - ifnull(damage_count,0)),0) AS lack_count
        FROM
        sum_flow_layer_count t
        left JOIN real_flow_layer_count t1 ON t.flow_card_id = t1.flow_card_id
        AND t.layer = t1.layer
        left JOIN damage_flow_layer_count t2 ON t1.flow_card_id = t2.flow_card_id
        AND t1.layer = t2.layer
        h.flow_card_id,
        h.layer,
        MIN(r.films_id) AS films_id,
        MIN(r.thickness) AS thickness,
        COUNT(*) AS sum_count,
        COUNT(DISTINCT h.slot) AS slot_count,
        SUM(CASE WHEN h.state = 100 THEN 1 ELSE 0 END) AS real_count
        FROM hollow_glass_relation_info r
        LEFT JOIN hollow_big_storage_cage_details h
        ON r.flow_card_id = h.flow_card_id AND r.layer = h.layer
        WHERE r.flow_card_id = #{flowCardId}
        GROUP BY h.flow_card_id, h.layer
        ),
        layer_one AS ( SELECT * FROM hollow_big_storage_cage_details WHERE layer = 1 AND state = 100 ),
        layer_two AS ( SELECT * FROM hollow_big_storage_cage_details WHERE layer = 2 AND state = 100),
        layer_three AS ( SELECT * FROM hollow_big_storage_cage_details WHERE layer = 3 AND state = 100 )
        ,
        pair_flow_layer_count AS (
        damage_stats AS (
        SELECT
        t.flow_card_id,
        count(*) AS pair_count
        FROM
        layer_one t
        INNER JOIN layer_two t1 ON t.flow_card_id = t1.flow_card_id
        AND t.virtual_slot = t1.virtual_slot
        AND t.sequence = t1.sequence
        process_id AS flow_card_id,
        technology_number AS layer,
        COUNT(*) AS damage_count
        FROM damage
        WHERE type IN (8,9) AND process_id = #{flowCardId}
        GROUP BY process_id, technology_number
        ),
        pair_stats AS (
        SELECT
        t1.flow_card_id,
        COUNT(*) AS pair_count
        FROM hollow_big_storage_cage_details t1
        INNER JOIN hollow_big_storage_cage_details t2
        ON t1.flow_card_id = t2.flow_card_id
        AND t1.virtual_slot = t2.virtual_slot
        AND t1.sequence = t2.sequence
        AND t1.layer = 1 AND t2.layer = 2
        AND t1.state = 100 AND t2.state = 100
        <if test="totalLayer == 3">
            inner join layer_three t2
            on t.flow_card_id = t2.flow_card_id and
            t.virtual_slot = t2.virtual_slot and t.sequence = t2.sequence
            INNER JOIN hollow_big_storage_cage_details t3
            ON t1.flow_card_id = t3.flow_card_id
            AND t1.virtual_slot = t3.virtual_slot
            AND t1.sequence = t3.sequence
            AND t3.layer = 3 AND t3.state = 100
        </if>
        GROUP BY
        t.flow_card_id
        ),
        result_flow_layer_count AS (
        WHERE t1.flow_card_id = #{flowCardId}
        GROUP BY t1.flow_card_id
        )
        SELECT
        t.flow_card_id,
        t.layer,
        t.films_id,
        t.thickness,
        sum_count,
        IFNULL( t3.pair_count, 0 ) AS pair_count,
        IFNULL( real_count, 0 ) AS real_count,
        IFNULL( damage_count, 0 ) AS damage_count,
        IFNULL( lack_count, 0 ) AS lack_count,
        IFNULL(slot_count,0) AS slot_count
        FROM
        sum_flow_layer_count t
        LEFT JOIN real_flow_layer_count t1 ON t.flow_card_id = t1.flow_card_id
        AND t.layer = t1.layer
        LEFT JOIN lack_flow_layer_count t2 ON t.flow_card_id = t2.flow_card_id
        AND t.layer = t2.layer
        LEFT JOIN pair_flow_layer_count t3 ON t.flow_card_id = t3.flow_card_id
        LEFT JOIN damage_flow_layer_count t4 ON t.flow_card_id = t4.flow_card_id
        AND t.layer = t4.layer
        ) SELECT
        *
        FROM
        result_flow_layer_count
        WHERE
        flow_card_id = #{flowCardId}
        f.flow_card_id,
        f.layer,
        f.films_id,
        f.thickness,
        f.sum_count,
        COALESCE(p.pair_count, 0) AS pair_count,
        COALESCE(f.real_count, 0) AS real_count,
        COALESCE(d.damage_count, 0) AS damage_count,
        (f.sum_count - COALESCE(f.real_count, 0) - COALESCE(d.damage_count, 0)) AS lack_count,
        f.slot_count
        FROM flow_layer_stats f
        LEFT JOIN damage_stats d
        ON f.flow_card_id = d.flow_card_id AND f.layer = d.layer
        LEFT JOIN pair_stats p
        ON f.flow_card_id = p.flow_card_id
        WHERE 1=1
        <if test="flag == true">
            and sum_count = pair_count
            AND f.sum_count = COALESCE(p.pair_count, 0)
        </if>
        order by layer
        ORDER BY f.layer;
    </select>
    <select id="queryIsAllNeedDispatchVirtualSlot" resultMap="virtualSlotSequenceDTO">
hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/mapper/HollowGlassOutRelationInfoMapper.xml
@@ -39,4 +39,15 @@
            date( hgori.create_time ) = date(
            now())
    </select>
    <select id="queryProductNameByFlowCardId" resultType="com.mes.hollow.entity.dto.OrderDetailsDTO">
        select t.product_name, t1.customer_name
        from sd.order_detail t
                 inner join sd.order t1 on t.order_id = t1.order_id
        where (t.order_id, t.order_number) = (
            select min(order_id) as order_id, min(order_number) as order_number
            from pp.flow_card
            where process_id = #{flowCardId}
        )
        limit 1
    </select>
</mapper>
hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/mapper/HollowGlassRelationInfoMapper.xml
@@ -164,36 +164,16 @@
        from hollow_glass_relation_info
        where flow_card_id = #{flowCardId}
    </select>
    <select id="queryProductNameByFlowCardId" resultType="com.mes.hollow.entity.dto.OrderDetailsDTO">
        select t.product_name, t1.customer_name
        from sd.order_detail t
        inner join sd.order t1 on t.order_id = t1.order_id
        where (t.order_id, t.order_number) = (
        select min(order_id) as order_id, min(order_number) as order_number
        from pp.flow_card
        where process_id = #{flowCardId}
        <if test="productName != null and productName != ''">
            and t.product_name like concat('%', #{productName}, '%')
        </if>
        <if test="customerName != null and customerName != ''">
            and t1.customer_name like concat('%', #{customerName}, '%')
        </if>
        )
        limit 1
    </select>
    <update id="clearDirtyFlowCardData">
        update hollow_glass_relation_info
        set glass_id                = null,
            tempering_layout_id     = null,
            tempering_feed_sequence = null,
            engineer_id             = null,
            state                   = 0
        update tempering_glass_relation_info
        set shelf_order = null
          , state       = 0
        where flow_card_id = #{flowCardId}
          and layer = #{layer}
          and glass_id not in (
            select glass_id
            from hollow_big_storage_cage_details
          and shelf_order not in (
            select shelf_order
            from vertical_sheet_cage_details
            where flow_card_id = #{flowCardId}
              and layer = #{layer}
              and state in (100, 102, 103, 104)