Browse Source

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

xiahan 9 months ago
parent
commit
880c647bcf
22 changed files with 1346 additions and 3 deletions
  1. 9 0
      bs-common/src/main/java/com/rongwei/safecommon/utils/SaveConstans.java
  2. 2 0
      cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/dao/ApsBlankOrderDao.java
  3. 3 0
      cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/dao/ApsProcessOperationDao.java
  4. 22 0
      cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ApsBlankOrderServiceImpl.java
  5. 31 0
      cx-aps/cx-aps-common/src/main/java/com/rongwei/bscommon/sys/service/impl/ApsProcessOperationServiceImpl.java
  6. 1 1
      cx-aps/cx-aps-server/src/main/java/com/rongwei/bsserver/controller/ApsProductionOrderController.java
  7. 96 0
      cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/config/EquForkliftRepairRecordListener.java
  8. 7 0
      cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/dao/EquForkliftRepairRecordDao.java
  9. 18 0
      cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/dao/EquMaintenancePredictivePlanDao.java
  10. 62 0
      cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/excel/EquForkliftRepairRecordTemplate.java
  11. 15 0
      cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/service/EquForkliftRepairRecordService.java
  12. 22 0
      cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/service/EquMaintenancePredictivePlanService.java
  13. 118 0
      cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/service/impl/EquForkliftRepairRecordServiceImpl.java
  14. 132 0
      cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/service/impl/EquMaintenancePredictivePlanServiceImpl.java
  15. 1 1
      cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/service/impl/MaintenanceServiceImpl.java
  16. 30 0
      cx-equipment/cx-equipment-common/src/main/resources/mybatis/business/EquMaintenancePredictivePlanDao.xml
  17. 186 0
      cx-equipment/cx-equipment-entity/src/main/java/com/rongwei/bsentity/domain/EquForkliftRepairRecordDo.java
  18. 443 0
      cx-equipment/cx-equipment-entity/src/main/java/com/rongwei/bsentity/domain/EquMaintenancePredictivePlanDo.java
  19. 20 0
      cx-equipment/cx-equipment-entity/src/main/java/com/rongwei/bsentity/domain/EquMaintenancePredictivePlanVo.java
  20. 12 1
      cx-equipment/cx-equipment-entity/src/main/java/com/rongwei/bsentity/domain/EquMaintenanceTaskDo.java
  21. 37 0
      cx-equipment/cx-equipment-server/src/main/java/com/rongwei/bsserver/sys/controller/EquForkliftRepairRecordController.java
  22. 79 0
      cx-equipment/cx-equipment-server/src/main/java/com/rongwei/bsserver/sys/controller/EquMaintenancePredictivePlanController.java

+ 9 - 0
bs-common/src/main/java/com/rongwei/safecommon/utils/SaveConstans.java

@@ -963,4 +963,13 @@ public class SaveConstans {
         public static final Integer MAINTENANCE_PART_MONTH_Y = 1; //月份选择是,值为1
 
     }
+
+    /**
+     * 人员信息 -默认值
+     */
+    public static class SysUser{
+        //设备子系统ID,NAME
+        public static final String DEVICESUBSYSTEMID = "b6ab1e33b3464fdd996145f8715c605e";
+        public static final String DEVICESUBSYSTEMNAME = "设备子系统";
+    }
 }

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

@@ -136,4 +136,6 @@ public interface ApsBlankOrderDao extends BaseMapper<ApsBlankOrderDo> {
     @Select("select count(1) from aps_work_in_progress_inventory where DELETED = 0 AND (BLANKBATCHNUMBER =  #{batchNumber} OR BLANKBATCHNUMBER like CONCAT(#{batchNumber},'-%') OR #{batchNumber} like CONCAT(BLANKBATCHNUMBER,'-%'))")
     Integer selectCountWorkIn(@Param("batchNumber") String batchNumber);
 
+    @Select("select GROUP_CONCAT(distinct IF(b.BACHMATERIALPROCESS = '', null,b.BACHMATERIALPROCESS) ) AS 'BACHMATERIALPROCESS' from aps_process_operation a LEFT JOIN aps_process_operation_process_equ b ON b.DELETED = 0 AND a.ID = b.PROCESSID where a.DELETED = 0 AND a.ID = #{processId} AND a.PREVIOUSPROCESSID is null group by a.ID")
+    String selectBatchNumbersByProcessId(@Param("processId") String processId);
 }

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

@@ -91,4 +91,7 @@ public interface ApsProcessOperationDao extends BaseMapper<ApsProcessOperationDo
     @Select("SELECT CRAFTROUTEID as ID,ROUTEPRODUCTTYPEID as PRODUCTTYPE,ROUTEMETAL as METAL,ROUTEMETALSTATE as METALSTATE,ROUTETHICKSTR as THICKSTR,ROUTETHICKEND as THICKEND," +
             "ROUTEWIDTHSTR as WIDTHSTR,ROUTEWIDTHEND as WIDTHEND,ROUTELENGTHSTR as LENGTHSTR,ROUTELENGTHEND as LENGTHEND FROM aps_blank_order WHERE ID=#{newblankid}")
     ApsCraftRouteDo getApsCraftRoute(@Param("newblankid") String newblankid);
+
+    @Select("SELECT * from aps_craft_route WHERE ID=#{craftrouteid}")
+    ApsCraftRouteDo getCraftRoute(@Param("craftrouteid") String craftrouteid);
 }

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

@@ -2962,6 +2962,9 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
             return R.error("领料数量不能大于计划加工卷数-已开工卷数-已取消卷数=" + needStartRoll);
         }
 
+        //查询目前的作业明细包含的批次号
+        String nowNumber = this.baseMapper.selectBatchNumbersByProcessId(apsProcessOperationDo.getId());
+
         //原来的批次号
         String oldBatchNumbers = req.getOldBatchNumbers();
         LinkedList<String> oldBatchNumberList = new LinkedList<>();
@@ -2969,6 +2972,25 @@ public class ApsBlankOrderServiceImpl extends ServiceImpl<ApsBlankOrderDao, ApsB
             oldBatchNumberList = new LinkedList<>(Arrays.asList(oldBatchNumbers.split(",")));
         }
 
+        //判断旧的批次号有没有变化
+        List<String> nowNumberList = new LinkedList<>();
+        if (ObjectUtil.isNotEmpty(nowNumber)) {
+            nowNumberList = new LinkedList<>(Arrays.asList(nowNumber.split(",")));
+        }
+        if (nowNumberList.size() != oldBatchNumberList.size()) {
+            return R.error("领料批次号可能已经被使用,请刷新后重新领料");
+        }
+        for (String s : nowNumberList) {
+            if (!oldBatchNumberList.contains(s)) {
+                return R.error("领料批次号可能已经被使用,请刷新后重新领料");
+            }
+        }
+        for (String s : oldBatchNumberList) {
+            if (!nowNumberList.contains(s)) {
+                return R.error("领料批次号可能已经被使用,请刷新后重新领料");
+            }
+        }
+
         //新的批次号集合
         List<String> addBatchNumberList = new LinkedList<>();
         //删除的批次号集合

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

