lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/controller/MdcSubLargeScreenController.java
@@ -6,8 +6,8 @@ import org.jeecg.common.api.vo.Result; import org.jeecg.modules.mdc.entity.EquipmentAlarm; 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.dto.ToolLifeDto; import org.jeecg.modules.screen.service.MdcSubLargeScreenService; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; @@ -50,5 +50,12 @@ return Result.ok(result); } @ApiOperation(value = "åæ§çæ¿-åå ·å¯¿å½å表", notes = "åæ§çæ¿-åå ·å¯¿å½å表") @GetMapping("/toolLifeList") public Result<?> toolLifeList(String productionId) { List<ToolLifeDto> result = mdcSubLargeScreenService.toolLifeList(productionId); return Result.ok(result); } } lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/dto/ToolLifeDto.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,19 @@ package org.jeecg.modules.screen.dto; import lombok.Data; import java.util.UUID; /** * @author Lius * @date 2024/10/9 11:22 */ @Data public class ToolLifeDto { private String id = UUID.randomUUID().toString().replaceAll("-", ""); private String equipmentId; private String equipmentName; private String tId; private String initLife; private String currentLife; } lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/mapper/MdcSubLargeScreenMapper.java
@@ -4,6 +4,7 @@ import org.apache.ibatis.annotations.Param; import org.jeecg.modules.mdc.entity.MdcEquipmentMonitor; import org.jeecg.modules.screen.dto.MdcProductDayscheduleDto; import org.jeecg.modules.screen.dto.ToolLifeDto; import org.springframework.stereotype.Repository; import java.util.List; @@ -31,4 +32,12 @@ * @return */ List<MdcEquipmentMonitor> checkStatusFromEquipmentIds(@Param("productionId") String productionId); /** * åå ·å¯¿å½ç®¡ç * * @param productionId * @return */ List<ToolLifeDto> toolLifeList(@Param("productionId") String productionId); } lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/mapper/xml/MdcSubLargeScreenMapper.xml
@@ -33,4 +33,28 @@ WHERE t3.production_id = #{productionId} </select> <!--åå ·å¯¿å½å表--> <select id="toolLifeList" resultType="org.jeecg.modules.screen.dto.ToolLifeDto"> SELECT t.* FROM ( SELECT a.EquipmentID equipmentId, t1.equipment_name equipmentName, a.TId tId, a.InitLife initLife, a.CurrentLife currentLife, row_number( ) OVER ( partition BY EquipmentID, TId ORDER BY CollectTime DESC ) rw FROM Basi_CuttingToolCraftLife a LEFT JOIN mdc_equipment t1 ON t1.equipment_id = a.EquipmentID LEFT JOIN mdc_production_equipment t2 ON t1.id = t2.equipment_id WHERE t2.production_id = #{productionId} ) t WHERE t.rw = 1; </select> </mapper> lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/service/MdcSubLargeScreenService.java
@@ -3,6 +3,7 @@ import org.jeecg.modules.mdc.entity.EquipmentAlarm; import org.jeecg.modules.mdc.entity.MdcEquipmentMonitor; import org.jeecg.modules.screen.dto.MdcProductDayscheduleDto; import org.jeecg.modules.screen.dto.ToolLifeDto; import java.util.List; @@ -35,5 +36,11 @@ */ List<EquipmentAlarm> equipmentAlarm(String productionId); /** * åå ·å¯¿å½ç®¡ç * * @param productionId * @return */ List<ToolLifeDto> toolLifeList(String productionId); } lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/service/impl/MdcSubLargeScreenServiceImpl.java
@@ -4,6 +4,7 @@ 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; @@ -101,4 +102,21 @@ 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 toolLifeList; } }