From 5706372636fb594320db25d2e2aab8b94e3ef294 Mon Sep 17 00:00:00 2001
From: “linengliang” <vanSuperEnergy@163.com>
Date: 星期四, 14 九月 2023 18:11:15 +0800
Subject: [PATCH] 预测性维护工单

---
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/PredictiveWorkOrderMapper.java                    |    8 +
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IPredictiveWorkOrderService.java                 |    9 
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/PredictiveWorkPlanWarnHistory.java                |    6 +
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/PredictiveWorkOrderMapper.xml                 |   11 +
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/PredictiveWorkPlanWarnServiceImpl.java      |   15 +-
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/PredictiveWorkOrder.java                          |    3 
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/PredictiveWorkOrderController.java            |  173 ++++++++++++++++------------
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/PredictiveWorkPlanParameterHistory.java           |    6 +
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/PredictiveWorkOrderServiceImpl.java         |   20 +-
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/PredictiveWorkPlanParameterController.java    |   25 ++++
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/PredictiveWorkPlanWarnController.java         |   25 ++++
 lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/PredictiveWorkPlanParameterServiceImpl.java |   16 ++
 12 files changed, 217 insertions(+), 100 deletions(-)

diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/PredictiveWorkOrderController.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/PredictiveWorkOrderController.java
index dae24cf..0e81472 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/PredictiveWorkOrderController.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/PredictiveWorkOrderController.java
@@ -2,6 +2,8 @@
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -12,14 +14,13 @@
 import org.jeecg.common.system.base.controller.JeecgController;
 import org.jeecg.common.system.query.QueryGenerator;
 import org.jeecg.common.system.vo.LoginUser;
-import org.jeecg.modules.eam.entity.Equipment;
-import org.jeecg.modules.eam.entity.MaintenanceOrderActualWorkingHour;
-import org.jeecg.modules.eam.entity.PredictiveWorkOrder;
-import org.jeecg.modules.eam.entity.SpecialtyMaintenanceOrder;
+import org.jeecg.modules.eam.entity.*;
+import org.jeecg.modules.eam.service.IMaintenanceOrderActualMaterialService;
 import org.jeecg.modules.eam.service.IMaintenanceOrderActualWorkingHourService;
 import org.jeecg.modules.eam.service.IPredictiveWorkOrderService;
 import org.jeecg.modules.eam.service.ISpecialtyMaintenanceOrderService;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.servlet.ModelAndView;
 
@@ -28,6 +29,7 @@
 import java.math.BigDecimal;
 import java.util.Arrays;
 import java.util.Date;
+import java.util.List;
 import java.util.Map;
 
 @RestController
@@ -40,6 +42,9 @@
 
     @Autowired
     private IMaintenanceOrderActualWorkingHourService maintenanceOrderActualWorkingHourService;
+
+    @Autowired
+    private IMaintenanceOrderActualMaterialService maintenanceOrderActualMaterialService;
 
     /**
      * 鍒嗛〉鍒楄〃鏌ヨ
@@ -77,12 +82,12 @@
         return Result.ok(specialtyMaintenanceOrderList);
     }
 
-    /**
-     * 娣诲姞
-     *
-     * @param specialtyMaintenanceOrder
-     * @return
-     */
+//    /**
+//     * 娣诲姞
+//     *
+//     * @param specialtyMaintenanceOrder
+//     * @return
+//     */
 //    @AutoLog(value = "mom_eam_specialty_maintenance_order-娣诲姞")
 //    @ApiOperation(value = "mom_eam_specialty_maintenance_order-娣诲姞", notes = "mom_eam_specialty_maintenance_order-娣诲姞")
 //    //@RequiresPermissions("org.jeecg.modules:mom_eam_specialty_maintenance_order:add")
@@ -114,60 +119,82 @@
 //    }
 //
 //
