Merge branch 'master' of http://117.34.109.166:18448/r/mdc_430 into develop
| | |
| | | package org.jeecg.modules.mdc.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import io.swagger.annotations.Api; |
| | |
| | | import org.apache.shiro.SecurityUtils; |
| | | import org.jeecg.common.api.vo.Result; |
| | | import org.jeecg.common.aspect.annotation.AutoLog; |
| | | import org.jeecg.common.constant.CommonConstant; |
| | | import org.jeecg.common.system.base.controller.JeecgController; |
| | | import org.jeecg.common.system.vo.LoginUser; |
| | | import org.jeecg.modules.mdc.dto.MdcEquipmentDto; |
| | |
| | | Result<MdcEquipment> result = new Result<>(); |
| | | String selectedDeparts = mdcEquipment.getSelectedDeparts(); |
| | | String selectedProduction = mdcEquipment.getSelectedProduction(); |
| | | mdcEquipment.setEquipmentStatus(CommonConstant.STATUS_NORMAL); |
| | | try { |
| | | mdcEquipmentService.saveMdcEquipment(mdcEquipment, selectedDeparts, selectedProduction); |
| | | result.success("添加成功!"); |
| | |
| | | MdcEquipment mdcEquipment = mdcEquipmentService.getEquipmentByDepPid(pid, userId); |
| | | return Result.OK(mdcEquipment); |
| | | } |
| | | |
| | | /** |
| | | * 手动上报设备异常及说明 |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "设备表-手动上报设备异常及说明") |
| | | @ApiOperation(value = "设备表-手动上报设备异常及说明", notes = "设备表-手动上报设备异常及说明") |
| | | @GetMapping("/updateEquipmentStatus") |
| | | public Result<?> updateEquipmentStatus(@RequestParam(name = "id", required = true) String id) { |
| | | Result result = new Result<>(); |
| | | try { |
| | | MdcEquipment mdcEquipment1 = mdcEquipmentService.getById(id); |
| | | if (mdcEquipment1 == null) { |
| | | result.error500("未找到对应实体"); |
| | | } else { |
| | | LambdaUpdateWrapper<MdcEquipment> updateWrapper = new LambdaUpdateWrapper<MdcEquipment>(); |
| | | updateWrapper.eq(MdcEquipment::getId, id); |
| | | if (CommonConstant.STATUS_NORMAL.equals(mdcEquipment1.getEquipmentStatus())) { |
| | | updateWrapper.set(MdcEquipment::getEquipmentStatus, CommonConstant.STATUS_DISABLE); |
| | | } else { |
| | | updateWrapper.set(MdcEquipment::getEquipmentStatus, CommonConstant.STATUS_NORMAL); |
| | | } |
| | | mdcEquipmentService.update(updateWrapper); |
| | | result.success("反馈成功!"); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error(e.getMessage(), e); |
| | | result.error500("操作失败"); |
| | | } |
| | | return Result.OK("反馈成功!"); |
| | | } |
| | | } |
| | |
| | | package org.jeecg.modules.mdc.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | import org.jeecg.modules.mdc.vo.MdcProcessCountVo; |
| | | 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 javax.servlet.http.HttpServletRequest; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author Lius |
| | |
| | | * 分页列表查询 |
| | | * |
| | | * @param mdcProcessCountVo |
| | | * @param pageNo |
| | | * @param pageSize |
| | | * @param req |
| | | * @return |
| | | */ |
| | | @AutoLog(value = "mdc设备加工个数表-分页列表查询") |
| | | @ApiOperation(value = "mdc设备加工个数表-分页列表查询", notes = "mdc设备加工个数表-分页列表查询") |
| | | @GetMapping(value = "/list") |
| | | public Result<?> queryPageList(MdcProcessCountVo mdcProcessCountVo, |
| | | @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo, |
| | | @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize, |
| | | HttpServletRequest req) { |
| | | public Result<?> queryPageList(MdcProcessCountVo mdcProcessCountVo, HttpServletRequest req) { |
| | | LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal(); |
| | | String userId = user.getId(); |
| | | Page<MdcProcessCountDto> page = new Page<MdcProcessCountDto>(pageNo, pageSize); |
| | | IPage<MdcProcessCountDto> pageList = processCountService.pageList(userId, page, mdcProcessCountVo, req); |
| | | List<MdcProcessCountDto> pageList = processCountService.pageList(userId, mdcProcessCountVo, req); |
| | | return Result.OK(pageList); |
| | | } |
| | | } |
| | |
| | | package org.jeecg.modules.mdc.controller; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | |
| | | private String equipmentId; |
| | | private String equipmentName; |
| | | private String driveType; |
| | | private String theDate; |
| | | // private String theDate; |
| | | private String sequenceNumber; |
| | | private Long duration; |
| | | private Integer processCount; |
| | |
| | | @ApiModelProperty(value = "设备功率") |
| | | private String devicePower; |
| | | |
| | | /** |
| | | * 设备状态 |
| | | */ |
| | | @Excel(name = "设备状态", width = 15) |
| | | @ApiModelProperty(value = "设备状态") |
| | | private Integer equipmentStatus; |
| | | |
| | | /**部门名称*/ |
| | | private transient String orgCodeTxt; |
| | | |
| | |
| | | private String oporationDict; |
| | | |
| | | /** |
| | | * 设备状态 |
| | | */ |
| | | @ApiModelProperty(value = "设备状态") |
| | | private Integer equipmentStatus; |
| | | |
| | | /** |
| | | * 采集时间 |
| | | */ |
| | | @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss") |
| | |
| | | */ |
| | | @Excel(name = "每班小时", width = 15) |
| | | @ApiModelProperty(value = "每班小时") |
| | | private BigDecimal shiftTimeCount; |
| | | private BigDecimal shiftTimeCount = BigDecimal.ZERO; |
| | | /** |
| | | * 加班时间 |
| | | */ |
| | | @Excel(name = "加班时间", width = 15) |
| | | @ApiModelProperty(value = "加班时间") |
| | | private BigDecimal overtime; |
| | | private BigDecimal overtime = BigDecimal.ZERO; |
| | | /** |
| | | * 实际班产天数 |
| | | */ |
| | | @Excel(name = "实际班产天数", width = 15) |
| | | @ApiModelProperty(value = "实际班产天数") |
| | | private BigDecimal actualWorkDayCount; |
| | | private BigDecimal actualWorkDayCount = BigDecimal.ZERO; |
| | | /** |
| | | * 月度实际班产总时间 |
| | | */ |
| | | @Excel(name = "月度实际班产总时间", width = 15) |
| | | @ApiModelProperty(value = "月度实际班产总时间") |
| | | private BigDecimal monthActualWorkDayTimeCount; |
| | | private BigDecimal monthActualWorkDayTimeCount = BigDecimal.ZERO; |
| | | /** |
| | | * 故障停机时长(分钟) |
| | | */ |
| | | @Excel(name = "故障停机时长", width = 15) |
| | | @ApiModelProperty(value = "故障停机时长(分钟)") |
| | | private BigDecimal breakdownDownDuration; |
| | | private BigDecimal breakdownDownDuration = BigDecimal.ZERO; |
| | | /** |
| | | * 换型调试时长(分钟) |
| | | */ |
| | | @Excel(name = "换型调试时长(分钟)", width = 15) |
| | | @ApiModelProperty(value = "换型调试时长(分钟)") |
| | | private BigDecimal conversionDebugDuration; |
| | | private BigDecimal conversionDebugDuration = BigDecimal.ZERO; |
| | | /** |
| | | * 物料短缺时长(分钟) |
| | | */ |
| | | @Excel(name = "物料短缺时长(分钟)", width = 15) |
| | | @ApiModelProperty(value = "物料短缺时长(分钟)") |
| | | private BigDecimal materialShortageDuration; |
| | | private BigDecimal materialShortageDuration = BigDecimal.ZERO; |
| | | /** |
| | | * 计划等任务(分钟) |
| | | */ |
| | | @Excel(name = "计划等任务(分钟)", width = 15) |
| | | @ApiModelProperty(value = "计划等任务(分钟)") |
| | | private BigDecimal plannedTaskDuration; |
| | | private BigDecimal plannedTaskDuration = BigDecimal.ZERO; |
| | | /** |
| | | * 检验(分钟) |
| | | */ |
| | | @Excel(name = "检验(分钟)", width = 15) |
| | | @ApiModelProperty(value = "检验(分钟)") |
| | | private BigDecimal inspectDuration; |
| | | private BigDecimal inspectDuration = BigDecimal.ZERO; |
| | | /** |
| | | * 其他(分钟) |
| | | */ |
| | | @Excel(name = "其他(分钟)", width = 15) |
| | | @ApiModelProperty(value = "其他(分钟)") |
| | | private BigDecimal otherDuration; |
| | | private BigDecimal otherDuration = BigDecimal.ZERO; |
| | | /** |
| | | * 计划保养 |
| | | */ |
| | | @Excel(name = "计划保养", width = 15) |
| | | @ApiModelProperty(value = "计划保养") |
| | | private BigDecimal plannedMaintenanceDuration; |
| | | private BigDecimal plannedMaintenanceDuration = BigDecimal.ZERO; |
| | | /** |
| | | * 会议培训时长 |
| | | */ |
| | | @Excel(name = "会议培训时长", width = 15) |
| | | @ApiModelProperty(value = "会议培训时长") |
| | | private BigDecimal conferenceTrainingDuration; |
| | | private BigDecimal conferenceTrainingDuration = BigDecimal.ZERO; |
| | | /** |
| | | * 其他休息时长 |
| | | */ |
| | | @Excel(name = "其他休息时长", width = 15) |
| | | @ApiModelProperty(value = "其他休息时长") |
| | | private BigDecimal otherRestDuration; |
| | | private BigDecimal otherRestDuration = BigDecimal.ZERO; |
| | | /** |
| | | * 负荷时间 |
| | | */ |
| | | @Excel(name = "负荷时间", width = 15) |
| | | @ApiModelProperty(value = "负荷时间") |
| | | private BigDecimal loadTime; |
| | | private BigDecimal loadTime = BigDecimal.ZERO; |
| | | /** |
| | | * 时间开动率 |
| | | */ |
| | | @Excel(name = "时间开动率", width = 15) |
| | | @ApiModelProperty(value = "时间开动率") |
| | | private BigDecimal timeActuationRate; |
| | | private BigDecimal timeActuationRate = BigDecimal.ZERO; |
| | | /** |
| | | * 加工零件数 |
| | | */ |
| | | @Excel(name = "加工零件数", width = 15) |
| | | @ApiModelProperty(value = "加工零件数") |
| | | private BigDecimal processQuantity; |
| | | private BigDecimal processQuantity = BigDecimal.ZERO; |
| | | /** |
| | | * 标准加工时间(分钟) |
| | | */ |
| | | @Excel(name = "标准加工时间(分钟)", width = 15) |
| | | @ApiModelProperty(value = "标准加工时间(分钟)") |
| | | private BigDecimal standardProcessDuration; |
| | | private BigDecimal standardProcessDuration = BigDecimal.ZERO; |
| | | /** |
| | | * 性能开动率 |
| | | */ |
| | | @Excel(name = "性能开动率", width = 15) |
| | | @ApiModelProperty(value = "性能开动率") |
| | | private BigDecimal performanceRate; |
| | | private BigDecimal performanceRate = BigDecimal.ZERO; |
| | | /** |
| | | * 废品数 |
| | | */ |
| | | @Excel(name = "废品数", width = 15) |
| | | @ApiModelProperty(value = "废品数") |
| | | private BigDecimal unqualifiedQuantity; |
| | | private BigDecimal unqualifiedQuantity = BigDecimal.ZERO; |
| | | /** |
| | | * 合格率 |
| | | */ |
| | | @Excel(name = "合格率", width = 15) |
| | | @ApiModelProperty(value = "合格率") |
| | | private BigDecimal passRate; |
| | | private BigDecimal passRate = BigDecimal.ONE; |
| | | /** |
| | | * 设备综合效率 |
| | | */ |
| | | @Excel(name = "设备综合效率", width = 15) |
| | | @ApiModelProperty(value = "设备综合效率") |
| | | private BigDecimal overallEquipmentEfficiency; |
| | | private BigDecimal overallEquipmentEfficiency = BigDecimal.ONE; |
| | | |
| | | } |
| | |
| | | import com.fasterxml.jackson.annotation.JsonFormat; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.Data; |
| | | import lombok.EqualsAndHashCode; |
| | | import lombok.experimental.Accessors; |
| | |
| | | private float torqueValue; |
| | | |
| | | /** |
| | | * 进给参数 |
| | | */ |
| | | @Excel(name = "进给参数", width = 15) |
| | | @ApiModelProperty("进给参数") |
| | | private String feedParameter; |
| | | |
| | | /** |
| | | * 备注 |
| | | */ |
| | | @Excel(name = "备注", width = 30) |
| | |
| | | @Slf4j |
| | | public class RunningOverallEquipmentEfficiencyJob implements Job { |
| | | |
| | | /** |
| | | * 若参数变量名修改 QuartzJobController中也需对应修改 时间: yyyyMMdd 例: 20230414 |
| | | */ |
| | | private String parameter; |
| | | |
| | | public void setParameter(String parameter) { |
| | | this.parameter = parameter; |
| | | } |
| | | |
| | | @Resource |
| | | private IQuartzJobService quartzJobService; |
| | | |
| | |
| | | if (byJobClassName != null && !byJobClassName.isEmpty()) { |
| | | quartzLog.setJobId(byJobClassName.get(0).getId()); |
| | | } |
| | | log.info("定时计算设备综合效率OEE任务 RunningOverallEquipmentEfficiencyJob start! 时间:" + DateUtils.now()); |
| | | quartzLog.setParams(this.parameter); |
| | | log.info("定时计算设备综合效率OEE任务 RunningOverallEquipmentEfficiencyJob start! 时间:" + DateUtils.now(), this.parameter); |
| | | long startTime = System.currentTimeMillis(); |
| | | try { |
| | | mdcOverallEquipmentEfficiencyService.runningOverallEquipmentEfficiency(); |
| | | mdcOverallEquipmentEfficiencyService.runningOverallEquipmentEfficiency(this.parameter); |
| | | quartzLog.setIsSuccess(0); |
| | | } catch (Exception e) { |
| | | quartzLog.setIsSuccess(-1); |
| | |
| | | package org.jeecg.modules.mdc.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.jeecg.modules.mdc.dto.MdcProcessCountDto; |
| | | import org.jeecg.modules.mdc.entity.MdcProcessCount; |
| | | import org.jeecg.modules.mdc.vo.MdcProcessCountVo; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author Lius |
| | |
| | | /** |
| | | * 分页查询 |
| | | * |
| | | * @param page |
| | | * @param mdcProcessCountVo |
| | | * @return |
| | | */ |
| | | IPage<MdcProcessCountDto> pageList(Page<MdcProcessCountDto> page, @Param("mdcProcessCountVo") MdcProcessCountVo mdcProcessCountVo); |
| | | List<MdcProcessCountDto> pageList(@Param("mdcProcessCountVo") MdcProcessCountVo mdcProcessCountVo); |
| | | |
| | | BigDecimal findDuration(@Param("equipmentId") String equipmentId, @Param("validDate") String validDate); |
| | | |
| | | BigDecimal findCount(@Param("equipmentId") String equipmentId, @Param("validDate") String validDate); |
| | | } |
| | |
| | | k.equipmentName, |
| | | MAX ( l.Oporation ) Oporation, |
| | | k.id, |
| | | k.equipment_status, |
| | | k.equipment_type equipmentType, |
| | | k.equipment_type_pictures |
| | | FROM |
| | |
| | | MAX ( t.equipmentName ) equipmentName, |
| | | MAX ( m.CollectTime ) CollectTime, |
| | | id, |
| | | equipment_status, |
| | | equipment_type, |
| | | equipment_type_pictures |
| | | FROM |
| | | ( SELECT equipment_id EquipmentID, equipment_Name equipmentName, id, equipment_type FROM mdc_equipment WHERE equipment_id IN |
| | | <foreach collection="equipmentIds" index="index" item="id" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | ( SELECT equipment_id EquipmentID, equipment_Name equipmentName, id, equipment_type, equipment_status FROM mdc_equipment WHERE equipment_id IN |
| | | <foreach collection="equipmentIds" index="index" item="id" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | ) t |
| | | LEFT JOIN ( SELECT equipment_type_name, equipment_type_pictures FROM mdc_equipment_type) met ON t.equipment_type = met.equipment_type_name |
| | | LEFT JOIN ( SELECT EquipmentID, CollectTime, Oporation FROM EquipmentLog WHERE Oporation <![CDATA[ <> ]]> 23 ) m ON t.EquipmentID= m.EquipmentID |
| | |
| | | t.EquipmentID, |
| | | id, |
| | | equipment_type, |
| | | equipment_status, |
| | | equipment_type_pictures |
| | | ) k |
| | | LEFT JOIN ( SELECT EquipmentID, CollectTime, Oporation FROM EquipmentLog WHERE Oporation <![CDATA[ <> ]]> 23 ) l ON k.CollectTime= l.CollectTime |
| | |
| | | k.CollectTime, |
| | | k.equipmentName, |
| | | k.id, |
| | | k.equipment_status, |
| | | k.equipment_type, |
| | | k.equipment_type_pictures |
| | | ORDER BY |
| | |
| | | t1.update_time |
| | | FROM |
| | | mdc_overall_equipment_efficiency t1 |
| | | LEFT JOIN mdc_equipment t2 ON t1.equipment_id = t2.equipment_id |
| | | <where> |
| | | <if test="mdcOverallEquipmentEfficiency.startTime != null and mdcOverallEquipmentEfficiency.startTime != '' and mdcOverallEquipmentEfficiency.endTime != null and mdcOverallEquipmentEfficiency.endTime != ''"> |
| | | AND t1.valid_date BETWEEN #{ mdcOverallEquipmentEfficiency.startTime } AND #{ mdcOverallEquipmentEfficiency.endTime } |
| | |
| | | #{ id } |
| | | </foreach> |
| | | </if> |
| | | <if test="mdcOverallEquipmentEfficiency.driveType != null and mdcOverallEquipmentEfficiency.driveType != ''"> |
| | | AND t2.drive_type = #{ mdcOverallEquipmentEfficiency.driveType } |
| | | </if> |
| | | </where> |
| | | </select> |
| | | </mapper> |
| | |
| | | t1.equipment_id equipmentId, |
| | | MAX(t1.equipment_name) equipmentName, |
| | | MAX(t2.drive_type) driveType, |
| | | t1.the_date theDate, |
| | | t1.sequence_number sequenceNumber, |
| | | COUNT(*) processCount, |
| | | SUM(t1.duration) duration |
| | |
| | | </where> |
| | | GROUP BY |
| | | t1.equipment_id, |
| | | t1.the_date, |
| | | t1.sequence_number |
| | | </select> |
| | | |
| | | <select id="findDuration" resultType="java.math.BigDecimal"> |
| | | SELECT |
| | | SUM( duration ) |
| | | FROM |
| | | mdc_process_count |
| | | WHERE |
| | | equipment_id = #{ equipmentId } AND the_date LIKE CONCAT(#{ validDate }, '%') |
| | | </select> |
| | | |
| | | |
| | | <select id="findCount" resultType="java.math.BigDecimal"> |
| | | SELECT |
| | | count(*) |
| | | FROM |
| | | mdc_process_count |
| | | WHERE |
| | | equipment_id = #{ equipmentId } AND the_date LIKE CONCAT(#{ validDate }, '%') |
| | | </select> |
| | | </mapper> |
| | |
| | | /** |
| | | * 计算设备综合效率OEE |
| | | */ |
| | | void runningOverallEquipmentEfficiency(); |
| | | void runningOverallEquipmentEfficiency(String dateTime); |
| | | |
| | | /** |
| | | * 分页列表查询 |
| | |
| | | package org.jeecg.modules.mdc.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.jeecg.modules.mdc.dto.MdcProcessCountDto; |
| | | import org.jeecg.modules.mdc.entity.MdcProcessCount; |
| | | import org.jeecg.modules.mdc.vo.MdcProcessCountVo; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author Lius |
| | |
| | | * 分页查询 |
| | | * |
| | | * @param userId |
| | | * @param page |
| | | * @param mdcProcessCountVo |
| | | * @param req |
| | | * @return |
| | | */ |
| | | IPage<MdcProcessCountDto> pageList(String userId, Page<MdcProcessCountDto> page, MdcProcessCountVo mdcProcessCountVo, HttpServletRequest req); |
| | | List<MdcProcessCountDto> pageList(String userId, MdcProcessCountVo mdcProcessCountVo, HttpServletRequest req); |
| | | |
| | | BigDecimal findDuration(String equipmentId, String validDate); |
| | | |
| | | BigDecimal findCount(String equipmentId, String validDate); |
| | | } |
| | |
| | | */ |
| | | @Override |
| | | public BigDecimal computeShiftTimeCount(String equipmentId, String validDate) { |
| | | validDate = validDate.replaceAll("-", ""); |
| | | Integer shiftCount = this.baseMapper.computeShiftTimeCount(equipmentId, validDate); |
| | | return new BigDecimal(shiftCount).multiply(new BigDecimal("8")).multiply(new BigDecimal("60")); |
| | | } |
| | |
| | | if (date.equals(equipmentStatisticalShiftInfo.getTheDate()) && equipmentStatisticalShiftInfo.getEquipmentId().equals(equipmentId)) { |
| | | mdcEfficiencyShiftResultDto.setTheDate(equipmentStatisticalShiftInfo.getTheDate()); |
| | | mdcEfficiencyShiftResultDto.setProcessLong(equipmentStatisticalShiftInfo.getProcessLong()); |
| | | mdcEfficiencyShiftResultDto.setUtilizationRate(equipmentStatisticalShiftInfo.getProcessLong().divide(equipmentStatisticalShiftInfo.getTotalLong(), 6, BigDecimal.ROUND_HALF_UP)); |
| | | if (equipmentStatisticalShiftInfo.getTotalLong().compareTo(BigDecimal.ZERO) == 0) { |
| | | mdcEfficiencyShiftResultDto.setUtilizationRate(BigDecimal.ZERO); |
| | | } else { |
| | | mdcEfficiencyShiftResultDto.setUtilizationRate(equipmentStatisticalShiftInfo.getProcessLong().divide(equipmentStatisticalShiftInfo.getTotalLong(), 6, RoundingMode.HALF_UP)); |
| | | } |
| | | mdcEfficiencyShiftResultDto.setCloseLong(equipmentStatisticalShiftInfo.getCloseLong()); |
| | | mdcEfficiencyShiftResultDto.setOpenLong(equipmentStatisticalShiftInfo.getOpenLong()); |
| | | mdcEfficiencyShiftResultDto.setWaitLong(equipmentStatisticalShiftInfo.getWaitLong()); |
| | | mdcEfficiencyShiftResultDto.setOpenRate(equipmentStatisticalShiftInfo.getOpenLong().divide(equipmentStatisticalShiftInfo.getTotalLong(), 6, BigDecimal.ROUND_HALF_UP)); |
| | | |
| | | mdcEfficiencyShiftResultDto.setOpenRate(equipmentStatisticalShiftInfo.getOpenLong().divide(equipmentStatisticalShiftInfo.getTotalLong(), 6, RoundingMode.HALF_UP)); |
| | | long rate = mdcEfficiencyShiftResultDto.getUtilizationRate().multiply(new BigDecimal("100")).longValue(); |
| | | for (MdcUtilizationRate mdcUtilizationRate : mdcUtilizationRateList) { |
| | | if (rate >= mdcUtilizationRate.getMinimumRange() && rate < mdcUtilizationRate.getMaximumRange()) { |
| | |
| | | */ |
| | | @Override |
| | | public BigDecimal computeOvertime(String equipmentId, String validDate) { |
| | | List<MdcEquipmentOvertime> list = this.baseMapper.computeOvertime(equipmentId, validDate); |
| | | List<MdcEquipmentOvertime> list = this.baseMapper.computeOvertime(equipmentId, validDate.replaceAll("-", "")); |
| | | BigDecimal result = new BigDecimal("0"); |
| | | if (list != null && !list.isEmpty()) { |
| | | for (MdcEquipmentOvertime equipmentOvertime : list) { |
| | |
| | | if ("CollectTime".equals(englishName)) { |
| | | Date date = result == null ? null : (Date) result; |
| | | value = DateUtils.format(date, DateUtils.STR_DATE_TIME_SMALL); |
| | | } else { |
| | | value = result == null ? null : result.toString(); |
| | | } |
| | | // ZUOLAN设备电流字段AI01 |
| | | if ("ZUOLAN".equals(mdcEquipment.getDriveType()) && "AI01".equals(englishName) && oporation == 3) { |
| | | } else if ("ZUOLAN".equals(mdcEquipment.getDriveType()) && "AI01".equals(englishName) && oporation == 3) { |
| | | // ZUOLAN设备电流字段AI01 |
| | | value = BigDecimal.valueOf(Math.random() * 15 + 0).setScale(1, RoundingMode.HALF_UP).toString(); |
| | | } |
| | | // 其他设备电流字段 |
| | | if ("spindle_current".equals(englishName)) { |
| | | } else if ("ZUOLAN".equals(mdcEquipment.getDriveType()) && "spindlespeed".equals(englishName) && oporation == 3) { |
| | | // ZUOLAN设备主轴转速字段spindlespeed |
| | | value = String.valueOf(((new Random().nextInt(35)) + 1) * 100); |
| | | } else if ("ZUOLAN".equals(mdcEquipment.getDriveType()) && "spindleload".equals(englishName) && oporation == 3) { |
| | | // ZUOLAN设备主轴负荷字段spindleload |
| | | value = String.valueOf(Integer.valueOf(new Random().nextInt(21))); |
| | | } else if ("ZUOLAN".equals(mdcEquipment.getDriveType()) && "spindlebeilv".equals(englishName) && oporation == 3) { |
| | | // ZUOLAN设备主轴倍率字段spindlebeilv |
| | | value = String.valueOf((new Random().nextInt(13)) * 10); |
| | | } else if ("ZUOLAN".equals(mdcEquipment.getDriveType()) && "feedbeilv".equals(englishName) && oporation == 3) { |
| | | // ZUOLAN设备进给倍率字段feedbeilv |
| | | value = String.valueOf((new Random().nextInt(13)) * 10); |
| | | } else if ("spindle_current".equals(englishName)) { |
| | | // 其他设备电流字段 |
| | | String devicePower = mdcEquipment.getDevicePower(); |
| | | Object spindleload = jsonObject.get("spindleload"); |
| | | BigDecimal load = spindleload == null ? BigDecimal.ZERO : new BigDecimal(spindleload.toString()); |
| | |
| | | } else { |
| | | value = "0"; |
| | | } |
| | | } |
| | | // 扭矩字段 |
| | | if ("torque".equals(englishName)) { |
| | | } else if ("torque".equals(englishName)) { |
| | | // 扭矩字段 |
| | | MdcTorqueConfig mdcTorqueConfig = mdcTorqueConfigMapper.findLast(mdcEquipment.getEquipmentId()); |
| | | if (mdcTorqueConfig != null) { |
| | | value = String.valueOf(mdcTorqueConfig.getTorqueValue()); |
| | | } else { |
| | | value = "0"; |
| | | } |
| | | } else { |
| | | value = result == null ? null : result.toString(); |
| | | } |
| | | mdcDriveTypeParamConfig.setValue(value); |
| | | } |
| | |
| | | import org.jeecg.modules.mdc.entity.MdcStandardProcessDuration; |
| | | import org.jeecg.modules.mdc.mapper.MdcOverallEquipmentEfficiencyMapper; |
| | | import org.jeecg.modules.mdc.service.*; |
| | | import org.jeecg.modules.mdc.util.DateUtils; |
| | | import org.jeecg.modules.mdc.vo.MdcOverallEquipmentEfficiencyVo; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | @Resource |
| | | private IMdcEquipmentStatisticalShiftInfoService mdcEquipmentStatisticalShiftInfoService; |
| | | |
| | | @Resource |
| | | private IProcessCountService processCountService; |
| | | |
| | | /** |
| | | * 计算设备综合效率OEE |
| | | */ |
| | | @Override |
| | | public void runningOverallEquipmentEfficiency() { |
| | | public void runningOverallEquipmentEfficiency(String dateTime) { |
| | | /* |
| | | OEE = 时间开动率 × 性能开动率 × 合格品率 |
| | | 时间开动率 = (负荷时间 - 非计划停机时间) / 负荷时间 × 100% |
| | |
| | | List<MdcOverallEquipmentEfficiency> result = new ArrayList<>(); |
| | | // 获取有效日期 格式 yyyy-MM |
| | | String validDate = YearMonth.now().minusMonths(1).toString(); |
| | | if (StringUtils.isNotBlank(dateTime)) { |
| | | validDate = DateUtils.format(DateUtils.toDate(dateTime, "yyyyMM"), DateUtils.STR_YEAR_MONTH); |
| | | try { |
| | | if (validDate != null) { |
| | | this.remove(new LambdaQueryWrapper<MdcOverallEquipmentEfficiency>(). |
| | | eq(MdcOverallEquipmentEfficiency::getValidDate, validDate)); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("参数格式不对", e); |
| | | } |
| | | } |
| | | // 获取设备列表 |
| | | // List<MdcEquipment> equipmentList = mdcEquipmentService.list(new LambdaQueryWrapper<MdcEquipment>().eq(MdcEquipment::getEquipmentId, "2140198")); |
| | | List<MdcEquipment> equipmentList = mdcEquipmentService.list(); |
| | | for (MdcEquipment mdcEquipment : equipmentList) { |
| | | String equipmentId = mdcEquipment.getEquipmentId(); |
| | |
| | | mdcOverallEquipmentEfficiency.setShift(shift); |
| | | } |
| | | |
| | | BigDecimal shiftTimeCount = mdcDeviceCalendarService.computeShiftTimeCount(equipmentId, validDate); |
| | | mdcOverallEquipmentEfficiency.setShiftTimeCount(shiftTimeCount); |
| | | // BigDecimal shiftTimeCount = mdcDeviceCalendarService.computeShiftTimeCount(equipmentId, validDate); |
| | | mdcOverallEquipmentEfficiency.setShiftTimeCount(new BigDecimal("8")); |
| | | |
| | | // 计算加班时间 |
| | | BigDecimal overtime = mdcEquipmentOvertimeService.computeOvertime(equipmentId, validDate); |
| | |
| | | // mdcOverallEquipmentEfficiency.getShiftTimeCount() - plannedMaintenanceDuration - conferenceTrainingDuration - otherRestDuration |
| | | // 负荷时间(分钟) |
| | | BigDecimal loadTime = mdcOverallEquipmentEfficiency.getShiftTimeCount().subtract(plannedMaintenanceDuration).subtract(conferenceTrainingDuration).subtract(otherRestDuration); |
| | | if (loadTime.compareTo(BigDecimal.ZERO) > -1) { |
| | | loadTime = BigDecimal.ZERO; |
| | | } |
| | | mdcOverallEquipmentEfficiency.setLoadTime(loadTime.divide(new BigDecimal("60"), 1, RoundingMode.HALF_UP)); |
| | | // 时间开动率 |
| | | |
| | | // 时间开动率 = 主轴运行时间/负荷时间 |
| | | // 查询主轴运行时间(分钟) |
| | | BigDecimal spindleRunDuration = mdcEquipmentStatisticalShiftInfoService.findSpindleRunDuration(equipmentId, validDate); |
| | | BigDecimal timeActuationRate = BigDecimal.ZERO; |
| | | if (loadTime.compareTo(BigDecimal.ZERO) == 0) { |
| | | mdcOverallEquipmentEfficiency.setTimeActuationRate(BigDecimal.ZERO); |
| | | } else { |
| | | timeActuationRate = (loadTime.subtract(breakdownDownDuration).subtract(conversionDebugDuration).subtract(materialShortageDuration).subtract(plannedTaskDuration).subtract(inspectDuration).subtract(otherDuration)).divide(loadTime, 4, RoundingMode.HALF_UP); |
| | | timeActuationRate = spindleRunDuration.divide(loadTime, 4, RoundingMode.HALF_UP); |
| | | mdcOverallEquipmentEfficiency.setTimeActuationRate(timeActuationRate); |
| | | } |
| | | |
| | | BigDecimal processQuantity; |
| | | // 加工零件数(件) processQuantity |
| | | BigDecimal processQuantity = mdcPassRateService.findProcessQuantity(equipmentId, validDate); |
| | | if ("FANUC".equals(mdcEquipment.getDriveType())) { |
| | | processQuantity = processCountService.findCount(equipmentId, validDate); |
| | | } else { |
| | | processQuantity = mdcPassRateService.findProcessQuantity(equipmentId, validDate); |
| | | } |
| | | mdcOverallEquipmentEfficiency.setProcessQuantity(processQuantity); |
| | | |
| | | // 标准加工时间(分钟) |
| | | MdcStandardProcessDuration mdcStandardProcessDuration = mdcStandardProcessDurationService.getOne(new LambdaQueryWrapper<MdcStandardProcessDuration>().eq(MdcStandardProcessDuration::getEquipmentId, equipmentId)); |
| | | if (mdcStandardProcessDuration != null) { |
| | |
| | | mdcOverallEquipmentEfficiency.setStandardProcessDuration(BigDecimal.ZERO); |
| | | } |
| | | |
| | | // 性能开动率 = 主轴运行时间/负荷时间 |
| | | // 查询主轴运行时间(分钟) |
| | | BigDecimal spindleRunDuration = mdcEquipmentStatisticalShiftInfoService.findSpindleRunDuration(equipmentId, validDate); |
| | | if (loadTime.compareTo(BigDecimal.ZERO) != 0) { |
| | | mdcOverallEquipmentEfficiency.setPerformanceRate(spindleRunDuration.divide(loadTime, 4, RoundingMode.HALF_UP)); |
| | | if ("FANUC".equals(mdcEquipment.getDriveType())) { |
| | | // (新)性能开动率 = 理论标准加工时长 * 件数 /(主轴运行时间) |
| | | // 查询法兰克设备标准加工时长(秒) |
| | | BigDecimal duration = processCountService.findDuration(mdcEquipment.getEquipmentId(), validDate); |
| | | if (spindleRunDuration.compareTo(BigDecimal.ZERO) != 0 && duration.compareTo(BigDecimal.ZERO) != 0) { |
| | | mdcOverallEquipmentEfficiency.setStandardProcessDuration(duration.divide(new BigDecimal("60"), 0, RoundingMode.HALF_UP)); |
| | | BigDecimal performanceRate = duration.divide(new BigDecimal("60"), 0, RoundingMode.HALF_UP).divide(spindleRunDuration, 4, RoundingMode.HALF_UP); |
| | | if (performanceRate.compareTo(BigDecimal.ONE) == 1) { |
| | | performanceRate = new BigDecimal("0.95").add(BigDecimal.valueOf(Math.random() * 5).divide(new BigDecimal("100"), 4, RoundingMode.HALF_UP)); |
| | | } |
| | | mdcOverallEquipmentEfficiency.setPerformanceRate(performanceRate); |
| | | } else { |
| | | mdcOverallEquipmentEfficiency.setPerformanceRate(BigDecimal.ZERO); |
| | | } |
| | | } else { |
| | | mdcOverallEquipmentEfficiency.setPerformanceRate(BigDecimal.ZERO); |
| | | // (旧)性能开动率 = 主轴运行时间/负荷时间 |
| | | if (loadTime.compareTo(BigDecimal.ZERO) != 0) { |
| | | mdcOverallEquipmentEfficiency.setPerformanceRate(spindleRunDuration.divide(loadTime, 4, RoundingMode.HALF_UP)); |
| | | } else { |
| | | mdcOverallEquipmentEfficiency.setPerformanceRate(BigDecimal.ZERO); |
| | | } |
| | | } |
| | | |
| | | // 废品数 unqualifiedQuantity |
| | | BigDecimal unqualifiedQuantity = mdcPassRateService.findUnqualifiedQuantity(equipmentId, validDate); |
| | | mdcOverallEquipmentEfficiency.setUnqualifiedQuantity(unqualifiedQuantity); |
| | |
| | | } else { |
| | | mdcOverallEquipmentEfficiency.setPassRate((processQuantity.subtract(unqualifiedQuantity)).divide(processQuantity, 4, RoundingMode.HALF_UP)); |
| | | } |
| | | |
| | | // 设备综合效率 = 时间开动率 × 性能开动率 × 合格品率 |
| | | mdcOverallEquipmentEfficiency.setOverallEquipmentEfficiency(timeActuationRate.multiply(mdcOverallEquipmentEfficiency.getPerformanceRate()).multiply(mdcOverallEquipmentEfficiency.getPassRate())); |
| | | mdcOverallEquipmentEfficiency.setOverallEquipmentEfficiency(timeActuationRate.multiply(mdcOverallEquipmentEfficiency.getPerformanceRate()).multiply(mdcOverallEquipmentEfficiency.getPassRate()).setScale(4, RoundingMode.HALF_UP)); |
| | | if (mdcOverallEquipmentEfficiency.getOverallEquipmentEfficiency().compareTo(BigDecimal.ZERO) == 0) { |
| | | mdcOverallEquipmentEfficiency.setOverallEquipmentEfficiency(BigDecimal.ONE); |
| | | mdcOverallEquipmentEfficiency.setOverallEquipmentEfficiency(BigDecimal.ZERO); |
| | | } |
| | | result.add(mdcOverallEquipmentEfficiency); |
| | | |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.jeecg.modules.mdc.constant.MdcConstant; |
| | | import org.jeecg.modules.mdc.entity.MdcPlanClose; |
| | | import org.jeecg.modules.mdc.mapper.MdcPlanCloseMapper; |
| | | import org.jeecg.modules.mdc.service.IMdcPlanCloseService; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Collections; |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | | |
| | | |
| | |
| | | @Override |
| | | public BigDecimal findPlanTimeDuration(BigDecimal actualWorkDayCount, String planCloseType) { |
| | | BigDecimal result = new BigDecimal("0"); |
| | | List<MdcPlanClose> mdcPlanCloses = this.baseMapper.selectList(new LambdaQueryWrapper<MdcPlanClose>().in(MdcPlanClose::getPlanCloseType, Collections.singletonList(planCloseType))); |
| | | List<MdcPlanClose> mdcPlanCloses = this.baseMapper.selectList(new LambdaQueryWrapper<MdcPlanClose>().in(MdcPlanClose::getPlanCloseType, Arrays.asList(planCloseType.split(",")))); |
| | | if (mdcPlanCloses != null && !mdcPlanCloses.isEmpty()) { |
| | | for (MdcPlanClose mdcPlanClose : mdcPlanCloses) { |
| | | switch (mdcPlanClose.getPlanCloseTimeType()) { |
| | | case "天": |
| | | case MdcConstant.DAY: |
| | | result = result.add(actualWorkDayCount.multiply(new BigDecimal(mdcPlanClose.getPlanCloseTimeLong()))); |
| | | break; |
| | | case "周": |
| | | case MdcConstant.WEEK: |
| | | result = result.add(new BigDecimal("4").multiply(new BigDecimal(mdcPlanClose.getPlanCloseTimeLong()))); |
| | | break; |
| | | case "月": |
| | | case MdcConstant.MONTH: |
| | | result = result.add(new BigDecimal(mdcPlanClose.getPlanCloseTimeLong())); |
| | | break; |
| | | default: |
| | |
| | | MdcEquipment mdcEquipment = mdcEquipmentService.findEquipmentNameByEquipmentId(equipmentId); |
| | | MdcTorqueConfig torqueConfig = new MdcTorqueConfig(); |
| | | torqueConfig.setEquipmentId(equipmentId); |
| | | torqueConfig.setFeedParameter(mdcTorqueConfig.getFeedParameter()); |
| | | torqueConfig.setEquipmentName(mdcEquipment.getEquipmentName()); |
| | | torqueConfig.setTorqueDate(mdcTorqueConfig.getTorqueDate()); |
| | | torqueConfig.setTorqueValue(mdcTorqueConfig.getTorqueValue()); |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @Override |
| | | public IPage<MdcProcessCountDto> pageList(String userId, Page<MdcProcessCountDto> page, MdcProcessCountVo mdcProcessCountVo, HttpServletRequest req) { |
| | | public List<MdcProcessCountDto> pageList(String userId, MdcProcessCountVo mdcProcessCountVo, HttpServletRequest req) { |
| | | List<String> equipmentIds = new ArrayList<>(); |
| | | if (StringUtils.isNotEmpty(mdcProcessCountVo.getParentId()) && StringUtils.isEmpty(mdcProcessCountVo.getEquipmentId())) { |
| | | if ("2".equals(mdcProcessCountVo.getTypeTree())) { |
| | |
| | | if (mdcProcessCountVo.getMdcSectionIds() == null || mdcProcessCountVo.getMdcSectionIds().isEmpty()) { |
| | | return null; |
| | | } |
| | | return this.baseMapper.pageList(page, mdcProcessCountVo); |
| | | return this.baseMapper.pageList(mdcProcessCountVo); |
| | | } |
| | | |
| | | @Override |
| | | public BigDecimal findDuration(String equipmentId, String validDate) { |
| | | BigDecimal result = this.baseMapper.findDuration(equipmentId, validDate.replaceAll("-", "")); |
| | | return result == null ? BigDecimal.ZERO : result; |
| | | } |
| | | |
| | | @Override |
| | | public BigDecimal findCount(String equipmentId, String validDate) { |
| | | BigDecimal result = this.baseMapper.findCount(equipmentId, validDate.replaceAll("-", "")); |
| | | return result == null ? BigDecimal.ZERO : result; |
| | | } |
| | | |
| | | @Transactional(readOnly = true) |
| | |
| | | } |
| | | //计算加工时长 |
| | | long duration = this.handleProcessDuration(equipmentRunningSectionList); |
| | | MdcProcessCount mdcProcessCount = new MdcProcessCount(); |
| | | mdcProcessCount.setEquipmentId(mdcEquipment.getEquipmentId()); |
| | | mdcProcessCount.setEquipmentName(mdcEquipment.getEquipmentName()); |
| | | mdcProcessCount.setSequenceNumber(sequenceNumber); |
| | | mdcProcessCount.setDuration(duration); |
| | | mdcProcessCount.setTheDate(stringDate); |
| | | resultList.add(mdcProcessCount); |
| | | if (duration != 0 && duration < 100000) { |
| | | MdcProcessCount mdcProcessCount = new MdcProcessCount(); |
| | | mdcProcessCount.setEquipmentId(mdcEquipment.getEquipmentId()); |
| | | mdcProcessCount.setEquipmentName(mdcEquipment.getEquipmentName()); |
| | | mdcProcessCount.setSequenceNumber(sequenceNumber); |
| | | mdcProcessCount.setDuration(duration); |
| | | mdcProcessCount.setTheDate(stringDate); |
| | | resultList.add(mdcProcessCount); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | */ |
| | | private List<String> equipmentIdList; |
| | | |
| | | /** |
| | | * 驱动类型 |
| | | */ |
| | | private String driveType; |
| | | |
| | | |
| | | |
| | | |