unknown пре 1 дан
родитељ
комит
fdf755ecdb
1 измењених фајлова са 56 додато и 0 уклоњено
  1. 56 0
      application/api/controller/Facility.php

+ 56 - 0
application/api/controller/Facility.php

@@ -3153,4 +3153,60 @@ class Facility extends Api
         $data = \db('制程检验_记录')->where($where)->field($field)->select();
         $this->success('成功',$data);
     }
+
+    /**
+     * 现场管理巡查统计左侧菜单
+     */
+    public function ManagementInspectionMenu()
+    {
+        if ($this->request->isGet() === false){
+            $this->error('请求错误');
+        }
+        $param = $this->request->param();
+        $where = [
+            '类别' => '现场巡查记录'
+        ];
+        if (isset($param['machine'])){
+            $where['设备编号'] = $param['machine'];
+        }
+        
+        // 添加最近一个月的时间条件
+        $oneMonthAgo = date('Y-m-d H:i:s', strtotime('-1 month'));
+        $where['提交时间'] = ['>=', $oneMonthAgo];
+        
+        $field = '设备编号,提交时间';
+        $data = db('制程检验_记录')->where($where)->field($field)->select();
+        $result = [];
+        foreach ($data as $key=>$value){
+            $date = date('Y-m-d',strtotime($value['提交时间']));
+            if (!isset($result[$value['设备编号']])){
+                $result[$value['设备编号']] = [];
+            }
+            array_push($result[$value['设备编号']],$date);
+        }
+        $this->success('成功',$result);
+    }
+
+    /**
+     * 管理巡查统计列表
+     */
+    public function ManagementInspectionList()
+    {
+        if ($this->request->isGet() === false){
+            $this->error('请求错误');
+        }
+        $param = $this->request->param();
+        if (empty($param['machine']) || empty($param['date']))
+        {
+            $this->error('参数错误');
+        }
+        $where = [
+            '类别' => '现场巡查记录',
+            '设备编号' => $param['machine'],
+            '提交时间' => ['like',$param['date'].'%'],
+        ];
+        $field = '类别,工单编号,印件号,工序名称,流程单号,班组编号,检验项目,检验备注,提交时间';
+        $data = \db('制程检验_记录')->where($where)->field($field)->select();
+        $this->success('成功',$data);
+    }
 }