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

+ 48 - 0
application/api/controller/GluingReport.php

@@ -690,4 +690,52 @@ class GluingReport extends Api
             $this->success('修改成功');
         }
     }
+
+
+    /**
+     * 当班产量
+     * @return void
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    public function GluingReportList()
+    {
+        if ($this->request->isGet() === false){
+            $this->error('请求错误');
+        }
+        $params = $this->request->param();
+        if (!isset($params['machine']) || empty($params['machine'])){
+            $this->error('参数错误');
+        }
+        $machine = $params['machine'];
+        $sczlTime = date('Y-m-d H:i:s',time());
+        if ($sczlTime>date('Y-m-d 00:00:00') && $sczlTime<date('Y-m-d 08:30:00')){
+            $time = date('Y-m-d 00:00:00',time()-86400);
+        }else{
+            $time = date('Y-m-d 00:00:00');
+        }
+        $where = [
+            'sczl_jtbh' => $machine,
+            'sczl_rq' => $time,
+        ];
+        $field = 'rtrim(sczl_gdbh) as 工单编号,rtrim(sczl_yjno) as yjno,rtrim(sczl_dedh) as dedh,rtrim(sczl_gxmc) as gxmc,
+        rtrim(sczl_cl) as 产量,rtrim(sczl_zcfp) as 制程废品,rtrim(装版工时) as 装版工时,rtrim(保养工时) as 保养工时,
+        rtrim(异常工时) as 异常工时,rtrim(设备运行工时) as 通电工时,startTime,endTime,Uid,rtrim(sczl_ls) as ls,来料数量';
+        $list = \db('设备_糊盒报工资料')->where($where)->field($field)->order('Uid desc')->select();
+
+        if (!empty($list)){
+            foreach ($list as $k=>$v){
+                $name = \db('工单_印件资料')->where('Yj_Gdbh',$v['工单编号'])->where('yj_Yjno',$v['yjno'])->field('rtrim(yj_yjmc) as cpmc')->find();
+                if ($v['yjno']<10){
+                    $list[$k]['yjno'] = '0'.$v['yjno'];
+                }
+                $list[$k]['印件及工序'] = $list[$k]['yjno'].'-'.$v['gxmc'];
+                $list[$k]['生产时间段'] = substr($v['startTime'],5,5).' '.substr($v['startTime'],11,5).'<-->'.substr($v['endTime'],5,5).' '.substr($v['endTime'],11,5);
+                $list[$k]['产品名称'] = $name['cpmc'];
+            }
+        }
+        $this->success('成功',$list);
+    }
+
 }