From e0fac38b26845f25de479783e0c76cf12a5311e0 Mon Sep 17 00:00:00 2001
From: cl <418351270@qq.com>
Date: 星期五, 19 一月 2024 10:31:28 +0800
Subject: [PATCH] 修改数据采集

---
 guns-vip-main/src/main/java/cn/stylefeng/guns/modular/om/productionOrdeInfo/controller/ProductionOrdeInfoController.java |  105 +++++++++++++++++++++++++++++++++++++++++++---------
 1 files changed, 87 insertions(+), 18 deletions(-)

diff --git a/guns-vip-main/src/main/java/cn/stylefeng/guns/modular/om/productionOrdeInfo/controller/ProductionOrdeInfoController.java b/guns-vip-main/src/main/java/cn/stylefeng/guns/modular/om/productionOrdeInfo/controller/ProductionOrdeInfoController.java
index c8244c7..6a19b39 100644
--- a/guns-vip-main/src/main/java/cn/stylefeng/guns/modular/om/productionOrdeInfo/controller/ProductionOrdeInfoController.java
+++ b/guns-vip-main/src/main/java/cn/stylefeng/guns/modular/om/productionOrdeInfo/controller/ProductionOrdeInfoController.java
@@ -11,6 +11,7 @@
 import cn.stylefeng.guns.modular.bs.materialInfo.entity.MaterialInfo;
 import cn.stylefeng.guns.modular.bs.materialInfo.service.MaterialInfoService;
 import cn.stylefeng.guns.modular.cm.passingStationCollection.entity.PassingStationCollection;
+import cn.stylefeng.guns.modular.cm.passingStationCollection.model.result.PassingStationCollectionResult;
 import cn.stylefeng.guns.modular.cm.passingStationCollection.service.PassingStationCollectionService;
 import cn.stylefeng.guns.modular.om.productionOrdeInfo.entity.ProductionOrdeInfo;
 import cn.stylefeng.guns.modular.om.productionOrdeInfo.model.params.ProductionOrdeInfoParam;
@@ -604,6 +605,8 @@
         List categoryList = new ArrayList();
         List lineDataList = new ArrayList();
         List barDataList = new ArrayList();
+        List percentageList = new ArrayList();
+        percentageList.add(0);
 
         ProductionOrdeInfo result = null;
         //浣嗗墠宸ュ崟
@@ -618,25 +621,64 @@
             List<ProductionOrdeInfo> workOrderNo = productionOrdeInfoService.list(new QueryWrapper<ProductionOrdeInfo>().eq("work_order_no", results.get(0).getWorkOrderNo()));
             result = workOrderNo.get(0);
         }
-        for (String o : getLocationList()) {
-            List<PassingStationCollection> list = passingStationCollectionService.list(new QueryWrapper<PassingStationCollection>()
-                    .eq("location_code", o)
-                    .eq("out_rs_sign", "2")
-                    .eq("work_order_no",result.getWorkOrderNo())
-            );
-            List<PassingStationCollection> lineList = passingStationCollectionService.list(new QueryWrapper<PassingStationCollection>()
-                    .eq("location_code", o)
-                    .eq("work_order_no",result.getWorkOrderNo())
-            );
-            categoryList.add(o);
-            barDataList.add(list.size());
-            lineDataList.add(lineList.size());
-        }
-        map.put("category",categoryList);
-        map.put("barData",barDataList);
-        map.put("lineData",lineDataList);
+        List<PassingStationCollectionResult> resultList = passingStationCollectionService.centerLeftData(productionOrdeInfoParam.getWorkOrderNo());
+        int unQuantity = passingStationCollectionService.getUnqualifiedQuantity(productionOrdeInfoParam.getWorkOrderNo());
+        int variableInt = 0;
+        if(unQuantity == 0){
+            map.put("category",getLocationList());
+            map.put("barData",getZeroList());
+            map.put("percentage",getPercentageList());
 
+        }else {
+            for (int i = 0; i < resultList.size(); i++) {
+                categoryList.add(resultList.get(i).getLocationCode());
+                barDataList.add(resultList.get(i).getNum());
+                variableInt+=Integer.valueOf(resultList.get(i).getNum());
+                percentageList.add(Math.round((float) variableInt / unQuantity * 100));
+            }
+            map.put("category",categoryList);
+            map.put("barData",barDataList);
+            map.put("lineData",lineDataList);
+            map.put("percentage",percentageList);
+        }
         return ResponseData.success(map);
