From 22899f74279a47f4ec79e1325f8489d948ced005 Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期五, 15 九月 2023 17:24:44 +0800
Subject: [PATCH] 修改2.0 9.15
---
standard-server/src/main/java/com/yuanchu/mom/service/impl/SpecificationsServiceImpl.java | 34 +++++++++++++++++++++++-----------
1 files changed, 23 insertions(+), 11 deletions(-)
diff --git a/standard-server/src/main/java/com/yuanchu/mom/service/impl/SpecificationsServiceImpl.java b/standard-server/src/main/java/com/yuanchu/mom/service/impl/SpecificationsServiceImpl.java
index 9b37d8c..714960b 100644
--- a/standard-server/src/main/java/com/yuanchu/mom/service/impl/SpecificationsServiceImpl.java
+++ b/standard-server/src/main/java/com/yuanchu/mom/service/impl/SpecificationsServiceImpl.java
@@ -9,6 +9,7 @@
import com.yuanchu.mom.service.*;
import com.yuanchu.mom.utils.MyUtil;
import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
@@ -62,7 +63,16 @@
//(4绾�)鏂板-->鍨嬪彿
@Override
- public void addSpecifications(SpecificationsDto specificationsDto) {
+ @Transactional(rollbackFor = Exception.class)
+ public String addSpecifications(SpecificationsDto specificationsDto) {
+ //鏍¢獙娣诲姞璇ユ爣鍑嗕笅鐨勫瀷鍙锋槸鍚﹂噸澶�
+ List<String> specificationsNameList = specificationsMapper.selectList(Wrappers.<Specifications>query().eq("standard_id", specificationsDto.getId())).stream().map(specifications -> {
+ String specificationsName = specifications.getName();
+ return specificationsName;
+ }).collect(Collectors.toList());
+ if (specificationsNameList.contains(specificationsDto.getSpecifications())){
+ return "璇ユ爣鍑嗕笅鏈夎鍨嬪彿";
+ }
/*鏂板鍨嬪彿琛�*/
Specifications specifications = new Specifications();
specifications.setStandardId(specificationsDto.getId());
@@ -71,7 +81,17 @@
/*鏂板鏍囧噯BOM-->宸ヨ壓璺嚎(鎵归噺娣诲姞)*/
//鏍规嵁鏍囧噯id鏌ヨ鐗╂枡澶х被
Material material = materialMapper.selFath(specificationsDto.getId());
- List<TechnologyTemplate> technologyTemplateList = technologyTemplateMapper.selectList(Wrappers.<TechnologyTemplate>query().eq("type", material.getFather()));
+ Integer type = null;
+ if (material.getFather().equals("姗¤兌杩炴帴鍣�")){
+ type=0;
+ }else if (material.getFather().equals("閲戝睘杩炴帴鍣�")){
+ type=1;
+ }else if(material.getFather().equals("婀挎彃鎷旂數杩炴帴鍣�")){
+ type=2;
+ }else if(material.getFather().equals("鍒嗘敮缁勪欢")){
+ type=3;
+ }else return "娣诲姞鍨嬪彿銆�" + specificationsDto.getSpecifications() + "銆戞垚鍔�";
+ List<TechnologyTemplate> technologyTemplateList = technologyTemplateMapper.selectList(Wrappers.<TechnologyTemplate>query().eq("type",type));
List<Technology> technologyList = technologyTemplateList.stream().map(technologyTemplate -> {
Technology technology = new Technology();
technology.setSpecificationsId(specifications.getId());
@@ -135,15 +155,7 @@
}
}
techniqueService.saveBatch(techniqueList);
- }
-
- /**
- * 妫�楠屾ā鍧�-->QMS绠$悊-->鎴愬搧妫�楠�-->鏂板(闇�瑕佽鏍煎瀷鍙风殑Id涓庡悕绉�)
- */
- @Override
- public List<Map<String, Object>> selectSpecificationIdAndName(Integer materialId) {
- List<Map<String, Object>> maps = specificationsMapper.selectSpecificationIdAndName(materialId);
- return maps;
+ return "娣诲姞鍨嬪彿銆�"+ specificationsDto.getSpecifications() +"銆戞垚鍔燂紒";
}
}
--
Gitblit v1.9.3