-//    @RequestMapping(value = "/editStatus", method = {RequestMethod.PUT, RequestMethod.POST})
-//    public Result<String> editStatus(@RequestBody SpecialtyMaintenanceOrder specialtyMaintenanceOrder) {
-//        specialtyMaintenanceOrder.setActualStartTime(new Date());
-//        boolean b = specialtyMaintenanceOrderService.updateById(specialtyMaintenanceOrder);
-//        if (b) {
-//            return Result.OK("涓嬪彂鎴愬姛!");
-//        } else {
-//            return Result.error("涓嬪彂澶辫触!");
-//        }
-//    }
-//
-//    @RequestMapping(value = "/report", method = {RequestMethod.PUT, RequestMethod.POST})
-//    public Result<String> report(@RequestBody SpecialtyMaintenanceOrder specialtyMaintenanceOrder) {
-//        specialtyMaintenanceOrder.setActualEndTime(new Date());
-//        boolean b = specialtyMaintenanceOrderService.updateById(specialtyMaintenanceOrder);
-//        if (!b) {
-//            return Result.error("鎶ュ伐澶辫触!");
-//        } else {
-//            return Result.ok("鎶ュ伐鎴愬姛!");
-//        }
-//    }
-//
-//    @RequestMapping(value = "/revocation", method = {RequestMethod.PUT, RequestMethod.POST})
-//    public Result<String> revocation(@RequestBody SpecialtyMaintenanceOrder specialtyMaintenanceOrder) {
-//        String id = specialtyMaintenanceOrder.getId();
-//        SpecialtyMaintenanceOrder maintenanceOrder = specialtyMaintenanceOrderService.getById(id);
-//        String status = maintenanceOrder.getStatus();
-//        if ("5".equals(status)) {
-//            maintenanceOrder.setActualEndTime(null);
-//            boolean b = specialtyMaintenanceOrderService.updateById(specialtyMaintenanceOrder);
-//            if (b) {
-//                return Result.OK("鎾ら攢鎴愬姛!");
-//            } else {
-//                return Result.error("鎾ら攢澶辫触!");
-//            }
-//        } else {
-//            return Result.error("浠呴檺宸插畬宸ョ姸鎬佹挙閿�瀹屾垚鎿嶄綔!");
-//        }
-//    }
-//
-//    @RequestMapping(value = "/orderGet", method = {RequestMethod.PUT, RequestMethod.POST})
-//    public Result<String> orderGet(@RequestBody SpecialtyMaintenanceOrder specialtyMaintenanceOrder) {
-//        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
-//        String userId = sysUser.getId();
-//        specialtyMaintenanceOrder.setRecipientUserId(userId);
-//        specialtyMaintenanceOrder.setMaintenanceUserId(userId);
-//        specialtyMaintenanceOrder.setStatus("3");
-//        boolean b = specialtyMaintenanceOrderService.updateById(specialtyMaintenanceOrder);
-//        if (b) {
-//            return Result.OK("棰嗗彇鎴愬姛!");
-//        } else {
-//            return Result.error("棰嗗彇澶辫触!");
-//        }
-//    }
+    @RequestMapping(value = "/editStatus", method = {RequestMethod.PUT, RequestMethod.POST})
+    public Result<String> editStatus(@RequestBody PredictiveWorkOrder predictiveWorkOrder) {
+        predictiveWorkOrder.setActualStartTime(new Date());
+        boolean b = predictiveWorkOrderService.updateById(predictiveWorkOrder);
+        if (b) {
+            return Result.OK("鎿嶄綔鎴愬姛!");
+        } else {
+            return Result.error("鎿嶄綔澶辫触!");
+        }
+    }
+
+    @RequestMapping(value = "/report", method = {RequestMethod.PUT, RequestMethod.POST})
+    @Transactional(rollbackFor = {Exception.class})
+    public Result<String> report(@RequestBody PredictiveWorkOrder predictiveWorkOrder) {
+        List<MaintenanceOrderActualMaterial> actualMaterialList = maintenanceOrderActualMaterialService
+                .list(new QueryWrapper<MaintenanceOrderActualMaterial>()
+                        .eq("maintenance_order_id",predictiveWorkOrder.getId())
+                        .eq("del_flag",0));
+        for(MaintenanceOrderActualMaterial maintenanceOrderActualMaterial:actualMaterialList){
+            if(maintenanceOrderActualMaterial.getIsLock().equals("no")){
+                throw new RuntimeException("  銆愬疄闄呯墿鏂欍�戝皻鏈攣鏂欙紝璇峰厛閿佹枡");
+            }
+        }
+        List<MaintenanceOrderActualWorkingHour> actualWorkingHours = maintenanceOrderActualWorkingHourService
+                .list(new QueryWrapper<MaintenanceOrderActualWorkingHour>()
+                .eq("maintenance_order_id",predictiveWorkOrder.getId())
+                .eq("del_flag",0));
+        for(MaintenanceOrderActualWorkingHour actualWorkingHour:actualWorkingHours){
+            if(ObjectUtils.isNull(actualWorkingHour.getActualWorkingHourQuota())){
+                throw new RuntimeException("銆愬疄闄呭伐鏃躲�戝瓨鍦ㄦ湭濉啓鐨勫伐鏃�,璇峰厛濉啓");
+            }
+            if(StringUtils.isBlank(actualWorkingHour.getUserId())){
+                throw new RuntimeException("銆愬疄闄呭伐鏃躲�戝瓨鍦ㄦ湭濉啓鐨勪汉鍛�,璇峰厛濉啓");
+            }
+        }
+        predictiveWorkOrder.setActualEndTime(new Date());
+        boolean b = predictiveWorkOrderService.updateById(predictiveWorkOrder);
+        if (!b) {
+            return Result.error("鎶ュ伐澶辫触!");
+        } else {
+            return Result.ok("鎶ュ伐鎴愬姛!");
+        }
+    }
+
+    @RequestMapping(value = "/revocation", method = {RequestMethod.PUT, RequestMethod.POST})
+    public Result<String> revocation(@RequestBody PredictiveWorkOrder predictiveWorkOrder) {
+        String id = predictiveWorkOrder.getId();
+        PredictiveWorkOrder predictiveWorkOrder1 = predictiveWorkOrderService.getById(id);
+        String status = predictiveWorkOrder1.getStatus();
+        if ("5".equals(status)) {
+            predictiveWorkOrder1.setActualEndTime(null);
+            boolean b = predictiveWorkOrderService.updateById(predictiveWorkOrder);
+            if (b) {
+                return Result.OK("鎾ら攢鎴愬姛!");
+            } else {
+                return Result.error("鎾ら攢澶辫触!");
+            }
+        } else {
+            return Result.error("浠呴檺宸插畬宸ョ姸鎬佽繘琛屾挙閿�鎿嶄綔!");
+        }
+    }
+
+    @RequestMapping(value = "/orderGet", method = {RequestMethod.PUT, RequestMethod.POST})
+    public Result<String> orderGet(@RequestBody PredictiveWorkOrder predictiveWorkOrder) {
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        String userId = sysUser.getId();
+        predictiveWorkOrder.setRecipientUserId(userId);
+        predictiveWorkOrder.setMaintenanceUserId(userId);
+        predictiveWorkOrder.setStatus("3");
+        boolean b = predictiveWorkOrderService.updateById(predictiveWorkOrder);
+        if (b) {
+            return Result.OK("棰嗗彇鎴愬姛!");
+        } else {
+            return Result.error("棰嗗彇澶辫触!");
+        }
+    }
 //
 //    /**
 //     * 閫氳繃id鍒犻櫎
