1、新增每日统计接口及向前端推送当当天生产情况
2、优化理片笼判断笼内是否有相同玻璃小片
3、新增list转page工具类
3个文件已修改
8个文件已添加
405 ■■■■■ 已修改文件
hangzhoumesParent/common/servicebase/src/main/java/com/mes/largenscreen/controller/LargenScreenController.java 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/common/servicebase/src/main/java/com/mes/largenscreen/entity/DailyProductionVO.java 52 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/common/servicebase/src/main/java/com/mes/largenscreen/entity/DateRequest.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/common/servicebase/src/main/java/com/mes/largenscreen/mapper/LargenScreenMapper.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/common/servicebase/src/main/java/com/mes/largenscreen/service/LargenScreenService.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/common/servicebase/src/main/java/com/mes/largenscreen/service/impl/LargenScreenServiceImpl.java 51 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/common/servicebase/src/main/java/com/mes/tools/PageUtil.java 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/common/servicebase/src/main/resources/mapper/LargenScreenMapper.xml 141 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/job/PushMessageToIndex.java 31 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/OPCPlcSlicecage.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/job/PushMessageToIndex.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
hangzhoumesParent/common/servicebase/src/main/java/com/mes/largenscreen/controller/LargenScreenController.java
New file
@@ -0,0 +1,38 @@
package com.mes.largenscreen.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mes.largenscreen.entity.DailyProductionVO;
import com.mes.largenscreen.entity.DateRequest;
import com.mes.largenscreen.service.LargenScreenService;
import com.mes.utils.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
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 javax.annotation.Resource;
/**
 * @Author : zhoush
 * @Date: 2025/3/12 14:24
 * @Description:
 */
@Api(tags = "大屏统计信息")
@RestController
@RequestMapping("largenScreen")
public class LargenScreenController {
    @Resource
    LargenScreenService largenScreenService;
    @ApiOperation("按照条件统计每日生产情况")
    @PostMapping("/queryDailyProduction")
    public Result<Page<DailyProductionVO>> queryDailyProduction(@RequestBody @Validated DateRequest query) {
        return Result.build(200, "查询成功", largenScreenService.queryDailyProduction(query));
    }
}
hangzhoumesParent/common/servicebase/src/main/java/com/mes/largenscreen/entity/DailyProductionVO.java
New file
@@ -0,0 +1,52 @@
package com.mes.largenscreen.entity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * @Author : zhoush
 * @Date: 2025/3/12 14:30
 * @Description:
 */
@Data
public class DailyProductionVO {
    @ApiModelProperty(value = "日期")
    private String date;
    @ApiModelProperty(value = "切割一线玻璃数量")
    private int countOutOne;
    @ApiModelProperty(value = "切割一线玻璃面积")
    private double totalAreaOutOne;
    @ApiModelProperty(value = "切割二线玻璃数量")
    private int countOutTwo;
    @ApiModelProperty(value = "切割二线玻璃面积")
    private double totalAreaOutTwo;
    @ApiModelProperty(value = "钢化前大理片笼玻璃数量")
    private int countIn;
    @ApiModelProperty(value = "钢化前大理片笼玻璃面积")
    private double totalAreaIn;
    @ApiModelProperty(value = "钢化玻璃数量")
    private int countOut;
    @ApiModelProperty(value = "钢化玻璃面积")
    private double totalAreaOut;
    @ApiModelProperty(value = "中空一线玻璃数量")
    private int hollowCountOutOne;
    @ApiModelProperty(value = "中空一线玻璃面积")
    private double hollowTotalAreaOutOne;
    @ApiModelProperty(value = "中空二线玻璃数量")
    private int hollowCountOutTwo;
    @ApiModelProperty(value = "中空二线玻璃面积")
    private double hollowTotalAreaOutTwo;
}
hangzhoumesParent/common/servicebase/src/main/java/com/mes/largenscreen/entity/DateRequest.java
New file
@@ -0,0 +1,19 @@
package com.mes.largenscreen.entity;
import com.mes.base.entity.PageRequest;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * @Author : zhoush
 * @Date: 2025/3/12 14:42
 * @Description:
 */