@@ -1102,8 +1102,20 @@ public class ApsProcessOperationServiceImpl extends ServiceImpl<ApsProcessOperat
             req.setProcessOperationId(blanckdata.getStr("ID"));
             apsProcessOperationProcessEquService.updateProductionStatus(req);
 
+            //作业开工完工时间初始化
+            apsProcessOperationService.update(new LambdaUpdateWrapper<ApsProcessOperationDo>()
+                    .eq(ApsProcessOperationDo::getBlankid, blanckdata.getStr("ID"))
+                    .set(ApsProcessOperationDo::getPlanstartdate, null)
+                    .set(ApsProcessOperationDo::getPlanenddate, null)
+                    .set(ApsProcessOperationDo::getActualstartdate, null)
+                    .set(ApsProcessOperationDo::getActualfinishdate, null)
+            );
+
             //更新坯料计划的所选工艺路线相关信息
             ApsCraftRouteDo apsCraftRouteDo = apsProcessOperationDao.getApsCraftRoute(newblankid);
+            if (apsCraftRouteDo == null) {
+                apsCraftRouteDo = apsProcessOperationDao.getCraftRoute(craftrouteid);
+            }
             apsBlankOrderService.update(new LambdaUpdateWrapper<ApsBlankOrderDo>()
                     .eq(ApsBlankOrderDo::getId, blanckdata.getStr("ID"))
                     .set(ApsBlankOrderDo::getRoption, newblankid)
@@ -1328,6 +1340,12 @@ public class ApsProcessOperationServiceImpl extends ServiceImpl<ApsProcessOperat
             List<ApsScheduleConfigDo> apsConfigs = apsScheduleConfigService.list();
             BigDecimal aluminumdensity = apsConfigs.get(0).getAluminumdensity();
 
+            String craftrouteid = params.getCraftrouteid();
+            if (craftrouteid == null) {
+                ApsBlankOrderDo apsBlankOrderDo = apsBlankOrderService.getById(params.getBlankid());
+                craftrouteid = apsBlankOrderDo.getCraftrouteid();
+            }
+
             //该坯料计划所有的工序及输出
             Map<String, Object> map = new HashMap<>();
             map.put("BLANKID", params.getBlankid());
@@ -1502,12 +1520,16 @@ public class ApsProcessOperationServiceImpl extends ServiceImpl<ApsProcessOperat
                 if (operationOutMaterDos.size() > 0) {
                     ResetProcessOperationVo resetmap = new ResetProcessOperationVo();
                     resetmap.setBlankid(params.getBlankid());
+                    resetmap.setCraftrouteid(craftrouteid);
                     resetmap.setOutmeterinfo(operationOutMaterDos);
                     resetProcessOperation(resetmap);
                 }
             }
             //更新坯料计划的所选工艺路线相关信息
             ApsCraftRouteDo apsCraftRouteDo = apsProcessOperationDao.getApsCraftRoute(params.getBlankid());
+            if (apsCraftRouteDo == null) {
+                apsCraftRouteDo = apsProcessOperationDao.getCraftRoute(craftrouteid);
+            }
             R r = new R();
             r.setCode("200");
             r.setData(apsCraftRouteDo);
@@ -1831,11 +1853,15 @@ public class ApsProcessOperationServiceImpl extends ServiceImpl<ApsProcessOperat
             if (operationOutMaterDos.size() > 0) {
                 ResetProcessOperationVo resetmap = new ResetProcessOperationVo();
                 resetmap.setBlankid(blanckdata.getStr("ID"));
+                resetmap.setCraftrouteid(blanckdata.getStr("CRAFTROUTEID"));
                 resetmap.setOutmeterinfo(operationOutMaterDos);
                 resetProcessOperation(resetmap);
             }
             //更新坯料计划的所选工艺路线相关信息
             ApsCraftRouteDo apsCraftRouteDo = apsProcessOperationDao.getApsCraftRoute(blanckdata.getStr("ID"));
+            if (apsCraftRouteDo == null) {
+                apsCraftRouteDo = apsProcessOperationDao.getCraftRoute(blanckdata.getStr("CRAFTROUTEID"));
+            }
             R r = new R();
             r.setCode("200");
             r.setData(apsCraftRouteDo);
