lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/controller/MdcLargeScreenController.java
@@ -13,7 +13,6 @@ import javax.annotation.Resource; import java.util.List; import java.util.Map; /** * @author Lius lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/controller/MdcSubLargeScreenController.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,53 @@ package org.jeecg.modules.screen.controller; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.jeecg.common.api.vo.Result; import org.jeecg.modules.mdc.entity.MdcEquipmentMonitor; import org.jeecg.modules.mdcJc.entity.MdcProductDayschedule; import org.jeecg.modules.screen.dto.MdcProductDayscheduleDto; import org.jeecg.modules.screen.service.MdcSubLargeScreenService; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import java.util.List; /** * @author Lius * @date 2024/8/26 14:57 */ @Slf4j @Api(tags = "åæ§çæ¿") @RestController @RequestMapping("/mdc/subLargeScreen") public class MdcSubLargeScreenController { @Resource private MdcSubLargeScreenService mdcSubLargeScreenService; @ApiOperation(value = "åæ§çæ¿-彿¥ç产è¿åº¦", notes = "åæ§çæ¿-彿¥ç产è¿åº¦") @GetMapping("/todayProductionProgress") public Result<?> todayProductionProgress(String productionId) { List<MdcProductDayscheduleDto> result = mdcSubLargeScreenService.todayProductionProgress(productionId); return Result.ok(result); } @ApiOperation(value = "åæ§çæ¿-设å¤å®æ¶ç¶æ", notes = "åæ§çæ¿-设å¤å®æ¶ç¶æ") @GetMapping("/equipmentStatus") public Result<?> equipmentStatus(String productionId) { List<MdcEquipmentMonitor> result = mdcSubLargeScreenService.equipmentStatus(productionId); return Result.ok(result); } // @ApiOperation(value = "åæ§çæ¿-设å¤å®æ¶ç¶æ", notes = "åæ§çæ¿-设å¤å®æ¶ç¶æ") // @GetMapping("/equipmentStatus") // public Result<?> equipmentStatus(String productionId) { // List<MdcEquipmentMonitor> result = mdcSubLargeScreenService.equipmentStatus(productionId); // return Result.ok(result); // } } lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/dto/MdcProductDayscheduleDto.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,20 @@ package org.jeecg.modules.screen.dto; import lombok.Data; import org.jeecg.modules.mdcJc.entity.MdcProductDayschedule; import java.math.BigDecimal; /** * @author Lius * @date 2024/8/26 16:27 */ @Data public class MdcProductDayscheduleDto extends MdcProductDayschedule { /** * 产ååæ ¼ç */ private BigDecimal passRate = BigDecimal.ZERO; } lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/mapper/MdcSubLargeScreenMapper.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,34 @@ package org.jeecg.modules.screen.mapper; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; import org.jeecg.modules.mdc.entity.MdcEquipmentMonitor; import org.jeecg.modules.screen.dto.MdcProductDayscheduleDto; import org.springframework.stereotype.Repository; import java.util.List; /** * @author Lius * @date 2024/8/26 15:02 */ @Mapper @Repository public interface MdcSubLargeScreenMapper { /** * 彿¥ç产计å * * @param productionId * @param date * @return */ List<MdcProductDayscheduleDto> todayProductionProgress(@Param("productionId") String productionId, @Param("date") String date); /** * 设å¤å®æ¶ç¶æ * * @param productionId * @return */ List<MdcEquipmentMonitor> checkStatusFromEquipmentIds(@Param("productionId") String productionId); } lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/mapper/xml/MdcSubLargeScreenMapper.xml
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,35 @@ <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <mapper namespace="org.jeecg.modules.screen.mapper.MdcSubLargeScreenMapper"> <!--彿¥ç产计å--> <select id="todayProductionProgress" resultType="org.jeecg.modules.screen.dto.MdcProductDayscheduleDto"> SELECT t1.* FROM mdcJc_ProductDayschedule t1 LEFT JOIN mdc_equipment t2 ON t1.equipmentID = t2.equipment_id LEFT JOIN mdc_production_equipment t3 ON t2.id = t3.equipment_id WHERE t3.production_id = #{productionId} AND planDate = #{date} </select> <!--设å¤å®æ¶ç¶æ--> <select id="checkStatusFromEquipmentIds" resultType="org.jeecg.modules.mdc.entity.MdcEquipmentMonitor"> SELECT t1.equipment_id, t2.CollectTime, t1.equipment_name, t2.Oporation, t1.id, t1.equipment_status, t1.equipment_type equipmentType FROM mdc_equipment t1 LEFT JOIN Equipment t2 ON t1.equipment_id = t2.EquipmentID LEFT JOIN mdc_production_equipment t3 ON t1.id = t3.equipment_id WHERE t3.production_id = #{productionId} </select> </mapper> lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/service/MdcSubLargeScreenService.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,29 @@ package org.jeecg.modules.screen.service; import org.jeecg.modules.mdc.entity.MdcEquipmentMonitor; import org.jeecg.modules.screen.dto.MdcProductDayscheduleDto; import java.util.List; /** * @author Lius * @date 2024/8/26 15:00 */ public interface MdcSubLargeScreenService { /** * 彿¥ç产è¿åº¦ * * @param productionId * @return */ List<MdcProductDayscheduleDto> todayProductionProgress(String productionId); /** * 设å¤å®æ¶ç¶æ * * @param productionId * @return */ List<MdcEquipmentMonitor> equipmentStatus(String productionId); } lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/service/impl/MdcLargeScreenServiceImpl.java
@@ -3,7 +3,6 @@ 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; import org.jeecg.modules.mdcJc.service.IMdcProductDayScheduleService; import org.jeecg.modules.screen.dto.*; lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/service/impl/MdcSubLargeScreenServiceImpl.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,81 @@ package org.jeecg.modules.screen.service.impl; import org.jeecg.modules.mdc.entity.MdcEquipmentMonitor; import org.jeecg.modules.screen.dto.MdcProductDayscheduleDto; import org.jeecg.modules.screen.mapper.MdcSubLargeScreenMapper; import org.jeecg.modules.screen.service.MdcSubLargeScreenService; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.math.BigDecimal; import java.math.RoundingMode; import java.time.LocalDate; import java.util.ArrayList; import java.util.List; /** * @author Lius * @date 2024/8/26 15:01 */ @Service public class MdcSubLargeScreenServiceImpl implements MdcSubLargeScreenService { @Resource private MdcSubLargeScreenMapper mdcSubLargeScreenMapper; private final String today = LocalDate.now().toString(); /** * 彿¥ç产计å * * @param productionId * @return */ @Override public List<MdcProductDayscheduleDto> todayProductionProgress(String productionId) { List<MdcProductDayscheduleDto> mdcProductDayscheduleDtos = new ArrayList<>(); 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)); } } return mdcProductDayscheduleDtos; } /** * 设å¤å®æ¶ç¶æ * * @param productionId * @return */ @Override public List<MdcEquipmentMonitor> equipmentStatus(String productionId) { List<MdcEquipmentMonitor> result = mdcSubLargeScreenMapper.checkStatusFromEquipmentIds(productionId); if (result != null && !result.isEmpty()) { for (MdcEquipmentMonitor mdcEquipmentMonitor : result) { if (mdcEquipmentMonitor.getOporation() != null) { switch (mdcEquipmentMonitor.getOporation()) { case 1: case 2: mdcEquipmentMonitor.setOporationDict("å¾ æº"); break; case 3: mdcEquipmentMonitor.setOporationDict("è¿è¡"); break; case 22: mdcEquipmentMonitor.setOporationDict("æ¥è¦"); break; default: mdcEquipmentMonitor.setOporationDict("å ³æº"); break; } } else { mdcEquipmentMonitor.setOporationDict("å ³æº"); mdcEquipmentMonitor.setOporation(0); } } } return result; } }