Browse Source

机台日报表新增相关接口优化

曹鹤洋 1 year ago
parent
commit
728c5e7771
1 changed files with 40 additions and 0 deletions
  1. 40 0
      application/api/controller/MachineProductionReport.php

+ 40 - 0
application/api/controller/MachineProductionReport.php

@@ -600,6 +600,46 @@ class MachineProductionReport extends Api
         $this->success('成功',$rows);
     }
 
+    /**
+     * 查询机台
+     * @ApiMethod (GET)
+     */
+    public function getJtbh()
+    {
+        //get请求
+        if(!$this->request->isGet()){
+            $this->error('请求方式错误');
+        }
+        $req = $this->request->param();
+        if (isset($req['sczl_type']) && !empty($req['sczl_type'])){
+            $sczl_type = $req['sczl_type'];
+        }else{
+            $this->error('参数错误');
+        }
+        if (isset($req['key_word'])){
+            $key_word = $req['key_word'];
+        }else{
+            $this->error('参数错误');
+        }
+        $rows = db('设备_基本资料')
+            ->field('rtrim(设备编号) as jtbh, rtrim(设备名称) as 设备名称')
+            ->where('设备编号|设备名称','like','%'.$key_word.'%')
+            ->where('生产工序','like','%'.$sczl_type.'%')
+            ->order('设备编号 asc')
+            ->select();
+            halt($rows);
+        // foreach ($arr as $value) {
+        //     $data[$value] = [];
+        //     foreach ($rows as $row){
+        //         if($row['使用部门']==$value){
+        //             unset($row['使用部门']);
+        //             array_push($data[$value], $row);
+        //         }
+        //     }
+        // }
+        $this->success('成功',[$data]);
+    }
+
     /**
      * 查询定额代号
      * @ApiMethod (GET)