保养计划

highway
wws 1 year ago
parent c0daf9a89a
commit 35b354562b

@ -3,6 +3,7 @@ package com.op.device.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.op.device.domain.EquPlanEqu;
import com.op.device.service.IEquUpkeepService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@ -34,6 +35,17 @@ public class EquUpkeepController extends BaseController {
@Autowired
private IEquUpkeepService equUpkeepService;
/**
* -
*
* @param equPlanEquList
* @return
*/
@PostMapping("/formatEquItem")
public AjaxResult formatEquItem(@RequestBody List<EquPlanEqu> equPlanEquList) {
return equUpkeepService.formatEquItem(equPlanEquList);
}
/**
*
*/

@ -131,6 +131,39 @@ public class EquOrder extends BaseEntity {
private EquOrderEqu equ;
// 保养类型
private String upkeep;
// 计划保养时间计算规则
private String calculationRule;
// 是否停机保养
private String shutDown;
public String getShutDown() {
return shutDown;
}
public void setShutDown(String shutDown) {
this.shutDown = shutDown;
}
public String getCalculationRule() {
return calculationRule;
}
public void setCalculationRule(String calculationRule) {
this.calculationRule = calculationRule;
}
public String getUpkeep() {
return upkeep;
}
public void setUpkeep(String upkeep) {
this.upkeep = upkeep;
}
public EquOrderEqu getEqu() {
return equ;
}

@ -5,6 +5,7 @@ import java.util.List;
import com.op.device.domain.EquCheckItem;
import com.op.device.domain.EquPlanDetail;
import com.op.device.domain.vo.EquCheckItemVO;
import org.apache.ibatis.annotations.Param;
/**
* Mapper
@ -85,7 +86,7 @@ public interface EquCheckItemMapper {
* @param equipmentCode
* @return
*/
List<EquCheckItem> selectCheckItemByEquipmentCode(String equipmentCode);
List<EquCheckItem> selectCheckItemByEquipmentCode(@Param("equipmentCode") String equipmentCode,@Param("type") String type);
/**
*

@ -3,7 +3,9 @@ package com.op.device.service;
import java.util.List;
import com.op.common.core.web.domain.AjaxResult;
import com.op.device.domain.EquPlan;
import com.op.device.domain.EquPlanEqu;
/**
* Service
@ -59,4 +61,12 @@ public interface IEquUpkeepService {
* @return
*/
public int deleteEquPlanByPlanId(String planId);
/**
* -
*
* @param equPlanEquList
* @return
*/
AjaxResult formatEquItem(List<EquPlanEqu> equPlanEquList);
}

@ -22,6 +22,7 @@ import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import static com.op.common.core.web.domain.AjaxResult.error;
import static com.op.common.core.web.domain.AjaxResult.success;
/**
@ -241,7 +242,7 @@ public class EquPlanServiceImpl implements IEquPlanService {
StringBuilder itemTempName = new StringBuilder();
// 获取检查项list
List<EquCheckItem> equCheckItemList = equCheckItemMapper.selectCheckItemByEquipmentCode(data.getEquipmentCode());
List<EquCheckItem> equCheckItemList = equCheckItemMapper.selectCheckItemByEquipmentCode(data.getEquipmentCode(),"inspection");
if (equCheckItemList.size() > 0) {
for (EquCheckItem checkItem : equCheckItemList) {
if (!checkItem.getItemCode().isEmpty()) {
@ -258,6 +259,8 @@ public class EquPlanServiceImpl implements IEquPlanService {
}
data.setEquCheckItemList(equCheckItemList);
data.setItemTempName(itemTempName.toString());
}else {
return error(500,"存在设备未设置巡检项!");
}
}
return success(equPlanEquList);

@ -2,7 +2,13 @@ package com.op.device.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.web.domain.AjaxResult;
import com.op.device.domain.EquCheckItem;
import com.op.device.domain.EquCheckItemDetail;
import com.op.device.domain.EquPlan;
import com.op.device.domain.EquPlanEqu;
import com.op.device.mapper.EquCheckItemDetailMapper;
import com.op.device.mapper.EquCheckItemMapper;
import com.op.device.mapper.EquPlanMapper;
import com.op.device.service.IEquUpkeepService;
import org.springframework.beans.factory.annotation.Autowired;
@ -10,11 +16,18 @@ import org.springframework.stereotype.Service;
import java.util.List;
import static com.op.common.core.web.domain.AjaxResult.error;
import static com.op.common.core.web.domain.AjaxResult.success;
@Service
public class EquUpkeepServiceImpl implements IEquUpkeepService {
@Autowired
private EquPlanMapper equPlanMapper;
@Autowired
private EquCheckItemMapper equCheckItemMapper;
@Autowired
private EquCheckItemDetailMapper equCheckItemDetailMapper;
/**
*
@ -89,4 +102,42 @@ public class EquUpkeepServiceImpl implements IEquUpkeepService {
public int deleteEquPlanByPlanId(String planId) {
return equPlanMapper.deleteEquPlanByPlanId(planId);
}
/**
* -
*
* @param equPlanEquList
* @return
*/
@Override
@DS("#header.poolName")
public AjaxResult formatEquItem(List<EquPlanEqu> equPlanEquList) {
for (EquPlanEqu data : equPlanEquList) {
StringBuilder itemTempName = new StringBuilder();
// 获取检查项list
List<EquCheckItem> equCheckItemList = equCheckItemMapper.selectCheckItemByEquipmentCode(data.getEquipmentCode(),"maintenance");
if (equCheckItemList.size() > 0) {
for (EquCheckItem checkItem : equCheckItemList) {
if (!checkItem.getItemCode().isEmpty()) {
itemTempName.append(checkItem.getItemName()).append(",");
// 获取检查项详情list
List<EquCheckItemDetail> equCheckItemDetailList = equCheckItemDetailMapper.selectCheckItemDetailByItemCode(checkItem.getItemCode());
if (equCheckItemList.size() > 0) {
for (EquCheckItemDetail detail : equCheckItemDetailList) {
detail.setShowFlag(true);
}
checkItem.setEquCheckItemDetailList(equCheckItemDetailList);
}
}
}
data.setEquCheckItemList(equCheckItemList);
data.setItemTempName(itemTempName.toString());
}else {
return error(500,"存在设备未设置保养项!");
}
}
return success(equPlanEquList);
}
}

