diff --git a/op-modules/op-device/src/main/java/com/op/device/mapper/EquRepairOrderMapper.java b/op-modules/op-device/src/main/java/com/op/device/mapper/EquRepairOrderMapper.java index 83166c0d..61116121 100644 --- a/op-modules/op-device/src/main/java/com/op/device/mapper/EquRepairOrderMapper.java +++ b/op-modules/op-device/src/main/java/com/op/device/mapper/EquRepairOrderMapper.java @@ -72,4 +72,17 @@ public interface EquRepairOrderMapper { //查询报修人员列表 @DS("master") List getRepairPersonList(EquEquipment equEquipment); + + /** + * 通过报修code查询报修单信息 + * @param repairCode + * @return + */ + EquRepairOrder selectEquRepairOrderByRepairCode(String repairCode); + + /** + * 通过报修code删除报修单信息-彻底删除! + * @param repairCode + */ + void deleteEquRepairOrderByRepairCode(String repairCode); } diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquOrderServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquOrderServiceImpl.java index 53a1923b..9d87fa5b 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquOrderServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquOrderServiceImpl.java @@ -23,6 +23,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; /** @@ -67,7 +68,7 @@ public class EquOrderServiceImpl implements IEquOrderService { timeArray.add(order.getOrderEnd()); order.setTimeArray(timeArray); - order.setPlanName(equOrderMapper.selectPlanNameByPlanCode(orderCode)); + order.setPlanName(equOrderMapper.selectPlanNameByPlanCode(order.getPlanCode())); order.setWorkCenterName(equOrderMapper.selectCenterNameByCenterCode(order.getPlanWorkshop())); @@ -135,6 +136,21 @@ public class EquOrderServiceImpl implements IEquOrderService { @Override @DS("#header.poolName") public AjaxResult updateEquOrder(EquOrder equOrder) { + + // 检验如果审核通过则不允许修改记录 + if (equOrder.getRepairCode() != null) { + if (!equOrder.getRepairCode().isEmpty()) { + EquRepairOrder repairOrder = equRepairOrderMapper.selectEquRepairOrderByRepairCode(equOrder.getRepairCode()); + if (repairOrder==null) { + return error(500,"未查询到报修单信息!"); + }else { + if (!repairOrder.getOrderStatus().equals("待审核")){ + return error(500,"报修单已审核,不可修改记录!"); + } + } + } + } + boolean hasError = false; EquOrderEqu equ = equOrder.getEqu(); @@ -165,13 +181,19 @@ public class EquOrderServiceImpl implements IEquOrderService { if (standard.getStandardType().equals("quantify")) { int up = standard.getActualValue().compareTo(standard.getDetailUpLimit()); int down = standard.getActualValue().compareTo(standard.getDetailDownLimit()); + standard.setDetailReach("1"); + standard.setErrorFlag("0"); if (!(up != 1 && down != -1)) { hasError = true; + standard.setErrorFlag("1"); + standard.setDetailReach("0"); } }else { // TODO 未达标 - if (standard.getDetailReach().equals("1")) { + standard.setErrorFlag("0"); + if (standard.getDetailReach().equals("0")) { hasError = true; + standard.setErrorFlag("1"); } } @@ -187,6 +209,10 @@ public class EquOrderServiceImpl implements IEquOrderService { equOrder.setUpdateBy(SecurityContextHolder.getUserName()); equOrder.setPlanPerson(SecurityContextHolder.getUserName()); equOrder.setPlanPerson(SecurityContextHolder.getUserName()); + if (equOrder.getTimeArray().size() > 0) { + equOrder.setOrderStart(equOrder.getTimeArray().get(0)); + equOrder.setOrderEnd(equOrder.getTimeArray().get(1)); + } boolean checkRepair = false; @@ -198,6 +224,7 @@ public class EquOrderServiceImpl implements IEquOrderService { } } + // 报修信息 if (checkRepair && hasError ) { // 获取故障报修流水号 EquRepairOrder equRepairOrder = new EquRepairOrder(); @@ -229,6 +256,16 @@ public class EquOrderServiceImpl implements IEquOrderService { equRepairOrderMapper.insertEquRepairOrder(equRepairOrder); } + if (!hasError) { + // TODO 删除报修单 + if (equOrder.getRepairCode() != null) { + if (!equOrder.getRepairCode().isEmpty()) { + equRepairOrderMapper.deleteEquRepairOrderByRepairCode(equOrder.getRepairCode()); + equOrder.setRepairCode(""); + } + } + } + // 更新工单信息 equOrderMapper.updateEquOrder(equOrder); return success(); diff --git a/op-modules/op-device/src/main/resources/mapper/device/EquRepairOrderMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/EquRepairOrderMapper.xml index 501acfb8..27599761 100644 --- a/op-modules/op-device/src/main/resources/mapper/device/EquRepairOrderMapper.xml +++ b/op-modules/op-device/src/main/resources/mapper/device/EquRepairOrderMapper.xml @@ -220,6 +220,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + delete from equ_repair_order where order_code = #{repairCode} and del_flag = '0' + + + + \ No newline at end of file