ZengTao
2025-11-11 aa5d2f68e1d97f7a1b20fa15e1bde9195544bb3e
1、钢化查询添加显示工程名称
2、中空任务界面缺片详情修改
18个文件已修改
297 ■■■■ 已修改文件
UI-Project/src/views/Slicecage/slicecage.vue 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/views/hollow/hollowequipment.vue 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/common/servicebase/src/main/java/com/mes/damage/mapper/DamageMapper.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/common/servicebase/src/main/java/com/mes/damage/service/DamageService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/common/servicebase/src/main/java/com/mes/damage/service/impl/DamageServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/common/servicebase/src/main/java/com/mes/order/mapper/OrdersMapper.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/common/servicebase/src/main/java/com/mes/order/service/OrdersService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/common/servicebase/src/main/java/com/mes/order/service/impl/OrdersServiceImpl.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/common/servicebase/src/main/resources/mapper/OrderMapper.xml 28 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/job/OpcCacheGlassNewTask.java 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/entity/dto/TemperingGlassCountDTO.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/mapper/BigStorageCageDetailsMapper.xml 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/controller/HollowGlassRelationInfoController.java 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/entity/dto/LackDetailsDTO.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/mapper/HollowGlassRelationInfoMapper.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/HollowGlassRelationInfoService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassRelationInfoServiceImpl.java 84 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/mapper/HollowGlassRelationInfoMapper.xml 88 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
UI-Project/src/views/Slicecage/slicecage.vue
@@ -1530,8 +1530,25 @@
    <el-button type="primary" style="margin-left: 10px;margin-bottom: 10px;" @click="fetchxianga">
      {{$t('reportmanage.inquire')}}</el-button>
  </div>
    <el-table ref="table" style="margin-top: 20px;height: 700px;width: 1770px;" :data="tableDataa" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}">
          <el-table-column prop="deviceId" align="center" :label="$t('searchOrder.cagenumber')" min-width="100" />
<el-table
  ref="table"
  style="margin-top: 20px; height: 700px; width: 1770px; overflow-y: auto;"
  :data="tableDataa"
  :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}"
  virtual-scroll
  :virtual-scroll-item-size="50"
  :virtual-scroll-offset="100"
  :row-height="50"
   :border="false"
  :lazy="true"
  :cell-style="{padding: '8px 0'}"
  :show-header-overflow="false"
  :show-overflow="false"
  :stripe="false"
  :selectable="false"
  :tooltip-effect="null"
>
  <el-table-column prop="deviceId" align="center" :label="$t('searchOrder.cagenumber')" min-width="100" />
          <el-table-column prop="engineerId" align="center" :label="$t('searchOrder.projectnumber')" min-width="100" />
          <el-table-column prop="layer" align="center" :label="$t('processCard.layer')" min-width="50" />
          <el-table-column prop="slot" align="center" :label="$t('searchOrder.gridnumber')" min-width="150" />
@@ -1642,6 +1659,7 @@
    <el-table  ref="table" style="margin-top: 20px;height: 500px;"
        :data="tableDatagh" :header-cell-style="{background:'#F2F3F5 ',color:'#1D2129'}">
          <el-table-column prop="engineerId" fixed align="center" :label="$t('searchOrder.projectnumber')" min-width="150"/>
          <el-table-column prop="engineerName" fixed align="center" :label="$t('large.productname')" min-width="150"/>
          <el-table-column prop="thickness" align="center" :label="$t('basicData.thickness')" min-width="150" />
          <el-table-column prop="filmsId" align="center" :label="$t('basicData.coatingtypes')" min-width="150" />
          <el-table-column prop="temperingLayoutId" align="center" :label="$t('searchOrder.layoutnumber')" min-width="120" />
UI-Project/src/views/hollow/hollowequipment.vue
@@ -780,7 +780,7 @@
      <el-table-column prop="workingProcedure" align="center" :label="$t('reportmanage.process')" min-width="80" />
      <el-table-column fixed="right" :label="$t('searchOrder.operate')" align="center">
            <template #default="scope">
              <el-button type="text" plain  @click="handleBroke(scope.row)">{{ $t('order.dilapidation') }}</el-button>
              <el-button type="text" plain :disabled="scope.row.glassId==null"  @click="handleBroke(scope.row)">{{ $t('order.dilapidation') }}{{  }}</el-button>
            </template>
      </el-table-column>
      <div style="float: right;margin-bottom: 5px;">
