From 0d7f3104244ca76fdb3a8b70117c51f25dce4c36 Mon Sep 17 00:00:00 2001
From: 懒羊羊 <15939171744@163.com>
Date: 星期一, 11 九月 2023 15:54:02 +0800
Subject: [PATCH] 大屏

---
 guns-vip-main/src/main/java/cn/stylefeng/guns/modular/om/productionOrdeInfo/controller/ProductionOrdeInfoController.java |  111 ++++++++++++++++++++++++++++++++++++++++---------------
 1 files changed, 81 insertions(+), 30 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 2af65c0..5bf5e95 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
@@ -13,6 +13,7 @@
 import cn.stylefeng.guns.sys.modular.system.entity.Dict;
 import cn.stylefeng.guns.sys.modular.system.service.DictService;
 import cn.stylefeng.roses.core.base.controller.BaseController;
+import cn.stylefeng.roses.core.util.ToolUtil;
 import cn.stylefeng.roses.kernel.model.response.ResponseData;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -27,6 +28,7 @@
 import org.apache.poi.xssf.usermodel.XSSFSheet;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.core.parameters.P;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.ModelMap;
 import org.springframework.web.bind.annotation.*;
@@ -132,7 +134,7 @@
     public ResponseData editItem(ProductionOrdeInfoParam productionOrdeInfoParam) {
         if(productionOrdeInfoParam.getFlag()!=null){
             productionOrdeInfoParam.setActualStartTime(new Date());
-       }
+        }
         this.productionOrdeInfoService.update(productionOrdeInfoParam);
         this.productionOrdeInfoService.saveOrderBatchInfo(productionOrdeInfoParam);
         return ResponseData.success();
