DMS:Web润滑计划完善,润滑工单定时任务完成
master
xins 8 months ago
parent 9f3757af4b
commit f963061fd9

@ -25,4 +25,16 @@ public interface RemoteJobService {
@PostMapping("/jobinner/remove/{jobIds}")
R<?> remove(@RequestHeader(SecurityConstants.FROM_SOURCE) String source, @PathVariable("jobIds") Long[] jobIds);
/**
*
*
* @param jobId job
* @param source
* @return
*/
@GetMapping("/jobinner/info/{jobId}")
public SysJob getJobInfo(@PathVariable("jobId") Long jobId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
@PostMapping("/jobinner/update")
R<?> update(@RequestHeader(SecurityConstants.FROM_SOURCE) String source, SysJob job);
}

@ -35,6 +35,16 @@ public class RemoteJobFallbackFactory implements FallbackFactory<RemoteJobServic
return null;
}
@Override
public SysJob getJobInfo(Long jobId, String source) {
return null;
}
@Override
public R<?> update(String source, SysJob job) {
return null;
}
};
}

@ -94,24 +94,9 @@ public class DmsBillsLubeInstanceController extends BaseController
*
* */
@PostMapping("/autoAdd")
public AjaxResult autoAdd(@RequestBody String lubeInstanceId)
public AjaxResult autoAdd(@RequestBody String lubeInstanceCode)
{
String s = lubeInstanceId.replaceAll("\"", "");
DmsPlanLube dmsPlanLube = dmsPlanLubeService.selectDmsPlanLubeByPlanLubeId(Long.valueOf(s));
DmsBillsLubeInstance dmsBillsLubeInstance = new DmsBillsLubeInstance();
// DmsRepairInstance dmsRepairInstance = dmsRepairInstanceService.selectDmsRepairInstanceByRepairInstanceId(2l);
Date nowDate = DateUtils.getNowDate();
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHH");
String strDate = sdf.format(nowDate);
dmsBillsLubeInstance.setPlanLubeId(dmsPlanLube.getPlanLubeId());
dmsBillsLubeInstance.setBillsLubeCode(strDate);
return toAjax(dmsBillsLubeInstanceService.insertDmsBillsLubeInstance(dmsBillsLubeInstance));
return toAjax(dmsBillsLubeInstanceService.insertDmsBillsLubeInstance(lubeInstanceCode));
}

@ -94,9 +94,7 @@ public class DmsBillsMaintInstanceController extends BaseController
@PostMapping("/autoAdd")
public AjaxResult autoAdd(@RequestBody String planMaintCode)
{
String planMaintCodeS = planMaintCode.replaceAll("\"", "");
DmsPlanMaint dmsPlanMaint = dmsPlanMaintService.selectDmsPlanMaintJoinByPlanMaintCode(planMaintCodeS);
return toAjax(dmsBillsMaintInstanceService.insertDmsBillsMaintInstance(dmsPlanMaint));
return toAjax(dmsBillsMaintInstanceService.insertDmsBillsMaintInstance(planMaintCode));
}
/**

@ -152,6 +152,7 @@ public class DmsPlanLubeDetailController extends BaseController
@GetMapping(value = "/getBaseDeviceLedgers")
public AjaxResult getBaseDeviceLedgers(DmsBaseDeviceLedger dmsBaseDeviceLedger)
{
System.out.println(dmsBaseDeviceLedgerService.selectDmsBaseDeviceLedgerList(dmsBaseDeviceLedger));
return success(dmsBaseDeviceLedgerService.selectDmsBaseDeviceLedgerList(dmsBaseDeviceLedger));
}

@ -1,6 +1,8 @@
package com.hw.dms.domain;
import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
@ -64,6 +66,8 @@ public class DmsPlanLube extends BaseEntity
private Long timeLimitHours;
private String cronExpression;
private List<DmsPlanLubeDetail> dmsPlanLubeDetailList;
public Long getTimeLimitDays() {
return timeLimitDays;
}
@ -188,6 +192,14 @@ public class DmsPlanLube extends BaseEntity
return isFlag;
}
public List<DmsPlanLubeDetail> getDmsPlanLubeDetailList() {
return dmsPlanLubeDetailList;
}
public void setDmsPlanLubeDetailList(List<DmsPlanLubeDetail> dmsPlanLubeDetailList) {
this.dmsPlanLubeDetailList = dmsPlanLubeDetailList;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

@ -1,6 +1,8 @@
package com.hw.dms.mapper;
import java.util.List;
import com.hw.dms.domain.DmsBillsLubeDetail;
import com.hw.dms.domain.DmsBillsLubeInstance;
/**
@ -62,6 +64,13 @@ public interface DmsBillsLubeInstanceMapper
/**
*
*
* @param dmsBillsLubeDetailList
* @return
*/
public int batchDmsBillsLubeDetail(List<DmsBillsLubeDetail> dmsBillsLubeDetailList);
/**
* ,Join

@ -71,4 +71,14 @@ public interface DmsPlanLubeMapper
* @return
*/
public DmsPlanLube selectDmsPlanLubeJoinByPlanLubeCode(String planLubeCode);
/**
* Join job
*
* @param planLubeId
* @return
*/
public DmsPlanLube selectPlanLubeJoinJobByPlanLubeId(Long planLubeId);
}

