From e78cc56f04556a1d3d54f0db830ba9f16eb28a58 Mon Sep 17 00:00:00 2001
From: zss <zss@example.com>
Date: 星期六, 03 八月 2024 21:40:53 +0800
Subject: [PATCH] 检验下单待检撤销+删除检验值结论还在

---
 inspect-server/src/main/java/com/yuanchu/mom/service/impl/InsOrderPlanServiceImpl.java |   90 +++++++++++++++++++++-----------------------
 1 files changed, 43 insertions(+), 47 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 0c9bc4f..cbc5ab0 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
@@ -135,6 +135,7 @@
 
     @Resource
     private InsOrderFileMapper insOrderFileMapper;
+
     @Override
     public Map<String, Object> selectInsOrderPlanList(Page page, InsOrderPlanDTO insOrderPlanDTO) {
         Map<String, Object> map = new HashMap<>();
@@ -153,13 +154,13 @@
                 laboratory = departLims;
             }
         }
-        Integer userId =null;
-        if (ObjectUtil.isNotEmpty(insOrderPlanDTO.getUserId()) ) {
+        Integer userId = null;
+        if (ObjectUtil.isNotEmpty(insOrderPlanDTO.getUserId())) {
             userId = map1.get("userId");
             insOrderPlanDTO.setUserId(userId.longValue());
         }
         String sonLaboratory = insOrderPlanDTO.getSonLaboratory();//璇曢獙瀹�
-        IPage<InsOrderPlanVO> insOrderPage = insSampleMapper.findInsSampleAndOrder(page, QueryWrappers.queryWrappers(insOrderPlanDTO), userId,sonLaboratory,laboratory);
+        IPage<InsOrderPlanVO> insOrderPage = insSampleMapper.findInsSampleAndOrder(page, QueryWrappers.queryWrappers(insOrderPlanDTO), userId, sonLaboratory, laboratory);
         map.put("body", insOrderPage);
         return map;
     }
@@ -187,7 +188,7 @@
             insOrderPlanDTO.setUserId(userId.longValue());
         }
         String sonLaboratory = insOrderPlanDTO.getSonLaboratory();//璇曢獙瀹�
-        IPage<InsOrderPlanTaskSwitchVo> insOrderPage = insSampleMapper.inspectionOrderDetailsTaskSwitching(page, QueryWrappers.queryWrappers(insOrderPlanDTO), userId,sonLaboratory,laboratory);
+        IPage<InsOrderPlanTaskSwitchVo> insOrderPage = insSampleMapper.inspectionOrderDetailsTaskSwitching(page, QueryWrappers.queryWrappers(insOrderPlanDTO), userId, sonLaboratory, laboratory);
         map.put("body", insOrderPage);
         return map;
     }
@@ -200,7 +201,7 @@
         }
         Map<String, Integer> map1 = getLook.selectPowerByMethodAndUserId(null);
         Integer userId = map1.get("userId");
-        InsSampleUser insSampleUser = new InsSampleUser(entity.getInsSampleId().intValue(), userId, 1,entity.getSonLaboratory());
+        InsSampleUser insSampleUser = new InsSampleUser(entity.getInsSampleId().intValue(), userId, 1, entity.getSonLaboratory());
         return insSampleUserMapper.insert(insSampleUser) > 0;
     }
 
@@ -251,7 +252,7 @@
     private List<InsProduct> getDeviceMessage(List<InsProduct> insProducts, HttpServletRequest request) {
         String ipAddress = request.getRemoteAddr();
         // 闃叉鍥炵幆鍦板潃鍙樹负IPv6
-        String ip =  ipAddress.equals("0:0:0:0:0:0:0:1") ? "127.0.0.1" : ipAddress;
+        String ip = ipAddress.equals("0:0:0:0:0:0:0:1") ? "127.0.0.1" : ipAddress;
         insProducts.forEach(i -> {
             Map<String, Object> devices = baseMapper.getDeviceMessage(ip, i.getInspectionItem(), i.getInspectionItemSubclass(), i.getSampleType());
             if (ObjectUtils.isNotEmpty(devices) && ObjectUtils.isNotEmpty(devices.get("file_type")) && ObjectUtils.isNotEmpty(devices.get("collect_url"))) {
@@ -275,6 +276,7 @@
         });
         return insProducts;
     }
+
     @Override
     public List<String> checkSubmitPlan(Integer orderId, String laboratory) {
         List<String> collect = new ArrayList<>();
@@ -353,9 +355,9 @@
                 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)).collect(Collectors.toList());
