diff --git a/op-modules/op-device/src/main/java/com/op/device/controller/EquRepairWorkOrderController.java b/op-modules/op-device/src/main/java/com/op/device/controller/EquRepairWorkOrderController.java index 4505c5b6..2bb5f525 100644 --- a/op-modules/op-device/src/main/java/com/op/device/controller/EquRepairWorkOrderController.java +++ b/op-modules/op-device/src/main/java/com/op/device/controller/EquRepairWorkOrderController.java @@ -146,7 +146,7 @@ public class EquRepairWorkOrderController extends BaseController { * @param upKeepOrderDTO * @return */ - @RequiresPermissions("device:repairOrder:checkRepairWorkOrder") + @RequiresPermissions("device:repairOrder:check") @PostMapping("/checkRepairWorkOrder") public AjaxResult checkRepairWorkOrder(@RequestBody UpKeepOrderDTO upKeepOrderDTO) { return equRepairWorkOrderService.checkRepairWorkOrder(upKeepOrderDTO); diff --git a/op-modules/op-device/src/main/java/com/op/device/controller/EquUpkeepOrderController.java b/op-modules/op-device/src/main/java/com/op/device/controller/EquUpkeepOrderController.java index 662812e8..927c3b2d 100644 --- a/op-modules/op-device/src/main/java/com/op/device/controller/EquUpkeepOrderController.java +++ b/op-modules/op-device/src/main/java/com/op/device/controller/EquUpkeepOrderController.java @@ -37,7 +37,7 @@ public class EquUpkeepOrderController extends BaseController { * @param upKeepOrderDTO * @return */ - @RequiresPermissions("device:upkeepOrder:subInspect") + @RequiresPermissions("device:upkeepOrder:check") @PostMapping("/subInspect") public AjaxResult subInspect(@RequestBody UpKeepOrderDTO upKeepOrderDTO) { return equUpkeepOrderService.subInspect(upKeepOrderDTO); diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceTaskServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceTaskServiceImpl.java index eb415717..27d3c429 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceTaskServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/DeviceTaskServiceImpl.java @@ -149,7 +149,7 @@ public class DeviceTaskServiceImpl implements IDeviceTaskService { } /** - * 根据保养计划生成点检任务 + * 根据保养计划生成保养任务 **/ @Override public AjaxResult createMaintenancePlanTask() { @@ -336,9 +336,9 @@ public class DeviceTaskServiceImpl implements IDeviceTaskService { String serialNum = String.format("%03d", equOrderMapper.selectSerialNumber()); String orderCode = "O" + DateUtils.dateTimeNow(DateUtils.YYYYMMDD) + serialNum; order.setOrderCode(orderCode); - + //todo 工厂号 if ("1".equals(plan.getUpkeep())) {//1委外工单 - order.setOutsourceCode("BW" + orderCode); + order.setOutsourceCode("WW" + orderCode); } if(StringUtils.isNotEmpty(plan.getEquipmentCode())){ diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquOutsourceWorkServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquOutsourceWorkServiceImpl.java index aa60e15f..c08eed91 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquOutsourceWorkServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquOutsourceWorkServiceImpl.java @@ -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); } } diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquRepairOrderServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquRepairOrderServiceImpl.java index 52d2c286..3bed1b98 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquRepairOrderServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquRepairOrderServiceImpl.java @@ -320,9 +320,11 @@ public class EquRepairOrderServiceImpl implements IEquRepairOrderService { equOutsourceWork.setWorkType("0"); //委外类型 维修委外 equOutsourceWork.setCreateBy(SecurityUtils.getUsername()); equOutsourceWork.setCreateTime(DateUtils.getNowDate()); + equOutsourceWork.setDelFlag("0"); //删除标识 HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest(); String key = "#header.poolName"; equOutsourceWork.setFactoryCode(request.getHeader(key.substring(8)).replace("ds_", "")); + ////更新委外列表 equOutsourceWorkMapper.insertEquOutsourceWork(equOutsourceWork);