@@ -1968,6 +1994,7 @@ public class ApsProcessOperationServiceImpl extends ServiceImpl<ApsProcessOperat
     public R cancelProcessOperation(CancelProcessOperationVo cancelProcessOperationVo) {
         List<ApsProcessOperationOutMaterDo> apsProcessOperationOutMaterDoList = new ArrayList<>();
         try {
+            String craftrouteid = cancelProcessOperationVo.getCraftrouteid();
             Integer curcancelroll = cancelProcessOperationVo.getCurcancelroll();//作业本次取消卷数
 
             //本道工序作业
@@ -2075,6 +2102,7 @@ public class ApsProcessOperationServiceImpl extends ServiceImpl<ApsProcessOperat
                 List<ApsProcessOperationDo> apsProcessOperationDos = apsProcessOperationDao.getNextProcessOperations(apsProcessOperationDo.getNextprocessid().replace(",", "','"));
                 for (ApsProcessOperationDo processOperationDo : apsProcessOperationDos) {
                     CancelProcessOperationVo cancelProcessOperationVo1 = new CancelProcessOperationVo();
+                    cancelProcessOperationVo1.setCraftrouteid(craftrouteid);
                     cancelProcessOperationVo1.setSetincancelroll(false);
                     cancelProcessOperationVo1.setUpdatecuropration(false);
                     Integer nextCurCancelRoll = (int) Math.floor((double) (curcancelroll * processOperationDo.getPlanprocessrall()) / apsProcessOperationDo.getPlanprocessrall());
@@ -2150,6 +2178,9 @@ public class ApsProcessOperationServiceImpl extends ServiceImpl<ApsProcessOperat
 
                 //更新坯料计划的所选工艺路线相关信息
                 ApsCraftRouteDo apsCraftRouteDo = apsProcessOperationDao.getApsCraftRoute(apsProcessOperationDo.getBlankid());
+                if (apsCraftRouteDo == null && StringUtils.isNotBlank(craftrouteid)) {
+                    apsCraftRouteDo = apsProcessOperationDao.getCraftRoute(craftrouteid);
+                }
                 R r = new R();
                 r.setCode("200");
                 r.setData(apsCraftRouteDo);

+ 1 - 1
cx-aps/cx-aps-server/src/main/java/com/rongwei/bsserver/controller/ApsProductionOrderController.java

@@ -153,7 +153,7 @@ public class ApsProductionOrderController {
      * 每天凌晨1点执行一次
      * 每天定时任务检查所有订单评审状态=已发布计划的订单,如果订单生产状态=已完工,则更新订单评审状态=已完工关闭(个人工作台的评审消息自动清除)
      */
-    @Scheduled(cron = "0 1 * * *")
+    @Scheduled(cron = "0 0 1 * * *")
     @PostMapping("/closeOrder")
     public R closeOrder(){
         return apsProductionOrderService.closeOrder();

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

@@ -0,0 +1,96 @@
+package com.rongwei.bscommon.sys.config;
+
+import com.alibaba.excel.context.AnalysisContext;
+import com.alibaba.excel.event.AnalysisEventListener;
+import com.rongwei.bscommon.sys.excel.EquForkliftRepairRecordTemplate;
+import com.rongwei.bscommon.sys.excel.EquMaintenanceStandardTemplate;
+import com.rongwei.bsentity.domain.EquForkliftRepairRecordDo;
+import com.rongwei.bsentity.domain.EquMaintenanceStandardDo;
+import com.rongwei.bsentity.enums.MaintenanceTypeEnum;
+import com.rongwei.bsentity.enums.PlantEnum;
+import com.rongwei.rwcommon.utils.SecurityUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
+
+import java.lang.reflect.Field;
+import java.util.*;
+
+/**
+ * @author shangmi
+ * @title ExcelListener
+ * @date 2023/12/7 16:09
+ * @description EquMaintenanceStandard监听器
+ */
+@Slf4j
+public class EquForkliftRepairRecordListener extends AnalysisEventListener<EquForkliftRepairRecordTemplate> {
+
+    private static final String[] NON_SET = {"equipmentnumber","rapairdetail","rapairdate"};
+    private List<EquForkliftRepairRecordDo> forkliftRepairRecordDoList = new ArrayList<>();
+
+    private List<String> errorData = new ArrayList<>();
+
+    @Override
+    public void invoke(EquForkliftRepairRecordTemplate forkliftRepairRecordTemplate, AnalysisContext analysisContext) {
+        try {
+            log.info("解析到一条数据:{}", forkliftRepairRecordTemplate);
+            for (Field field : forkliftRepairRecordTemplate.getClass().getDeclaredFields()) {
+                field.setAccessible(true);
+                String name = field.getName();
+                if (Objects.isNull(field.get(forkliftRepairRecordTemplate)) && Arrays.asList(NON_SET).contains(name)) {
+                    errorData.add((analysisContext.readRowHolder().getRowIndex() + 1) + "行存在必填数据为空的情况,请填写完整!");
+                }
+            }
+            EquForkliftRepairRecordDo e = migrateDate(forkliftRepairRecordTemplate);
+            forkliftRepairRecordDoList.add(e);
+        } catch (Exception e) {
+            log.error(e.getMessage());
+        }
+    }
+
+
+    @Override
+    public void doAfterAllAnalysed(AnalysisContext analysisContext) {
+
+    }
+
+    public List<EquForkliftRepairRecordDo> getForkliftRepairRecordDoList() {
+        return this.forkliftRepairRecordDoList;
+    }
+
+
+    public List<String> getErrorData() {
+        return this.errorData;
+    }
+
+
+    /**
+     * 数据转换
+     *
+     * @param
+     * @return {@link EquForkliftRepairRecordDo}
+     * @date 2023/12/8 10:14
+     * @author shangmi
+     */
+
+    private EquForkliftRepairRecordDo migrateDate(EquForkliftRepairRecordTemplate forkliftRepairRecordTemplate) {
+        Date date = new Date();
+        StringBuilder planMonth = new StringBuilder();
+        // SysUserVo currentUser = CommonUtils.getCurrentUser();
+        EquForkliftRepairRecordDo equForkliftRepairRecordDo = new EquForkliftRepairRecordDo();
+        BeanUtils.copyProperties(forkliftRepairRecordTemplate, equForkliftRepairRecordDo);
+        equForkliftRepairRecordDo.setCreatedate(date)
+                .setModifydate(date)
+                .setId(SecurityUtil.getUUID())
+                .setTenantid(PlantEnum.idOf(forkliftRepairRecordTemplate.getOwnedfactory()))
+                .setOwnedfactory(forkliftRepairRecordTemplate.getOwnedfactory())
+                .setEquipmentname(forkliftRepairRecordTemplate.getEquipmentname())
+                .setEquipmentnumber(forkliftRepairRecordTemplate.getEquipmentnumber())
+                .setUsedept(forkliftRepairRecordTemplate.getUsedept())
+                .setRapairname(forkliftRepairRecordTemplate.getRapairname())
+                .setRapairdate(forkliftRepairRecordTemplate.getRapairdate())
+                .setRapairdetail(forkliftRepairRecordTemplate.getRapairdetail())
+               ;
+
+        return equForkliftRepairRecordDo;
+    }
+}

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

@@ -0,0 +1,7 @@
+package com.rongwei.bscommon.sys.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.rongwei.bsentity.domain.EquForkliftRepairRecordDo;
+
+public interface EquForkliftRepairRecordDao extends BaseMapper<EquForkliftRepairRecordDo> {
+}

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

@@ -0,0 +1,18 @@
+package com.rongwei.bscommon.sys.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.rongwei.bsentity.domain.EquMaintenancePredictivePlanDo;
+import com.rongwei.bsentity.domain.EquMaintenancePredictivePlanVo;
+import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.annotations.Select;
+
+import java.util.List;
+
+public interface EquMaintenancePredictivePlanDao extends BaseMapper<EquMaintenancePredictivePlanDo> {
+
+
+
+    List<EquMaintenancePredictivePlanVo> queryDateByids(@Param("ids") List<String> ids);
+
+    void getDetail(List<String> ids);
+}

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

@@ -0,0 +1,62 @@
+package com.rongwei.bscommon.sys.excel;
+
+import com.alibaba.excel.annotation.ExcelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+import java.util.Date;
+
+/**
+ * @author shangmi
+   叉车维修登记
+ */
+@Data
+@EqualsAndHashCode
+public class EquForkliftRepairRecordTemplate {
+
+
+    /**
+     * 所属工厂
+     */
+    @ExcelProperty(index = 0)
+    private String ownedfactory;
+
+    /**
+     * 叉车
+     */
+    @ExcelProperty(index = 1)
+    private String equipmentname;
+
+    /**
+     叉车编号
+     */
+    @ExcelProperty(index = 2)
+    private String equipmentnumber;
+
+    /**
+     使用部门
+     */
+    @ExcelProperty(index = 3)
+    private String usedept;
+
+    /**
+     维修/保养人
+     */
+    @ExcelProperty(index = 4)
+    private String rapairname;
+
+    /**
+     维修/保养日期
+     */
+    @ExcelProperty(index = 5)
+    private Date rapairdate;
+
+    /**
+     维修/保养内容
+     */
+    @ExcelProperty(index = 6)
+    private String rapairdetail;
+
+
+
+}

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

@@ -0,0 +1,15 @@
+package com.rongwei.bscommon.sys.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.rongwei.bsentity.domain.EquForkliftRepairRecordDo;
+import com.rongwei.rwcommon.base.R;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.IOException;
+import java.util.List;
+
+public interface EquForkliftRepairRecordService extends IService<EquForkliftRepairRecordDo> {
+    R equForkliftRepairRecordService(MultipartFile multipartFile) throws IOException;
+
+    List<EquForkliftRepairRecordDo> getUniqueDateByAll();
+}

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

@@ -0,0 +1,22 @@
+package com.rongwei.bscommon.sys.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.rongwei.bsentity.domain.EquMaintenancePartDo;
+import com.rongwei.bsentity.domain.EquMaintenancePredictivePlanDo;
+import com.rongwei.bsentity.domain.EquMaintenancePredictivePlanVo;
+import com.rongwei.bsentity.domain.EquMaintenanceTaskDo;
+import com.rongwei.bsentity.dto.TaskCreatorDTO;
+import com.rongwei.rwcommon.base.R;
+
+import java.util.List;
+
+/**
+
+ */
+public interface EquMaintenancePredictivePlanService extends IService<EquMaintenancePredictivePlanDo> {
+
+    R generateMaintenanceTask(List<String> ids);
+
+
+}
+

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

@@ -0,0 +1,118 @@
+package com.rongwei.bscommon.sys.service.impl;
+
+import cn.hutool.core.date.DateUtil;
+import com.alibaba.excel.EasyExcel;
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.rongwei.bscommon.sys.config.EquForkliftRepairRecordListener;
+import com.rongwei.bscommon.sys.dao.EquForkliftRepairRecordDao;
+import com.rongwei.bscommon.sys.excel.EquForkliftRepairRecordTemplate;
+import com.rongwei.bscommon.sys.service.EquForkliftRepairRecordService;
+import com.rongwei.bscommon.sys.utils.CommonUtils;
+import com.rongwei.bscommon.sys.utils.DateUtils;
+import com.rongwei.bsentity.domain.EquForkliftRepairRecordDo;
+import com.rongwei.bsentity.enums.MaintenanceTypeEnum;
+import com.rongwei.bsentity.enums.PlantEnum;
+import com.rongwei.rwadmincommon.system.vo.SysUserVo;
+import com.rongwei.rwcommon.base.R;
+import com.rongwei.rwcommonentity.commonservers.vo.SysSerialVo;
+import com.rongwei.safecommon.utils.CXCommonUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+import java.io.IOException;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import static com.rongwei.safecommon.utils.SaveConstans.DatePattern.DATE_PATTERN_YMD;
+
+@Service
+public class EquForkliftRepairRecordServiceImpl extends ServiceImpl<EquForkliftRepairRecordDao, EquForkliftRepairRecordDo> implements EquForkliftRepairRecordService {
+
+
+    @Autowired
+    EquForkliftRepairRecordService equForkliftRepairRecordService;
+
+    @Autowired
+    EquForkliftRepairRecordDao equForkliftRepairRecordDao;
+
+    @Override
+    public R equForkliftRepairRecordService(MultipartFile multipartFile) throws IOException {
+        Date date = new Date();
+        EquForkliftRepairRecordListener forkliftRepairRecordListener = new EquForkliftRepairRecordListener();
+        // 解析Excel
+        EasyExcel.read(multipartFile.getInputStream(), EquForkliftRepairRecordTemplate.class, forkliftRepairRecordListener).sheet().headRowNumber(3).doRead();
+        // 解析有误信息
+        List<String> errorData = forkliftRepairRecordListener.getErrorData();
+        // 解析数据
+        List<EquForkliftRepairRecordDo> newForkliftRepairRecord = forkliftRepairRecordListener.getForkliftRepairRecordDoList();
+        // 唯一性数据
+        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());
+        // 拼接返回错误数据
+        if (forkliftRepairRecordDoList.size() != 0) {
+            jointErrorData(forkliftRepairRecordDoList, errorData);
+        }
+        // 判断是否又错误数据
+        if (errorData.size() != 0) {
+            return R.error(JSON.toJSONString(errorData));
+        }
+        SysUserVo currentUser = CommonUtils.getCurrentUser();
+        // 生成流水号
+        for (EquForkliftRepairRecordDo forkliftRepairRecord : newForkliftRepairRecord) {
+            SysSerialVo sysSerialVo = new SysSerialVo();
+            String plantSimp = PlantEnum.addrOf(forkliftRepairRecord.getTenantid());
+//            sysSerialVo.setModulecode("equ_maintenance_standard_aq_code_" + plantSimp);
+//            // sysSerialVo.setResetrule("date:yyyy");
+//            sysSerialVo.setRuleTemplateStr(plantSimp + "-BYBZ-@{serialNumber:#00000}");
+//            R serialNumberCode = rwAdminFeign.getSerialNumberCode(sysSerialVo);
+//            if ("200".equals(serialNumberCode.getCode())) {
+//                Object data = serialNumberCode.getData();
+//                forkliftRepairRecord.setStandardid(JSONObject.parseObject(JSONObject.toJSONString(data), Map.class).get("code").toString());
+//            }
+            forkliftRepairRecord.setTenantid(CXCommonUtils.getCurrentUserFactoryId(currentUser))
+                    .setCreatedate(date)
+                    .setModifydate(date)
+                    .setCreateuserid(currentUser.getId())
+                    .setCreateusername(currentUser.getName())
+                    .setModifyusername(currentUser.getName())
+                    .setModifyuserid(currentUser.getId());
+        }
+        equForkliftRepairRecordService.saveBatch(newForkliftRepairRecord, 200);
+        return R.ok("导入成功");
+    }
+
+    @Override
+    public List<EquForkliftRepairRecordDo> getUniqueDateByAll() {
+        LambdaQueryWrapper<EquForkliftRepairRecordDo> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.select(EquForkliftRepairRecordDo::getEquipmentnumber,
+                EquForkliftRepairRecordDo::getRapairdetail,
+                EquForkliftRepairRecordDo::getRapairdate
+              ).eq(EquForkliftRepairRecordDo::getDeleted,"0");
+
+        return equForkliftRepairRecordDao.selectList(queryWrapper);
+
+    }
+
+    public void jointErrorData(List<EquForkliftRepairRecordDo> forkliftRepairRecordDoList, List<String> errorData) {
+        forkliftRepairRecordDoList.forEach(info -> {
+            errorData.add(PlantEnum.nameOf(info.getTenantid()) + ",已存在了叉车编号" + ":" + info.getEquipmentnumber()+" 维修/保养日期:" +  DateUtil.format(info.getRapairdate(),DATE_PATTERN_YMD) +" 维修/保养内容:" + info.getRapairdetail() + "的数据,不可重复导入,请检查");
+        });
+
+    }
+}

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

@@ -0,0 +1,132 @@
+package com.rongwei.bscommon.sys.service.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.rongwei.bscommon.sys.dao.EquMaintenancePredictivePlanDao;
+import com.rongwei.bscommon.sys.feign.RwAdminFeign;
+import com.rongwei.bscommon.sys.service.EquMaintenancePredictivePlanService;
+import com.rongwei.bscommon.sys.service.EquMaintenanceTaskService;
+import com.rongwei.bsentity.domain.EquMaintenancePredictivePlanDo;
+import com.rongwei.bsentity.domain.EquMaintenancePredictivePlanVo;
+import com.rongwei.bsentity.domain.EquMaintenanceTaskDo;
+import com.rongwei.bsentity.enums.PlantEnum;
+import com.rongwei.bsentity.enums.TaskStatusEnum;
+import com.rongwei.rwcommon.base.R;
+import com.rongwei.rwcommon.utils.SecurityUtil;
+import com.rongwei.rwcommonentity.commonservers.vo.SysSerialVo;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.time.*;
+import java.util.*;
+
+import static com.rongwei.safecommon.utils.SaveConstans.SysUser.DEVICESUBSYSTEMID;
+import static com.rongwei.safecommon.utils.SaveConstans.SysUser.DEVICESUBSYSTEMNAME;
+
+@Service
+public class EquMaintenancePredictivePlanServiceImpl extends ServiceImpl<EquMaintenancePredictivePlanDao, EquMaintenancePredictivePlanDo> implements EquMaintenancePredictivePlanService {
+
+    private final static Logger log = LoggerFactory.getLogger(EquMaintenancePredictivePlanServiceImpl.class);
+
+    @Autowired
+    EquMaintenancePredictivePlanService equMaintenancePredictivePlanService;
+
+    @Autowired
+    EquMaintenancePredictivePlanDao equMaintenancePredictivePlanDao;
+
+    @Autowired
+    EquMaintenanceTaskService equMaintenanceTaskService;
+
+    @Autowired
+    private RwAdminFeign rwAdminFeign;
+
+
+    @Override
+    public R generateMaintenanceTask(List<String> ids) {
+        List<EquMaintenanceTaskDo> maintenanceTaskDoList =new ArrayList<>();
+        EquMaintenanceTaskDo equMaintenanceTaskDo = null;
+
+        //1.根据选中的id 查询预测保养信息记录
+        List<EquMaintenancePredictivePlanVo> predictivePlanVos= equMaintenancePredictivePlanDao.queryDateByids(ids);
+
+        for (EquMaintenancePredictivePlanVo predictivePlanVo:predictivePlanVos){
+            equMaintenanceTaskDo =new EquMaintenanceTaskDo();
+
+            BeanUtils.copyProperties(predictivePlanVo, equMaintenanceTaskDo);
+
+            //【预测下次保养日期】 >=  当前日期,则取【预测下次保养日期】的年份,否则取  当前日期年份
+           if(predictivePlanVo.getNextmaintenancedate().getTime()>= System.currentTimeMillis()){
+               equMaintenanceTaskDo.setPlanyear(predictivePlanVo.getNextmaintenancedate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate().getYear());
+               equMaintenanceTaskDo.setMonth(predictivePlanVo.getNextmaintenancedate().toInstant().atZone(ZoneId.systemDefault()).toLocalDate().getMonthValue()+"");
+           }else {
+               equMaintenanceTaskDo.setPlanyear(LocalDate.now().getYear());
+               equMaintenanceTaskDo.setMonth(LocalDate.now().getMonthValue()+"");
+           };
+           //是否要停机
+            equMaintenanceTaskDo.setIshalt(predictivePlanVo.getIshalt());
+            //计划开始时间 计划结束时间
+            if (SetTimeToHourAM(predictivePlanVo.getNextmaintenancedate(),8).getTime()< System.currentTimeMillis()){
+                equMaintenanceTaskDo.setTaskstart(SetTimeToHourAM(new Date(),8));
+                equMaintenanceTaskDo.setTaskend(SetTimeToHourAM(new Date(),12));
+            }else {
+                equMaintenanceTaskDo.setTaskstart(SetTimeToHourAM(predictivePlanVo.getNextmaintenancedate(),8));
+                equMaintenanceTaskDo.setTaskend(SetTimeToHourAM(predictivePlanVo.getNextmaintenancedate(),12));
+            };
+            equMaintenanceTaskDo.setCreateuserid(DEVICESUBSYSTEMID);
+            equMaintenanceTaskDo.setCreateusername(DEVICESUBSYSTEMNAME);
+            equMaintenanceTaskDo.setCreatedate(new Date());
+            equMaintenanceTaskDo.setModifyuserid(DEVICESUBSYSTEMID);
+            equMaintenanceTaskDo.setModifyusername(DEVICESUBSYSTEMNAME);
+            equMaintenanceTaskDo.setModifydate(new Date());
+            equMaintenanceTaskDo.setTaskstate(TaskStatusEnum.EXPORT_DISTRIBUTION.code);
+            equMaintenanceTaskDo.setId(SecurityUtil.getUUID());
+            equMaintenanceTaskDo.setPredictivemaintenanceplanid(predictivePlanVo.getId());
+            //设置流水号
+            setTaskId(equMaintenanceTaskDo);
+            maintenanceTaskDoList.add(equMaintenanceTaskDo);
+
+        }
+        if (maintenanceTaskDoList.size()>0){
+            equMaintenanceTaskService.insertBatch(maintenanceTaskDoList);
+        }
+
+        return R.ok();
+    }
+
+    private void setTaskId(EquMaintenanceTaskDo equMaintenanceTaskDo) {
+        SysSerialVo sysSerialVo = new SysSerialVo();
+        String plantSimp = PlantEnum.addrOf(equMaintenanceTaskDo.getTenantid());
+        String plantype = equMaintenanceTaskDo.getPlantype();
+        sysSerialVo.setModulecode("equ_maintenance_task_aq_code_" + plantSimp);
+        sysSerialVo.setResetrule("date:yyyy");
+        sysSerialVo.setRuleTemplateStr(plantSimp +"-"+plantype+"-@{date:yyyyMM}-@{serialNumber:#00000}");
+        sysSerialVo.setIfautomaticreset("y");
+            R serialNumberCode = rwAdminFeign.getSerialNumberCode(sysSerialVo);
+            if ("200".equals(serialNumberCode.getCode())) {
+                Object data = serialNumberCode.getData();
+                equMaintenanceTaskDo.setTaskid(JSONObject.parseObject(JSONObject.toJSONString(data), Map.class).get("code").toString());
+            }
+
+    }
+
+
+
+    /**
+     * 设置时间时分秒 设值小时整点
+     *
+     * @param originalDate
+     * @param hour
+     * @return
+     */
+    public Date SetTimeToHourAM(Date originalDate, int hour){
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(originalDate);
+        calendar.set(Calendar.HOUR_OF_DAY, hour);
+        calendar.set(Calendar.MINUTE, 0);
+        calendar.set(Calendar.SECOND, 0);
+        return calendar.getTime();
+    }
+}

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

@@ -485,7 +485,7 @@ public class MaintenanceServiceImpl implements MaintenanceService {
                     .setEquipmentnumber(maintenanceSchedule.getEquipmentnumber())
                     .setCreatedate(newDate)
                     .setModifydate(newDate)
-                    .setPLANCLASSIFICATION(PLANCLASSIFICATION_CONVENTIONALPLAN)
+                    .setPlanclassification(PLANCLASSIFICATION_CONVENTIONALPLAN)
                     .setTenantid(maintenanceSchedule.getTenantid());
             if ("200".equals(serialNumberCode.getCode())) {
                 Object data = serialNumberCode.getData();

+ 30 - 0
cx-equipment/cx-equipment-common/src/main/resources/mybatis/business/EquMaintenancePredictivePlanDao.xml

@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.rongwei.bscommon.sys.dao.EquMaintenancePredictivePlanDao">
+
+    <select id="queryDateByids" resultType="com.rongwei.bsentity.domain.EquMaintenancePredictivePlanVo">
+        SELECT
+        a.*,
+        DATE_ADD(a.LASTMAINTENANCEDATE, INTERVAL a.FREQUENCY DAY) AS NEXTMAINTENANCEDATE,
+        b.NEXTTASKID
+        FROM
+        equ_maintenance_predictive_plan a
+        LEFT JOIN (
+        SELECT PREDICTIVEMAINTENANCEPLANID, GROUP_CONCAT(TASKID) AS NEXTTASKID
+        FROM equ_maintenance_task
+        WHERE DELETED = '0' AND TASKSTATE IN ('20', '70', '30', '15', '10')
+        GROUP BY PREDICTIVEMAINTENANCEPLANID
+        ) b ON a.ID = b.PREDICTIVEMAINTENANCEPLANID
+        <where>
+            a.DELETED ='0'
+            and  DATEDIFF(DATE_ADD(a.LASTMAINTENANCEDATE, INTERVAL a.FREQUENCY DAY), CURDATE()) &lt; 30
+            and b.NEXTTASKID is null
+            <if test="ids != null and ids.size()>0">
+                AND a.ID in
+                <foreach collection="ids" item="id" open="(" close=")" separator=",">
+                    #{id}
+                </foreach>
+            </if>
+        </where>
+    </select>
+</mapper>

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

@@ -0,0 +1,186 @@
+package com.rongwei.bsentity.domain;
+
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.NoArgsConstructor;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.util.Date;
+
+/**
+ * 叉车维修保养记录
+ * @author  cyn 
+ * @create 2024-10-22 16:44 
+ */
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@Accessors(chain = true)
+@TableName("equ_forklift_repair_record")
+public class EquForkliftRepairRecordDo {
+
+	/**
+	 * table name:ID
+	 * table type:varchar(36)
+	 * table comment:主键ID
+	 */
+	private String id;
+
+	/**
+	 * table name:TENANTID
+	 * table type:text
+	 * table comment:所属工厂
+	 */
+	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:varchar(2000)
+	 * 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:OWNEDFACTORYID
+	 * table type:varchar(36)
+	 * table comment:所属工厂ID
+	 */
+	private String ownedfactoryid;
+
+	/**
+	 * table name:OWNEDFACTORY
+	 * table type:varchar(255)
+	 * table comment:所属工厂
+	 */
+	private String ownedfactory;
+
+	/**
+	 * table name:EQUIPMENTID
+	 * table type:varchar(36)
+	 * table comment:叉车ID
+	 */
+	private String equipmentid;
+
+	/**
+	 * table name:EQUIPMENTNAME
+	 * table type:varchar(255)
+	 * table comment:叉车
+	 */
+	private String equipmentname;
+
+	/**
+	 * table name:EQUIPMENTNUMBER
+	 * table type:varchar(255)
+	 * table comment:叉车编号
+	 */
+	private String equipmentnumber;
+
+	/**
+	 * 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;
+
+	/**
+	 * table name:RAPAIRDATE
+	 * table type:datetime
+	 * table comment:维修/保养日期
+	 */
+	private Date rapairdate;
+
+	/**
+	 * table name:DJDATE
+	 * table type:datetime
+	 * table comment:登记日期
+	 */
+	private Date djdate;
+
+	/**
+	 * table name:RAPAIRID
+	 * table type:varchar(100)
+	 * table comment:维修/保养人ID
+	 */
+	private String rapairid;
+
+	/**
+	 * table name:RAPAIRNAME
+	 * table type:varchar(100)
+	 * table comment:维修/保养人
+	 */
+	private String rapairname;
+
+	/**
+	 * table name:RAPAIRDETAIL
+	 * table type:varchar(2000)
+	 * table comment:维修/保养内容
+	 */
+	private String rapairdetail;
+
+}

+ 443 - 0
cx-equipment/cx-equipment-entity/src/main/java/com/rongwei/bsentity/domain/EquMaintenancePredictivePlanDo.java

@@ -0,0 +1,443 @@
+package com.rongwei.bsentity.domain;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.NoArgsConstructor;
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.util.Date;
+
+/**
+ * @author  cyn 
+ * @create 2024-10-22 13:21 
+ */
+
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+@Accessors(chain = true)
+@TableName("equ_maintenance_predictive_plan")
+public class EquMaintenancePredictivePlanDo {
+
+	/**
+	 * table name:ID
+	 * table type:varchar(36)
+	 * table comment:主键
+	 */
+	private String id;
+
+	/**
+	 * table name:TENANTID
+	 * table type:text
+	 * table comment:null
+	 */
+	private String tenantid;
+
+	/**
+	 * table name:ROPTION
+	 * table type:longtext
+	 * table comment:扩展json格式配置
+	 */
+	private String roption;
+
+	/**
+	 * table name:DELETED
+	 * table type:char(1)
+	 * table comment:是否删除
+	 */
+	private String deleted;
+
+	/**
+	 * table name:REMARK
+	 * table type:mediumtext
+	 * 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(50)
+	 * table comment:创建人名称
+	 */
+	private String createusername;
+
+	/**
+	 * table name:MODIFYUSERNAME
+	 * table type:varchar(50)
+	 * table comment:修改人名称
+	 */
+	private String modifyusername;
+
+	/**
+	 * table name:TASKID
+	 * table type:varchar(50)
+	 * table comment:任务号
+	 */
+	private String taskid;
+
+	/**
+	 * table name:EQUIPMENTNAME
+	 * table type:varchar(50)
+	 * table comment:设备名称
+	 */
+	private String equipmentname;
+
+	/**
+	 * table name:EQUIPMENTID
+	 * table type:varchar(36)
+	 * table comment:设备ID
+	 */
+	private String equipmentid;
+
+	/**
+	 * table name:EQUIPMENTNUMBER
+	 * table type:varchar(50)
+	 * table comment:设备编号
+	 */
+	private String equipmentnumber;
+
+	/**
+	 * table name:PLANTYPE
+	 * table type:varchar(20)
+	 * table comment:任务分类
+	 */
+	private String plantype;
+
+	/**
+	 * table name:EQUIPMENTTYPE
+	 * table type:varchar(20)
+	 * table comment:设备类型
+	 */
+	private String equipmenttype;
+
+	/**
+	 * table name:PLANT
+	 * table type:varchar(35)
+	 * table comment:所属工厂
+	 */
+	private String plant;
+
+	/**
+	 * table name:SPECIALEQUIPMENT
+	 * table type:varchar(20)
+	 * table comment:特种设备
+	 */
+	private String specialequipment;
+
+	/**
+	 * table name:MAINTENANCESITE
+	 * table type:text
+	 * table comment:保养部位
+	 */
+	private String maintenancesite;
+
+	/**
+	 * table name:MAINTENANCECONTENT
+	 * table type:text
+	 * table comment:问题点/计划保养内容
+	 */
+	private String maintenancecontent;
+
+	/**
+	 * table name:STANDARDREQUEST
+	 * table type:text
+	 * table comment:预控标准要求
+	 */
+	private String standardrequest;
+
+	/**
+	 * table name:EQUIPMENTSUPPORT
+	 * table type:text
+	 * table comment:设备保障域控措施
+	 */
+	private String equipmentsupport;
+
+	/**
+	 * table name:MEANS
+	 * table type:text
+	 * table comment:保养/预防方法
+	 */
+	private String means;
+
+	/**
+	 * table name:PRINCIPALID
+	 * table type:text
+	 * table comment:责任人ID
+	 */
+	private String principalid;
+
+	/**
+	 * table name:PRINCIPAL
+	 * table type:text
+	 * table comment:责任人
+	 */
+	private String principal;
+
+	/**
+	 * table name:OTHERENGINEERS
+	 * table type:text
+	 * table comment:其他工程师
+	 */
+	private String otherengineers;
+
+	/**
+	 * table name:PERIOD
+	 * table type:varchar(20)
+	 * table comment:保养周期
+	 */
+	private String period;
+
+	/**
+	 * table name:MAINTENANCETYPE
+	 * table type:varchar(20)
+	 * table comment:保养检修分类
+	 */
+	private String maintenancetype;
+
+	/**
+	 * table name:ISOUTSOURCE
+	 * table type:varchar(10)
+	 * table comment:是否委外
+	 */
+	private String isoutsource;
+
+	/**
+	 * table name:OBJECTTYPE
+	 * table type:varchar(20)
+	 * table comment:对象分类
+	 */
+	private String objecttype;
+
+	/**
+	 * table name:SPECIFICATION
+	 * table type:varchar(50)
+	 * table comment:规格型号
+	 */
+	private String specification;
+
+	/**
+	 * table name:MAINTENANCESTANDID
+	 * table type:varchar(36)
+	 * table comment:保养标准ID
+	 */
+	private String maintenancestandid;
+
+	/**
+	 * table name:MAINTENANCESTAND
+	 * table type:varchar(50)
+	 * table comment:保养标准
+	 */
+	private String maintenancestand;
+
+	/**
+	 * table name:WORKSHOPID
+	 * table type:varchar(36)
+	 * table comment:使用车间ID
+	 */
+	private String workshopid;
+
+	/**
+	 * table name:WORKSHOP
+	 * table type:varchar(50)
+	 * table comment:使用车间
+	 */
+	private String workshop;
+
+	/**
+	 * table name:USERID
+	 * table type:text
+	 * table comment:使用人ID
+	 */
+	private String userid;
+
+	/**
+	 * table name:USER
+	 * table type:text
+	 * table comment:使用人
+	 */
+	private String user;
+
+	/**
+	 * table name:TASKSTART
+	 * table type:datetime
+	 * table comment:计划开始时间
+	 */
+	private Date taskstart;
+
+	/**
+	 * table name:TASKEND
+	 * table type:datetime
+	 * table comment:计划结束时间
+	 */
+	private Date taskend;
+
+	/**
+	 * table name:TASKSTATE
+	 * table type:varchar(20)
+	 * table comment:任务状态
+	 */
+	private String taskstate;
+
+	/**
+	 * table name:MAINTENANCESTATUS
+	 * table type:text
+	 * table comment:保养情况
+	 */
+	private String maintenancestatus;
+
+	/**
+	 * table name:PERFORMANCE
+	 * table type:text
+	 * table comment:完成情况
+	 */
+	private String performance;
+
+	/**
+	 * table name:OTHERENGINEERSID
+	 * table type:text
+	 * table comment:其他工程师ID
+	 */
+	private String otherengineersid;
+
+	/**
+	 * table name:TASKSTARTTIME
+	 * table type:datetime
+	 * table comment:保养开始时间
+	 */
+	private Date taskstarttime;
+
+	/**
+	 * table name:TASKENDTIME
+	 * table type:datetime
+	 * table comment:保养完成时间
+	 */
+	private Date taskendtime;
+
+	/**
+	 * table name:PREVIOUSSITUATION
+	 * table type:text
+	 * table comment:保养前情况
+	 */
+	private String previoussituation;
+
+	/**
+	 * table name:ACCEPTOR
+	 * table type:text
+	 * table comment:验收人
+	 */
+	private String acceptor;
+
+	/**
+	 * table name:ACCEPTORID
+	 * table type:text
+	 * table comment:验收人ID
+	 */
+	private String acceptorid;
+
+	/**
+	 * table name:RESULTCHART
+	 * table type:text
+	 * table comment:保养结果图
+	 */
+	private String resultchart;
+
+	/**
+	 * table name:CONFIRMRESULT
+	 * table type:varchar(20)
+	 * table comment:确认结果
+	 */
+	private String confirmresult;
+
+	/**
+	 * table name:AFFIRMSTATE
+	 * table type:text
+	 * table comment:确认说明
+	 */
+	private String affirmstate;
+
+	/**
+	 * table name:ACCEPTANCETIME
+	 * table type:datetime
+	 * table comment:确认验收时间
+	 */
+	private Date acceptancetime;
+
+	/**
+	 * table name:RETURNMARK
+	 * table type:varchar(255)
+	 * table comment:返工标记
+	 */
+	private String returnmark;
+
+	/**
+	 * table name:ISHALT
+	 * table type:varchar(36)
+	 * table comment:是否要停机
+	 */
+	private String ishalt;
+
+	/**
+	 * table name:YGHFGS
+	 * table type:varchar(36)
+	 * table comment:预估花费工时
+	 */
+	private String yghfgs;
+
+	/**
+	 * table name:PLANCLASSIFICATION
+	 * table type:varchar(36)
+	 * table comment:计划分类
+	 */
+	private String planclassification;
+
+	/**
+	 * table name:LASTMAINTENANCEDATE
+	 * table type:datetime
+	 * table comment:最近保养日期
+	 */
+	private Date lastmaintenancedate;
+
+	/**
+	 * table name:FREQUENCY
+	 * table type:int
+	 * table comment:频次
+	 */
+	private Integer frequency;
+
+	/**
+	 * table name:ISOUTOFSERVICE
+	 * table type:varchar(36)
+	 * table comment:是否停用
+	 */
+	private String isoutofservice;
+
+}

+ 20 - 0
cx-equipment/cx-equipment-entity/src/main/java/com/rongwei/bsentity/domain/EquMaintenancePredictivePlanVo.java

@@ -0,0 +1,20 @@
+package com.rongwei.bsentity.domain;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+@Data
+public class EquMaintenancePredictivePlanVo  extends EquMaintenancePredictivePlanDo implements Serializable {
+
+    /**
+     * 下次保养日期
+     */
+    private Date nextmaintenancedate;
+
+    /**
+     * 下次任务编号
+     */
+    private String nexttaskid;
+}

+ 12 - 1
cx-equipment/cx-equipment-entity/src/main/java/com/rongwei/bsentity/domain/EquMaintenanceTaskDo.java

@@ -418,6 +418,17 @@ public class EquMaintenanceTaskDo implements Serializable {
 	/**
 	 * 计划分类
 	 */
-	private String PLANCLASSIFICATION;
+	private String planclassification;
+
+	/**
+	 * 预测性保养计划ID
+	 */
+	private String predictivemaintenanceplanid;
+
+	/**
+	 * 是否要停机
+	 */
+	private String ishalt;
+
 
 }

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

@@ -0,0 +1,37 @@
+package com.rongwei.bsserver.sys.controller;
+
+import com.rongwei.bscommon.sys.service.EquForkliftRepairRecordService;
+import com.rongwei.bscommon.sys.service.MaintenanceService;
+import com.rongwei.bscommon.sys.utils.ExceptionUtils;
+import com.rongwei.rwcommon.base.R;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
+
+@RestController
+@RequestMapping("/equForkliftRepairRecord")
+public class EquForkliftRepairRecordController {
+
+    private final static Logger log = LoggerFactory.getLogger(EquForkliftRepairRecordController.class);
+
+    @Autowired
+    private EquForkliftRepairRecordService equForkliftRepairRecordService;
+
+
+    @PostMapping("/uploadimportForkliftRepairRecordSave")
+    public R uploadimportForkliftRepairRecordSave(@RequestParam("file") MultipartFile multipartFile){
+        try {
+            log.info("进入接口:/equForkliftRepairRecord/importStandardSave,入参:{}", multipartFile);
+            return equForkliftRepairRecordService.equForkliftRepairRecordService(multipartFile);
+            // return null;
+        }catch (Exception e){
+            ExceptionUtils.printExceptionDetail(e,"导入失败,请检查后再导入:");
+            return R.error(e.getMessage());
+        }
+    }
+}

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

@@ -0,0 +1,79 @@
+package com.rongwei.bsserver.sys.controller;
+
+
+import com.rongwei.bscommon.sys.service.EquBomService;
+import com.rongwei.bscommon.sys.service.EquMaintenancePredictivePlanService;
+import com.rongwei.bscommon.sys.utils.ExceptionUtils;
+import com.rongwei.bsentity.dto.EquBomCopyDto;
+import com.rongwei.rwcommon.base.R;
+import lombok.Data;
+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.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+import java.util.Map;
+
+
+/**
+ * <p>
+ * 设备子系统—— 预测性保养计划
+ * </p>
+ *
+ * @author hp
+ * @since  2024-10-22
+ */
+@RestController
+@RequestMapping("/equMaintenancePredictivePlan")
+public class EquMaintenancePredictivePlanController {
+
+    private static final Logger logger = LoggerFactory.getLogger(EquMaintenancePredictivePlanController.class);
+
+    @Autowired
+    private EquMaintenancePredictivePlanService equMaintenancePredictivePlanService;
+
+
+    /**
+     * 生成保养任务记录
+     * @param ids
+     * @return
+     */
+    @PostMapping("/generateMaintenanceTask")
+    public R updateInventoryReminderStatus(@RequestBody List<String> ids){
+        try {
+            logger.info("预测性保养计划开始生成保养任务记录");
+            R r = equMaintenancePredictivePlanService.generateMaintenanceTask(ids);
+            logger.info("预测性保养计划结束生成保养任务记录");
+            return r;
+        } catch (Exception e) {
+            logger.error("预测性保养计划生成保养任务记录失败:{}"+e.getMessage());
+        }
+        return R.ok();
+    }
+
+
+    /**
+     * 每天早上5点
+     * @return
+     */
+    @Scheduled(cron = "0 0 5 1/1 * ? ")
+   // @Scheduled(cron = "0/15 * * * * ? ")
+    public R updateInventoryReminderStatusCron(){
+        try {
+            logger.info("开始执行定时任务 测性保养计划开始生成保养任务");
+            R r = equMaintenancePredictivePlanService.generateMaintenanceTask(null);
+            return r;
+        } catch (Exception e) {
+            logger.error("预测性保养计划生成保养任务记录失败:{}"+e.getMessage());
+        }
+        return R.ok();
+    }
+
+
+}
+