点检-巡检-保养-检查项优化

highway
wws 1 year ago
parent eef550d5ae
commit 20efabdfd1

@ -77,4 +77,11 @@ public interface EquPlanDetailMapper {
* @param planCode
*/
void delEquPlanDetailByPlanCode(String planCode);
/**
* parentCode
* @param code
* @return
*/
List<EquPlanDetail> selectEquPlanDetailListByParentCode(String code);
}

@ -64,4 +64,10 @@ public interface EquPlanEquSpareMapper {
* @param planCode
*/
void deleteEquPlanEquSpareByPlanCode(String planCode);
/**
*
* @param planCode
*/
void delEquPlanEquSpareByPlanCode(String planCode);
}

@ -77,4 +77,11 @@ public interface EquPlanStandardMapper {
* @param planCode
*/
void delEquPlanStandardByPlanCode(String planCode);
/**
* parentCode
* @param code
* @return
*/
List<EquPlanStandard> selectEquPlanStandardListByParentCode(String code);
}

@ -59,7 +59,7 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
/**
* list
* list-
*
* @return
*/
@ -145,7 +145,7 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
@DS("#header.poolName")
public AjaxResult updateInspectionRecord(EquOrder equOrder) {
boolean checkRepair = false;
boolean hasError = false;
EquOrderEqu equ = equOrder.getEqu();
List<EquOrderDetail> detailList = equ.getDetailList();
@ -176,12 +176,12 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
int up = standard.getActualValue().compareTo(standard.getDetailUpLimit());
int down = standard.getActualValue().compareTo(standard.getDetailDownLimit());
if (!(up != 1 && down != -1)) {
checkRepair = true;
hasError = true;
}
}else {
// 未达标
// TODO 未达标
if (standard.getDetailReach().equals("1")) {
checkRepair = true;
hasError = true;
}
}
@ -198,7 +198,17 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
equOrder.setPlanPerson(SecurityContextHolder.getUserName());
equOrder.setPlanPerson(SecurityContextHolder.getUserName());
if (checkRepair) {
boolean checkRepair = false;
if (equOrder.getRepairCode() == null){
checkRepair = true;
}else {
if (equOrder.getRepairCode().isEmpty()){
checkRepair = true;
}
}
if (checkRepair && hasError) {
// 获取故障报修流水号
EquRepairOrder equRepairOrder = new EquRepairOrder();
String serialNum = String.format("%03d", equRepairOrderMapper.selectOrderCodeSerialNumber());
@ -213,6 +223,16 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
equRepairOrder.setCreateTime(DateUtils.getNowDate());
equRepairOrder.setCreateBy(SecurityUtils.getUsername());
equRepairOrder.setOrderStatus("待审核");
// 报修来源
if (equOrder.getPlanType().equals("inspection")){
equRepairOrder.setOrderSource("巡检");
}
if (equOrder.getPlanType().equals("spotInspection")){
equRepairOrder.setOrderSource("点检");
}
if (equOrder.getPlanType().equals("maintenance")){
equRepairOrder.setOrderSource("保养");
}
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String key = "#header.poolName";
equRepairOrder.setFactoryCode(request.getHeader(key.substring(8)).replace("ds_",""));
@ -221,7 +241,7 @@ public class DevicePDAServiceImpl implements IDevicePDAService {
// 更新工单信息
equOrderMapper.updateEquOrder(equOrder);
return success(equOrder);
return success();
}
//////////////////////报修

@ -6,14 +6,22 @@ import java.util.List;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.op.common.core.context.SecurityContextHolder;
import com.op.common.core.domain.BaseFileData;
import com.op.common.core.utils.DateUtils;
import com.op.common.core.utils.StringUtils;
import com.op.common.core.utils.uuid.IdUtils;
import com.op.common.core.web.domain.AjaxResult;
import com.op.common.security.utils.SecurityUtils;
import com.op.device.domain.*;
import com.op.device.mapper.*;
import com.op.system.api.domain.SysUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.op.device.service.IEquOrderService;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import static com.op.common.core.web.domain.AjaxResult.success;
@ -39,6 +47,8 @@ public class EquOrderServiceImpl implements IEquOrderService {
private PersonMapper personMapper;
@Autowired
private EquOrderEquSpareMapper equOrderEquSpareMapper;
@Autowired
private EquRepairOrderMapper equRepairOrderMapper;
/**
*
@ -125,25 +135,102 @@ public class EquOrderServiceImpl implements IEquOrderService {
@Override
@DS("#header.poolName")
public AjaxResult updateEquOrder(EquOrder equOrder) {
// 更新工单信息
equOrder.setOrderStart(equOrder.getTimeArray().get(0));
equOrder.setOrderEnd(equOrder.getTimeArray().get(1));
equOrder.setUpdateTime(DateUtils.getNowDate());
equOrder.setUpdateBy(SecurityContextHolder.getUserName());
equOrder.setPlanPerson(SecurityContextHolder.getUserName());
equOrderMapper.updateEquOrder(equOrder);
boolean hasError = false;
// 更新标准信息
EquOrderEqu equ = equOrder.getEqu();
List<EquOrderDetail> detailList = equ.getDetailList();
for (EquOrderDetail detail : detailList) {
List<EquOrderStandard> standardList = detail.getStandardList();
for (EquOrderStandard standard : standardList) {
standard.setUpdateBy(SecurityContextHolder.getUserName());
//上传附件
if (StringUtils.isNotEmpty(standard.getPicturePath())) {
String[] ids = standard.getPicturePath().split(",");
List<BaseFileData> files = new ArrayList<>();
BaseFileData file = null;
for (String id : ids) {
file = new BaseFileData();
file.setFileId(IdUtils.fastSimpleUUID());
file.setFileName(id.split("&fileName=")[1]);
file.setFileAddress(id);
file.setSourceId(standard.getId());
file.setCreateBy(SecurityUtils.getUsername());
file.setCreateTime(new Date());
files.add(file);
}
equOrderStandardMapper.insertBaseFileBatch(files);
}
// 校验标准信息-是否申请报修
if (standard.getStandardType().equals("quantify")) {
int up = standard.getActualValue().compareTo(standard.getDetailUpLimit());
int down = standard.getActualValue().compareTo(standard.getDetailDownLimit());
if (!(up != 1 && down != -1)) {
hasError = true;
}
}else {
// TODO 未达标
if (standard.getDetailReach().equals("1")) {
hasError = true;
}
}
// 更新标准
standard.setUpdateTime(DateUtils.getNowDate());
equOrderStandardMapper.updateEquOrderStandard(standard);
}
}
// 更新工单信息
equOrder.setOrderStatus("1"); // 状态为已完成
equOrder.setUpdateTime(DateUtils.getNowDate());
equOrder.setUpdateBy(SecurityContextHolder.getUserName());
equOrder.setPlanPerson(SecurityContextHolder.getUserName());
equOrder.setPlanPerson(SecurityContextHolder.getUserName());
boolean checkRepair = false;
if (equOrder.getRepairCode() == null){
checkRepair = true;
}else {
if (equOrder.getRepairCode().isEmpty()){
checkRepair = true;
}
}
if (checkRepair && hasError ) {
// 获取故障报修流水号
EquRepairOrder equRepairOrder = new EquRepairOrder();
String serialNum = String.format("%03d", equRepairOrderMapper.selectOrderCodeSerialNumber());
String equipmentCode = equOrder.getEquipmentCode();
//报修单号
equRepairOrder.setOrderCode("BX"+DateUtils.dateTimeNow(DateUtils.YYYYMMDD) + equipmentCode + serialNum);
//在主表中存入报修单号信息
equOrder.setRepairCode(equRepairOrder.getOrderCode());
//新增报修记录
equRepairOrder.setOrderId(IdUtils.fastSimpleUUID());
equRepairOrder.setCreateTime(DateUtils.getNowDate());
equRepairOrder.setCreateBy(SecurityUtils.getUsername());
// 报修来源
if (equOrder.getPlanType().equals("inspection")){
equRepairOrder.setOrderSource("巡检");
}
if (equOrder.getPlanType().equals("spotInspection")){
equRepairOrder.setOrderSource("点检");
}
if (equOrder.getPlanType().equals("maintenance")){
equRepairOrder.setOrderSource("保养");
}
equRepairOrder.setOrderStatus("待审核");
HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
String key = "#header.poolName";
equRepairOrder.setFactoryCode(request.getHeader(key.substring(8)).replace("ds_",""));
equRepairOrderMapper.insertEquRepairOrder(equRepairOrder);
}
// 更新工单信息
equOrderMapper.updateEquOrder(equOrder);
return success();
}

@ -202,6 +202,8 @@ public class EquPlanServiceImpl implements IEquPlanService {
equPlanDetailMapper.delEquPlanDetailByPlanCode(equPlan.getPlanCode());
equPlanEquMapper.delEquPlanEquByPlanCode(equPlan.getPlanCode());
equPlanStandardMapper.delEquPlanStandardByPlanCode(equPlan.getPlanCode());
// TODO 有问题没有删除成功
equPlanEquSpareMapper.delEquPlanEquSpareByPlanCode(equPlan.getPlanCode());
}
return success();
}
@ -343,16 +345,10 @@ public class EquPlanServiceImpl implements IEquPlanService {
for (EquPlanEqu equipment : equipmentList) {
// 获取检查项list
EquPlanDetail selectDetail = new EquPlanDetail();
selectDetail.setParentCode(equipment.getCode());
selectDetail.setPlanCode(equPlan.getPlanCode());
List<EquPlanDetail> detailList = equPlanDetailMapper.selectEquPlanDetailList(selectDetail);
List<EquPlanDetail> detailList = equPlanDetailMapper.selectEquPlanDetailListByParentCode(equipment.getCode());
for (EquPlanDetail detail : detailList) {
// 获取标准list
EquPlanStandard selectStandard = new EquPlanStandard();
selectStandard.setParentCode(detail.getCode());
selectStandard.setPlanCode(equPlan.getPlanCode());
List<EquPlanStandard> standardList = equPlanStandardMapper.selectEquPlanStandardList(selectStandard);
List<EquPlanStandard> standardList = equPlanStandardMapper.selectEquPlanStandardListByParentCode(detail.getCode());
for (EquPlanStandard standard : standardList) {
standard.setShowFlag(true);
}
@ -433,7 +429,7 @@ public class EquPlanServiceImpl implements IEquPlanService {
if (item != null) {
item.setId(IdUtils.fastSimpleUUID());
item.setPlanCode(equPlan.getPlanCode());
item.setCode("C" + equPlan.getPlanCode() + String.format("%02d", ++itemCodeTemp));
item.setCode("C" + equipment.getCode() + String.format("%02d", ++itemCodeTemp));
item.setParentCode(equipment.getCode());
item.setCreateBy(SecurityContextHolder.getUserName());
item.setCreateTime(DateUtils.getNowDate());
@ -458,7 +454,7 @@ public class EquPlanServiceImpl implements IEquPlanService {
standard.setId(IdUtils.fastSimpleUUID());
standard.setParentCode(item.getCode());
standard.setPlanCode(equPlan.getPlanCode());
standard.setCode("D" + equPlan.getPlanCode() + String.format("%02d", ++detailCodeTemp));
standard.setCode("D" + item.getCode() + String.format("%02d", ++detailCodeTemp));
standard.setCreateBy(SecurityContextHolder.getUserName());
standard.setCreateTime(DateUtils.getNowDate());
standard.setUpdateBy(SecurityContextHolder.getUserName());

@ -209,24 +209,6 @@ public class EquUpkeepOrderServiceImpl implements IEquUpkeepOrderService {
@Override
@DS("#header.poolName")
public AjaxResult updateEquOrder(EquOrder equOrder) {
// 更新保养工单信息
equOrder.setOrderStart(equOrder.getTimeArray().get(0));
equOrder.setOrderEnd(equOrder.getTimeArray().get(1));
equOrder.setUpdateBy(SecurityContextHolder.getUserName());
equOrder.setUpdateTime(DateUtils.getNowDate());
equOrderMapper.updateEquOrder(equOrder);
// 更新标准信息
EquOrderEqu equ = equOrder.getEqu();
List<EquOrderDetail> detailList = equ.getDetailList();
for (EquOrderDetail detail : detailList) {
List<EquOrderStandard> standardList = detail.getStandardList();
for (EquOrderStandard standard : standardList) {
standard.setUpdateBy(SecurityContextHolder.getUserName());
standard.setUpdateTime(DateUtils.getNowDate());
equOrderStandardMapper.updateEquOrderStandard(standard);
}
}
return success();
}

@ -265,7 +265,7 @@ public class EquUpkeepServiceImpl implements IEquUpkeepService {
if (item != null) {
item.setId(IdUtils.fastSimpleUUID());
item.setPlanCode(equPlan.getPlanCode());
item.setCode("C" + equPlan.getPlanCode() + String.format("%02d", ++itemCodeTemp));
item.setCode("C" + equipment.getCode() + String.format("%02d", ++itemCodeTemp));
item.setParentCode(equipment.getCode());
item.setCreateBy(SecurityContextHolder.getUserName());
item.setCreateTime(DateUtils.getNowDate());
@ -290,7 +290,7 @@ public class EquUpkeepServiceImpl implements IEquUpkeepService {
standard.setId(IdUtils.fastSimpleUUID());
standard.setParentCode(item.getCode());
standard.setPlanCode(equPlan.getPlanCode());
standard.setCode("D" + equPlan.getPlanCode() + String.format("%02d", ++detailCodeTemp));
standard.setCode("D" + item.getCode() + String.format("%02d", ++detailCodeTemp));
standard.setCreateBy(SecurityContextHolder.getUserName());
standard.setCreateTime(DateUtils.getNowDate());
standard.setUpdateBy(SecurityContextHolder.getUserName());

@ -44,22 +44,23 @@
<if test="attr1 != null and attr1 != ''"> and attr1 = #{attr1}</if>
<if test="attr2 != null and attr2 != ''"> and attr2 = #{attr2}</if>
<if test="attr3 != null and attr3 != ''"> and attr3 = #{attr3}</if>
and del_flag = '0'
</where>
</select>
<select id="selectEquOrderDetailById" parameterType="String" resultMap="EquOrderDetailResult">
<include refid="selectEquOrderDetailVo"/>
where id = #{id}
where id = #{id} and del_flag = '0'
</select>
<select id="selectEquOrderDetailByParentCode" parameterType="String" resultMap="EquOrderDetailResult">
<include refid="selectEquOrderDetailVo"/>
where parent_code = #{parentCode}
where parent_code = #{parentCode} and del_flag = '0'
</select>
<select id="selectEquOrderDetailByOrderCode" parameterType="String" resultMap="EquOrderDetailResult">
<include refid="selectEquOrderDetailVo"/>
where order_code = #{orderCode}
where order_code = #{orderCode} and del_flag = '0'
</select>
<insert id="insertEquOrderDetail" parameterType="EquOrderDetail">

@ -38,17 +38,18 @@
<if test="attr1 != null and attr1 != ''"> and attr1 = #{attr1}</if>
<if test="attr2 != null and attr2 != ''"> and attr2 = #{attr2}</if>
<if test="attr3 != null and attr3 != ''"> and attr3 = #{attr3}</if>
and del_flag = '0'
</where>
</select>
<select id="selectEquOrderEquById" parameterType="String" resultMap="EquOrderEquResult">
<include refid="selectEquOrderEquVo"/>
where id = #{id}
where id = #{id} and del_flag = '0'
</select>
<select id="selectEquOrderEquListByParentCode" parameterType="String" resultMap="EquOrderEquResult">
<include refid="selectEquOrderEquVo"/>
where parent_code = #{parentCode}
where parent_code = #{parentCode} and del_flag = '0'
</select>
<insert id="insertEquOrderEqu" parameterType="EquOrderEqu">
@ -107,7 +108,7 @@
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
where id = #{id} and del_flag = '0'
</update>
<delete id="deleteEquOrderEquById" parameterType="String">

@ -42,22 +42,23 @@
<if test="attr1 != null and attr1 != ''"> and attr1 = #{attr1}</if>
<if test="attr2 != null and attr2 != ''"> and attr2 = #{attr2}</if>
<if test="attr3 != null and attr3 != ''"> and attr3 = #{attr3}</if>
and del_flag = '0'
</where>
</select>
<select id="selectEquOrderEquSpareById" parameterType="String" resultMap="EquOrderEquSpareResult">
<include refid="selectEquOrderEquSpareVo"/>
where id = #{id}
where id = #{id} and del_flag = '0'
</select>
<select id="selectEquOrderEquSpareByParentCode" parameterType="String" resultMap="EquOrderEquSpareResult">
<include refid="selectEquOrderEquSpareVo"/>
where parent_code = #{parentCode}
where parent_code = #{parentCode} and del_flag = '0'
</select>
<select id="selectEquOrderEquSpareByOrderCode" parameterType="String" resultMap="EquOrderEquSpareResult">
<include refid="selectEquOrderEquSpareVo"/>
where order_code = #{orderCode}
where order_code = #{orderCode} and del_flag = '0'
</select>
<insert id="insertEquOrderEquSpare" parameterType="EquOrderEquSpare">
@ -122,7 +123,7 @@
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
where id = #{id} and del_flag = '0'
</update>
<delete id="deleteEquOrderEquSpareById" parameterType="String">

@ -85,7 +85,7 @@
<select id="selectEquOrderByOrderCode" parameterType="String" resultMap="EquOrderResult">
<include refid="selectEquOrderVo"/>
where order_code = #{orderCode}
where order_code = #{orderCode} and del_flag = '0'
</select>
<select id="selectPlanNameByPlanCode" resultType="java.lang.String">
@ -112,7 +112,7 @@
<select id="selectEquOrderByOrderId" parameterType="String" resultMap="EquOrderResult">
<include refid="selectEquOrderVo"/>
where order_id = #{orderId}
where order_id = #{orderId} and del_flag = '0'
</select>
<select id="selectSerialNumber" resultType="java.lang.Integer">

@ -34,16 +34,17 @@
<if test="attr1 != null and attr1 != ''"> and attr1 = #{attr1}</if>
<if test="attr2 != null and attr2 != ''"> and attr2 = #{attr2}</if>
<if test="attr3 != null and attr3 != ''"> and attr3 = #{attr3}</if>
and del_flag = '0'
</where>
</select>
<select id="selectEquOrderPersonById" parameterType="String" resultMap="EquOrderPersonResult">
<include refid="selectEquOrderPersonVo"/>
where id = #{id}
where id = #{id} and del_flag = '0'
</select>
<select id="selectEquOrderPersonByOrderCode" resultType="java.lang.String">
SELECT user_id FROM equ_order_person where order_code = #{orderCode}
SELECT user_id FROM equ_order_person where order_code = #{orderCode} and del_flag = '0'
</select>
<insert id="insertEquOrderPerson" parameterType="EquOrderPerson">
@ -96,7 +97,7 @@
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
where id = #{id} and del_flag = '0'
</update>
<delete id="deleteEquOrderPersonById" parameterType="String">

@ -62,17 +62,18 @@
<if test="repairReach != null and repairReach != ''"> and repair_reach = #{repairReach}</if>
<if test="repairValue != null and repairValue != ''"> and repair_value = #{repairValue}</if>
<if test="repairPicture != null and repairPicture != ''"> and repair_picture = #{repairPicture}</if>
and del_flag = '0'
</where>
</select>
<select id="selectEquOrderStandardById" parameterType="String" resultMap="EquOrderStandardResult">
<include refid="selectEquOrderStandardVo"/>
where id = #{id}
where id = #{id} and del_flag = '0'
</select>
<select id="selectEquOrderStandardByParentCode" parameterType="String" resultMap="EquOrderStandardResult">
<include refid="selectEquOrderStandardVo"/>
where parent_code = #{parentCode}
where parent_code = #{parentCode} and del_flag = '0'
</select>
<insert id="insertEquOrderStandard" parameterType="EquOrderStandard">
@ -183,7 +184,7 @@
<if test="repairValue != null">repair_value = #{repairValue},</if>
<if test="repairPicture != null">repair_picture = #{repairPicture},</if>
</trim>
where id = #{id}
where id = #{id} and del_flag = '0'
</update>
<delete id="deleteEquOrderStandardById" parameterType="String">

@ -48,17 +48,24 @@
<if test="attr1 != null and attr1 != ''"> and attr1 = #{attr1}</if>
<if test="attr2 != null and attr2 != ''"> and attr2 = #{attr2}</if>
<if test="attr3 != null and attr3 != ''"> and attr3 = #{attr3}</if>
and del_flag = '0'
</where>
ORDER BY item_name
</select>
<select id="selectEquPlanDetailById" parameterType="String" resultMap="EquPlanDetailResult">
<include refid="selectEquPlanDetailVo"/>
where id = #{id}
where id = #{id} and del_flag = '0'
</select>
<select id="selectEquPlanDetailByPlanCode" parameterType="String" resultMap="EquPlanDetailResult">
<include refid="selectEquPlanDetailVo"/>
where plan_code = #{planCode} and del_flag = '0'
where plan_code = #{planCode} and del_flag = '0' ORDER BY item_name
</select>
<select id="selectEquPlanDetailListByParentCode" parameterType="String" resultMap="EquPlanDetailResult">
<include refid="selectEquPlanDetailVo"/>
where parent_code = #{code} and del_flag = '0' ORDER BY item_name
</select>
<insert id="insertEquPlanDetail" parameterType="EquPlanDetail">
@ -132,7 +139,7 @@
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
where id = #{id} and del_flag = '0'
</update>
<delete id="deleteEquPlanDetailById" parameterType="String">

@ -108,7 +108,7 @@
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
where id = #{id} and del_flag = '0'
</update>
<delete id="deleteEquPlanEquById" parameterType="String">

@ -129,4 +129,9 @@
<delete id="deleteEquPlanEquSpareByPlanCode">
delete from equ_plan_equ_spare where plan_code = #{planCode}
</delete>
<delete id="delEquPlanEquSpareByPlanCode">
update equ_plan_equ_spare set del_flag = '1' where plan_code = #{planCode} and del_flag = '0'
</delete>
</mapper>

@ -48,6 +48,7 @@
<if test="attr3 != null and attr3 != ''"> and attr3 = #{attr3}</if>
and del_flag = '0'
</where>
ORDER BY standard_name
</select>
<select id="selectEquPlanStandardById" parameterType="String" resultMap="EquPlanStandardResult">
@ -57,7 +58,12 @@
<select id="selectEquPlanStandardByPlanCode" parameterType="String" resultMap="EquPlanStandardResult">
<include refid="selectEquPlanStandardVo"/>
where plan_code = #{planCode} and del_flag ='0'
where plan_code = #{planCode} and del_flag ='0' ORDER BY standard_name
</select>
<select id="selectEquPlanStandardListByParentCode" parameterType="String" resultMap="EquPlanStandardResult">
<include refid="selectEquPlanStandardVo"/>
where parent_code = #{code} and del_flag ='0' ORDER BY standard_name
</select>
<insert id="insertEquPlanStandard" parameterType="EquPlanStandard">

Loading…
Cancel
Save