From 69f3d9e338f29af69def24839e9b8cdd276a0472 Mon Sep 17 00:00:00 2001 From: zss <zss@example.com> Date: 星期四, 08 八月 2024 11:41:03 +0800 Subject: [PATCH] 检验任务保存优化+模版样式修改 --- inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java | 54 ++++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 40 insertions(+), 14 deletions(-) diff --git a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java index 05d37ca..cc30704 100644 --- a/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java +++ b/inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java @@ -336,7 +336,7 @@ for (InsFibers insFiber : insFibers) { List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery().eq(InsProduct::getInsFibersId, insFiber.getId())); List<Integer> collect = insProducts.stream().map(InsProduct::getInsResult) - .filter(sm -> ObjectUtils.isNotEmpty(sm) && sm!=2).collect(Collectors.toList()); + .filter(sm -> ObjectUtils.isNotEmpty(sm) && sm != 2).collect(Collectors.toList()); if (insProducts.size() == collect.size()) { insFiber.setState(1);//宸叉楠� } else { @@ -349,7 +349,7 @@ for (InsFiber insFiber : fiberList) { List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery().eq(InsProduct::getInsFiberId, insFiber.getId())); List<Integer> collect = insProducts.stream().map(InsProduct::getInsResult) - .filter(sm -> ObjectUtils.isNotEmpty(sm) && sm!=2).collect(Collectors.toList()); + .filter(sm -> ObjectUtils.isNotEmpty(sm) && sm != 2).collect(Collectors.toList()); if (insProducts.size() == collect.size()) { insFiber.setState(1);//宸叉楠� } else { @@ -363,7 +363,7 @@ for (InsFiber insFiber : insFiberList) { List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery().eq(InsProduct::getInsFiberId, insFiber.getId())); List<Integer> collect = insProducts.stream().map(InsProduct::getInsResult) - .filter(sm -> ObjectUtils.isNotEmpty(sm) && sm!=2).collect(Collectors.toList()); + .filter(sm -> ObjectUtils.isNotEmpty(sm) && sm != 2).collect(Collectors.toList()); if (insProducts.size() == collect.size()) { insFiber.setState(1);//宸叉楠� } else { @@ -378,7 +378,7 @@ .eq(InsProduct::getInsBushId, insBushing.getId())); List<Integer> collect = insProducts.stream() .map(InsProduct::getInsResult) - .filter(sm -> ObjectUtils.isNotEmpty(sm) && sm!=2).collect(Collectors.toList()); + .filter(sm -> ObjectUtils.isNotEmpty(sm) && sm != 2).collect(Collectors.toList()); if (insProducts.size() == collect.size()) { insBushing.setState(1);//宸叉楠� } else { @@ -516,6 +516,7 @@ insProduct.setId(Integer.parseInt(k)); List<InsProductResult> results = insProductResultMapper.selectList(Wrappers.<InsProductResult>lambdaQuery() .eq(InsProductResult::getInsProductId, insProduct.getId())); + InsProduct product = insProductMapper.selectById(insProduct.getId()); InsProductResult result; if (CollectionUtils.isEmpty(results)) { result = new InsProductResult(); @@ -523,7 +524,16 @@ result = results.get(0); } result.setInsProductId(Integer.parseInt(k)); + /*鏍¢獙涓�涓媟esult琛�*/ + List<InsProductResult> insProductResultss = insProductResultMapper.selectList(Wrappers.<InsProductResult>lambdaQuery() + .eq(InsProductResult::getInsProductId, insProduct.getId())); + if (insProductResultss.size() > 1) { + for (int i = 1; i < insProductResultss.size(); i++) { + insProductResultMapper.deleteById(insProductResultss.get(i)); + } + } InsProductResult insProductResult = insProductResultMapper.selectOne(Wrappers.<InsProductResult>lambdaQuery().eq(InsProductResult::getInsProductId, Integer.parseInt(k))); + //妫�楠屽�� if (jo.get("insValue") != null) { JSONArray jsonArray = JSON.parseArray(JSON.toJSONString(jo.get("insValue"))); List<Map<String, Object>> iv = new ArrayList<>(); @@ -546,6 +556,7 @@ } result.setInsValue(JSON.toJSONString(iv)); } + //璁$畻鍊� if (jo.get("comValue") != null && !Objects.equals(jo.get("comValue"), "")) { JSONArray jsonArray2 = JSON.parseArray(JSON.toJSONString(jo.get("comValue"))); List<Map<String, Object>> cv = new ArrayList<>(); @@ -557,6 +568,7 @@ } result.setComValue(JSON.toJSONString(cv)); } + //鏈�缁堝�� try { JSONObject resValue = JSON.parseObject(JSON.toJSONString(jo.get("resValue"))); if (resValue.get("v") != null) { @@ -566,6 +578,7 @@ } catch (Exception e) { insProduct.setLastValue("");//'' } + //璁惧缂栧彿 if (jo.get("equipValue") != null) { JSONArray jsonArray2 = JSON.parseArray(JSON.toJSONString(jo.get("equipValue"))); List<Map<String, Object>> ev = new ArrayList<>(); @@ -577,6 +590,7 @@ } result.setEquipValue(JSON.toJSONString(ev)); } + //璁惧鍚嶇О if (jo.get("equipName") != null) { JSONArray jsonArray2 = JSON.parseArray(JSON.toJSONString(jo.get("equipName"))); List<Map<String, Object>> ev = new ArrayList<>(); @@ -588,6 +602,7 @@ } result.setEquipName(JSON.toJSONString(ev)); } + //缁撹 try { JSONObject insResult = JSON.parseObject(JSON.toJSONString(jo.get("insResult"))); String ir = JSON.parseObject(JSON.toJSONString(insResult.get("v"))).get("v") + ""; @@ -607,7 +622,6 @@ /*濡傛灉鏄涓�娆¢�夋嫨璁惧淇℃伅,涓旇繕鏈夊叾浣欐牱鍝佷篃鏈夊悓涓�涓粡楠岄」鐩�,閭d箞鎵�鏈夋牱鍝佺殑璇ラ」鐩兘鐢ㄨ繖涓澶囦俊鎭�*/ //鍏堟煡璇㈡槸鍚﹁繕鏈夊叾浣欐牱鍝� - InsProduct product = insProductMapper.selectById(insProduct.getId()); Integer insSampleId = product.getInsSampleId(); List<InsSample> insSamples = insSampleMapper.selectList(Wrappers.<InsSample>lambdaQuery().eq(InsSample::getInsOrderId, insSampleMapper.selectById(insSampleId).getInsOrderId())); @@ -623,9 +637,9 @@ .eq(InsProduct::getInspectionItemSubclassEn, product.getInspectionItemSubclassEn()) .eq(InsProduct::getTemplateId, product.getTemplateId()) .eq(InsProduct::getStandardMethodListId, product.getStandardMethodListId()) - .eq(InsProduct::getInsBushId,product.getInsBushId()) - .eq(InsProduct::getInsFibersId,product.getInsFibersId()) - .eq(InsProduct::getInsFiberId,product.getInsFiberId()) + .eq(InsProduct::getInsBushId, product.getInsBushId()) + .eq(InsProduct::getInsFibersId, product.getInsFibersId()) + .eq(InsProduct::getInsFiberId, product.getInsFiberId()) ); if (ObjectUtils.isNotEmpty(product1)) { //濡傛灉瀛樺湪椤圭洰,鏌ヨ鏄惁鏈夎〃 @@ -685,18 +699,30 @@ isWithinRange = !now.isBefore(startTime) || !now.isAfter(endTime); } //鍔犵彮 - AuxiliaryOutputWorkingHours count1 = auxiliaryOutputWorkingHoursMapper.selectOne(Wrappers.<AuxiliaryOutputWorkingHours>lambdaQuery() + List<AuxiliaryOutputWorkingHours> count1s = auxiliaryOutputWorkingHoursMapper.selectList(Wrappers.<AuxiliaryOutputWorkingHours>lambdaQuery() .eq(AuxiliaryOutputWorkingHours::getCheck, userId) .eq(AuxiliaryOutputWorkingHours::getInspectionItem, insProduct.getInspectionItem()) .eq(AuxiliaryOutputWorkingHours::getInspectionItemSubclass, insProduct.getInspectionItemSubclass()) - .eq(AuxiliaryOutputWorkingHours::getOvertimeOrderNo, insOrder.getEntrustCode())); + .eq(AuxiliaryOutputWorkingHours::getOvertimeOrderNo, insOrder.getEntrustCode()) + .eq(AuxiliaryOutputWorkingHours::getSample, insSampleMapper.selectById(insProduct.getInsSampleId()).getSampleCode())); + if (count1s.size() > 1) { + for (int i = 1; i < count1s.size(); i++) { + auxiliaryOutputWorkingHoursMapper.deleteById(count1s.get(i)); + } + } //闈炲姞鐝� - AuxiliaryOutputWorkingHours count2 = auxiliaryOutputWorkingHoursMapper.selectOne(Wrappers.<AuxiliaryOutputWorkingHours>lambdaQuery() + List<AuxiliaryOutputWorkingHours> count2s = auxiliaryOutputWorkingHoursMapper.selectList(Wrappers.<AuxiliaryOutputWorkingHours>lambdaQuery() .eq(AuxiliaryOutputWorkingHours::getCheck, userId) .eq(AuxiliaryOutputWorkingHours::getInspectionItem, insProduct.getInspectionItem()) .eq(AuxiliaryOutputWorkingHours::getInspectionItemSubclass, insProduct.getInspectionItemSubclass()) - .eq(AuxiliaryOutputWorkingHours::getOrderNo, insOrder.getEntrustCode())); - if (ObjectUtils.isNotEmpty(insProduct.getManHour()) && ObjectUtils.isEmpty(count2) && ObjectUtils.isEmpty(count1)) { + .eq(AuxiliaryOutputWorkingHours::getOrderNo, insOrder.getEntrustCode()) + .eq(AuxiliaryOutputWorkingHours::getSample, insSampleMapper.selectById(insProduct.getInsSampleId()).getSampleCode())); + if (count2s.size() > 1) { + for (int i = 1; i < count2s.size(); i++) { + auxiliaryOutputWorkingHoursMapper.deleteById(count2s.get(i)); + } + } + if (ObjectUtils.isNotEmpty(insProduct.getManHour()) && CollectionUtils.isEmpty(count2s) && CollectionUtils.isEmpty(count1s)) { AuxiliaryOutputWorkingHours auxiliaryOutputWorkingHours = new AuxiliaryOutputWorkingHours(); if (isWithinRange) { //鍦ㄦ椂闂村唴灏辨槸姝e父涓婄彮 @@ -3459,7 +3485,7 @@ put("createTime", now.format(DateTimeFormatter.ofPattern("yyyy骞碝M鏈坉d鏃�"))); put("createTimeEn", monthNames[now.getMonthValue() - 1] + " " + now.getDayOfMonth() + ", " + now.getYear()); put("insTime", insOrder.getInsTime().format(DateTimeFormatter.ofPattern("yyyy骞碝M鏈坉d鏃�"))); - put("insTimeEn", monthNames[insOrder.getInsTime().getMonthValue() - 1] + " " + now.getDayOfMonth() + ", " + now.getYear()); + put("insTimeEn", monthNames[insOrder.getInsTime().getMonthValue() - 1] + " " + insOrder.getInsTime().getDayOfMonth() + ", " + insOrder.getInsTime().getYear()); put("writeUrl", null); put("insUrl", Pictures.ofLocal(imgUrl + "/" + signatureUrl).create()); put("images", images); -- Gitblit v1.9.3