From 279b381d288cf6d1358408684d308d50ef3dd7a5 Mon Sep 17 00:00:00 2001
From: Fixiaobai <fixiaobai@163.com>
Date: 星期五, 03 十一月 2023 09:10:54 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 mes-basic/src/main/java/com/chinaztt/mes/basic/service/impl/PartServiceImpl.java |   51 ++++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 46 insertions(+), 5 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 3efc91a..8ce1260 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
@@ -39,6 +39,7 @@
 import com.chinaztt.mes.basic.util.DictUtils;
 import com.chinaztt.mes.basic.util.PartUtils;
 import com.chinaztt.mes.basic.util.TransactionUtils;
+import com.chinaztt.mes.basic.vo.PartVo;
 import com.chinaztt.mes.common.util.JsonUtil;
 import com.chinaztt.mes.common.util.MultipartFileToFile;
 import com.chinaztt.ztt.common.core.util.R;
@@ -57,6 +58,7 @@
 import org.apache.http.impl.client.HttpClientBuilder;
 import org.apache.http.params.CoreConnectionPNames;
 import org.apache.http.util.EntityUtils;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.cloud.client.discovery.DiscoveryClient;
 import org.springframework.core.env.Environment;
@@ -311,11 +313,6 @@
 			throw new RuntimeException("闆朵欢鍙风増鏈彿閲嶅锛�" + partByFind.getPartName() + "-" + partByFind.getPartNo());
 		}
 		baseMapper.insert(part);
-		//瀵规帴IFS
-//		R result = ifsFeignClient.importInventPartStd(new JSONObject().fluentPut("BATCH_INFO", new JSONArray().fluentAdd(ifsDataMake(part))), true);
-//		if (result.getCode() == 1) {
-//			throw new RuntimeException("IFS閿欒鈥斺��" + result.getMsg());
-//		}
 		return true;
 	}
 
@@ -480,6 +477,50 @@
 		},threadPoolTaskExecutor);
 	}
 
+	//瑙﹀彂闆朵欢
+	@Override
+	public String triggerAdd(PartVo partVo) {
+		Part part = new Part();
+		BeanUtils.copyProperties(partVo,part);
+		//鍒涘缓鑰�
+		part.setCreateUser(partVo.getCreate_name());
+		//鏇存柊鑰�
+		part.setUpdateUser(partVo.getUpdate_name());
+		//闆朵欢鍙�
+		part.setPartNo(partVo.getMaterial_number());
+		//鍚嶇О
+		part.setPartName(partVo.getMaterial_name());
+		//闆朵欢鎻忚堪
+		part.setDescription(partVo.getMaterial_description());
+		//鍗曚綅
+		part.setUnit(partVo.getUnit());
+		//涓�绾у垎绫�
+		part.setAssortment(partVo.getFirstCategoryName());
+		//浜岀骇鍒嗙被
+		part.setCategory(partVo.getSecondCategoryName());
+		//涓夌骇鍒嗙被
+		part.setThreeLevelClassification(partVo.getThirdCategoryName());
+		//瑙勬牸
+		part.setSpecs(partVo.getMaterial_spec());
+		//鐗堟湰鍙�
+		part.setEngChgLevel(partVo.getTemplate_version().substring(1));
+		//璁″垝鏂规硶
+		part.setPlanningMethod("A");
+		//鍨嬪彿
+		part.setPartModel(partVo.getMaterial_spec());
+		if (partVo.getType().equals("add")){
+			baseMapper.insert(part);
+			return "鏂板"+part.getPartNo()+"闆朵欢鍙锋垚鍔�" ;
+		}else {
+			baseMapper.update(part,Wrappers.<Part>lambdaUpdate().eq(Part::getPartNo,part.getPartNo()));
+			return "淇敼"+part.getPartNo()+"闆朵欢鍙锋垚鍔�" ;
+		}
+	}
+
+
+
+
+
 	public void asyncExcel(MultipartFile file,Map<String, String> dicmattype,Map<String, String> dicunit){
 		File file1 = MultipartFileToFile.multipartFileToFile(file);
 		CsvReader reader = CsvUtil.getReader();

--
Gitblit v1.9.3