|
|
|
@ -9,12 +9,9 @@ import com.op.common.security.utils.SecurityUtils;
|
|
|
|
|
import com.op.device.domain.EquEquipment;
|
|
|
|
|
import com.op.device.domain.EquRepairWorkOrder;
|
|
|
|
|
import com.op.device.domain.Equipment;
|
|
|
|
|
import com.op.device.mapper.EquOrderMapper;
|
|
|
|
|
import com.op.device.mapper.EquRepairWorkOrderMapper;
|
|
|
|
|
import com.op.device.mapper.EquipmentMapper;
|
|
|
|
|
import com.op.device.mapper.*;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import com.op.device.mapper.EquOutsourceWorkMapper;
|
|
|
|
|
import com.op.device.domain.EquOutsourceWork;
|
|
|
|
|
import com.op.device.service.IEquOutsourceWorkService;
|
|
|
|
|
import org.springframework.web.context.request.RequestContextHolder;
|
|
|
|
@ -42,7 +39,6 @@ public class EquOutsourceWorkServiceImpl implements IEquOutsourceWorkService {
|
|
|
|
|
@Autowired
|
|
|
|
|
private EquipmentMapper equipmentMapper;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查询委外工单
|
|
|
|
|
*
|
|
|
|
@ -90,28 +86,85 @@ public class EquOutsourceWorkServiceImpl implements IEquOutsourceWorkService {
|
|
|
|
|
String key = "#header.poolName";
|
|
|
|
|
equOutsourceWork.setFactoryCode(request.getHeader(key.substring(8)).replace("ds_", ""));
|
|
|
|
|
|
|
|
|
|
////修改工单状态、设备状态
|
|
|
|
|
//todo 委外也需要审核
|
|
|
|
|
//todo 故障
|
|
|
|
|
////修改设备状态
|
|
|
|
|
EquEquipment example = new EquEquipment();
|
|
|
|
|
example.setEquipmentCode(equOutsourceWork.getEquipmentCode());
|
|
|
|
|
Equipment equipment = equipmentMapper.selectEquipmentByEquipmentCode(equOutsourceWork.getEquipmentCode());
|
|
|
|
|
|
|
|
|
|
//如果未完成工单
|
|
|
|
|
if(equOutsourceWork.getWorkStatus().equals("0")){
|
|
|
|
|
//如果是委外维修
|
|
|
|
|
if (equOutsourceWork.getWorkType().equals("0")) {
|
|
|
|
|
//1.修改设备状态 正常运行1--->故障0
|
|
|
|
|
if (equipment.getEquipmentStatus().equals("1")) {
|
|
|
|
|
example.setEquipmentStatus("0");
|
|
|
|
|
equRepairWorkOrderMapper.updateEquipmentStatus(example);
|
|
|
|
|
|
|
|
|
|
//2.修改设备状态 保养中3---->维修保养中4
|
|
|
|
|
}else if (equipment.getEquipmentStatus().equals("3")) {
|
|
|
|
|
example.setEquipmentStatus("4");
|
|
|
|
|
equRepairWorkOrderMapper.updateEquipmentStatus(example);
|
|
|
|
|
}
|
|
|
|
|
//原来是故障0/维修中2/维修保养中4 什么都不改变
|
|
|
|
|
|
|
|
|
|
//如果是委外保养
|
|
|
|
|
} else if (equOutsourceWork.getWorkType().equals("1")) {
|
|
|
|
|
//1.修改设备状态维修中2----->维修保养中4
|
|
|
|
|
if (equipment.getEquipmentStatus().equals("2")) {
|
|
|
|
|
example.setEquipmentStatus("4");
|
|
|
|
|
equRepairWorkOrderMapper.updateEquipmentStatus(example);
|
|
|
|
|
|
|
|
|
|
//2.正常1--->保养中
|
|
|
|
|
}else if (equipment.getEquipmentStatus().equals("1")) {
|
|
|
|
|
example.setEquipmentStatus("3");
|
|
|
|
|
equRepairWorkOrderMapper.updateEquipmentStatus(example);
|
|
|
|
|
|
|
|
|
|
//3.故障0 和 维修---->维修保养中4
|
|
|
|
|
}else if (equipment.getEquipmentStatus().equals("0")) {
|
|
|
|
|
example.setEquipmentStatus("4");
|
|
|
|
|
equRepairWorkOrderMapper.updateEquipmentStatus(example);
|
|
|
|
|
}
|
|
|
|
|
//维修保养中不变 保养中不变
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//如果完成工单
|
|
|
|
|
if (equOutsourceWork.getWorkStatus().equals("1") && equOutsourceWork.getWorkType().equals("0")) {
|
|
|
|
|
//更新维修工单状态
|
|
|
|
|
//1.如果是完成委外 查看是否存在维修单 存在的话改维修单状态 改设备状态 WorkType 0 维修委外
|
|
|
|
|
//1.1 更新维修工单状态
|
|
|
|
|
equRepairWorkOrderMapper.updateWorkStatus(equOutsourceWork.getRepairCode());
|
|
|
|
|
//todo 按照正常来说应该加一个审核再 修改设备状态 改为正常运行
|
|
|
|
|
|
|
|
|
|
//1.2 更新设备状态
|
|
|
|
|
//设备状态 故障0/维修中2--->正常运行1
|
|
|
|
|
if(equipment.getEquipmentStatus().equals("0") || equipment.getEquipmentStatus().equals("2")){
|
|
|
|
|
example.setEquipmentStatus("1");
|
|
|
|
|
equRepairWorkOrderMapper.updateEquipmentStatus(example);
|
|
|
|
|
|
|
|
|
|
//设备状态 维修保养中4--->保养中3
|
|
|
|
|
}else if(equipment.getEquipmentStatus().equals("4")){
|
|
|
|
|
example.setEquipmentStatus("3");
|
|
|
|
|
equRepairWorkOrderMapper.updateEquipmentStatus(example);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//修改设备状态 改为正常运行
|
|
|
|
|
EquEquipment equEquipment = new EquEquipment();
|
|
|
|
|
equEquipment.setEquipmentCode(equOutsourceWork.getEquipmentCode());
|
|
|
|
|
equEquipment.setEquipmentStatus("1");
|
|
|
|
|
equRepairWorkOrderMapper.updateEquipmentStatus(equEquipment);
|
|
|
|
|
} else if (equOutsourceWork.getWorkStatus().equals("1") && equOutsourceWork.getWorkType().equals("1")) {
|
|
|
|
|
//2.如果是完成委外 查看是否存在保养 存在的话改保养单状态 改设备状态 WorkType 1 保养委外
|
|
|
|
|
//更新保养工单状态
|
|
|
|
|
equOrderMapper.updateEquOrderStatusComplete(equOutsourceWork.getRepairCode());
|
|
|
|
|
//todo 按照正常来说应该加一个审核再 修改设备状态 改为正常运行
|
|
|
|
|
|
|
|
|
|
//修改设备状态 改为正常运行
|
|
|
|
|
//查找当前运行的设备信息 如果是维修中则不改 维修>保养
|
|
|
|
|
EquEquipment example = new EquEquipment();
|
|
|
|
|
example.setEquipmentCode(equOutsourceWork.getEquipmentCode());
|
|
|
|
|
Equipment equipment = equipmentMapper.selectEquipmentByEquipmentCode(equOutsourceWork.getEquipmentCode());
|
|
|
|
|
if (equipment.getEquipmentStatus().equals("3")) {
|
|
|
|
|
//2.2 更新设备状态
|
|
|
|
|
//设备状态 保养中3--->正常运行1
|
|
|
|
|
if(equipment.getEquipmentStatus().equals("3")){
|
|
|
|
|
example.setEquipmentStatus("1");
|
|
|
|
|
equRepairWorkOrderMapper.updateEquipmentStatus(example);
|
|
|
|
|
|
|
|
|
|
//设备状态 维修保养中4--->维修中2
|
|
|
|
|
}else if(equipment.getEquipmentStatus().equals("4")){
|
|
|
|
|
example.setEquipmentStatus("2");
|
|
|
|
|
equRepairWorkOrderMapper.updateEquipmentStatus(example);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -127,28 +180,44 @@ public class EquOutsourceWorkServiceImpl implements IEquOutsourceWorkService {
|
|
|
|
|
@Override
|
|
|
|
|
@DS("#header.poolName")
|
|
|
|
|
public int updateEquOutsourceWork(EquOutsourceWork equOutsourceWork) {
|
|
|
|
|
//1完成委外,更新工单状态
|
|
|
|
|
EquEquipment equEquipment = new EquEquipment();
|
|
|
|
|
equEquipment.setEquipmentCode(equOutsourceWork.getEquipmentCode());
|
|
|
|
|
Equipment equipment = equipmentMapper.selectEquipmentByEquipmentCode(equOutsourceWork.getEquipmentCode());
|
|
|
|
|
|
|
|
|
|
if (equOutsourceWork.getWorkStatus().equals("1") && equOutsourceWork.getWorkType().equals("0")) {
|
|
|
|
|
//更新维修工单状态
|
|
|
|
|
//1.如果是完成委外 查看是否存在维修单 存在的话改维修单状态 改设备状态 WorkType 0 维修委外
|
|
|
|
|
//1.1 更新维修工单状态
|
|
|
|
|
equRepairWorkOrderMapper.updateWorkStatus(equOutsourceWork.getRepairCode());
|
|
|
|
|
//todo 按照正常来说应该加一个审核再 修改设备状态 改为正常运行
|
|
|
|
|
|
|
|
|
|
//1.2 更新设备状态
|
|
|
|
|
//设备状态 故障0/维修中2--->正常运行1
|
|
|
|
|
if(equipment.getEquipmentStatus().equals("0") || equipment.getEquipmentStatus().equals("2")){
|
|
|
|
|
equEquipment.setEquipmentStatus("1");
|
|
|
|
|
equRepairWorkOrderMapper.updateEquipmentStatus(equEquipment);
|
|
|
|
|
|
|
|
|
|
//设备状态 维修保养中4--->保养中3
|
|
|
|
|
}else if(equipment.getEquipmentStatus().equals("4")){
|
|
|
|
|
equEquipment.setEquipmentStatus("3");
|
|
|
|
|
equRepairWorkOrderMapper.updateEquipmentStatus(equEquipment);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//修改设备状态 改为正常运行
|
|
|
|
|
EquEquipment equEquipment = new EquEquipment();
|
|
|
|
|
equEquipment.setEquipmentCode(equOutsourceWork.getEquipmentCode());
|
|
|
|
|
equEquipment.setEquipmentStatus("1");
|
|
|
|
|
equRepairWorkOrderMapper.updateEquipmentStatus(equEquipment);
|
|
|
|
|
} else if (equOutsourceWork.getWorkStatus().equals("1") && equOutsourceWork.getWorkType().equals("1")) {
|
|
|
|
|
//2.如果是完成委外 查看是否存在保养 存在的话改保养单状态 改设备状态 WorkType 1 保养委外
|
|
|
|
|
//更新保养工单状态
|
|
|
|
|
equOrderMapper.updateEquOrderStatusComplete(equOutsourceWork.getRepairCode());
|
|
|
|
|
|
|
|
|
|
//修改设备状态 改为正常运行
|
|
|
|
|
//查找当前运行的设备信息 如果是维修中则不改 维修>保养
|
|
|
|
|
EquEquipment example = new EquEquipment();
|
|
|
|
|
example.setEquipmentCode(equOutsourceWork.getEquipmentCode());
|
|
|
|
|
Equipment equipment = equipmentMapper.selectEquipmentByEquipmentCode(equOutsourceWork.getEquipmentCode());
|
|
|
|
|
if (equipment.getEquipmentStatus().equals("3")) {
|
|
|
|
|
example.setEquipmentStatus("1");
|
|
|
|
|
equRepairWorkOrderMapper.updateEquipmentStatus(example);
|
|
|
|
|
//todo 按照正常来说应该加一个审核再 修改设备状态 改为正常运行
|
|
|
|
|
|
|
|
|
|
//2.2 更新设备状态
|
|
|
|
|
//设备状态 保养中3--->正常运行1
|
|
|
|
|
if(equipment.getEquipmentStatus().equals("3")){
|
|
|
|
|
equEquipment.setEquipmentStatus("1");
|
|
|
|
|
equRepairWorkOrderMapper.updateEquipmentStatus(equEquipment);
|
|
|
|
|
|
|
|
|
|
//设备状态 维修保养中4--->维修中2
|
|
|
|
|
}else if(equipment.getEquipmentStatus().equals("4")){
|
|
|
|
|
equEquipment.setEquipmentStatus("2");
|
|
|
|
|
equRepairWorkOrderMapper.updateEquipmentStatus(equEquipment);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|