-                    if (insProducts.size()==collect.size()) {
+                    if (insProducts.size() == collect.size()) {
                         insFiber.setState(1);//宸叉楠�
-                    }else {
+                    } else {
                         insFiber.setState(0);//鏈楠�
                     }
                 }
@@ -365,9 +367,9 @@
                 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)).collect(Collectors.toList());
-                    if (insProducts.size()==collect.size()) {
+                    if (insProducts.size() == collect.size()) {
                         insFiber.setState(1);//宸叉楠�
-                    }else {
+                    } else {
                         insFiber.setState(0);//鏈楠�
                     }
                 }
@@ -378,9 +380,9 @@
                 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)).collect(Collectors.toList());
-                    if (insProducts.size()==collect.size()) {
+                    if (insProducts.size() == collect.size()) {
                         insFiber.setState(1);//宸叉楠�
-                    }else {
+                    } else {
                         insFiber.setState(0);//鏈楠�
                     }
                 }
@@ -403,7 +405,7 @@
         //鍏堟煡鍑鸿繖涓牱鍝佷笅鏈夊摢浜涚鑹叉爣,鍏夌氦甯�,鍏夌氦鑹叉爣
         //鍏堟煡鍑哄绠�
         List<InsBushing> insBushings = insBushingMapper.selectList(Wrappers.<InsBushing>lambdaQuery().eq(InsBushing::getInsSampleId, sampleId));
-        if (insBushings.size()>0) {
+        if (insBushings.size() > 0) {
             //閫氫俊--娓╁害寰幆
             for (InsBushing insBushing : insBushings) {
                 //鍐嶆煡璇㈠嚭鎵�鏈夌殑鍏夌氦甯�
@@ -430,13 +432,13 @@
                                     insProduct.setInsProductResult(insProductResult);
                                 }
                                 //姹傚悓绛夋潯浠朵笅1娆″惊鐜�20搴﹀父娓╃殑璁$畻鍊�
-                                InsProductResult insProductResult1 = insProductResultMapper.selectOne(Wrappers.<InsProductResult>lambdaQuery().eq(InsProductResult::getInsProductId,insProductMapper.selectOne(Wrappers.<InsProduct>lambdaQuery()
-                                        .eq(InsProduct::getInsSampleId,sampleId)
+                                InsProductResult insProductResult1 = insProductResultMapper.selectOne(Wrappers.<InsProductResult>lambdaQuery().eq(InsProductResult::getInsProductId, insProductMapper.selectOne(Wrappers.<InsProduct>lambdaQuery()
+                                        .eq(InsProduct::getInsSampleId, sampleId)
                                         .eq(InsProduct::getInspectionItem, "1")
                                         .eq(InsProduct::getInspectionItemSubclass, "20鈩�(甯告俯)")
                                         .eq(InsProduct::getInspectionItemClass, insProduct.getInspectionItemClass())
-                                        .eq(InsProduct::getInsFiberId, fiber.getId())).getId() ));
-                                if (ObjectUtils.isNotEmpty(insProductResult1) &&!insProductResult1.getComValue().equals("[]")) {
+                                        .eq(InsProduct::getInsFiberId, fiber.getId())).getId()));
+                                if (ObjectUtils.isNotEmpty(insProductResult1) && !insProductResult1.getComValue().equals("[]")) {
                                     insProduct.setComplue(insProductResult1.getComValue().split(":")[1].split("\"")[1]);
                                 }
                                 productVo.setInsProduct(insProduct);
@@ -444,8 +446,7 @@
                             }
                         }
                     }
