点检计划

This commit is contained in:
JinLu.Yin 2022-06-16 22:16:36 +08:00
parent 9631ba6a1e
commit edb3190734
6 changed files with 571 additions and 0 deletions

View File

@ -0,0 +1,113 @@
package com.ktg.mes.dv.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.ktg.common.constant.UserConstants;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ktg.common.annotation.Log;
import com.ktg.common.core.controller.BaseController;
import com.ktg.common.core.domain.AjaxResult;
import com.ktg.common.enums.BusinessType;
import com.ktg.mes.dv.domain.DvCheckPlan;
import com.ktg.mes.dv.service.IDvCheckPlanService;
import com.ktg.common.utils.poi.ExcelUtil;
import com.ktg.common.core.page.TableDataInfo;
/**
* 设备点检计划头Controller
*
* @author yinjinlu
* @date 2022-06-16
*/
@RestController
@RequestMapping("/mes/dv/checkplan")
public class DvCheckPlanController extends BaseController
{
@Autowired
private IDvCheckPlanService dvCheckPlanService;
/**
* 查询设备点检计划头列表
*/
@PreAuthorize("@ss.hasPermi('mes:dv:checkplan:list')")
@GetMapping("/list")
public TableDataInfo list(DvCheckPlan dvCheckPlan)
{
startPage();
List<DvCheckPlan> list = dvCheckPlanService.selectDvCheckPlanList(dvCheckPlan);
return getDataTable(list);
}
/**
* 导出设备点检计划头列表
*/
@PreAuthorize("@ss.hasPermi('mes:dv:checkplan:export')")
@Log(title = "设备点检计划头", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, DvCheckPlan dvCheckPlan)
{
List<DvCheckPlan> list = dvCheckPlanService.selectDvCheckPlanList(dvCheckPlan);
ExcelUtil<DvCheckPlan> util = new ExcelUtil<DvCheckPlan>(DvCheckPlan.class);
util.exportExcel(response, list, "设备点检计划头数据");
}
/**
* 获取设备点检计划头详细信息
*/
@PreAuthorize("@ss.hasPermi('mes:dv:checkplan:query')")
@GetMapping(value = "/{planId}")
public AjaxResult getInfo(@PathVariable("planId") Long planId)
{
return AjaxResult.success(dvCheckPlanService.selectDvCheckPlanByPlanId(planId));
}
/**
* 新增设备点检计划头
*/
@PreAuthorize("@ss.hasPermi('mes:dv:checkplan:add')")
@Log(title = "设备点检计划头", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody DvCheckPlan dvCheckPlan)
{
return toAjax(dvCheckPlanService.insertDvCheckPlan(dvCheckPlan));
}
/**
* 修改设备点检计划头
*/
@PreAuthorize("@ss.hasPermi('mes:dv:checkplan:edit')")
@Log(title = "设备点检计划头", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody DvCheckPlan dvCheckPlan)
{
return toAjax(dvCheckPlanService.updateDvCheckPlan(dvCheckPlan));
}
/**
* 删除设备点检计划头
*/
@PreAuthorize("@ss.hasPermi('mes:dv:checkplan:remove')")
@Log(title = "设备点检计划头", businessType = BusinessType.DELETE)
@DeleteMapping("/{planIds}")
public AjaxResult remove(@PathVariable Long[] planIds)
{
for (Long planId:planIds
) {
DvCheckPlan plan = dvCheckPlanService.selectDvCheckPlanByPlanId(planId);
if(UserConstants.ORDER_STATUS_PREPARE.equals(plan.getStatus())){
return AjaxResult.error("只能删除草稿状态单据!");
}
}
return toAjax(dvCheckPlanService.deleteDvCheckPlanByPlanIds(planIds));
}
}

View File