@Data
public class DateRequest extends PageRequest {
    @ApiModelProperty(value = "开始日期 ‘yyyy-MM-dd’")
    private String BeginDate;
    @ApiModelProperty(value = "结束日期 ‘yyyy-MM-dd’")
    private String endDate;
}
hangzhoumesParent/common/servicebase/src/main/java/com/mes/largenscreen/mapper/LargenScreenMapper.java
New file
@@ -0,0 +1,16 @@
package com.mes.largenscreen.mapper;
import com.mes.largenscreen.entity.DailyProductionVO;
import java.util.List;
/**
 * @Author : zhoush
 * @Date: 2025/3/12 14:46
 * @Description:
 */
public interface LargenScreenMapper {
    List<DailyProductionVO> queryDailyProduction(String beginDate, String endDate);
}
hangzhoumesParent/common/servicebase/src/main/java/com/mes/largenscreen/service/LargenScreenService.java
New file
@@ -0,0 +1,17 @@
package com.mes.largenscreen.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mes.largenscreen.entity.DailyProductionVO;
import com.mes.largenscreen.entity.DateRequest;
/**
 * @Author : zhoush
 * @Date: 2025/3/12 14:27
 * @Description:
 */
public interface LargenScreenService {
    Page<DailyProductionVO> queryDailyProduction(DateRequest query);
    DailyProductionVO querySameDayProduction(DateRequest query);
}
hangzhoumesParent/common/servicebase/src/main/java/com/mes/largenscreen/service/impl/LargenScreenServiceImpl.java
New file
@@ -0,0 +1,51 @@
package com.mes.largenscreen.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mes.largenscreen.entity.DailyProductionVO;
import com.mes.largenscreen.entity.DateRequest;
import com.mes.largenscreen.mapper.LargenScreenMapper;
import com.mes.largenscreen.service.LargenScreenService;
import com.mes.tools.PageUtil;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
/**
 * @Author : zhoush
 * @Date: 2025/3/12 14:28
 * @Description:
 */
@Service
public class LargenScreenServiceImpl implements LargenScreenService {
    @Resource
    private LargenScreenMapper largenScreenMapper;
    @Override
    public Page<DailyProductionVO> queryDailyProduction(DateRequest query) {
        if (StringUtils.isEmpty(query.getBeginDate())) {
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            query.setBeginDate(sdf.format(new Date()));
            query.setEndDate(sdf.format(new Date()));
        }
        List<DailyProductionVO> list = largenScreenMapper.queryDailyProduction(query.getBeginDate(), query.getEndDate());
        return (Page<DailyProductionVO>) PageUtil.listToPage(list, query.getPageNo(), query.getPageSize());
    }
    @Override
    public DailyProductionVO querySameDayProduction(DateRequest query) {
        if (StringUtils.isEmpty(query.getBeginDate())) {
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            query.setBeginDate(sdf.format(new Date()));
            query.setEndDate(sdf.format(new Date()));
        }
        List<DailyProductionVO> list = largenScreenMapper.queryDailyProduction(query.getBeginDate(), query.getEndDate());
        return list.get(0);
    }
}
hangzhoumesParent/common/servicebase/src/main/java/com/mes/tools/PageUtil.java
New file
@@ -0,0 +1,27 @@
package com.mes.tools;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.ArrayList;
import java.util.List;
/**
 * @Author : zhoush
 * @Date: 2025/3/12 15:29
 * @Description:
 */
