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

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 java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import cn.hutool.core.collection.CollUtil;
import com.ktg.common.constant.UserConstants; 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.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@ -36,6 +41,12 @@ public class DvCheckPlanController extends BaseController
@Autowired @Autowired
private IDvCheckPlanService dvCheckPlanService; private IDvCheckPlanService dvCheckPlanService;
@Autowired
IDvCheckMachineryService dvCheckMachineryService;
@Autowired
IDvCheckSubjectService dvCheckSubjectService;
/** /**
* 查询设备点检计划头列表 * 查询设备点检计划头列表
*/ */
@ -90,6 +101,21 @@ public class DvCheckPlanController extends BaseController
@PutMapping @PutMapping
public AjaxResult edit(@RequestBody DvCheckPlan dvCheckPlan) 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)); return toAjax(dvCheckPlanService.updateDvCheckPlan(dvCheckPlan));
} }

View File

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

View File

@ -46,7 +46,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="checkMachineryUnique" parameterType="DvCheckMachinery" resultMap="DvCheckMachineryResult"> <select id="checkMachineryUnique" parameterType="DvCheckMachinery" resultMap="DvCheckMachineryResult">
<include refid="selectDvCheckMachineryVo"/> <include refid="selectDvCheckMachineryVo"/>
where machinery_id = #{machineryId} limit 1 where machinery_id = #{machineryId} and plan_type = #{planType} limit 1
</select> </select>
<insert id="insertDvCheckMachinery" parameterType="DvCheckMachinery" useGeneratedKeys="true" keyProperty="recordId"> <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="planId" column="plan_id" />
<result property="planCode" column="plan_code" /> <result property="planCode" column="plan_code" />
<result property="planName" column="plan_name" /> <result property="planName" column="plan_name" />
<result property="planType" column="plan_type" />
<result property="startDate" column="start_date" /> <result property="startDate" column="start_date" />
<result property="endDate" column="end_date" /> <result property="endDate" column="end_date" />
<result property="cycleType" column="cycle_type" /> <result property="cycleType" column="cycle_type" />
@ -25,7 +26,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectDvCheckPlanVo"> <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> </sql>
<select id="selectDvCheckPlanList" parameterType="DvCheckPlan" resultMap="DvCheckPlanResult"> <select id="selectDvCheckPlanList" parameterType="DvCheckPlan" resultMap="DvCheckPlanResult">
@ -33,6 +34,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<where> <where>
<if test="planCode != null and planCode != ''"> and plan_code = #{planCode}</if> <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="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="startDate != null "> and start_date = #{startDate}</if>
<if test="endDate != null "> and end_date = #{endDate}</if> <if test="endDate != null "> and end_date = #{endDate}</if>
<if test="cycleType != null and cycleType != ''"> and cycle_type = #{cycleType}</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=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="planCode != null and planCode != ''">plan_code,</if> <if test="planCode != null and planCode != ''">plan_code,</if>
<if test="planName != null">plan_name,</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="startDate != null">start_date,</if>
<if test="endDate != null">end_date,</if> <if test="endDate != null">end_date,</if>
<if test="cycleType != null">cycle_type,</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=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="planCode != null and planCode != ''">#{planCode},</if> <if test="planCode != null and planCode != ''">#{planCode},</if>
<if test="planName != null">#{planName},</if> <if test="planName != null">#{planName},</if>
<if test="planType != null and planType != ''">#{planType},</if>
<if test="startDate != null">#{startDate},</if> <if test="startDate != null">#{startDate},</if>
<if test="endDate != null">#{endDate},</if> <if test="endDate != null">#{endDate},</if>
<if test="cycleType != null">#{cycleType},</if> <if test="cycleType != null">#{cycleType},</if>
@ -96,6 +100,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="planCode != null and planCode != ''">plan_code = #{planCode},</if> <if test="planCode != null and planCode != ''">plan_code = #{planCode},</if>
<if test="planName != null">plan_name = #{planName},</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="startDate != null">start_date = #{startDate},</if>
<if test="endDate != null">end_date = #{endDate},</if> <if test="endDate != null">end_date = #{endDate},</if>
<if test="cycleType != null">cycle_type = #{cycleType},</if> <if test="cycleType != null">cycle_type = #{cycleType},</if>