+//        Map map = new HashMap<String,String>();
+//        List categoryList = new ArrayList();
+//        List lineDataList = new ArrayList();
+//        List barDataList = new ArrayList();
+//
+//        ProductionOrdeInfo result = null;
+//        //浣嗗墠宸ュ崟
+//        List<ProductionOrdeInfo> orderStatus = productionOrdeInfoService.list(new QueryWrapper<ProductionOrdeInfo>().eq("order_status", "3"));
+//        if(productionOrdeInfoParam.getWorkOrderNo() != null && !productionOrdeInfoParam.getWorkOrderNo().equals("")){
+//            List<ProductionOrdeInfo> workOrderNo = productionOrdeInfoService.list(new QueryWrapper<ProductionOrdeInfo>().eq("work_order_no", productionOrdeInfoParam.getWorkOrderNo()));
+//            result = workOrderNo.get(0);
+//        }else if(orderStatus.size()!=0){
+//            result = orderStatus.get(0);
+//        }else {
+//            List<ProductionOrdeInfoResult> results = productionOrdeInfoService.orderDescListFive();
+//            List<ProductionOrdeInfo> workOrderNo = productionOrdeInfoService.list(new QueryWrapper<ProductionOrdeInfo>().eq("work_order_no", results.get(0).getWorkOrderNo()));
+//            result = workOrderNo.get(0);
+//        }
+//        for (String o : getLocationList()) {
+//            List<PassingStationCollection> list = passingStationCollectionService.list(new QueryWrapper<PassingStationCollection>()
+//                    .eq("location_code", o)
+//                    .eq("out_rs_sign", "2")
+//                    .eq("work_order_no",result.getWorkOrderNo())
+//            );
+//            List<PassingStationCollection> lineList = passingStationCollectionService.list(new QueryWrapper<PassingStationCollection>()
+//                    .eq("location_code", o)
+//                    .eq("work_order_no",result.getWorkOrderNo())
+//            );
+//            categoryList.add(o);
+//            barDataList.add(list.size());
+//            lineDataList.add(lineList.size());
+//        }
+//        map.put("category",categoryList);
+//        map.put("barData",barDataList);
+//        map.put("lineData",lineDataList);
+//
+//        return ResponseData.success(map);
     }
 
     @ResponseBody
@@ -668,8 +710,12 @@
                     .eq("out_rs_sign", "2")
                     .eq("work_order_no",result.getWorkOrderNo())
             );
+            List<PassingStationCollection> list1 = passingStationCollectionService.list(new QueryWrapper<PassingStationCollection>()
+                    .eq("location_code", o)
+                    .eq("work_order_no",result.getWorkOrderNo())
+            );
             Integer unqualified = list.size();
-            Integer qualified = result.getActualQty()-list.size();
+            Integer qualified = list1.size()-list.size();
             unqualifiedList.add(unqualified);
             qualifiedList.add(qualified);
             if(unqualified == 0){
@@ -756,6 +802,29 @@
         return locationList;
     }
 
+    public static List<String> getZeroList(){
+        List<String> locationList = new ArrayList<>();
+        locationList.add("0");
+        locationList.add("0");
+        locationList.add("0");
+        locationList.add("0");
+        locationList.add("0");
+        locationList.add("0");
+        return locationList;
+    }
+
+    public static List<String> getPercentageList(){
+        List<String> locationList = new ArrayList<>();
+        locationList.add("100");
+        locationList.add("100");
+        locationList.add("100");
+        locationList.add("100");
+        locationList.add("100");
+        locationList.add("100");
+        return locationList;
+    }
+
+
     public static List<String> getCenterRightSpit(){
         List<String> locationList = new ArrayList<>();
         locationList.add("8:00");

--
Gitblit v1.9.3