@ -4,6 +4,7 @@ import java.util.List;
import com.hw.dms.domain.DmsBillsLubeDetail;
import com.hw.dms.domain.DmsBillsLubeInstance;
import com.hw.dms.domain.DmsPlanLube;
import org.springframework.transaction.annotation.Transactional;
/**
@ -30,6 +31,17 @@ public interface IDmsBillsLubeInstanceService
*/
public List<DmsBillsLubeInstance> selectDmsBillsLubeInstanceList(DmsBillsLubeInstance dmsBillsLubeInstance);
/**
*
*
* @param lubeInstanceCode
* @return
*/
public int insertDmsBillsLubeInstance(String lubeInstanceCode);
/**
*
*

@ -34,10 +34,10 @@ public interface IDmsBillsMaintInstanceService
/**
*
*
* @param dmsPlanMaint
* @param planMaintCode
* @return
*/
public int insertDmsBillsMaintInstance(DmsPlanMaint dmsPlanMaint);
public int insertDmsBillsMaintInstance(String planMaintCode);
/**
*

@ -1,6 +1,7 @@
package com.hw.dms.service.impl;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
@ -10,6 +11,7 @@ import com.hw.common.core.constant.SecurityConstants;
import com.hw.common.core.exception.ServiceException;
import com.hw.common.core.utils.DateUtils;
import com.hw.common.core.utils.StringUtils;
import com.hw.common.core.utils.uuid.Seq;
import com.hw.common.security.utils.SecurityUtils;
import com.hw.dms.domain.*;
import com.hw.dms.mapper.DmsBillsLubeDetailMapper;
@ -68,6 +70,61 @@ public class DmsBillsLubeInstanceServiceImpl implements IDmsBillsLubeInstanceSer
return dmsBillsLubeInstanceMapper.selectDmsBillsLubeInstanceList(dmsBillsLubeInstance);
}
/**
*
*
* @param lubeInstanceCode
* @return
*/
@Override
@Transactional
public int insertDmsBillsLubeInstance(String lubeInstanceCode) {
String lubeInstanceCodeS = lubeInstanceCode.replaceAll("\"", "");
DmsPlanLube dmsPlanLube = dmsPlanLubeMapper.selectDmsPlanLubeJoinByPlanLubeCode(lubeInstanceCodeS);
List<DmsPlanLubeDetail> planLubeDetails = dmsPlanLube.getDmsPlanLubeDetailList();
if (planLubeDetails == null || planLubeDetails.isEmpty()) {
return 0;
}
DmsBillsLubeInstance dmsBillsLubeInstance = new DmsBillsLubeInstance();
Date lubeTime = dmsPlanLube.getLubeTime();
dmsBillsLubeInstance.setPlanLubeId(dmsPlanLube.getPlanLubeId());
dmsBillsLubeInstance.setCreateTime(DateUtils.getNowDate());
dmsBillsLubeInstance.setPlanBeginTime(lubeTime);
dmsBillsLubeInstance.setBillsLubeCode(Seq.getId(Seq.lubeInstanceSeqType, Seq.lubeInstanceCode));
dmsBillsLubeInstance.setLubeStatus(DmsConstants.DMS_BILLS_LUBE_INSTANCE_STATUS_TO_LUBE);
dmsBillsLubeInstance.setLubeGroup(dmsPlanLube.getLubeGroup());
dmsBillsLubeInstance.setLubeSupervisor(dmsPlanLube.getLubeSupervisor());
dmsBillsLubeInstance.setLubeLevel(dmsPlanLube.getLubeLevel());
Long timeLimit = dmsPlanLube.getTimeLimit();
dmsBillsLubeInstance.setIsFlag("1");
dmsBillsLubeInstance.setPlanEndTime(new Date(lubeTime.getTime() + timeLimit * 1000l));
int i = dmsBillsLubeInstanceMapper.insertDmsBillsLubeInstance(dmsBillsLubeInstance);
batchInsertDmsBillsLubeDetail(dmsPlanLube, dmsBillsLubeInstance.getLubeInstanceId());
return i;
}
public void batchInsertDmsBillsLubeDetail(DmsPlanLube dmsPlanLube, Long lubeInstanceId) {
List<DmsPlanLubeDetail> planLubeDetails = dmsPlanLube.getDmsPlanLubeDetailList();
List<DmsBillsLubeDetail> billsLubeDetails = new ArrayList<>();
planLubeDetails.forEach(planLubeDetail -> {
DmsBillsLubeDetail dmsBillsLubeDetail = new DmsBillsLubeDetail();
dmsBillsLubeDetail.setLubeInstanceId(lubeInstanceId);
dmsBillsLubeDetail.setDeviceId(planLubeDetail.getDeviceId());
dmsBillsLubeDetail.setLubeStationId(planLubeDetail.getLubeStationId());
dmsBillsLubeDetail.setLubeStandardId(planLubeDetail.getLubeStandardId());
dmsBillsLubeDetail.setIsFlag(1L);
billsLubeDetails.add(dmsBillsLubeDetail);
});
dmsBillsLubeInstanceMapper.batchDmsBillsLubeDetail(billsLubeDetails);
}
/**
*
*

@ -69,16 +69,24 @@ public class DmsBillsMaintInstanceServiceImpl implements IDmsBillsMaintInstanceS
/**
*
*
* @param dmsPlanMaint
* @param planMaintCode
* @return
*/
@Override
@Transactional
public int insertDmsBillsMaintInstance(DmsPlanMaint dmsPlanMaint) {
public int insertDmsBillsMaintInstance(String planMaintCode) {
String planMaintCodeS = planMaintCode.replaceAll("\"", "");
DmsPlanMaint dmsPlanMaint = dmsPlanMaintMapper.selectDmsPlanMaintJoinByPlanMaintCode(planMaintCodeS);
List<DmsPlanMaintDetail> planMaintDetails = dmsPlanMaint.getDmsPlanMaintDetailList();
if (planMaintDetails == null || planMaintDetails.isEmpty()) {
return 0;
}
DmsBillsMaintInstance dmsBillsMaintInstance = new DmsBillsMaintInstance();
dmsBillsMaintInstance.setCreateTime(DateUtils.getNowDate());
dmsBillsMaintInstance.setPlanBeginTime(dmsPlanMaint.getMaintTime());
dmsBillsMaintInstance.setPlanMaintId(dmsPlanMaint.getPlanMaintId());
dmsBillsMaintInstance.setBillsMaintCode(Seq.getId(Seq.maintInstanceSeqType, Seq.maintInstanceCode));
dmsBillsMaintInstance.setMaintStatus(DmsConstants.DMS_BILLS_MAINT_INSTANCE_STATUS_TO_MAINT);
dmsBillsMaintInstance.setMaintGroup(dmsPlanMaint.getMaintGroup());
@ -96,12 +104,22 @@ public class DmsBillsMaintInstanceServiceImpl implements IDmsBillsMaintInstanceS
return i;
}
/**
*
*
* @param dmsBillsMaintInstance
* @return
*/
public void batchInsertDmsBillsMaintDetail(DmsPlanMaint dmsPlanMaint, Long maintInstanceId) {
List<DmsPlanMaintDetail> planMaintDetails = dmsPlanMaint.getDmsPlanMaintDetailList();
List<DmsBillsMaintDetail> billsMaintDetails = new ArrayList<>();
planMaintDetails.forEach(planMaintDetail -> {
DmsBillsMaintDetail dmsBillsMaintDetail = new DmsBillsMaintDetail();
dmsBillsMaintDetail.setMaintInstanceId(maintInstanceId);
dmsBillsMaintDetail.setDeviceId(planMaintDetail.getDeviceId());
dmsBillsMaintDetail.setStationId(planMaintDetail.getMaintStationId());
dmsBillsMaintDetail.setMaintStandardId(planMaintDetail.getMaintStandardId());
dmsBillsMaintDetail.setIsFlag(1L);
billsMaintDetails.add(dmsBillsMaintDetail);
});
dmsBillsMaintInstanceMapper.batchDmsBillsMaintDetail(billsMaintDetails);
}
@Override
public int updateDmsBillsMaintInstance(DmsBillsMaintInstance dmsBillsMaintInstance) {
dmsBillsMaintInstance.setUpdateTime(DateUtils.getNowDate());
@ -176,23 +194,6 @@ public class DmsBillsMaintInstanceServiceImpl implements IDmsBillsMaintInstanceS
}
public void batchInsertDmsBillsMaintDetail(DmsPlanMaint dmsPlanMaint, Long maintInstanceId) {
List<DmsPlanMaintDetail> planMaintDetails = dmsPlanMaint.getDmsPlanMaintDetailList();
List<DmsBillsMaintDetail> billsMaintDetails = new ArrayList<>();
planMaintDetails.forEach(planMaintDetail -> {
DmsBillsMaintDetail dmsBillsMaintDetail = new DmsBillsMaintDetail();
dmsBillsMaintDetail.setMaintInstanceId(maintInstanceId);
dmsBillsMaintDetail.setDeviceId(planMaintDetail.getDeviceId());
dmsBillsMaintDetail.setStationId(planMaintDetail.getMaintStationId());
dmsBillsMaintDetail.setMaintStandardId(planMaintDetail.getMaintStandardId());
dmsBillsMaintDetail.setIsFlag(1L);
billsMaintDetails.add(dmsBillsMaintDetail);
});
dmsBillsMaintInstanceMapper.batchDmsBillsMaintDetail(billsMaintDetails);
}
/**
*
*

@ -6,14 +6,12 @@ import java.util.List;
import com.hw.common.core.constant.SecurityConstants;
import com.hw.common.core.domain.R;
import com.hw.common.core.utils.DateUtils;
import com.hw.common.core.utils.StringUtils;
import com.hw.common.core.utils.uuid.Seq;
import com.hw.common.security.utils.SecurityUtils;
import com.hw.dms.domain.DmsPlanMaint;
import com.hw.dms.domain.DmsPlanRepair;
import com.hw.job.api.RemoteJobService;
import com.hw.job.api.domain.SysJob;
import com.hw.job.api.util.CronUtils;
import com.hw.system.api.model.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hw.dms.mapper.DmsPlanLubeMapper;
@ -30,8 +28,7 @@ import javax.annotation.Resource;
* @date 2024-01-12
*/
@Service
public class DmsPlanLubeServiceImpl implements IDmsPlanLubeService
{
public class DmsPlanLubeServiceImpl implements IDmsPlanLubeService {
@Autowired
private DmsPlanLubeMapper dmsPlanLubeMapper;
@ -45,17 +42,16 @@ public class DmsPlanLubeServiceImpl implements IDmsPlanLubeService
* @return
*/
@Override
public DmsPlanLube selectDmsPlanLubeByPlanLubeId(Long planLubeId)
{
DmsPlanLube dmsPlanLube = dmsPlanLubeMapper.selectDmsPlanLubeByPlanLubeId(planLubeId);
public DmsPlanLube selectDmsPlanLubeByPlanLubeId(Long planLubeId) {
DmsPlanLube dmsPlanLube = dmsPlanLubeMapper.selectPlanLubeJoinJobByPlanLubeId(planLubeId);
Long timeLimit = dmsPlanLube.getTimeLimit();
if (timeLimit !=null){
if (timeLimit != null) {
Long days = timeLimit / (24 * 60 * 60l);
Long hours = timeLimit % (24 * 60 * 60l);
// System.out.println(days);
// System.out.println(hours);
dmsPlanLube.setTimeLimitDays(days);
dmsPlanLube.setTimeLimitHours(hours/(60*60l));
dmsPlanLube.setTimeLimitHours(hours / (60 * 60l));
}
return dmsPlanLube;
}
@ -67,18 +63,17 @@ public class DmsPlanLubeServiceImpl implements IDmsPlanLubeService
* @return
*/
@Override
public List<DmsPlanLube> selectDmsPlanLubeList(DmsPlanLube dmsPlanLube)
{
public List<DmsPlanLube> selectDmsPlanLubeList(DmsPlanLube dmsPlanLube) {
List<DmsPlanLube> dmsPlanLubes = dmsPlanLubeMapper.selectDmsPlanLubeList(dmsPlanLube);
for (DmsPlanLube dmsPlanReapirFor : dmsPlanLubes){
for (DmsPlanLube dmsPlanReapirFor : dmsPlanLubes) {
Long timeLimit = dmsPlanReapirFor.getTimeLimit();
if (timeLimit !=null){
if (timeLimit != null) {
Long days = timeLimit / (24 * 60 * 60l);
Long hours = timeLimit % (24 * 60 * 60l);
// System.out.println(days);
// System.out.println(hours);
dmsPlanReapirFor.setTimeLimitDays(days);
dmsPlanReapirFor.setTimeLimitHours(hours/(60*60l));
dmsPlanReapirFor.setTimeLimitHours(hours / (60 * 60l));
}
}
return dmsPlanLubes;
@ -111,8 +106,10 @@ public class DmsPlanLubeServiceImpl implements IDmsPlanLubeService
dmsPlanLube.setLubeTime(nextExecution);
dmsPlanLube.setJobId(jobIdR.getData().longValue());
dmsPlanLube.setPlanLubeCode(planLubeCode);
dmsPlanLube.setTimeLimit((dmsPlanLube.getTimeLimitDays() * 24 * 60 * 60)
+ (dmsPlanLube.getTimeLimitHours() * 60 * 60));
Long timeLimitDays = dmsPlanLube.getTimeLimitDays() == null ? 0L : dmsPlanLube.getTimeLimitDays();
Long timeLimitHours = dmsPlanLube.getTimeLimitHours() == null ? 0L : dmsPlanLube.getTimeLimitHours();
dmsPlanLube.setTimeLimit((timeLimitDays * 24 * 60 * 60)
+ (timeLimitHours * 60 * 60));
dmsPlanLube.setIsFlag("1");
dmsPlanLube.setCreateBy(SecurityUtils.getUsername());
dmsPlanLube.setCreateTime(DateUtils.getNowDate());
@ -128,8 +125,41 @@ public class DmsPlanLubeServiceImpl implements IDmsPlanLubeService
* @return
*/
@Override
public int updateDmsPlanLube(DmsPlanLube dmsPlanLube)
{
@Transactional(rollbackFor = Exception.class)
public int updateDmsPlanLube(DmsPlanLube dmsPlanLube) {
Long jobId = dmsPlanLube.getJobId();
String cronExpression = dmsPlanLube.getCronExpression();
if (StringUtils.isNotEmpty(cronExpression)) {
//通过cron表达式获取下一次执行时间
Date nextExecution = CronUtils.getNextExecution(cronExpression);
dmsPlanLube.setLubeTime(nextExecution);
if (jobId == null) {
String planLubeCode = dmsPlanLube.getPlanLubeCode();
SysJob job = new SysJob();
job.setJobName("润滑计划编号" + planLubeCode + "工单任务");
job.setJobGroup("DEFAULT");
job.setInvokeTarget("ryTask.getDmsBillsLube(\"" + planLubeCode + "\")");
job.setCronExpression(dmsPlanLube.getCronExpression());
job.setMisfirePolicy("1");
job.setConcurrent("1");
job.setStatus("1");
R<Integer> jobIdR = remoteJobService.add(SecurityConstants.INNER, job);
dmsPlanLube.setJobId(jobIdR.getData().longValue());
} else {
SysJob sysJob = remoteJobService.getJobInfo(jobId, SecurityConstants.INNER);
if (sysJob != null) {
sysJob.setCronExpression(dmsPlanLube.getCronExpression());
remoteJobService.update(SecurityConstants.INNER, sysJob);
}
}
}
Long timeLimitDays = dmsPlanLube.getTimeLimitDays() == null ? 0L : dmsPlanLube.getTimeLimitDays();
Long timeLimitHours = dmsPlanLube.getTimeLimitHours() == null ? 0L : dmsPlanLube.getTimeLimitHours();
dmsPlanLube.setTimeLimit((timeLimitDays * 24 * 60 * 60)
+ (timeLimitHours * 60 * 60));
dmsPlanLube.setUpdateBy(SecurityUtils.getUsername());
dmsPlanLube.setUpdateTime(DateUtils.getNowDate());
return dmsPlanLubeMapper.updateDmsPlanLube(dmsPlanLube);
}
@ -141,8 +171,7 @@ public class DmsPlanLubeServiceImpl implements IDmsPlanLubeService
* @return
*/
@Override
public int deleteDmsPlanLubeByPlanLubeIds(Long[] planLubeIds)
{
public int deleteDmsPlanLubeByPlanLubeIds(Long[] planLubeIds) {
return dmsPlanLubeMapper.deleteDmsPlanLubeByPlanLubeIds(planLubeIds);
}
@ -153,8 +182,7 @@ public class DmsPlanLubeServiceImpl implements IDmsPlanLubeService
* @return
*/
@Override
public int deleteDmsPlanLubeByPlanLubeId(Long planLubeId)
{
public int deleteDmsPlanLubeByPlanLubeId(Long planLubeId) {
return dmsPlanLubeMapper.deleteDmsPlanLubeByPlanLubeId(planLubeId);
}
}

@ -2,6 +2,7 @@ package com.hw.dms.service.impl;
import java.util.List;
import com.hw.common.core.utils.DateUtils;
import com.hw.common.security.utils.SecurityUtils;
import com.hw.system.api.model.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -54,8 +55,7 @@ public class DmsPlanMaintDetailServiceImpl implements IDmsPlanMaintDetailService
@Override
public int insertDmsPlanMaintDetail(DmsPlanMaintDetail dmsPlanMaintDetail)
{
LoginUser user = new LoginUser();
dmsPlanMaintDetail.setCreateBy(user.getUsername());
dmsPlanMaintDetail.setCreateBy(SecurityUtils.getUsername());
dmsPlanMaintDetail.setCreateTime(DateUtils.getNowDate());
dmsPlanMaintDetail.setIsFlag(1l);
return dmsPlanMaintDetailMapper.insertDmsPlanMaintDetail(dmsPlanMaintDetail);
@ -70,8 +70,7 @@ public class DmsPlanMaintDetailServiceImpl implements IDmsPlanMaintDetailService
@Override
public int updateDmsPlanMaintDetail(DmsPlanMaintDetail dmsPlanMaintDetail)
{
LoginUser user = new LoginUser();
dmsPlanMaintDetail.setUpdateBy(user.getUsername());
dmsPlanMaintDetail.setUpdateBy(SecurityUtils.getUsername());
dmsPlanMaintDetail.setUpdateTime(DateUtils.getNowDate());
return dmsPlanMaintDetailMapper.updateDmsPlanMaintDetail(dmsPlanMaintDetail);
}

@ -116,6 +116,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<insert id="batchDmsBillsLubeDetail">
insert into dms_bills_lube_detail( bills_lube_detail_id, lube_instance_id, device_id, lube_station_id, lube_standard_id, operation_description, maint_status, is_flag, remark, create_by, create_time, update_by, update_time) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.billsLubeDetailId}, #{item.lubeInstanceId}, #{item.deviceId}, #{item.lubeStationId}, #{item.lubeStandardId}, #{item.operationDescription}, #{item.maintStatus}, #{item.isFlag}, #{item.remark}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime})
</foreach>
</insert>
<select id="selectNewestDmsBillsLubeInstance" parameterType="DmsBillsLubeInstance" resultMap="DmsBillsLubeInstanceResult">
select dbli.lube_instance_id, dbli.plan_lube_id, dbli.bills_lube_code, dbli.plan_begin_time, dbli.real_begin_time, dbli.plan_end_time,

@ -0,0 +1,101 @@
<?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.hw.dms.mapper.DmsPlanLubeDetailMapper">
<resultMap type="DmsPlanLubeDetail" id="DmsPlanLubeDetailResult">
<result property="planLubeDetailId" column="plan_lube_detail_id" />
<result property="planLubeId" column="plan_lube_id" />
<result property="deviceId" column="device_id" />
<result property="lubeStationId" column="lube_station_id" />
<result property="lubeStandardId" column="lube_standard_id" />
<result property="operationDescription" column="operation_description" />
<result property="isFlag" column="is_flag" />
<result property="remark" column="remark" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectDmsPlanLubeDetailVo">
select plan_lube_detail_id, plan_lube_id, device_id, lube_station_id, lube_standard_id, operation_description, is_flag, remark, create_by, create_time, update_by, update_time from dms_plan_lube_detail
</sql>
<select id="selectDmsPlanLubeDetailList" parameterType="DmsPlanLubeDetail" resultMap="DmsPlanLubeDetailResult">
<include refid="selectDmsPlanLubeDetailVo"/>
<where>
<if test="planLubeId != null "> and plan_lube_id = #{planLubeId}</if>
<if test="deviceId != null "> and device_id = #{deviceId}</if>
<if test="lubeStationId != null "> and lube_station_id = #{lubeStationId}</if>
<if test="lubeStandardId != null "> and lube_standard_id = #{lubeStandardId}</if>
<if test="operationDescription != null and operationDescription != ''"> and operation_description = #{operationDescription}</if>
<if test="isFlag != null "> and is_flag = #{isFlag}</if>
</where>
</select>
<select id="selectDmsPlanLubeDetailByPlanLubeDetailId" parameterType="Long" resultMap="DmsPlanLubeDetailResult">
<include refid="selectDmsPlanLubeDetailVo"/>
where plan_lube_detail_id = #{planLubeDetailId}
</select>
<insert id="insertDmsPlanLubeDetail" parameterType="DmsPlanLubeDetail" useGeneratedKeys="true" keyProperty="planLubeDetailId">
insert into dms_plan_lube_detail
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="planLubeId != null">plan_lube_id,</if>
<if test="deviceId != null">device_id,</if>
<if test="lubeStationId != null">lube_station_id,</if>
<if test="lubeStandardId != null">lube_standard_id,</if>
<if test="operationDescription != null">operation_description,</if>
<if test="isFlag != null">is_flag,</if>
<if test="remark != null">remark,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="planLubeId != null">#{planLubeId},</if>
<if test="deviceId != null">#{deviceId},</if>
<if test="lubeStationId != null">#{lubeStationId},</if>
<if test="lubeStandardId != null">#{lubeStandardId},</if>
<if test="operationDescription != null">#{operationDescription},</if>
<if test="isFlag != null">#{isFlag},</if>
<if test="remark != null">#{remark},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateDmsPlanLubeDetail" parameterType="DmsPlanLubeDetail">
update dms_plan_lube_detail
<trim prefix="SET" suffixOverrides=",">
<if test="planLubeId != null">plan_lube_id = #{planLubeId},</if>
<if test="deviceId != null">device_id = #{deviceId},</if>
<if test="lubeStationId != null">lube_station_id = #{lubeStationId},</if>
<if test="lubeStandardId != null">lube_standard_id = #{lubeStandardId},</if>
<if test="operationDescription != null">operation_description = #{operationDescription},</if>
<if test="isFlag != null">is_flag = #{isFlag},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where plan_lube_detail_id = #{planLubeDetailId}
</update>
<delete id="deleteDmsPlanLubeDetailByPlanLubeDetailId" parameterType="Long">
delete from dms_plan_lube_detail where plan_lube_detail_id = #{planLubeDetailId}
</delete>
<delete id="deleteDmsPlanLubeDetailByPlanLubeDetailIds" parameterType="String">
delete from dms_plan_lube_detail where plan_lube_detail_id in
<foreach item="planLubeDetailId" collection="array" open="(" separator="," close=")">
#{planLubeDetailId}
</foreach>
</delete>
</mapper>

@ -21,6 +21,8 @@
<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="DmsPlanLubeDmsPlanLubeDetailResult" type="DmsPlanLube" extends="DmsPlanLubeResult">
@ -150,4 +152,12 @@
left join dms_plan_lube_detail b on b.plan_lube_id = a.plan_lube_id
where a.plan_lube_code = #{planLubeCode}
</select>
<select id="selectPlanLubeJoinJobByPlanLubeId" parameterType="Long" resultMap="DmsPlanLubeResult">
select a.plan_lube_id, a.plan_lube_code, a.lube_level, a.lube_group, a.lube_supervisor, a.lube_time, a.time_limit, a.job_id, a.cycle_period, a.create_method, a.is_flag, a.remark, a.create_by, a.create_time,
sj.cron_expression
from dms_plan_lube a
left join sys_job sj on a.job_id = sj.job_id
where a.plan_lube_id = #{planLubeId}
</select>
</mapper>

@ -17,14 +17,7 @@
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<el-form-item label="设备名称" prop="deviceName">
<el-input
v-model="queryParams.deviceName"
placeholder="请输入设备名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<!-- <el-form-item label="润滑级别1-日常润滑2-月度润滑3-年度润滑" prop="lubeLevel">-->
<!-- <el-input-->
<!-- v-model="queryParams.lubeLevel"-->
@ -48,73 +41,7 @@
/>
</el-select>
</el-form-item>
<!-- <el-form-item label="润滑组别" prop="lubeGroup">-->
<!-- <el-input-->
<!-- v-model="queryParams.lubeGroup"-->
<!-- placeholder="请输入润滑组别"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="润滑负责人" prop="lubeSupervisor">-->
<!-- <el-input-->
<!-- v-model="queryParams.lubeSupervisor"-->
<!-- placeholder="请输入润滑负责人"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="本次润滑时间" prop="lubeTime">-->
<!-- <el-date-picker clearable-->
<!-- v-model="queryParams.lubeTime"-->
<!-- type="date"-->
<!-- value-format="yyyy-MM-dd"-->
<!-- placeholder="请选择本次润滑时间">-->
<!-- </el-date-picker>-->
<!-- </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="循环周期" prop="cyclePeriod">-->
<!-- <el-input-->
<!-- v-model="queryParams.cyclePeriod"-->
<!-- placeholder="请输入循环周期"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="创建方式1-人工创建2-自动创建" prop="createMethod">-->
<!-- <el-input-->
<!-- v-model="queryParams.createMethod"-->
<!-- placeholder="请输入创建方式1-人工创建2-自动创建"-->
<!-- clearable-->
<!-- @keyup.enter.native="handleQuery"-->
<!-- />-->
<!-- </el-form-item>-->
<!-- <el-form-item label="是否标识1-是0-否" prop="isFlag">-->
<!-- <el-input-->
<!-- v-model="queryParams.isFlag"-->
<!-- placeholder="请输入是否标识1-是0-否"-->
<!-- 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>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery"></el-button>
@ -154,7 +81,7 @@
v-hasPermi="['dms:lube:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<!--el-col :span="1.5">
<el-button
type="warning"
plain
@ -163,7 +90,7 @@
@click="handleExport"
v-hasPermi="['dms:lube:export']"
>导出</el-button>
</el-col>
</el-col-->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
@ -172,18 +99,6 @@
<!-- <el-table-column label="主键标识" align="center" prop="planLubeId" />-->
<el-table-column label="计划编号" align="center" prop="planLubeCode" />
<!-- <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">
<span
v-for="(item, index) in ledgerList"
:key="index"
:value="item.ledgerList"
v-if="scope.row.deviceId == item.deviceId"
>
{{ item.deviceName }}
</span>
</template>
</el-table-column>
<!-- <el-table-column label="润滑级别1-日常润滑2-月度润滑3-年度润滑" align="center" prop="lubeLevel" />-->
<el-table-column label="润滑级别" align="center" prop="lubeLevel">
<template slot-scope="scope">
@ -211,15 +126,18 @@
<!-- </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-是0-否" align="center" prop="isFlag" />-->
<el-table-column label="备注" align="center" prop="remark" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-right"
@click="openLubeDetailPage(scope.row)"
>计划明细
</el-button>
<el-button
size="mini"
type="text"
@ -249,22 +167,9 @@
<!-- 添加或修改润滑计划对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="100px">
<el-form-item label="计划编号" prop="planLubeCode">
<el-input v-model="form.planLubeCode" placeholder="请输入计划编号" />
</el-form-item>
<!-- <el-form-item label="润滑设备ID,关联dms_base_device_ledger的device_id" prop="deviceId">-->
<!-- <el-input v-model="form.deviceId" placeholder="请输入润滑设备ID,关联dms_base_device_ledger的device_id" />-->
<!-- </el-form-item>-->
<el-form-item label="设备名称" prop="deviceId" >
<el-select v-model="form.deviceId" placeholder="请选择设备" >
<el-option
v-for="item in ledgerList"
:key="item.deviceId"
:label="item.deviceName"
:value="item.deviceId">
</el-option>
</el-select>
</el-form-item>
<!-- <el-form-item label="润滑级别1-日常润滑2-月度润滑3-年度润滑" prop="lubeLevel">-->
<!-- <el-input v-model="form.lubeLevel" placeholder="请输入润滑级别1-日常润滑2-月度润滑3-年度润滑" />-->
<!-- </el-form-item>-->
@ -312,11 +217,11 @@
<!-- <el-form-item label="关联sys_job主键" prop="jobId">-->
<!-- <el-input v-model="form.jobId" placeholder="请输入关联sys_job主键" />-->
<!-- </el-form-item>-->
<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="请输入定时计划">
<template slot="append">
<el-button type="primary" @click="handleShowCron">
生成表达式
生成计划表达式
<i class="el-icon-time el-icon--right"></i>
</el-button>
</template>
@ -328,15 +233,6 @@
<!-- <el-form-item label="创建方式1-人工创建2-自动创建" prop="createMethod">-->
<!-- <el-input v-model="form.createMethod" placeholder="请输入创建方式1-人工创建2-自动创建" />-->
<!-- </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="(dict.value)"
>{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item>
<!-- <el-form-item label="是否标识1-是0-否" prop="isFlag">-->
<!-- <el-input v-model="form.isFlag" placeholder="请输入是否标识1-是0-否" />-->
<!-- </el-form-item>-->
@ -416,8 +312,8 @@ export default {
deviceId: [
{ required: true, message: "润滑设备ID,关联dms_base_device_ledger的device_id不能为空", trigger: "blur" }
],
isFlag: [
{ required: true, message: "是否标识1-是0-否不能为空", trigger: "blur" }
cronExpression: [
{ required: true, message: "定时计划不能为空", trigger: "blur" }
],
}
};
@ -549,7 +445,18 @@ export default {
this.download('dms/lube/export', {
...this.queryParams
}, `lube_${new Date().getTime()}.xlsx`)
}
},
/** 润滑计划明细 */
openLubeDetailPage(row) {
const planLubeId = row.planLubeId || this.ids[0];
const planLubeCode = row.planLubeCode;
const params = {pageNum: this.queryParams.pageNum};
this.$router.push('/dms/lubeDetail/index/' + planLubeId+'/' + planLubeCode)
},
}
};
</script>

@ -0,0 +1,423 @@
<template>
<div class="app-container">
<h4 class="form-header h4">润滑计划信息</h4>
<el-form label-width="120px">
<el-row>
<el-col :span="8" :offset="2">
<el-form-item label="润滑计划编号" prop="planRepairId">
<el-input v-model="this.planLubeCode" disabled />
</el-form-item>
</el-col>
</el-row>
</el-form>
<h4 class="form-header h4">详细信息</h4>
<el-row :gutter="10" class="mb8">
<el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['dms:lubeDetail:add']"
>新增</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="lubeDetailList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="设备名称" align="center" prop="deviceId" >
<template slot-scope="scope">
<span
v-for="(item, index) in ledgerList"
:key="index"
:value="item.ledgerList"
v-if="scope.row.deviceId == item.deviceId"
>
{{ item.deviceName }}
</span>
</template>
</el-table-column>
<el-table-column label="润滑部位" align="center" prop="lubeStationId" >
<template slot-scope="scope">
<span
v-for="(item, index) in stationList"
:key="index"
:value="item.stationList"
v-if="scope.row.lubeStationId == item.lubeStationId"
>
{{ item.lubeStationName }}
</span>
</template>
</el-table-column>
<el-table-column label="润滑标准" align="center" prop="lubeStandardId" >
<template slot-scope="scope">
<span
v-for="(item, index) in standardList"
:key="index"
:value="item.standardList"
v-if="scope.row.lubeStandardId == item.lubeStandardId"
>
{{ item.lubeProtocol }}
</span>
</template>
</el-table-column>
<el-table-column label="操作描述" align="center" prop="operationDescription" />
<!-- <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">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['dms:lubeDetail:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['dms:lubeDetail:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<el-dialog :title="titleCheck" :visible.sync="openCheck" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="计划编号" prop="planLubeCode">
<el-input v-model="form.planLubeCode" :disabled="true"/>
</el-form-item>
<el-form-item label="保养级别" prop="lubeLevel">
<el-radio-group v-model="form.lubeLevel" :disabled="true">
<el-radio
v-for="dict in dict.type.dms_lube_level"
:key="dict.value"
:label="parseInt(dict.value)"
>{{dict.label}}</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="保养组别" prop="lubeGroup" >
<el-input v-model="form.lubeGroup" placeholder="请输入保养组别":disabled="true" />
</el-form-item>
<el-form-item label="循环周期" prop="cyclePeriod" >
<el-input v-model="form.cyclePeriod" placeholder="请输入循环周期" :disabled="true"/>
</el-form-item>
<!-- <el-form-item label="创建方式1-人工创建2-自动创建" prop="createMethod">-->
<!-- <el-input v-model="form.createMethod" placeholder="请输入创建方式1-人工创建2-自动创建" />-->
<!-- </el-form-item>-->
<el-form-item label="创建方式" prop="createMethod" >
<el-radio-group v-model="form.createMethod" :disabled="true">
<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="保养负责人" prop="lubeSupervisor">
<el-input v-model="form.lubeSupervisor" placeholder="请输入保养负责人" />
</el-form-item>
<el-form-item label="本次保养时间" prop="lubeTime">
<el-date-picker clearable
v-model="form.lubeTime"
type="date"
value-format="yyyy-MM-dd"
placeholder="请选择本次保养时间">
</el-date-picker>
</el-form-item>
<el-form-item label="保养状态" prop="lubeStatus">
<el-radio-group v-model="form.lubeStatus">
<el-radio
v-for="dict in dict.type.dms_lube_status"
: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>-->
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancelCheck"> </el-button>
</div>
</el-dialog>
<!-- 添加或修改保养计划明细对话框 -->
<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="deviceId" >
<el-select v-model="form.deviceId" placeholder="请选择设备">
<el-option
v-for="item in ledgerList"
:key="item.deviceId"
:label="item.deviceName"
:value="item.deviceId">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="保养部位" prop="lubeStationId" >
<el-select v-model="form.lubeStationId" placeholder="请选择设备">
<el-option
v-for="item in stationList"
:key="item.lubeStationId"
:label="item.lubeStationName"
:value="item.lubeStationId">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="保养标准" prop="lubeStandardId" >
<el-select v-model="form.lubeStandardId" placeholder="请选择标准">
<el-option
v-for="item in standardList"
:key="item.lubeStandardId"
:label="item.lubeProtocol"
:value="item.lubeStandardId">
</el-option>
</el-select>
</el-form-item>
<el-form-item label="操作描述" prop="operationDescription">
<el-input v-model="form.operationDescription" placeholder="请输入操作描述" />
</el-form-item>
<!-- <el-form-item label="是否标识1-是2-否" prop="isFlag">-->
<!-- <el-input v-model="form.isFlag" placeholder="请输入是否标识1-是2-否" />-->
<!-- </el-form-item>-->
<el-form-item label="备注" prop="remark">
<el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listDmsPlanLubeDetail, getDmsPlanLubeDetail, delDmsPlanLubeDetail,
addDmsPlanLubeDetail, updateDmsPlanLubeDetail,
getLubeStations,getLubeStandards,getBaseDeviceLedgers
} from "@/api/dms/dmsPlanLubeDetail";import { listLedger } from '@/api/dms/ledger'
export default {
name: "LubeDetail",
dicts:['dms_lube_level','dms_create_method','dms_lube_status'],
data() {
return {
lubeList:[],
stationList:[],
ledgerList:[],
standardList:[],
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
lubeDetailList: [],
planLubeId:"",
planLubeCode:"",
//
title: "",
titleCheck:"",
//
open: false,
openCheck:false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
planLubeId: null,
deviceId: null,
lubeStationId: null,
lubeStandardId: null,
operationDescription: null,
isFlag: null,
},
//
form: {},
//
rules: {
// deviceId: [
// { required: true, message: "IDdms_base_device_ledgerdevice_id", trigger: "blur" }
// ],
// isFlag: [
// { required: true, message: "1-2-", trigger: "blur" }
// ],
}
};
},
created() {
const planLubeId = this.$route.params && this.$route.params.planLubeId;
const planLubeCode = this.$route.params && this.$route.params.planLubeCode;
this.planLubeId = planLubeId;
this.planLubeCode = planLubeCode;
this.queryParams.planLubeId = planLubeId;
this.getList(planLubeId);
this.getDeviceLedger();
this.getStation();
this.getStandard();
},
methods: {
/** 查询润滑标准信息列表 */
getStandard() {
getLubeStandards().then(response => {
this.standardList = response.data;
});
},
/** 查询润滑部位信息列表 */
getStation() {
getLubeStations().then(response => {
this.stationList = response.data;
});
},
/** 查询设备台账信息列表 */
getDeviceLedger() {
getBaseDeviceLedgers().then(response => {
this.ledgerList = response.data;
});
},
/** 查询润滑计划明细列表 */
getList() {
this.loading = true;
listDmsPlanLubeDetail({planLubeId:this.planLubeId}).then(response => {
this.lubeDetailList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
cancel() {
this.open = false;
this.reset();
},
cancelCheck() {
this.openCheck = false;
this.reset();
},
//
reset() {
this.form = {
planLubeDetailId: null,
planLubeId: null,
deviceId: null,
lubeStationId: null,
lubeStandardId: null,
operationDescription: null,
isFlag: null,
remark: null,
createBy: null,
createTime: null,
updateBy: null,
updateTime: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.planLubeDetailId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.form.planLubeId = this.planLubeId;
this.open = true;
this.title = "添加保养计划明细";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const planLubeDetailId = row.planLubeDetailId || this.ids
getDmsPlanLubeDetail(planLubeDetailId).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改保养计划明细信息";
});
},
/** 修改按钮操作 */
handleUpdateCheck(row) {
this.reset();
const planLubeId = row.planLubeId || this.ids
getLube(planLubeId).then(response => {
this.form = response.data;
this.openCheck = true;
this.titleCheck = "修改保养计划信息";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.planLubeDetailId != null) {
updateDmsPlanLubeDetail(this.form).then(response => {
this.$modal.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addDmsPlanLubeDetail(this.form).then(response => {
this.$modal.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const planLubeDetailIds = row.planLubeDetailId || this.ids;
this.$modal.confirm('是否确认删除保养计划明细编号为"' + planLubeDetailIds + '"的数据项?').then(function() {
return delDmsPlanLubeDetail(planLubeDetailIds);
}).then(() => {
this.getList();
this.$modal.msgSuccess("删除成功");
}).catch(() => {});
},
}
};
</script>

@ -114,7 +114,7 @@
v-hasPermi="['dms:maint:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<!--el-col :span="1.5">
<el-button
type="warning"
plain
@ -123,7 +123,7 @@
@click="handleExport"
v-hasPermi="['dms:maint:export']"
>导出</el-button>
</el-col>
</el-col-->
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
@ -159,7 +159,7 @@
<el-button
size="mini"
type="text"
icon="el-icon-s-order"
icon="el-icon-right"
@click="jumpToDetail(scope.row)"
v-hasPermi="['dms:checkplan:edit']"
>计划明细</el-button>
@ -359,7 +359,7 @@ export default {
},
//
jumpToDetail(row){
this.$router.push('/dms/maintDetail/index/' + row.planMaintId)
this.$router.push('/dms/maintDetail/index/' + row.planMaintId+'/' + row.planMaintCode)
},
//
getDevice(){

@ -5,7 +5,7 @@
<el-row>
<el-col :span="8" :offset="2">
<el-form-item label="保养计划编号" prop="planRepairId">
<el-input v-model="this.planMaintIdCheck" disabled />
<el-input v-model="this.planMaintCode" disabled />
</el-form-item>
</el-col>
<!-- <el-col :span="8" :offset="2">-->
@ -359,6 +359,7 @@ export default {
//
maintDetailList: [],
planMaintIdCheck:"",
planMaintCode:"",
//
title: "",
titleCheck:"",
@ -394,8 +395,10 @@ export default {
},
created() {
const planMaintId = this.$route.params && this.$route.params.planMaintId;
const planMaintCode = this.$route.params && this.$route.params.planMaintCode;
// console.log(planMaintId)
this.planMaintIdCheck = planMaintId;
this.planMaintCode = planMaintCode;
this.queryParams.planMaintId = planMaintId;
this.getList(planMaintId);
this.getDeviceLedger();

Loading…
Cancel
Save