ZengTao
2025-10-11 eae026a90011e77c1a3947021c87a2eea786d1b1
Merge remote-tracking branch 'origin/master'

# Conflicts:
# hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/mapper/HollowGlassRelationInfoMapper.xml
11个文件已修改
1个文件已添加
227 ■■■■■ 已修改文件
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstoragecagetask/controller/BigStorageCageHistoryTaskController.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstoragecagetask/service/BigStorageCageHistoryTaskService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstoragecagetask/service/impl/BigStorageCageHistoryTaskServiceImpl.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/OPCPlcSlicecage.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/job/PlcLoadGlassTask.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/loadglassdevicetaskhistory/controller/LoadGlassDeviceTaskHistoryController.java 22 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/loadglassdevicetaskhistory/entity/request/LoadGlassRequest.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/controller/HollowGlassRelationInfoController.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollowtask/controller/HollowBigStorageCageHistoryTaskController.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollowtask/service/HollowBigStorageCageHistoryTaskService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollowtask/service/impl/HollowBigStorageCageHistoryTaskServiceImpl.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/mapper/HollowGlassRelationInfoMapper.xml 115 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstoragecagetask/controller/BigStorageCageHistoryTaskController.java
@@ -45,4 +45,10 @@
    public Result<List<RunTime>> queryRunTimes(String days) {
        return Result.success(bigStorageCageHistoryTaskService.queryRunTimes(days));
    }
    @ApiOperation(value = "查询大理片界面所有信息", notes = "查询大理片界面所有信息")
    @GetMapping("/queryAllMessage")
    public Result<String> queryAllMessage() {
        return Result.success(bigStorageCageHistoryTaskService.queryAllMessage());
    }
}
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstoragecagetask/service/BigStorageCageHistoryTaskService.java
@@ -23,5 +23,7 @@
    DailyProductionVO queryBigDailyProduction(BigStorageCageHistoryRequest request);
    List<RunTime> queryRunTimes(String days);
    String queryAllMessage();
}
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/bigstoragecagetask/service/impl/BigStorageCageHistoryTaskServiceImpl.java
@@ -10,11 +10,13 @@
import com.mes.bigstoragecagetask.entity.request.BigStorageCageHistoryRequest;
import com.mes.bigstoragecagetask.mapper.BigStorageCageHistoryTaskMapper;
import com.mes.bigstoragecagetask.service.BigStorageCageHistoryTaskService;
import com.mes.job.OPCPlcSlicecage;
import com.mes.largenscreen.entity.DailyProductionVO;
import com.mes.largenscreen.entity.RunTime;
import com.mes.tools.DateUtil;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.List;
@@ -26,6 +28,9 @@
 */