-                }
-                else {
+                } else {
                     //濡傛灉濂楃涓嬫病鏈夊厜绾ゅ甫灏卞彧鏈夊厜绾や簡
                     List<InsFiber> insFiberList = insFiberMapper.selectList(Wrappers.<InsFiber>lambdaQuery().eq(InsFiber::getInsBushingId, insBushing.getId()));
                     for (InsFiber fiber : insFiberList) {
@@ -463,12 +464,12 @@
                             productVo.setBushColor(fiber.getBushColor());
                             insProduct.setInsProductResult(insProductResult);
                             //姹傚悓绛夋潯浠朵笅1娆″惊鐜�20搴﹀父娓╃殑璁$畻鍊�
-                            InsProductResult insProductResult1 = insProductResultMapper.selectOne(Wrappers.<InsProductResult>lambdaQuery().eq(InsProductResult::getInsProductId,insProductMapper.selectOne(Wrappers.<InsProduct>lambdaQuery()
-                                    .eq(InsProduct::getInsSampleId,sampleId)
+                            InsProductResult insProductResult1 = insProductResultMapper.selectOne(Wrappers.<InsProductResult>lambdaQuery().eq(InsProductResult::getInsProductId, insProductMapper.selectOne(Wrappers.<InsProduct>lambdaQuery()
+                                    .eq(InsProduct::getInsSampleId, sampleId)
                                     .eq(InsProduct::getInspectionItem, "1")
                                     .eq(InsProduct::getInspectionItemSubclass, "20鈩�(甯告俯)")
                                     .eq(InsProduct::getInspectionItemClass, insProduct.getInspectionItemClass())
-                                    .eq(InsProduct::getInsFiberId, fiber.getId())).getId() ));
+                                    .eq(InsProduct::getInsFiberId, fiber.getId())).getId()));
                             if (ObjectUtils.isNotEmpty(insProductResult1) && !insProductResult1.getComValue().equals("[]")) {
                                 insProduct.setComplue(insProductResult1.getComValue().split(":")[1].split("\"")[1]);
                             }
@@ -479,8 +480,7 @@
                 }
             }
             productVos = productVos.stream().sorted(Comparator.comparing(productVo -> productVo.getInsProduct().getInspectionItemClass())).collect(Collectors.toList());
