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/controller/BomController.java          |    5 
 mes-technology/src/main/java/com/chinaztt/mes/technology/service/impl/BomServiceImpl.java       |   30 ++++-
 mes-technology/src/main/java/com/chinaztt/mes/technology/controller/StructureController.java    |   41 +++++--
 mes-basic/src/main/java/com/chinaztt/mes/basic/service/impl/PartServiceImpl.java                |    4 
 mes-technology/src/main/java/com/chinaztt/mes/technology/excel/StructureUploadListener.java     |   24 ++--
 mes-technology/src/main/java/com/chinaztt/mes/technology/service/impl/StructureServiceImpl.java |  101 ++++++++++---------
 mes-technology/src/main/java/com/chinaztt/mes/technology/excel/StructureData.java               |   46 +++++++++
 7 files changed, 161 insertions(+), 90 deletions(-)

diff --git a/mes-basic/src/main/java/com/chinaztt/mes/basic/service/impl/PartServiceImpl.java b/mes-basic/src/main/java/com/chinaztt/mes/basic/service/impl/PartServiceImpl.java
index 8ce1260..60b2a39 100644
--- a/mes-basic/src/main/java/com/chinaztt/mes/basic/service/impl/PartServiceImpl.java
+++ b/mes-basic/src/main/java/com/chinaztt/mes/basic/service/impl/PartServiceImpl.java
@@ -517,10 +517,6 @@
 		}
 	}
 
