Browse Source

其他计件单据列表优化

曹鹤洋 1 year ago
parent
commit
d0d434df34
1 changed files with 22 additions and 1 deletions
  1. 22 1
      application/api/controller/OtherCountDocument.php

+ 22 - 1
application/api/controller/OtherCountDocument.php

@@ -31,12 +31,30 @@ class OtherCountDocument extends Api
         if(!$this->request->isGet()){
             $this->error('请求方式错误');
         }
+//        $rows = db()->table('db_拉料计件')
+//            ->field('LEFT(Sczl_rq, 7) as date, CAST(sum(Sczl_cl) AS SIGNED) as counts')
+//            ->group('LEFT(Sczl_rq, 7)')
+//            ->order('UniqId desc')
+//            ->paginate(13);
+//halt($rows);
+//        $rows->each(function ($item){
+//            $arr = db()->table('db_拉料计件')->alias('l')
+//                ->field('rtrim(l.Sczl_bh1) as Sczl_bh1, rtrim(r.员工姓名) as name, sum(l.Sczl_cl) as count')
+//                ->where('l.sczl_rq','LIKE',$item['date'].'%')
+//                ->join(['人事_基本资料'=>'r'],'l.Sczl_bh1 = r.员工编号')
+//                ->group('Sczl_bh1')
+//                ->select();
+//
+//            $item['sys']=$arr;
+//        });
+//        halt($rows);
         $rows = db()->table('db_拉料计件')
             ->field('LEFT(Sczl_rq, 7) as date, CAST(sum(Sczl_cl) AS SIGNED) as counts')
             ->group('date')
             ->order('UniqId desc')
             ->limit(13)
             ->select();
+//        halt($rows);
         $rs = db()->table('人事_基本资料')->column('员工编号, 员工姓名');
         foreach($rows as $key=>$value){
             $arr = db()->table('db_拉料计件')
@@ -89,7 +107,9 @@ class OtherCountDocument extends Api
             ->page($page,$limit)
             ->order('Sczl_rq asc, UniqId asc')
             ->select();
-
+        $total = db()->table('db_拉料计件')
+            ->where($where)
+            ->count();
         $gd = db()->table('工单_基本资料')->column('Gd_gdbh, Gd_cpmc');
         $rs = db()->table('人事_基本资料')->column('员工编号, 员工姓名');
         foreach ($rows as $key=>$value) {
@@ -99,6 +119,7 @@ class OtherCountDocument extends Api
         }
 
         $data = [
+            'total'         => $total,
             'rows'          => $rows,
         ];
         $this->success('成功',$data);