@ -74,7 +74,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectCheckItemByEquipmentCode" parameterType="String" resultMap="EquCheckItemResult">
<include refid="selectEquCheckItemVo"/>
where item_code in ( select item_code from equ_item_equipment where equipment_code = #{equipmentCode} and del_flag = '0' ) and del_flag = '0'
where item_code in ( select item_code from equ_item_equipment where equipment_code = #{equipmentCode} and del_flag = '0' ) and del_flag = '0' and item_type = #{type}
</select>
<select id="checkDelItem" resultType="com.op.device.domain.EquPlanDetail">

@ -33,10 +33,13 @@
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="upkeep" column="upkeep" />
<result property="calculationRule" column="calculation_rule" />
<result property="shutDown" column="shut_down" />
</resultMap>
<sql id="selectEquOrderVo">
select order_id, plan_id, plan_code, plan_type, order_code, plan_workshop, plan_prod_line, plan_loop, plan_loop_type, plan_loop_start, plan_loop_end, order_start, order_end, equipment_code, order_status, order_cost, plan_person, order_cost_time, order_sign_person, factory_code, attr1, attr2, attr3, del_flag, create_by, create_time, update_by, update_time from equ_order
select order_id, plan_id, plan_code, plan_type, order_code, plan_workshop, plan_prod_line, plan_loop, plan_loop_type, plan_loop_start, plan_loop_end, order_start, order_end, equipment_code, order_status, order_cost, plan_person, order_cost_time, order_sign_person, factory_code, attr1, attr2, attr3, del_flag, create_by, create_time, update_by, update_time,upkeep,calculation_rule,shut_down from equ_order
</sql>
<select id="selectEquOrderList" parameterType="EquOrder" resultMap="EquOrderResult">
@ -69,6 +72,9 @@
<if test="createTime != null "> and create_time = #{createTime}</if>
<if test="updateBy != null and updateBy != ''"> and update_by like concat('%', #{updateBy}, '%')</if>
<if test="updateTime != null "> and update_time = #{updateTime}</if>
<if test="upkeep != null "> and upkeep = #{upkeep}</if>
<if test="calculationRule != null "> and calculation_rule = #{calculationRule}</if>
<if test="shutDown != null "> and shut_down = #{shutDown}</if>
</where>
and del_flag = '0'
</select>
@ -131,6 +137,9 @@
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="upkeep != null">upkeep,</if>
<if test="calculationRule != null">calculation_rule,</if>
<if test="shutDown != null">shut_down,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="orderId != null">#{orderId},</if>
@ -161,6 +170,9 @@
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="upkeep != null">#{upkeep},</if>
<if test="calculationRule != null">#{calculationRule},</if>
<if test="shutDown != null">#{shutDown},</if>
</trim>
</insert>
@ -194,6 +206,9 @@
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="upkeep != null">upkeep = #{upkeep},</if>
<if test="calculationRule != null">calculation_rule = #{calculationRule},</if>
<if test="shutDown != null">shut_down = #{shutDown},</if>
</trim>
where order_id = #{orderId}
</update>

Loading…
Cancel
Save