From 44a9b4729e058e75dfba2892803038ee91963d77 Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期一, 25 九月 2023 15:28:50 +0800
Subject: [PATCH] 修改4.0 9.25
---
inspect-server/src/main/java/com/yuanchu/mom/service/impl/FinishedInspectServiceImpl.java | 126 +++++++++--------------------------------
1 files changed, 29 insertions(+), 97 deletions(-)
diff --git a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/FinishedInspectServiceImpl.java b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/FinishedInspectServiceImpl.java
index 9704d8b..116f886 100644
--- a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/FinishedInspectServiceImpl.java
+++ b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/FinishedInspectServiceImpl.java
@@ -16,6 +16,7 @@
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
+import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Objects;
@@ -36,19 +37,10 @@
FinishedInspectMapper finishedInspectMapper;
@Resource
- MaterialMapper materialMapper;
-
- @Resource
- StandardService standardService;
-
- @Resource
- SpecificationsService specificationsService;
-
- @Resource
ManualTechnologyMapper manualTechnologyMapper;
@Resource
- ProductService productService;
+ ManualProductService manualProductService;
@Resource
InspectionItemService inspectionItemService;
@@ -72,6 +64,10 @@
@Override
@Transactional(rollbackFor = Exception.class)
public Integer addProcessInspectionSheet(String userId, FinishedInspectVo finishedInspectVo) {
+ //鏍规嵁鐢熶骇璁㈠崟id鏌ヨ缂栧埗宸ュ簭鐨勬渶鍚庝竴閬撳伐鑹�
+ List<ManualTechnology> manualTechnologyList = manualTechnologyMapper.selAllByMoId(finishedInspectVo.getId());
+ //鑾峰彇缂栧埗宸ヨ壓鏈�鍚庝竴閬撳伐鑹虹殑id
+ Integer mtId = manualTechnologyList.get(0).getId();
/*鏂板鎴愬搧妫�楠屽崟*/
FinishedInspect finishedInspect = new FinishedInspect();
finishedInspect.setUserId(Integer.parseInt(userId));
@@ -84,20 +80,16 @@
finishedInspect.setSpecificationsModel(finishedInspectVo.getSpecificationsModel());
finishedInspect.setMaterial(finishedInspectVo.getMaterial());
finishedInspect.setMaterialCode(finishedInspectVo.getMcode());
+ //finishedInspect.setTechId(technologyId);
finishedInspectMapper.insert(finishedInspect);
/*鎵归噺鏂板鎴愬搧妫�楠岄」鐩崟*/
- //鑾峰彇鍨嬪彿id
- Integer specificationId = getSpecificationId(finishedInspectVo.getMaterial(), finishedInspectVo.getMcode(), finishedInspectVo.getSpecificationsModel());
- //鏍规嵁鐢熶骇璁㈠崟id鏌ヨ缂栧埗宸ュ簭鐨勬渶鍚庝竴閬撳伐鑹�
- List<ManualTechnology> manualTechnologyList = manualTechnologyMapper.selAllByMoId(finishedInspectVo.getId());
- //鑾峰彇鏈�鍚庝竴閬撳伐鑹哄叧鑱旂殑宸ヨ壓璺嚎id
- Integer technologyId = manualTechnologyList.get(0).getTechnologyId();
- //鏌ヨ鏍囧噯BOM鎶�鏈寚鏍囦腑璇ュ瀷鍙峰伐鑹轰笅鏈�鏂扮増鏈殑妫�楠岄」鐩�
- Integer ver = productService.selectVerByPro(specificationId).get(0);//璇ュ瀷鍙蜂笅鎶�鏈寚鏍囨渶鏂扮増鏈�
- List<Product> productList = productService.selProByVerSpe(technologyId, ver);
- List<InspectionItem> inspectionItemList = productList.stream().map(product -> {
+ List<ManualProduct> manualProductList = manualProductService.selByMtid(mtId);
+ List<InspectionItem> inspectionItemList = manualProductList.stream().map(manualProduct -> {
InspectionItem inspectionItem = new InspectionItem();
- BeanUtils.copyProperties(product, inspectionItem);
+ BeanUtils.copyProperties(manualProductList, inspectionItem);
+ inspectionItem.setId(null);
+ inspectionItem.setCreateTime(new Date());
+ inspectionItem.setUpdateTime(new Date());
inspectionItem.setInspectId(finishedInspect.getId());
inspectionItem.setType(2);//鎴愬搧
return inspectionItem;
@@ -106,13 +98,14 @@
return finishedInspect.getId();
}
+
//涓婃姤(鏇存柊妫�楠岀姸鎬�)
@Override
@Transactional(rollbackFor = Exception.class)
- public String updateFinishInspectsById(String username,Integer id) {
+ public String updateFinishInspectsById(String username, Integer id,Integer number) {
/*鏇存柊妫�楠屽崟閲岄潰鐨勬楠岀粨璁�*/
//鍏堝垽鏂楠岀粨鏋�
- List<Integer> results = inspectionItemMapper.getResult(id,1);
+ List<Integer> results = inspectionItemMapper.getResult(id, 2);
int count = 0;
for (Integer result : results) {
if (result != null && result == 1) {
@@ -131,8 +124,18 @@
} else return "椤圭洰鏈楠屽畬!";
/*濡傛灉妫�楠岀粨璁轰负涓嶅悎鏍�,鍒欓渶瑕佹柊澧炰笉鍚堟牸妫�楠屽崟*/
if (finishedInspect.getResult() == 0) {
+ //鏌ヨ璇ユ楠屽崟鍝簺妫�楠岄」鐩笉鍚堟牸
+ List<InspectionItem> inspectionItemList = inspectionItemMapper.selectList(Wrappers.<InspectionItem>query()
+ .eq("inspect_id", id)
+ .eq("result", 0)
+ .eq("type", 2));
+ String msg = "";
+ for (InspectionItem inspectionItem : inspectionItemList) {
+ msg =msg+ inspectionItem.getName()+"-";
+ }
InspectUnaccepted finishUnaccepted = InspectUnaccepted.builder()
- .reason(finishedInspect.getMaterial() + "涓嶅悎鏍�") //鏆備笖瀹氫箟涓轰骇鍝佸悕绉颁笉鍚堟牸
+ .reason(msg + "涓嶅悎鏍�") //鏆備笖瀹氫箟涓洪」鐩�+涓嶅悎鏍�
+ .number(number)
.rawInspectId(id)
.type(1) //绫诲瀷涓烘垚鍝佹楠�
.build();
@@ -149,7 +152,7 @@
.eq(Repertory::getUnit, finishedInspect.getUnit())
.eq(Repertory::getType, 1);
Repertory rep = repertoryMapper.selectOne(queryWrapper);
- if (rep != null ) {
+ if (rep != null) {
rep.setNumber(rep.getNumber() + finishedInspect.getQuantity());
rep.setUserName(username);
repertoryMapper.updateById(rep);
@@ -174,7 +177,7 @@
//鍒嗛〉鏌ヨ鎴愬搧妫�楠屽崟鍒楄〃
@Override
public IPage<Map<String, Object>> selectFinishedInspectPage(Page<Object> page, Integer result, String material) {
- return finishedInspectMapper.selectFinishedInspectPage(page, result,material);
+ return finishedInspectMapper.selectFinishedInspectPage(page, result, material);
}
//鏍规嵁妫�楠屽崟id鏌ヨ鎴愬搧妫�楠屽崟璇︽儏
@@ -183,76 +186,5 @@
return finishedInspectMapper.selectFinishInspectsListById(id);
}
-
- /*鏍规嵁鏍峰搧鍚嶇О,鏍峰搧缂栧彿,鍨嬪彿瑙勬牸鑾峰彇鍨嬪彿id*/
- private Integer getSpecificationId(String name, String mcode, String specification) {
- //鑾峰彇鐗╂枡id
- Material material = materialMapper.selectOne(Wrappers.<Material>query()
- .eq("name", name)
- .eq("code", mcode));
- if (Objects.isNull(material)) {
- return null;
- }
- //鑾峰彇瑙勬牸鍚嶇О鍜屽瀷鍙峰悕绉�
- String[] split = specification.split("-");
- String stName = split[0];
- String spName = split[1];
- //鑾峰彇瑙勬牸id
- Standard standard = standardService.getOne(Wrappers.<Standard>query()
- .eq("name", stName)
- .eq("material_id", material.getId()));
- //鑾峰彇鍨嬪彿id
- Specifications specifications = specificationsService.getOne(Wrappers.<Specifications>query()
- .eq("name", spName)
- .eq("standard_id", standard.getId()));
- return specifications.getId();
- }
-
- /*鍒ゆ柇妫�娴嬪�兼槸鍚︽弧瓒虫爣鍑嗗�煎拰鍐呮帶鍊肩殑瑕佹眰,濡傛灉涓嶆弧瓒冲垯妫�楠岀粨璁轰负涓嶅悎鏍�*/
- private int checkValues(String standardValueStr, String controlValueStr, String detectionValueStr) {
- boolean isStandardValueSatisfied = isValueSatisfied(standardValueStr, detectionValueStr);
- boolean isControlValueSatisfied = isValueSatisfied(controlValueStr, detectionValueStr);
-
- if (isStandardValueSatisfied && isControlValueSatisfied) {
- return 1;
- } else {
- return 0;
- }
- }
-
- private boolean isValueSatisfied(String valueStr, String detectionValueStr) {
- String substring = valueStr.substring(1, 2);
- if (substring.equals("=")) {
- String operator = valueStr.substring(0, 2);
- Double standardValue = Double.parseDouble(valueStr.substring(2));
- Double detectionValue = Double.parseDouble(detectionValueStr);
- switch (operator) {
- case ">=":
- return detectionValue >= standardValue;
- case "<=":
- return detectionValue <= standardValue;
- default:
- return false;
- }
- } else {
- String operator = valueStr.substring(0, 1);
- Double standardValue = Double.parseDouble(valueStr.substring(1));
- Double detectionValue = Double.parseDouble(detectionValueStr);
- switch (operator) {
- case ">":
- return detectionValue > standardValue;
- case "鈮�":
- return detectionValue >= standardValue;
- case "鈮�":
- return detectionValue <= standardValue;
- case "<":
- return detectionValue < standardValue;
- case "=":
- return detectionValue.equals(standardValue);
- default:
- return false;
- }
- }
- }
}
--
Gitblit v1.9.3