cuilei
8 天以前 b7eab0dfd01f691efa10980aebc872fa872cb8ea
Merge remote-tracking branch 'origin/master'
已修改4个文件
71 ■■■■■ 文件已修改
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcDowntimeController.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcDowntime.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcDowntimeServiceImpl.java 31 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcOeeInfoServiceImpl.java 25 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcDowntimeController.java
@@ -1,6 +1,7 @@
package org.jeecg.modules.mdc.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
@@ -73,6 +74,9 @@
        if (StringUtils.isBlank(mdcDowntime.getEquipmentIds())) {
            return Result.error("未选择设备,请排查");
        }
        if (CollectionUtils.isEmpty(mdcDowntime.getDateList())) {
            return Result.error("未选择日期,请排查");
        }
        boolean flag = mdcDowntimeService.saveDowntime(mdcDowntime);
        return flag ? Result.ok("添加成功") : Result.error("添加失败");
    }
@@ -87,9 +91,6 @@
    @ApiOperation(value = "待机停机表-编辑", notes = "待机停机表-编辑")
    @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
    public Result<?> edit(@RequestBody MdcDowntime mdcDowntime) {
//        if (mdcDowntime.getReasonId() != null) {
//            mdcDowntime.setStatus(CommonConstant.DOWNTIME_STATUS_1);
//        }
        mdcDowntimeService.updateById(mdcDowntime);
        return Result.OK("编辑成功!");
    }
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcDowntime.java
@@ -2,19 +2,16 @@
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecg.common.aspect.annotation.Dict;
import org.jeecg.common.system.base.entity.JeecgEntity;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
 * @Description: 待机停机表