@@ -255,8 +257,16 @@
     @CrossOrigin
     @RequestMapping("/lineFinishQty")
     public ResponseData lineFinishQty() {
-        List list = this.productionOrdeInfoService.lineFinishQty();
-        return ResponseData.success(list);
+        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
+        List resultList = new ArrayList();
+        List<ProductionOrdeInfoResult> list = this.productionOrdeInfoService.lineFinishQty();
+        for (ProductionOrdeInfoResult productionOrdeInfo : list) {
+            Map map = new HashMap();
+            map.put("name",format.format(productionOrdeInfo.getActualStartTime()));
+            map.put("value",productionOrdeInfo.getActualQty());
+            resultList.add(map);
+        }
+        return ResponseData.success(resultList);
     }
 
     /**
@@ -267,14 +277,50 @@
     @CrossOrigin
     @RequestMapping("/workshopOrderDetail")
     public ResponseData workshopOrderDetail(ProductionOrdeInfoParam productionOrdeInfoParam) {
+//        NumberFormat numberFormat = NumberFormat.getInstance();
+//        numberFormat.setMaximumFractionDigits(2);
+//        ProductionOrdeInfo one = productionOrdeInfoService.getOne(new QueryWrapper<ProductionOrdeInfo>()
+//                .select("SUM\n" +
+//                        "\t( plan_qty ) AS planQty,\n" +
+//                        "\tSUM ( actual_qty ) AS actualQty,\n" +
+//                        "\tSUM ( scrap_qty ) AS scrapQty ")
+//        );
+//        //璁″垝
+//        Integer plqnQty = one.getPlanQty();
+//        //瀹屾垚
+//        Integer actualQty = one.getActualQty();
+//        //鎶ュ簾
+//        Integer scrapQty = one.getScrapQty();
+//        //鍚堟牸鏁伴噺
+//        Integer paseQty = actualQty-scrapQty;
+//
+//        Map map = new HashMap<String,String>();
+//        map.put("produceQty",plqnQty);
+//        map.put("finishQty",actualQty);
+//        map.put("paseQty",paseQty);
+//        map.put("noPaseQty",scrapQty);
+//        map.put("CompletionRate",numberFormat.format((float) actualQty / (float) plqnQty * 100));
+//        map.put("PassRate",numberFormat.format((float) paseQty / (float) actualQty * 100));
+//        map.put("surplusQty",plqnQty-actualQty);
+//        return ResponseData.success(map);
+        ProductionOrdeInfoParam param = new ProductionOrdeInfoParam();
+        param.setOrderStatus("3");
+        ProductionOrdeInfoResult one = new ProductionOrdeInfoResult();
         NumberFormat numberFormat = NumberFormat.getInstance();
         numberFormat.setMaximumFractionDigits(2);
-        ProductionOrdeInfo one = productionOrdeInfoService.getOne(new QueryWrapper<ProductionOrdeInfo>()
-                .select("SUM\n" +
-                        "\t( plan_qty ) AS planQty,\n" +
-                        "\tSUM ( actual_qty ) AS actualQty,\n" +
-                        "\tSUM ( scrap_qty ) AS scrapQty ")
-        );
+        List<ProductionOrdeInfoResult> listMonth = productionOrdeInfoService.getListMonth();
+        List<ProductionOrdeInfoResult> listBySpec = productionOrdeInfoService.findListBySpec(param);
+        if(listBySpec.size() == 0){
+            ToolUtil.copyProperties(listMonth.get(0), one);
+        }else {
+            ToolUtil.copyProperties(listBySpec.get(0), one);
+        }
+        if(one.getActualQty() == null){
+            one.setActualQty(0);
+        }
+        if(one.getScrapQty() == null){
+            one.setScrapQty(0);
+        }
         //璁″垝
         Integer plqnQty = one.getPlanQty();
         //瀹屾垚
@@ -285,12 +331,17 @@
         Integer paseQty = actualQty-scrapQty;
 
         Map map = new HashMap<String,String>();
-        map.put("produceQty",plqnQty);
-        map.put("finishQty",actualQty);
+        map.put("produceQty",one.getPlanQty());
+        map.put("finishQty",one.getActualQty());
         map.put("paseQty",paseQty);
         map.put("noPaseQty",scrapQty);
         map.put("CompletionRate",numberFormat.format((float) actualQty / (float) plqnQty * 100));
-        map.put("PassRate",numberFormat.format((float) paseQty / (float) actualQty * 100));
+        String format = numberFormat.format((float) paseQty / (float) actualQty * 100);
+        if(format.equals("锟�")){
+            map.put("PassRate","0");
+        }else {
+            map.put("PassRate",format);
+        }
         map.put("surplusQty",plqnQty-actualQty);
         return ResponseData.success(map);
     }
@@ -317,28 +368,28 @@
         Map map = new HashMap<String,String>();
 //        for (int i = 0; i < 7; i++) {
 //            String str = LocalDate.now().minusDays(i).toString();
-            for (Object o : getWeek()) {
-                QueryWrapper<ProductionOrdeInfo> queryWrapper = new QueryWrapper<ProductionOrdeInfo>();
-                queryWrapper.select("SUM(plan_qty) as planQty,SUM(actual_qty) as actualQty");
-                queryWrapper.apply("CONVERT ( VARCHAR ( 100 ), plan_start_time, 23 ) = {0}",o.toString() );
-                ProductionOrdeInfo one = productionOrdeInfoService.getOne(queryWrapper);
-                if(one!=null){
-                    if(one.getPlanQty()!=null){
-                        planQtyList.add(one.getPlanQty());
-                    }else {
-                        planQtyList.add(0);
-                    }
-                    if(one.getActualQty()!=null){
-                        actualQtyList.add(one.getActualQty());
-                    }else {
-                        actualQtyList.add(0);
-                    }
+        for (Object o : getWeek()) {
+            QueryWrapper<ProductionOrdeInfo> queryWrapper = new QueryWrapper<ProductionOrdeInfo>();
+            queryWrapper.select("SUM(plan_qty) as planQty,SUM(actual_qty) as actualQty");
+            queryWrapper.apply("CONVERT ( VARCHAR ( 100 ), plan_start_time, 23 ) = {0}",o.toString() );
+            ProductionOrdeInfo one = productionOrdeInfoService.getOne(queryWrapper);
+            if(one!=null){
+                if(one.getPlanQty()!=null){
+                    planQtyList.add(one.getPlanQty());
                 }else {
                     planQtyList.add(0);
+                }
+                if(one.getActualQty()!=null){
+                    actualQtyList.add(one.getActualQty());
+                }else {
                     actualQtyList.add(0);
                 }
-                list.add(o.toString());
+            }else {
+                planQtyList.add(0);
+                actualQtyList.add(0);
             }
+            list.add(o.toString());
+        }
 
 //        }
         map.put("category",list);
@@ -377,7 +428,7 @@
      */
     @RequestMapping("/downloadExcelTemplate")
     public void downloadExcelTemplate(ModelMap modelMap, HttpServletRequest request,
-                          HttpServletResponse response) {
+                                      HttpServletResponse response) {
         //鍒濆鍖栬〃澶�
         List<ExcelExportEntity> entity = new ArrayList<>();
         entity.add(new ExcelExportEntity("鐢熶骇宸ュ崟鍙�", "workOrderNo"));

--
Gitblit v1.9.3