@@ -241,15 +268,15 @@
 //        return super.importExcel(request, response, SpecialtyMaintenanceOrder.class);
 //    }
 //
-//    @RequestMapping(value = "/assign", method = {RequestMethod.PUT, RequestMethod.POST})
-//    public Result<String> assign(@RequestBody SpecialtyMaintenanceOrder specialtyMaintenanceOrder) {
-//        boolean b = specialtyMaintenanceOrderService.assign(specialtyMaintenanceOrder);
-//        if (b) {
-//            return Result.OK("鏀规淳鎴愬姛!");
-//        } else {
-//            return Result.error("鏀规淳澶辫触!");
-//        }
-//    }
+    @RequestMapping(value = "/assign", method = {RequestMethod.PUT, RequestMethod.POST})
+    public Result<String> assign(@RequestBody PredictiveWorkOrder predictiveWorkOrder) {
+        boolean b = predictiveWorkOrderService.assign(predictiveWorkOrder);
+        if (b) {
+            return Result.OK("鏀规淳鎴愬姛!");
+        } else {
+            return Result.error("鏀规淳澶辫触!");
+        }
+    }
 
 
 }
diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/PredictiveWorkPlanParameterController.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/PredictiveWorkPlanParameterController.java
index 69ecd0c..6f56d13 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/PredictiveWorkPlanParameterController.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/PredictiveWorkPlanParameterController.java
@@ -1,16 +1,23 @@
 package org.jeecg.modules.eam.controller;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.system.base.controller.JeecgController;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.modules.eam.entity.Equipment;
 import org.jeecg.modules.eam.entity.PredictiveWorkPlanParameter;