@@ -71,4 +68,7 @@
    @TableField(exist = false)
    private String equipmentIds;
    @TableField(exist = false)
    private List<String> dateList;
}
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcDowntimeServiceImpl.java
@@ -7,20 +7,18 @@
import org.jeecg.modules.mdc.dto.MdcDowntimeDto;
import org.jeecg.modules.mdc.entity.MdcDowntime;
import org.jeecg.modules.mdc.entity.MdcEquipment;
import org.jeecg.modules.mdc.entity.MdcStandardProcessDuration;
import org.jeecg.modules.mdc.mapper.MdcDowntimeMapper;
import org.jeecg.modules.mdc.service.IMdcDowntimeService;
import org.jeecg.modules.mdc.service.IMdcEquipmentService;
import org.jeecg.modules.mdc.util.DateUtils;
import org.jeecg.modules.mdc.vo.MdcDowntimeVo;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
/**
@@ -66,8 +64,6 @@
        List<MdcDowntime> mdcDowntimeList = this.baseMapper.findPlanTimeDuration(equipmentId, validDate, closeType);
        if (mdcDowntimeList != null && !mdcDowntimeList.isEmpty()) {
            for (MdcDowntime mdcDowntime : mdcDowntimeList) {
//                Date startDate = DateUtils.toDate(mdcDowntime.getTheDate() + " " + mdcDowntime.getStartTime(), DateUtils.STR_DATE_TIME_SMALL);
//                Date endDate = DateUtils.toDate(mdcDowntime.getTheDate() + " " + mdcDowntime.getEndTime(), DateUtils.STR_DATE_TIME_SMALL);
                result = mdcDowntime.getDownLong() + result;
            }
        }
@@ -80,22 +76,25 @@
     * @return
     */
    @Override
    @Transactional(rollbackFor = Exception.class)
    public boolean saveDowntime(MdcDowntime mdcDowntime) {
        boolean result = false;
        String[] equipmentIds = mdcDowntime.getEquipmentIds().split(",");
        List<String> dateList = mdcDowntime.getDateList();
        List<MdcDowntime> mdcDowntimeList = new ArrayList<>();
        for (String equipmentId : equipmentIds) {
            MdcEquipment mdcEquipment = mdcEquipmentService.findEquipmentNameByEquipmentId(equipmentId);
            MdcDowntime downtime = new MdcDowntime();
            BeanUtils.copyProperties(mdcDowntime, downtime);
            downtime.setEquipmentId(mdcEquipment.getEquipmentId());
            downtime.setEquipmentName(mdcEquipment.getEquipmentName());
            boolean b = super.save(downtime);
            if (b) {
                result = true;
            for (String date : dateList) {
//                this.baseMapper.delete(new LambdaQueryWrapper<MdcDowntime>().eq(MdcDowntime::getTheDate, date).eq(MdcDowntime::getEquipmentId, equipmentId));
                MdcEquipment mdcEquipment = mdcEquipmentService.findEquipmentNameByEquipmentId(equipmentId);
                MdcDowntime downtime = new MdcDowntime();
                BeanUtils.copyProperties(mdcDowntime, downtime);
                downtime.setEquipmentId(mdcEquipment.getEquipmentId());
                downtime.setEquipmentName(mdcEquipment.getEquipmentName());
                downtime.setTheDate(date);
                mdcDowntimeList.add(downtime);
            }
        }
        return result;
        this.saveBatch(mdcDowntimeList);
        return true;
    }
    private List<String> getEquipmentIds(String userId, MdcDowntimeVo mdcDowntimeVo) {
lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcOeeInfoServiceImpl.java
@@ -204,21 +204,20 @@
                    int actuateLong = loadLong - noPlanCloseLong;
                    mdcOeeInfo.setActuateLong(actuateLong);
                    // 时间开动率 --- 开动时间/负荷时间
                    BigDecimal timeActuationRate = new BigDecimal(actuateLong).divide(new BigDecimal(loadLong), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP);
                    mdcOeeInfo.setTimeActuationRate(timeActuationRate.compareTo(new BigDecimal(100)) > 0 ? new BigDecimal(100) : timeActuationRate);
                    BigDecimal timeActuationRate = BigDecimal.ZERO;
                    if (loadLong == 0) {
                        mdcOeeInfo.setTimeActuationRate(timeActuationRate);
                    } else {
                        timeActuationRate = new BigDecimal(actuateLong).divide(new BigDecimal(loadLong), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP);
                        mdcOeeInfo.setTimeActuationRate(timeActuationRate.compareTo(new BigDecimal(100)) > 0 ? new BigDecimal(100) : timeActuationRate);
                    }
                    // 有效运行时间 --- 按需求维护零件加工总时长||系统主轴负载时间
                    Integer effectiveRunLong = 0;
//                    Integer totalProcessLong = mdcPartProcessInfoService.selectTotalProcessLong(equipmentId, validDate);
                    //查询设备运行时间
                    effectiveRunLong = mdcEquipmentStatisticalInfoService.selectProcessLong(equipmentId, validDate.replace("-", ""));
                    if (effectiveRunLong == null) {
                        effectiveRunLong = 0;
                    }
//                    if (totalProcessLong == 0) {
//
//                    } else {
//                        effectiveRunLong = totalProcessLong;
//                    }
                    mdcOeeInfo.setEffectiveRunLong(effectiveRunLong);
                    // 性能开动率 --- 有效运行时间/开动时间
                    BigDecimal performanceRate = BigDecimal.ZERO;
@@ -227,16 +226,6 @@
                    }
                    mdcOeeInfo.setPerformanceRate(performanceRate.compareTo(new BigDecimal(100)) > 0 ? new BigDecimal(100) : performanceRate);
                    // 加工零件数量 --- 按维护数据统计当天
//                    Integer processCount = mdcPartProcessInfoService.selectTotalProcessCount(equipmentId, validDate);
//                    mdcOeeInfo.setProcessCount(processCount);
//                    // 合格零件数量 --- 按维护数据统计当天
//                    Integer passCount = mdcPartProcessInfoService.selectTotalPassCount(equipmentId, validDate);
//                    mdcOeeInfo.setPassCount(passCount);
//                    // 合格率 --- 合格数/加工数
//                    BigDecimal passRate = BigDecimal.ZERO;
//                    if (processCount != 0 && passCount != 0) {
//                        passRate = new BigDecimal(passCount).divide(new BigDecimal(processCount), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP);
//                    }
                    // 加工零件数量
                    Integer processCount = mdcJcRcJobreportService.selectTotalProcessCount(equipmentId, validDate);
                    mdcOeeInfo.setProcessCount(processCount);