| | |
| | | package org.jeecg.modules.screen.service.impl; |
| | | |
| | | import org.jeecg.modules.mdc.entity.EquipmentAlarm; |
| | | import org.jeecg.modules.mdc.entity.MdcEquipmentMonitor; |
| | | import org.jeecg.modules.mdc.mapper.EquipmentAlarmMapper; |
| | | import org.jeecg.modules.screen.dto.MdcProductDayscheduleDto; |
| | | import org.jeecg.modules.screen.dto.ToolLifeDto; |
| | | import org.jeecg.modules.screen.mapper.MdcSubLargeScreenMapper; |
| | | import org.jeecg.modules.screen.service.MdcSubLargeScreenService; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.LocalTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | |
| | | |
| | | @Resource |
| | | private MdcSubLargeScreenMapper mdcSubLargeScreenMapper; |
| | | |
| | | @Resource |
| | | private EquipmentAlarmMapper equipmentAlarmMapper; |
| | | |
| | | private final String today = LocalDate.now().toString(); |
| | | |
| | |
| | | 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)); |
| | | if (mdcProductDayscheduleDto.getCompletionCount() != 0) { |
| | | 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; |
| | |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 设备报警 |
| | | * |
| | | * @param productionId |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<EquipmentAlarm> equipmentAlarm(String productionId) { |
| | | String startDate = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").format(LocalDateTime.of(LocalDate.now(), LocalTime.MIN)); |
| | | String endDate = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").format(LocalDateTime.of(LocalDate.now(), LocalTime.MIN).plusDays(1)); |
| | | return equipmentAlarmMapper.equipmentAlarm(productionId, startDate, endDate); |
| | | } |
| | | |
| | | /** |
| | | * 刀具寿命管理 |
| | | * |
| | | * @param productionId |
| | | * @return |
| | | */ |
| | | @Override |
| | | public List<ToolLifeDto> toolLifeList(String productionId) { |
| | | // List<ToolLifeDto> toolLifeList = mdcSubLargeScreenMapper.toolLifeList(productionId); |
| | | // if (toolLifeList != null && !toolLifeList.isEmpty()) { |
| | | // for (ToolLifeDto toolLifeDto : toolLifeList) { |
| | | // toolLifeDto.setTId("T" + toolLifeDto.getTId()); |
| | | // } |
| | | // } |
| | | return mdcSubLargeScreenMapper.toolLifeList(productionId); |
| | | } |
| | | } |