+import org.jeecg.modules.eam.entity.PredictiveWorkPlanParameterHistory;
 import org.jeecg.modules.eam.entity.PredictiveWorkPlanSparePart;
+import org.jeecg.modules.eam.service.IPredictiveWorkPlanParameterHistoryService;
 import org.jeecg.modules.eam.service.IPredictiveWorkPlanParameterService;
 import org.jeecg.modules.eam.service.IPredictiveWorkPlanSparePartService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import javax.servlet.http.HttpServletRequest;
 import java.util.List;
 import java.util.Map;
 
@@ -21,6 +28,8 @@
 
     @Autowired
     private IPredictiveWorkPlanParameterService predictiveWorkPlanParameterService;
+    @Autowired
+    private IPredictiveWorkPlanParameterHistoryService predictiveWorkPlanParameterHistoryService;
 
     /**
      * 鍙傛暟鍒楄〃
@@ -67,4 +76,20 @@
         return Result.OK("鍒犻櫎鎴愬姛!");
     }
 
+    /**
+     * 璁惧淇濅慨  鑾峰彇璁惧鍒楄〃缁勪欢
+     * qsw 2023-7-14
+     */
+    @GetMapping(value = "/getHistoryPage")
+    public Result<IPage<PredictiveWorkPlanParameterHistory>> getHistory(PredictiveWorkPlanParameterHistory predictiveWorkPlanParameterHistory,
+                                               @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+                                               @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+                                               HttpServletRequest req) {
+        QueryWrapper<PredictiveWorkPlanParameterHistory> queryWrapper = QueryGenerator.initQueryWrapper(predictiveWorkPlanParameterHistory, req.getParameterMap());
+        Page<PredictiveWorkPlanParameterHistory> page = new Page<PredictiveWorkPlanParameterHistory>(pageNo, pageSize);
+        IPage<PredictiveWorkPlanParameterHistory> pageList = predictiveWorkPlanParameterHistoryService.page(page, queryWrapper);
+        return Result.OK(pageList);
+    }
+
+
 }
diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/PredictiveWorkPlanWarnController.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/PredictiveWorkPlanWarnController.java
index e4a18d4..ae762f3 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/PredictiveWorkPlanWarnController.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/controller/PredictiveWorkPlanWarnController.java
@@ -1,14 +1,21 @@
 package org.jeecg.modules.eam.controller;
 
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import lombok.extern.slf4j.Slf4j;
 import org.jeecg.common.api.vo.Result;
 import org.jeecg.common.system.base.controller.JeecgController;
+import org.jeecg.common.system.query.QueryGenerator;
+import org.jeecg.modules.eam.entity.PredictiveWorkPlanParameterHistory;
 import org.jeecg.modules.eam.entity.PredictiveWorkPlanWarn;
+import org.jeecg.modules.eam.entity.PredictiveWorkPlanWarnHistory;
+import org.jeecg.modules.eam.service.IPredictiveWorkPlanWarnHistoryService;
 import org.jeecg.modules.eam.service.IPredictiveWorkPlanWarnService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import javax.servlet.http.HttpServletRequest;
 import java.util.List;
 import java.util.Map;
 
