懒羊羊
2023-12-11 99991a3f52eb415f226537f4cda00a5fc20bc82f
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");