unknown 4 месяцев назад
Родитель
Сommit
ce2a26415b
1 измененных файлов с 53 добавлено и 2 удалено
  1. 53 2
      application/api/controller/GluingReport.php

+ 53 - 2
application/api/controller/GluingReport.php

@@ -504,8 +504,59 @@ class GluingReport extends Api
     //糊盒设备运行跟踪数据页面显示
     //糊盒设备运行跟踪数据页面显示
     public function getGluingReportDataList()
     public function getGluingReportDataList()
     {
     {
-        if (Request::instance()->isPost() == false) {}
-
+        if ($this->request->isGet() === false){
+            $this->error('请求错误');
+        }
+        $params = $this->request->param();
+        if (empty($params['machine']) || empty($params['day'])){
+            $this->error('参数错误');
+        }
+        $where = [
+            'a.sczl_jtbh' => $params['machine'],
+            'a.sczl_rq' => ['like',$params['day'].'%']
+        ];
+        $field = ['a.sczl_gdbh as 工单编号','a.sczl_yjno as 印件号','a.sczl_gxh as 工序号','a.来料数量','a.sczl_cl as 产量',
+            'a.sczl_zcfp as 制程废品','a.startTime as 开始时间','a.endTime as 结束时间','a.sczl_ls as 联数','a.sczl_rq as 日期',
+            'a.sczl_dedh as 定额代号','a.工价系数','a.保养工时','a.装版工时','a.异常工时','a.异常类型','a.设备运行工时','a.role',
+            'a.sys_id as 创建人员','a.sys_rq as 上报时间','a.mod_rq as 修改时间','a.Uid','a.sczl_jtbh as 机台编号',
+            'b.yj_Yjdh as 产品代号','yj_yjmc as 产品名称'];
+        $list = \db('设备_糊盒报工资料')
+            ->alias('a')
+            ->join('工单_印件资料 b','a.sczl_gdbh = b.Yj_Gdbh and a.sczl_yjno = b.yj_Yjno','left')
+            ->field($field)
+            ->where($where)
+            ->group('a.Uid')
+            ->select();
+        if (empty($list)){
+            $this->error('未找到报工数据');
+        }
+        foreach ($list as $key=>$value){
+            $list[$key]['class'] = [];
+            $idList = explode(',',$value['role']);
+            foreach ($idList as $item){
+                $class = \db('设备_糊盒班组资料')
+                    ->where('id',$item)
+                    ->field("role,rate,bh1,bh2,bh3,bh4,bh5,bh6,bh7,bh8,bh9,bh10,bh11,bh12,bh13,bh14,bh15")
+                    ->find();
+                if (!empty($class)){
+                    for ($i=1;$i<16;$i++) {
+                        if ($class['bh' . $i] != '' && $class['bh' . $i] != '000000') {
+                            $name = \db('人事_基本资料')->where('员工编号', $class['bh' . $i])->field('rtrim(员工姓名) as 姓名')->find();
+                            $list[$key]['class'][] = [
+                                '编号' => $class['bh' . $i],
+                                '姓名' => $name['姓名'],
+                                '比例' => $class['rate'],
+                                '角色' => $class['role'],
+                            ];
+                        }
+                    }
+                    $list[$key]['class'] = array_values($list[$key]['class']);
+                }
+            }
+            unset($list[$key]['role']);
+        }
+        
+        $this->success('成功',$list);
     }
     }
 
 
 }
 }