@@ -19,6 +26,8 @@
 
     @Autowired
     private IPredictiveWorkPlanWarnService predictiveWorkPlanWarnService;
+    @Autowired
+    private IPredictiveWorkPlanWarnHistoryService predictiveWorkPlanWarnHistoryService;
 
     /**
      * 鎶ヨ鍒楄〃
@@ -63,4 +72,20 @@
         return Result.OK("鍒犻櫎鎴愬姛!");
     }
 
+    /**
+     * 璁惧淇濅慨  鑾峰彇璁惧鍒楄〃缁勪欢
+     * qsw 2023-7-14
+     */
+    @GetMapping(value = "/getHistoryPage")
+    public Result<IPage<PredictiveWorkPlanWarnHistory>> getHistory(PredictiveWorkPlanWarnHistory predictiveWorkPlanWarnHistory,
+                                                                   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
+                                                                   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
+                                                                   HttpServletRequest req) {
+        QueryWrapper<PredictiveWorkPlanWarnHistory> queryWrapper = QueryGenerator.initQueryWrapper(predictiveWorkPlanWarnHistory, req.getParameterMap());
+        Page<PredictiveWorkPlanWarnHistory> page = new Page<PredictiveWorkPlanWarnHistory>(pageNo, pageSize);
+        IPage<PredictiveWorkPlanWarnHistory> pageList = predictiveWorkPlanWarnHistoryService.page(page, queryWrapper);
+        return Result.OK(pageList);
+    }
+
+
 }
diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/PredictiveWorkOrder.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/PredictiveWorkOrder.java
index 6ccab40..110be70 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/PredictiveWorkOrder.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/PredictiveWorkOrder.java
@@ -79,6 +79,7 @@
      */
     @Excel(name = "棰嗗彇浜篿d", width = 15)
     @ApiModelProperty(value = "棰嗗彇浜篿d")
+    @Dict(dicCode = "id",dictTable = "sys_user",dicText = "realname")
     private String recipientUserId;
 
     /**
@@ -94,7 +95,7 @@
     @Excel(name = "鐘舵��", width = 15)
     @ApiModelProperty(value = "鐘舵��")
     @Dict(dicCode = "maintenance_order_status")
-    private String status = CommonConstant.STATUS_1;
+    private String status;
     /**
      * 澶囩敤瀛楁1
      */
diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/PredictiveWorkPlanParameterHistory.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/PredictiveWorkPlanParameterHistory.java
index fc8544d..c1b3fe6 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/PredictiveWorkPlanParameterHistory.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/PredictiveWorkPlanParameterHistory.java
@@ -6,6 +6,7 @@
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
+import org.jeecg.common.aspect.annotation.Dict;
 import org.jeecg.common.constant.CommonConstant;
 import org.jeecg.common.system.base.entity.JeecgEntity;
 import org.jeecgframework.poi.excel.annotation.Excel;
@@ -22,6 +23,8 @@
     @Excel(name = "缁存姢鏂规ID", width = 15)
     @ApiModelProperty(value = "缁存姢鏂规ID")
     private String workPlanId;
+
+    private String workOrderId;
 
     @Excel(name = "鍙傛暟ID", width = 30)
     @ApiModelProperty(value = "鍙傛暟ID")
@@ -47,8 +50,11 @@
     @ApiModelProperty(value = "瀹為檯鍊�")
     private float actualValue;
 
+    private String parameterUnit;
+
     @Excel(name = "鏉′欢", width = 15)
     @ApiModelProperty(value = "鏉′欢")
+    @Dict(dicCode = "conditional_relation")
     private String parameterCondition;
 
     @Excel(name = "鐩戞祴鏃堕棿", width = 15)
diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/PredictiveWorkPlanWarnHistory.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/PredictiveWorkPlanWarnHistory.java
index 10c92d6..8a6f72e 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/PredictiveWorkPlanWarnHistory.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/entity/PredictiveWorkPlanWarnHistory.java
@@ -6,6 +6,7 @@
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
+import org.jeecg.common.aspect.annotation.Dict;
 import org.jeecg.common.constant.CommonConstant;
 import org.jeecg.common.system.base.entity.JeecgEntity;
 import org.jeecgframework.poi.excel.annotation.Excel;
