diff --git a/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderWorkorderServiceImpl.java b/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderWorkorderServiceImpl.java index dba9b84a..fbdfd5bc 100644 --- a/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderWorkorderServiceImpl.java +++ b/op-modules/op-plan/src/main/java/com/op/plan/service/impl/ProOrderWorkorderServiceImpl.java @@ -578,17 +578,31 @@ public class ProOrderWorkorderServiceImpl implements IProOrderWorkorderService { List proOrderWorkorderList = new ArrayList(); // 查询该工单信息 ProOrderWorkorder proOrderWorkorder = proOrderWorkorderMapper.selectWorkOrderByCode(code); + proOrderWorkorderList.add(proOrderWorkorder); boolean flag = true; + + // 临时存放parentCode + StringBuilder tempCode = new StringBuilder(); + tempCode.append(proOrderWorkorder.getParentOrder()); + while (flag) { - proOrderWorkorderList.add(proOrderWorkorder); - ProOrderWorkorder workorder = proOrderWorkorderMapper.selectWorkOrderByCode(proOrderWorkorder.getParentOrder()); + ProOrderWorkorder workorder = proOrderWorkorderMapper.selectWorkOrderByCode(tempCode.toString()); if (workorder != null) { - BeanUtils.copyProperties(workorder,proOrderWorkorder); + proOrderWorkorderList.add(workorder); + tempCode.setLength(0); + tempCode.append(workorder.getParentOrder()); } else { flag = false; } } - return success(proOrderWorkorderList); + + // 反转list + List reversalWorkOrderList = new ArrayList<>(); + for (int i = proOrderWorkorderList.size()-1; i >= 0; i--) { + reversalWorkOrderList.add(proOrderWorkorderList.get(i)); + } + + return success(reversalWorkOrderList); } /**