From 5c18a8c93db1cf1b7b6d61a618e3a1b87fb14883 Mon Sep 17 00:00:00 2001
From: Lius <Lius2225@163.com>
Date: 星期四, 08 五月 2025 15:05:15 +0800
Subject: [PATCH] 看板接口mdc部分

---
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcOeeInfoServiceImpl.java |   60 +++++++++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 47 insertions(+), 13 deletions(-)

diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcOeeInfoServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcOeeInfoServiceImpl.java
index d166372..6019a60 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcOeeInfoServiceImpl.java
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcOeeInfoServiceImpl.java
@@ -15,6 +15,7 @@
 import org.jeecg.modules.mdc.util.DateUtils;
 import org.jeecg.modules.mdc.vo.MdcOeeComputeVo;
 import org.jeecg.modules.mdc.vo.MdcOeeInfoVo;
+import org.jeecg.modules.mdcJc.service.IMdcJcRcJobreportService;
 import org.jeecgframework.poi.excel.def.NormalExcelConstants;
 import org.jeecgframework.poi.excel.entity.ExportParams;
 import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
@@ -45,8 +46,11 @@
     @Resource
     private IMdcDowntimeService mdcDowntimeService;
 
+//    @Resource
+//    private IMdcPartProcessInfoService mdcPartProcessInfoService;
+
     @Resource
-    private IMdcPartProcessInfoService mdcPartProcessInfoService;
+    private IMdcJcRcJobreportService mdcJcRcJobreportService;
 
     @Resource
     private IMdcEquipmentStatisticalInfoService mdcEquipmentStatisticalInfoService;
@@ -165,8 +169,8 @@
     @Transactional(rollbackFor = Exception.class)
     public void computeOee(MdcOeeComputeVo mdcOeeComputeVo) {
         List<MdcOeeInfo> result = new ArrayList<>();
-        String startDate = mdcOeeComputeVo.getStartDate();
-        String endDate = mdcOeeComputeVo.getEndDate();
+        String startDate = mdcOeeComputeVo.getStartTime();
+        String endDate = mdcOeeComputeVo.getEndTime();
         List<String> dateList = DateUtils.getDatesStringList(DateUtils.getShortDate(startDate), DateUtils.getShortDate(endDate));
         if (!dateList.isEmpty()) {
             //鑾峰彇璁惧鍒楄〃
@@ -204,13 +208,17 @@
                     mdcOeeInfo.setTimeActuationRate(timeActuationRate);
                     // 鏈夋晥杩愯鏃堕棿 --- 鎸夐渶姹傜淮鎶ら浂浠跺姞宸ユ�绘椂闀縷|绯荤粺涓昏酱璐熻浇鏃堕棿
                     Integer effectiveRunLong = 0;
-                    Integer totalProcessLong = mdcPartProcessInfoService.selectTotalProcessLong(equipmentId, validDate);
-                    if (totalProcessLong == 0) {
-                        //鏌ヨ璁惧杩愯鏃堕棿
-                        effectiveRunLong = mdcEquipmentStatisticalInfoService.selectProcessLong(equipmentId, validDate.replace("-", ""));
-                    } else {
-                        effectiveRunLong = totalProcessLong;
+//                    Integer totalProcessLong = mdcPartProcessInfoService.selectTotalProcessLong(equipmentId, validDate);
+                    //鏌ヨ璁惧杩愯鏃堕棿
+                    effectiveRunLong = mdcEquipmentStatisticalInfoService.selectProcessLong(equipmentId, validDate.replace("-", ""));
+                    if (effectiveRunLong == null) {
+                        effectiveRunLong = 0;
                     }
+//                    if (totalProcessLong == 0) {
+//
+//                    } else {
+//                        effectiveRunLong = totalProcessLong;
+//                    }
                     mdcOeeInfo.setEffectiveRunLong(effectiveRunLong);
                     // 鎬ц兘寮�鍔ㄧ巼 --- 鏈夋晥杩愯鏃堕棿/寮�鍔ㄦ椂闂�
                     BigDecimal performanceRate = BigDecimal.ZERO;
@@ -219,13 +227,24 @@
                     }
                     mdcOeeInfo.setPerformanceRate(performanceRate);
                     // 鍔犲伐闆朵欢鏁伴噺 --- 鎸夌淮鎶ゆ暟鎹粺璁″綋澶�
-                    Integer processCount = mdcPartProcessInfoService.selectTotalProcessCount(equipmentId, validDate);
+//                    Integer processCount = mdcPartProcessInfoService.selectTotalProcessCount(equipmentId, validDate);
+//                    mdcOeeInfo.setProcessCount(processCount);
+//                    // 鍚堟牸闆朵欢鏁伴噺 --- 鎸夌淮鎶ゆ暟鎹粺璁″綋澶�
+//                    Integer passCount = mdcPartProcessInfoService.selectTotalPassCount(equipmentId, validDate);
+//                    mdcOeeInfo.setPassCount(passCount);
+//                    // 鍚堟牸鐜� --- 鍚堟牸鏁�/鍔犲伐鏁�
+//                    BigDecimal passRate = BigDecimal.ZERO;
+//                    if (processCount != 0 && passCount != 0) {
+//                        passRate = new BigDecimal(passCount).divide(new BigDecimal(processCount), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP);
+//                    }
+                    // 鍔犲伐闆朵欢鏁伴噺
+                    Integer processCount = mdcJcRcJobreportService.selectTotalProcessCount(equipmentId, validDate);
                     mdcOeeInfo.setProcessCount(processCount);
-                    // 鍚堟牸闆朵欢鏁伴噺 --- 鎸夌淮鎶ゆ暟鎹粺璁″綋澶�
-                    Integer passCount = mdcPartProcessInfoService.selectTotalPassCount(equipmentId, validDate);
+                    // 鍚堟牸闆朵欢鏁伴噺
+                    Integer passCount = mdcJcRcJobreportService.selectTotalPassCount(equipmentId, validDate);
                     mdcOeeInfo.setPassCount(passCount);
                     // 鍚堟牸鐜� --- 鍚堟牸鏁�/鍔犲伐鏁�
-                    BigDecimal passRate = BigDecimal.ZERO;
+                    BigDecimal passRate = new BigDecimal("100");
                     if (processCount != 0 && passCount != 0) {
                         passRate = new BigDecimal(passCount).divide(new BigDecimal(processCount), 4, RoundingMode.HALF_UP).multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP);
                     }
@@ -243,4 +262,19 @@
         super.saveBatch(result);
     }
 
+    @Override
+    public BigDecimal findByEquIdsAndDate(List<String> equipmentIdList, String date) {
+        return this.baseMapper.findByEquIdsAndDate(equipmentIdList, date);
+    }
+
+    @Override
+    public BigDecimal findByEquIdAndDate(String equipmentId, String date) {
+        return this.baseMapper.findByEquIdAndDate(equipmentId, date);
+    }
+
+    @Override
+    public BigDecimal findByEquIdAndMonth(String equipmentId, String month) {
+        return this.baseMapper.findByEquIdAndMonth(equipmentId, month);
+    }
+
 }

--
Gitblit v1.9.3