@@ -23,8 +24,13 @@
     @ApiModelProperty(value = "缁存姢鏂规ID")
     private String workPlanId;
 
+    @Excel(name = "缁存姢宸ュ崟ID", width = 15)
+    @ApiModelProperty(value = "缁存姢宸ュ崟ID")
+    private String workOrderId;
+
     @Excel(name = "鏉′欢", width = 15)
     @ApiModelProperty(value = "鏉′欢")
+    @Dict(dicCode = "conditional_relation")
     private String parameterCondition;
 
 	@Excel(name = "鎶ヨID", width = 30)
diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/PredictiveWorkOrderMapper.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/PredictiveWorkOrderMapper.java
index 32cf850..8de031f 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/PredictiveWorkOrderMapper.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/PredictiveWorkOrderMapper.java
@@ -12,7 +12,13 @@
 
 public interface PredictiveWorkOrderMapper extends BaseMapper<PredictiveWorkOrder> {
 
-    public List<PredictiveWorkOrder> pageList(IPage<PredictiveWorkOrder> pageData,@Param("num")String num);
+    public List<PredictiveWorkOrder> pageList(IPage<PredictiveWorkOrder> pageData
+                                              ,@Param("num")String num
+                                              ,@Param("status") String status
+                                              ,@Param("equipmentNum") String equipmentNum
+                                              ,@Param("equipmentName") String equipmentName
+
+    );
 
     @Select("<script> select dbo.F_GET_SEQ_ID('${predictiveWorkOrder}') </script>")
     public String getOrderNum(@Param("predictiveWorkOrder")String predictiveWorkOrder);
diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/PredictiveWorkOrderMapper.xml b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/PredictiveWorkOrderMapper.xml
index 30bc644..cc1c583 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/PredictiveWorkOrderMapper.xml
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/mapper/xml/PredictiveWorkOrderMapper.xml
@@ -58,12 +58,14 @@
         t1.create_by createBy,
         t1.create_time createTime,
         t1.maintenance_user_id maintenanceUserId,
+        t1.recipient_user_id recipientUserId,
         t2.monitor_type monitorType,
         t2.num planNum,
         t2.id workPlanId,
         t2.team_id teamId,
         t2.plan_version version,
         t2.assign_mode assignMode,
+        t3.id equipmentId,
         t3.num equipmentNum,
         t3.name equipmentName,
         t3.model model,
@@ -89,5 +91,14 @@
         <if test="num != null and num != ''">
             and t1.num like concat('%',#{num},'%')
         </if>
+        <if test="status != null and status != ''">
+            and t1.status = #{status}
+        </if>
+        <if test="equipmentNum != null and equipmentNum != ''">
+            and t3.num like concat('%',#{equipmentNum},'%')
+        </if>
+        <if test="equipmentName != null and equipmentName != ''">
+            and t3.name like concat('%',#{equipmentName},'%')
+        </if>
     </select>
 </mapper>
diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IPredictiveWorkOrderService.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IPredictiveWorkOrderService.java
index d887453..3d3453c 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IPredictiveWorkOrderService.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/IPredictiveWorkOrderService.java
@@ -4,6 +4,7 @@
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.IService;
 import org.jeecg.modules.eam.entity.PredictiveWorkOrder;
+import org.jeecg.modules.eam.entity.SpecialtyMaintenanceOrder;
 
 import java.util.Map;
 
@@ -21,10 +22,10 @@
 //     */
 //    boolean edit(SpecialtyMaintenanceOrder specialtyMaintenanceOrder);
 
-//    /**
-//     *鏀规淳 涓撲笟淇濆伐鍗�
-//     */
-//    boolean assign(SpecialtyMaintenanceOrder specialtyMaintenanceOrder);
+    /**
+     *鏀规淳 棰勬祴鎬х淮鎶ゅ伐鍗�
+     */
+    boolean assign(PredictiveWorkOrder predictiveWorkOrder);
 
 
 }
diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/PredictiveWorkOrderServiceImpl.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/PredictiveWorkOrderServiceImpl.java
index 3df998e..a6fcbbe 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/PredictiveWorkOrderServiceImpl.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/PredictiveWorkOrderServiceImpl.java
@@ -24,7 +24,7 @@
 
     @Override
     public IPage<PredictiveWorkOrder> pageOrderList(Page<PredictiveWorkOrder> page, PredictiveWorkOrder predictiveWorkOrder) {
-        return page.setRecords(baseMapper.pageList(page,predictiveWorkOrder.getNum()));
+        return page.setRecords(baseMapper.pageList(page,predictiveWorkOrder.getNum(),predictiveWorkOrder.getStatus(),predictiveWorkOrder.getEquipmentNum(),predictiveWorkOrder.getEquipmentName()));
     }
 
 //    @Autowired
@@ -157,14 +157,14 @@
 //        return true;
 //    }
 
-//    @Override
-//    public boolean assign(SpecialtyMaintenanceOrder specialtyMaintenanceOrder) {
-//       specialtyMaintenanceOrder.setStatus("3");
-//        boolean b1 = super.updateById(specialtyMaintenanceOrder);
-//        if(!b1){
-//            return false;
-//        }
-//        return true;
-//    }
+    @Override
+    public boolean assign(PredictiveWorkOrder predictiveWorkOrder) {
+       predictiveWorkOrder.setStatus("3");
+        boolean b1 = super.updateById(predictiveWorkOrder);
+        if(!b1){
+            return false;
+        }
+        return true;
+    }
 
 }
diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/PredictiveWorkPlanParameterServiceImpl.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/PredictiveWorkPlanParameterServiceImpl.java
index 1863614..0ed5a3a 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/PredictiveWorkPlanParameterServiceImpl.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/PredictiveWorkPlanParameterServiceImpl.java
@@ -79,8 +79,11 @@
             }
             if (needCreateFlag) {
                 //鐢熸垚宸ュ崟 ,灏嗗弬鏁颁俊鎭浠�
-                this.createOrder(predictiveWorkPlan.getId(), predictiveWorkPlan.getEquipmentId());
-                this.backInfo(predictiveWorkPlan.getId(), predictiveWorkPlanParameterList);
+                PredictiveWorkOrder predictiveWorkOrder = this.createOrder(predictiveWorkPlan.getId(), predictiveWorkPlan.getEquipmentId());
+                if(predictiveWorkOrder != null){
+                    this.backInfo(predictiveWorkPlan.getId(), predictiveWorkOrder.getId(),predictiveWorkPlanParameterList);
+                }
+
             }
         }
     }
