From 7c7463d2f5012c27ac50f1d2ac39fa09616fc813 Mon Sep 17 00:00:00 2001
From: Lius <Lius2225@163.com>
Date: 星期五, 23 八月 2024 11:29:31 +0800
Subject: [PATCH] update

---
 lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/service/impl/MdcLargeScreenServiceImpl.java |   35 +++++++++++++++++++++++++++++++++++
 1 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/service/impl/MdcLargeScreenServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/service/impl/MdcLargeScreenServiceImpl.java
index 31e82b7..7874e7a 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/screen/service/impl/MdcLargeScreenServiceImpl.java
+++ b/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));
+    }
+
 }

--
Gitblit v1.9.3