-        }
-        else {
+        } else {
             //鐢靛姏--鐑惊鐜拰娓╁崌璇曢獙
             List<InsProduct> insProducts = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery()
                     .eq(InsProduct::getInsSampleId, sampleId)
@@ -564,6 +564,7 @@
                         insProduct.setLastValue(o.equals("") ? null : (o.toString()));
                     }
                 } catch (Exception e) {
+                    insProduct.setLastValue("");//''
                 }
                 if (jo.get("equipValue") != null) {
                     JSONArray jsonArray2 = JSON.parseArray(JSON.toJSONString(jo.get("equipValue")));
@@ -592,6 +593,7 @@
                     String ir = JSON.parseObject(JSON.toJSONString(insResult.get("v"))).get("v") + "";
                     insProduct.setInsResult(Integer.parseInt(ir));
                 } catch (Exception e) {
+                    insProduct.setInsResult(2);//寰呭畾
                 }
                 if (BeanUtil.isEmpty(result.getId())) {
                     result.setCreateUser(userId);
@@ -616,9 +618,9 @@
                 PerformanceShift performanceShift = performanceShiftMapper.selectOne(Wrappers.<PerformanceShift>lambdaQuery()
                         .eq(PerformanceShift::getUserId, userId)
                         .eq(PerformanceShift::getWorkTime, today));
-                if (ObjectUtils.isNotEmpty(performanceShift)){
+                if (ObjectUtils.isNotEmpty(performanceShift)) {
                     ShiftTime shiftTime = shiftTimeMapper.selectOne(Wrappers.<ShiftTime>lambdaQuery().eq(ShiftTime::getShift, performanceShift.getShift()));
-                    if (ObjectUtils.isNotEmpty(shiftTime)){
+                    if (ObjectUtils.isNotEmpty(shiftTime)) {
                         DateTimeFormatter forma = DateTimeFormatter.ofPattern("HH:mm");
                         LocalTime now = LocalTime.now();
                         LocalTime startTime = LocalTime.parse(shiftTime.getStartTime(), forma);
@@ -644,7 +646,7 @@
                                 .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)) {
+                        if (ObjectUtils.isNotEmpty(insProduct.getManHour()) && ObjectUtils.isEmpty(count2) && ObjectUtils.isEmpty(count1)) {
                             AuxiliaryOutputWorkingHours auxiliaryOutputWorkingHours = new AuxiliaryOutputWorkingHours();
                             if (isWithinRange) {
                                 //鍦ㄦ椂闂村唴灏辨槸姝e父涓婄彮
@@ -654,7 +656,7 @@
                                 auxiliaryOutputWorkingHours.setOrderNo(insOrder.getEntrustCode());//闈炲姞鐝鎵樺崟鍙�
                                 auxiliaryOutputWorkingHours.setWorkTime(insProduct.getManHour());//闈炲姞鐝伐鏃�
                                 auxiliaryOutputWorkingHours.setAmount(1);//闈炲姞鐝暟閲�
-                                auxiliaryOutputWorkingHours.setOutputWorkTime((ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHours.getOvertimeWorkTime())?auxiliaryOutputWorkingHours.getOvertimeWorkTime():0)+(ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHours.getWorkTime())?auxiliaryOutputWorkingHours.getWorkTime():0));//浜ч噺宸ユ椂
+                                auxiliaryOutputWorkingHours.setOutputWorkTime((ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHours.getOvertimeWorkTime()) ? auxiliaryOutputWorkingHours.getOvertimeWorkTime() : 0) + (ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHours.getWorkTime()) ? auxiliaryOutputWorkingHours.getWorkTime() : 0));//浜ч噺宸ユ椂
                                 auxiliaryOutputWorkingHours.setManHourGroup(insProduct.getManHourGroup());//宸ユ椂鍒嗙粍
                                 DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
                                 DateTimeFormatter formatters = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
@@ -672,7 +674,7 @@
                                 auxiliaryOutputWorkingHours.setOvertimeOrderNo(insOrder.getEntrustCode());//鍔犵彮濮旀墭鍗曞彿
                                 auxiliaryOutputWorkingHours.setOvertimeWorkTime(insProduct.getManHour());//鍔犵彮宸ユ椂
                                 auxiliaryOutputWorkingHours.setOvertimeAmount(1);//鍔犵彮鏁伴噺
-                                auxiliaryOutputWorkingHours.setOutputWorkTime((ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHours.getOvertimeWorkTime())?auxiliaryOutputWorkingHours.getOvertimeWorkTime():0)+(ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHours.getWorkTime())?auxiliaryOutputWorkingHours.getWorkTime():0));//浜ч噺宸ユ椂
+                                auxiliaryOutputWorkingHours.setOutputWorkTime((ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHours.getOvertimeWorkTime()) ? auxiliaryOutputWorkingHours.getOvertimeWorkTime() : 0) + (ObjectUtils.isNotEmpty(auxiliaryOutputWorkingHours.getWorkTime()) ? auxiliaryOutputWorkingHours.getWorkTime() : 0));//浜ч噺宸ユ椂
                                 auxiliaryOutputWorkingHours.setManHourGroup(insProduct.getManHourGroup());//宸ユ椂鍒嗙粍
                                 DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
                                 DateTimeFormatter formatters = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
@@ -734,7 +736,7 @@
 
     //浜ゆ帴
     @Override