@Service
public class BigStorageCageHistoryTaskServiceImpl extends ServiceImpl<BigStorageCageHistoryTaskMapper, BigStorageCageHistoryTask> implements BigStorageCageHistoryTaskService {
    @Resource
    OPCPlcSlicecage opcPlcSlicecage;
    @Override
    public Page<BigStorageCageHistoryTask> queryBigStorageCageHistoryTask(BigStorageCageHistoryRequest request) {
@@ -58,9 +63,20 @@
    }
    @Override
    public List<RunTime> queryRunTimes(String days){
    public List<RunTime> queryRunTimes(String days) {
        return baseMapper.queryRunTimes(days);
    }
    @Override
    public String queryAllMessage() {
        try {
            opcPlcSlicecage.plcStorageCageTask();
            return "success";
        } catch (Exception exception) {
            exception.printStackTrace();
        }
        return "fail";
    }
}
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/OPCPlcSlicecage.java
@@ -83,9 +83,9 @@
    private static final String ALARM_CODE_SIZE = "sizeSame";
    private static final String ALARM_CODE_ID = "idSame";
    private JSONObject jsonObject = new JSONObject();
    public void queryDataSource1() throws Exception {
    public JSONObject queryDataSource1() throws Exception {
        JSONObject jsonObject = new JSONObject();
        jsonObject.append("alarmInfo", productAlarmInfoService.list(new LambdaQueryWrapper<ProductAlarmInfo>()
                .eq(ProductAlarmInfo::getState, Const.LOAD_RAW_GLASS_NEW)
                .eq(ProductAlarmInfo::getAlarmModule, ALARM_MODULE)
@@ -248,10 +248,11 @@
        //当前指定工程
        jsonObject.append("temperingEngineerId", redisUtil.getCacheObject("temperingEngineerId"));
        return jsonObject;
    }
    public void queryDataSource2() throws InterruptedException {
        JSONObject jsonObject = new JSONObject();
        //出片队列
        List<TemperingGlassInfo> temperingGlassInfoList = temperingGlassInfoService.list(
                new LambdaQueryWrapper<TemperingGlassInfo>()
@@ -267,9 +268,8 @@
     */
    @Scheduled(fixedDelay = 3000)
    public void plcStorageCageTask() throws Exception {
        jsonObject = new JSONObject();
        //查询使用数据源1查询数据
        queryDataSource1();
        JSONObject jsonObject = queryDataSource1();
        //查询使用数据源2查询数据
//            queryDataSource2();
        webSocketUtils.sendToWeb("slicecage", jsonObject);
hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/job/PlcLoadGlassTask.java
@@ -11,7 +11,6 @@
import com.mes.pp.service.OptimizeProjectService;
import com.mes.rawglassdetails.entity.RawGlassStorageDetails;
import com.mes.rawglassstation.service.RawGlassStorageStationService;
import com.mes.tools.WebSocketServer;
import com.mes.tools.WebSocketUtils;
import com.mes.uppattenusage.entity.UpPattenUsage;
import com.mes.uppattenusage.service.UpPattenUsageService;
@@ -24,7 +23,6 @@
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@@ -147,7 +145,7 @@
    }
    private void loadGlassChild(String redisRequest, int stationCell, String tableName, String webSocketName) {
    public String loadGlassChild(String redisRequest, int stationCell, String tableName, String webSocketName) {
        try {
            JSONObject jsonObject = new JSONObject();
            //当前线路正在执行的工程
@@ -177,6 +175,7 @@
        } catch (Exception e) {
            e.printStackTrace();
        }
        return "success";
    }
hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/loadglassdevicetaskhistory/controller/LoadGlassDeviceTaskHistoryController.java
@@ -2,22 +2,25 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mes.job.PlcLoadGlassTask;
import com.mes.loadglassdevicetaskhistory.entity.request.LoadGlassRequest;
import com.mes.opctask.entity.LoadGlassDeviceTaskHistory;
import com.mes.opctask.entity.request.LoadGlassDeviceTaskHistoryRequest;
import com.mes.opctask.service.LoadGlassDeviceTaskHistoryService;
import com.mes.pp.service.OptimizeProjectService;
import com.mes.uppattenusage.entity.UpPattenUsage;
import com.mes.utils.Result;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import javax.annotation.Resource;
/**
 * <p>
 *  前端控制器
 * 前端控制器
 * </p>
 *
 * @author wf
@@ -27,6 +30,8 @@
@RequestMapping("/loadglassdevicetaskhistory")
public class LoadGlassDeviceTaskHistoryController {
    @Resource
    PlcLoadGlassTask plcLoadGlassTask;
    @Autowired
    private LoadGlassDeviceTaskHistoryService loadGlassDeviceTaskHistoryService;
@@ -36,5 +41,12 @@
        return Result.build(200, "查询成功", loadGlassDeviceTaskHistoryService.queryLoadGlassHistoryTask(request));
    }
    @ApiOperation("查询线路所有数据")
    @PostMapping("/queryAllMessage") //查询现在上片机的玻璃信息
    public Result<String> queryAllMessage(@RequestBody @Validated LoadGlassRequest request) {
        return Result.build(200, "查询成功", plcLoadGlassTask.loadGlassChild(request.getRedisRequest(), request.getStationCell(),
                request.getTableName(), request.getWebSocketName()));
    }
}
hangzhoumesParent/moduleService/LoadGlassModule/src/main/java/com/mes/loadglassdevicetaskhistory/entity/request/LoadGlassRequest.java
New file
@@ -0,0 +1,22 @@
package com.mes.loadglassdevicetaskhistory.entity.request;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * @Author : zhoush
 * @Date: 2025/10/11 11:04
 * @Description:
 */
@Data
public class LoadGlassRequest {
    @ApiModelProperty(value = "redis名字(loadGlassRequestOne loadGlassRequestTwo)", position = 1)
    private String redisRequest;
    @ApiModelProperty(value = "线路(5 6)", position = 2)
    private int stationCell;
    @ApiModelProperty(value = "线路表名(LOAD_GLASS_DEVICE_ONE_TASK LOAD_GLASS_DEVICE_TWO_TASK)", position = 3)
    private String tableName;
    @ApiModelProperty(value = "websocket(loadGlassOne loadGlassTwo)", position = 4)
    private String webSocketName;
}
hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollow/controller/HollowGlassRelationInfoController.java
@@ -40,14 +40,14 @@
        return Result.success(hollowAllFlowCardVOList);
    }
    @ApiOperation("查询指定流程卡及层数的缺片详情")
    @ApiOperation("界面展示:查询流程卡、层数的缺片详情")
    @PostMapping("/queryAllLackByFlowCard")
    public Result<List<LackDetailsDTO>> queryAllLackByFlowCard() {
        List<LackDetailsDTO> lackDetailsList = hollowGlassRelationInfoService.queryAllLackByFlowCard();
        return Result.success(lackDetailsList);
    }
    @ApiOperation("缺片玻璃信息详情")
    @ApiOperation("按照流程卡、订单序号、层号获取缺片玻璃信息详情")
    @PostMapping("/queryLackGlassByFlowCard")
    public Result<List<LackDetailsDTO>> queryLackGlassByFlowCard(@RequestBody HollowBigStorageDetailsQueryVO query) {
        List<LackDetailsDTO> lackGlassList = hollowGlassRelationInfoService.queryLackGlassByFlowCard(query);
@@ -60,7 +60,7 @@
//        List<LackDetailsDTO> lackDetailsList = hollowGlassRelationInfoService.queryLackByFlowCard(flowCardId);
//        return Result.success(lackDetailsList);
//    }
    @ApiOperation("查询指定流程卡及层数的缺片详情")
    @ApiOperation("查询指定流程卡的缺片详情")
    @PostMapping("/queryLackByFlowCard")
    public Result<Map<Integer,List<LackDetailsDTO>>> queryLackByFlowCard(String flowCardId) {
        Map<Integer,List<LackDetailsDTO>> lackDetailsMap = hollowGlassRelationInfoService.queryLackByFlowCard(flowCardId);
hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollowtask/controller/HollowBigStorageCageHistoryTaskController.java
@@ -47,5 +47,11 @@
    public Result<List<RunTime>> queryRunTimes(String days) {
        return Result.success(hollowBigStorageCageHistoryTaskService.queryRunTimes(days));
    }
    @ApiOperation(value = "查询中空大理片界面所有信息", notes = "查询中空大理片界面所有信息")
    @GetMapping("/queryAllMessage")
    public Result<String> queryAllMessage() {
        return Result.success(hollowBigStorageCageHistoryTaskService.queryAllMessage());
    }
}
hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollowtask/service/HollowBigStorageCageHistoryTaskService.java
@@ -22,5 +22,7 @@
    DailyProductionVO queryHollowDailyProduction(HollowBigStorageCageHistoryRequest request);
    List<RunTime> queryRunTimes(String days);
    String queryAllMessage();
}
hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/hollowtask/service/impl/HollowBigStorageCageHistoryTaskServiceImpl.java
@@ -9,11 +9,13 @@
import com.mes.hollowtask.entity.request.HollowBigStorageCageHistoryRequest;
import com.mes.hollowtask.mapper.HollowBigStorageCageHistoryTaskMapper;
import com.mes.hollowtask.service.HollowBigStorageCageHistoryTaskService;
import com.mes.job.PushMessageToIndex;
import com.mes.largenscreen.entity.DailyProductionVO;
import com.mes.largenscreen.entity.RunTime;
import com.mes.tools.DateUtil;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.List;
@@ -25,6 +27,9 @@
 */
@Service
public class HollowBigStorageCageHistoryTaskServiceImpl extends ServiceImpl<HollowBigStorageCageHistoryTaskMapper, HollowBigStorageCageHistoryTask> implements HollowBigStorageCageHistoryTaskService {
    @Resource
    PushMessageToIndex pushMessageToIndex;
    @Override
    public Page<HollowBigStorageCageHistoryTask> queryHollowBigStorageCageHistoryTask(HollowBigStorageCageHistoryRequest request) {
@@ -57,8 +62,14 @@
    }
    @Override
    public List<RunTime> queryRunTimes(String days){
    public List<RunTime> queryRunTimes(String days) {
        return baseMapper.queryRunTimes(days);
    }
    @Override
    public String queryAllMessage() {
        pushMessageToIndex.hollowGlassMessage();
        return "success";
    }
}
hangzhoumesParent/moduleService/hollowGlassModule/src/main/resources/mapper/HollowGlassRelationInfoMapper.xml
@@ -5,10 +5,10 @@
    <resultMap id="lackBaseMap" type="com.mes.hollow.entity.dto.LackDetailsDTO">
        <result column="flow_card_id" property="flowCardId"/>
        <result column="layer" property="layer"/>
        <result column="order_sort" property="glassType"/>
        <result column="films_id" property="filmsId"/>
        <result column="first_length" property="width"/>
        <result column="second_Length" property="height"/>
        <result column="glass_type" property="glassType"/>
        <result column="filmsid" property="filmsId"/>
        <result column="width" property="width"/>
        <result column="height" property="height"/>
        <result column="thickness" property="thickness"/>
        <result column="lack_count" property="lackCount"/>
        <result column="damage_count" property="damageCount"/>
@@ -59,58 +59,67 @@
    </select>
    <select id="queryAllLackByFlowCard" resultMap="lackBaseMap">
        with flow_card_id_info as (
            select distinct flow_card_id from hollow_big_storage_cage_details where state = 100
        WITH flow_card_id_info AS (
            SELECT DISTINCT flow_card_id
            FROM hollow_big_storage_cage_details
            WHERE state = 100
        ),
             relation_length as (
                 select flow_card_id,
                        layer,
                        order_sort,
                        tempering_layout_id,
                        tempering_feed_sequence,
                        GREATEST(width, height) as first_length,
                        LEAST(width, height)    as second_Length,
                        width,
                        height,
                        thickness,
                        films_id
                 from hollow_glass_relation_info
                 where flow_card_id in (select flow_card_id from flow_card_id_info)
                   and tempering_layout_id is null
                   and tempering_feed_sequence is null
             glass_temp AS (
                 SELECT t.*
                 FROM glass_info t
                          INNER JOIN flow_card_id_info t1 ON t.flow_card_id = t1.flow_card_id
             ),
             lack_count_temp as (
                 select flow_card_id,
                        layer,
                        order_sort,
                        first_length,
                        films_id,
                        second_Length,
                        thickness,
                        count(*) as lack_count
                 from relation_length
                 group by flow_card_id, layer, order_sort, films_id, first_length, second_Length, thickness
             detail_temp AS (
                 SELECT t.*
                 FROM glass_temp t
                 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)
                     )
             ),
             damage_count_temp as (
                 select process_id                                                                     as flow_card_id,
                        technology_number                                                              as layer,
                        order_number                                                                   as order_sort,
                        count(distinct
                              case when type = 8 and status &lt; 3 then glass_id else null end)        as damage_count,
                        count(distinct case when type = 8 and status >= 3 then glass_id else null end) as patch_count
                 from damage
                 where process_id in (select flow_card_id from flow_card_id_info)
                 group by process_id, technology_number, order_number
             damage_latest AS (
                 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
                          FROM detail_temp t
                                   INNER JOIN damage t1 ON t.flow_card_id = t1.process_id
                      ) dr
                 WHERE dr.rn = 1
             ),
             result_count as (
                 select t.*, IFNULL(t1.damage_count, 0) damage_count, IFNULL(t1.patch_count, 0) patch_count
                 from lack_count_temp t
                          left join damage_count_temp t1 on t.flow_card_id = t1.flow_card_id and t.layer = t1.layer and
                                                            t.order_sort = t1.order_sort
                 order by t.flow_card_id, t.layer
             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 (7,8) 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
             )
        select *
        from result_count
        SELECT *
        FROM result_temp
        ORDER BY flow_card_id, layer;
    </select>
    <select id="queryLayerByFlowCardId" resultType="java.lang.Integer">
        select count(distinct layer)
@@ -128,8 +137,8 @@
           , 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)
            WHERE t1.glass_id is null
                     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 (
            SELECT t.flow_card_id,