| | |
| | | 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); |
| | | } |
| | | } |
| | |
| | | private String equipmentId; |
| | | private String equipmentName; |
| | | private String driveType; |
| | | private String theDate; |
| | | // private String theDate; |
| | | private String sequenceNumber; |
| | | private Long duration; |
| | | private Integer processCount; |
| | |
| | | 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); |
| | | } |
| | |
| | | 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> |
| | | |
| | |
| | | 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> |
| | |
| | | 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 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); |
| | | } |
| | |
| | | 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()) { |
| | |
| | | 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)); |
| | | |
| | | // 时间开动率 = 主轴运行时间/负荷时间 |
| | |
| | | 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); |
| | | |
| | | // 标准加工时间(分钟) |
| | |
| | | // 设备综合效率 = 时间开动率 × 性能开动率 × 合格品率 |
| | | 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; |
| | |
| | | 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: |
| | |
| | | * @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 |
| | |
| | | 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) |
| | | List<MdcProcessCount> processCount(MdcEquipment mdcEquipment) { |
| | | Date initDate = null; |