-    public int upPlanUser(Integer userId, Integer orderId,String sonLaboratory) {
+    public int upPlanUser(Integer userId, Integer orderId, String sonLaboratory) {
         InsSampleUser insSampleUser = new InsSampleUser();
         insSampleUser.setUserId(userId);
         insSampleUser.setInsSampleId(orderId);
@@ -1118,8 +1120,8 @@
                     if (i % number == 0) {
                         List<RowRenderData> rows = new ArrayList<>();
                         //琛ㄦ牸鐨勮鏁� 脳 鈭� 鉁� 鉁�
-                        long count1 = size-(index-1)*number < number ? size-(index-1)*number + 3 : number + 3;
-                        for (int j = 0; j <count1 ; j++) {
+                        long count1 = size - (index - 1) * number < number ? size - (index - 1) * number + 3 : number + 3;
+                        for (int j = 0; j < count1; j++) {
                             RowRenderData rowRenderData = new RowRenderData();
                             RowStyle rowStyle = new RowStyle();
                             rowStyle.setHeight(40);
@@ -1161,8 +1163,7 @@
                                         cellRenderData.setParagraphs(paragraphRenderDataList);
                                         cells.add(cellRenderData);
                                     }
-                                }
-                                else if (j == 1) {
+                                } else if (j == 1) {
                                     //绗簩琛�
                                     if (k == 0) {
                                         //绗竴鍒�
@@ -1205,8 +1206,7 @@
                                         cellRenderData.setParagraphs(paragraphRenderDataList);
                                         cells.add(cellRenderData);
                                     }
-                                }
-                                else if (j == count1-1) {
+                                } else if (j == count1 - 1) {
                                     //鏈�鍚庝竴琛�
                                     if (k == 0 || k == 1) {
                                         //鍓嶄袱鍒�
@@ -1224,8 +1224,7 @@
                                         cellRenderData.setParagraphs(paragraphRenderDataList);
                                         cells.add(cellRenderData);
                                     }
-                                }
-                                else {
+                                } else {
                                     if (k == 0) {
                                         //绗竴鍒�
                                         textRenderData.setText((j - 1) + "");
@@ -1593,7 +1592,7 @@
                     if (i % 16 == 0) {
                         //鏍峰搧鏁伴噺瓒呰繃16闇�瑕佹柊澧炶〃鏍�
                         List<RowRenderData> rows = new ArrayList<>();
-                        int count2 = sampleList.size()-(index41-1)*16 < 16 ? (int) (sampleList.size() - (index41 - 1) * 16 + 1) : 17;
+                        int count2 = sampleList.size() - (index41 - 1) * 16 < 16 ? (int) (sampleList.size() - (index41 - 1) * 16 + 1) : 17;
                         //琛ㄦ牸鐨勮鏁�
                         for (int j = 0; j < count2; j++) {
                             RowRenderData rowRenderData = new RowRenderData();
@@ -1649,8 +1648,7 @@
                                         cellRenderData.setParagraphs(paragraphRenderDataList);
                                         cells.add(cellRenderData);
                                     }
-                                }
-                                else {
+                                } else {
                                     if (k == 0) {
                                         //绗竴鍒�
                                         textRenderData.setText(sampleList.get(0).getModel() + "鈭�44");
@@ -1789,7 +1787,7 @@
             } catch (Exception e) {
                 throw new ErrorException("鎵句笉鍒版楠屼汉鐨勭鍚�");
             }
-            if (ObjectUtils.isEmpty(signatureUrl)  || signatureUrl.equals("")) {
+            if (ObjectUtils.isEmpty(signatureUrl) || signatureUrl.equals("")) {
                 throw new ErrorException("鎵句笉鍒版楠屼汉鐨勭鍚�");
             }
             //Custom custom = customMapper.selectById(user.get("company"));
@@ -3479,8 +3477,7 @@
             } catch (IOException e) {
                 throw new RuntimeException(e);
             }
-        }
-        else {
+        } else {
             //澶嶆牳涓嶉�氳繃灏嗘妸澶嶆牳鐨勮礋璐d汉鍘绘帀
             Integer id = insSampleUserMapper.selectOne(Wrappers.<InsSampleUser>lambdaQuery().eq(InsSampleUser::getInsSampleId, orderId).orderByDesc(InsSampleUser::getId).last("limit 1")).getId();
             insSampleUserMapper.deleteById(id);
@@ -3548,7 +3545,7 @@
                     insProductMapper.updateById(product);
                 }
                 //濡傛灉鏄儹寰幆鎴栬�呮槸娓╁崌璇曢獙
-                else if (product.getInspectionItem().equals("鐑惊鐜�") || product.getInspectionItem().equals("娓╁崌璇曢獙")){
+                else if (product.getInspectionItem().equals("鐑惊鐜�") || product.getInspectionItem().equals("娓╁崌璇曢獙")) {
                     //鏌ヨ杩欎簺椤圭洰涓嬬殑鍏朵粬妫�楠岄」鐩槸鍚﹀叏閮ㄦ楠�
                     List<InsProduct> insProductList = insProductMapper.selectList(Wrappers.<InsProduct>lambdaQuery()
                             .eq(InsProduct::getInsSampleId, product.getInsSampleId())
@@ -3564,8 +3561,7 @@
                         product.setInsResult(1);
                     }
                     insProductMapper.updateById(product);
-                }
-                else {
+                } else {
                     count++;
                     str += "<br/>" + count + "锛�" + product.getInspectionItem() + " " + product.getInspectionItemSubclass() + "<br/>";
                 }

--
Gitblit v1.9.3