hangzhoumesParent/common/servicebase/src/main/java/com/mes/damage/mapper/DamageMapper.java
@@ -3,6 +3,9 @@
import com.baomidou.dynamic.datasource.annotation.DS;
import com.github.yulichang.base.MPJBaseMapper;
import com.mes.damage.entity.Damage;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
 * <p>
@@ -15,4 +18,5 @@
@DS("northGlassMes")
public interface DamageMapper extends MPJBaseMapper<Damage> {
    List<Damage> queryUnTempByFlowCardId(@Param("flowCardId") String flowCardId);
}
hangzhoumesParent/common/servicebase/src/main/java/com/mes/damage/service/DamageService.java
@@ -68,4 +68,6 @@
    void deleteByGlassId(String glassId);
    Boolean sendToERP(ReportingWork reportingWork, List<ReportingWorkDetail> reportingWorkDetails, Boolean type);
    List<Damage> queryUnTempByFlowCardId(String flowCardId);
}
hangzhoumesParent/common/servicebase/src/main/java/com/mes/damage/service/impl/DamageServiceImpl.java
@@ -430,4 +430,9 @@
            return false;
        }
    }
    @Override
    public List<Damage> queryUnTempByFlowCardId(String flowCardId){
        return baseMapper.queryUnTempByFlowCardId(flowCardId);
    }
}
hangzhoumesParent/common/servicebase/src/main/java/com/mes/order/mapper/OrdersMapper.java
@@ -1,9 +1,6 @@
package com.mes.order.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mes.order.entity.HollowGlassDetailsDTO;
import com.mes.order.entity.HollowOrderDTO;
import com.mes.order.entity.OrderDetailsDTO;
import com.mes.order.entity.Orders;
import com.mes.order.entity.*;
import com.mes.order.entity.dto.OrderDTO;
import java.util.List;
@@ -27,4 +24,6 @@
    List<HollowGlassDetailsDTO> queryFlowCardIdLayerGlassInfo(String flowCardId, int totalLayer, int layer);
    OrderDetailsDTO queryProductNameByFlowCardId(String flowCardId);
    List<ProcessCardReport> queryLackByERP(String flowCardId);
}
hangzhoumesParent/common/servicebase/src/main/java/com/mes/order/service/OrdersService.java
@@ -29,4 +29,6 @@
    List<HollowGlassDetailsDTO> queryFlowCardIdLayerGlassInfo(String flowCardId, int totalLayer, int layer);
    OrderDetailsDTO queryProductNameByFlowCardId(String flowCardId);
    List<ProcessCardReport> queryLackByERP(String flowCardId);
}
hangzhoumesParent/common/servicebase/src/main/java/com/mes/order/service/impl/OrdersServiceImpl.java
@@ -68,9 +68,14 @@
    }
    @Override
    @Cacheable(value = "orderDetails", key = "#flowCardId",unless = "#result == null")
    @Cacheable(value = "orderDetails", key = "#flowCardId", unless = "#result == null")
    public OrderDetailsDTO queryProductNameByFlowCardId(String flowCardId) {
        log.info("查询数据库一次:{}", flowCardId);
        return baseMapper.queryProductNameByFlowCardId(flowCardId);
    }
    @Override
    public List<ProcessCardReport> queryLackByERP(String flowCardId) {
        return baseMapper.queryLackByERP(flowCardId);
    }
}
hangzhoumesParent/common/servicebase/src/main/resources/mapper/OrderMapper.xml
@@ -25,8 +25,7 @@
               a.area,
               a.quantity,
               a.create_time,
               round(ifnull(d.finishNum, 0) / a.quantity * 100) as 'percent',
                ifnull(d.finishNum, 0)
               round(ifnull(d.finishNum, 0) / a.quantity * 100) as 'percent', ifnull(d.finishNum, 0)
        from sd.`order` as a
                 LEFT JOIN (
            SELECT sum(c.reporting_work_num) as 'finishNum',order_id
@@ -38,16 +37,15 @@
        ) as d
                           on a.order_id = d.order_id
        where a.warehousing != 2 and a.warehousing >= 0
        ORDER BY  a.order_id desc
        ORDER BY a.order_id desc
    </select>
    <select id="queryOrderByFlowCardId" resultType="com.mes.order.entity.HollowOrderDTO">
        select t1.*
        from pp.flow_card t
                 inner join sd.order t1 on t.order_id = t1.order_id
        where t.process_id = #{flowCardId}
            limit 1
        where t.process_id = #{flowCardId} limit 1
    </select>
    <select id="queryFlowCardIdMaxLayerGlassInfo"  resultMap="baseMapHollowDetail">
    <select id="queryFlowCardIdMaxLayerGlassInfo" resultMap="baseMapHollowDetail">
        with temp_flow as (SELECT t.process_id,
                                  t.order_id,
                                  t.order_number,
@@ -137,7 +135,21 @@
            select min(order_id) as order_id, min(order_number) as order_number
            from pp.flow_card
            where process_id = #{flowCardId}
        )
            limit 1
        ) limit 1
    </select>
    <select id="queryLackByERP" resultType="com.mes.order.entity.ProcessCardReport">
        select a.*,
               (b.quantity - b.termination_quantity) as 'quantity',
                (b.quantity - b.termination_quantity - reporting_work_num) as 'lack_quantity'
        from order_process_detail as a
                 inner join pp.flow_card as b
                            on a.order_id = b.order_id
                                and a.process_id = b.process_id
                                and a.order_number = b.order_number
                                and a.technology_number = b.technology_number
        where termination_status = 0
          and a.process_id = #{flowCardId}
          and a.process = "中空"
          and (b.quantity - b.termination_quantity) > reporting_work_num
    </select>
