diff --git a/op-modules/op-device/src/main/java/com/op/device/domain/EquOrder.java b/op-modules/op-device/src/main/java/com/op/device/domain/EquOrder.java index 1390c4d2..f8cbc97a 100644 --- a/op-modules/op-device/src/main/java/com/op/device/domain/EquOrder.java +++ b/op-modules/op-device/src/main/java/com/op/device/domain/EquOrder.java @@ -149,6 +149,16 @@ public class EquOrder extends BaseEntity { private String workCode; private int days; + private String equipmentName; + + public String getEquipmentName() { + return equipmentName; + } + + public void setEquipmentName(String equipmentName) { + this.equipmentName = equipmentName; + } + public int getDays() { return days; } diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/DevicePDAServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/DevicePDAServiceImpl.java index ec7ea9cf..418cab09 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/DevicePDAServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/DevicePDAServiceImpl.java @@ -243,7 +243,7 @@ public class DevicePDAServiceImpl implements IDevicePDAService { // 获取故障报修流水号 EquRepairOrder equRepairOrder = new EquRepairOrder(); String serialNum = String.format("%03d", equRepairOrderMapper.selectOrderCodeSerialNumber()); - String equipmentCode = equOrder.getEquipmentCode(); + String equipmentCode = equOrder.getEqu().getEquipmentCode(); //报修单号 equRepairOrder.setOrderCode("BX"+DateUtils.dateTimeNow(DateUtils.YYYYMMDD) + equipmentCode + serialNum); //在主表中存入报修单号信息 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 9d87fa5b..77ceb614 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 @@ -82,7 +82,7 @@ public class EquOrderServiceImpl implements IEquOrderService { equ.setDetailList(detailList); List spareList = equOrderEquSpareMapper.selectEquOrderEquSpareByParentCode(equ.getCode()); - if (spareList.size()>0) { + if (spareList.size() > 0) { equ.setSpareList(spareList); } @@ -111,7 +111,13 @@ public class EquOrderServiceImpl implements IEquOrderService { @Override @DS("#header.poolName") public List selectEquOrderList(EquOrder equOrder) { - return equOrderMapper.selectEquOrderList(equOrder); + List orderList = equOrderMapper.selectEquOrderList(equOrder); + for (EquOrder order : orderList) { + EquOrderEqu equ = equOrderEquMapper.selectEquOrderEquListByParentCode(order.getOrderCode()); + order.setEquipmentCode(equ.getEquipmentCode()); + order.setEquipmentName(equ.getEquipmentName()); + } + return orderList; } /** @@ -141,11 +147,11 @@ public class EquOrderServiceImpl implements IEquOrderService { 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,"报修单已审核,不可修改记录!"); + if (repairOrder == null) { + return error(500, "未查询到报修单信息!"); + } else { + if (!repairOrder.getOrderStatus().equals("待审核")) { + return error(500, "报修单已审核,不可修改记录!"); } } } @@ -188,7 +194,7 @@ public class EquOrderServiceImpl implements IEquOrderService { standard.setErrorFlag("1"); standard.setDetailReach("0"); } - }else { + } else { // TODO 未达标 standard.setErrorFlag("0"); if (standard.getDetailReach().equals("0")) { @@ -216,44 +222,44 @@ public class EquOrderServiceImpl implements IEquOrderService { boolean checkRepair = false; - if (equOrder.getRepairCode() == null){ + if (equOrder.getRepairCode() == null) { checkRepair = true; - }else { - if (equOrder.getRepairCode().isEmpty()){ + } 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); + if (checkRepair && hasError) { + // 获取故障报修流水号 + EquRepairOrder equRepairOrder = new EquRepairOrder(); + String serialNum = String.format("%03d", equRepairOrderMapper.selectOrderCodeSerialNumber()); + String equipmentCode = equOrder.getEqu().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); } if (!hasError) { diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquPlanServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquPlanServiceImpl.java index 850cb8f0..94bdcfe9 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquPlanServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquPlanServiceImpl.java @@ -448,9 +448,6 @@ public class EquPlanServiceImpl implements IEquPlanService { // 处理标准 List standardList = item.getEquPlanStandardList(); - // 检查项详情流水号 - int detailCodeTemp = 0; - // 判断是否插入检查项 boolean checkInsert = false; @@ -463,7 +460,6 @@ public class EquPlanServiceImpl implements IEquPlanService { standard.setId(IdUtils.fastSimpleUUID()); standard.setParentCode(item.getCode()); standard.setPlanCode(equPlan.getPlanCode()); - standard.setCode("D" + item.getCode() + String.format("%02d", ++detailCodeTemp)); standard.setCreateBy(SecurityContextHolder.getUserName()); standard.setCreateTime(DateUtils.getNowDate()); standard.setUpdateBy(SecurityContextHolder.getUserName()); diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquUpkeepOrderServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquUpkeepOrderServiceImpl.java index 62c92cb8..4c904715 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquUpkeepOrderServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquUpkeepOrderServiceImpl.java @@ -127,7 +127,6 @@ public class EquUpkeepOrderServiceImpl implements IEquUpkeepOrderService { EquOrderEquSpare spareTemp = new EquOrderEquSpare(); BeanUtils.copyProperties(spare,spareTemp); spareTemp.setId(IdUtils.fastSimpleUUID()); - spareTemp.setCode("S"+equOrder.getOrderCode()+String.format("%03d",++spareSerialNum)); spareTemp.setOrderCode(equOrder.getOrderCode()); spareTemp.setParentCode(equ.getCode()); spareTemp.setFactoryCode(factory); @@ -163,12 +162,10 @@ public class EquUpkeepOrderServiceImpl implements IEquUpkeepOrderService { // 插入检查项信息 equOrderDetailMapper.insertEquOrderDetail(equOrderDetail); - int standardSerialNum = 0; for (EquPlanStandard standard : standardList) { EquOrderStandard orderStandard = new EquOrderStandard(); BeanUtils.copyProperties(standard,orderStandard); orderStandard.setId(IdUtils.fastSimpleUUID()); - orderStandard.setCode("S"+equOrder.getOrderCode()+String.format("%03d",++standardSerialNum)); orderStandard.setParentCode(equOrderDetail.getCode()); orderStandard.setOrderCode(equOrder.getOrderCode()); orderStandard.setCreateBy(SecurityContextHolder.getUserName()); diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquUpkeepServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquUpkeepServiceImpl.java index 090c41ea..92528f17 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/EquUpkeepServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/EquUpkeepServiceImpl.java @@ -275,9 +275,6 @@ public class EquUpkeepServiceImpl implements IEquUpkeepService { // 处理标准 List standardList = item.getEquPlanStandardList(); - // 检查项详情流水号 - int detailCodeTemp = 0; - // 判断是否插入检查项 boolean checkInsert = false; @@ -290,7 +287,6 @@ public class EquUpkeepServiceImpl implements IEquUpkeepService { standard.setId(IdUtils.fastSimpleUUID()); standard.setParentCode(item.getCode()); standard.setPlanCode(equPlan.getPlanCode()); - standard.setCode("D" + item.getCode() + String.format("%02d", ++detailCodeTemp)); standard.setCreateBy(SecurityContextHolder.getUserName()); standard.setCreateTime(DateUtils.getNowDate()); standard.setUpdateBy(SecurityContextHolder.getUserName()); @@ -321,7 +317,6 @@ public class EquUpkeepServiceImpl implements IEquUpkeepService { if (spareList != null) { for (EquPlanEquSpare spare : spareList) { spare.setId(IdUtils.fastSimpleUUID()); - spare.setCode("S" + equPlan.getPlanCode() + String.format("%02d", ++spareCodeTemp)); spare.setPlanCode(equPlan.getPlanCode()); spare.setParentCode(equipment.getCode()); spare.setFactoryCode(factory); diff --git a/op-modules/op-device/src/main/java/com/op/device/service/impl/InspectionWorkServiceImpl.java b/op-modules/op-device/src/main/java/com/op/device/service/impl/InspectionWorkServiceImpl.java index 1c2279e6..be809e0a 100644 --- a/op-modules/op-device/src/main/java/com/op/device/service/impl/InspectionWorkServiceImpl.java +++ b/op-modules/op-device/src/main/java/com/op/device/service/impl/InspectionWorkServiceImpl.java @@ -35,6 +35,8 @@ public class InspectionWorkServiceImpl implements IInspectionWorkService { private EquPlanMapper equPlanMapper; @Autowired private EquOrderEquSpareMapper equOrderEquSpareMapper; + @Autowired + private EquOrderEquMapper equOrderEquMapper; /** * 查询巡检记录 @@ -60,7 +62,7 @@ public class InspectionWorkServiceImpl implements IInspectionWorkService { // 替换循环周期 order.setPlanLoopType(equOrderMapper.changeLoopType(order.getPlanLoopType())); - Equipment equipment = equipmentMapper.selectEquipmentByEquipmentCode(order.getEquipmentCode()); + Equipment equipment = equipmentMapper.selectEquipmentByEquipmentCode(equOrderEquMapper.selectEquOrderEquListByParentCode(order.getOrderCode()).getEquipmentCode()); // 查询检查项、标准 List detailList = equOrderDetailMapper.selectEquOrderDetailByOrderCode(order.getOrderCode()); diff --git a/op-modules/op-device/src/main/resources/mapper/device/EquOrderMapper.xml b/op-modules/op-device/src/main/resources/mapper/device/EquOrderMapper.xml index de310660..9ac2d48b 100644 --- a/op-modules/op-device/src/main/resources/mapper/device/EquOrderMapper.xml +++ b/op-modules/op-device/src/main/resources/mapper/device/EquOrderMapper.xml @@ -60,7 +60,6 @@ and plan_loop_end = #{planLoopEnd} and order_start = #{orderStart} and order_end = #{orderEnd} - and equipment_code = #{equipmentCode} and order_status = #{orderStatus} and order_cost = #{orderCost} and plan_person like concat('%', #{planPerson}, '%') @@ -82,6 +81,14 @@ and repair_code = #{repairCode} and work_code = #{workCode} and del_flag = '0' + + and order_code in ( + select order_code from equ_order_equ + where equ_order.order_code = equ_order_equ.order_code + and equ_order_equ.equipment_code like concat('%', #{equipmentCode}, '%') + and equ_order_equ.equipment_name like concat('%', #{equipmentName}, '%') + ) +