@ -0,0 +1,196 @@
package com.ktg.mes.dv.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ktg.common.annotation.Excel;
import com.ktg.common.core.domain.BaseEntity;
/**
* 设备点检计划头对象 dv_check_plan
*
* @author yinjinlu
* @date 2022-06-16
*/
public class DvCheckPlan extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 计划ID */
private Long planId;
/** 计划编码 */
@Excel(name = "计划编码")
private String planCode;
/** 计划名称 */
@Excel(name = "计划名称")
private String planName;
/** 开始日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "开始日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date startDate;
/** 结束日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "结束日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date endDate;
/** 频率 */
@Excel(name = "频率")
private String cycleType;
/** 次数 */
@Excel(name = "次数")
private Long cycleCount;
/** 状态 */
@Excel(name = "状态")
private String status;
/** 预留字段1 */
private String attr1;
/** 预留字段2 */
private String attr2;
/** 预留字段3 */
private Long attr3;
/** 预留字段4 */
private Long attr4;
public void setPlanId(Long planId)
{
this.planId = planId;
}
public Long getPlanId()
{
return planId;
}
public void setPlanCode(String planCode)
{
this.planCode = planCode;
}
public String getPlanCode()
{
return planCode;
}
public void setPlanName(String planName)
{
this.planName = planName;
}
public String getPlanName()
{
return planName;
}
public void setStartDate(Date startDate)
{
this.startDate = startDate;
}
public Date getStartDate()
{
return startDate;
}
public void setEndDate(Date endDate)
{
this.endDate = endDate;
}
public Date getEndDate()
{
return endDate;
}
public void setCycleType(String cycleType)
{
this.cycleType = cycleType;
}
public String getCycleType()
{
return cycleType;
}
public void setCycleCount(Long cycleCount)
{
this.cycleCount = cycleCount;
}
public Long getCycleCount()
{
return cycleCount;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
public void setAttr1(String attr1)
{
this.attr1 = attr1;
}
public String getAttr1()
{
return attr1;
}
public void setAttr2(String attr2)
{
this.attr2 = attr2;
}
public String getAttr2()
{
return attr2;
}
public void setAttr3(Long attr3)
{
this.attr3 = attr3;
}
public Long getAttr3()
{
return attr3;
}
public void setAttr4(Long attr4)
{
this.attr4 = attr4;
}
public Long getAttr4()
{
return attr4;
}
@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();
}
}

View File

