qiuenguang il y a 1 an
Parent
commit
7dfe50b1c5
1 fichiers modifiés avec 9 ajouts et 6 suppressions
  1. 9 6
      application/api/controller/Manufacture.php

+ 9 - 6
application/api/controller/Manufacture.php

@@ -943,7 +943,7 @@ class Manufacture extends Api
         $date = date('Y-m-d 00:00:00',time()-1888000);
         $arr = \db('设备_产量计酬')
             ->field([
-                'DISTINCT(sczl_rq)' => '时间',
+                'DISTINCT(date_format(sczl_rq,"%Y-%m-%d"))' => '时间',
                 'rtrim(sczl_jtbh)' => '机台编号'
             ])
             ->where('sczl_rq','>',$date)
@@ -986,13 +986,16 @@ class Manufacture extends Api
         if (empty($param)){
             $this->error('参数错误');
         }
-        $list = \db('工单_排程班次')
+        if (isset($param['date'])){
+            $where['a.sczl_rq'] = $param['date'];
+        }
+        $where['a.sczl_jtbh'] = $param['machine'];
+        $list = \db('设备_产量计酬')
             ->alias('a')
             ->join('工单_印件资料 b','b.订单编号 = a.订单编号 AND a.子订单编号 = a.子订单编号')
-            ->join('设备_产量计酬 c','a.订单编号 = c.订单编号 AND a.子订单编号 = c.子订单编号','LEFT')
-            ->field('a.订单编号,a.子订单编号,b.款号,b.颜色,b.船样,b.zdtotal as 制单数,SUM(c.数量) as 已完成')
-            ->where('a.班组编号',$param['machine'])
-            ->where('a.mod_rq',null)
+            ->field('b.订单编号,b.子订单编号,b.款号,b.颜色,b.船样,b.zdtotal as 制单数,a.数量 as 已完成')
+            ->where($where)
+            ->group('a.UniqId')
             ->select();
         $this->success('成功',$list);
     }