Browse Source

Merge remote-tracking branch 'origin/mode-min-unit' into mode-min-unit

xiahan 9 months ago
parent
commit
8ca609e662
34 changed files with 2282 additions and 46 deletions
  1. 1 1
      cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/dao/ApsBlankOrderDao.java
  2. 4 0
      cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/dao/ApsProductDetailDao.java
  3. 23 20
      cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ApsBlankOrderServiceImpl.java
  4. 25 4
      cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ApsProcessOperationServiceImpl.java
  5. 18 4
      cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ApsProductDetailServiceImpl.java
  6. 53 0
      cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ApsReportRecordsServiceImpl.java
  7. 2 2
      cx-aps/cx-aps-common/src/main/resources/mybatis/ApsBlankOrderDao.xml
  8. 61 0
      cx-aps/cx-aps-common/src/main/resources/mybatis/ApsProductDetailDao.xml
  9. 3 0
      cx-aps/cx-aps-entity/src/main/java/com/rongwei/bsentity/vo/GetOldTechnicalRequirementReq.java
  10. 3 1
      cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/config/EquForkliftRepairRecordListener.java
  11. 54 0
      cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/dao/EquEnergyMeterCenterDosageDayDao.java
  12. 62 0
      cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/dao/EquEnergyMeterCenterDosageMonthDao.java
  13. 12 0
      cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/dao/EquEnergyMeterDosageDayDao.java
  14. 68 0
      cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/dao/EquEnergyMeterDosageMonthDao.java
  15. 58 0
      cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/dao/EquEnergyRecordDao.java
  16. 11 0
      cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/excel/EquForkliftRepairRecordTemplate.java
  17. 14 0
      cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/service/EquEnergyMeterCenterDosageDayService.java
  18. 10 0
      cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/service/EquEnergyMeterCenterDosageMonthService.java
  19. 11 0
      cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/service/EquEnergyMeterDosageDayService.java
  20. 14 0
      cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/service/EquEnergyMeterDosageMonthService.java
  21. 10 0
      cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/service/EquEnergyRecordService.java
  22. 42 0
      cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/service/impl/EquEnergyMeterCenterDosageDayServiceImpl.java
  23. 91 0
      cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/service/impl/EquEnergyMeterCenterDosageMonthServiceImpl.java
  24. 19 0
      cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/service/impl/EquEnergyMeterDosageDayServiceImpl.java
  25. 90 0
      cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/service/impl/EquEnergyMeterDosageMonthSetviceImpl.java
  26. 105 0
      cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/service/impl/EquEnergyRecordServiceImpl.java
  27. 14 14
      cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/service/impl/EquForkliftRepairRecordServiceImpl.java
  28. 182 0
      cx-equipment/cx-equipment-entity/src/main/java/com/rongwei/bsentity/domain/EquEnergyMeterCenterDosageDayDo.java
  29. 399 0
      cx-equipment/cx-equipment-entity/src/main/java/com/rongwei/bsentity/domain/EquEnergyMeterCenterDosageMonthDo.java
  30. 163 0
      cx-equipment/cx-equipment-entity/src/main/java/com/rongwei/bsentity/domain/EquEnergyMeterDosageDayDo.java
  31. 381 0
      cx-equipment/cx-equipment-entity/src/main/java/com/rongwei/bsentity/domain/EquEnergyMeterDosageMonthDo.java
  32. 224 0
      cx-equipment/cx-equipment-entity/src/main/java/com/rongwei/bsentity/domain/EquEnergyRecordDo.java
  33. 10 0
      cx-equipment/cx-equipment-entity/src/main/java/com/rongwei/bsentity/domain/EquForkliftRepairRecordDo.java
  34. 45 0
      cx-equipment/cx-equipment-server/src/main/java/com/rongwei/bsserver/sys/controller/EquEnergyRecordController.java

+ 1 - 1
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/dao/ApsBlankOrderDao.java

