Lius
2024-08-27 8ff9cd39e12be7730b4b9e6dc63e33113ded0219
update
已添加6个文件
已修改2个文件
254 ■■■■■ 文件已修改
lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/controller/MdcLargeScreenController.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/controller/MdcSubLargeScreenController.java 53 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/dto/MdcProductDayscheduleDto.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/mapper/MdcSubLargeScreenMapper.java 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/mapper/xml/MdcSubLargeScreenMapper.xml 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/service/MdcSubLargeScreenService.java 29 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/service/impl/MdcLargeScreenServiceImpl.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/service/impl/MdcSubLargeScreenServiceImpl.java 81 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/controller/MdcLargeScreenController.java
@@ -13,7 +13,6 @@
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
/**
 * @author Lius
lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/controller/MdcSubLargeScreenController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,53 @@
package org.jeecg.modules.screen.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.MdcEquipmentMonitor;
import org.jeecg.modules.mdcJc.entity.MdcProductDayschedule;
import org.jeecg.modules.screen.dto.MdcProductDayscheduleDto;
import org.jeecg.modules.screen.service.MdcSubLargeScreenService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
/**
 * @author Lius
 * @date 2024/8/26 14:57
 */
@Slf4j
@Api(tags = "分控看板")
@RestController
@RequestMapping("/mdc/subLargeScreen")
public class MdcSubLargeScreenController {
    @Resource
    private MdcSubLargeScreenService mdcSubLargeScreenService;
    @ApiOperation(value = "分控看板-当日生产进度", notes = "分控看板-当日生产进度")
    @GetMapping("/todayProductionProgress")
    public Result<?> todayProductionProgress(String productionId) {
        List<MdcProductDayscheduleDto> result = mdcSubLargeScreenService.todayProductionProgress(productionId);
        return Result.ok(result);
    }
    @ApiOperation(value = "分控看板-设备实时状态", notes = "分控看板-设备实时状态")
    @GetMapping("/equipmentStatus")
    public Result<?> equipmentStatus(String productionId) {
        List<MdcEquipmentMonitor> result = mdcSubLargeScreenService.equipmentStatus(productionId);
        return Result.ok(result);
    }
//    @ApiOperation(value = "分控看板-设备实时状态", notes = "分控看板-设备实时状态")
//    @GetMapping("/equipmentStatus")
//    public Result<?> equipmentStatus(String productionId) {
//        List<MdcEquipmentMonitor> result = mdcSubLargeScreenService.equipmentStatus(productionId);
//        return Result.ok(result);
//    }
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/dto/MdcProductDayscheduleDto.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,20 @@
package org.jeecg.modules.screen.dto;
import lombok.Data;
import org.jeecg.modules.mdcJc.entity.MdcProductDayschedule;
import java.math.BigDecimal;
/**
 * @author Lius
 * @date 2024/8/26 16:27
 */
@Data
public class MdcProductDayscheduleDto extends MdcProductDayschedule {
    /**
     * äº§å“åˆæ ¼çއ
     */
    private BigDecimal passRate = BigDecimal.ZERO;
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/mapper/MdcSubLargeScreenMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,34 @@
package org.jeecg.modules.screen.mapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.mdc.entity.MdcEquipmentMonitor;
import org.jeecg.modules.screen.dto.MdcProductDayscheduleDto;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
 * @author Lius
 * @date 2024/8/26 15:02
 */
@Mapper
@Repository
public interface MdcSubLargeScreenMapper {
    /**
     * å½“日生产计划
     *
     * @param productionId
     * @param date
     * @return
     */
    List<MdcProductDayscheduleDto> todayProductionProgress(@Param("productionId") String productionId, @Param("date") String date);
    /**
     * è®¾å¤‡å®žæ—¶çŠ¶æ€
     *
     * @param productionId
     * @return
     */
    List<MdcEquipmentMonitor> checkStatusFromEquipmentIds(@Param("productionId") String productionId);
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/mapper/xml/MdcSubLargeScreenMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,35 @@
<?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="org.jeecg.modules.screen.mapper.MdcSubLargeScreenMapper">
    <!--当日生产计划-->
    <select id="todayProductionProgress" resultType="org.jeecg.modules.screen.dto.MdcProductDayscheduleDto">
        SELECT
            t1.*
        FROM
            mdcJc_ProductDayschedule 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 = #{productionId}
            AND planDate = #{date}
    </select>
    <!--设备实时状态-->
    <select id="checkStatusFromEquipmentIds" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentMonitor">
        SELECT
            t1.equipment_id,
            t2.CollectTime,
            t1.equipment_name,
            t2.Oporation,
            t1.id,
            t1.equipment_status,
            t1.equipment_type equipmentType
        FROM
            mdc_equipment t1
                LEFT JOIN Equipment t2 ON t1.equipment_id = t2.EquipmentID
                LEFT JOIN mdc_production_equipment t3 ON t1.id = t3.equipment_id
        WHERE
            t3.production_id  = #{productionId}
    </select>
</mapper>
lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/service/MdcSubLargeScreenService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,29 @@
package org.jeecg.modules.screen.service;
import org.jeecg.modules.mdc.entity.MdcEquipmentMonitor;
import org.jeecg.modules.screen.dto.MdcProductDayscheduleDto;
import java.util.List;
/**
 * @author Lius
 * @date 2024/8/26 15:00
 */
public interface MdcSubLargeScreenService {
    /**
     * å½“日生产进度
     *
     * @param productionId
     * @return
     */
    List<MdcProductDayscheduleDto> todayProductionProgress(String productionId);
    /**
     * è®¾å¤‡å®žæ—¶çŠ¶æ€
     *
     * @param productionId
     * @return
     */
    List<MdcEquipmentMonitor> equipmentStatus(String productionId);
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/service/impl/MdcLargeScreenServiceImpl.java
@@ -3,7 +3,6 @@
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.jeecg.common.constant.CommonConstant;
import org.jeecg.modules.mdc.dto.MdcEfficiencyDto;
import org.jeecg.modules.mdc.service.IMdcEquipmentStatisticalInfoService;
import org.jeecg.modules.mdcJc.entity.MdcProductDayschedule;
import org.jeecg.modules.mdcJc.service.IMdcProductDayScheduleService;
import org.jeecg.modules.screen.dto.*;
lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/service/impl/MdcSubLargeScreenServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,81 @@
package org.jeecg.modules.screen.service.impl;
import org.jeecg.modules.mdc.entity.MdcEquipmentMonitor;
import org.jeecg.modules.screen.dto.MdcProductDayscheduleDto;
import org.jeecg.modules.screen.mapper.MdcSubLargeScreenMapper;
import org.jeecg.modules.screen.service.MdcSubLargeScreenService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;
/**
 * @author Lius
 * @date 2024/8/26 15:01
 */
@Service
public class MdcSubLargeScreenServiceImpl implements MdcSubLargeScreenService {
    @Resource
    private MdcSubLargeScreenMapper mdcSubLargeScreenMapper;
    private final String today = LocalDate.now().toString();
    /**
     * å½“日生产计划
     *
     * @param productionId
     * @return
     */
    @Override
    public List<MdcProductDayscheduleDto> todayProductionProgress(String productionId) {
        List<MdcProductDayscheduleDto> mdcProductDayscheduleDtos = new ArrayList<>();
        mdcProductDayscheduleDtos = mdcSubLargeScreenMapper.todayProductionProgress(productionId, today);
        if (mdcProductDayscheduleDtos != null && !mdcProductDayscheduleDtos.isEmpty()) {
            for (MdcProductDayscheduleDto mdcProductDayscheduleDto : mdcProductDayscheduleDtos) {
                mdcProductDayscheduleDto.setPassRate(new BigDecimal(mdcProductDayscheduleDto.getQualifiedCount()).divide(new BigDecimal(mdcProductDayscheduleDto.getCompletionCount()), 0, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP));
            }
        }
        return mdcProductDayscheduleDtos;
    }
    /**
     * è®¾å¤‡å®žæ—¶çŠ¶æ€
     *
     * @param productionId
     * @return
     */
    @Override
    public List<MdcEquipmentMonitor> equipmentStatus(String productionId) {
        List<MdcEquipmentMonitor> result = mdcSubLargeScreenMapper.checkStatusFromEquipmentIds(productionId);
        if (result != null && !result.isEmpty()) {
            for (MdcEquipmentMonitor mdcEquipmentMonitor : result) {
                if (mdcEquipmentMonitor.getOporation() != null) {
                    switch (mdcEquipmentMonitor.getOporation()) {
                        case 1:
                        case 2:
                            mdcEquipmentMonitor.setOporationDict("待机");
                            break;
                        case 3:
                            mdcEquipmentMonitor.setOporationDict("运行");
                            break;
                        case 22:
                            mdcEquipmentMonitor.setOporationDict("报警");
                            break;
                        default:
                            mdcEquipmentMonitor.setOporationDict("关机");
                            break;
                    }
                } else {
                    mdcEquipmentMonitor.setOporationDict("关机");
                    mdcEquipmentMonitor.setOporation(0);
                }
            }
        }
        return result;
    }
}