Lius
2025-05-08 5c18a8c93db1cf1b7b6d61a618e3a1b87fb14883
看板接口mdc部分
已添加4个文件
已修改27个文件
730 ■■■■■ 文件已修改
lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/mapper/EquipmentMapper.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentMapper.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/mapper/xml/EquipmentMapper.xml 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/service/IEquipmentService.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/service/IEquipmentWorkLineService.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentServiceImpl.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcBoardController.java 86 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentStatisticalInfoMapper.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcOeeInfoMapper.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentStatisticalInfoMapper.xml 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcOeeInfoMapper.xml 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcBoardService.java 49 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentStatisticalInfoService.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcOeeInfoService.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentWorkLineServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcBoardServiceImpl.java 265 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentRunningSectionServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentStatisticalInfoServiceImpl.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcOeeInfoServiceImpl.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/MdcBoardRateVo.java 40 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdcJc/mapper/MdcJcRcJobreportMapper.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdcJc/mapper/xml/MdcJcRcJobreportMapper.xml 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdcJc/service/IMdcJcRcJobreportService.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdcJc/service/impl/MdcJcRcJobreportServiceImpl.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/MdcProductionMapper.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/xml/MdcProductionMapper.xml 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/IMdcProductionService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/MdcProductionServiceImpl.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/mapper/EquipmentMapper.java
@@ -7,6 +7,8 @@
import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.mdc.entity.Equipment;
import java.util.List;
/**
 * @Description: é‡‡é›†è®¾å¤‡è¡¨
 * @Author: liuS
@@ -25,4 +27,6 @@
    void deleteTableData(@Param("tableName") String saveTableName, @Param("day") String day);
    void insertNoTableData(@Param("tableName") String tableName, @Param("lastTableName") String lastTableName, @Param("date") String date);
    List<Equipment> listByProds(@Param("proIds") List<String> proIds);
}
lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentMapper.java
@@ -135,4 +135,8 @@
    List<MdcEquipment> findByProIdsAndTeamCode(@Param("mdcProductionIds") List<String> mdcProductionIds, @Param("teamCodeList") List<String> teamCodeList);
    List<MdcEquipment> findByProIdsAndType(@Param("mdcProductionIds") List<String> mdcProductionIds, @Param("typeList") List<String> typeList);
    List<String> getEquIdsByProIds(@Param("proIds") List<String> proIds);
    List<MdcEquipment> findByProIds(@Param("proIds") List<String> proIds);
}
lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/mapper/xml/EquipmentMapper.xml
@@ -22,4 +22,19 @@
    <select id="checkTableDataNum" resultType="java.lang.Integer">
        SELECT COUNT(CollectTime) num FROM ${saveTableName} WHERE CollectTime &lt; '${day}'
    </select>
    <select id="listByProds" resultType="org.jeecg.modules.mdc.entity.Equipment">
        SELECT
            t1.*
        FROM
            Equipment t1
                LEFT JOIN mdc_equipment t2 ON t1.EquipmentID = t2.equipment_id
                LEFT JOIN mdc_production_equipment t3 ON t2.id = t3.equipment_id
        <where>
            t3.production_id IN
            <foreach collection="proIds" index="index" item="id" open="(" separator="," close=")">
                #{id}
            </foreach>
        </where>
    </select>
</mapper>
lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentMapper.xml
@@ -340,4 +340,32 @@
        </foreach>
    </select>
    <select id="getEquIdsByProIds" resultType="java.lang.String">
        SELECT
            t1.equipment_id
        FROM
            mdc_equipment t1
                LEFT JOIN mdc_production_equipment t2 ON t1.id = t2.equipment_id
        <where>
            t2.production_id IN
            <foreach collection="proIds" index="index" item="id" open="(" separator="," close=")">
                #{id}
            </foreach>
        </where>
    </select>
    <select id="findByProIds" resultType="org.jeecg.modules.mdc.entity.MdcEquipment">
        SELECT
            t1.*
        FROM
            mdc_equipment t1
                LEFT JOIN mdc_production_equipment t2 ON t1.id = t2.equipment_id
        <where>
            t2.production_id IN
            <foreach collection="proIds" index="index" item="id" open="(" separator="," close=")">
                #{id}
            </foreach>
        </where>
    </select>
</mapper>
lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/service/IEquipmentService.java
@@ -3,6 +3,8 @@
import com.baomidou.mybatisplus.extension.service.IService;
import org.jeecg.modules.mdc.entity.Equipment;
import java.util.List;
/**
 * @Description: é‡‡é›†è®¾å¤‡è¡¨
 * @Author: liuS
@@ -48,4 +50,11 @@
     * @param day
     */
    void insertNoTableData(String backupTableName, String tableName, String day);
    /**
     *
     * @param proIds
     * @return
     */
    List<Equipment> listByProds(List<String> proIds);
}
lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/service/IEquipmentWorkLineService.java
@@ -34,13 +34,12 @@
    /**
     * æŸ¥æ‰¾æ³•兰克设备运行的程序号
     * @param drivetype
     * @param equipmentid
     * @param saveTableName
     * @param startTime
     * @param endTime
     * @return
     */
    List<EquipmentMachingDto> getEquipProgramNum(String drivetype, String equipmentid, Date startTime, Date endTime);
    List<EquipmentMachingDto> getEquipProgramNum(String saveTableName, Date startTime, Date endTime);
    /**
     * æŸ¥è¯¢æ³•拉克设备加工工件开始时间
lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentService.java
@@ -239,4 +239,8 @@
     * @return
     */
    List<MdcEquipment> findByProIdsAndType(List<String> allProductionIds, List<String> typeList);
    List<String> getEquIdsByProIds(List<String> proIds);
    List<MdcEquipment> findByProIds(List<String> proIds);
}
lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentServiceImpl.java
@@ -6,6 +6,9 @@
import org.jeecg.modules.mdc.service.IEquipmentService;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.List;
/**
 * @Description: é‡‡é›†è®¾å¤‡è¡¨
 * @Author: liuS
@@ -39,4 +42,9 @@
    public void insertNoTableData(String backupTableName, String tableName, String day) {
        this.baseMapper.insertNoTableData(backupTableName, tableName, day);
    }
    @Override
    public List<Equipment> listByProds(List<String> proIds) {
        return this.baseMapper.listByProds(proIds);
    }
}
lxzn-module-mdc-common/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentServiceImpl.java
@@ -1042,4 +1042,14 @@
        return this.baseMapper.findByProIdsAndType(allProductionIds, typeList);
    }
    @Override
    public List<String> getEquIdsByProIds(List<String> proIds) {
        return this.baseMapper.getEquIdsByProIds(proIds);
    }
    @Override
    public List<MdcEquipment> findByProIds(List<String> proIds) {
        return this.baseMapper.findByProIds(proIds);
    }
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcBoardController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,86 @@
package org.jeecg.modules.mdc.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.mdc.entity.MdcEquipment;
import org.jeecg.modules.mdc.service.IMdcBoardService;
import org.jeecg.modules.system.entity.MdcProduction;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
/**
 * @Author: Lius
 * @CreateTime: 2025-05-06
 * @Description: çœ‹æ¿æŽ¥å£
 */
