From 940f06f6d8e5508f39bd7f8ce7791d60bfc0686c Mon Sep 17 00:00:00 2001 From: Fixiaobai <fixiaobai@163.com> Date: 星期二, 07 十一月 2023 14:11:21 +0800 Subject: [PATCH] Changes --- mes-technology/src/main/java/com/chinaztt/mes/technology/service/impl/StructureServiceImpl.java | 101 ++++++++++++++++++++++++++------------------------ 1 files changed, 52 insertions(+), 49 deletions(-) diff --git a/mes-technology/src/main/java/com/chinaztt/mes/technology/service/impl/StructureServiceImpl.java b/mes-technology/src/main/java/com/chinaztt/mes/technology/service/impl/StructureServiceImpl.java index 9176fb3..8f54259 100644 --- a/mes-technology/src/main/java/com/chinaztt/mes/technology/service/impl/StructureServiceImpl.java +++ b/mes-technology/src/main/java/com/chinaztt/mes/technology/service/impl/StructureServiceImpl.java @@ -257,55 +257,58 @@ @Override public void importExcel(List<StructureData> list) { - if (CollectionUtil.isEmpty(list)) { - return; - } - List<String> uinck = new ArrayList<>(); - for (StructureData data : list) { - Part part = partMapper.selectOne(Wrappers.<Part>lambdaQuery().eq(Part::getPartNo, data.getFatherPartNo()).eq(Part::getEngChgLevel, data.getFatherVersion())); - if (part == null) { - throw new RuntimeException("闆朵欢鍙�:" + data.getFatherPartNo() + "涓嶅瓨鍦�"); - } - Structure structure = baseMapper.selectOne(Wrappers.<Structure>lambdaQuery() - .eq(Structure::getPartId, part.getId()) - .eq(Structure::getBomTypeDb, data.getStructureType()) - .eq(Structure::getAlternativeNo, data.getAlternativeNo())); - if (structure == null) { - structure = new Structure(); - structure.setPartId(part.getId()); - structure.setVersion(data.getFatherVersion()); - structure.setAlternativeDesc(data.getAlternativeDesc()); - structure.setActive(true); - structure.setBomTypeDb(data.getStructureType()); - structure.setIfsSync(false); - structure.setAlternativeNo(data.getAlternativeNo()); - baseMapper.insert(structure); - } - if (uinck.contains(structure.getId() + "_" + data.getLineItemNo())) { - throw new RuntimeException("闆朵欢鍙�:" + part.getPartNo() + "琛岄」鍙烽噸澶�"); - } - Part childPart = partMapper.selectOne(Wrappers.<Part>lambdaQuery().eq(Part::getPartNo, data.getChildPartNo()).eq(Part::getEngChgLevel, data.getChildVersion())); - if (childPart == null) { - throw new RuntimeException("闆朵欢鍙�:" + data.getChildPartNo() + "涓嶅瓨鍦�"); - } - StructureComponent component = new StructureComponent(); - component.setStructureId(structure.getId()); - component.setPartId(childPart.getId()); - component.setPlanningMethod(childPart.getPlanningMethod()); - component.setQpa(new BigDecimal(data.getQpa())); - component.setLineItemNo(Integer.valueOf(data.getLineItemNo())); - component.setDiscNum(StringUtils.isEmpty(data.getDiskNum()) ? null : new Long(data.getDiskNum())); - //鏌ヨ宸ュ簭 濡傛灉鏈夊涓幏鍙栫涓�涓� - List<Operation> operationList = operationMapper.selectList(Wrappers.<Operation>lambdaQuery() - .eq(Operation::getName, data.getOperationName()) - .eq(Operation::getActive, true).orderByAsc(Operation::getId)); - if (CollectionUtil.isEmpty(operationList)) { - throw new RuntimeException("宸ュ簭" + data.getOperationName() + "涓嶅瓨鍦�"); - } - component.setOperationId(operationList.get(0).getId()); - structureComponentMapper.insert(component); - uinck.add(structure.getId() + "_" + data.getLineItemNo()); - } + list.forEach(System.out::println); + System.out.println("================================"); + return; + //if (CollectionUtil.isEmpty(list)) { + // return; + //} + //List<String> uinck = new ArrayList<>(); + //for (StructureData data : list) { + // Part part = partMapper.selectOne(Wrappers.<Part>lambdaQuery().eq(Part::getPartNo, data.getFatherPartNo()).eq(Part::getEngChgLevel, data.getFatherVersion())); + // if (part == null) { + // throw new RuntimeException("闆朵欢鍙�:" + data.getFatherPartNo() + "涓嶅瓨鍦�"); + // } + // Structure structure = baseMapper.selectOne(Wrappers.<Structure>lambdaQuery() + // .eq(Structure::getPartId, part.getId()) + // .eq(Structure::getBomTypeDb, data.getStructureType()) + // .eq(Structure::getAlternativeNo, data.getAlternativeNo())); + // if (structure == null) { + // structure = new Structure(); + // structure.setPartId(part.getId()); + // structure.setVersion(data.getFatherVersion()); + // structure.setAlternativeDesc(data.getAlternativeDesc()); + // structure.setActive(true); + // structure.setBomTypeDb(data.getStructureType()); + // structure.setIfsSync(false); + // structure.setAlternativeNo(data.getAlternativeNo()); + // baseMapper.insert(structure); + // } + // if (uinck.contains(structure.getId() + "_" + data.getLineItemNo())) { + // throw new RuntimeException("闆朵欢鍙�:" + part.getPartNo() + "琛岄」鍙烽噸澶�"); + // } + // Part childPart = partMapper.selectOne(Wrappers.<Part>lambdaQuery().eq(Part::getPartNo, data.getChildPartNo()).eq(Part::getEngChgLevel, data.getChildVersion())); + // if (childPart == null) { + // throw new RuntimeException("闆朵欢鍙�:" + data.getChildPartNo() + "涓嶅瓨鍦�"); + // } + // StructureComponent component = new StructureComponent(); + // component.setStructureId(structure.getId()); + // component.setPartId(childPart.getId()); + // component.setPlanningMethod(childPart.getPlanningMethod()); + // component.setQpa(new BigDecimal(data.getQpa())); + // component.setLineItemNo(Integer.valueOf(data.getLineItemNo())); + // component.setDiscNum(StringUtils.isEmpty(data.getDiskNum()) ? null : new Long(data.getDiskNum())); + // //鏌ヨ宸ュ簭 濡傛灉鏈夊涓幏鍙栫涓�涓� + // List<Operation> operationList = operationMapper.selectList(Wrappers.<Operation>lambdaQuery() + // .eq(Operation::getName, data.getOperationName()) + // .eq(Operation::getActive, true).orderByAsc(Operation::getId)); + // if (CollectionUtil.isEmpty(operationList)) { + // throw new RuntimeException("宸ュ簭" + data.getOperationName() + "涓嶅瓨鍦�"); + // } + // component.setOperationId(operationList.get(0).getId()); + // structureComponentMapper.insert(component); + // uinck.add(structure.getId() + "_" + data.getLineItemNo()); + //} } @Override -- Gitblit v1.9.3