Browse Source

first commit

liuhairui 8 months ago
parent
commit
825803860e

+ 100 - 8
application/api/controller/Fourth.php

@@ -55,7 +55,7 @@ class Fourth extends Controller{
         $res=[];
         $res['status'] = 0;
         $res['msg'] = '';
-        $res['data'] = round(json_decode($redis->get(md5('getxssr_redis')),true)['data']['series'][0]['data'][2]/$target*100);
+        $res['data'] = round(json_decode($redis->get(md5('getxssrs_redis')),true)['data']['series'][0]['data'][2]/$target*100);
         $year_ywcls_wcl = md5('year_ywcls_wcl');
         $redis->set($year_ywcls_wcl, json_encode($res));
 
@@ -120,18 +120,110 @@ class Fourth extends Controller{
     }
 
     //销售收入->接口
-    public function year_ywcls(){
-        //取合同价格
+//    public function year_ywcls(){
+//        //取合同价格
+//        $redis = redis();
+//        return $redis->get(md5('year_ywcls'));
+//    }
+    //销售收入-完成率百分比->接口
+//    public function year_ywcls_wcl(){
+//        //取合同价格/目标收入
+//        $redis = redis();
+//        return $redis->get(md5('year_ywcls_wcl'));
+//    }
+    public function year_ywcls() {
+        // 取合同价格
         $redis = redis();
-        return $redis->get(md5('year_ywcls'));
+        $list = $redis->get(md5('ndxs_redis'));
+
+        // 检查 $list 是否为空,且是否是一个有效的 JSON 字符串
+        if ($list) {
+            // 解码 JSON 字符串为 PHP 数组
+            $list = json_decode($list, true);
+
+            // 判断解码是否成功
+            if (is_array($list)) {
+                // 取出第一个和第二个元素
+                $secondItem = isset($list['data'][0]) ? $list['data'][0] : null;
+                $firstItem = isset($list['data'][1]) ? $list['data'][1] : null;
+
+                // 构造返回数据
+                $response = [
+                    "status" => 0,
+                    "msg" => "",
+                    "data" => []
+                ];
+
+                // 如果第一个元素存在,加入返回数据
+                if ($firstItem) {
+                    $response['data'][] = $firstItem;
+                }
+
+                // 如果第二个元素存在,加入返回数据
+                if ($secondItem) {
+                    $response['data'][] = $secondItem;
+                }
+
+                // 返回最终结果
+                return json_encode($response);
+            } else {
+                // 如果解码失败,返回错误信息
+                return json_encode([
+                    "status" => 1,
+                    "msg" => "数据格式错误",
+                    "data" => []
+                ]);
+            }
+        } else {
+            // 如果 Redis 中没有数据
+            return json_encode([
+                "status" => 1,
+                "msg" => "未获取到数据",
+                "data" => []
+            ]);
+        }
     }
-    //销售收入-完成率百分比->接口
-    public function year_ywcls_wcl(){
-        //取合同价格/目标收入
+
+
+    public function year_ywcls_wcl() {
+        // 获取 Redis 实例
         $redis = redis();
-        return $redis->get(md5('year_ywcls_wcl'));
+        // 获取 Redis 缓存数据
+        $list = $redis->get(md5('ndxs_redis'));
+
+        // 解析 JSON 数据
+        $data = json_decode($list, true);
+
+        // 判断数据是否正确解析
+        if (!isset($data['data']) || !is_array($data['data']) || empty($data['data'])) {
+            return json_encode([
+                'status' => 1,
+                'msg' => '数据格式错误或数据为空',
+                'data' => null
+            ]);
+        }
+
+        // 获取最后一个元素
+        $lastItem = end($data['data']);
+
+        // 确保 $lastItem 是一个数组并且有 'value' 键
+        if (!is_array($lastItem) || !isset($lastItem['value'])) {
+            return json_encode([
+                'status' => 1,
+                'msg' => '数据格式错误',
+                'data' => null
+            ]);
+        }
+
+        // 返回结果,data 直接返回最后的 value
+        return json_encode([
+            'status' => 0,
+            'msg' => '',
+            'data' => $lastItem['value']
+        ]);
     }
 
+
     //毛利收入->接口
     public function year_ywclml(){
         //取生产毛利不含税

+ 365 - 294
application/api/controller/Index.php

@@ -9037,6 +9037,11 @@ class Index extends Api{
     }
     //完成实物产量色令数及百分比->接口调用
     public function wcsw(){
+        $redis=redis();
+        $redis_key = md5('wcsw_redis');
+        $redis_data = $redis->get($redis_key);
+        return $redis_data;
+        die;
         $redis=redis();
         // $redis_key = md5('wcsw_redis');
 //        $redis_key = md5('yssl_redis');
@@ -9402,61 +9407,50 @@ class Index extends Api{
                 DATE_FORMAT( db.RQ, '%Y-%m' ) AS 'rq',
                 ROUND(SUM( db.nnRotationSL )) AS 'nnRotationSL'
             ")
-            ->where("db.RQ >= '{$this->qstart_time()}'AND db.RQ <= '{$this->end_time()}' ")
-            // ->group('MONTH(db.RQ)')
+            ->where("db.RQ >= '{$this->qianstart_time()}'AND db.RQ <= '{$this->end_time()}' ")
             ->group("DATE_FORMAT( db.RQ, '%Y-%m' )")
             ->select();
+
         // 初始化数据
         $list['categories'] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'];
         $currentYear = date("Y"); // 当前年份
         $currentMonth = date("m"); // 当前月份
-        $previousYear = (int)$currentYear - 1; // 前一年
-        // 为前一年和当前年份创建数据数组,初始值为0
-        $list['series'][0]['name'] = $previousYear . '年';
-        $list['series'][0]['data'] = array_fill(0, 12, 0);
-        $list['series'][1]['name'] = $currentYear . '年';
-        $list['series'][1]['data'] = array_fill(0, $currentMonth, 0);
+        $previousYear = (int)$currentYear - 1; // 去年
+        $previousTwoYear = (int)$currentYear - 2; // 前年
+
+        // 为前年、去年和今年创建数据数组,初始值为0
+        $list['series'][0]['name'] = $previousTwoYear . '年';
+        $list['series'][0]['data'] = array_fill(0, 12, 0); // 前年初始化为0
+        $list['series'][1]['name'] = $previousYear . '年';
+        $list['series'][1]['data'] = array_fill(0, 12, 0); // 去年初始化为0
+        $list['series'][2]['name'] = $currentYear . '年';
+        $list['series'][2]['data'] = array_fill(0, $currentMonth, 0); // 今年初始化到当前月份为0
+
         // 遍历查询结果
         foreach ($sql_final as $v) {
             // 获取年份和月份
             $year = substr($v['rq'], 0, 4);
             $month = substr($v['rq'], 5, 2);
 
-            // 如果是前年的数据
-            if ($year == $previousYear) {
+            // 如果是前年的数据
+            if ($year == $previousTwoYear) {
                 $list['series'][0]['data'][(int)$month - 1] = $v['nnRotationSL'];
             }
-            // 如果是当前年份的数据
-            if ($year == $currentYear) {
+            // 如果是去年的数据
+            if ($year == $previousYear) {
                 $list['series'][1]['data'][(int)$month - 1] = $v['nnRotationSL'];
             }
+            // 如果是今年的数据
+            if ($year == $currentYear) {
+                $list['series'][2]['data'][(int)$month - 1] = $v['nnRotationSL'];
+            }
         }
-        // 设置响应数据
+
         $res['status'] = 0;
         $res['msg'] = '';
         $res['data'] = $list;
-        // 将结果存储到Redis并返回
         $redis->set($redis_key, json_encode($res));
         return json_encode($res);
-//        $i=0;
-//        $j=0;
-//        $list['categories']=['01','02','03','04','05','06','07','08','09','10','11','12'];
-//        foreach($sql_final as $v){
-//            if($v['rq']>=date("Y-01")){
-//                $list['series'][1]['name']=date("Y").'年';
-//                $list['series'][1]['data'][$j]=$v['nnRotationSL'];
-//                $j++;
-//            }else{
-//                $list['series'][0]['name']=date("Y", strtotime("-1 year")).'年';
-//                $list['series'][0]['data'][$i]=$v['nnRotationSL'];
-//                $i++;
-//            }
-//        }
-//        $res['status']=0;
-//        $res['msg']='';
-//        $res['data']=$list;
-//        $redis->set($redis_key, json_encode($res));
-//        return json_encode($res);
     }
     //轮转机每月生产趋势 纸令->接口调用
     public function lunzhuanzl(){
@@ -9504,7 +9498,7 @@ class Index extends Api{
                 DATE_FORMAT( db.RQ, '%Y-%m' ) AS 'rq',
                 ROUND(SUM( db.nFourColorSL )) AS 'nFourColorSL'
             ")
-            ->where("db.RQ >= '{$this->qstart_time()}'AND db.RQ <= '{$this->end_time()}' ")
+            ->where("db.RQ >= '{$this->qianstart_time()}'AND db.RQ <= '{$this->end_time()}' ")
             // ->group('MONTH(db.RQ)')
             ->group("DATE_FORMAT( db.RQ, '%Y-%m' )")
             ->select();
@@ -9512,55 +9506,42 @@ class Index extends Api{
         $list['categories'] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'];
         $currentYear = date("Y"); // 当前年份
         $currentMonth = date("m"); // 当前月份
-        $previousYear = (int)$currentYear - 1; // 前一年
-        // 为前一年和当前年份创建数据数组,初始值为0
-        $list['series'][0]['name'] = $previousYear . '年';
-        $list['series'][0]['data'] = array_fill(0, 12, 0);
-        $list['series'][1]['name'] = $currentYear . '年';
-        $list['series'][1]['data'] = array_fill(0, $currentMonth, 0);
+        $previousYear = (int)$currentYear - 1; // 去年
+        $previousTwoYear = (int)$currentYear - 2; // 前年
+
+        // 为前年、去年和今年创建数据数组,初始值为0
+        $list['series'][0]['name'] = $previousTwoYear . '年';
+        $list['series'][0]['data'] = array_fill(0, 12, 0); // 前年初始化为0
+        $list['series'][1]['name'] = $previousYear . '年';
+        $list['series'][1]['data'] = array_fill(0, 12, 0); // 去年初始化为0
+        $list['series'][2]['name'] = $currentYear . '年';
+        $list['series'][2]['data'] = array_fill(0, $currentMonth, 0); // 今年初始化到当前月份为0
+
         // 遍历查询结果
         foreach ($sql_final as $v) {
             // 获取年份和月份
             $year = substr($v['rq'], 0, 4);
             $month = substr($v['rq'], 5, 2);
 
-            // 如果是前年的数据
-            if ($year == $previousYear) {
+            // 如果是前年的数据
+            if ($year == $previousTwoYear) {
                 $list['series'][0]['data'][(int)$month - 1] = $v['nFourColorSL'];
             }
-            // 如果是当前年份的数据
-            if ($year == $currentYear) {
+            // 如果是去年的数据
+            if ($year == $previousYear) {
                 $list['series'][1]['data'][(int)$month - 1] = $v['nFourColorSL'];
             }
+            // 如果是今年的数据
+            if ($year == $currentYear) {
+                $list['series'][2]['data'][(int)$month - 1] = $v['nFourColorSL'];
+            }
         }
-        // 设置响应数据
+
         $res['status'] = 0;
         $res['msg'] = '';
         $res['data'] = $list;
-        // 将结果存储到Redis并返回
         $redis->set($redis_key, json_encode($res));
         return json_encode($res);
-
-//        $i=0;
-//        $j=0;
-//        $list['categories']=['01','02','03','04','05','06','07','08','09','10','11','12'];
-//        foreach($sql_final as $v){
-//            if($v['rq']>=$this->year_January()){
-//                $list['series'][1]['name']=date("Y"). '年';
-//                $list['series'][1]['data'][$j]=$v['nFourColorSL'];
-//                $j++;
-//            }else{
-//                $list['series'][0]['name']=date("Y", strtotime("-1 year")).'年';
-//                $list['series'][0]['data'][$i]=$v['nFourColorSL'];
-//                $i++;
-//            }
-//        }
-//        $res['status']=0;
-//        $res['msg']='';
-//        $res['data']=$list;
-//        $redis->set($redis_key, json_encode($res));
-//        // halt(json_decode($redis->get($redis_key),true));
-//        return json_encode($res);
     }
     //四色机每月生产趋势 纸令->接口调用
     public function sisejizl(){
@@ -9607,7 +9588,7 @@ class Index extends Api{
                 DATE_FORMAT( db.RQ, '%Y-%m' ) AS 'rq',
                 ROUND(SUM( db.nBBSL )) AS 'nBBSL'
             ")
-            ->where("db.RQ >= '{$this->qstart_time()}'AND db.RQ <= '{$this->end_time()}' ")
+            ->where("db.RQ >= '{$this->qianstart_time()}'AND db.RQ <= '{$this->end_time()}' ")
             // ->group('MONTH(db.RQ)')
             ->group("DATE_FORMAT( db.RQ, '%Y-%m' )")
             ->select();
@@ -9615,54 +9596,42 @@ class Index extends Api{
         $list['categories'] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'];
         $currentYear = date("Y"); // 当前年份
         $currentMonth = date("m"); // 当前月份
-        $previousYear = (int)$currentYear - 1; // 前一年
-        // 为前一年和当前年份创建数据数组,初始值为0
-        $list['series'][0]['name'] = $previousYear . '年';
-        $list['series'][0]['data'] = array_fill(0, $currentMonth, 0);
-        $list['series'][1]['name'] = $currentYear . '年';
-        $list['series'][1]['data'] = array_fill(0, $currentMonth, 0);
+        $previousYear = (int)$currentYear - 1; // 去年
+        $previousTwoYear = (int)$currentYear - 2; // 前年
+
+        // 为前年、去年和今年创建数据数组,初始值为0
+        $list['series'][0]['name'] = $previousTwoYear . '年';
+        $list['series'][0]['data'] = array_fill(0, 12, 0); // 前年初始化为0
+        $list['series'][1]['name'] = $previousYear . '年';
+        $list['series'][1]['data'] = array_fill(0, 12, 0); // 去年初始化为0
+        $list['series'][2]['name'] = $currentYear . '年';
+        $list['series'][2]['data'] = array_fill(0, $currentMonth, 0); // 今年初始化到当前月份为0
+
         // 遍历查询结果
         foreach ($sql_final as $v) {
             // 获取年份和月份
             $year = substr($v['rq'], 0, 4);
             $month = substr($v['rq'], 5, 2);
 
-            // 如果是前年的数据
-            if ($year == $previousYear) {
+            // 如果是前年的数据
+            if ($year == $previousTwoYear) {
                 $list['series'][0]['data'][(int)$month - 1] = $v['nBBSL'];
             }
-            // 如果是当前年份的数据
-            if ($year == $currentYear) {
+            // 如果是去年的数据
+            if ($year == $previousYear) {
                 $list['series'][1]['data'][(int)$month - 1] = $v['nBBSL'];
             }
+            // 如果是今年的数据
+            if ($year == $currentYear) {
+                $list['series'][2]['data'][(int)$month - 1] = $v['nBBSL'];
+            }
         }
-        // 设置响应数据
+
         $res['status'] = 0;
         $res['msg'] = '';
         $res['data'] = $list;
-        // 将结果存储到Redis并返回
         $redis->set($redis_key, json_encode($res));
         return json_encode($res);
-
-//        $i=0;
-//        $j=0;
-//        $list['categories']=['01','02','03','04','05','06','07','08','09','10','11','12'];
-//        foreach($sql_final as $v){
-//            if($v['rq']>=$this->year_January()){
-//                $list['series'][1]['name']=date("Y"). '年';
-//                $list['series'][1]['data'][$j]=$v['nBBSL'];
-//                $j++;
-//            }else{
-//                $list['series'][0]['name']=date("Y", strtotime("-1 year")).'年';
-//                $list['series'][0]['data'][$i]=$v['nBBSL'];
-//                $i++;
-//            }
-//        }
-//        $res['status']=0;
-//        $res['msg']='';
-//        $res['data']=$list;
-//        $redis->set($redis_key, json_encode($res));
-//        return json_encode($res);
     }
     //BB机每月生产趋势 纸令->接口调用
     public function bbjzl(){
@@ -9720,7 +9689,7 @@ class Index extends Api{
                 DATE_FORMAT( db.RQ, '%Y-%m' ) AS 'rq',
                 ROUND(SUM( db.nnRotationSL )) AS 'nnRotationSL'
             ")
-            ->where("db.RQ >= '{$this->qstart_time()}'AND db.RQ <= '{$this->end_time()}' ")
+            ->where("db.RQ >= '{$this->qianstart_time()}'AND db.RQ <= '{$this->end_time()}' ")
             // ->group('MONTH(db.RQ)')
             ->group("DATE_FORMAT( db.RQ, '%Y-%m' )")
             ->select();
@@ -9728,53 +9697,42 @@ class Index extends Api{
         $list['categories'] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'];
         $currentYear = date("Y"); // 当前年份
         $currentMonth = date("m"); // 当前月份
-        $previousYear = (int)$currentYear - 1; // 前一年
-        // 为前一年和当前年份创建数据数组,初始值为0
-        $list['series'][0]['name'] = $previousYear . '年';
-        $list['series'][0]['data'] = array_fill(0, $currentMonth, 0);
-        $list['series'][1]['name'] = $currentYear . '年';
-        $list['series'][1]['data'] = array_fill(0, $currentMonth, 0);
+        $previousYear = (int)$currentYear - 1; // 去年
+        $previousTwoYear = (int)$currentYear - 2; // 前年
+
+        // 为前年、去年和今年创建数据数组,初始值为0
+        $list['series'][0]['name'] = $previousTwoYear . '年';
+        $list['series'][0]['data'] = array_fill(0, 12, 0); // 前年初始化为0
+        $list['series'][1]['name'] = $previousYear . '年';
+        $list['series'][1]['data'] = array_fill(0, 12, 0); // 去年初始化为0
+        $list['series'][2]['name'] = $currentYear . '年';
+        $list['series'][2]['data'] = array_fill(0, $currentMonth, 0); // 今年初始化到当前月份为0
+
         // 遍历查询结果
         foreach ($sql_final as $v) {
             // 获取年份和月份
             $year = substr($v['rq'], 0, 4);
             $month = substr($v['rq'], 5, 2);
 
-            // 如果是前年的数据
-            if ($year == $previousYear) {
+            // 如果是前年的数据
+            if ($year == $previousTwoYear) {
                 $list['series'][0]['data'][(int)$month - 1] = $v['nnRotationSL'];
             }
-            // 如果是当前年份的数据
-            if ($year == $currentYear) {
+            // 如果是去年的数据
+            if ($year == $previousYear) {
                 $list['series'][1]['data'][(int)$month - 1] = $v['nnRotationSL'];
             }
+            // 如果是今年的数据
+            if ($year == $currentYear) {
+                $list['series'][2]['data'][(int)$month - 1] = $v['nnRotationSL'];
+            }
         }
-        // 设置响应数据
+
         $res['status'] = 0;
         $res['msg'] = '';
         $res['data'] = $list;
-        // 将结果存储到Redis并返回
         $redis->set($redis_key, json_encode($res));
         return json_encode($res);
-//        $i=0;
-//        $j=0;
-//        $list['categories']=['01','02','03','04','05','06','07','08','09','10','11','12'];
-//        foreach($sql_final as $v){
-//            if($v['rq']>=$this->year_January()){
-//                $list['series'][1]['name']=date("Y"). '年';
-//                $list['series'][1]['data'][$j]=$v['nnRotationSL'];
-//                $j++;
-//            }else{
-//                $list['series'][0]['name']= date("Y", strtotime("-1 year")).'年';
-//                $list['series'][0]['data'][$i]=$v['nnRotationSL'];
-//                $i++;
-//            }
-//        }
-//        $res['status']=0;
-//        $res['msg']='';
-//        $res['data']=$list;
-//        $redis->set($redis_key, json_encode($res));
-//        return json_encode($res);
     }
     //轮转机每月生产趋势 色令->接口调用
     public function lunzhuan(){
@@ -9832,7 +9790,7 @@ class Index extends Api{
                 DATE_FORMAT( db.RQ, '%Y-%m' ) AS 'rq',
                 ROUND(SUM( db.nFourColorSL )) AS 'nFourColorSL'
             ")
-            ->where("db.RQ >= '{$this->qstart_time()}'AND db.RQ <= '{$this->end_time()}' ")
+            ->where("db.RQ >= '{$this->qianstart_time()}'AND db.RQ <= '{$this->end_time()}' ")
             // ->group('MONTH(db.RQ)')
             ->group("DATE_FORMAT( db.RQ, '%Y-%m' )")
             ->select();
@@ -9840,55 +9798,42 @@ class Index extends Api{
         $list['categories'] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'];
         $currentYear = date("Y"); // 当前年份
         $currentMonth = date("m"); // 当前月份
-        $previousYear = (int)$currentYear - 1; // 前一年
-        // 为前一年和当前年份创建数据数组,初始值为0
-        $list['series'][0]['name'] = $previousYear . '年';
-        $list['series'][0]['data'] = array_fill(0, 12, 0);
-        $list['series'][1]['name'] = $currentYear . '年';
-        $list['series'][1]['data'] = array_fill(0, $currentMonth, 0);
+        $previousYear = (int)$currentYear - 1; // 去年
+        $previousTwoYear = (int)$currentYear - 2; // 前年
+
+        // 为前年、去年和今年创建数据数组,初始值为0
+        $list['series'][0]['name'] = $previousTwoYear . '年';
+        $list['series'][0]['data'] = array_fill(0, 12, 0); // 前年初始化为0
+        $list['series'][1]['name'] = $previousYear . '年';
+        $list['series'][1]['data'] = array_fill(0, 12, 0); // 去年初始化为0
+        $list['series'][2]['name'] = $currentYear . '年';
+        $list['series'][2]['data'] = array_fill(0, $currentMonth, 0); // 今年初始化到当前月份为0
+
         // 遍历查询结果
         foreach ($sql_final as $v) {
             // 获取年份和月份
             $year = substr($v['rq'], 0, 4);
             $month = substr($v['rq'], 5, 2);
 
-            // 如果是前年的数据
-            if ($year == $previousYear) {
+            // 如果是前年的数据
+            if ($year == $previousTwoYear) {
                 $list['series'][0]['data'][(int)$month - 1] = $v['nFourColorSL'];
             }
-            // 如果是当前年份的数据
-            if ($year == $currentYear) {
+            // 如果是去年的数据
+            if ($year == $previousYear) {
                 $list['series'][1]['data'][(int)$month - 1] = $v['nFourColorSL'];
             }
+            // 如果是今年的数据
+            if ($year == $currentYear) {
+                $list['series'][2]['data'][(int)$month - 1] = $v['nFourColorSL'];
+            }
         }
-        // 设置响应数据
+
         $res['status'] = 0;
         $res['msg'] = '';
         $res['data'] = $list;
-        // 将结果存储到Redis并返回
         $redis->set($redis_key, json_encode($res));
         return json_encode($res);
-
-//        $i=0;
-//        $j=0;
-//        $list['categories']=['01','02','03','04','05','06','07','08','09','10','11','12'];
-//        foreach($sql_final as $v){
-//            if($v['rq']>=$this->year_January()){
-//                $list['series'][1]['name']=date("Y").'年';
-//                $list['series'][1]['data'][$j]=$v['nFourColorSL'];
-//                $j++;
-//            }else{
-//                $list['series'][0]['name']= date("Y", strtotime("-1 year")).'年';
-//                $list['series'][0]['data'][$i]=$v['nFourColorSL'];
-//                $i++;
-//            }
-//        }
-//        $res['status']=0;
-//        $res['msg']='';
-//        $res['data']=$list;
-//        $redis->set($redis_key, json_encode($res));
-//        // halt(json_decode($redis->get($redis_key),true));
-//        return json_encode($res);
     }
     //四色机每月生产趋势 色令->接口调用
     public function siseji(){
@@ -9942,7 +9887,7 @@ class Index extends Api{
                 DATE_FORMAT( db.RQ, '%Y-%m' ) AS 'rq',
                 ROUND(SUM( db.nBBSL )) AS 'nBBSL'
             ")
-            ->where("db.RQ >= '{$this->qstart_time()}'AND db.RQ <= '{$this->end_time()}' ")
+            ->where("db.RQ >= '{$this->qianstart_time()}'AND db.RQ <= '{$this->end_time()}' ")
             // ->group('MONTH(db.RQ)')
             ->group("DATE_FORMAT( db.RQ, '%Y-%m' )")
             ->order('db.RQ', 'asc')
@@ -9951,53 +9896,42 @@ class Index extends Api{
         $list['categories'] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'];
         $currentYear = date("Y"); // 当前年份
         $currentMonth = date("m"); // 当前月份
-        $previousYear = (int)$currentYear - 1; // 前一年
-        // 为前一年和当前年份创建数据数组,初始值为0
-        $list['series'][0]['name'] = $previousYear . '年';
-        $list['series'][0]['data'] = array_fill(0, $currentMonth, 0);
-        $list['series'][1]['name'] = $currentYear . '年';
-        $list['series'][1]['data'] = array_fill(0, $currentMonth, 0);
+        $previousYear = (int)$currentYear - 1; // 去年
+        $previousTwoYear = (int)$currentYear - 2; // 前年
+
+        // 为前年、去年和今年创建数据数组,初始值为0
+        $list['series'][0]['name'] = $previousTwoYear . '年';
+        $list['series'][0]['data'] = array_fill(0, 12, 0); // 前年初始化为0
+        $list['series'][1]['name'] = $previousYear . '年';
+        $list['series'][1]['data'] = array_fill(0, 12, 0); // 去年初始化为0
+        $list['series'][2]['name'] = $currentYear . '年';
+        $list['series'][2]['data'] = array_fill(0, $currentMonth, 0); // 今年初始化到当前月份为0
+
         // 遍历查询结果
         foreach ($sql_final as $v) {
             // 获取年份和月份
             $year = substr($v['rq'], 0, 4);
             $month = substr($v['rq'], 5, 2);
 
-            // 如果是前年的数据
-            if ($year == $previousYear) {
+            // 如果是前年的数据
+            if ($year == $previousTwoYear) {
                 $list['series'][0]['data'][(int)$month - 1] = $v['nBBSL'];
             }
-            // 如果是当前年份的数据
-            if ($year == $currentYear) {
+            // 如果是去年的数据
+            if ($year == $previousYear) {
                 $list['series'][1]['data'][(int)$month - 1] = $v['nBBSL'];
             }
+            // 如果是今年的数据
+            if ($year == $currentYear) {
+                $list['series'][2]['data'][(int)$month - 1] = $v['nBBSL'];
+            }
         }
-        // 设置响应数据
+
         $res['status'] = 0;
         $res['msg'] = '';
         $res['data'] = $list;
-        // 将结果存储到Redis并返回
         $redis->set($redis_key, json_encode($res));
         return json_encode($res);
-//        $i=0;
-//        $j=0;
-//        $list['categories']=['01','02','03','04','05','06','07','08','09','10','11','12'];
-//        foreach($sql_final as $v){
-//            if($v['rq']>=$this->year_January()){
-//                $list['series'][1]['name']=date("Y").'年';
-//                $list['series'][1]['data'][$j]=$v['nBBSL'];
-//                $j++;
-//            }else{
-//                $list['series'][0]['name']=date("Y", strtotime("-1 year")).'年';
-//                $list['series'][0]['data'][$i]=$v['nBBSL'];
-//                $i++;
-//            }
-//        }
-//        $res['status']=0;
-//        $res['msg']='';
-//        $res['data']=$list;
-//        $redis->set($redis_key, json_encode($res));
-//        return json_encode($res);
     }
     //BB机每月生产趋势 色令->接口调用
     public function bbj(){
@@ -11478,26 +11412,47 @@ class Index extends Api{
                 DATE_FORMAT(db.rq, '%Y-%m') as rq,
                 ROUND(SUM(db.纸令数总计), 0) AS jdzl
              ")
-            ->where("db.RQ >= '{$this->qstart_time()}'AND db.RQ <= '{$this->end_time()}' ")
+            ->where("db.RQ >= '{$this->qianstart_time()}'AND db.RQ <= '{$this->end_time()}' ")
             ->group("DATE_FORMAT(db.rq, '%Y-%m')")
             ->select();
-        $i=0;
-        $j=0;
-        $list['categories']=['01','02','03','04','05','06','07','08','09','10','11','12'];
-        foreach($sql_final as $v){
-            if($v['rq']>=$this->year_January()){
-                $list['series'][1]['name']=date("Y").'年';
-                $list['series'][1]['data'][$j]=$v['jdzl'];
-                $j++;
-            }else{
-                $list['series'][0]['name']=date("Y", strtotime("-1 year")).'年';
-                $list['series'][0]['data'][$i]=$v['jdzl'];
-                $i++;
+        // 初始化数据
+        $i = 0;
+        $j = 0;
+        $k = 0;
+        $list['categories'] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'];
+        $currentYear = date("Y"); // 当前年份
+        $previousYear = (int)$currentYear - 1; // 去年
+        $previousTwoYear = (int)$currentYear - 2; // 前年
+        // 为三年的数据创建数组,初始值为0
+        $list['series'][0]['name'] = $previousTwoYear . '年'; // 前年
+        $list['series'][0]['data'] = array_fill(0, 12, 0); // 初始化为12个月的数据
+        $list['series'][1]['name'] = $previousYear . '年'; // 去年
+        $list['series'][1]['data'] = array_fill(0, 12, 0); // 初始化为12个月的数据
+        $list['series'][2]['name'] = $currentYear . '年'; // 今年
+        $list['series'][2]['data'] = array_fill(0, (int)date("m"), 0); // 初始化到当前月份的数据
+
+        // 遍历查询结果并填充数据
+        foreach ($sql_final as $v) {
+            // 获取年份和月份
+            $year = substr($v['rq'], 0, 4);
+            $month = substr($v['rq'], 5, 2);
+
+            // 如果是前年数据
+            if ($year == $previousTwoYear) {
+                $list['series'][0]['data'][(int)$month - 1] = $v['jdzl'];
+            }
+            // 如果是去年数据
+            if ($year == $previousYear) {
+                $list['series'][1]['data'][(int)$month - 1] = $v['jdzl'];
+            }
+            // 如果是今年数据
+            if ($year == $currentYear) {
+                $list['series'][2]['data'][(int)$month - 1] = $v['jdzl'];
             }
         }
-        $res['status']=0;
-        $res['msg']='';
-        $res['data']=$list;
+        $res['status'] = 0;
+        $res['msg'] = '';
+        $res['data'] = $list;
         $redis->set($redis_key, json_encode($res));
         return json_encode($res);
     }
@@ -11772,7 +11727,7 @@ class Index extends Api{
                 DATE_FORMAT(db.rq, '%Y-%m') as rq,
                 ROUND(sum(db.纸令数总计), 0) as jzzl
              ")
-            ->where("db.RQ >= '{$this->qstart_time()}'AND db.RQ <= '{$this->end_time()}' ")
+            ->where("db.RQ >= '{$this->qianstart_time()}'AND db.RQ <= '{$this->end_time()}' ")
             ->group("DATE_FORMAT(db.rq, '%Y-%m')")
             ->select();
 
@@ -11786,24 +11741,48 @@ class Index extends Api{
         $redis=redis();
         $sql_final = json_decode($redis->get(md5('jzzl_redis')), true);
 
-        $i=0;
-        $j=0;
-        $list['categories']=['01','02','03','04','05','06','07','08','09','10','11','12'];
-        foreach($sql_final as $v){
-            if($v['rq']>=$this->year_January()){
-                $list['series'][1]['name']=date("Y").'年';
-                $list['series'][1]['data'][$j]=$v['jzzl'];
-                $j++;
-            }else{
-                $list['series'][0]['name']=date("Y", strtotime("-1 year")).'年';
-                $list['series'][0]['data'][$i]=$v['jzzl'];
-                $i++;
+        $i = 0;
+        $j = 0;
+        $k = 0;
+        $list['categories'] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'];
+
+        // 获取当前年份、去年和前年
+        $currentYear = date("Y"); // 当前年份
+        $previousYear = (int)$currentYear - 1; // 去年
+        $previousTwoYear = (int)$currentYear - 2; // 前年
+
+        // 初始化三年的数据
+        $list['series'][0]['name'] = $previousTwoYear . '年'; // 前年
+        $list['series'][0]['data'] = array_fill(0, 12, 0); // 初始化为12个月的数据
+        $list['series'][1]['name'] = $previousYear . '年'; // 去年
+        $list['series'][1]['data'] = array_fill(0, 12, 0); // 初始化为12个月的数据
+        $list['series'][2]['name'] = $currentYear . '年'; // 今年
+        $list['series'][2]['data'] = array_fill(0, (int)date("m"), 0); // 初始化到当前月份的数据
+
+        // 遍历查询结果并填充数据
+        foreach ($sql_final as $v) {
+            // 获取年份和月份
+            $year = substr($v['rq'], 0, 4);
+            $month = substr($v['rq'], 5, 2);
+
+            // 如果是前年数据
+            if ($year == $previousTwoYear) {
+                $list['series'][0]['data'][(int)$month - 1] = $v['jzzl'];
+            }
+            // 如果是去年数据
+            if ($year == $previousYear) {
+                $list['series'][1]['data'][(int)$month - 1] = $v['jzzl'];
+            }
+            // 如果是今年数据
+            if ($year == $currentYear) {
+                $list['series'][2]['data'][(int)$month - 1] = $v['jzzl'];
             }
         }
-        $res['status']=0;
-        $res['msg']='';
-        $res['data']=$list;
+        $res['status'] = 0;
+        $res['msg'] = '';
+        $res['data'] = $list;
         return json_encode($res);
+
     }
 
     //骑马纸令->缓存调用
@@ -12737,26 +12716,49 @@ class Index extends Api{
                 DATE_FORMAT(db.rq, '%Y-%m')   as rq,
                 ROUND(sum(db.纸令数总计),0)     as qmzl
             ")
-            ->where("db.rq >= '{$this->qstart_time()}'AND db.rq <= '{$this->end_time()}' ")
+            ->where("db.rq >= '{$this->qianstart_time()}'AND db.rq <= '{$this->end_time()}' ")
             ->group("DATE_FORMAT(db.rq, '%Y-%m')")
             ->select();
-        $i=0;
-        $j=0;
-        $list['categories']=['01','02','03','04','05','06','07','08','09','10','11','12'];
-        foreach($sql_final as $v){
-            if($v['rq']>=$this->year_January()){
-                $list['series'][1]['name']=date("Y").'年';
-                $list['series'][1]['data'][$j]=$v['qmzl'];
-                $j++;
-            }else{
-                $list['series'][0]['name']=date("Y", strtotime("-1 year")).'年';
-                $list['series'][0]['data'][$i]=$v['qmzl'];
-                $i++;
+        // 初始化数据
+        $i = 0;
+        $j = 0;
+        $k = 0;
+        $list['categories'] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'];
+
+        $currentYear = date("Y"); // 当前年份
+        $previousYear = (int)$currentYear - 1; // 去年
+        $previousTwoYear = (int)$currentYear - 2; // 前年
+
+        // 为三年的数据创建数组,初始值为0
+        $list['series'][0]['name'] = $previousTwoYear . '年'; // 前年
+        $list['series'][0]['data'] = array_fill(0, 12, 0); // 初始化为12个月的数据
+        $list['series'][1]['name'] = $previousYear . '年'; // 去年
+        $list['series'][1]['data'] = array_fill(0, 12, 0); // 初始化为12个月的数据
+        $list['series'][2]['name'] = $currentYear . '年'; // 今年
+        $list['series'][2]['data'] = array_fill(0, (int)date("m"), 0); // 初始化到当前月份的数据
+
+        // 遍历查询结果并填充数据
+        foreach ($sql_final as $v) {
+            // 获取年份和月份
+            $year = substr($v['rq'], 0, 4);
+            $month = substr($v['rq'], 5, 2);
+
+            // 如果是前年数据
+            if ($year == $previousTwoYear) {
+                $list['series'][0]['data'][(int)$month - 1] = $v['qmzl'];
+            }
+            // 如果是去年数据
+            if ($year == $previousYear) {
+                $list['series'][1]['data'][(int)$month - 1] = $v['qmzl'];
+            }
+            // 如果是今年数据
+            if ($year == $currentYear) {
+                $list['series'][2]['data'][(int)$month - 1] = $v['qmzl'];
             }
         }
-        $res['status']=0;
-        $res['msg']='';
-        $res['data']=$list;
+        $res['status'] = 0;
+        $res['msg'] = '';
+        $res['data'] = $list;
         $redis->set($redis_key, json_encode($res));
         return json_encode($res);
     }
@@ -13204,27 +13206,50 @@ class Index extends Api{
                 DATE_FORMAT(db.rq, '%Y-%m') as rq,
                 ROUND(sum(db.总计册), 0) as jdcs
              ")
-            ->where("db.RQ >= '{$this->qstart_time()}'
+            ->where("db.RQ >= '{$this->qianstart_time()}'
             AND db.RQ <= '{$this->end_time()}' ")
             ->group("DATE_FORMAT(db.rq, '%Y-%m')")
             ->select();
-        $i=0;
-        $j=0;
-        $list['categories']=['01','02','03','04','05','06','07','08','09','10','11','12'];
-        foreach($sql_final as $v){
-            if($v['rq']>=$this->year_January()){
-                $list['series'][1]['name']=date("Y").'年';
-                $list['series'][1]['data'][$j]=$v['jdcs'];
-                $j++;
-            }else{
-                $list['series'][0]['name']= date("Y", strtotime("-1 year")).'年';
-                $list['series'][0]['data'][$i]=$v['jdcs'];
-                $i++;
+        // 初始化数据
+        $i = 0;
+        $j = 0;
+        $k = 0;
+        $list['categories'] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'];
+
+        $currentYear = date("Y"); // 当前年份
+        $previousYear = (int)$currentYear - 1; // 去年
+        $previousTwoYear = (int)$currentYear - 2; // 前年
+
+        // 为三年的数据创建数组,初始值为0
+        $list['series'][0]['name'] = $previousTwoYear . '年'; // 前年
+        $list['series'][0]['data'] = array_fill(0, 12, 0); // 初始化为12个月的数据
+        $list['series'][1]['name'] = $previousYear . '年'; // 去年
+        $list['series'][1]['data'] = array_fill(0, 12, 0); // 初始化为12个月的数据
+        $list['series'][2]['name'] = $currentYear . '年'; // 今年
+        $list['series'][2]['data'] = array_fill(0, (int)date("m"), 0); // 初始化到当前月份的数据
+
+        // 遍历查询结果并填充数据
+        foreach ($sql_final as $v) {
+            // 获取年份和月份
+            $year = substr($v['rq'], 0, 4);
+            $month = substr($v['rq'], 5, 2);
+
+            // 如果是前年数据
+            if ($year == $previousTwoYear) {
+                $list['series'][0]['data'][(int)$month - 1] = $v['jdcs'];
+            }
+            // 如果是去年数据
+            if ($year == $previousYear) {
+                $list['series'][1]['data'][(int)$month - 1] = $v['jdcs'];
+            }
+            // 如果是今年数据
+            if ($year == $currentYear) {
+                $list['series'][2]['data'][(int)$month - 1] = $v['jdcs'];
             }
         }
-        $res['status']=0;
-        $res['msg']='';
-        $res['data']=$list;
+        $res['status'] = 0;
+        $res['msg'] = '';
+        $res['data'] = $list;
         $redis->set($redis_key, json_encode($res));
         return json_encode($res);
     }
@@ -13337,27 +13362,50 @@ class Index extends Api{
                 DATE_FORMAT(db.rq, '%Y-%m') as rq,
                 ROUND(sum(db.总计册), 0) as jzcs
              ")
-            ->where("db.RQ >= '{$this->qstart_time()}'
+            ->where("db.RQ >= '{$this->qianstart_time()}'
             AND db.RQ <= '{$this->end_time()}' ")
             ->group("DATE_FORMAT(db.rq, '%Y-%m')")
             ->select();
-        $i=0;
-        $j=0;
-        $list['categories']=['01','02','03','04','05','06','07','08','09','10','11','12'];
-        foreach($sql_final as $v){
-            if($v['rq']>=$this->year_January()){
-                $list['series'][1]['name']= date("Y").'年';
-                $list['series'][1]['data'][$j]=$v['jzcs'];
-                $j++;
-            }else{
-                $list['series'][0]['name']= date("Y", strtotime("-1 year")).'年';
-                $list['series'][0]['data'][$i]=$v['jzcs'];
-                $i++;
+        // 初始化数据
+        $i = 0;
+        $j = 0;
+        $k = 0;
+        $list['categories'] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'];
+
+        $currentYear = date("Y"); // 当前年份
+        $previousYear = (int)$currentYear - 1; // 去年
+        $previousTwoYear = (int)$currentYear - 2; // 前年
+
+        // 为三年的数据创建数组,初始值为0
+        $list['series'][0]['name'] = $previousTwoYear . '年'; // 前年
+        $list['series'][0]['data'] = array_fill(0, 12, 0); // 初始化为12个月的数据
+        $list['series'][1]['name'] = $previousYear . '年'; // 去年
+        $list['series'][1]['data'] = array_fill(0, 12, 0); // 初始化为12个月的数据
+        $list['series'][2]['name'] = $currentYear . '年'; // 今年
+        $list['series'][2]['data'] = array_fill(0, (int)date("m"), 0); // 初始化到当前月份的数据
+
+        // 遍历查询结果并填充数据
+        foreach ($sql_final as $v) {
+            // 获取年份和月份
+            $year = substr($v['rq'], 0, 4);
+            $month = substr($v['rq'], 5, 2);
+
+            // 如果是前年数据
+            if ($year == $previousTwoYear) {
+                $list['series'][0]['data'][(int)$month - 1] = $v['jzcs'];
+            }
+            // 如果是去年数据
+            if ($year == $previousYear) {
+                $list['series'][1]['data'][(int)$month - 1] = $v['jzcs'];
+            }
+            // 如果是今年数据
+            if ($year == $currentYear) {
+                $list['series'][2]['data'][(int)$month - 1] = $v['jzcs'];
             }
         }
-        $res['status']=0;
-        $res['msg']='';
-        $res['data']=$list;
+        $res['status'] = 0;
+        $res['msg'] = '';
+        $res['data'] = $list;
         $redis->set($redis_key, json_encode($res));
         return json_encode($res);
     }
@@ -13686,26 +13734,49 @@ class Index extends Api{
                 DATE_FORMAT(db.rq, '%Y-%m')   as rq,
                 ROUND(sum(db.总计册), 3)       as qmcs
             ")
-            ->where("db.rq >= '{$this->qstart_time()}'AND db.rq <= '{$this->end_time()}' ")
+            ->where("db.rq >= '{$this->qianstart_time()}'AND db.rq <= '{$this->end_time()}' ")
             ->group("DATE_FORMAT(db.rq, '%Y-%m')")
             ->select();
-        $i=0;
-        $j=0;
-        $list['categories']=['01','02','03','04','05','06','07','08','09','10','11','12'];
-        foreach($sql_final as $v){
-            if($v['rq']>=$this->year_January()){
-                $list['series'][1]['name']=date("Y").'年';
-                $list['series'][1]['data'][$j]=$v['qmcs'];
-                $j++;
-            }else{
-                $list['series'][0]['name']=date("Y", strtotime("-1 year")).'年';
-                $list['series'][0]['data'][$i]=$v['qmcs'];
-                $i++;
+        // 初始化数据
+        $i = 0;
+        $j = 0;
+        $k = 0;
+        $list['categories'] = ['01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12'];
+
+        $currentYear = date("Y"); // 当前年份
+        $previousYear = (int)$currentYear - 1; // 去年
+        $previousTwoYear = (int)$currentYear - 2; // 前年
+
+        // 为三年的数据创建数组,初始值为0
+        $list['series'][0]['name'] = $previousTwoYear . '年'; // 前年
+        $list['series'][0]['data'] = array_fill(0, 12, 0); // 初始化为12个月的数据
+        $list['series'][1]['name'] = $previousYear . '年'; // 去年
+        $list['series'][1]['data'] = array_fill(0, 12, 0); // 初始化为12个月的数据
+        $list['series'][2]['name'] = $currentYear . '年'; // 今年
+        $list['series'][2]['data'] = array_fill(0, (int)date("m"), 0); // 初始化到当前月份的数据
+
+        // 遍历查询结果并填充数据
+        foreach ($sql_final as $v) {
+            // 获取年份和月份
+            $year = substr($v['rq'], 0, 4);
+            $month = substr($v['rq'], 5, 2);
+
+            // 如果是前年数据
+            if ($year == $previousTwoYear) {
+                $list['series'][0]['data'][(int)$month - 1] = $v['qmcs'];
+            }
+            // 如果是去年数据
+            if ($year == $previousYear) {
+                $list['series'][1]['data'][(int)$month - 1] = $v['qmcs'];
+            }
+            // 如果是今年数据
+            if ($year == $currentYear) {
+                $list['series'][2]['data'][(int)$month - 1] = $v['qmcs'];
             }
         }
-        $res['status']=0;
-        $res['msg']='';
-        $res['data']=$list;
+        $res['status'] = 0;
+        $res['msg'] = '';
+        $res['data'] = $list;
         $redis->set($redis_key, json_encode($res));
         return json_encode($res);
     }

File diff suppressed because it is too large
+ 471 - 295
application/api/controller/Machines.php


+ 9 - 9
application/api/controller/Monthachines.php

@@ -149,7 +149,7 @@ ORDER BY DATE_FORMAT(
             if (isset($res[$item['班组']])) {
                 $mappedResult[] = [
                     '班组' => $res[$item['班组']],
-                    '纸令' => (float)$item['纸令'] // 确保纸令为浮点数
+                    '纸令' => round((float)$item['纸令']) // 确保纸令为浮点数
                 ];
             }
         }
@@ -272,7 +272,7 @@ ORDER BY DATE_FORMAT(
             if (isset($res[$item['班组']])) {
                 $mappedResult[] = [
                     '班组' => $res[$item['班组']],
-                    '工作量' => (float)$item['工作量'] // 确保纸令为浮点数
+                    '工作量' => round((float)$item['工作量'])// 确保纸令为浮点数
                 ];
             }
         }
@@ -404,7 +404,7 @@ ORDER BY DATE_FORMAT(
             if (isset($res[$item['班组']])) {
                 $mappedResult[] = [
                     '班组' => $res[$item['班组']],
-                    '纸令' => (float)$item['纸令'] // 确保纸令为浮点数
+                    '纸令' => round((float)$item['纸令']) // 确保纸令为浮点数
                 ];
             }
         }
@@ -534,7 +534,7 @@ ORDER BY DATE_FORMAT(
             if (isset($res[$item['班组']])) {
                 $mappedResult[] = [
                     '班组' => $res[$item['班组']],
-                    '纸令' => (float)$item['纸令'] // 确保纸令为浮点数
+                    '纸令' => round((float)$item['纸令']) // 确保纸令为浮点数
                 ];
             }
         }
@@ -658,7 +658,7 @@ ORDER BY DATE_FORMAT(
             if (isset($res[$item['班组']])) {
                 $mappedResult[] = [
                     '班组' => $res[$item['班组']],
-                    '纸令' => (float)$item['纸令'] // 确保纸令为浮点数
+                    '纸令' => round((float)$item['纸令']) // 确保纸令为浮点数
                 ];
             }
         }
@@ -786,7 +786,7 @@ ORDER BY DATE_FORMAT(
             if (isset($res[$item['班组']])) {
                 $mappedResult[] = [
                     '班组' => $res[$item['班组']],
-                    '纸令' => (float)$item['纸令'] // 确保纸令为浮点数
+                    '纸令' => round((float)$item['纸令']) // 确保纸令为浮点数
                 ];
             }
         }
@@ -916,7 +916,7 @@ ORDER BY DATE_FORMAT(
             if (isset($res[$item['班组']])) {
                 $mappedResult[] = [
                     '班组' => $res[$item['班组']],
-                    '工作量' => (float)$item['工作量'] // 确保纸令为浮点数
+                    '工作量' => round((float)$item['工作量']) // 确保纸令为浮点数
                 ];
             }
         }
@@ -1040,7 +1040,7 @@ ORDER BY DATE_FORMAT(
             if (isset($res[$item['班组']])) {
                 $mappedResult[] = [
                     '班组' => $res[$item['班组']],
-                    '工作量' => (float)$item['工作量'] // 确保纸令为浮点数
+                    '工作量' => round((float)$item['工作量']) // 确保纸令为浮点数
                 ];
             }
         }
@@ -1160,7 +1160,7 @@ ORDER BY DATE_FORMAT(
             if (isset($res[$item['班组']])) {
                 $mappedResult[] = [
                     '班组' => $res[$item['班组']],
-                    '工作量' => (float)$item['工作量'] // 确保纸令为浮点数
+                    '工作量' => round((float)$item['工作量']) // 确保纸令为浮点数
                 ];
             }
         }

+ 2 - 1
application/api/controller/Third.php

@@ -4394,7 +4394,8 @@ WHERE   (iStop = 0)
 
     //近30天班组生产效率完成情况 生产异常情况统计->接口
     public function machine_scxl(){
-        $postData = input('post.dependence.item.name');
+//        $postData = input('post.dependence.item.name');
+        $postData = input('post.dependence.item.subsys');
         $redisKeys = [
             "单双色印刷机台" => 'dssj_scxl_redis',
             "四色印刷机" => 'ssj_scxl_redis',

Some files were not shown because too many files changed in this diff