@@ -104,18 +107,23 @@
         this.saveBatch(insertList);
     }
 
-    private void createOrder(String workPlanId, String equipmentId) {
+    private PredictiveWorkOrder createOrder(String workPlanId, String equipmentId) {
         PredictiveWorkOrder predictiveWorkOrder = new PredictiveWorkOrder();
         predictiveWorkOrder.setWorkPlanId(workPlanId);
         predictiveWorkOrder.setEquipmentId(equipmentId);
+        //TODO 寰呴獙璇�
         predictiveWorkOrderService.add(predictiveWorkOrder);
+        return predictiveWorkOrder;
     }
 
-    private void backInfo(String workPlanId, List<PredictiveWorkPlanParameter> predictiveWorkPlanParameterList) {
+    private void backInfo(String workPlanId,String workOrderId, List<PredictiveWorkPlanParameter> predictiveWorkPlanParameterList) {
         List<PredictiveWorkPlanParameterHistory> list = new ArrayList<>();
         for (PredictiveWorkPlanParameter predictiveWorkPlanParameter : predictiveWorkPlanParameterList) {
             PredictiveWorkPlanParameterHistory predictiveWorkPlanParameterHistory = new PredictiveWorkPlanParameterHistory();
             predictiveWorkPlanParameterHistory.setWorkPlanId(workPlanId);
+            //TODO 鍔犲睘鎬orkOrderId
+            predictiveWorkPlanParameterHistory.setWorkOrderId(workOrderId);
+            predictiveWorkPlanParameterHistory.setParameterUnit(predictiveWorkPlanParameter.getParameterUnit());
             predictiveWorkPlanParameterHistory.setParameterId(predictiveWorkPlanParameter.getParameterId());
             predictiveWorkPlanParameterHistory.setParameterCode(predictiveWorkPlanParameter.getParameterCode());
             predictiveWorkPlanParameterHistory.setParameterName(predictiveWorkPlanParameter.getParameterName());
diff --git a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/PredictiveWorkPlanWarnServiceImpl.java b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/PredictiveWorkPlanWarnServiceImpl.java
index 0a56743..392c020 100644
--- a/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/PredictiveWorkPlanWarnServiceImpl.java
+++ b/lxzn-module-eam/src/main/java/org/jeecg/modules/eam/service/impl/PredictiveWorkPlanWarnServiceImpl.java
@@ -74,9 +74,9 @@
             }
             if (needWarnFlag) {
                 //鍒ゆ柇鏄惁鐢熸垚宸ュ崟 ,灏嗘姤璀︿俊鎭浠�
-                boolean flag = this.createOrder(predictiveWorkPlan.getId(), predictiveWorkPlan.getEquipmentId());
-                if (flag) {
-                    this.backInfo(predictiveWorkPlan.getId(), insertList);
+                PredictiveWorkOrder predictiveWorkOrder = this.createOrder(predictiveWorkPlan.getId(), predictiveWorkPlan.getEquipmentId());
+                if (predictiveWorkOrder != null) {
+                    this.backInfo(predictiveWorkPlan.getId(), predictiveWorkOrder.getId(),insertList);
                 }
             }
         }
@@ -101,11 +101,12 @@
         this.saveBatch(insertList);
     }
 
-    private void backInfo(String workPlanId, List<MdcEquipmentAlarmVo> predictiveWorkPlanWarnList) {
+    private void backInfo(String workPlanId, String workOrderId,List<MdcEquipmentAlarmVo> predictiveWorkPlanWarnList) {
         List<PredictiveWorkPlanWarnHistory> list = new ArrayList<>();
         for (MdcEquipmentAlarmVo mdcEquipmentAlarmVo : predictiveWorkPlanWarnList) {
             PredictiveWorkPlanWarnHistory predictiveWorkPlanWarnHistory = new PredictiveWorkPlanWarnHistory();
             predictiveWorkPlanWarnHistory.setWorkPlanId(workPlanId);
+            predictiveWorkPlanWarnHistory.setWorkOrderId(workOrderId);
             predictiveWorkPlanWarnHistory.setWarnId(mdcEquipmentAlarmVo.getAlarmNo());
             predictiveWorkPlanWarnHistory.setWarnCode(mdcEquipmentAlarmVo.getAlarmNo());
             predictiveWorkPlanWarnHistory.setWarnName(mdcEquipmentAlarmVo.getAlarmContent());
@@ -115,7 +116,7 @@
         predictiveWorkPlanWarnHistoryService.saveBatch(list);
     }
 
-    private boolean createOrder(String workPlanId, String equipmentId) {
+    private PredictiveWorkOrder createOrder(String workPlanId, String equipmentId) {
         LambdaQueryChainWrapper<PredictiveWorkOrder> lambdaQuery = predictiveWorkOrderService.lambdaQuery();
         lambdaQuery.eq(PredictiveWorkOrder::getWorkPlanId, workPlanId).eq(PredictiveWorkOrder::getEquipmentId, equipmentId);
         //宸插垱寤� 0     宸蹭笅鍙�	1	 鏈紑濮�	2	 鎵ц涓�	3
@@ -127,9 +128,9 @@
             predictiveWorkOrder.setEquipmentId(equipmentId);
             predictiveWorkOrder.setWorkPlanId(workPlanId);
             predictiveWorkOrderService.add(predictiveWorkOrder);
-            return true;
+            return predictiveWorkOrder;
         }
-        return false;
+        return null;
     }
 
     //鍗曚綅缁熶竴鎹㈢畻涓虹

--
Gitblit v1.9.3