Browse Source

班组数据左侧菜单

qiuenguang 1 year ago
parent
commit
393139e81b
1 changed files with 28 additions and 4 deletions
  1. 28 4
      application/api/controller/Manufacture.php

+ 28 - 4
application/api/controller/Manufacture.php

@@ -940,10 +940,34 @@ class Manufacture extends Api
         if ($this->request->isGet() === false){
             $this->error('请求错误');
         }
-        $list = \db('设备_基本资料')
-            ->where('生产工序','车缝')
-            ->column('设备编号');
-        $this->success('成功',$list);
+        $date = date('Y-m-d 00:00:00',time()-1888000);
+        $arr = \db('设备_产量计酬')
+            ->field([
+                'DISTINCT(sczl_rq)' => '时间',
+                'rtrim(sczl_jtbh)' => '机台编号'
+            ])
+            ->where('sczl_rq','>',$date)
+            ->order('sczl_rq desc')
+            ->select();
+        $MachineList = \db('设备_基本资料')
+            ->where('生产工序','in',['车缝','后道','总检','大烫','包装'])
+            ->select();
+        $list = ['车缝','后道','总检','大烫','包装'];
+        $data =[];
+        foreach ($list as $m=>$n){
+            $data[$n] = [];
+            foreach ($MachineList as $key=>$value){
+                if ($n === $value['生产工序']){
+                    $data[$n][$value['设备编号'].'--'.$value['设备编组']] = [];
+                    foreach ($arr as $k=>$v){
+                        if ($value['设备编号'] === $v['机台编号']){
+                            array_push($data[$n][$value['设备编号'].'--'.$value['设备编组']],$v['时间']);
+                        }
+                    }
+                }
+            }
+        }
+        $this->success('成功',$data);
     }
 
     /**