-
-
-
-
 	public void asyncExcel(MultipartFile file,Map<String, String> dicmattype,Map<String, String> dicunit){
 		File file1 = MultipartFileToFile.multipartFileToFile(file);
 		CsvReader reader = CsvUtil.getReader();
diff --git a/mes-technology/src/main/java/com/chinaztt/mes/technology/controller/BomController.java b/mes-technology/src/main/java/com/chinaztt/mes/technology/controller/BomController.java
index b84375a..bb123f5 100644
--- a/mes-technology/src/main/java/com/chinaztt/mes/technology/controller/BomController.java
+++ b/mes-technology/src/main/java/com/chinaztt/mes/technology/controller/BomController.java
@@ -21,9 +21,7 @@
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.chinaztt.mes.common.wrapper.QueryWrapperUtil;
 import com.chinaztt.mes.technology.dto.BomDTO;
-import com.chinaztt.mes.technology.dto.StructureTree;
 import com.chinaztt.mes.technology.entity.Bom;
-import com.chinaztt.mes.technology.entity.Operation;
 import com.chinaztt.mes.technology.entity.Structure;
 import com.chinaztt.mes.technology.excel.BomData;
 import com.chinaztt.mes.technology.excel.BomUploadListener;
@@ -42,8 +40,6 @@
 
 import java.io.IOException;
 import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
 
 
 /**
@@ -199,6 +195,7 @@
 	public R addByStructure() {
 		// 鑾峰彇闇�瑕佽繘琛屾瀯寤築OM鐨勪骇鍝佺粨鏋�
 		List<Structure> structures = structureService.getBuildBom();
+		structures.forEach(System.out::println);
 		return bomService.saveALLBom(structures);
 	}
 }
diff --git a/mes-technology/src/main/java/com/chinaztt/mes/technology/controller/StructureController.java b/mes-technology/src/main/java/com/chinaztt/mes/technology/controller/StructureController.java
index 18365c3..67f390b 100644
--- a/mes-technology/src/main/java/com/chinaztt/mes/technology/controller/StructureController.java
+++ b/mes-technology/src/main/java/com/chinaztt/mes/technology/controller/StructureController.java
@@ -19,14 +19,14 @@
 
 import com.alibaba.excel.EasyExcel;
 import com.alibaba.excel.ExcelReader;
-import com.alibaba.excel.read.builder.ExcelReaderBuilder;
 import com.alibaba.excel.read.metadata.ReadSheet;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.chinaztt.mes.basic.util.DictUtils;
 import com.chinaztt.mes.common.wrapper.QueryWrapperUtil;
-import com.chinaztt.mes.technology.excel.*;
 import com.chinaztt.mes.technology.dto.StructureDTO;
 import com.chinaztt.mes.technology.entity.StructureComponent;
+import com.chinaztt.mes.technology.excel.StructureData;
+import com.chinaztt.mes.technology.excel.StructureUploadListener;
 import com.chinaztt.mes.technology.service.StructureService;
 import com.chinaztt.ztt.admin.api.entity.SysDictItem;
 import com.chinaztt.ztt.admin.api.feign.RemoteDictService;
@@ -41,7 +41,6 @@
 
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
-import java.util.ArrayList;
 import java.util.List;
 
 
@@ -69,17 +68,32 @@
 	 */
 	@PostMapping("/uploadExt")
 	public R uploadExt(@RequestParam("file") MultipartFile file) {
+		//ExcelReader excelReader = null;
+		//try {
+		//	ExcelReaderBuilder excelReaderBuilder = EasyExcel.read(file.getInputStream());
+		//	excelReader = excelReaderBuilder.build();
+		//	List<ReadSheet> sheets = excelReader.excelExecutor().sheetList();
+		//	List<ReadSheet> readSheetList = new ArrayList<>();
+		//	for (ReadSheet sheet : sheets) {
+		//		ReadSheet readSheet = EasyExcel.readSheet(sheet.getSheetName()).registerReadListener(new StructureUploadExtListener(structureService)).build();
+		//		readSheetList.add(readSheet);
+		//	}
+		//	excelReader.read(readSheetList);
+		//} catch (IOException e) {
+		//	e.printStackTrace();
+		//	return R.failed(e.getMessage());
+		//} finally {
+		//	if (excelReader != null) {
+		//		// 杩欓噷鍗冧竾鍒繕璁板叧闂紝璇荤殑鏃跺�欎細鍒涘缓涓存椂鏂囦欢锛屽埌鏃剁鐩樹細宕╃殑
+		//		excelReader.finish();
+		//	}
+		//}
 		ExcelReader excelReader = null;
 		try {
-			ExcelReaderBuilder excelReaderBuilder = EasyExcel.read(file.getInputStream());
-			excelReader = excelReaderBuilder.build();
-			List<ReadSheet> sheets = excelReader.excelExecutor().sheetList();
-			List<ReadSheet> readSheetList = new ArrayList<>();
-			for (ReadSheet sheet : sheets) {
-				ReadSheet readSheet = EasyExcel.readSheet(sheet.getSheetName()).registerReadListener(new StructureUploadExtListener(structureService)).build();
-				readSheetList.add(readSheet);
-			}
-			excelReader.read(readSheetList);
+			excelReader = EasyExcel.read(file.getInputStream(), StructureData.class, new StructureUploadListener(structureService, dictUtils)).build();
+			ReadSheet readSheet = EasyExcel.readSheet(0).build();
+			ReadSheet readSheet2 = EasyExcel.readSheet(1).build();
+			excelReader.read(readSheet,readSheet2);
 		} catch (IOException e) {
 			e.printStackTrace();
 			return R.failed(e.getMessage());
@@ -104,7 +118,8 @@
 		try {
 			excelReader = EasyExcel.read(file.getInputStream(), StructureData.class, new StructureUploadListener(structureService, dictUtils)).build();
 			ReadSheet readSheet = EasyExcel.readSheet(0).build();
-			excelReader.read(readSheet);
+			ReadSheet readSheet2 = EasyExcel.readSheet(1).build();
+			excelReader.read(readSheet,readSheet2);
 		} catch (IOException e) {
 			e.printStackTrace();
 			return R.failed(e.getMessage());
diff --git a/mes-technology/src/main/java/com/chinaztt/mes/technology/excel/StructureData.java b/mes-technology/src/main/java/com/chinaztt/mes/technology/excel/StructureData.java
index 78e96d8..3b85722 100644
--- a/mes-technology/src/main/java/com/chinaztt/mes/technology/excel/StructureData.java
+++ b/mes-technology/src/main/java/com/chinaztt/mes/technology/excel/StructureData.java
@@ -1,7 +1,6 @@
 package com.chinaztt.mes.technology.excel;
 
 import com.alibaba.excel.annotation.ExcelProperty;
-import jdk.nashorn.internal.objects.annotations.Property;
 import lombok.Data;
 
 /**
@@ -11,6 +10,51 @@
 @Data
 public class StructureData {
 
+	@ExcelProperty(value = "瀹㈡埛")
+	private String custom;
+
+	@ExcelProperty(value = "闆朵欢鍙�")
+	private String partNo;
+
+	@ExcelProperty(value = "闆朵欢鍚嶇О")
+	private String partName;
+
+	@ExcelProperty(value = "瀛愪欢缂栧彿")
+	private String sonPartNo;
+
+	@ExcelProperty(value = "瀛愪欢鍚嶇О锛堝彲澶氬~锛�")
+	private String sonPartName;
+
+	@ExcelProperty(value = "妯″叿缂栧彿")
+	private String sharpenerNo;
+
+	@ExcelProperty(value = "姣忔ā绌存暟")
+	private String caveNum;
+
+	@ExcelProperty(value = "浜у搧鍏嬮噸锛坘g锛�")
+	private String gramWeight;
+
+	@ExcelProperty(value = "娴囧彛鍏嬮噸锛坘g锛�")
+	private String gateGramWeight;
+
+	@ExcelProperty(value = "鎴愬瀷鍛ㄦ湡锛圫锛�")
+	private String moldingCycle;
+
+	@ExcelProperty(value = "鏈哄彴锛堝惃锛�")
+	private String machine;
+
+	@ExcelProperty(value = "鍥炴枡姣斾緥锛�%锛�")
+	private String scale;
+
+	@ExcelProperty(value= "鐑樻枡鏃堕棿锛圚锛�")
+	private String dryingTime;
+
+	@ExcelProperty(value = "鐑樻枡娓╁害锛堚剝锛�")
+	private String dryingTemperature;
+
+	@ExcelProperty(value = "鍖呰淇℃伅")
+	private String packingInfo;
+
 	@ExcelProperty(value = "鐖朵欢")
 	private String fatherPartNo;
 
diff --git a/mes-technology/src/main/java/com/chinaztt/mes/technology/excel/StructureUploadListener.java b/mes-technology/src/main/java/com/chinaztt/mes/technology/excel/StructureUploadListener.java
index 7cc99b1..89d7a99 100644
--- a/mes-technology/src/main/java/com/chinaztt/mes/technology/excel/StructureUploadListener.java
+++ b/mes-technology/src/main/java/com/chinaztt/mes/technology/excel/StructureUploadListener.java
@@ -45,18 +45,18 @@
 		if (StringUtils.isEmpty(data.getAlternativeNo())) {
 			data.setAlternativeNo("*");
 		}
-		if (StringUtils.isEmpty(data.getChildPartNo()) || StringUtils.isEmpty(data.getChildVersion()) || StringUtils.isEmpty(data.getFatherPartNo()) || StringUtils.isEmpty(data.getFatherVersion())) {
-			throw new RuntimeException("缂哄皯闆朵欢鏁版嵁缂栧彿鎴栬�呯増鏈�");
-		}
-		if (StringUtils.isEmpty(data.getQpa())) {
-			throw new RuntimeException("缂哄皯鏁伴噺");
-		}
-		if (StringUtils.isEmpty(data.getLineItemNo())) {
-			throw new RuntimeException("缂哄皯琛岄」鍙�");
-		}
-		if (StringUtils.isEmpty(data.getOperationName())) {
-			throw new RuntimeException("缂哄皯宸ュ簭");
-		}
+		//if (StringUtils.isEmpty(data.getChildPartNo()) || StringUtils.isEmpty(data.getChildVersion()) || StringUtils.isEmpty(data.getFatherPartNo()) || StringUtils.isEmpty(data.getFatherVersion())) {
+		//	throw new RuntimeException("缂哄皯闆朵欢鏁版嵁缂栧彿鎴栬�呯増鏈�");
+		//}
+		//if (StringUtils.isEmpty(data.getQpa())) {
+		//	throw new RuntimeException("缂哄皯鏁伴噺");
+		//}
+		//if (StringUtils.isEmpty(data.getLineItemNo())) {
+		//	throw new RuntimeException("缂哄皯琛岄」鍙�");
+		//}
+		//if (StringUtils.isEmpty(data.getOperationName())) {
+		//	throw new RuntimeException("缂哄皯宸ュ簭");
+		//}
 		data.setStructureType(StringUtils.isEmpty(data.getStructureType()) ? "M" : dicbomtype.get(data.getStructureType()));
 		list.add(data);
 		// 杈惧埌BATCH_COUNT浜嗭紝闇�瑕佸幓瀛樺偍涓�娆℃暟鎹簱锛岄槻姝㈡暟鎹嚑涓囨潯鏁版嵁鍦ㄥ唴瀛橈紝瀹规槗OOM
diff --git a/mes-technology/src/main/java/com/chinaztt/mes/technology/service/impl/BomServiceImpl.java b/mes-technology/src/main/java/com/chinaztt/mes/technology/service/impl/BomServiceImpl.java
index f5a24cb..cacfed0 100644
--- a/mes-technology/src/main/java/com/chinaztt/mes/technology/service/impl/BomServiceImpl.java
+++ b/mes-technology/src/main/java/com/chinaztt/mes/technology/service/impl/BomServiceImpl.java
@@ -40,6 +40,7 @@
 import com.chinaztt.mes.technology.state.bom.constant.BomStates;
 import com.chinaztt.ztt.common.core.util.R;
 import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.BeanUtils;
 import org.springframework.messaging.Message;
 import org.springframework.messaging.support.MessageBuilder;
@@ -66,6 +67,7 @@
 @Service
 @AllArgsConstructor
 @Transactional(rollbackFor = Exception.class)
+@Slf4j
 public class BomServiceImpl extends ServiceImpl<BomMapper, Bom> implements BomService {
 
 	private NumberGenerator<Bom> numberGenerator;
@@ -162,10 +164,13 @@
 			bom.setVersion(structure.getVersion());
 			bom.setAlternativeNo(structure.getAlternativeNo());
 			bom.setAlternativeDesc(structure.getAlternativeDesc());
-			StructureTree tree = getAllBomExt(bom, 998);
+			//log.info("绗竴灞�========================銆�"+bom);
+			StructureTree tree = getAllBomExt(bom, 999);
 			BomDTO bomDTO = new BomDTO();
 			BeanUtils.copyProperties(bom, bomDTO);
 			bomDTO.setTree(tree);
+			//BomDTO bomDTO = getBomDtoById(structure.getPartId());
+			log.info("bomDto============>"+bomDTO);
 			saveBom(bomDTO);
 		});
 		return R.ok();
@@ -221,12 +226,14 @@
 			return;
 		}
 		Part parentPart = partMapper.selectById(parentPartId);
-		//"P" 铏氭嫙浠剁殑鎰忔�� 鍦ㄤ竴涓狟OM涓紝闄ゆ牴鑺傜偣澶栵紝鍏朵綑鑺傜偣鑻ヤ笉鏄櫄鎷熶欢锛堥浂浠躲�愯鍒掓柟娉曘�戜笉涓篜 鍜� K锛夛紝鍒欑姝负鍏跺鍔犲瓙浠躲��
-		if (!bom.getPartId().equals(parentPartId)) {
-			if (!"P".equals(parentPart.getPlanningMethod()) && !"K".equals(parentPart.getPlanningMethod())) {
-				throw new RuntimeException(parentPart.getPartNo() + parentPart.getPartName() + "涓洪潪铏氭嫙浠讹紝涓嶅彲娣诲姞瀛愪欢");
-			}
-		}
+		log.error("parentId=======>"+parentPartId);
+		log.error("bomParentId====>"+bom);
+		////"P" 铏氭嫙浠剁殑鎰忔�� 鍦ㄤ竴涓狟OM涓紝闄ゆ牴鑺傜偣澶栵紝鍏朵綑鑺傜偣鑻ヤ笉鏄櫄鎷熶欢锛堥浂浠躲�愯鍒掓柟娉曘�戜笉涓篜 鍜� K锛夛紝鍒欑姝负鍏跺鍔犲瓙浠躲��
+		//if (!bom.getPartId().equals(parentPartId)) {
+		//	if (!"P".equals(parentPart.getPlanningMethod()) && !"K".equals(parentPart.getPlanningMethod())) {
+		//		throw new RuntimeException(parentPart.getPartNo() + parentPart.getPartName() + "涓洪潪铏氭嫙浠讹紝涓嶅彲娣诲姞瀛愪欢");
+		//	}
+		//}
 		for (StructureTree child : children) {
 			BomComponent bomComp = new BomComponent();
 			bomComp.setQpa(child.getQpa());
@@ -263,6 +270,7 @@
 	 */
 	@Override
 	public StructureTree getAllBomExt(Bom bom, int bomLayers) {
+		log.info("鐢熸垚鏍�=======銆�");
 		Long partId = bom.getPartId();
 		String version = bom.getVersion();
 		String alternativeNo = bom.getAlternativeNo();
@@ -288,7 +296,9 @@
 	 * @Date: 2022-06-01
 	 */
 	private StructureTree getRootNode(Long partId) {
+		log.info("鑾峰彇bom鏍硅妭鐐�====銆�"+partId);
 		Part part = partMapper.selectById(partId);
+		log.info("鐖剁骇闆朵欢====銆�"+part);
 		StructureTree root = new StructureTree();
 		root.setPartName(part.getPartName());
 		root.setPlanningMethod(part.getPlanningMethod());
@@ -352,13 +362,16 @@
 	@Override
 	public BomDTO getBomDtoById(Long id) {
 		Bom bom = baseMapper.selectById(id);
+		log.info("getBomDtoById=>>>"+bom);
 		//濡傛灉瀛樺湪鏈粦瀹氬伐搴忕殑 宸ヨ壓璺嚎 鍒欎細涓虹┖
 		List<StructureTree> nodes = baseMapper.getBomComponents4Tree(id);
 		if (CollectionUtil.isEmpty(nodes)) {
 			return null;
 		}
 		StructureTree root = nodes.stream().filter(e -> e.getParentId() == null || e.getParentId() == 0).findFirst().get();
+		log.info("root=======>"+root);
 		setChildren(root, nodes);
+		log.info("setChildren鍚�========銆�"+root);
 		Part part = partMapper.selectById(bom.getPartId());
 		BomDTO bomDto = new BomDTO();
 		BeanUtils.copyProperties(bom, bomDto);
@@ -557,6 +570,7 @@
 	 */
 	private void getStructureByPartId(StructureTree parent, Long partId, Map<Long, Integer> cache, String version,
 									  String alternativeNo, String bomType, int bomLayers) {
+		log.info("姣忓眰鏍�===================銆�"+parent);
 		Integer cycleCount = cache.get(partId) == null ? 0 : cache.get(partId);
 		if (cycleCount >= CYCLE_DEEP) {
 			return;
@@ -565,6 +579,7 @@
 		}
 		//鏍规嵁闆朵欢鎵惧埌缁撴瀯涓昏〃
 		List<Structure> structures = getRootNodes(partId, version, alternativeNo, bomType);
+		log.info("寰楀埌缁撴瀯=========銆�"+structures);
 		if (CollectionUtil.isNotEmpty(structures)) {
 			for (Structure structure : structures) {
 
@@ -598,6 +613,7 @@
 					}
 					// 濉厖child鑺傜偣鏁版嵁
 					StructureTree child = fillChildNode(parent, component, structure, part);
+					log.info("鑺傜偣鏁版嵁====================銆�"+child);
 					if (bomLayers == 999) {
 						getStructureByPartId(child, component.getPartId(), cache, "ALL", "ALL", bomType, bomLayers);
 						// 鍒ゆ柇鍒扮鍑犲眰浜嗭紝鍒堕�犵被鍨嬩负1-宸插埗閫狅紝璁″垝鏂规硶涓篜-铏氭嫙浠�
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