@ -0,0 +1,63 @@
package com.ktg.mes.dv.mapper;
import java.util.List;
import com.ktg.mes.dv.domain.DvCheckPlan;
/**
* 设备点检计划头Mapper接口
*
* @author yinjinlu
* @date 2022-06-16
*/
public interface DvCheckPlanMapper
{
/**
* 查询设备点检计划头
*
* @param planId 设备点检计划头主键
* @return 设备点检计划头
*/
public DvCheckPlan selectDvCheckPlanByPlanId(Long planId);
/**
* 查询设备点检计划头列表
*
* @param dvCheckPlan 设备点检计划头
* @return 设备点检计划头集合
*/
public List<DvCheckPlan> selectDvCheckPlanList(DvCheckPlan dvCheckPlan);
public DvCheckPlan checkPlanCodeUnique(DvCheckPlan dvCheckPlan);
/**
* 新增设备点检计划头
*
* @param dvCheckPlan 设备点检计划头
* @return 结果
*/
public int insertDvCheckPlan(DvCheckPlan dvCheckPlan);
/**
* 修改设备点检计划头
*
* @param dvCheckPlan 设备点检计划头
* @return 结果
*/
public int updateDvCheckPlan(DvCheckPlan dvCheckPlan);
/**
* 删除设备点检计划头
*
* @param planId 设备点检计划头主键
* @return 结果
*/
public int deleteDvCheckPlanByPlanId(Long planId);
/**
* 批量删除设备点检计划头
*
* @param planIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteDvCheckPlanByPlanIds(Long[] planIds);
}

View File

@ -0,0 +1,68 @@
package com.ktg.mes.dv.service;
import java.util.List;
import com.ktg.mes.dv.domain.DvCheckPlan;
/**
* 设备点检计划头Service接口
*
* @author yinjinlu
* @date 2022-06-16
*/
public interface IDvCheckPlanService
{
/**
* 查询设备点检计划头
*
* @param planId 设备点检计划头主键
* @return 设备点检计划头
*/
public DvCheckPlan selectDvCheckPlanByPlanId(Long planId);
/**
* 查询设备点检计划头列表
*
* @param dvCheckPlan 设备点检计划头
* @return 设备点检计划头集合
*/
public List<DvCheckPlan> selectDvCheckPlanList(DvCheckPlan dvCheckPlan);
/**
* 检查计划编码是否唯一
* @param dvCheckPlan
* @return
*/
public String checkPlanCodeUnique(DvCheckPlan dvCheckPlan);
/**
* 新增设备点检计划头
*
* @param dvCheckPlan 设备点检计划头
* @return 结果
*/
public int insertDvCheckPlan(DvCheckPlan dvCheckPlan);
/**
* 修改设备点检计划头
*
* @param dvCheckPlan 设备点检计划头
* @return 结果
*/
public int updateDvCheckPlan(DvCheckPlan dvCheckPlan);
/**
* 批量删除设备点检计划头
*
* @param planIds 需要删除的设备点检计划头主键集合
* @return 结果
*/
public int deleteDvCheckPlanByPlanIds(Long[] planIds);
/**
* 删除设备点检计划头信息
*
* @param planId 设备点检计划头主键
* @return 结果
*/
public int deleteDvCheckPlanByPlanId(Long planId);
}

View File

@ -136,6 +136,10 @@ public class ProWorkorderController extends BaseController
{ {
for (Long id:workorderIds for (Long id:workorderIds
) { ) {
ProWorkorder workorder = proWorkorderService.selectProWorkorderByWorkorderId(id);
if(!UserConstants.ORDER_STATUS_PREPARE.equals(workorder.getStatus())){
return AjaxResult.error("只能删除草稿状态单据!");
}
removeBomLine(id); removeBomLine(id);
} }
return toAjax(proWorkorderService.deleteProWorkorderByWorkorderIds(workorderIds)); return toAjax(proWorkorderService.deleteProWorkorderByWorkorderIds(workorderIds));

View File

@ -0,0 +1,127 @@
<?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.ktg.mes.dv.mapper.DvCheckPlanMapper">
<resultMap type="DvCheckPlan" id="DvCheckPlanResult">
<result property="planId" column="plan_id" />
<result property="planCode" column="plan_code" />
<result property="planName" column="plan_name" />
<result property="startDate" column="start_date" />
<result property="endDate" column="end_date" />
<result property="cycleType" column="cycle_type" />
<result property="cycleCount" column="cycle_count" />
<result property="status" column="status" />
<result property="remark" column="remark" />
<result property="attr1" column="attr1" />
<result property="attr2" column="attr2" />
<result property="attr3" column="attr3" />
<result property="attr4" column="attr4" />
<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="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
</sql>
<select id="selectDvCheckPlanList" parameterType="DvCheckPlan" resultMap="DvCheckPlanResult">
<include refid="selectDvCheckPlanVo"/>
<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="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>
<if test="cycleCount != null "> and cycle_count = #{cycleCount}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
</where>
</select>
<select id="selectDvCheckPlanByPlanId" parameterType="Long" resultMap="DvCheckPlanResult">
<include refid="selectDvCheckPlanVo"/>
where plan_id = #{planId}
</select>
<select id="checkPlanCodeUnique" parameterType="DvCheckPlan" resultMap="DvCheckPlanResult">
<include refid="selectDvCheckPlanVo"/>
where plan_code = #{planCode}
</select>
<insert id="insertDvCheckPlan" parameterType="DvCheckPlan" useGeneratedKeys="true" keyProperty="planId">
insert into dv_check_plan
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="planCode != null and planCode != ''">plan_code,</if>
<if test="planName != null">plan_name,</if>
<if test="startDate != null">start_date,</if>
<if test="endDate != null">end_date,</if>
<if test="cycleType != null">cycle_type,</if>
<if test="cycleCount != null">cycle_count,</if>
<if test="status != null and status !=''">status,</if>
<if test="remark != null">remark,</if>
<if test="attr1 != null">attr1,</if>
<if test="attr2 != null">attr2,</if>
<if test="attr3 != null">attr3,</if>
<if test="attr4 != null">attr4,</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="planCode != null and planCode != ''">#{planCode},</if>
<if test="planName != null">#{planName},</if>
<if test="startDate != null">#{startDate},</if>
<if test="endDate != null">#{endDate},</if>
<if test="cycleType != null">#{cycleType},</if>
<if test="cycleCount != null">#{cycleCount},</if>
<if test="status != null and status !=''">#{status},</if>
<if test="remark != null">#{remark},</if>
<if test="attr1 != null">#{attr1},</if>
<if test="attr2 != null">#{attr2},</if>
<if test="attr3 != null">#{attr3},</if>
<if test="attr4 != null">#{attr4},</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="updateDvCheckPlan" parameterType="DvCheckPlan">
update dv_check_plan
<trim prefix="SET" suffixOverrides=",">
<if test="planCode != null and planCode != ''">plan_code = #{planCode},</if>
<if test="planName != null">plan_name = #{planName},</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>
<if test="cycleCount != null">cycle_count = #{cycleCount},</if>
<if test="status != null and status !=''">status = #{status},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="attr1 != null">attr1 = #{attr1},</if>
<if test="attr2 != null">attr2 = #{attr2},</if>
<if test="attr3 != null">attr3 = #{attr3},</if>
<if test="attr4 != null">attr4 = #{attr4},</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_id = #{planId}
</update>
<delete id="deleteDvCheckPlanByPlanId" parameterType="Long">
delete from dv_check_plan where plan_id = #{planId}
</delete>
<delete id="deleteDvCheckPlanByPlanIds" parameterType="String">
delete from dv_check_plan where plan_id in
<foreach item="planId" collection="array" open="(" separator="," close=")">
#{planId}
</foreach>
</delete>
</mapper>