点检计划、保养计划合二为一

This commit is contained in:
JinLu.Yin 2022-06-19 17:23:27 +08:00
parent 1e1cc2fd09
commit 917f34db7c
4 changed files with 59 additions and 22 deletions

View File

@ -3,7 +3,12 @@ package com.ktg.mes.dv.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import cn.hutool.core.collection.CollUtil;
import com.ktg.common.constant.UserConstants;
import com.ktg.mes.dv.domain.DvCheckMachinery;
import com.ktg.mes.dv.domain.DvCheckSubject;
import com.ktg.mes.dv.service.IDvCheckMachineryService;
import com.ktg.mes.dv.service.IDvCheckSubjectService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@ -36,6 +41,12 @@ public class DvCheckPlanController extends BaseController
@Autowired
private IDvCheckPlanService dvCheckPlanService;
@Autowired
IDvCheckMachineryService dvCheckMachineryService;
@Autowired
IDvCheckSubjectService dvCheckSubjectService;
/**
* 查询设备点检计划头列表
*/
@ -90,6 +101,21 @@ public class DvCheckPlanController extends BaseController
@PutMapping
public AjaxResult edit(@RequestBody DvCheckPlan dvCheckPlan)
{
if(UserConstants.ORDER_STATUS_FINISHED.equals(dvCheckPlan.getStatus())){
DvCheckMachinery para1 = new DvCheckMachinery();
para1.setPlanId(dvCheckPlan.getPlanId());
List<DvCheckMachinery> machinerys = dvCheckMachineryService.selectDvCheckMachineryList(para1);
if(!CollUtil.isNotEmpty(machinerys)){
return AjaxResult.error("请指定设备!");
}
DvCheckSubject para2 = new DvCheckSubject();
para2.setPlanId(dvCheckPlan.getPlanId());
List<DvCheckSubject> subjects = dvCheckSubjectService.selectDvCheckSubjectList(para2);
if(!CollUtil.isNotEmpty(subjects)){
return AjaxResult.error("请指定项目!");
}
}
return toAjax(dvCheckPlanService.updateDvCheckPlan(dvCheckPlan));
}

View File

@ -28,6 +28,8 @@ public class DvCheckPlan extends BaseEntity
@Excel(name = "计划名称")
private String planName;
private String planType;
/** 开始日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "开始日期", width = 30, dateFormat = "yyyy-MM-dd")
@ -94,7 +96,15 @@ public class DvCheckPlan extends BaseEntity
this.startDate = startDate;
}
public Date getStartDate()
public String getPlanType() {
return planType;
}
public void setPlanType(String planType) {
this.planType = planType;
}
public Date getStartDate()
{
return startDate;
}
@ -173,24 +183,20 @@ public class DvCheckPlan extends BaseEntity
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("planId", getPlanId())
.append("planCode", getPlanCode())
.append("planName", getPlanName())
.append("startDate", getStartDate())
.append("endDate", getEndDate())
.append("cycleType", getCycleType())
.append("cycleCount", getCycleCount())
.append("status", getStatus())
.append("remark", getRemark())
.append("attr1", getAttr1())
.append("attr2", getAttr2())
.append("attr3", getAttr3())
.append("attr4", getAttr4())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
return "DvCheckPlan{" +
"planId=" + planId +
", planCode='" + planCode + '\'' +
", planName='" + planName + '\'' +
", planType='" + planType + '\'' +
", startDate=" + startDate +
", endDate=" + endDate +
", cycleType='" + cycleType + '\'' +
", cycleCount=" + cycleCount +
", status='" + status + '\'' +
", attr1='" + attr1 + '\'' +
", attr2='" + attr2 + '\'' +
", attr3=" + attr3 +
", attr4=" + attr4 +
'}';
}
}

View File

@ -46,7 +46,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="checkMachineryUnique" parameterType="DvCheckMachinery" resultMap="DvCheckMachineryResult">
<include refid="selectDvCheckMachineryVo"/>
where machinery_id = #{machineryId} limit 1
where machinery_id = #{machineryId} and plan_type = #{planType} limit 1
</select>
<insert id="insertDvCheckMachinery" parameterType="DvCheckMachinery" useGeneratedKeys="true" keyProperty="recordId">

View File

@ -8,6 +8,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="planId" column="plan_id" />
<result property="planCode" column="plan_code" />
<result property="planName" column="plan_name" />
<result property="planType" column="plan_type" />
<result property="startDate" column="start_date" />
<result property="endDate" column="end_date" />
<result property="cycleType" column="cycle_type" />
@ -25,7 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectDvCheckPlanVo">
select plan_id, plan_code, plan_name, start_date, end_date, cycle_type, cycle_count,status, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from dv_check_plan
select plan_id, plan_code, plan_name,plan_type, start_date, end_date, cycle_type, cycle_count,status, remark, attr1, attr2, attr3, attr4, create_by, create_time, update_by, update_time from dv_check_plan
</sql>
<select id="selectDvCheckPlanList" parameterType="DvCheckPlan" resultMap="DvCheckPlanResult">
@ -33,6 +34,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<where>
<if test="planCode != null and planCode != ''"> and plan_code = #{planCode}</if>
<if test="planName != null and planName != ''"> and plan_name like concat('%', #{planName}, '%')</if>
<if test="planType != null and planType != ''"> and plan_type = #{planType}</if>
<if test="startDate != null "> and start_date = #{startDate}</if>
<if test="endDate != null "> and end_date = #{endDate}</if>
<if test="cycleType != null and cycleType != ''"> and cycle_type = #{cycleType}</if>
@ -56,6 +58,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="planCode != null and planCode != ''">plan_code,</if>
<if test="planName != null">plan_name,</if>
<if test="planType != null and planType != ''">plan_type,</if>
<if test="startDate != null">start_date,</if>
<if test="endDate != null">end_date,</if>
<if test="cycleType != null">cycle_type,</if>
@ -74,6 +77,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="planCode != null and planCode != ''">#{planCode},</if>
<if test="planName != null">#{planName},</if>
<if test="planType != null and planType != ''">#{planType},</if>
<if test="startDate != null">#{startDate},</if>
<if test="endDate != null">#{endDate},</if>
<if test="cycleType != null">#{cycleType},</if>
@ -96,6 +100,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="SET" suffixOverrides=",">
<if test="planCode != null and planCode != ''">plan_code = #{planCode},</if>
<if test="planName != null">plan_name = #{planName},</if>
<if test="planType != null and planType != ''">plan_type = #{planType},</if>
<if test="startDate != null">start_date = #{startDate},</if>
<if test="endDate != null">end_date = #{endDate},</if>
<if test="cycleType != null">cycle_type = #{cycleType},</if>