@@ -35,7 +35,7 @@ public interface ApsBlankOrderDao extends BaseMapper<ApsBlankOrderDo> {
             "LEFT JOIN aps_process_operation c on c.BLANKID=a.ID " +
             "where a.PRODUCTIONORDERID=#{orderId} " +
             "and (c.LOCKMARK='n' or c.LOCKMARK is null) " +
-            "and a.DELETED='0' and b.DELETED='0' and c.DELETED='0'")
+            "and a.DELETED='0' and b.DELETED='0' and c.DELETED='0' and a.ISSTAG ='否'")
     List<ApsBlankOrderVo> getByOrderId(@Param("orderId") String orderId);
 
     @Select("select a.*,b.DELIVERYDATE,b.DELIVERYTIME from aps_blank_order a LEFT JOIN aps_production_order b on a.PRODUCTIONORDERID=b.ID \n" +

+ 4 - 0
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/dao/ApsProductDetailDao.java

@@ -65,4 +65,8 @@ public interface ApsProductDetailDao extends BaseMapper<ApsProductDetailDo> {
     void publishCancel(@Param("productionOrderIds") List<String> productionOrderIds);
 
     List<GetOldTechnicalRequirementRes> selectMyList(@Param("technicalRequirementId") String technicalRequirementId, @Param("id") String id, @Param("alloy") String alloy, @Param("alloystatus") String alloystatus, @Param("orderProductTypeId") String orderProductTypeId);
+
+    List<GetOldTechnicalRequirementRes> selectMyList1(@Param("technicalRequirementId") String technicalRequirementId, @Param("id") String id, @Param("customId") String customId, @Param("alloy") String alloy);
+    List<GetOldTechnicalRequirementRes> selectMyList2(@Param("technicalRequirementId") String technicalRequirementId, @Param("id") String id, @Param("customId") String customId, @Param("alloystatus") String alloystatus);
+    List<GetOldTechnicalRequirementRes> selectMyList3(@Param("technicalRequirementId") String technicalRequirementId, @Param("id") String id, @Param("customId") String customId, @Param("orderProductTypeId") String orderProductTypeId);
 }

+ 23 - 20
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ApsBlankOrderServiceImpl.java

@@ -668,7 +668,7 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
             // 回写订单排程交货期
             Map<String, Date> orderDeliveryTime = new HashMap<>();
             // 查询所有坯料计划信息
-            List<ApsBlankOrderDo> apsBlankOrderDos = (List<ApsBlankOrderDo>)apsBlankOrderService.listByIds(blankids);
+            List<ApsBlankOrderDo> apsBlankOrderDos = (List<ApsBlankOrderDo>) apsBlankOrderService.listByIds(blankids);
             // 坯料计划ID集合
             List<String> blankKeys = new ArrayList<>();
             List<ApsBlankOrderDo> blankIds = new ArrayList<>();
@@ -679,7 +679,7 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
                         // 坯料计划信息
                         List<ApsBlankOrderDo> orders = apsBlankOrderDos.stream().filter(v -> v.getId().equals(order.getId())).collect(Collectors.toList());
                         ApsBlankOrderDo nowOrder = null;
-                        if(orders != null && orders.size()>0){
+                        if (orders != null && orders.size() > 0) {
                             nowOrder = orders.get(0);
                         }
 
@@ -689,13 +689,13 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
                             ApsBlankOrderDo blankOrderDo = hasblanks.get(0);
                             if (blankOrderDo.getScheduledatestart().compareTo(endDate) > 0) {
                                 blankOrderDo.setScheduledatestart(endDate);
-                                if(nowOrder != null && nowOrder.getPromisedatestart() == null){
+                                if (nowOrder != null && nowOrder.getPromisedatestart() == null) {
                                     blankOrderDo.setPromisedatestart(DateUtil.offsetDay(endDate, 2));
                                 }
                             }
                             if (blankOrderDo.getScheduledateend().compareTo(endDate) < 0) {
                                 blankOrderDo.setScheduledateend(endDate);
-                                if(nowOrder != null && nowOrder.getPromisedateend() == null){
+                                if (nowOrder != null && nowOrder.getPromisedateend() == null) {
                                     blankOrderDo.setPromisedateend(DateUtil.offsetDay(endDate, 2));
                                 }
                             }
@@ -706,10 +706,10 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
                             updateBlank.setSchedulingstatus(TO_BE_PUBLISHED);
                             updateBlank.setScheduledatestart(endDate);
                             updateBlank.setScheduledateend(endDate);
-                            if(nowOrder != null && nowOrder.getPromisedatestart() == null){
+                            if (nowOrder != null && nowOrder.getPromisedatestart() == null) {
                                 updateBlank.setPromisedatestart(DateUtil.offsetDay(endDate, 2));
                             }
-                            if(nowOrder != null && nowOrder.getPromisedateend() == null){
+                            if (nowOrder != null && nowOrder.getPromisedateend() == null) {
                                 updateBlank.setPromisedateend(DateUtil.offsetDay(endDate, 2));
                             }
                             // 自动加锁坯料计划
@@ -1745,28 +1745,31 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
 
 
         //如果存在订单产品和输出单卷重都相同坯料输出成品,错误提示:以下坯料输出成品重复:{订单产品1}{输出单卷重}{数量单位},{订单产品2}{输出单卷重}{数量单位}
-        //组装一下list
-        List<String> processOutputDesList = apsProcessOutputProductDoList.stream().map(item -> {
+        //新需求:如果存在关联相同的订单产品,并且输出单卷重都相同坯料输出成品,错误提示:以下坯料输出成品重复:{订单产品1}{输出单卷重}{数量单位},{订单产品2}{输出单卷重}{数量单位}
+        //用于判断是否重复
+        Map<String, String> checkOutputDesMap = new HashMap<>();
+        //有重复数据订单产品的数组
+        List<String> endCheckOutputDesList = new LinkedList<>();
+        for (ApsProcessOutputProductDo apsProcessOutputProductDo : apsProcessOutputProductDoList) {
+            //产品明细的ID
+            String productid = apsProcessOutputProductDo.getProductid();
+
             String unit = "吨";
-            if (item.getCountunit().equals(SaveConstans.CountUnit.KG)) {
+            if (apsProcessOutputProductDo.getCountunit().equals(SaveConstans.CountUnit.KG)) {
                 unit = "千克";
             }
-            return item.getProductname() + item.getOutputonerollweigth() + unit;
-        }).collect(Collectors.toList());
+            //拼接字段
+            String s = apsProcessOutputProductDo.getProductname() + apsProcessOutputProductDo.getOutputonerollweigth() + unit;
 
-        //用于判断是否重复
-        List<String> checkOutputDesList = new LinkedList<>();
-        //有重复数据订单产品的数组
-        List<String> endCheckOutputDesList = new LinkedList<>();
-        for (String s : processOutputDesList) {
-            if (checkOutputDesList.contains(s)) {
+            if (checkOutputDesMap.containsKey(productid) && checkOutputDesMap.get(productid).equals(s)) {
                 endCheckOutputDesList.add(s);
             } else {
-                checkOutputDesList.add(s);
+                checkOutputDesMap.put(productid, s);
             }
         }
-        if (endCheckOutputDesList.size() > 0) {
-            String join = String.join(",", endCheckOutputDesList);
+        List<String> collect = endCheckOutputDesList.stream().distinct().collect(Collectors.toList());
+        if (!collect.isEmpty()) {
+            String join = String.join(",", collect);
             return R.error("以下坯料输出成品重复:" + join);
         }
 

+ 25 - 4
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ApsProcessOperationServiceImpl.java

@@ -178,9 +178,12 @@ public class ApsProcessOperationServiceImpl extends ServiceImpl<ApsProcessOperat
             List<ApsCraftRouteOutMaterRequestDo> apsCraftRouteOutMaterRequestDoList = apsCraftRouteOutMaterRequestService.listByMap(map).stream().collect(Collectors.toList());
 
             //工艺路线对应的可选设备
-            Map<String, Object> equmap = new HashMap<>();
-            equmap.put("DELETED", "0");
-            List<ApsCraftRouteStepEquDo> apsCraftRouteStepEquDoList = apsCraftRouteStepEquService.listByMap(equmap).stream().collect(Collectors.toList());
+            List<ApsCraftRouteStepEquDo> apsCraftRouteStepEquDoList = apsCraftRouteStepEquService.listByMap(map).stream().collect(Collectors.toList());
+            if (apsCraftRouteStepEquDoList.size() == 0) {
+                Map<String, Object> equmap = new HashMap<>();
+                equmap.put("DELETED", "0");
+                apsCraftRouteStepEquDoList = apsCraftRouteStepEquService.listByMap(equmap).stream().collect(Collectors.toList());
+            }
 
             //工艺路线对应的思维导图
             List<SysMindMappingDo> sysMindMappingDos = new ArrayList<>();
@@ -371,6 +374,9 @@ public class ApsProcessOperationServiceImpl extends ServiceImpl<ApsProcessOperat
 
                             //本道工序的可选设备
                             List<ApsCraftRouteStepEquDo> apsCraftRouteStepEquDos = apsCraftRouteStepEquDoList.stream().filter(crse -> apsCraftRouteStepDo1.getId().equals(crse.getCraftstepid())).collect(Collectors.toList());
+                            if (apsCraftRouteStepEquDos.size() == 0) {
+                                return R.error("工艺步骤" + apsCraftRouteStepDo1.getProcessname() + "没可选设备");
+                            }
                             List<String> equIdList = new ArrayList<>();//设备
                             List<String> equGroupIdList = new ArrayList<>();//资源组
                             for (ApsCraftRouteStepEquDo apsCraftRouteStepEquDo : apsCraftRouteStepEquDos) {
@@ -540,6 +546,9 @@ public class ApsProcessOperationServiceImpl extends ServiceImpl<ApsProcessOperat
                         if (hasFirst) {
                             //本道工序的可选设备
                             List<ApsCraftRouteStepEquDo> apsCraftRouteStepEquDos = apsCraftRouteStepEquDoList.stream().filter(crse -> apsCraftRouteStepDo.getId().equals(crse.getCraftstepid())).collect(Collectors.toList());
+                            if (apsCraftRouteStepEquDos.size() == 0) {
+                                return R.error("工艺步骤" + apsCraftRouteStepDo.getProcessname() + "没可选设备");
+                            }
                             List<String> equIdList = new ArrayList<>();//设备
                             List<String> equGroupIdList = new ArrayList<>();//资源组
                             for (ApsCraftRouteStepEquDo apsCraftRouteStepEquDo : apsCraftRouteStepEquDos) {
@@ -866,6 +875,9 @@ public class ApsProcessOperationServiceImpl extends ServiceImpl<ApsProcessOperat
 
                         //本道工序的可选设备
                         List<ApsProcessOperationEquDo> apsProcessOperationEquDos1 = apsProcessOperationEquDos.stream().filter(crse -> apsProcessOperationDo1.getId().equals(crse.getMainid())).collect(Collectors.toList());
+                        if (apsProcessOperationEquDos1.size() == 0) {
+                            return R.error("工艺步骤" + apsProcessOperationDo1.getProcessname() + "没可选设备");
+                        }
                         for (ApsProcessOperationEquDo apsProcessOperationEquDo : apsProcessOperationEquDos1) {
                             ApsProcessOperationEquDo processOperationEquDo = BeanUtil.toBean(apsProcessOperationEquDo, ApsProcessOperationEquDo.class);
                             processOperationEquDo.setId(SecurityUtil.getUUID());
@@ -1049,6 +1061,9 @@ public class ApsProcessOperationServiceImpl extends ServiceImpl<ApsProcessOperat
                     if (hasFirst) {
                         //本道工序的可选设备
                         List<ApsProcessOperationEquDo> apsProcessOperationEquDos1 = apsProcessOperationEquDos.stream().filter(omd -> apsProcessOperationDo.getId().equals(omd.getMainid())).collect(Collectors.toList());
+                        if (apsProcessOperationEquDos1.size() == 0) {
+                            return R.error("工艺步骤" + apsProcessOperationDo.getProcessname() + "没可选设备");
+                        }
                         for (ApsProcessOperationEquDo apsProcessOperationEquDo : apsProcessOperationEquDos1) {
                             ApsProcessOperationEquDo processOperationEquDo = BeanUtil.toBean(apsProcessOperationEquDo, ApsProcessOperationEquDo.class);
                             processOperationEquDo.setId(SecurityUtil.getUUID());
@@ -1242,9 +1257,15 @@ public class ApsProcessOperationServiceImpl extends ServiceImpl<ApsProcessOperat
         //校验工序作业明细的加工设备和加工车间的代号是否为空
         if (checkDeviceAndOrgCode) {
             //查询坯料计划对应的所有工序作业明细
-            List<ApsProcessOperationProcessEquDo> list = apsProcessOperationProcessEquService.list(new QueryWrapper<ApsProcessOperationProcessEquDo>().lambda().eq(ApsProcessOperationProcessEquDo::getBlankid, blankId));
+            List<ApsProcessOperationProcessEquDo> list = apsProcessOperationProcessEquService.list(new QueryWrapper<ApsProcessOperationProcessEquDo>().lambda().eq(ApsProcessOperationProcessEquDo::getBlankid, blankId).ne(ApsProcessOperationProcessEquDo::getClosestatus, "已完工"));
+            if (ObjectUtil.isEmpty(list)) {
+                return R.ok();
+            }
             //获取所有工序作业明细的加工设备
             Set<String> deviceIds = list.stream().filter(item -> ObjectUtil.isNotEmpty(item.getProcessdeviceid())).map(ApsProcessOperationProcessEquDo::getProcessdeviceid).collect(Collectors.toSet());
+            if (ObjectUtil.isEmpty(deviceIds)) {
+                return R.error("存在未排程的工序作业明细,未分配加工设备");
+            }
             //查询设备对应的代号
             List<AspCheckItemsDo> deviceList = aspCheckItemsService.list(new QueryWrapper<AspCheckItemsDo>().lambda().in(AspCheckItemsDo::getId, deviceIds));
             //组装成map类型,以便筛选和查询

+ 18 - 4
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ApsProductDetailServiceImpl.java

@@ -622,21 +622,35 @@ public class ApsProductDetailServiceImpl extends ServiceImpl<ApsProductDetailDao
         if (ObjectUtil.isEmpty(orderDetail)) {
             return R.error("产品明细不能为空");
         }
+        String customId = req.getCustomId();
+        if (ObjectUtil.isEmpty(customId)) {
+            return R.error("客户ID不能为空");
+        }
         String alloy = orderDetail.getAlloy();
         String alloystatus = orderDetail.getAlloystatus();
 
-        List<GetOldTechnicalRequirementRes> apsProductDetailDoList = this.baseMapper.selectMyList(technicalRequirementId, orderDetail.getId(), alloy, alloystatus, orderProductTypeId);
+//        List<GetOldTechnicalRequirementRes> apsProductDetailDoList = this.baseMapper.selectMyList(technicalRequirementId, orderDetail.getId(), alloy, alloystatus, orderProductTypeId);
+        List<GetOldTechnicalRequirementRes> list1 = this.baseMapper.selectMyList1(technicalRequirementId, orderDetail.getId(),customId, alloy);
+        List<GetOldTechnicalRequirementRes> list2 = this.baseMapper.selectMyList2(technicalRequirementId, orderDetail.getId(),customId, alloystatus);
+        List<GetOldTechnicalRequirementRes> list3 = this.baseMapper.selectMyList3(technicalRequirementId, orderDetail.getId(),customId, orderProductTypeId);
+
+        //合并三个list
+        List<GetOldTechnicalRequirementRes> apsProductDetailDoList = new LinkedList<>();
+        apsProductDetailDoList.addAll(list1);
+        apsProductDetailDoList.addAll(list2);
+        apsProductDetailDoList.addAll(list3);
+        apsProductDetailDoList = apsProductDetailDoList.stream().distinct().collect(Collectors.toList());
 
         List<GetOldTechnicalRequirementRes> list = new LinkedList<>();
         for (GetOldTechnicalRequirementRes vo : apsProductDetailDoList) {
             int score = 0;
-            if (vo.getAlloy().equals(alloy)) {
+            if (ObjectUtil.isNotEmpty(vo.getAlloy()) && vo.getAlloy().equals(alloy)) {
                 score += 10;
             }
-            if (vo.getAlloystatus().equals(alloystatus)) {
+            if (ObjectUtil.isNotEmpty(vo.getAlloystatus()) && vo.getAlloystatus().equals(alloystatus)) {
                 score += 1;
             }
-            if (vo.getOrderproducttypeid().equals(orderProductTypeId)) {
+            if (ObjectUtil.isNotEmpty(vo.getOrderproducttypeid()) && vo.getOrderproducttypeid().equals(orderProductTypeId)) {
                 score += 100;
             }
             vo.setScore(score);

+ 53 - 0
cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ApsReportRecordsServiceImpl.java

@@ -2,6 +2,7 @@ package com.rongwei.bscommon.sys.service.impl;
 
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
@@ -897,6 +898,10 @@ public class ApsReportRecordsServiceImpl extends ServiceImpl<ApsReportRecordsDao
             ApsBlankOrderDo apsBlankOrderDo = apsBlankOrderService.getById(apsProcessOperationDo.getBlankid());
             //查询对应的订单评审信息
             ApsProductionOrderDo apsProductionOrderDo = apsProductionOrderService.getById(apsBlankOrderDo.getProductionorderid());
+            //合并加工作业开工之后进行报工,同步更新一起开工的其他作业的加工参数
+            if (ObjectUtil.isNotEmpty(apsReportMachiningDoList)) {
+                syncOtherEquRecords(apsProcessOperationDo,apsProcessOperationProcessEquDo,nowReportRecordsDo.getProcessequid(),apsReportMachiningDoList,currentUser);
+            }
 
             //如果工序作业是否坯料工序=是,检查每个报工输出物料批次号
             if (ObjectUtil.isNotEmpty(apsProcessOperationDo.getIfblankprocess()) && apsProcessOperationDo.getIfblankprocess().equals("是")) {
@@ -1730,6 +1735,54 @@ public class ApsReportRecordsServiceImpl extends ServiceImpl<ApsReportRecordsDao
     }
 
 
+    /**
+     * 更新合并加工的工序作业明细相关的报工记录下面的报工记录加工参数子表数据
+     * @param apsProcessOperationDo
+     * @param apsProcessOperationProcessEquDo
+     * @param processEquId
+     * @param apsReportMachiningDoList
+     */
+    private void syncOtherEquRecords(ApsProcessOperationDo apsProcessOperationDo,ApsProcessOperationProcessEquDo apsProcessOperationProcessEquDo,String processEquId,List<ApsReportMachiningDo> apsReportMachiningDoList,SysUserVo currentUser){
+        List<ApsReportMachiningDo> machList = apsReportMachiningService.list();
+        List<String> mainRecordIds = machList.stream().map(ApsReportMachiningDo::getMainid).distinct().collect(Collectors.toList());
+        if ("合并加工".equals(apsProcessOperationDo.getProcessway())){
+            List<ApsProcessOperationProcessEquDo> list = apsProcessOperationProcessEquService.list(new LambdaQueryWrapper<ApsProcessOperationProcessEquDo>()
+                    .eq(ApsProcessOperationProcessEquDo::getProcessdeviceid, apsProcessOperationProcessEquDo.getProcessdeviceid())
+                    .eq(ApsProcessOperationProcessEquDo::getPlanstartdate,apsProcessOperationProcessEquDo.getPlanstartdate())
+                    .eq(ApsProcessOperationProcessEquDo::getProcessid,apsProcessOperationDo.getId())
+                    .notIn(ApsProcessOperationProcessEquDo::getId,processEquId)
+                    .and(qw-> qw.gt(ApsProcessOperationProcessEquDo::getActualfinishdate,apsProcessOperationProcessEquDo.getActualstartdate()).or().isNull(ApsProcessOperationProcessEquDo::getActualfinishdate)));
+            List<String> equIds = list.stream().map(ApsProcessOperationProcessEquDo::getId).collect(Collectors.toList());
+            log.info("待同步工序作业主键数据:{}",equIds);
+            if (!equIds.isEmpty()){
+                List<ApsReportRecordsDo> recordsDos = this.list(new LambdaQueryWrapper<ApsReportRecordsDo>()
+                        .eq(ApsReportRecordsDo::getDeleted, "0")
+                        .in(ApsReportRecordsDo::getProcessequid, equIds)
+                        .in(ApsReportRecordsDo::getReportworkstatus,"已开工","已报工"));
+                recordsDos.forEach(info ->{
+                    if (mainRecordIds.contains(info.getId())){
+                        apsReportMachiningService.remove(new LambdaUpdateWrapper<ApsReportMachiningDo>()
+                                .eq(ApsReportMachiningDo::getMainid, info.getId()));
+                    }
+                    apsReportMachiningDoList.forEach(mach->{
+                        mach.setId(SecurityUtil.getUUID());
+                        mach.setMainid(info.getId());
+                        mach.setCreatedate(new Date());
+                        mach.setCreateuserid(currentUser.getId());
+                        mach.setCreateusername(currentUser.getName());
+                        mach.setModifydate(new Date());
+                        mach.setModifyuserid(currentUser.getId());
+                        mach.setModifyusername(currentUser.getName());
+                    });
+                    if (!apsReportMachiningDoList.isEmpty()){
+                        apsReportMachiningService.saveBatch(apsReportMachiningDoList);
+                    }
+                });
+            }
+        }
+    }
+
+
 }
 
 

+ 2 - 2
cx-aps/cx-aps-common/src/main/resources/mybatis/ApsBlankOrderDao.xml

@@ -227,8 +227,8 @@
             abo.PROMISEDATESTART AS 'promiseDateStart',
             abo.PROMISEDATEEND AS 'promiseDateEnd',
             abo.BLANKNUMBER AS 'blankNumber',
-            CONCAT(apop.OUTPUTRESULT,'=',CAST(apop.PLANOUTPUTONEROLLWEIGHT AS CHAR) + 0,'吨') AS 'outPutResult',
-            CONCAT(abo.BLANKTYPE,IFNULL(abo.BLANKCOMEFROM,''),abo.INPUTREPORTDESCRIBE,' ',CAST(abo.SINGLEROLLWEIGHT AS CHAR) + 0,'吨*',abo.ROLLNUM,'卷=',CAST(abo.SINGLEROLLWEIGHT*abo.ROLLNUM AS CHAR) + 0,'吨') AS 'planBlank',
+            CONCAT(apop.OUTPUTRESULT,'=',CAST(ROUND(apop.PLANOUTPUTONEROLLWEIGHT,2) AS CHAR) + 0,'吨') AS 'outPutResult',
+            CONCAT(abo.BLANKTYPE,IFNULL(abo.BLANKCOMEFROM,''),abo.INPUTREPORTDESCRIBE,' ',CAST(abo.SINGLEROLLWEIGHT AS CHAR) + 0,'吨*',abo.ROLLNUM,'卷=',CAST(ROUND(abo.SINGLEROLLWEIGHT*abo.ROLLNUM,2) AS CHAR) + 0,'吨') AS 'planBlank',
             '' AS 'processWorkShop',
             null AS 'planChangeBlankDate',
             null AS 'actualChangeBlankDate',

+ 61 - 0
cx-aps/cx-aps-common/src/main/resources/mybatis/ApsProductDetailDao.xml

@@ -158,4 +158,65 @@
                   OR aptr.ORDERPRODUCTTYPEID = #{orderProductTypeId}
               )
     </select>
+    <select id="selectMyList1" resultType="com.rongwei.bsentity.vo.GetOldTechnicalRequirementRes">
+        select
+            apd.ID AS 'orderDetailId',
+            apd.ALLOY AS 'alloy',
+            apd.ALLOYSTATUS AS 'alloystatus',
+            apd.PRODUCTTYPEID AS 'producttypeid',
+            apd.PRODUCTTYPE AS 'producttype',
+            aptr.*
+        from
+            aps_production_order apo
+                LEFT JOIN aps_product_detail apd ON apo.ID = apd.MAINID
+                LEFT JOIN aps_production_technical_requirement aptr ON  FIND_IN_SET(apd.ID,aptr.ORDERDETAILIDS)
+        where apo.DELETED = 0
+          AND apd.DELETED = 0
+          AND aptr.DELETED = 0
+          AND apd.ID != #{id}
+          AND aptr.ID != #{technicalRequirementId}
+          AND aptr.ID is not null
+          AND apd.ALLOY = #{alloy}
+          AND apo.CUSTOMID = #{customId}
+    </select>
+    <select id="selectMyList2" resultType="com.rongwei.bsentity.vo.GetOldTechnicalRequirementRes">
+        select
+            apd.ID AS 'orderDetailId',
+            apd.ALLOY AS 'alloy',
+            apd.ALLOYSTATUS AS 'alloystatus',
+            apd.PRODUCTTYPEID AS 'producttypeid',
+            apd.PRODUCTTYPE AS 'producttype',
+            aptr.*
+        from
+            aps_production_order apo
+                LEFT JOIN aps_product_detail apd ON apo.ID = apd.MAINID
+                LEFT JOIN aps_production_technical_requirement aptr ON  FIND_IN_SET(apd.ID,aptr.ORDERDETAILIDS)
+        where apd.DELETED = 0
+          AND aptr.DELETED = 0
+          AND apd.ID != #{id}
+          AND aptr.ID != #{technicalRequirementId}
+          AND aptr.ID is not null
+          AND apd.ALLOYSTATUS = #{alloystatus}
+          AND apo.CUSTOMID = #{customId}
+    </select>
+    <select id="selectMyList3" resultType="com.rongwei.bsentity.vo.GetOldTechnicalRequirementRes">
+        select
+            apd.ID AS 'orderDetailId',
+            apd.ALLOY AS 'alloy',
+            apd.ALLOYSTATUS AS 'alloystatus',
+            apd.PRODUCTTYPEID AS 'producttypeid',
+            apd.PRODUCTTYPE AS 'producttype',
+            aptr.*
+        from
+            aps_production_order apo
+                LEFT JOIN aps_product_detail apd ON apo.ID = apd.MAINID
+                LEFT JOIN aps_production_technical_requirement aptr ON  FIND_IN_SET(apd.ID,aptr.ORDERDETAILIDS)
+        where apd.DELETED = 0
+          AND aptr.DELETED = 0
+          AND apd.ID != #{id}
+          AND aptr.ID != #{technicalRequirementId}
+          AND aptr.ID is not null
+          AND aptr.ORDERPRODUCTTYPEID = #{orderProductTypeId}
+          AND apo.CUSTOMID = #{customId}
+    </select>
 </mapper>

+ 3 - 0
cx-aps/cx-aps-entity/src/main/java/com/rongwei/bsentity/vo/GetOldTechnicalRequirementReq.java

@@ -17,4 +17,7 @@ public class GetOldTechnicalRequirementReq {
 
     //产品明细详情
     private ApsProductDetailDo orderDetail;
+
+    //客户ID
+    private String customId;
 }

+ 3 - 1
cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/config/EquForkliftRepairRecordListener.java

@@ -28,7 +28,7 @@ import java.util.stream.Collectors;
 @Slf4j
 public class EquForkliftRepairRecordListener extends AnalysisEventListener<EquForkliftRepairRecordTemplate> {
 
-    private static final String[] NON_SET = {"equipmentnumber","rapairdetail","rapairdate"};
+    private static final String[] NON_SET = {"equipmentnumber","rapairdate"};
     private List<EquForkliftRepairRecordDo> forkliftRepairRecordDoList = new ArrayList<>();
 
     private List<String> errorData = new ArrayList<>();
@@ -101,6 +101,8 @@ public class EquForkliftRepairRecordListener extends AnalysisEventListener<EquFo
                 .setRapairname(forkliftRepairRecordTemplate.getRapairname())
                 .setRapairdate(forkliftRepairRecordTemplate.getRapairdate())
                 .setRapairdetail(forkliftRepairRecordTemplate.getRapairdetail())
+                .setSpecificationmodel(forkliftRepairRecordTemplate.getSpecificationmodel())
+                .setQuantity(forkliftRepairRecordTemplate.getQuantity())
                ;
 
         return equForkliftRepairRecordDo;

+ 54 - 0
cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/dao/EquEnergyMeterCenterDosageDayDao.java

@@ -0,0 +1,54 @@
+package com.rongwei.bscommon.sys.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.rongwei.bsentity.domain.EquEnergyMeterCenterDosageDayDo;
+import com.rongwei.bsentity.domain.EquEnergyMeterDosageDayDo;
+import org.apache.ibatis.annotations.Delete;
+import org.apache.ibatis.annotations.Select;
+
+import java.util.List;
+
+public interface EquEnergyMeterCenterDosageDayDao extends BaseMapper<EquEnergyMeterCenterDosageDayDo> {
+
+    @Delete("TRUNCATE  table equ_energy_meter_center_dosage_day")
+    void deleteData();
+
+    @Select("SELECT\n" +
+            "\tUUID() AS 'ID',\n" +
+            "\tb.CENTERID,\n" +
+            "\tb.CENTERDAY,\n" +
+            "\tb.DOSAGE,\n" +
+            "\tb.TENANTID,\n" +
+            "\tb.OWNEDFACTORY \n" +
+            "FROM\n" +
+            "\tequ_energy_meter_center a\n" +
+            "\tLEFT JOIN (\n" +
+            "\tSELECT\n" +
+            "\t\ta.CENTERID,\n" +
+            "\t\tb.CENTERDAY,\n" +
+            "\t\tb.TENANTID,\n" +
+            "\t\tb.OWNEDFACTORY,\n" +
+            "\t\tSUM(\n" +
+            "\t\tCASE\n" +
+            "\t\t\t\tWHEN b.DOSAGE IS NULL THEN\n" +
+            "\t\t\tNULL \n" +
+            "\t\t\t\tWHEN a.JSMETHOD = '+' THEN\n" +
+            "\t\t\t\tb.DOSAGE * a.XS \n" +
+            "\t\t\t\tWHEN a.JSMETHOD = '-' THEN\n" +
+            "\t\t\t\tb.DOSAGE * a.XS *- 1 ELSE NULL \n" +
+            "\t\t\tEND \n" +
+            "\t\t\t) 'DOSAGE' \n" +
+            "\t\tFROM\n" +
+            "\t\t\tequ_energy_meter_center_detail a\n" +
+            "\t\t\tINNER JOIN equ_energy_meter_dosage_day b ON a.METERID = b.METERID \n" +
+            "\t\t \tWHERE a.DELETED='0'\n" +
+            "\t\tGROUP BY\n" +
+            "\t\t\ta.CENTERID,\n" +
+            "\t\t\tb.CENTERDAY \n" +
+            "\t\t) b ON a.ID = b.CENTERID \n" +
+            "WHERE\n" +
+            "\tb.CENTERDAY IS NOT NULL\n" +
+            "\tand\n" +
+            "\ta.`STATUS`='enable' and a.DELETED='0'")
+    List<EquEnergyMeterCenterDosageDayDo> calRecordDataToCenterDosageDay();
+}

+ 62 - 0
cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/dao/EquEnergyMeterCenterDosageMonthDao.java

@@ -0,0 +1,62 @@
+package com.rongwei.bscommon.sys.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.rongwei.bsentity.domain.EquEnergyMeterCenterDosageDayDo;
+import com.rongwei.bsentity.domain.EquEnergyMeterCenterDosageMonthDo;
+import org.apache.ibatis.annotations.Select;
+
+import java.util.List;
+
+public interface EquEnergyMeterCenterDosageMonthDao  extends BaseMapper<EquEnergyMeterCenterDosageMonthDo> {
+
+    @Select("SELECT\n" +
+            "\t\tb.ID,\n" +
+            "\ta.* \n" +
+            "FROM\n" +
+            "\t(\n" +
+            "\tSELECT\n" +
+            "\t\tCENTERID,\n" +
+            "\t\tYEAR ( CENTERDAY ) 'CENTERYEAR',\n" +
+            "\t\tMONTH ( CENTERDAY ) 'CENTERMONTH',TENANTID,OWNEDFACTORY,\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '1' THEN DOSAGE ELSE NULL END ) 'DAY1',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '2' THEN DOSAGE ELSE NULL END ) 'DAY2',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '3' THEN DOSAGE ELSE NULL END ) 'DAY3',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '4' THEN DOSAGE ELSE NULL END ) 'DAY4',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '5' THEN DOSAGE ELSE NULL END ) 'DAY5',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '6' THEN DOSAGE ELSE NULL END ) 'DAY6',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '7' THEN DOSAGE ELSE NULL END ) 'DAY7',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '8' THEN DOSAGE ELSE NULL END ) 'DAY8',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '9' THEN DOSAGE ELSE NULL END ) 'DAY9',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '10' THEN DOSAGE ELSE NULL END ) 'DAY10',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '11' THEN DOSAGE ELSE NULL END ) 'DAY11',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '12' THEN DOSAGE ELSE NULL END ) 'DAY12',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '13' THEN DOSAGE ELSE NULL END ) 'DAY13',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '14' THEN DOSAGE ELSE NULL END ) 'DAY14',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '15' THEN DOSAGE ELSE NULL END ) 'DAY15',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '16' THEN DOSAGE ELSE NULL END ) 'DAY16',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '17' THEN DOSAGE ELSE NULL END ) 'DAY17',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '18' THEN DOSAGE ELSE NULL END ) 'DAY18',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '19' THEN DOSAGE ELSE NULL END ) 'DAY19',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '20' THEN DOSAGE ELSE NULL END ) 'DAY20',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '21' THEN DOSAGE ELSE NULL END ) 'DAY21',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '22' THEN DOSAGE ELSE NULL END ) 'DAY22',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '23' THEN DOSAGE ELSE NULL END ) 'DAY23',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '24' THEN DOSAGE ELSE NULL END ) 'DAY24',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '25' THEN DOSAGE ELSE NULL END ) 'DAY25',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '26' THEN DOSAGE ELSE NULL END ) 'DAY26',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '27' THEN DOSAGE ELSE NULL END ) 'DAY27',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '28' THEN DOSAGE ELSE NULL END ) 'DAY28',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '29' THEN DOSAGE ELSE NULL END ) 'DAY29',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '30' THEN DOSAGE ELSE NULL END ) 'DAY30',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '31' THEN DOSAGE ELSE NULL END ) 'DAY31' \n" +
+            "\tFROM\n" +
+            "\t\tequ_energy_meter_center_dosage_day \n" +
+            "\tGROUP BY\n" +
+            "\t\tCENTERID,TENANTID,OWNEDFACTORY,\n" +
+            "\t\tYEAR ( CENTERDAY ),\n" +
+            "\tMONTH ( CENTERDAY )) a\n" +
+            "\tLEFT JOIN equ_energy_meter_center_dosage_month b ON a.CENTERID = b.CENTERID \n" +
+            "\tAND a.CENTERYEAR = b.CENTERYEAR \n" +
+            "\tAND a.CENTERMONTH = b.CENTERMONTH")
+    List<EquEnergyMeterCenterDosageMonthDo> queryDaySum();
+}

+ 12 - 0
cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/dao/EquEnergyMeterDosageDayDao.java

@@ -0,0 +1,12 @@
+package com.rongwei.bscommon.sys.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.rongwei.bsentity.domain.EquEnergyMeterDosageDayDo;
+import org.apache.ibatis.annotations.Delete;
+
+public interface EquEnergyMeterDosageDayDao extends BaseMapper<EquEnergyMeterDosageDayDo> {
+    @Delete("TRUNCATE table equ_energy_meter_dosage_day")
+    void deleteData();
+
+
+}

+ 68 - 0
cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/dao/EquEnergyMeterDosageMonthDao.java

@@ -0,0 +1,68 @@
+package com.rongwei.bscommon.sys.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.rongwei.bsentity.domain.EquEnergyMeterDosageMonthDo;
+import org.apache.ibatis.annotations.Select;
+
+import java.util.List;
+
+public interface EquEnergyMeterDosageMonthDao extends BaseMapper<EquEnergyMeterDosageMonthDo> {
+
+    @Select("SELECT\n" +
+            "\t\tb.ID,\n" +
+            "\ta.* \n" +
+            "FROM\n" +
+            "\t(\n" +
+            "\tSELECT\n" +
+            "\t\tMETERID,\n" +
+            "\t\tTENANTID,\n" +
+            "\t\tOWNEDFACTORY,\n" +
+            "\t\tYEAR ( CENTERDAY ) 'CENTERYEAR',\n" +
+            "\t\tMONTH ( CENTERDAY ) 'CENTERMONTH',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '1' THEN DOSAGE ELSE NULL END ) 'DAY1',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '2' THEN DOSAGE ELSE NULL END ) 'DAY2',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '3' THEN DOSAGE ELSE NULL END ) 'DAY3',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '4' THEN DOSAGE ELSE NULL END ) 'DAY4',\n" +
+            "\t\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '5' THEN DOSAGE ELSE NULL END ) 'DAY5',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '6' THEN DOSAGE ELSE NULL END ) 'DAY6',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '7' THEN DOSAGE ELSE NULL END ) 'DAY7',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '8' THEN DOSAGE ELSE NULL END ) 'DAY8',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '9' THEN DOSAGE ELSE NULL END ) 'DAY9',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '10' THEN DOSAGE ELSE NULL END ) 'DAY10',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '11' THEN DOSAGE ELSE NULL END ) 'DAY11',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '12' THEN DOSAGE ELSE NULL END ) 'DAY12',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '13' THEN DOSAGE ELSE NULL END ) 'DAY13',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '14' THEN DOSAGE ELSE NULL END ) 'DAY14',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '15' THEN DOSAGE ELSE NULL END ) 'DAY15',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '16' THEN DOSAGE ELSE NULL END ) 'DAY16',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '17' THEN DOSAGE ELSE NULL END ) 'DAY17',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '18' THEN DOSAGE ELSE NULL END ) 'DAY18',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '19' THEN DOSAGE ELSE NULL END ) 'DAY19',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '20' THEN DOSAGE ELSE NULL END ) 'DAY20',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '21' THEN DOSAGE ELSE NULL END ) 'DAY21',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '22' THEN DOSAGE ELSE NULL END ) 'DAY22',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '23' THEN DOSAGE ELSE NULL END ) 'DAY23',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '24' THEN DOSAGE ELSE NULL END ) 'DAY24',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '25' THEN DOSAGE ELSE NULL END ) 'DAY25',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '26' THEN DOSAGE ELSE NULL END ) 'DAY26',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '27' THEN DOSAGE ELSE NULL END ) 'DAY27',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '28' THEN DOSAGE ELSE NULL END ) 'DAY28',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '29' THEN DOSAGE ELSE NULL END ) 'DAY29',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '30' THEN DOSAGE ELSE NULL END ) 'DAY30',\n" +
+            "\t\tSUM( CASE WHEN DAY ( CENTERDAY )= '31' THEN DOSAGE ELSE NULL END ) 'DAY31' \n" +
+            "\tFROM\n" +
+            "\t\tequ_energy_meter_dosage_day \n" +
+            "\tGROUP BY\n" +
+            "\t\tMETERID,\n" +
+            "\t\tTENANTID,\n" +
+            "\t\tOWNEDFACTORY,\n" +
+            "\t\tYEAR ( CENTERDAY ),\n" +
+            "\t\tMONTH ( CENTERDAY ) \n" +
+            "\t) a\n" +
+            "\tLEFT JOIN equ_energy_meter_dosage_month b ON a.METERID = b.METERID \n" +
+            "\tAND a.CENTERYEAR = b.CENTERYEAR \n" +
+            "\tAND a.CENTERMONTH = b.CENTERMONTH")
+    List<EquEnergyMeterDosageMonthDo> queryDaySum();
+
+}

+ 58 - 0
cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/dao/EquEnergyRecordDao.java

@@ -0,0 +1,58 @@
+package com.rongwei.bscommon.sys.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.rongwei.bsentity.domain.EquEnergyMeterDosageDayDo;
+import com.rongwei.bsentity.domain.EquEnergyRecordDo;
+import org.apache.ibatis.annotations.Select;
+import org.springframework.data.repository.query.Param;
+
+import java.util.List;
+
+public interface EquEnergyRecordDao extends BaseMapper<EquEnergyRecordDo> {
+
+
+    @Select("SELECT\n" +
+            "\ta.METERID,\n" +
+            "\ta.OWNEDFACTORY,\n" +
+            "\ta.TENANTID,\n" +
+            "\tDATE_FORMAT( a.CBDATE, '%Y-%m-%d' ) 'CENTERDAY',\n" +
+            "CASE\n" +
+            "\t\t\n" +
+            "\t\tWHEN a.VALUEZ IS NOT NULL \n" +
+            "\t\tAND b.a.VALUEZ IS NOT NULL THEN\n" +
+            "\t\tc.DBBB *(b.VALUEZ - a.VALUEZ)\t ELSE 0 \n" +
+            "\t\tEND 'DOSAGE' \n" +
+            "FROM\n" +
+            "\t(\n" +
+            "\tSELECT\n" +
+            "\t\tMETERID,\n" +
+            "\t\tVALUEZ,\n" +
+            "\t\tTENANTID,\n" +
+            "\t\tOWNEDFACTORY,\n" +
+            "\t\tCBDATE,\n" +
+            "\t\tROW_NUMBER() OVER ( PARTITION BY METERID, DATE_FORMAT( CBDATE, '%Y-%m-%d' ) ORDER BY CBDATE DESC ) AS 'rank' \n" +
+            "\tFROM\n" +
+            "\t\tequ_energy_record \n" +
+            "\tWHERE\n" +
+            "\t\tCBDATE <= #{endTime} AND CBDATE >= #{startTime} \n" +
+            "\t\tAND DELETED = '0' \n" +
+            "\t) a\n" +
+            "\tLEFT JOIN (\n" +
+            "\tSELECT\n" +
+            "\t\tMETERID,\n" +
+            "\t\tVALUEZ,\n" +
+            "\t\tCBDATE,\n" +
+            "\t\tROW_NUMBER() OVER ( PARTITION BY METERID, DATE_FORMAT( CBDATE, '%Y-%m-%d' ) ORDER BY CBDATE DESC ) AS 'rank' \n" +
+            "\tFROM\n" +
+            "\t\tequ_energy_record \n" +
+            "\tWHERE\n" +
+            "\t\tCBDATE <= #{endTime}  AND CBDATE >= #{startTime} \n" +
+            "\t\tAND DELETED = '0' \n" +
+            "\t) b ON a.METERID = b.METERID \n" +
+            "\tAND b.rank = '1' \n" +
+            "\tAND DATE_FORMAT( a.CBDATE, '%Y-%m-%d' ) = DATE_FORMAT( DATE_SUB( b.CBDATE, INTERVAL 1 DAY ), '%Y-%m-%d' ) \n" +
+            "\tLEFT JOIN equ_energy_meter c ON c.ID =a.METERID and c.DELETED ='0'\n" +
+            "WHERE\n" +
+            "\ta.rank = '1'")
+    List<EquEnergyMeterDosageDayDo> calRecordDataToDosageDay(@Param("startTime") String startTime,@Param("endTime") String endTime);
+}

+ 11 - 0
cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/excel/EquForkliftRepairRecordTemplate.java

@@ -57,6 +57,17 @@ public class EquForkliftRepairRecordTemplate {
     @ExcelProperty(index = 6)
     private String rapairdetail;
 
+    /**
+     * 规格型号
+     */
+    @ExcelProperty(index = 7)
+    private String specificationmodel;
+
+    /**
+     * 数量
+     */
+    @ExcelProperty(index = 8)
+    private String quantity;
 
 
 }

+ 14 - 0
cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/service/EquEnergyMeterCenterDosageDayService.java

@@ -0,0 +1,14 @@
+package com.rongwei.bscommon.sys.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.rongwei.bsentity.domain.EquEnergyMeterCenterDosageDayDo;
+
+import java.util.List;
+
+public interface EquEnergyMeterCenterDosageDayService extends IService<EquEnergyMeterCenterDosageDayDo> {
+
+    void calRecordDataToCenterDosageDay();
+
+
+
+}

+ 10 - 0
cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/service/EquEnergyMeterCenterDosageMonthService.java

@@ -0,0 +1,10 @@
+package com.rongwei.bscommon.sys.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.rongwei.bsentity.domain.EquEnergyMeterCenterDosageDayDo;
+import com.rongwei.bsentity.domain.EquEnergyMeterCenterDosageMonthDo;
+
+public interface EquEnergyMeterCenterDosageMonthService  extends IService<EquEnergyMeterCenterDosageMonthDo> {
+    void calRecordDataToCenterDosageMonth();
+
+}

+ 11 - 0
cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/service/EquEnergyMeterDosageDayService.java

@@ -0,0 +1,11 @@
+package com.rongwei.bscommon.sys.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.rongwei.bsentity.domain.AspCheckItems;
+import com.rongwei.bsentity.domain.EquEnergyMeterDosageDayDo;
+
+public interface EquEnergyMeterDosageDayService extends IService<EquEnergyMeterDosageDayDo> {
+    void deleteData();
+
+
+}

+ 14 - 0
cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/service/EquEnergyMeterDosageMonthService.java

@@ -0,0 +1,14 @@
+package com.rongwei.bscommon.sys.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.rongwei.bsentity.domain.EquEnergyMeterDosageMonthDo;
+import org.apache.ibatis.annotations.Update;
+
+import java.util.HashMap;
+import java.util.List;
+
+public interface EquEnergyMeterDosageMonthService extends IService<EquEnergyMeterDosageMonthDo> {
+
+    void calDayToMonth();
+
+}

+ 10 - 0
cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/service/EquEnergyRecordService.java

@@ -0,0 +1,10 @@
+package com.rongwei.bscommon.sys.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.rongwei.bsentity.domain.EquEnergyRecordDo;
+import com.rongwei.rwcommon.base.R;
+
+public interface EquEnergyRecordService extends IService<EquEnergyRecordDo> {
+    R calEnergyUsage();
+
+}

+ 42 - 0
cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/service/impl/EquEnergyMeterCenterDosageDayServiceImpl.java

@@ -0,0 +1,42 @@
+package com.rongwei.bscommon.sys.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.rongwei.bscommon.sys.dao.EquEnergyMeterCenterDosageDayDao;
+import com.rongwei.bscommon.sys.service.EquEnergyMeterCenterDosageDayService;
+import com.rongwei.bsentity.domain.EquEnergyMeterCenterDosageDayDo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class EquEnergyMeterCenterDosageDayServiceImpl  extends ServiceImpl<EquEnergyMeterCenterDosageDayDao, EquEnergyMeterCenterDosageDayDo>
+        implements EquEnergyMeterCenterDosageDayService {
+
+
+    @Autowired
+    EquEnergyMeterCenterDosageDayService equEnergyMeterCenterDosageDayService;
+
+    @Autowired
+    EquEnergyMeterCenterDosageDayDao equEnergyMeterCenterDosageDayDao;
+
+
+    @Override
+    public void calRecordDataToCenterDosageDay() {
+        //删除老数据
+        this.deleteData();
+        List<EquEnergyMeterCenterDosageDayDo> list = equEnergyMeterCenterDosageDayDao.calRecordDataToCenterDosageDay();
+        if (!list.isEmpty()){
+            equEnergyMeterCenterDosageDayService.saveBatch(list);
+        }
+    }
+
+    /**
+     * 删除老数据
+     */
+    private void deleteData() {
+        equEnergyMeterCenterDosageDayDao.deleteData();
+    }
+
+
+}

+ 91 - 0
cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/service/impl/EquEnergyMeterCenterDosageMonthServiceImpl.java

@@ -0,0 +1,91 @@
+package com.rongwei.bscommon.sys.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.rongwei.bscommon.sys.dao.EquEnergyMeterCenterDosageMonthDao;
+import com.rongwei.bscommon.sys.service.EquEnergyMeterCenterDosageMonthService;
+import com.rongwei.bsentity.domain.EquEnergyMeterCenterDosageMonthDo;
+import com.rongwei.bsentity.domain.EquEnergyMeterDosageMonthDo;
+import com.rongwei.rwcommon.utils.SecurityUtil;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Service
+public class EquEnergyMeterCenterDosageMonthServiceImpl  extends ServiceImpl<EquEnergyMeterCenterDosageMonthDao, EquEnergyMeterCenterDosageMonthDo>
+        implements EquEnergyMeterCenterDosageMonthService {
+
+    @Autowired
+    EquEnergyMeterCenterDosageMonthDao equEnergyMeterCenterDosageMonthDao;
+
+
+    @Autowired
+    EquEnergyMeterCenterDosageMonthService equEnergyMeterCenterDosageMonthService;
+
+    @Override
+    public void calRecordDataToCenterDosageMonth() {
+        //1.查询月表中已存在的数据
+        List<EquEnergyMeterCenterDosageMonthDo> list = equEnergyMeterCenterDosageMonthDao.queryDaySum();
+
+        List<EquEnergyMeterCenterDosageMonthDo> saveList =new ArrayList<>();
+        List<EquEnergyMeterCenterDosageMonthDo> updateList =new ArrayList<>();
+        final UpdateWrapper<EquEnergyMeterCenterDosageMonthDo>[] updateWrapper = new UpdateWrapper[]{null};
+
+        list.forEach(v->{
+            if (StringUtils.isNotBlank(v.getId())){
+                updateList.add(v);
+                updateWrapper[0] =new UpdateWrapper<>();
+               this.setUpdateWrapper( updateWrapper[0],v);
+                equEnergyMeterCenterDosageMonthService.update(v, updateWrapper[0]);
+            }else {
+                v.setId(SecurityUtil.getUUID());
+
+                saveList.add(v);
+            }
+        });
+
+        if (!saveList.isEmpty()){
+            equEnergyMeterCenterDosageMonthService.saveBatch(saveList);
+        }
+
+    };
+
+
+    public void setUpdateWrapper(UpdateWrapper<EquEnergyMeterCenterDosageMonthDo> updateWrapper, EquEnergyMeterCenterDosageMonthDo equEnergyMeterCenterDosageMonthDo){
+        updateWrapper.eq("id",equEnergyMeterCenterDosageMonthDo.getId())
+                .set("day1",equEnergyMeterCenterDosageMonthDo.getDay1())
+                .set("day2",equEnergyMeterCenterDosageMonthDo.getDay2())
+                .set("day3",equEnergyMeterCenterDosageMonthDo.getDay3())
+                .set("day4",equEnergyMeterCenterDosageMonthDo.getDay4())
+                .set("day5",equEnergyMeterCenterDosageMonthDo.getDay5())
+                .set("day6",equEnergyMeterCenterDosageMonthDo.getDay6())
+                .set("day7",equEnergyMeterCenterDosageMonthDo.getDay7())
+                .set("day8",equEnergyMeterCenterDosageMonthDo.getDay8())
+                .set("day9",equEnergyMeterCenterDosageMonthDo.getDay9())
+                .set("day10",equEnergyMeterCenterDosageMonthDo.getDay10())
+                .set("day11",equEnergyMeterCenterDosageMonthDo.getDay11())
+                .set("day12",equEnergyMeterCenterDosageMonthDo.getDay12())
+                .set("day13",equEnergyMeterCenterDosageMonthDo.getDay13())
+                .set("day14",equEnergyMeterCenterDosageMonthDo.getDay14())
+                .set("day15",equEnergyMeterCenterDosageMonthDo.getDay15())
+                .set("day16",equEnergyMeterCenterDosageMonthDo.getDay16())
+                .set("day17",equEnergyMeterCenterDosageMonthDo.getDay17())
+                .set("day18",equEnergyMeterCenterDosageMonthDo.getDay18())
+                .set("day19",equEnergyMeterCenterDosageMonthDo.getDay19())
+                .set("day20",equEnergyMeterCenterDosageMonthDo.getDay20())
+                .set("day21",equEnergyMeterCenterDosageMonthDo.getDay21())
+                .set("day22",equEnergyMeterCenterDosageMonthDo.getDay22())
+                .set("day23",equEnergyMeterCenterDosageMonthDo.getDay23())
+                .set("day24",equEnergyMeterCenterDosageMonthDo.getDay24())
+                .set("day25",equEnergyMeterCenterDosageMonthDo.getDay25())
+                .set("day26",equEnergyMeterCenterDosageMonthDo.getDay26())
+                .set("day27",equEnergyMeterCenterDosageMonthDo.getDay27())
+                .set("day28",equEnergyMeterCenterDosageMonthDo.getDay28())
+                .set("day29",equEnergyMeterCenterDosageMonthDo.getDay29())
+                .set("day30",equEnergyMeterCenterDosageMonthDo.getDay30())
+                .set("day31",equEnergyMeterCenterDosageMonthDo.getDay31());
+    }
+}

+ 19 - 0
cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/service/impl/EquEnergyMeterDosageDayServiceImpl.java

@@ -0,0 +1,19 @@
+package com.rongwei.bscommon.sys.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.rongwei.bscommon.sys.dao.EquEnergyMeterDosageDayDao;
+import com.rongwei.bscommon.sys.service.EquEnergyMeterDosageDayService;
+import com.rongwei.bsentity.domain.EquEnergyMeterDosageDayDo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class EquEnergyMeterDosageDayServiceImpl extends ServiceImpl<EquEnergyMeterDosageDayDao, EquEnergyMeterDosageDayDo> implements EquEnergyMeterDosageDayService {
+
+  @Autowired
+    EquEnergyMeterDosageDayDao equEnergyMeterDosageDayDao;
+    @Override
+    public void deleteData() {
+        equEnergyMeterDosageDayDao.deleteData();
+    }
+}

+ 90 - 0
cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/service/impl/EquEnergyMeterDosageMonthSetviceImpl.java

@@ -0,0 +1,90 @@
+package com.rongwei.bscommon.sys.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.rongwei.bscommon.sys.dao.EquEnergyMeterDosageMonthDao;
+import com.rongwei.bscommon.sys.service.EquEnergyMeterDosageMonthService;
+import com.rongwei.bsentity.domain.EquEnergyMeterDosageMonthDo;
+import com.rongwei.rwcommon.utils.SecurityUtil;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Service
+public class EquEnergyMeterDosageMonthSetviceImpl extends
+        ServiceImpl<EquEnergyMeterDosageMonthDao, EquEnergyMeterDosageMonthDo> implements EquEnergyMeterDosageMonthService {
+
+    @Autowired
+    EquEnergyMeterDosageMonthDao equEnergyMeterDosageMonthDao;
+    @Autowired
+    EquEnergyMeterDosageMonthService equEnergyMeterDosageMonthService;
+
+    @Override
+    public void calDayToMonth() {
+        //1.查询月表中已存在的数据
+        List<EquEnergyMeterDosageMonthDo> list = equEnergyMeterDosageMonthDao.queryDaySum();
+
+        List<EquEnergyMeterDosageMonthDo> saveList =new ArrayList<>();
+        List<EquEnergyMeterDosageMonthDo> updateList =new ArrayList<>();
+        final UpdateWrapper<EquEnergyMeterDosageMonthDo>[] updateWrapper = new UpdateWrapper[]{null};
+
+
+        list.forEach(v->{
+            if (StringUtils.isNotBlank(v.getId())){
+                updateList.add(v);
+                updateWrapper[0] =new UpdateWrapper<>();
+                this.setUpdateWrapper( updateWrapper[0],v);
+                equEnergyMeterDosageMonthService.update(v, updateWrapper[0]);
+            }else {
+                v.setId(SecurityUtil.getUUID());
+
+                saveList.add(v);
+            }
+        });
+
+        if (!saveList.isEmpty()){
+            equEnergyMeterDosageMonthService.saveBatch(saveList);
+        }
+
+
+    }
+
+
+    public void setUpdateWrapper(UpdateWrapper<EquEnergyMeterDosageMonthDo> updateWrapper, EquEnergyMeterDosageMonthDo equEnergyMeterDosageMonthDo){
+        updateWrapper.eq("id",equEnergyMeterDosageMonthDo.getId())
+                .set("day1",equEnergyMeterDosageMonthDo.getDay1())
+                .set("day2",equEnergyMeterDosageMonthDo.getDay2())
+                .set("day3",equEnergyMeterDosageMonthDo.getDay3())
+                .set("day4",equEnergyMeterDosageMonthDo.getDay4())
+                .set("day5",equEnergyMeterDosageMonthDo.getDay5())
+                .set("day6",equEnergyMeterDosageMonthDo.getDay6())
+                .set("day7",equEnergyMeterDosageMonthDo.getDay7())
+                .set("day8",equEnergyMeterDosageMonthDo.getDay8())
+                .set("day9",equEnergyMeterDosageMonthDo.getDay9())
+                .set("day10",equEnergyMeterDosageMonthDo.getDay10())
+                .set("day11",equEnergyMeterDosageMonthDo.getDay11())
+                .set("day12",equEnergyMeterDosageMonthDo.getDay12())
+                .set("day13",equEnergyMeterDosageMonthDo.getDay13())
+                .set("day14",equEnergyMeterDosageMonthDo.getDay14())
+                .set("day15",equEnergyMeterDosageMonthDo.getDay15())
+                .set("day16",equEnergyMeterDosageMonthDo.getDay16())
+                .set("day17",equEnergyMeterDosageMonthDo.getDay17())
+                .set("day18",equEnergyMeterDosageMonthDo.getDay18())
+                .set("day19",equEnergyMeterDosageMonthDo.getDay19())
+                .set("day20",equEnergyMeterDosageMonthDo.getDay20())
+                .set("day21",equEnergyMeterDosageMonthDo.getDay21())
+                .set("day22",equEnergyMeterDosageMonthDo.getDay22())
+                .set("day23",equEnergyMeterDosageMonthDo.getDay23())
+                .set("day24",equEnergyMeterDosageMonthDo.getDay24())
+                .set("day25",equEnergyMeterDosageMonthDo.getDay25())
+                .set("day26",equEnergyMeterDosageMonthDo.getDay26())
+                .set("day27",equEnergyMeterDosageMonthDo.getDay27())
+                .set("day28",equEnergyMeterDosageMonthDo.getDay28())
+                .set("day29",equEnergyMeterDosageMonthDo.getDay29())
+                .set("day30",equEnergyMeterDosageMonthDo.getDay30())
+                .set("day31",equEnergyMeterDosageMonthDo.getDay31());
+    }
+}

+ 105 - 0
cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/service/impl/EquEnergyRecordServiceImpl.java

@@ -0,0 +1,105 @@
+package com.rongwei.bscommon.sys.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.rongwei.bscommon.sys.dao.EquEnergyRecordDao;
+import com.rongwei.bscommon.sys.service.*;
+import com.rongwei.bsentity.domain.EquEnergyMeterDosageDayDo;
+import com.rongwei.bsentity.domain.EquEnergyMeterDosageMonthDo;
+import com.rongwei.bsentity.domain.EquEnergyRecordDo;
+import com.rongwei.rwcommon.base.R;
+import com.rongwei.rwcommon.utils.SecurityUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
+import java.util.*;
+import java.util.stream.Collectors;
+
+@Service
+public class EquEnergyRecordServiceImpl extends ServiceImpl<EquEnergyRecordDao, EquEnergyRecordDo> implements EquEnergyRecordService {
+
+
+    @Autowired
+    private EquEnergyMeterDosageDayService equEnergyMeterDosageDayService;
+
+    @Autowired
+    private EquEnergyMeterDosageMonthService equEnergyMeterDosageMonthService;
+
+    @Autowired
+    private EquEnergyMeterCenterDosageDayService equEnergyMeterCenterDosageDayService;
+
+    @Autowired
+    private EquEnergyMeterCenterDosageMonthService equEnergyMeterCenterDosageMonthService;
+
+    @Autowired
+    private EquEnergyRecordDao equEnergyRecordDao;
+
+
+    @Override
+    public R calEnergyUsage() {
+        //1.先将60天内计算出来的数据更新或者插入保存到 表具每日能源用量 equ_energy_meter_dosage_day表中
+        this.calRecordDataToDosageDay();
+        //2.根据equ_energy_meter_dosage_day中数据将近60天内每个日期的能源用量数据更新写入到 每月能源用量 equ_energy_meter_dosage_month
+        equEnergyMeterDosageMonthService.calDayToMonth();
+        //3.根据equ_energy_meter_dosage_day表中每日能源用量数据、能源成本中心与表具的关系和计算方式,equ_energy_meter_center_dosage_day
+        equEnergyMeterCenterDosageDayService.calRecordDataToCenterDosageDay();
+        //4.根据equ_energy_meter_center_dosage_day每日能源成本中心中数据将近60天内每个日期的能源用量数据更新写入到 每月能源用量equ_energy_meter_dosage_month表中
+        equEnergyMeterCenterDosageMonthService.calRecordDataToCenterDosageMonth();
+        return R.ok();
+    }
+
+
+
+    /**
+     * 计算60天最新的 equ_energy_record 记录,插入 equ_energy_meter_dosage_day表
+     *  月数据 按 表具id - 年 -月 统计
+     * @return
+     */
+    private void calRecordDataToDosageDay() {
+        //间隔天数
+        int intervalDays =60;
+        // 获取当前日期
+        LocalDate today = LocalDate.now();
+        // 计算60天前的日期
+        LocalDate sixtyDaysAgo = today.minusDays(intervalDays);
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+        String endTime = today.format(formatter)+" 23:59:59";
+        String startTime = sixtyDaysAgo.format(formatter);
+        //获取60天内所有表具中最新记录的相差值
+        List<EquEnergyMeterDosageDayDo> equEnergyMeterDosageDayDos = equEnergyRecordDao.calRecordDataToDosageDay(startTime,endTime);
+        //根据表具,时间 分组 ,每个镖局补充 60 天的记录
+        Map<String, Map<String, List<EquEnergyMeterDosageDayDo>>> collect = equEnergyMeterDosageDayDos.stream().collect(Collectors.groupingBy(EquEnergyMeterDosageDayDo::getMeterid,
+                Collectors.groupingBy(EquEnergyMeterDosageDayDo::getCenterday)));
+
+        List<EquEnergyMeterDosageDayDo>  dayList =new ArrayList<>();
+        final EquEnergyMeterDosageDayDo[] dayDos= {null};
+        final String[] dateKey = {""};
+        final String[] tenantid = {""};
+        final String[] ownedfactory = {""};
+        collect.forEach((meterid, map) -> {
+             tenantid[0] = map.values().stream().findFirst().get().get(0).getTenantid();
+             ownedfactory[0] = map.values().stream().findFirst().get().get(0).getOwnedfactory();
+            for (int i = 1; i < intervalDays; i++) {
+                dateKey[0] =  today.minusDays(i).format(formatter);
+                if (!map.containsKey(dateKey[0])){
+                    //表具能源用量 在该日期不存在记录,用量默认 null 新建记录
+                    dayDos[0] =new EquEnergyMeterDosageDayDo();
+                    dayDos[0].setCenterday(dateKey[0]);
+                    dayDos[0].setMeterid(meterid);
+                    dayDos[0].setTenantid(tenantid[0]);
+                    dayDos[0].setOwnedfactory(ownedfactory[0]);
+                }else {
+                    //日表数据存
+                    dayDos[0]=map.get(dateKey[0]).get(0);
+                }
+                dayDos[0].setId(SecurityUtil.getUUID());
+                dayList.add( dayDos[0]);
+
+            };
+
+        });
+        equEnergyMeterDosageDayService.deleteData();
+        equEnergyMeterDosageDayService.saveBatch(dayList);
+    }
+}

+ 14 - 14
cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/service/impl/EquForkliftRepairRecordServiceImpl.java

@@ -62,22 +62,22 @@ public class EquForkliftRepairRecordServiceImpl extends ServiceImpl<EquForkliftR
         // 解析数据
         List<EquForkliftRepairRecordDo> newForkliftRepairRecord = forkliftRepairRecordListener.getForkliftRepairRecordDoList();
         // 唯一性数据
-        List<EquForkliftRepairRecordDo> oldForkliftRepairRecord = equForkliftRepairRecordService.getUniqueDateByAll();
+    //    List<EquForkliftRepairRecordDo> oldForkliftRepairRecord = equForkliftRepairRecordService.getUniqueDateByAll();
         // 将新旧两组数据拼接为一个stream,再对stream进行分组,找到分组数量大于1的(说明又重复),将重复的数据拿到原始数据中找到源数据返回回来
-        List<EquForkliftRepairRecordDo> forkliftRepairRecordDoList = Stream.concat(newForkliftRepairRecord.stream(), oldForkliftRepairRecord.stream()).collect(Collectors.groupingBy(info ->
-                        info.getEquipmentnumber() + info.getRapairdate() + info.getRapairdetail() , Collectors.counting()))
-                .entrySet().stream()
-                .filter(info -> info.getValue() > 1)
-                .map(Map.Entry::getKey)
-                .map(info -> newForkliftRepairRecord.stream()
-                        .filter(item -> ( item.getEquipmentnumber() + item.getRapairdate() + item.getRapairdetail()).equals(info))
-                        .findFirst().orElse(null))
-                .filter(Objects::nonNull)
-                .collect(Collectors.toList());
+//        List<EquForkliftRepairRecordDo> forkliftRepairRecordDoList = Stream.concat(newForkliftRepairRecord.stream(), oldForkliftRepairRecord.stream()).collect(Collectors.groupingBy(info ->
+//                        info.getEquipmentnumber() + info.getRapairdate() + info.getRapairdetail() , Collectors.counting()))
+//                .entrySet().stream()
+//                .filter(info -> info.getValue() > 1)
+//                .map(Map.Entry::getKey)
+//                .map(info -> newForkliftRepairRecord.stream()
+//                        .filter(item -> ( item.getEquipmentnumber() + item.getRapairdate() + item.getRapairdetail()).equals(info))
+//                        .findFirst().orElse(null))
+//                .filter(Objects::nonNull)
+//                .collect(Collectors.toList());
         // 拼接返回错误数据
-        if (forkliftRepairRecordDoList.size() != 0) {
-            jointErrorData(forkliftRepairRecordDoList, errorData);
-        }
+//        if (forkliftRepairRecordDoList.size() != 0) {
+//            jointErrorData(forkliftRepairRecordDoList, errorData);
+//        }
         // 判断是否又错误数据
         if (errorData.size() != 0) {
             return R.error(JSON.toJSONString(errorData));

+ 182 - 0
cx-equipment/cx-equipment-entity/src/main/java/com/rongwei/bsentity/domain/EquEnergyMeterCenterDosageDayDo.java

@@ -0,0 +1,182 @@
+package com.rongwei.bsentity.domain;
+
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.NoArgsConstructor;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import java.util.Date;
+
+/**
+ * @author  cyn 
+ * @create 2024-07-12 09:24 
+ */
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@TableName("equ_energy_meter_center_dosage_day")
+public class EquEnergyMeterCenterDosageDayDo {
+
+	/**
+	 * table name:ID
+	 * table type:varchar(36)
+	 * table comment:主键ID
+	 */
+	private String id;
+
+	/**
+	 * table name:TENANTID
+	 * table type:text
+	 * table comment:所属工厂ID
+	 */
+	private String tenantid;
+
+	/**
+	 * table name:ROPTION
+	 * table type:text
+	 * table comment:扩展json格式配置
+	 */
+	private String roption;
+
+	/**
+	 * table name:DELETED
+	 * table type:varchar(1)
+	 * table comment:是否删除Y/N
+	 */
+	private String deleted;
+
+	/**
+	 * table name:REMARK
+	 * table type:text
+	 * table comment:备注
+	 */
+	private String remark;
+
+	/**
+	 * table name:CREATEDATE
+	 * table type:datetime
+	 * table comment:创建时间
+	 */
+	private Date createdate;
+
+	/**
+	 * table name:CREATEUSERID
+	 * table type:varchar(36)
+	 * table comment:创建用户ID
+	 */
+	private String createuserid;
+
+	/**
+	 * table name:MODIFYDATE
+	 * table type:datetime
+	 * table comment:修改日期
+	 */
+	private Date modifydate;
+
+	/**
+	 * table name:MODIFYUSERID
+	 * table type:varchar(36)
+	 * table comment:修改用户ID
+	 */
+	private String modifyuserid;
+
+	/**
+	 * table name:CREATEUSERNAME
+	 * table type:varchar(20)
+	 * table comment:创建人
+	 */
+	private String createusername;
+
+	/**
+	 * table name:MODIFYUSERNAME
+	 * table type:varchar(20)
+	 * table comment:修改人
+	 */
+	private String modifyusername;
+
+	/**
+	 * table name:PROCESSINSTID
+	 * table type:varchar(50)
+	 * table comment:流程ID
+	 */
+	private String processinstid;
+
+	/**
+	 * table name:CENTERID
+	 * table type:varchar(255)
+	 * table comment:能源统计ID
+	 */
+	private String centerid;
+
+	/**
+	 * table name:CENTERNAME
+	 * table type:varchar(255)
+	 * table comment:能源统计名称
+	 */
+	private String centername;
+
+	/**
+	 * table name:CENTERCODE
+	 * table type:varchar(50)
+	 * table comment:统计编号
+	 */
+	private String centercode;
+
+	/**
+	 * table name:STATUS
+	 * table type:varchar(36)
+	 * table comment:统计状态
+	 */
+	private String status;
+
+	/**
+	 * table name:ENERGYTYPE
+	 * table type:varchar(50)
+	 * table comment:分类
+	 */
+	private String energytype;
+
+	/**
+	 * table name:METERID
+	 * table type:varchar(255)
+	 * table comment:表具ID
+	 */
+	private String meterid;
+
+	/**
+	 * table name:METERCODE
+	 * table type:varchar(255)
+	 * table comment:编号
+	 */
+	private String metercode;
+
+	/**
+	 * table name:METERNAME
+	 * table type:varchar(255)
+	 * table comment:名称
+	 */
+	private String metername;
+
+	/**
+	 * table name:OWNEDFACTORY
+	 * table type:varchar(255)
+	 * table comment:所属工厂名称
+	 */
+	private String ownedfactory;
+
+	/**
+	 * table name:CENTERDAY
+	 * table type:varchar(255)
+	 * table comment:日期
+	 */
+	private String centerday;
+
+	/**
+	 * table name:DOSAGE
+	 * table type:decimal(20,6)
+	 * table comment:用量
+	 */
+	private Double dosage;
+
+}

+ 399 - 0
cx-equipment/cx-equipment-entity/src/main/java/com/rongwei/bsentity/domain/EquEnergyMeterCenterDosageMonthDo.java

@@ -0,0 +1,399 @@
+package com.rongwei.bsentity.domain;
+
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.NoArgsConstructor;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import java.util.Date;
+
+/**
+ * @author  cyn 
+ * @create 2024-07-12 09:24 
+ */
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@TableName("equ_energy_meter_center_dosage_month")
+public class EquEnergyMeterCenterDosageMonthDo {
+
+	/**
+	 * table name:ID
+	 * table type:varchar(36)
+	 * table comment:主键ID
+	 */
+	private String id;
+
+	/**
+	 * table name:TENANTID
+	 * table type:text
+	 * table comment:所属工厂ID
+	 */
+	private String tenantid;
+
+	/**
+	 * table name:ROPTION
+	 * table type:text
+	 * table comment:扩展json格式配置
+	 */
+	private String roption;
+
+	/**
+	 * table name:DELETED
+	 * table type:varchar(1)
+	 * table comment:是否删除Y/N
+	 */
+	private String deleted;
+
+	/**
+	 * table name:REMARK
+	 * table type:text
+	 * table comment:备注
+	 */
+	private String remark;
+
+	/**
+	 * table name:CREATEDATE
+	 * table type:datetime
+	 * table comment:创建时间
+	 */
+	private Date createdate;
+
+	/**
+	 * table name:CREATEUSERID
+	 * table type:varchar(36)
+	 * table comment:创建用户ID
+	 */
+	private String createuserid;
+
+	/**
+	 * table name:MODIFYDATE
+	 * table type:datetime
+	 * table comment:修改时间
+	 */
+	private Date modifydate;
+
+	/**
+	 * table name:MODIFYUSERID
+	 * table type:varchar(36)
+	 * table comment:修改用户ID
+	 */
+	private String modifyuserid;
+
+	/**
+	 * table name:CREATEUSERNAME
+	 * table type:varchar(20)
+	 * table comment:创建人
+	 */
+	private String createusername;
+
+	/**
+	 * table name:MODIFYUSERNAME
+	 * table type:varchar(20)
+	 * table comment:修改人
+	 */
+	private String modifyusername;
+
+	/**
+	 * table name:PROCESSINSTID
+	 * table type:varchar(50)
+	 * table comment:流程ID
+	 */
+	private String processinstid;
+
+	/**
+	 * table name:CENTERID
+	 * table type:varchar(255)
+	 * table comment:能源统计ID
+	 */
+	private String centerid;
+
+	/**
+	 * table name:CENTERNAME
+	 * table type:varchar(255)
+	 * table comment:能源统计名称
+	 */
+	private String centername;
+
+	/**
+	 * table name:CENTERCODE
+	 * table type:varchar(50)
+	 * table comment:统计编号
+	 */
+	private String centercode;
+
+	/**
+	 * table name:STATUS
+	 * table type:varchar(36)
+	 * table comment:统计状态
+	 */
+	private String status;
+
+	/**
+	 * table name:ENERGYTYPE
+	 * table type:varchar(50)
+	 * table comment:分类
+	 */
+	private String energytype;
+
+	/**
+	 * table name:METERID
+	 * table type:varchar(255)
+	 * table comment:表具ID
+	 */
+	private String meterid;
+
+	/**
+	 * table name:METERCODE
+	 * table type:varchar(255)
+	 * table comment:编号
+	 */
+	private String metercode;
+
+	/**
+	 * table name:METERNAME
+	 * table type:varchar(255)
+	 * table comment:名称
+	 */
+	private String metername;
+
+	/**
+	 * table name:OWNEDFACTORY
+	 * table type:varchar(255)
+	 * table comment:所属工厂名称
+	 */
+	private String ownedfactory;
+
+	/**
+	 * table name:CENTERYEAR
+	 * table type:varchar(20)
+	 * table comment:年
+	 */
+	private String centeryear;
+
+	/**
+	 * table name:CENTERMONTH
+	 * table type:varchar(20)
+	 * table comment:月
+	 */
+	private String centermonth;
+
+	/**
+	 * table name:DAY1
+	 * table type:decimal(20,6)
+	 * table comment:1
+	 */
+	private Double day1;
+
+	/**
+	 * table name:DAY2
+	 * table type:decimal(20,6)
+	 * table comment:2
+	 */
+	private Double day2;
+
+	/**
+	 * table name:DAY3
+	 * table type:decimal(20,6)
+	 * table comment:3
+	 */
+	private Double day3;
+
+	/**
+	 * table name:DAY4
+	 * table type:decimal(20,6)
+	 * table comment:4
+	 */
+	private Double day4;
+
+	/**
+	 * table name:DAY5
+	 * table type:decimal(20,6)
+	 * table comment:5
+	 */
+	private Double day5;
+
+	/**
+	 * table name:DAY6
+	 * table type:decimal(20,6)
+	 * table comment:6
+	 */
+	private Double day6;
+
+	/**
+	 * table name:DAY7
+	 * table type:decimal(20,6)
+	 * table comment:7
+	 */
+	private Double day7;
+
+	/**
+	 * table name:DAY8
+	 * table type:decimal(20,6)
+	 * table comment:8
+	 */
+	private Double day8;
+
+	/**
+	 * table name:DAY9
+	 * table type:decimal(20,6)
+	 * table comment:9
+	 */
+	private Double day9;
+
+	/**
+	 * table name:DAY10
+	 * table type:decimal(20,6)
+	 * table comment:10
+	 */
+	private Double day10;
+
+	/**
+	 * table name:DAY11
+	 * table type:decimal(20,6)
+	 * table comment:11
+	 */
+	private Double day11;
+
+	/**
+	 * table name:DAY12
+	 * table type:decimal(20,6)
+	 * table comment:12
+	 */
+	private Double day12;
+
+	/**
+	 * table name:DAY13
+	 * table type:decimal(20,6)
+	 * table comment:13
+	 */
+	private Double day13;
+
+	/**
+	 * table name:DAY14
+	 * table type:decimal(20,6)
+	 * table comment:14
+	 */
+	private Double day14;
+
+	/**
+	 * table name:DAY15
+	 * table type:decimal(20,6)
+	 * table comment:15
+	 */
+	private Double day15;
+
+	/**
+	 * table name:DAY16
+	 * table type:decimal(20,6)
+	 * table comment:16
+	 */
+	private Double day16;
+
+	/**
+	 * table name:DAY17
+	 * table type:decimal(20,6)
+	 * table comment:17
+	 */
+	private Double day17;
+
+	/**
+	 * table name:DAY18
+	 * table type:decimal(20,6)
+	 * table comment:18
+	 */
+	private Double day18;
+
+	/**
+	 * table name:DAY19
+	 * table type:decimal(20,6)
+	 * table comment:19
+	 */
+	private Double day19;
+
+	/**
+	 * table name:DAY20
+	 * table type:decimal(20,6)
+	 * table comment:20
+	 */
+	private Double day20;
+
+	/**
+	 * table name:DAY21
+	 * table type:decimal(20,6)
+	 * table comment:21
+	 */
+	private Double day21;
+
+	/**
+	 * table name:DAY22
+	 * table type:decimal(20,6)
+	 * table comment:22
+	 */
+	private Double day22;
+
+	/**
+	 * table name:DAY23
+	 * table type:decimal(20,6)
+	 * table comment:23
+	 */
+	private Double day23;
+
+	/**
+	 * table name:DAY24
+	 * table type:decimal(20,6)
+	 * table comment:24
+	 */
+	private Double day24;
+
+	/**
+	 * table name:DAY25
+	 * table type:decimal(20,6)
+	 * table comment:25
+	 */
+	private Double day25;
+
+	/**
+	 * table name:DAY26
+	 * table type:decimal(20,6)
+	 * table comment:26
+	 */
+	private Double day26;
+
+	/**
+	 * table name:DAY27
+	 * table type:decimal(20,6)
+	 * table comment:27
+	 */
+	private Double day27;
+
+	/**
+	 * table name:DAY28
+	 * table type:decimal(20,6)
+	 * table comment:28
+	 */
+	private Double day28;
+
+	/**
+	 * table name:DAY29
+	 * table type:decimal(20,6)
+	 * table comment:29
+	 */
+	private Double day29;
+
+	/**
+	 * table name:DAY30
+	 * table type:decimal(20,6)
+	 * table comment:30
+	 */
+	private Double day30;
+
+	/**
+	 * table name:DAY31
+	 * table type:decimal(20,6)
+	 * table comment:31
+	 */
+	private Double day31;
+
+}

+ 163 - 0
cx-equipment/cx-equipment-entity/src/main/java/com/rongwei/bsentity/domain/EquEnergyMeterDosageDayDo.java

@@ -0,0 +1,163 @@
+package com.rongwei.bsentity.domain;
+
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.NoArgsConstructor;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * @author  cyn 
+ * @create 2024-07-12 09:24 
+ */
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@TableName("equ_energy_meter_dosage_day")
+public class EquEnergyMeterDosageDayDo {
+
+	/**
+	 * table name:ID
+	 * table type:varchar(36)
+	 * table comment:主键ID
+	 */
+	private String id;
+
+	/**
+	 * table name:TENANTID
+	 * table type:text
+	 * table comment:所属工厂ID
+	 */
+	private String tenantid;
+
+	/**
+	 * table name:ROPTION
+	 * table type:text
+	 * table comment:扩展json格式配置
+	 */
+	private String roption;
+
+	/**
+	 * table name:DELETED
+	 * table type:varchar(1)
+	 * table comment:是否删除Y/N
+	 */
+	private String deleted;
+
+	/**
+	 * table name:REMARK
+	 * table type:text
+	 * table comment:备注
+	 */
+	private String remark;
+
+	/**
+	 * table name:CREATEDATE
+	 * table type:datetime
+	 * table comment:创建时间
+	 */
+	private Date createdate;
+
+	/**
+	 * table name:CREATEUSERID
+	 * table type:varchar(36)
+	 * table comment:创建用户ID
+	 */
+	private String createuserid;
+
+	/**
+	 * table name:MODIFYDATE
+	 * table type:datetime
+	 * table comment:修改日期
+	 */
+	private Date modifydate;
+
+	/**
+	 * table name:MODIFYUSERID
+	 * table type:varchar(36)
+	 * table comment:修改用户ID
+	 */
+	private String modifyuserid;
+
+	/**
+	 * table name:CREATEUSERNAME
+	 * table type:varchar(20)
+	 * table comment:创建人
+	 */
+	private String createusername;
+
+	/**
+	 * table name:MODIFYUSERNAME
+	 * table type:varchar(20)
+	 * table comment:修改人
+	 */
+	private String modifyusername;
+
+	/**
+	 * table name:PROCESSINSTID
+	 * table type:varchar(50)
+	 * table comment:流程ID
+	 */
+	private String processinstid;
+
+	/**
+	 * table name:STATUS
+	 * table type:varchar(36)
+	 * table comment:统计状态
+	 */
+	private String status;
+
+	/**
+	 * table name:ENERGYTYPE
+	 * table type:varchar(50)
+	 * table comment:分类
+	 */
+	private String energytype;
+
+	/**
+	 * table name:METERID
+	 * table type:varchar(255)
+	 * table comment:表具ID
+	 */
+	private String meterid;
+
+	/**
+	 * table name:METERCODE
+	 * table type:varchar(255)
+	 * table comment:编号
+	 */
+	private String metercode;
+
+	/**
+	 * table name:METERNAME
+	 * table type:varchar(255)
+	 * table comment:名称
+	 */
+	private String metername;
+
+	/**
+	 * table name:OWNEDFACTORY
+	 * table type:varchar(255)
+	 * table comment:所属工厂名称
+	 */
+	private String ownedfactory;
+
+	/**
+	 * table name:CENTERDAY
+	 * table type:varchar(255)
+	 * table comment:日期
+	 */
+	private String centerday;
+
+	/**
+	 * table name:DOSAGE
+	 * table type:decimal(20,6)
+	 * table comment:用量
+	 */
+	private BigDecimal dosage;
+
+}

+ 381 - 0
cx-equipment/cx-equipment-entity/src/main/java/com/rongwei/bsentity/domain/EquEnergyMeterDosageMonthDo.java

@@ -0,0 +1,381 @@
+package com.rongwei.bsentity.domain;
+
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.NoArgsConstructor;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+
+import java.lang.reflect.Field;
+import java.math.BigDecimal;
+import java.util.Date;
+
+/**
+ * @author  cyn 
+ * @create 2024-07-12 09:24 
+ */
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@TableName("equ_energy_meter_dosage_month")
+public class EquEnergyMeterDosageMonthDo {
+
+	/**
+	 * table name:ID
+	 * table type:varchar(36)
+	 * table comment:主键ID
+	 */
+	private String id;
+
+	/**
+	 * table name:TENANTID
+	 * table type:text
+	 * table comment:所属工厂ID
+	 */
+	private String tenantid;
+
+	/**
+	 * table name:ROPTION
+	 * table type:text
+	 * table comment:扩展json格式配置
+	 */
+	private String roption;
+
+	/**
+	 * table name:DELETED
+	 * table type:varchar(1)
+	 * table comment:是否删除Y/N
+	 */
+	private String deleted;
+
+	/**
+	 * table name:REMARK
+	 * table type:text
+	 * table comment:备注
+	 */
+	private String remark;
+
+	/**
+	 * table name:CREATEDATE
+	 * table type:datetime
+	 * table comment:创建时间
+	 */
+	private Date createdate;
+
+	/**
+	 * table name:CREATEUSERID
+	 * table type:varchar(36)
+	 * table comment:创建用户ID
+	 */
+	private String createuserid;
+
+	/**
+	 * table name:MODIFYDATE
+	 * table type:datetime
+	 * table comment:修改时间
+	 */
+	private Date modifydate;
+
+	/**
+	 * table name:MODIFYUSERID
+	 * table type:varchar(36)
+	 * table comment:修改用户ID
+	 */
+	private String modifyuserid;
+
+	/**
+	 * table name:CREATEUSERNAME
+	 * table type:varchar(20)
+	 * table comment:创建人
+	 */
+	private String createusername;
+
+	/**
+	 * table name:MODIFYUSERNAME
+	 * table type:varchar(20)
+	 * table comment:修改人
+	 */
+	private String modifyusername;
+
+	/**
+	 * table name:PROCESSINSTID
+	 * table type:varchar(50)
+	 * table comment:流程ID
+	 */
+	private String processinstid;
+
+	/**
+	 * table name:ENERGYTYPE
+	 * table type:varchar(50)
+	 * table comment:分类
+	 */
+	private String energytype;
+
+	/**
+	 * table name:METERID
+	 * table type:varchar(255)
+	 * table comment:表具ID
+	 */
+	private String meterid;
+
+	/**
+	 * table name:METERCODE
+	 * table type:varchar(255)
+	 * table comment:表具编号
+	 */
+	private String metercode;
+
+	/**
+	 * table name:METERNAME
+	 * table type:varchar(255)
+	 * table comment:表具名称
+	 */
+	private String metername;
+
+	/**
+	 * table name:OWNEDFACTORY
+	 * table type:varchar(255)
+	 * table comment:所属工厂名称
+	 */
+	private String ownedfactory;
+
+	/**
+	 * table name:CENTERYEAR
+	 * table type:varchar(20)
+	 * table comment:年
+	 */
+	private String centeryear;
+
+	/**
+	 * table name:CENTERMONTH
+	 * table type:varchar(20)
+	 * table comment:月
+	 */
+	private String centermonth;
+
+	/**
+	 * table name:DAY1
+	 * table type:decimal(20,6)
+	 * table comment:1
+	 */
+	private BigDecimal day1;
+
+	/**
+	 * table name:DAY2
+	 * table type:decimal(20,6)
+	 * table comment:2
+	 */
+	private BigDecimal day2;
+
+	/**
+	 * table name:DAY3
+	 * table type:decimal(20,6)
+	 * table comment:3
+	 */
+	private BigDecimal day3;
+
+	/**
+	 * table name:DAY4
+	 * table type:decimal(20,6)
+	 * table comment:4
+	 */
+	private BigDecimal day4;
+
+	/**
+	 * table name:DAY5
+	 * table type:decimal(20,6)
+	 * table comment:5
+	 */
+	private BigDecimal day5;
+
+	/**
+	 * table name:DAY6
+	 * table type:decimal(20,6)
+	 * table comment:6
+	 */
+	private BigDecimal day6;
+
+	/**
+	 * table name:DAY7
+	 * table type:decimal(20,6)
+	 * table comment:7
+	 */
+	private BigDecimal day7;
+
+	/**
+	 * table name:DAY8
+	 * table type:decimal(20,6)
+	 * table comment:8
+	 */
+	private BigDecimal day8;
+
+	/**
+	 * table name:DAY9
+	 * table type:decimal(20,6)
+	 * table comment:9
+	 */
+	private BigDecimal day9;
+
+	/**
+	 * table name:DAY10
+	 * table type:decimal(20,6)
+	 * table comment:10
+	 */
+	private BigDecimal day10;
+
+	/**
+	 * table name:DAY11
+	 * table type:decimal(20,6)
+	 * table comment:11
+	 */
+	private BigDecimal day11;
+
+	/**
+	 * table name:DAY12
+	 * table type:decimal(20,6)
+	 * table comment:12
+	 */
+	private BigDecimal day12;
+
+	/**
+	 * table name:DAY13
+	 * table type:decimal(20,6)
+	 * table comment:13
+	 */
+	private BigDecimal day13;
+
+	/**
+	 * table name:DAY14
+	 * table type:decimal(20,6)
+	 * table comment:14
+	 */
+	private BigDecimal day14;
+
+	/**
+	 * table name:DAY15
+	 * table type:decimal(20,6)
+	 * table comment:15
+	 */
+	private BigDecimal day15;
+
+	/**
+	 * table name:DAY16
+	 * table type:decimal(20,6)
+	 * table comment:16
+	 */
+	private BigDecimal day16;
+
+	/**
+	 * table name:DAY17
+	 * table type:decimal(20,6)
+	 * table comment:17
+	 */
+	private BigDecimal day17;
+
+	/**
+	 * table name:DAY18
+	 * table type:decimal(20,6)
+	 * table comment:18
+	 */
+	private BigDecimal day18;
+
+	/**
+	 * table name:DAY19
+	 * table type:decimal(20,6)
+	 * table comment:19
+	 */
+	private BigDecimal day19;
+
+	/**
+	 * table name:DAY20
+	 * table type:decimal(20,6)
+	 * table comment:20
+	 */
+	private BigDecimal day20;
+
+	/**
+	 * table name:DAY21
+	 * table type:decimal(20,6)
+	 * table comment:21
+	 */
+	private BigDecimal day21;
+
+	/**
+	 * table name:DAY22
+	 * table type:decimal(20,6)
+	 * table comment:22
+	 */
+	private BigDecimal day22;
+
+	/**
+	 * table name:DAY23
+	 * table type:decimal(20,6)
+	 * table comment:23
+	 */
+	private BigDecimal day23;
+
+	/**
+	 * table name:DAY24
+	 * table type:decimal(20,6)
+	 * table comment:24
+	 */
+	private BigDecimal day24;
+
+	/**
+	 * table name:DAY25
+	 * table type:decimal(20,6)
+	 * table comment:25
+	 */
+	private BigDecimal day25;
+
+	/**
+	 * table name:DAY26
+	 * table type:decimal(20,6)
+	 * table comment:26
+	 */
+	private BigDecimal day26;
+
+	/**
+	 * table name:DAY27
+	 * table type:decimal(20,6)
+	 * table comment:27
+	 */
+	private BigDecimal day27;
+
+	/**
+	 * table name:DAY28
+	 * table type:decimal(20,6)
+	 * table comment:28
+	 */
+	private BigDecimal day28;
+
+	/**
+	 * table name:DAY29
+	 * table type:decimal(20,6)
+	 * table comment:29
+	 */
+	private BigDecimal day29;
+
+	/**
+	 * table name:DAY30
+	 * table type:decimal(20,6)
+	 * table comment:30
+	 */
+	private BigDecimal day30;
+
+	/**
+	 * table name:DAY31
+	 * table type:decimal(20,6)
+	 * table comment:31
+	 */
+	private BigDecimal day31;
+
+
+	public void setDay(String fieldName, BigDecimal value) throws NoSuchFieldException, IllegalAccessException {
+		Field field = this.getClass().getDeclaredField(fieldName);
+		field.setAccessible(true); // 如果字段是私有的,则需要这一步
+		field.set(this, value);
+	}
+
+}

+ 224 - 0
cx-equipment/cx-equipment-entity/src/main/java/com/rongwei/bsentity/domain/EquEnergyRecordDo.java

@@ -0,0 +1,224 @@
+package com.rongwei.bsentity.domain;
+
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.NoArgsConstructor;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import java.util.Date;
+
+/**
+ * @author  cyn 
+ * @create 2024-07-12 09:24 
+ */
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@TableName("equ_energy_record")
+public class EquEnergyRecordDo {
+
+	/**
+	 * table name:ID
+	 * table type:varchar(36)
+	 * table comment:主键ID
+	 */
+	private String id;
+
+	/**
+	 * table name:TENANTID
+	 * table type:text
+	 * table comment:null
+	 */
+	private String tenantid;
+
+	/**
+	 * table name:ROPTION
+	 * table type:text
+	 * table comment:扩展json格式配置
+	 */
+	private String roption;
+
+	/**
+	 * table name:DELETED
+	 * table type:varchar(1)
+	 * table comment:是否删除Y/N
+	 */
+	private String deleted;
+
+	/**
+	 * table name:REMARK
+	 * table type:text
+	 * table comment:备注
+	 */
+	private String remark;
+
+	/**
+	 * table name:METERID
+	 * table type:varchar(50)
+	 * table comment:表具ID
+	 */
+	private String meterid;
+
+	/**
+	 * table name:VALUEZ
+	 * table type:decimal(18,4)
+	 * table comment:抄表总量
+	 */
+	private Double valuez;
+
+	/**
+	 * table name:CBDATE
+	 * table type:datetime
+	 * table comment:抄表日期
+	 */
+	private Date cbdate;
+
+	/**
+	 * table name:CREATEDATE
+	 * table type:datetime
+	 * table comment:创建时间
+	 */
+	private Date createdate;
+
+	/**
+	 * table name:CREATEUSERID
+	 * table type:varchar(36)
+	 * table comment:创建用户ID
+	 */
+	private String createuserid;
+
+	/**
+	 * table name:MODIFYDATE
+	 * table type:datetime
+	 * table comment:修改日期
+	 */
+	private Date modifydate;
+
+	/**
+	 * table name:MODIFYUSERID
+	 * table type:varchar(36)
+	 * table comment:修改用户ID
+	 */
+	private String modifyuserid;
+
+	/**
+	 * table name:CREATEUSERNAME
+	 * table type:varchar(20)
+	 * table comment:创建人
+	 */
+	private String createusername;
+
+	/**
+	 * table name:MODIFYUSERNAME
+	 * table type:varchar(20)
+	 * table comment:修改人
+	 */
+	private String modifyusername;
+
+	/**
+	 * table name:STATUS
+	 * table type:varchar(36)
+	 * table comment:使用状态
+	 */
+	private String status;
+
+	/**
+	 * table name:PROCESSINSTID
+	 * table type:varchar(50)
+	 * table comment:流程ID
+	 */
+	private String processinstid;
+
+	/**
+	 * table name:ENERGYTYPE
+	 * table type:varchar(50)
+	 * table comment:分类
+	 */
+	private String energytype;
+
+	/**
+	 * table name:METERCODE
+	 * table type:varchar(255)
+	 * table comment:表具编号
+	 */
+	private String metercode;
+
+	/**
+	 * table name:METERNAME
+	 * table type:varchar(255)
+	 * table comment:表具名称
+	 */
+	private String metername;
+
+	/**
+	 * table name:METERLOCATION
+	 * table type:varchar(255)
+	 * table comment:表具位置
+	 */
+	private String meterlocation;
+
+	/**
+	 * table name:POINTS
+	 * table type:varchar(255)
+	 * table comment:点位
+	 */
+	private String points;
+
+	/**
+	 * table name:VALUEU
+	 * table type:decimal(18,4)
+	 * table comment:抄表用量
+	 */
+	private Double valueu;
+
+	/**
+	 * table name:VALUE1
+	 * table type:decimal(18,4)
+	 * table comment:点位值1
+	 */
+	private Double value1;
+
+	/**
+	 * table name:VALUE2
+	 * table type:decimal(18,4)
+	 * table comment:点位值2
+	 */
+	private Double value2;
+
+	/**
+	 * table name:VALUE3
+	 * table type:varchar(255)
+	 * table comment:点位值3
+	 */
+	private String value3;
+
+	/**
+	 * table name:VALUE4
+	 * table type:varchar(255)
+	 * table comment:点位值4
+	 */
+	private String value4;
+
+	/**
+	 * table name:OWNEDFACTORY
+	 * table type:varchar(255)
+	 * table comment:所属工厂
+	 */
+	private String ownedfactory;
+
+	/**
+	 * table name:USEDEPTID
+	 * table type:varchar(255)
+	 * table comment:使用部门ID
+	 */
+	private String usedeptid;
+
+	/**
+	 * table name:USEDEPT
+	 * table type:varchar(255)
+	 * table comment:使用部门
+	 */
+	private String usedept;
+
+}

+ 10 - 0
cx-equipment/cx-equipment-entity/src/main/java/com/rongwei/bsentity/domain/EquForkliftRepairRecordDo.java

@@ -183,4 +183,14 @@ public class EquForkliftRepairRecordDo {
 	 */
 	private String rapairdetail;
 
+	/**
+	 * 规格型号
+	 */
+	private String specificationmodel;
+
+	/**
+	 * 数量
+	 */
+	private String quantity;
+
 }

+ 45 - 0
cx-equipment/cx-equipment-server/src/main/java/com/rongwei/bsserver/sys/controller/EquEnergyRecordController.java

@@ -0,0 +1,45 @@
+package com.rongwei.bsserver.sys.controller;
+
+import com.rongwei.bscommon.sys.service.EquEnergyRecordService;
+import com.rongwei.rwcommon.base.R;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.Date;
+
+/**
+ * 表具管理
+ * 2024-07-12
+ * huangpeng
+ */
+@RestController
+@RequestMapping("/equEnergyRecord")
+public class EquEnergyRecordController {
+
+    private static final Logger logger = LoggerFactory.getLogger(EquEnergyRecordController.class);
+    @Autowired
+    EquEnergyRecordService equEnergyRecordService;
+
+
+    /**
+     * 计算能源用量
+     * @param
+     * @return
+     */
+    @Scheduled(cron = "0 0 6/2 1/1 * ? ")
+    @RequestMapping("/calEnergyUsage")
+    public R calEnergyUsage() {
+        try {
+            logger.info("计算能源用量开始:{}"+new Date());
+            return equEnergyRecordService.calEnergyUsage();
+        } catch (Exception e) {
+            logger.error("计算能源用量失败:{}" + e.getMessage());
+            return R.error();
+        }
+    }
+
+}