¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.eam.job; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.jeecg.common.util.DateUtils; |
| | | import org.jeecg.modules.eam.service.IPredictiveWorkPlanParameterService; |
| | | import org.jeecg.modules.eam.service.IPredictiveWorkPlanSparePartService; |
| | | import org.quartz.Job; |
| | | import org.quartz.JobExecutionContext; |
| | | import org.quartz.JobExecutionException; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * å¤ä»¶å¯¿å½æ£æ¥ï¼çæé¢æµå·¥å |
| | | */ |
| | | @Slf4j |
| | | public class PredictiveWorkPlanParameterJob implements Job { |
| | | |
| | | @Resource |
| | | private IPredictiveWorkPlanParameterService predictiveWorkPlanParameterService; |
| | | |
| | | @Override |
| | | public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { |
| | | log.info("åæ°æ£æ¥ï¼çæé¢æµå·¥åä»»å¡ PredictiveWorkPlanParameterJob start! æ¶é´:" + DateUtils.now()); |
| | | try { |
| | | predictiveWorkPlanParameterService.createParameterWorkPlan(); |
| | | log.info("åæ°æ£æ¥ï¼çæé¢æµå·¥åä»»å¡ PredictiveWorkPlanParameterJob æ§è¡æå!"); |
| | | } catch (Exception e) { |
| | | log.error("åæ°æ£æ¥ï¼çæé¢æµå·¥åä»»å¡ PredictiveWorkPlanParameterJob æ§è¡å¤±è´¥!"); |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package org.jeecg.modules.eam.job; |
| | | |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.jeecg.common.util.DateUtils; |
| | | import org.jeecg.modules.eam.service.IPredictiveWorkPlanSparePartService; |
| | | import org.jeecg.modules.eam.service.IPredictiveWorkPlanWarnService; |
| | | import org.quartz.Job; |
| | | import org.quartz.JobExecutionContext; |
| | | import org.quartz.JobExecutionException; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | /** |
| | | * å¤ä»¶å¯¿å½æ£æ¥ï¼çæé¢æµå·¥å |
| | | */ |
| | | @Slf4j |
| | | public class PredictiveWorkPlanWarnJob implements Job { |
| | | |
| | | @Resource |
| | | private IPredictiveWorkPlanWarnService predictiveWorkPlanWarnService; |
| | | |
| | | @Override |
| | | public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { |
| | | log.info("æ¥è¦æ£æ¥ï¼çæé¢æµå·¥åä»»å¡ PredictiveWorkPlanWarnJob start! æ¶é´:" + DateUtils.now()); |
| | | try { |
| | | predictiveWorkPlanWarnService.createWarnWorkPlan(); |
| | | log.info("æ¥è¦æ£æ¥ï¼çæé¢æµå·¥åä»»å¡ PredictiveWorkPlanWarnJob æ§è¡æå!"); |
| | | } catch (Exception e) { |
| | | log.error("æ¥è¦æ£æ¥ï¼çæé¢æµå·¥åä»»å¡ PredictiveWorkPlanWarnJob æ§è¡å¤±è´¥!"); |
| | | log.error(e.getMessage(), e); |
| | | } |
| | | } |
| | | } |
| | |
| | | package org.jeecg.modules.eam.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.InterceptorIgnore; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.apache.ibatis.annotations.Select; |
| | | import org.jeecg.modules.eam.entity.PredictiveWorkPlanParameter; |
| | | import org.jeecg.modules.eam.model.ParameterVo; |
| | | |
| | |
| | | |
| | | public List<PredictiveWorkPlanParameter> listParameter(@Param("predictiveWorkPlanId") String predictiveWorkPlanId); |
| | | |
| | | |
| | | public ParameterVo findParameterInfo(@Param("saveTableName") String saveTableName, @Param("lowerLimitValue") float lowerLimitValue, |
| | | @Param("upperLimitValue") float upperLimitValue, @Param("parameterCode") String parameterCode); |
| | | |
| | | |
| | | @Select("<script> ${sql} </script>") |
| | | @InterceptorIgnore(tenantLine = "1") |
| | | ParameterVo findCommonParameterInfo(@Param("sql") String sql); |
| | | } |
| | |
| | | FROM |
| | | mom_eam_predictive_work_plan_parameter t1 |
| | | WHERE t1.del_flag = 0 |
| | | <if test="params.planId != null and params.planId != ''"> |
| | | and t1.work_plan_id = #{params.planId} |
| | | <if test="predictiveWorkPlanId != null and predictiveWorkPlanId != ''"> |
| | | and t1.work_plan_id = #{predictiveWorkPlanId} |
| | | </if> |
| | | ORDER BY t1.create_time desc |
| | | </select> |
| | |
| | | t1.CollectTime collectTime, |
| | | t1.${parameterCode} actualValue |
| | | FROM |
| | | [${saveTableName}] t1 |
| | | ${saveTableName} t1 |
| | | WHERE |
| | | t1.${parameterCode} <![CDATA[ < ]]> #{lowerLimitValue} |
| | | OR t1.${parameterCode} > #{upperLimitValue} |
| | |
| | | t1.start_long startLong, |
| | | t1.end_time endTime, |
| | | t1.end_long endLong |
| | | -- ç¶æ,0:å
³æº,1:弿º,2:å¾
æº,3:å·¥ä½,22:æ¥è¦ |
| | | from mdc_equipment_running_section t1 where t1.status IN (1,2,3,22) t1.equipment_id = #{mdcEquipmentId} order by start_time desc |
| | | from mdc_equipment_running_section t1 where t1.status IN (1,2,3,22) AND t1.equipment_id = #{mdcEquipmentId} order by start_time desc |
| | | </select> |
| | | |
| | | |
| | |
| | | } |
| | | |
| | | private ParameterVo findParameterInfo(String saveTableName, float lowerLimitValue, float upperLimitValue, String parameterCode) { |
| | | return this.getBaseMapper().findParameterInfo(saveTableName, lowerLimitValue, upperLimitValue, parameterCode); |
| | | // String temp = "[" + saveTableName + "]"; |
| | | // return this.getBaseMapper().findParameterInfo(temp, lowerLimitValue, upperLimitValue, parameterCode); |
| | | Integer lowerLimitValueInt = (int) lowerLimitValue; |
| | | Integer upperLimitValueInt = (int)upperLimitValue; |
| | | String sql = "SELECT TOP 1 " + |
| | | " t1.CollectTime collectTime, " + |
| | | " t1." + parameterCode + " actualValue " + |
| | | " FROM " + |
| | | " [" + saveTableName + "] t1 " + |
| | | " WHERE " + |
| | | " t1." + parameterCode + " < " + lowerLimitValueInt + |
| | | " OR t1." + parameterCode + " > " + upperLimitValueInt + |
| | | " ORDER BY " + |
| | | " t1.CollectTime DESC"; |
| | | return this.getBaseMapper().findCommonParameterInfo(sql); |
| | | } |
| | | |
| | | private List<PredictiveWorkPlanParameter> listParameter(String predictiveWorkPlanId) { |
| | |
| | | // 3.夿å®é
å¯¿å½æ¯å¦å¤§äºæ§å¶å¯¿å½ï¼å¹¶çæç»´æ¤å·¥å |
| | | @Override |
| | | public void createSparePartWorkPlan() { |
| | | List<PredictiveWorkPlan> predictiveWorkPlanList = predictiveWorkPlanService.listWorkPlan("bjkz"); |
| | | List<PredictiveWorkPlan> predictiveWorkPlanList = predictiveWorkPlanService.listWorkPlan("smkz"); |
| | | for (PredictiveWorkPlan predictiveWorkPlan : predictiveWorkPlanList) { |
| | | List<PredictiveWorkPlanSparePart> predictiveWorkPlanSparePartList = listPredictiveWorkPlanSparePart(predictiveWorkPlan.getId()); |
| | | for (PredictiveWorkPlanSparePart predictiveWorkPlanSparePart : predictiveWorkPlanSparePartList) { |
| | |
| | | if (list == null || list.size() == 0) { |
| | | PredictiveWorkOrder predictiveWorkOrder = new PredictiveWorkOrder(); |
| | | predictiveWorkOrder.setItemId(itemId); |
| | | predictiveWorkOrder.setStatus("1"); |
| | | predictiveWorkOrder.setEquipmentId(equipmentId); |
| | | predictiveWorkOrder.setWorkPlanId(workPlanId); |
| | | predictiveWorkOrderService.add(predictiveWorkOrder); |