lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/controller/MdcLargeScreenController.java
@@ -6,6 +6,7 @@ import org.jeecg.common.api.vo.Result; import org.jeecg.modules.screen.dto.*; import org.jeecg.modules.screen.service.MdcLargeScreenService; import org.jeecg.modules.system.entity.MdcProduction; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -31,7 +32,7 @@ @ApiOperation(value = "æ»æ§çæ¿-仿¥ç产è¿åº¦", notes = "æ»æ§çæ¿-仿¥ç产è¿åº¦") @GetMapping("/todayProductionSchedule") public Result<?> todayProductionSchedule() { List<TodayProductionDto> result = mdcLargeScreenService.todayProductionSchedule(); List<TodayProductionDto> result = mdcLargeScreenService.todayProductionSchedule(); return Result.ok(result); } @@ -58,6 +59,7 @@ /** * 弿ºçå©ç¨ç * * @return */ @ApiOperation(value = "æ»æ§çæ¿-仿¥è®¾å¤å·¥ä½æç", notes = "æ»æ§çæ¿-仿¥è®¾å¤å·¥ä½æç") @@ -70,8 +72,14 @@ @ApiOperation(value = "æ»æ§çæ¿-æè®¾å¤å©ç¨ç", notes = "æ»æ§çæ¿-æè®¾å¤å©ç¨ç") @GetMapping("/monthEquipmentUtilizationRate") public Result<?> monthEquipmentUtilizationRate() { return Result.ok(); List<MonthEquipmentUtilizationRateDto> result = mdcLargeScreenService.monthEquipmentUtilizationRate(); return Result.ok(result); } @ApiOperation(value = "æ»æ§çæ¿-产线å表", notes = "æ»æ§çæ¿-产线å表") @GetMapping("/productionList") public Result<?> productionList() { List<MdcProduction> result = mdcLargeScreenService.productionList(); return Result.ok(result); } } lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/dto/MonthEquipmentUtilizationRateDto.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,24 @@ package org.jeecg.modules.screen.dto; import lombok.Data; import java.math.BigDecimal; /** * @author Lius * @date 2024/8/22 17:03 */ @Data public class MonthEquipmentUtilizationRateDto { /** * æ¥æ */ private String date; /** * å©ç¨ç */ private BigDecimal utilizationRate = BigDecimal.ZERO; } lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/mapper/MdcLargeScreenMapper.java
@@ -31,4 +31,5 @@ List<MdcEfficiencyDto> efficiencyList(@Param("date") String date); List<MdcEfficiencyDto> efficiency(@Param("startDate") String startDate, @Param("endDate") String endDate); } lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/mapper/xml/MdcLargeScreenMapper.xml
@@ -81,4 +81,18 @@ WHERE t1.the_date = #{date} </select> <select id="efficiency" resultType="org.jeecg.modules.mdc.dto.MdcEfficiencyDto"> SELECT the_date, SUM ( process_long ) process_long FROM mdc_equipment_statistical_info WHERE the_date BETWEEN #{startDate} AND #{endDate} GROUP BY the_date ORDER BY the_date ASC </select> </mapper> lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/service/MdcLargeScreenService.java
@@ -1,6 +1,7 @@ package org.jeecg.modules.screen.service; import org.jeecg.modules.screen.dto.*; import org.jeecg.modules.system.entity.MdcProduction; import java.util.List; import java.util.Map; @@ -46,4 +47,17 @@ */ List<EquipmentRateDto> todayEquipmentRate(); /** * æè®¾å¤å©ç¨ç * * @return */ List<MonthEquipmentUtilizationRateDto> monthEquipmentUtilizationRate(); /** * 产线å表 * @return */ List<MdcProduction> productionList(); } lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/service/impl/MdcLargeScreenServiceImpl.java
@@ -1,5 +1,7 @@ package org.jeecg.modules.screen.service.impl; 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; @@ -7,6 +9,8 @@ import org.jeecg.modules.screen.dto.*; import org.jeecg.modules.screen.mapper.MdcLargeScreenMapper; import org.jeecg.modules.screen.service.MdcLargeScreenService; import org.jeecg.modules.system.entity.MdcProduction; import org.jeecg.modules.system.service.IMdcProductionService; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -32,6 +36,9 @@ private final String yesterday = LocalDate.now().plusDays(-1).toString().replaceAll("-", ""); private final String today = LocalDate.now().toString(); @Resource private IMdcProductionService mdcProductionService; /** @@ -124,4 +131,32 @@ } return result; } /** * æå©ç¨ç * * @return */ @Override public List<MonthEquipmentUtilizationRateDto> monthEquipmentUtilizationRate() { List<MonthEquipmentUtilizationRateDto> result = new ArrayList<>(); String startDate = LocalDate.now().plusDays(-32).toString().replaceAll("-", ""); List<MdcEfficiencyDto> mdcEfficiencyDtoList = mdcLargeScreenMapper.efficiency(startDate, yesterday); if (mdcEfficiencyDtoList != null && !mdcEfficiencyDtoList.isEmpty()) { for (MdcEfficiencyDto mdcEfficiencyDto : mdcEfficiencyDtoList) { MonthEquipmentUtilizationRateDto meu = new MonthEquipmentUtilizationRateDto(); meu.setDate(new StringBuilder(mdcEfficiencyDto.getTheDate().substring(4, 8)).insert(2, "-").toString()); BigDecimal equipmentCount = mdcLargeScreenMapper.findEquipmentCount(yesterday); meu.setUtilizationRate(mdcEfficiencyDto.getProcessLong().divide(equipmentCount.multiply(new BigDecimal("86400")), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP)); result.add(meu); } } return result; } @Override public List<MdcProduction> productionList() { return mdcProductionService.list(new LambdaQueryWrapper<MdcProduction>().eq(MdcProduction::getOrgType, "3").eq(MdcProduction::getDelFlag, CommonConstant.DEL_FLAG_0.toString()).orderByAsc(MdcProduction::getProductionOrder)); } }