</mapper>
hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/job/OpcCacheGlassNewTask.java
@@ -122,6 +122,7 @@
    private static final String ALARM_TYPE1 = "一线卧式理片笼";
    private static final String ALARM_TYPE2 = "二线卧式理片笼";
    private static final String ALARM_CODE_NOGLASS = "noGlass";
    private static final String ALARM_CODE_ID = "idSame";
    @Scheduled(fixedDelay = 1000)
    public void startOneOpcTask() throws Exception {
@@ -323,6 +324,17 @@
        }
        if (glassInIdOne.equals(task.getGlassIdIn()) || glassInIdTwo.equals(task.getGlassIdIn())) {
            log.info("玻璃id与上次相同,禁止进片");
            ProductAlarmInfo alarmInfo = new ProductAlarmInfo();
            alarmInfo.setState(Const.LOAD_RAW_GLASS_NEW);
            alarmInfo.setAlarmModule(ALARM_MODULE);
            if (deviceId == 1) {
                alarmInfo.setAlarmType(ALARM_TYPE1);
            } else {
                alarmInfo.setAlarmType(ALARM_TYPE2);
            }
            alarmInfo.setAlarmCode(ALARM_CODE_ID);
            alarmInfo.setAlarmMessage(task.getGlassIdIn());
            productAlarmInfoService.save(alarmInfo);
            Date endDate = new Date();
            log.info("结束进片任务设备为{},结束时间为:{},共耗时:{}ms", deviceId, endDate, endDate.getTime() - startDate.getTime());
            return Boolean.FALSE;
@@ -380,9 +392,9 @@
    private boolean outTask(S7DataWL task, int deviceId, int cellFlag) {
        Date startDate = new Date();
        GlassInfo glassInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>().eq(GlassInfo::getGlassId, task.getGlassIdOut()));
        GlassInfo glassInfo = glassInfoService.getOne(new LambdaQueryWrapper<GlassInfo>().eq(GlassInfo::getGlassId, task.getGlassIdIn()));
        if (null == glassInfo && StringUtils.isNotBlank(task.getGlassIdIn())) {
            log.info("进片玻璃信息不存在,玻璃id:{}", task.getGlassIdIn());
            log.info("直通玻璃信息不存在,玻璃id:{}", task.getGlassIdIn());
            ProductAlarmInfo alarmInfo = new ProductAlarmInfo();
            alarmInfo.setState(Const.LOAD_RAW_GLASS_NEW);
            alarmInfo.setAlarmModule(ALARM_MODULE);
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstorage/entity/dto/TemperingGlassCountDTO.java
@@ -15,6 +15,10 @@
     */
    private String engineerId;
    /**
     * 工程号
     */
    private String engineerName;
    /**
     * 钢化版图id
     */
    private Integer temperingLayoutId;
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/resources/mapper/BigStorageCageDetailsMapper.xml
@@ -32,6 +32,7 @@
    <resultMap id="temperingGlassCount" type="com.mes.bigstorage.entity.dto.TemperingGlassCountDTO">
        <result column="engineer_id" property="engineerId"/>
        <result column="engineer_name" property="engineerName"/>
        <result column="tempering_layout_id" property="temperingLayoutId"/>
        <result column="films_id" property="filmsId"/>
        <result column="thickness" property="thickness"/>
@@ -166,9 +167,9 @@
    <select id="selectTemperingGlassCount" resultMap="temperingGlassCount">
        with glass_info_temp as (
        select engineer_id, tempering_layout_id, count(*) as total_count
        from glass_info
        group by engineer_id, tempering_layout_id
        select t.engineer_id,t1.engineer_name, t.tempering_layout_id, count(*) as total_count
        from glass_info t inner join engineering t1 on t.engineer_id=t1.engineer_id
        group by t.engineer_id, t.tempering_layout_id
        ),
        big_details_temp as (
        select engineer_id, tempering_layout_id, count(*) as real_count, films_id, thickness
@@ -191,6 +192,7 @@
        ),
        result as (
        select t.engineer_id,
        t1.engineer_name,
        t.tempering_layout_id,
        t.films_id,
        t.thickness,
hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/controller/HollowGlassRelationInfoController.java
@@ -61,12 +61,19 @@
//        return Result.success(lackDetailsList);
//    }
    @ApiOperation("查询指定流程卡的缺片详情")
    @PostMapping("/queryLackByFlowCard")
    @PostMapping("/queryLackByFlowCardByERP")
    public Result<Map<Integer,List<LackDetailsDTO>>> queryLackByFlowCard(String flowCardId) {
        Map<Integer,List<LackDetailsDTO>> lackDetailsMap = hollowGlassRelationInfoService.queryLackByFlowCard(flowCardId);
        return Result.success(lackDetailsMap);
    }
    @ApiOperation("查询指定流程卡的缺片详情")
    @PostMapping("/queryLackByFlowCard")
    public Result<Map<Integer,List<LackDetailsDTO>>> queryLackByFlowCardByERP(String flowCardId) {
        Map<Integer,List<LackDetailsDTO>> lackDetailsMap = hollowGlassRelationInfoService.queryLackByFlowCardByERP(flowCardId);
        return Result.success(lackDetailsMap);
    }
    @ApiOperation("中空缺片爆破笼报破损")
    @PostMapping("/hollowBigStorageGlassDamage")
    public Result<Boolean> hollowBigStorageGlassDamage(@RequestBody DamageRequest request) {
hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/entity/dto/LackDetailsDTO.java
@@ -21,11 +21,11 @@
    /**
     * 流程卡
     */
    private int layer;
    private Integer layer;
    /**
     * 流程卡
     */
    private int glassType;
    private Integer glassType;
    /**
     * 膜系
     */
hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/mapper/HollowGlassRelationInfoMapper.java
@@ -4,6 +4,7 @@
import com.mes.glassinfo.entity.GlassInfo;
import com.mes.hollow.entity.HollowGlassRelationInfo;
import com.mes.hollow.entity.dto.LackDetailsDTO;
import com.mes.order.entity.ProcessCardReport;
import org.apache.ibatis.annotations.Param;
import org.springframework.cache.annotation.Cacheable;
@@ -29,5 +30,7 @@
    List<LackDetailsDTO> queryLackByFlowCard(@Param("flowCardId")  String flowCardId);
    List<LackDetailsDTO> queryLackGlassByFlowCard(@Param("flowCardId") String flowCardId, @Param("orderSort") Integer orderSort, @Param("layer") Integer layer);
    List<LackDetailsDTO> queryLackByFlowCardByERP(@Param("flowCardIdList") List<ProcessCardReport> flowCardIdList);
}
hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/HollowGlassRelationInfoService.java
@@ -43,6 +43,8 @@
    Map<Integer,List<LackDetailsDTO>> queryLackByFlowCard(String flowCardId);
    Map<Integer,List<LackDetailsDTO>> queryLackByFlowCardByERP(String flowCardId);
    /**
     * 按照厚度获取玻璃间隙
hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/service/impl/HollowGlassRelationInfoServiceImpl.java
@@ -7,6 +7,7 @@
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mes.common.config.Const;
import com.mes.common.config.ConstSysConfig;
import com.mes.damage.entity.Damage;
import com.mes.damage.entity.request.DamageRequest;
import com.mes.damage.service.DamageService;
import com.mes.glassinfo.entity.GlassInfo;
@@ -27,6 +28,7 @@
import com.mes.hollow.service.HollowGlassRelationInfoService;
import com.mes.order.entity.HollowGlassDetailsDTO;
import com.mes.order.entity.OrderDetailsDTO;
import com.mes.order.entity.ProcessCardReport;
import com.mes.order.service.OrdersService;
import com.mes.sysconfig.service.SysConfigService;
import lombok.extern.slf4j.Slf4j;
@@ -434,6 +436,88 @@
    }
    @Override
    public Map<Integer, List<LackDetailsDTO>> queryLackByFlowCardByERP(String flowCardId) {
        List<ProcessCardReport> processCardReports = ordersService.queryLackByERP(flowCardId);
        if (CollectionUtil.isEmpty(processCardReports)) {
            return null;
        }
        List<HollowBigStorageCageDetails> hollowBigStorageCageDetails = hollowBigStorageCageDetailsService.list(
                new LambdaQueryWrapper<HollowBigStorageCageDetails>()
                        .eq(HollowBigStorageCageDetails::getFlowCardId, flowCardId)
                        .in(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL)
        );
        // 1. 统计每个 (glassType, layer) 组合的出现次数
        Map<String, Long> typeLayerCountMap = hollowBigStorageCageDetails.stream()
                .map(detail -> detail.getGlassType() + "_" + detail.getLayer())
                .collect(Collectors.groupingBy(
                        key -> key,  // 以复合键为分组依据
                        Collectors.counting()  // 统计每个键的出现次数
                ));
        // 2. 遍历并按次数减 quantity(避免负数)
        processCardReports.forEach(report -> {
            String reportPair = report.getOrderNumber() + "_" + report.getTechnologyNumber();
            Long count = typeLayerCountMap.getOrDefault(reportPair, 0L);
            if (count > 0) {
                int newQuantity = Math.max(0, report.getLackQuantity() - count.intValue());
                report.setLackQuantity(newQuantity);
            }
        });
        List<LackDetailsDTO> detailsDTOS = baseMapper.queryLackByFlowCardByERP(processCardReports);
        List<Damage> damages = damageService.queryUnTempByFlowCardId(flowCardId);
// 1. 按(orderNumber+layer)分组,同时缓存DTO的其他字段作为模板
        Map<String, List<Damage>> damageMap = new HashMap<>();
        Map<String, LackDetailsDTO> dtoTemplateMap = new HashMap<>(); // 存储分组对应的DTO模板
// 1.1 初始化damage分组和DTO模板
        damages.forEach(damage -> {
            if (damage.getOrderNumber() == null || damage.getTechnologyNumber() == null) {
                return;
            }
            String key = damage.getOrderNumber() + "_" + damage.getTechnologyNumber();
            damageMap.computeIfAbsent(key, k -> new ArrayList<>()).add(damage);
        });
        detailsDTOS.forEach(dto -> {
            if (dto.getGlassType() == null || dto.getLayer() == null) {
                return;
            }
            String key = dto.getGlassType() + "_" + dto.getLayer();
            // 缓存第一个DTO作为模板(包含其他字段值)
            dtoTemplateMap.putIfAbsent(key, dto);
        });
// 2. 匹配并更新原始DTO
        detailsDTOS.forEach(dto -> {
            if (dto.getGlassType() == null || dto.getLayer() == null) {
                return;
            }
            String key = dto.getGlassType() + "_" + dto.getLayer();
            List<Damage> damagess = damageMap.get(key);
            if (damagess != null && !damagess.isEmpty()) {
                Damage damage = damagess.remove(0);
                dto.setGlassId(damage.getGlassId());
                dto.setWorkingProcedure(damage.getWorkingProcedure());
            }
        });
// 3. 处理剩余damage:复用同组DTO模板的其他字段
        damageMap.values().forEach(damagess -> damagess.forEach(damage -> {
            String key = damage.getOrderNumber() + "_" + damage.getTechnologyNumber();
            LackDetailsDTO template = dtoTemplateMap.get(key); // 获取同组模板
            if (template == null) return; // 无模板则跳过(理论上不会出现)
            LackDetailsDTO newDto = new LackDetailsDTO();
            // 1. 复制模板中的其他字段(除了glassId和workproduce)
            BeanUtils.copyProperties(template, newDto); // 用Spring的工具类复制属性
            // 2. 覆盖glassId和workproduce为当前damage的值
            newDto.setGlassId(damage.getGlassId());
            newDto.setWorkingProcedure("未知");
            detailsDTOS.add(newDto);
        }));
        return detailsDTOS.stream().collect(Collectors.groupingBy(item -> item.getLayer()));
    }
    @Override
    public Integer getGlassGapByThickness(Double thickness) {
        int sysKey = 0;
        if (thickness >= 12) {
hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/mapper/HollowGlassRelationInfoMapper.xml
@@ -72,50 +72,47 @@
             detail_temp AS (
                 SELECT t.*
                 FROM glass_temp t
                 WHERE NOT EXISTS (
                 WHERE NOT EXISTS(
                         SELECT 1
                         FROM hollow_big_storage_cage_details t1
                         WHERE t1.glass_id = t.glass_id
                           AND t1.state NOT IN (8,9)
                           AND t1.state NOT IN (8, 9)
                     )
             ),
             damage_latest AS (
                 SELECT
                     dr.glass_id,
                     dr.type,
                     dr.status
                 SELECT dr.glass_id,
                        dr.type,
                        dr.status
                 FROM (
                          SELECT
                              t1.glass_id,
                              t1.type,
                              t1.status,
                              ROW_NUMBER() OVER(PARTITION BY t1.glass_id ORDER BY t1.id DESC) as rn
                          SELECT t1.glass_id,
                                 t1.type,
                                 t1.status,
                                 ROW_NUMBER() OVER(PARTITION BY t1.glass_id ORDER BY t1.id DESC) as rn
                          FROM detail_temp t
                                   INNER JOIN damage t1 ON t.flow_card_id = t1.process_id
                      ) dr
                 WHERE dr.rn = 1
             ),
             result_temp AS (
                 SELECT
                     t.flow_card_id,
                     t.layer,
                     t.glass_type,
                     t.thickness,
                     t.filmsId,
                     t.width,
                     t.height,
                     COUNT(DISTINCT t.glass_id) as lack_count,
                     COUNT(DISTINCT CASE WHEN t1.type IN (8,9) AND t1.status = 1 THEN t.glass_id END) as damage_count
                 SELECT t.flow_card_id,
                        t.layer,
                        t.glass_type,
                        t.thickness,
                        t.filmsId,
                        t.width,
                        t.height,
                        COUNT(DISTINCT t.glass_id)                                                        as lack_count,
                        COUNT(DISTINCT
                              CASE WHEN t1.type IN (8, 9) AND t1.status = 1 THEN t.glass_id END)          as damage_count
                 FROM detail_temp t
                          LEFT JOIN damage_latest t1 ON t.glass_id = t1.glass_id
                 GROUP BY
                     t.flow_card_id,
                     t.layer,
                     t.glass_type,
                     t.thickness,
                     t.filmsId,
                     t.width,
                     t.height
                 GROUP BY t.flow_card_id,
                          t.layer,
                          t.glass_type,
                          t.thickness,
                          t.filmsId,
                          t.width,
                          t.height
             )
        SELECT *
        FROM result_temp
@@ -137,7 +134,7 @@
           , detail_temp as (
            select t.*
            from glass_temp t
                     left join hollow_big_storage_cage_details t1 on t.glass_id = t1.glass_id and t1.state  not in (8,9)
                     left join hollow_big_storage_cage_details t1 on t.glass_id = t1.glass_id and t1.state not in (8, 9)
            where t1.glass_id is null
        )
           , damage_ranked AS (
@@ -164,6 +161,37 @@
        select *
        from damage_latest
    </select>
    <select id="queryLackByFlowCardByERP" resultType="com.mes.hollow.entity.dto.LackDetailsDTO">
        WITH RECURSIVE nums(n) AS (
        SELECT 1
        UNION ALL
        SELECT n + 1 FROM nums WHERE n &lt; (SELECT MAX(quantity) FROM (
        <foreach collection="flowCardIdList" item="item" separator="UNION ALL">
            SELECT #{item.lackQuantity} AS quantity
        </foreach>
        ) t)
        )
        <foreach collection="flowCardIdList" item="item" separator="UNION ALL">
            SELECT t1.*
            FROM (
            SELECT
            g.flow_card_id AS flowCardId,
            g.layer AS layer,
            g.glass_type AS glassType,
            g.filmsid AS filmsId,
            g.width AS width,
            g.height AS height,
            g.thickness AS thickness
            FROM glass_info g
            WHERE g.flow_card_id = #{item.processId}
            AND g.layer = #{item.technologyNumber}
            AND g.glass_type = #{item.orderNumber}
            LIMIT 1
            ) t1
            CROSS JOIN nums
            WHERE nums.n &lt;= #{item.lackQuantity}
        </foreach>
    </select>
    <update id="clearDirtyFlowCardData">