浏览代码

月度数据

qiuenguang 1 年之前
父节点
当前提交
c7895c5ee5
共有 1 个文件被更改,包括 37 次插入30 次删除
  1. 37 30
      application/api/controller/Manufacture.php

+ 37 - 30
application/api/controller/Manufacture.php

@@ -1041,14 +1041,19 @@ class Manufacture extends Api
             $this->error('请求错误');
         }
         $param = $this->request->param();
-        if(empty($param)){
-            $this->error('参数错误');
-        }
+//        if(empty($param)){
+//            $this->error('参数错误');
+//        }
         if (isset($param['search'])){
             $where['a.订单编号'] = ['like','%'.$param['search'].'%'];
         }
-        $time = date('Y-m',strtotime($param['mouth']));
-        $where['b.Sys_rq'] = ['like',$time.'%'];
+        if (isset($param['client'])){
+            $where['b.客户编号'] = $param['client'];
+        }
+
+        $where['b.gd_statu'] = '2-生产中';
+//        $time = date('Y-m',strtotime($param['mouth']));
+//        $where['b.Sys_rq'] = ['like',$time.'%'];
         $list = \db('设备_产量计酬')
             ->alias('a')
             ->join('工单_基本资料 b','a.订单编号 = b.订单编号')
@@ -1056,6 +1061,7 @@ class Manufacture extends Api
             ->field('c.订单编号,c.子订单编号,c.款号,c.颜色,c.zdtotal as 制单总数,c.sctotal as 裁切总数,c.ck_rq as 出库日期,
             SUM(a.数量) as 产量,a.工序名称')
             ->where($where)
+            ->whereNotNull('c.sc_rq')
             ->group('a.订单编号,a.工序名称')
             ->order('c.Uniqid')
             ->select();
@@ -1064,6 +1070,7 @@ class Manufacture extends Api
             ->join('工单_基本资料 b','a.订单编号 = b.订单编号')
             ->field('a.订单编号,a.子订单编号,a.款号,a.颜色,a.zdtotal as 制单总数,a.sctotal as 裁切总数,a.ck_rq as 出库日期')
             ->where($where)
+            ->whereNotNull('a.sc_rq')
             ->group('a.子订单编号')
             ->order('a.Uniqid')
             ->select();
@@ -1088,31 +1095,31 @@ class Manufacture extends Api
      * @throws \think\db\exception\ModelNotFoundException
      * @throws \think\exception\DbException
      */
-    public function dateList()
-    {
-        if ($this->request->isGet() === false){
-            $this->error('请求错误');
-        }
-        // 查询并按月份统计
-        $result = Db::name('工单_基本资料')
-            ->field("DATE_FORMAT(Sys_rq, '%Y-%m') as month")
-            ->group("DATE_FORMAT(Sys_rq, '%Y-%m')")
-            ->select();
-        $list = $this->array_flatten($result);
-        $this->success('成功',$list);
-    }
-
-    function array_flatten($array) {
-        $result = [];
-        foreach ($array as $value) {
-            if (is_array($value)) {
-                $result = array_merge($result, $this->array_flatten($value));
-            } else {
-                $result[] = $value;
-            }
-        }
-        return $result;
-    }
+//    public function dateList()
+//    {
+//        if ($this->request->isGet() === false){
+//            $this->error('请求错误');
+//        }
+//        // 查询并按月份统计
+//        $result = Db::name('工单_基本资料')
+//            ->field("DATE_FORMAT(Sys_rq, '%Y-%m') as month")
+//            ->group("DATE_FORMAT(Sys_rq, '%Y-%m')")
+//            ->select();
+//        $list = $this->array_flatten($result);
+//        $this->success('成功',$list);
+//    }
+//
+//    function array_flatten($array) {
+//        $result = [];
+//        foreach ($array as $value) {
+//            if (is_array($value)) {
+//                $result = array_merge($result, $this->array_flatten($value));
+//            } else {
+//                $result[] = $value;
+//            }
+//        }
+//        return $result;
+//    }