public class PageUtil {
    public static IPage listToPage(List list, int pageNum, int pageSize) {
        List pageList = new ArrayList<>();
        int curIdx = pageNum > 1 ? (pageNum - 1) * pageSize : 0;
        for (int i = 0; i < pageSize && curIdx + i < list.size(); i++) {
            pageList.add(list.get(curIdx + i));
        }
        Page page = new Page(pageNum, pageSize);
        page.setRecords(pageList);
        page.setTotal(list.size());
        return page;
    }
}
hangzhoumesParent/common/servicebase/src/main/resources/mapper/LargenScreenMapper.xml
New file
@@ -0,0 +1,141 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.mes.largenscreen.mapper.LargenScreenMapper">
    <resultMap id="baseMap" type="com.mes.largenscreen.entity.DailyProductionVO">
        <result column="date" property="date"/>
        <result column="count_out_one" property="countOutOne"/>
        <result column="total_area_out_one" property="totalAreaOutOne"/>
        <result column="count_out_two" property="countOutTwo"/>
        <result column="total_area_out_two" property="totalAreaOutTwo"/>
        <result column="count_in" property="countIn"/>
        <result column="total_area_in" property="totalAreaIn"/>
        <result column="count_out" property="countOut"/>
        <result column="total_area_out" property="totalAreaOut"/>
        <result column="hollow_count_out_one" property="hollowCountOutOne"/>
        <result column="hollow_total_area_out_one" property="hollowTotalAreaOutOne"/>
        <result column="hollow_count_out_two" property="hollowCountOutTwo"/>
        <result column="hollow_total_area_out_two" property="hollowTotalAreaOutTwo"/>
    </resultMap>
    <select id="queryDailyProduction" resultMap="baseMap">
        WITH RECURSIVE
            date_series AS (
                SELECT #{beginDate} AS date
                UNION ALL
                SELECT DATE_ADD(date, INTERVAL 1 DAY)
                FROM date_series
                WHERE date &lt;= DATE_SUB(#{endDate}, INTERVAL 1 DAY)
            ),
            one_edg_temp as (
                select STR_TO_DATE(t.create_time, '%Y-%m-%d')        as product_date,
                       count(t.glass_id_out)                         as
                                                                        count_out_one,
                       round(sum(t1.width * t1.height) / 1000000, 2) as total_area_out_one
                from edg_storage_device_task_history t
                         inner join glass_info t1 on t.glass_id_in = t1.glass_id
                where t.task_type in
                      (2, 3)
                  and STR_TO_DATE(t.create_time, '%Y-%m-%d') BETWEEN #{beginDate} and #{endDate}
                  and device_id = 1
                group by STR_TO_DATE(t.create_time, '%Y-%m-%d')
                order by STR_TO_DATE(t.create_time, '%Y-%m-%d')
            ),
            two_edg_temp as (
                select STR_TO_DATE(t.create_time, '%Y-%m-%d')        as product_date,
                       count(t.glass_id_out)                         as
                                                                        count_out_two,
                       round(sum(t1.width * t1.height) / 1000000, 2) as total_area_out_two
                from edg_storage_device_task_history t
                         inner join glass_info t1 on t.glass_id_in = t1.glass_id
                where t.task_type in
                      (2, 3)
                  and STR_TO_DATE(t.create_time, '%Y-%m-%d') BETWEEN #{beginDate} and #{endDate}
                  and device_id = 2
                group by STR_TO_DATE(t.create_time, '%Y-%m-%d')
                order by STR_TO_DATE(t.create_time, '%Y-%m-%d')
            ),
            big_storage_in_temp as (
                select STR_TO_DATE(t.create_time, '%Y-%m-%d')        as product_date,
                       count(t.glass_id)                             as
                                                                        count_in,
                       round(sum(t1.width * t1.height) / 1000000, 2) as total_area_in
                from big_storage_cage_history_task t
                         INNER JOIN glass_info t1 on t.glass_id = t1.glass_id
                where t.task_type = 1
                  and STR_TO_DATE(t.create_time, '%Y-%m-%d')
                    BETWEEN #{beginDate} and #{endDate}
                group by STR_TO_DATE(t.create_time, '%Y-%m-%d')
                order by STR_TO_DATE(t.create_time, '%Y-%m-%d')
            ),
            big_storage_out_temp as (
                select STR_TO_DATE(t.create_time, '%Y-%m-%d')        as product_date,
                       count(t.glass_id)                             as
                                                                        count_out,
                       round(sum(t1.width * t1.height) / 1000000, 2) as total_area_out
                from big_storage_cage_history_task t
                         INNER JOIN glass_info t1 on t.glass_id = t1.glass_id
                where t.task_type = 2
                  and STR_TO_DATE(t.create_time, '%Y-%m-%d')
                    BETWEEN #{beginDate} and #{endDate}
                group by STR_TO_DATE(t.create_time, '%Y-%m-%d')
                order by STR_TO_DATE(t.create_time, '%Y-%m-%d')
            ),
            hollow_out_one_temp as (
                select STR_TO_DATE(t.create_time, '%Y-%m-%d')        as product_date,
                       count(t.glass_id)                             as
                                                                        hollow_count_out_one,
                       round(sum(t1.width * t1.height) / 1000000, 2) as hollow_total_area_out_one
                from hollow_big_storage_cage_history_task t
                         INNER JOIN glass_info t1 on t.glass_id = t1.glass_id
                where t.task_type =
                      5
                  and t.target_slot = 930
                  and STR_TO_DATE(t.create_time, '%Y-%m-%d') BETWEEN #{beginDate} and #{endDate}
                group by STR_TO_DATE(t.create_time, '%Y-%m-%d')
                order by STR_TO_DATE(t.create_time, '%Y-%m-%d')
            ),
            hollow_out_two_temp as (
                select STR_TO_DATE(t.create_time, '%Y-%m-%d')        as product_date,
                       count(t.glass_id)                             as
                                                                        hollow_count_out_two,
                       round(sum(t1.width * t1.height) / 1000000, 2) as hollow_total_area_out_two
                from hollow_big_storage_cage_history_task t
                         INNER JOIN glass_info t1 on t.glass_id = t1.glass_id
                where t.task_type =
                      5
                  and t.target_slot = 931
                  and STR_TO_DATE(t.create_time, '%Y-%m-%d') BETWEEN #{beginDate} and #{endDate}
                group by STR_TO_DATE(t.create_time, '%Y-%m-%d')
                order by STR_TO_DATE(t.create_time, '%Y-%m-%d')
            )
        select t.date,
               ifnull(t1.count_out_one, 0)        count_out_one,
               ifnull(t1.total_area_out_one, 0)   total_area_out_one,
               ifnull(t2.count_out_two, 0)        count_out_two,
               ifnull(t2.total_area_out_two, 0)   total_area_out_two,
               ifnull(t3.count_in, 0)             count_in,
               ifnull(t3.total_area_in, 0)        total_area_in,
               ifnull(t4.count_out, 0)            count_out,
               ifnull(t4.total_area_out, 0)       total_area_out,
               ifnull(t5.hollow_count_out_one, 0) hollow_count_out_one,
               ifnull(t5.hollow_total_area_out_one, 0)
                                                  hollow_total_area_out_one,
               ifnull(t6.hollow_count_out_two, 0) hollow_count_out_two,
               ifnull(t6.hollow_total_area_out_two, 0)
                                                  hollow_total_area_out_two
        from date_series t
                 left join one_edg_temp t1 on t.date = t1.product_date
                 left join two_edg_temp t2 on t.date =
                                              t2.product_date
                 left join big_storage_in_temp t3 on t.date = t3.product_date
                 left join big_storage_out_temp t4 on t.date =
                                                      t4.product_date
                 left join hollow_out_one_temp t5 on t.date = t5.product_date
                 left join hollow_out_two_temp t6 on t.date =
                                                     t6.product_date
        order by t.date
    </select>
</mapper>
hangzhoumesParent/moduleService/CacheGlassModule/src/main/java/com/mes/job/PushMessageToIndex.java
@@ -5,13 +5,13 @@
import com.mes.common.config.Const;
import com.mes.edgglasstask.entity.EdgGlassTaskInfo;
import com.mes.edgglasstask.service.EdgGlassTaskInfoService;
import com.mes.edgstoragecage.entity.vo.CutDrawingVO;
import com.mes.edgstoragecage.entity.vo.EdgStorageCageVO;
import com.mes.edgstoragecage.service.EdgStorageCageDetailsService;
import com.mes.edgstoragecage.service.EdgStorageCageService;
import com.mes.engineering.entity.Engineering;
import com.mes.engineering.service.EngineeringService;
import com.mes.opctask.entity.EdgStorageDeviceTask;
import com.mes.largenscreen.entity.DailyProductionVO;
import com.mes.largenscreen.service.LargenScreenService;
import com.mes.opctask.entity.EdgStorageDeviceTaskHistory;
import com.mes.opctask.service.EdgStorageDeviceTaskHistoryService;
import com.mes.opctask.service.EdgStorageDeviceTaskService;
@@ -23,8 +23,6 @@
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletionStage;
/**
 * @Author : zhoush
@@ -47,6 +45,8 @@
    EdgStorageDeviceTaskHistoryService edgStorageDeviceTaskHistoryService;
    @Resource
    EngineeringService engineeringService;
    @Resource
    LargenScreenService largenScreenService;
    private static final String EDG_STORAGE_DEVICE_ONE_TASK = "edg_storage_device_one_task";
@@ -146,6 +146,29 @@
        }
    }
    @Scheduled(fixedDelay = 30000)
    public void querySameDayProductionTask() {
        JSONObject jsonObject = new JSONObject();
        DailyProductionVO productionVO = largenScreenService.querySameDayProduction(null);
        jsonObject.append("productionVO", productionVO);
        ArrayList<WebSocketServer> sendwServer = WebSocketServer.sessionMap.get("largenScreenProduction");
        if (sendwServer != null) {
            for (WebSocketServer webserver : sendwServer) {
                if (webserver != null) {
                    webserver.sendMessage(jsonObject.toString());
                    List<String> messages = webserver.getMessages();
                    if (!messages.isEmpty()) {
                        // // 将最后一个消息转换为整数类型的列表
                        webserver.clearMessages();
                    }
                } else {
                    log.info("largenScreenProduction is closed");
                }
            }
        }
    }
    @Scheduled(fixedDelay = 1000)
    public void largenScreen() {
        JSONObject jsonObject = new JSONObject();
hangzhoumesParent/moduleService/CacheVerticalGlassModule/src/main/java/com/mes/job/OPCPlcSlicecage.java
@@ -12,7 +12,6 @@
import com.mes.bigstoragecagetask.entity.BigStorageTaskVO;
import com.mes.bigstoragecagetask.service.BigStorageCageTaskService;
import com.mes.common.config.Const;
import com.mes.engineering.entity.Engineering;
import com.mes.glassinfo.service.GlassInfoService;
import com.mes.temperingglass.entity.TemperingGlassInfo;
import com.mes.temperingglass.service.TemperingGlassInfoService;
@@ -73,8 +72,8 @@
                    BigStorageTaskVO task = new BigStorageTaskVO();
                    task.setGlassId(requestWord.getValue() + "");
                    int isExistCount = bigStorageCageDetailsService.count(new LambdaQueryWrapper<BigStorageCageDetails>().in(BigStorageCageDetails::getGlassId, task.getGlassId())
                            .in(BigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL_ZERO));
                    if (isExistCount > 0 && "0".equals(targetSlotWord.getValue())) {
                            .in(BigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL));
                    if (isExistCount > 0) {
                        task.setIsSame(1);
                    } else {
                        task.setIsSame(0);
hangzhoumesParent/moduleService/hollowGlassModule/src/main/java/com/mes/job/PushMessageToIndex.java
@@ -142,8 +142,8 @@
                    BigStorageTaskVO task = new BigStorageTaskVO();
                    task.setGlassId(requestWord.getValue() + "");
                    int isExistCount = hollowBigStorageCageDetailsService.count(new LambdaQueryWrapper<HollowBigStorageCageDetails>().in(HollowBigStorageCageDetails::getGlassId, task.getGlassId())
                            .in(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL_ZERO));
                    if (isExistCount > 0 && "0".equals(targetSlotWord.getValue() + "")) {
                            .in(HollowBigStorageCageDetails::getState, Const.GLASS_STATE_IN_ALL));
                    if (isExistCount > 0) {
                        task.setIsSame(1);
                    } else {
                        task.setIsSame(0);
@@ -203,8 +203,8 @@
        jsonObject.append("bigStorageCageUsage", bigStorageCageUsage);
        //理片笼使用情况汇总
        HollowBigStorageDetailsQueryVO hollowBigStorageDetailsQueryVO=new HollowBigStorageDetailsQueryVO();
        List<FlowCardGlassInfoDTO> bigStorageCageUsageSummary= hollowGlassRelationInfoService.queryHollowAllFlowCardSummary(hollowBigStorageDetailsQueryVO);
        HollowBigStorageDetailsQueryVO hollowBigStorageDetailsQueryVO = new HollowBigStorageDetailsQueryVO();
        List<FlowCardGlassInfoDTO> bigStorageCageUsageSummary = hollowGlassRelationInfoService.queryHollowAllFlowCardSummary(hollowBigStorageDetailsQueryVO);
        jsonObject.append("bigStorageCageUsageSummary", bigStorageCageUsageSummary);
    }