DMS:保养计划完善
master
xins 8 months ago
parent d0208b3072
commit 9f3757af4b

@ -69,6 +69,7 @@ public class DmsPlanMaint extends BaseEntity
private Long timeLimitDays;
private Long timeLimitHours;
public Long getTimeLimitDays() {
return timeLimitDays;
}

@ -95,4 +95,14 @@ public interface DmsPlanMaintMapper
*/
public DmsPlanMaint selectDmsPlanMaintJoinByPlanMaintCode(String planMaintCode);
/**
* ,Join job
*
* @param planMaintId
* @return
*/
public DmsPlanMaint selectPlanMaintJoinJobByPlanMaintId(Long planMaintId);
}

@ -47,8 +47,7 @@ public class DmsPlanMaintServiceImpl implements IDmsPlanMaintService {
*/
@Override
public DmsPlanMaint selectDmsPlanMaintByPlanMaintId(Long planMaintId) {
DmsPlanMaint dmsPlanMaint = dmsPlanMaintMapper.selectDmsPlanMaintByPlanMaintId(planMaintId);
DmsPlanMaint dmsPlanMaint = dmsPlanMaintMapper.selectPlanMaintJoinJobByPlanMaintId(planMaintId);
Long timeLimit = dmsPlanMaint.getTimeLimit();
if (timeLimit != null) {
@ -108,14 +107,15 @@ public class DmsPlanMaintServiceImpl implements IDmsPlanMaintService {
dmsPlanMaint.setMaintTime(nextExecution);
dmsPlanMaint.setJobId(jobIdR.getData().longValue());
dmsPlanMaint.setPlanMaintCode(planMaintCode);
dmsPlanMaint.setTimeLimit((dmsPlanMaint.getTimeLimitDays() * 24 * 60 * 60)
+ (dmsPlanMaint.getTimeLimitHours() * 60 * 60));
Long timeLimitDays = dmsPlanMaint.getTimeLimitDays()==null?0L:dmsPlanMaint.getTimeLimitDays();
Long timeLimitHours = dmsPlanMaint.getTimeLimitHours() == null?0L:dmsPlanMaint.getTimeLimitHours();
dmsPlanMaint.setTimeLimit((timeLimitDays * 24 * 60 * 60)
+ (timeLimitHours * 60 * 60));
dmsPlanMaint.setIsFlag(1l);
dmsPlanMaint.setCreateBy(SecurityUtils.getUsername());
dmsPlanMaint.setCreateTime(DateUtils.getNowDate());
int rows = dmsPlanMaintMapper.insertDmsPlanMaint(dmsPlanMaint);
return rows;
}
@ -128,12 +128,40 @@ public class DmsPlanMaintServiceImpl implements IDmsPlanMaintService {
@Transactional
@Override
public int updateDmsPlanMaint(DmsPlanMaint dmsPlanMaint) {
dmsPlanMaint.setIsFlag(1l);
LoginUser user = new LoginUser();
dmsPlanMaint.setUpdateBy(user.getUsername());
Long jobId = dmsPlanMaint.getJobId();
String cronExpression = dmsPlanMaint.getCronExpression();
if(StringUtils.isNotEmpty(cronExpression)){
if (jobId == null) {
String planMaintCode = dmsPlanMaint.getPlanMaintCode();
SysJob job = new SysJob();
job.setJobName("保养计划编号" + planMaintCode + "工单任务");
job.setJobGroup("DEFAULT");
job.setInvokeTarget("ryTask.getDmsBillsMaint(\"" + planMaintCode + "\")");
job.setCronExpression(dmsPlanMaint.getCronExpression());
job.setMisfirePolicy("1");
job.setConcurrent("1");
job.setStatus("1");
R<Integer> jobIdR = remoteJobService.add(SecurityConstants.INNER, job);
dmsPlanMaint.setJobId(jobIdR.getData().longValue());
} else {
SysJob sysJob = remoteJobService.getJobInfo(jobId, SecurityConstants.INNER);
if (sysJob != null) {
sysJob.setCronExpression(dmsPlanMaint.getCronExpression());
remoteJobService.update(SecurityConstants.INNER, sysJob);
}
}
}
String time = dmsPlanMaint.getCronExpression();
//通过cron表达式获取下一次执行时间
Date nextExecution = CronUtils.getNextExecution(time);
dmsPlanMaint.setMaintTime(nextExecution);
Long timeLimitDays = dmsPlanMaint.getTimeLimitDays()==null?0L:dmsPlanMaint.getTimeLimitDays();
Long timeLimitHours = dmsPlanMaint.getTimeLimitHours() == null?0L:dmsPlanMaint.getTimeLimitHours();
dmsPlanMaint.setTimeLimit((timeLimitDays * 24 * 60 * 60)
+ (timeLimitHours * 60 * 60));
dmsPlanMaint.setUpdateBy(SecurityUtils.getUsername());
dmsPlanMaint.setUpdateTime(DateUtils.getNowDate());
dmsPlanMaintMapper.deleteDmsPlanMaintDetailByPlanMaintId(dmsPlanMaint.getPlanMaintId());
insertDmsPlanMaintDetail(dmsPlanMaint);
return dmsPlanMaintMapper.updateDmsPlanMaint(dmsPlanMaint);
}
@ -154,7 +182,7 @@ public class DmsPlanMaintServiceImpl implements IDmsPlanMaintService {
jobIds[i] = dmsPlanMaint.getJobId();
}
remoteJobService.remove(SecurityConstants.INNER,jobIds);
remoteJobService.remove(SecurityConstants.INNER, jobIds);
return dmsPlanMaintMapper.deleteDmsPlanMaintByPlanMaintIds(planMaintIds);
}

@ -22,6 +22,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="cronExpression" column="cron_expression" />
</resultMap>
<resultMap id="DmsPlanMaintDmsPlanMaintDetailResult" type="DmsPlanMaint" extends="DmsPlanMaintResult">
@ -175,4 +177,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where a.plan_maint_code = #{planMaintCode}
</select>
<select id="selectPlanMaintJoinJobByPlanMaintId" parameterType="Long" resultMap="DmsPlanMaintResult">
select a.plan_maint_id, a.plan_maint_code, a.maint_level, a.maint_group, a.maint_supervisor, a.maint_time,a.time_limit,a.job_id, a.cycle_period, a.maint_status, a.create_method, a.is_flag, a.remark, a.create_by, a.create_time, a.update_by, a.update_time,
sj.cron_expression
from dms_plan_maint a
left join sys_job sj on a.job_id = sj.job_id
where a.plan_maint_id = #{planMaintId}
</select>
</mapper>

@ -72,48 +72,8 @@
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<el-form-item label="创建方式" prop="createMethod">
<el-select
v-model="queryParams.createMethod"
placeholder="创建方式"
clearable
style="width: 240px"
>
<el-option
v-for="dict in dict.type.dms_create_method"
:key="dict.value"
:label="dict.label"
:value="dict.value"
/>
</el-select>
</el-form-item>
<el-form-item label="调试时间">
<el-date-picker
v-model="queryParams.params.beginTime"
style="width: 240px"
type="date"
placeholder="选择日期时间"
value-format="yyyy-MM-dd "
></el-date-picker>
</el-form-item>
<el-form-item><div>-</div></el-form-item>
<el-form-item
><el-date-picker
v-model="queryParams.params.endTime"
value-format="yyyy-MM-dd "
style="width: 240px"
type="date"
placeholder="选择日期时间"
></el-date-picker
></el-form-item>
<!-- <el-form-item label="是否标识1-是2-否" prop="isFlag">-->
<!-- <el-input-->
<!-- v-model="queryParams.isFlag"-->
<!-- placeholder="请输入是否标识1-是2-否"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery"></el-button>
@ -170,13 +130,6 @@
<el-table v-loading="loading" :data="maintList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<!-- <el-table-column label="主键标识" align="center" prop="planMaintId" />-->
<el-table-column label="主键标识" align="center" prop="planMaintId" >
<template slot-scope="scope">
<router-link :to="'/dms/maintDetail/index/' + scope.row.planMaintId" class="link-type">
<span>{{ scope.row.planMaintId }}</span>
</router-link>
</template>
</el-table-column>
<el-table-column label="计划编号" align="center" prop="planMaintCode" />
<!-- <el-table-column label="保养级别1-日常保养2-月度保养3-年度保养" align="center" prop="maintLevel" />-->
<el-table-column label="保养级别" align="center" prop="maintLevel">
@ -199,19 +152,6 @@
<span v-show="scope.row.timeLimitHours!=0&&scope.row.timeLimitHours!=null">{{scope.row.timeLimitHours}}</span>
</template>
</el-table-column>
<!-- <el-table-column label="循环周期" align="center" prop="cyclePeriod" />-->
<!-- <el-table-column label="保养状态1-待保养2-保养中3-已完成" align="center" prop="maintStatus" />-->
<el-table-column label="保养状态" align="center" prop="maintStatus">
<template slot-scope="scope">
<dict-tag :options="dict.type.dms_maint_status" :value="scope.row.maintStatus"/>
</template>
</el-table-column>
<!-- <el-table-column label="创建方式1-人工创建2-自动创建" align="center" prop="createMethod" />-->
<el-table-column label="创建方式" align="center" prop="createMethod">
<template slot-scope="scope">
<dict-tag :options="dict.type.dms_create_method" :value="scope.row.createMethod"/>
</template>
</el-table-column>
<!-- <el-table-column label="是否标识1-是2-否" align="center" prop="isFlag" />-->
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
@ -222,7 +162,7 @@
icon="el-icon-s-order"
@click="jumpToDetail(scope.row)"
v-hasPermi="['dms:checkplan:edit']"
>详情</el-button>
>计划明细</el-button>
<el-button
size="mini"
type="text"
@ -251,13 +191,10 @@
<!-- 添加或修改保养计划信息对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="计划编号" prop="planMaintCode">
<el-input v-model="form.planMaintCode" placeholder="请输入计划编号" />
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item label="计划编号" prop="planMaintCode" v-if="false">
<el-input v-model="form.planMaintCode" disabled/>
</el-form-item>
<!-- <el-form-item label="保养级别1-日常保养2-月度保养3-年度保养" prop="maintLevel">-->
<!-- <el-input v-model="form.maintLevel" placeholder="请输入保养级别1-日常保养2-月度保养3-年度保养" />-->
<!-- </el-form-item>-->
<el-form-item label="保养级别" prop="maintLevel">
<el-radio-group v-model="form.maintLevel">
<el-radio
@ -287,42 +224,29 @@
<!-- <el-form-item label="创建方式1-人工创建2-自动创建" prop="createMethod">-->
<!-- <el-input v-model="form.createMethod" placeholder="请输入创建方式1-人工创建2-自动创建" />-->
<!-- </el-form-item>-->
<el-form-item label="job" prop="jobId" v-if="false">
<el-input v-model="form.jobId" />
</el-form-item>
<el-row>
<el-col :span="12">
<el-form-item label="时限" prop="timeLimitDays">
<el-input-number v-model="form.timeLimitDays" placeholder="请输入天数" :min="0" :max="10000"/>
<el-input-number v-model="form.timeLimitHours" placeholder="请输入小时" :min="0" :max="23"/>
<el-input-number v-model="form.timeLimitDays" placeholder="请输入天数" :precision="0" :min="0" :max="10000"/>
<el-input-number v-model="form.timeLimitHours" placeholder="请输入小时" :precision="0" :min="0" :max="23"/>
</el-form-item>
</el-col>
</el-row>
<el-form-item label="cron表达式" prop="cronExpression">
<el-input v-model="form.cronExpression" placeholder="请输入cron执行表达式">
<el-form-item label="定时计划" prop="cronExpression">
<el-input v-model="form.cronExpression" placeholder="请输入cron执行表达式" readonly>
<template slot="append">
<el-button type="primary" @click="handleShowCron">
生成表达式
生成计划表达式
<i class="el-icon-time el-icon--right"></i>
</el-button>
</template>
</el-input>
</el-form-item>
<el-form-item label="保养状态" prop="maintStatus">
<el-radio-group v-model="form.maintStatus">
<el-radio
v-for="dict in dict.type.dms_maint_status"
:key="dict.value"
:label="parseInt(dict.value)"
>{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="创建方式" prop="createMethod">
<el-radio-group v-model="form.createMethod">
<el-radio
v-for="dict in dict.type.dms_create_method"
:key="dict.value"
:label="parseInt(dict.value)"
>{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item>
<!-- <el-form-item label="是否标识1-是2-否" prop="isFlag">-->
<!-- <el-input v-model="form.isFlag" placeholder="请输入是否标识1-是2-否" />-->
<!-- </el-form-item>-->
@ -362,6 +286,8 @@ export default {
loading: true,
//
ids: [],
//
codes: [],
//
checkedDmsPlanMaintDetail: [],
//
@ -408,8 +334,8 @@ export default {
planMaintCode: [
{ required: true, message: "计划编号不能为空", trigger: "blur" }
],
isFlag: [
{ required: true, message: "是否标识1-是2-否不能为空", trigger: "blur" }
cronExpression: [
{ required: true, message: "定时计划不能为空", trigger: "blur" }
],
}
};
@ -480,6 +406,7 @@ export default {
cyclePeriod: null,
maintStatus: null,
createMethod: null,
cronExpression: null,
isFlag: null,
remark: null,
createBy: null,
@ -503,6 +430,7 @@ export default {
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.planMaintId)
this.codes = selection.map(item => item.planMaintCode)
this.single = selection.length!==1
this.multiple = !selection.length
},
@ -518,7 +446,6 @@ export default {
const planMaintId = row.planMaintId || this.ids
getMaint(planMaintId).then(response => {
this.form = response.data;
this.dmsPlanMaintDetailList = response.data.dmsPlanMaintDetailList;
this.open = true;
this.title = "修改保养计划信息";
});
@ -547,7 +474,8 @@ export default {
/** 删除按钮操作 */
handleDelete(row) {
const planMaintIds = row.planMaintId || this.ids;
this.$modal.confirm('是否确认删除保养计划信息编号为"' + planMaintIds + '"的数据项?').then(function() {
const planMatinCodes = row.planMatinCode || this.codes
this.$modal.confirm('是否确认删除保养计划编号为"' + planMatinCodes + '"的数据项?').then(function() {
return delMaint(planMaintIds);
}).then(() => {
this.getList();

@ -4,7 +4,7 @@
<el-form label-width="120px">
<el-row>
<el-col :span="8" :offset="2">
<el-form-item label="检修计划编号" prop="planRepairId">
<el-form-item label="保养计划编号" prop="planRepairId">
<el-input v-model="this.planMaintIdCheck" disabled />
</el-form-item>
</el-col>
@ -147,7 +147,6 @@
<el-table v-loading="loading" :data="maintDetailList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<!-- <el-table-column label="主键标识" align="center" prop="planMaintDetailId" />-->
<el-table-column label="计划ID" align="center" prop="planMaintId" />
<!-- <el-table-column label="设备ID关联dms_base_device_ledger的device_id" align="center" prop="deviceId" />-->
<el-table-column label="设备名称" align="center" prop="deviceId" >
<template slot-scope="scope">
@ -162,17 +161,7 @@
</template>
</el-table-column>
<!-- <el-table-column label="保养部位,关联dms_base_maint_station的maint_station_id" align="center" prop="maintStationId" />-->
<el-table-column label="保养部位" align="center" prop="maintStationId" >
<template slot-scope="scope">
<span
v-for="(item, index) in stationList"
:key="index"
:value="item.stationList"
v-if="scope.row.maintStationId == item.maintStationId"
>
{{ item.maintStationCode }}
</span>
</template>
<el-table-column label="保养部位" align="center" prop="maintStationName" >
</el-table-column>
<el-table-column label="保养标准" align="center" prop="maintProtocol" />
<el-table-column label="操作描述" align="center" prop="operationDescription" />
@ -280,7 +269,7 @@
<!-- 添加或修改保养计划明细对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="计划ID" prop="planMaintId" >
<el-form-item label="计划ID" prop="planMaintId" v-if="false">
<el-input v-model="form.planMaintId" placeholder="请输入计划ID" :disabled=true />
</el-form-item>
<!-- <el-form-item label="设备ID关联dms_base_device_ledger的device_id" prop="deviceId">-->
@ -304,22 +293,20 @@
<el-option
v-for="item in stationList"
:key="item.maintStationId"
:label="item.maintStationCode"
:label="item.maintStationName"
:value="item.maintStationId">
</el-option>
</el-select>
</el-form-item>
<!-- <el-form-item label="保养标准" prop="maintProtocol">-->
<!-- <el-input v-model="form.maintProtocol" placeholder="请输入保养标准" />-->
<!-- </el-form-item>-->
<el-form-item label="保养标准" prop="maintProtocol" >
<el-select v-model="form.maintProtocol" placeholder="请选择标准">
<el-form-item label="保养标准" prop="maintStandardId" >
<el-select v-model="form.maintStandardId" placeholder="请选择标准">
<el-option
v-for="item in standardList"
:key="item.maintProtocol"
:key="item.maintStandardId"
:label="item.maintProtocol"
:value="item.maintProtocol">
:value="item.maintStandardId">
</el-option>
</el-select>
</el-form-item>
@ -385,7 +372,7 @@ export default {
planMaintId: null,
deviceId: null,
maintStationId: null,
maintProtocol: null,
maintStandardId: null,
operationDescription: null,
isFlag: null,
},
@ -471,7 +458,7 @@ export default {
planMaintId: null,
deviceId: null,
maintStationId: null,
maintProtocol: null,
maintStandardId: null,
operationDescription: null,
isFlag: null,
remark: null,

Loading…
Cancel
Save