@Slf4j
@Api(tags = "MDC看板接口")
@RestController
@RequestMapping("/mdc/board")
public class MdcBoardController {
    @Resource
    private IMdcBoardService mdcBoardService;
    @ApiOperation(value = "MDC首页接口-设备运行状态统计", notes = "MDC首页接口-设备运行状态统计")
    @GetMapping("/equipmentStatusStatistics")
    public Result<?> equipmentStatusStatistics(String productionId) {
        Map<String, Object> result = mdcBoardService.equipmentStatusStatistics(productionId);
        return Result.OK(result);
    }
    @ApiOperation(value = "MDC首页接口-获取车间分组", notes = "MDC首页接口-获取车间分组")
    @GetMapping("/proList")
    public Result<?> proList(String productionId) {
        List<MdcProduction> result = mdcBoardService.proList(productionId);
        return Result.OK(result);
    }
    @ApiOperation(value = "MDC首页接口-率分析走势图", notes = "MDC首页接口-率分析走势图")
    @GetMapping("/rateAnalysisTrend")
    public Result<?> rateAnalysisTrend(String productionId) {
        Map<String, Object> result = mdcBoardService.rateAnalysisTrend(productionId);
        return Result.OK(result);
    }
    @ApiOperation(value = "MDC首页接口-设备列表", notes = "MDC首页接口-设备列表")
    @GetMapping("/equipmentList")
    public Result<?> equipmentList(@RequestParam(name = "productionId", required = true) String productionId) {
        List<MdcEquipment> result = mdcBoardService.equipmentList(productionId);
        return Result.OK(result);
    }
    @ApiOperation(value = "MDC首页接口-设备日率分析", notes = "MDC首页接口-设备日率分析")
    @GetMapping("/rateAnalysisTrendDay")
    public Result<?> rateAnalysisTrendDay(@RequestParam(name = "equipmentId", required = true) String equipmentId) {
        Map<String, Object> result = mdcBoardService.rateAnalysisTrendDay(equipmentId);
        return Result.OK(result);
    }
    @ApiOperation(value = "MDC首页接口-设备月率分析合格率", notes = "MDC首页接口-设备月率分析合格率")
    @GetMapping("/rateAnalysisTrendMonth")
    public Result<?> rateAnalysisTrendMonth(@RequestParam(name = "equipmentId", required = true) String equipmentId) {
        Map<String, Object> result = mdcBoardService.rateAnalysisTrendMonth(equipmentId);
        return Result.OK(result);
    }
//    @ApiOperation(value = "MDC首页接口-设备产品合格率", notes = "MDC首页接口-设备产品合格率")
//    @GetMapping("/passRate")
//    public Result<?> passRate(@RequestParam(name = "equipmentId", required = true) String equipmentId) {
//        Map<String, Object> result = mdcBoardService.passRate(equipmentId);
//        return Result.OK(result);
//    }
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentStatisticalInfoMapper.java
@@ -5,6 +5,8 @@
import org.jeecg.modules.mdc.dto.MdcEquipmentStatisticalDto;
import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalInfo;
import java.util.List;
/**
 * @Description: è®¾å¤‡å•日运行数据表
 * @Author: jeecg-boot
@@ -28,4 +30,10 @@
    Integer selectProcessLong(@Param("equipmentId") String equipmentId, @Param("validDate") String validDate);
    MdcEquipmentStatisticalDto findByEquipmentAndMonth(@Param("equipmentId") String equipmentId, @Param("date") String date);
    MdcEquipmentStatisticalInfo findByEquipmentAndDate(@Param("equipmentList") List<String> equipmentList, @Param("date") String date);
    MdcEquipmentStatisticalInfo findByEquIdAndDate(@Param("equipmentId") String equipmentId, @Param("date") String date);
    MdcEquipmentStatisticalInfo findByEquIdAndMonth(@Param("equipmentId") String equipmentId, @Param("month") String month);
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcOeeInfoMapper.java
@@ -7,6 +7,9 @@
import org.jeecg.modules.mdc.entity.MdcOeeInfo;
import org.jeecg.modules.mdc.vo.MdcOeeInfoVo;
import java.math.BigDecimal;
import java.util.List;
/**
 * @Description: OEE表
 * @Author: lius
@@ -22,4 +25,10 @@
     * @return
     */
    IPage<MdcOeeInfo> pageList(Page<MdcOeeInfo> page, @Param("mdcOeeInfoVo") MdcOeeInfoVo mdcOeeInfoVo);
    BigDecimal findByEquIdsAndDate(@Param("equipmentIdList") List<String> equipmentIdList, @Param("date") String date);
    BigDecimal findByEquIdAndDate(@Param("equipmentId") String equipmentId, @Param("date") String date);
    BigDecimal findByEquIdAndMonth(@Param("equipmentId") String equipmentId, @Param("month") String month);
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentStatisticalInfoMapper.xml
@@ -26,4 +26,42 @@
        WHERE
            equipment_id = #{equipmentId} AND the_date LIKE CONCAT(#{date}, '%')
    </select>
    <select id="findByEquipmentAndDate" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalInfo">
        SELECT
            the_date,
            AVG ( open_long ) openLong,
            AVG ( wait_long ) waitLong,
            AVG ( process_long ) processLong,
            AVG ( close_long ) closeLong,
            AVG ( error_long ) errorLong
        FROM
            mdc_equipment_statistical_info
        <where>
            the_date = #{date}
            AND equipment_id IN
            <foreach collection="equipmentList" index="index" item="id" open="(" separator="," close=")">
                #{id}
            </foreach>
        </where>
        GROUP BY
            the_date
    </select>
    <select id="findByEquIdAndDate" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalInfo">
        SELECT TOP 1 * FROM mdc_equipment_statistical_info WHERE equipment_id = #{equipmentId} AND the_date = #{date}
    </select>
    <select id="findByEquIdAndMonth" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalInfo">
        SELECT
            AVG(open_long) openLong,
            AVG(close_long) closeLong,
            AVG(wait_long) waitLong,
            AVG(process_long) processLong,
            AVG(error_long) errorLong
        FROM
            mdc_equipment_statistical_info
        WHERE
            equipment_id = #{equipmentId} AND the_date LIKE CONCAT(#{month}, '%')
    </select>
</mapper>
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcOeeInfoMapper.xml
@@ -27,4 +27,32 @@
        </where>
        ORDER BY the_date DESC, equipment_id ASC
    </select>
    <select id="findByEquIdsAndDate" resultType="java.math.BigDecimal">
        SELECT
            AVG ( oee )
        FROM
            mdc_oee_info
        <where>
            the_date = #{date}
            AND equipment_id IN
            <foreach collection="equipmentIdList" item="id" index="index" open="(" close=")" separator=",">
                #{ id }
            </foreach>
        </where>
    </select>
    <select id="findByEquIdAndDate" resultType="java.math.BigDecimal">
        SELECT oee FROM mdc_oee_info WHERE the_date = #{date} AND equipment_id = #{equipmentId}
    </select>
    <select id="findByEquIdAndMonth" resultType="java.math.BigDecimal">
        SELECT
            AVG(oee)
        FROM
            mdc_oee_info
        WHERE
            the_date LIKE CONCAT(#{month}, '%')
          AND equipment_id = #{equipmentId}
    </select>
</mapper>
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcBoardService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,49 @@
package org.jeecg.modules.mdc.service;
import org.jeecg.modules.mdc.entity.MdcEquipment;
import org.jeecg.modules.system.entity.MdcProduction;
import java.util.List;
import java.util.Map;
/**
 * @Author: Lius
 * @CreateTime: 2025-05-06
 * @Description: çœ‹æ¿æŽ¥å£
 */
public interface IMdcBoardService {
    /**
     * è®¾å¤‡çŠ¶æ€
     */
    Map<String, Object> equipmentStatusStatistics(String productionId);
    /**
     * èŽ·å–è½¦é—´åˆ—è¡¨
     */
    List<MdcProduction> proList(String productionId);
    /**
     * çŽ‡åˆ†æžèµ°åŠ¿
     */
    Map<String, Object> rateAnalysisTrend(String productionId);
    /**
     * è®¾å¤‡åˆ—表
     */
    List<MdcEquipment> equipmentList(String productionId);
    /**
     * è®¾å¤‡æ—¥åˆ©ç”¨çŽ‡åˆ†æž
     */
    Map<String, Object> rateAnalysisTrendDay(String equipmentId);
    /**
     * è®¾å¤‡æœˆçŽ‡åˆ†æž
     */
    Map<String, Object> rateAnalysisTrendMonth(String equipmentId);
//    /**
//     * è®¾å¤‡äº§å“åˆæ ¼çއ
//     */
//    Map<String, Object> passRate(String equipmentId);
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentStatisticalInfoService.java
@@ -1,8 +1,11 @@
package org.jeecg.modules.mdc.service;
import org.jeecg.modules.mdc.dto.MdcEquipmentStatisticalDto;
import org.jeecg.modules.mdc.entity.Equipment;
import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalInfo;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
 * @Description: è®¾å¤‡å•日运行数据表
@@ -29,4 +32,10 @@
    Integer selectProcessLong(String equipmentId, String validDate);
    MdcEquipmentStatisticalDto findByEquipmentAndMonth(String equipmentId, String date);
    MdcEquipmentStatisticalInfo findByEquipmentAndDate(List<String> equipmentList, String date);
    MdcEquipmentStatisticalInfo findByEquIdAndDate(String equipmentId, String date);
    MdcEquipmentStatisticalInfo findByEquIdAndMonth(String equipmentId, String month);
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcOeeInfoService.java
@@ -9,6 +9,8 @@
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.List;
/**
 * @Description: OEE表
@@ -44,4 +46,9 @@
     */
    void computeOee(MdcOeeComputeVo mdcOeeComputeVo);
    BigDecimal findByEquIdsAndDate(List<String> equipmentIdList, String date);
    BigDecimal findByEquIdAndDate(String equipmentId, String date);
    BigDecimal findByEquIdAndMonth(String equipmentId, String month);
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/EquipmentWorkLineServiceImpl.java
@@ -55,8 +55,8 @@
    }
    @Override
    public List<EquipmentMachingDto> getEquipProgramNum(String drivetype, String equipmentid, Date startTime, Date endTime) {
        return equipmentWorkLineMapper.getEquipProgramNum(drivetype + "_" + equipmentid, startTime, endTime);
    public List<EquipmentMachingDto> getEquipProgramNum(String saveTableName, Date startTime, Date endTime) {
        return equipmentWorkLineMapper.getEquipProgramNum(saveTableName, startTime, endTime);
    }
    @Override
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcBoardServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,265 @@
package org.jeecg.modules.mdc.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.modules.mdc.constant.MdcConstant;
import org.jeecg.modules.mdc.entity.Equipment;
import org.jeecg.modules.mdc.entity.MdcEquipment;
import org.jeecg.modules.mdc.entity.MdcEquipmentStatisticalInfo;
import org.jeecg.modules.mdc.service.*;
import org.jeecg.modules.mdc.util.DateUtils;
import org.jeecg.modules.mdc.vo.MdcBoardRateVo;
import org.jeecg.modules.mdc.vo.MdcEquipmentStatusVo;
import org.jeecg.modules.mdcJc.service.IMdcJcRcJobreportService;
import org.jeecg.modules.system.entity.MdcProduction;
import org.jeecg.modules.system.service.IMdcProductionService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDate;
import java.util.*;
import java.util.stream.Collectors;
/**
 * @Author: Lius
 * @CreateTime: 2025-05-06
 * @Description: çœ‹æ¿æŽ¥å£
 */
@Service
public class MdcBoardServiceImpl implements IMdcBoardService {
    @Resource
    private IMdcProductionService mdcProductionService;
    @Resource
    private IEquipmentService equipmentService;
    @Resource
    private IMdcEquipmentService mdcEquipmentService;
    @Resource
    private IMdcEquipmentStatisticalInfoService mdcEquipmentStatisticalInfoService;
    @Resource
    private IMdcOeeInfoService mdcOeeInfoService;
    @Resource
    private IMdcJcRcJobreportService mdcJcRcJobreportService;
    /**
     * è®¾å¤‡çŠ¶æ€
     */
    @Override
    public Map<String, Object> equipmentStatusStatistics(String productionId) {
        Map<String, Object> result = new HashMap<>();
        if (StringUtils.isBlank(productionId)) {
            MdcProduction mdcProduction = mdcProductionService.getOne(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getParentId, ""));
            productionId = mdcProduction.getId();
            result.put("productionName", mdcProduction.getProductionName());
        } else {
            MdcProduction mdcProduction = mdcProductionService.getById(productionId);
            result.put("productionName", mdcProduction.getProductionName());
        }
        List<String> proIds = mdcProductionService.findChildByProId(productionId);
        if (proIds == null || proIds.isEmpty()) {
            return result;
        }
        List<Equipment> equipmentList = equipmentService.listByProds(proIds);
        if (equipmentList == null || equipmentList.isEmpty()) {
            return result;
        }
        MdcEquipmentStatusVo mdcEquipmentStatusVo = new MdcEquipmentStatusVo();
        for (Equipment equipment : equipmentList) {
            if (equipment.getOporation() != null) {
                switch (equipment.getOporation()) {
                    case 1:
                    case 2:
                        mdcEquipmentStatusVo.setWaitCount(mdcEquipmentStatusVo.getWaitCount() + 1);
                        break;
                    case 3:
                        mdcEquipmentStatusVo.setRunCount(mdcEquipmentStatusVo.getRunCount() + 1);
                        break;
                    case 22:
                        mdcEquipmentStatusVo.setAlarmCount(mdcEquipmentStatusVo.getAlarmCount() + 1);
                        break;
                    default:
                        mdcEquipmentStatusVo.setCloseCount(mdcEquipmentStatusVo.getCloseCount() + 1);
                        break;
                }
            } else {
                mdcEquipmentStatusVo.setCloseCount(mdcEquipmentStatusVo.getCloseCount() + 1);
            }
        }
        result.put("equipmentStatus", mdcEquipmentStatusVo);
        return result;
    }
    /**
     * èŽ·å–äº§çº¿åˆ—è¡¨
     */
    @Override
    public List<MdcProduction> proList(String productionId) {
        if (StringUtils.isBlank(productionId)) {
            MdcProduction mdcProduction = mdcProductionService.getOne(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getParentId, ""));
            productionId = mdcProduction.getId();
        }
        return mdcProductionService.list(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getParentId, productionId).eq(MdcProduction::getMdcFlag, "1").eq(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_0).orderByAsc(MdcProduction::getProductionOrder));
    }
    /**
     * çŽ‡åˆ†æžèµ°åŠ¿
     */
    @Override
    public Map<String, Object> rateAnalysisTrend(String productionId) {
        Map<String, Object> result = new HashMap<>();
        if (StringUtils.isBlank(productionId)) {
            MdcProduction mdcProduction = mdcProductionService.getOne(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getParentId, ""));
            productionId = mdcProduction.getId();
        }
        List<String> proIds = mdcProductionService.findChildByProId(productionId);
        if (proIds == null || proIds.isEmpty()) {
            return result;
        }
        List<String> equipmentIdList = mdcEquipmentService.getEquIdsByProIds(proIds);
        if (equipmentIdList == null || equipmentIdList.isEmpty()) {
            return result;
        }
        LocalDate now = LocalDate.now();
        Date startDate = DateUtils.toDate(now.plusDays(-15).toString(), DateUtils.STR_DATE);
        Date endDate = DateUtils.toDate(now.plusDays(-1).toString(), DateUtils.STR_DATE);
        List<String> dateList = DateUtils.getDatesStringList(startDate, endDate);
        List<String> dates = new ArrayList<>();
        List<MdcBoardRateVo> dataList = new ArrayList<>();
        for (String date : dateList) {
            MdcBoardRateVo mdcBoardRateVo = new MdcBoardRateVo();
            String s = date.substring(5, 10);
            dates.add(s);
            mdcBoardRateVo.setDate(s);
            // TEEP å¼€æœºçއ å¼€åŠ¨çŽ‡
            MdcEquipmentStatisticalInfo mdcEquipmentStatisticalInfo = mdcEquipmentStatisticalInfoService.findByEquipmentAndDate(equipmentIdList, date.replaceAll("-", ""));
            mdcBoardRateVo.setUtilizationRate(mdcEquipmentStatisticalInfo.getProcessLong().divide(new BigDecimal("864"), 2, RoundingMode.HALF_UP));
            mdcBoardRateVo.setOpenRate(mdcEquipmentStatisticalInfo.getOpenLong().divide(new BigDecimal("864"), 2, RoundingMode.HALF_UP));
            if (mdcEquipmentStatisticalInfo.getOpenLong().compareTo(BigDecimal.ZERO) > 0) {
                mdcBoardRateVo.setStartRate(mdcEquipmentStatisticalInfo.getProcessLong().divide(mdcEquipmentStatisticalInfo.getOpenLong(), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")));
            }
            // OEE
            BigDecimal oee = mdcOeeInfoService.findByEquIdsAndDate(equipmentIdList, date);
            if (oee != null) {
                mdcBoardRateVo.setOee(oee.setScale(2, RoundingMode.HALF_UP));
            }
            dataList.add(mdcBoardRateVo);
        }
        result.put("dateList", dates);
        result.put("dataList", dataList);
        return result;
    }
    /**
     * è®¾å¤‡åˆ—表
     */
    @Override
    public List<MdcEquipment> equipmentList(String productionId) {
        List<String> proIds = mdcProductionService.findChildByProId(productionId);
        if (proIds == null || proIds.isEmpty()) {
            return null;
        }
        return mdcEquipmentService.findByProIds(proIds);
    }
    /**
     * è®¾å¤‡æ—¥åˆ©ç”¨çŽ‡åˆ†æž
     */
    @Override
    public Map<String, Object> rateAnalysisTrendDay(String equipmentId) {
        Map<String, Object> result = new HashMap<>();
        LocalDate now = LocalDate.now();
        Date startDate = DateUtils.toDate(now.plusDays(-7).toString(), DateUtils.STR_DATE);
        Date endDate = DateUtils.toDate(now.plusDays(-1).toString(), DateUtils.STR_DATE);
        List<String> dayBetween = DateUtils.getDatesStringList(startDate, endDate);
        List<String> dateList = new ArrayList<>();
        List<MdcBoardRateVo> dataList = new ArrayList<>();
        for (String date : dayBetween) {
            MdcBoardRateVo mdcBoardRateVo = new MdcBoardRateVo();
            String s = date.substring(5, 10);
            dateList.add(s);
            mdcBoardRateVo.setDate(s);
            // TEEP
            MdcEquipmentStatisticalInfo mdcEquipmentStatisticalInfo = mdcEquipmentStatisticalInfoService.findByEquIdAndDate(equipmentId, date.replaceAll("-", ""));
            mdcBoardRateVo.setUtilizationRate(mdcEquipmentStatisticalInfo.getProcessLong().divide(new BigDecimal("864"), 2, RoundingMode.HALF_UP));
            // OEE
            BigDecimal oee = mdcOeeInfoService.findByEquIdAndDate(equipmentId, date);
            if (oee != null) {
                mdcBoardRateVo.setOee(oee.setScale(2, RoundingMode.HALF_UP));
            }
            dataList.add(mdcBoardRateVo);
        }
        result.put("dateList", dateList);
        result.put("dataList", dataList);
        return result;
    }
    /**
     * è®¾å¤‡æœˆçŽ‡åˆ†æž
     */
    @Override
    public Map<String, Object> rateAnalysisTrendMonth(String equipmentId) {
        Map<String, Object> result = new HashMap<>();
        LocalDate now = LocalDate.now();
        Date start = DateUtils.toDate(now.plusMonths(-6).toString(), DateUtils.STR_DATE);
        Date end = DateUtils.toDate(now.plusMonths(-1).toString(), DateUtils.STR_DATE);
        List<String> monthBetween = DateUtils.getMonthBetween(start, end);
        List<String> dateList = new ArrayList<>();
        List<MdcBoardRateVo> dataList = new ArrayList<>();
        for (String month : monthBetween) {
            String name = month.substring(month.lastIndexOf("-") + 1).replaceFirst("^0*", "") + "月";
            dateList.add(name);
            MdcBoardRateVo mdcBoardRateVo = new MdcBoardRateVo();
            mdcBoardRateVo.setDate(name);
            // TEEP
            MdcEquipmentStatisticalInfo mdcEquipmentStatisticalInfo = mdcEquipmentStatisticalInfoService.findByEquIdAndMonth(equipmentId, month.replaceAll("-", ""));
            if (mdcEquipmentStatisticalInfo != null) {
                mdcBoardRateVo.setUtilizationRate(mdcEquipmentStatisticalInfo.getProcessLong().divide(new BigDecimal("864"), 2, RoundingMode.HALF_UP));
            }
            // OEE
            BigDecimal oee = mdcOeeInfoService.findByEquIdAndMonth(equipmentId, month);
            if (oee != null) {
                mdcBoardRateVo.setOee(oee.setScale(2, RoundingMode.HALF_UP));
            }
            // åˆæ ¼çއ
            BigDecimal passRate = mdcJcRcJobreportService.findRateByMonth(equipmentId, month);
            if (passRate != null) {
                mdcBoardRateVo.setPassRate(passRate);
            }
            dataList.add(mdcBoardRateVo);
        }
        result.put("dateList", dateList);
        result.put("dataList", dataList);
        return result;
    }
//    /**
//     * è®¾å¤‡äº§å“åˆæ ¼çއ
//     */
//    @Override
//    public Map<String, Object> passRate(String equipmentId) {
//        Map<String, Object> result = new HashMap<>();
//        LocalDate now = LocalDate.now();
//        Date start = DateUtils.toDate(now.plusMonths(-6).toString(), DateUtils.STR_DATE);
//        Date end = DateUtils.toDate(now.plusMonths(-1).toString(), DateUtils.STR_DATE);
//        List<String> monthBetween = DateUtils.getMonthBetween(start, end);
//        List<String> dateList = new ArrayList<>();
//        for (String month : monthBetween) {
//            String name = month.substring(month.lastIndexOf("-") + 1).replaceFirst("^0*", "") + "月";
//            dateList.add(name);
//            MdcBoardRateVo mdcBoardRateVo = new MdcBoardRateVo();
//            // åˆæ ¼çއ
//
//        }
//        return result;
//    }
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentRunningSectionServiceImpl.java
@@ -553,13 +553,13 @@
            if (e.getStatus() == 3) {
                equip = equipmentService.getOne(new LambdaQueryWrapper<Equipment>().eq(Equipment::getEquipmentid, e.getEquipmentId()));
                if (StringUtils.isNotBlank(equip.getDrivetype()) && equip.getDrivetype().startsWith("FANUC")) {
                    List<EquipmentMachingDto> esList = equipmentWorkLineService.getEquipProgramNum(equip.getDrivetype(), equip.getEquipmentid(),
                    List<EquipmentMachingDto> esList = equipmentWorkLineService.getEquipProgramNum(equip.getSavetablename(),
                            e.getStartTime(), e.getEndTime());
                    if (esList != null && esList.size() > 1) {
                        e.setSequenceNumber(esList.get(0).getProgramnumber());
                    }
                } else if (StringUtils.isNotBlank(equip.getDrivetype()) && equip.getDrivetype().startsWith("SIEMENS")) {
                    List<EquipmentMachingDto> esList = equipmentWorkLineService.getEquipmentSequencenumber(equip.getDrivetype() + "_" + equip.getEquipmentid(), e.getStartTime(), e.getEndTime());
                    List<EquipmentMachingDto> esList = equipmentWorkLineService.getEquipmentSequencenumber(equip.getSavetablename(), e.getStartTime(), e.getEndTime());
                    if (esList != null && esList.size() > 1) {
                        e.setSequenceNumber(esList.get(0).getSequencenumber());
                    }
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentStatisticalInfoServiceImpl.java
@@ -323,4 +323,19 @@
    public MdcEquipmentStatisticalDto findByEquipmentAndMonth(String equipmentId, String date) {
        return this.baseMapper.findByEquipmentAndMonth(equipmentId, date);
    }
    @Override
    public MdcEquipmentStatisticalInfo findByEquipmentAndDate(List<String> equipmentList, String date) {
        return this.baseMapper.findByEquipmentAndDate(equipmentList, date);
    }
    @Override
    public MdcEquipmentStatisticalInfo findByEquIdAndDate(String equipmentId, String date) {
        return this.baseMapper.findByEquIdAndDate(equipmentId, date);
    }
    @Override
    public MdcEquipmentStatisticalInfo findByEquIdAndMonth(String equipmentId, String month) {
        return this.baseMapper.findByEquIdAndMonth(equipmentId, month);
    }
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcOeeInfoServiceImpl.java
@@ -262,4 +262,19 @@
        super.saveBatch(result);
    }
    @Override
    public BigDecimal findByEquIdsAndDate(List<String> equipmentIdList, String date) {
        return this.baseMapper.findByEquIdsAndDate(equipmentIdList, date);
    }
    @Override
    public BigDecimal findByEquIdAndDate(String equipmentId, String date) {
        return this.baseMapper.findByEquIdAndDate(equipmentId, date);
    }
    @Override
    public BigDecimal findByEquIdAndMonth(String equipmentId, String month) {
        return this.baseMapper.findByEquIdAndMonth(equipmentId, month);
    }
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/vo/MdcBoardRateVo.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,40 @@
package org.jeecg.modules.mdc.vo;
import lombok.Data;
import java.math.BigDecimal;
/**
 * @Author: Lius
 * @CreateTime: 2025-05-07
 * @Description: çŽ‡åˆ†æžèµ°åŠ¿vo
 */
@Data
public class MdcBoardRateVo {
    /**
     * æ—¥æœŸ MM-dd
     */
    private String date;
    /**
     * åˆ©ç”¨çއ
     */
    private BigDecimal utilizationRate = BigDecimal.ZERO;
    /**
     * å¼€åŠ¨çŽ‡
     */
    private BigDecimal startRate = BigDecimal.ZERO;
    /**
     * å¼€æœºçއ
     */
    private BigDecimal openRate = BigDecimal.ZERO;
    /**
     * OEE
     */
    private BigDecimal oee = BigDecimal.ZERO;
    /**
     * åˆæ ¼çއ
     */
    private BigDecimal passRate = BigDecimal.ZERO;
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdcJc/mapper/MdcJcRcJobreportMapper.java
@@ -18,4 +18,5 @@
    Integer selectTotalPassCount(@Param("equipmentId") String equipmentId, @Param("date") String validDate);
    MesRcJobreport findRateByMonth(@Param("equipmentId") String equipmentId, @Param("month") String month);
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdcJc/mapper/xml/MdcJcRcJobreportMapper.xml
@@ -3,11 +3,22 @@
<mapper namespace="org.jeecg.modules.mdcJc.mapper.MdcJcRcJobreportMapper">
    <select id="selectTotalProcessCount" resultType="java.lang.Integer">
        SELECT okuqty + nookqty FROM mdcJc_rc_jobreport WHERE equipment_id = #{equipmentId} AND the_date = #{date}
        SELECT process_count FROM mdcJc_rc_jobreport WHERE equipment_id = #{equipmentId} AND the_date = #{date}
    </select>
    <select id="selectTotalPassCount" resultType="java.lang.Integer">
        SELECT okuqty FROM mdcJc_rc_jobreport WHERE equipment_id = #{equipmentId} AND the_date = #{date}
    </select>
    <select id="findRateByMonth" resultType="org.jeecg.modules.mdcJc.dto.MesRcJobreport">
        SELECT
            SUM(okuqty) okuqty,
            SUM(process_count) qty
        FROM
            mdcJc_rc_jobreport
        WHERE
            equipment_id = #{equipmentId}
          AND the_date LIKE CONCAT(#{month}, '%')
    </select>
</mapper>
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdcJc/service/IMdcJcRcJobreportService.java
@@ -4,6 +4,7 @@
import org.jeecg.modules.mdcJc.dto.MesRcJobreport;
import org.jeecg.modules.mdcJc.entity.MdcJcRcJobreport;
import java.math.BigDecimal;
import java.util.List;
/**
@@ -17,4 +18,5 @@
    Integer selectTotalPassCount(String equipmentId, String validDate);
    BigDecimal findRateByMonth(String equipmentId, String month);
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdcJc/service/impl/MdcJcRcJobreportServiceImpl.java
@@ -11,6 +11,8 @@
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.List;
/**
@@ -42,4 +44,14 @@
        }
    }
    @Override
    public BigDecimal findRateByMonth(String equipmentId, String month) {
        BigDecimal rate = BigDecimal.ZERO;
        MesRcJobreport mesRcJobreport = this.baseMapper.findRateByMonth(equipmentId, month);
        if (mesRcJobreport != null && mesRcJobreport.getQty().compareTo(BigDecimal.ZERO) > 0) {
            rate = mesRcJobreport.getOkuqty().divide(mesRcJobreport.getQty(), 2, RoundingMode.HALF_UP);
        }
        return rate;
    }
}
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/MdcProductionMapper.java
@@ -61,4 +61,7 @@
    List<String> findTeamValue(@Param("userId") String userId, @Param("productionList") List<String> productionList);
    List<String> findProIdsByUId(@Param("userId") String userId, @Param("allProductionIds") List<String> allProductionIds);
    List<String> findChildByProId(@Param("productionId") String productionId);
}
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/mapper/xml/MdcProductionMapper.xml
@@ -138,4 +138,26 @@
            </foreach>
          AND user_id = #{userId}
    </select>
    <select id="findChildByProId" resultType="java.lang.String">
        WITH temp ( id ) AS (
            SELECT
                id
            FROM
                mdc_production
            WHERE
                id = #{ productionId }
              AND mdc_flag = '1' UNION ALL
            SELECT
                a.id
            FROM
                mdc_production a
                    INNER JOIN temp ON a.parent_id = temp.id
            WHERE
                a.mdc_flag = '1'
        ) SELECT
            *
        FROM
            temp
    </select>
</mapper>
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/IMdcProductionService.java
@@ -175,4 +175,12 @@
     * @return
     */
    List<String> findProIdsByUId(String userId, List<String> allProductionIds);
    /**
     *
     * @param productionId
     * @return
     */
    List<String> findChildByProId(String productionId);
}
lxzn-module-system/lxzn-system-biz/src/main/java/org/jeecg/modules/system/service/impl/MdcProductionServiceImpl.java
@@ -600,6 +600,11 @@
        return this.baseMapper.findProIdsByUId(userId, allProductionIds);
    }
    @Override
    public List<String> findChildByProId(String productionId) {
        return this.baseMapper.findChildByProId(productionId);
    }
    /**
     * æ‰“å¼€ çˆ¶èŠ‚ç‚¹ åŠ ä»¥ä¸Šçš„mdc标记
     * @param parentId