|
|
@@ -0,0 +1,142 @@
|
|
|
+<?php
|
|
|
+
|
|
|
+namespace app\api\controller;
|
|
|
+
|
|
|
+use app\common\controller\Api;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 工单核验单维护接口
|
|
|
+ */
|
|
|
+class WorkOrderVerification extends Api
|
|
|
+{
|
|
|
+ protected $noNeedLogin = ['*'];
|
|
|
+ protected $noNeedRight = ['*'];
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 首页
|
|
|
+ *
|
|
|
+ */
|
|
|
+ public function index()
|
|
|
+ {
|
|
|
+ $this->success('请求成功');
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取工单核验单侧边栏
|
|
|
+ * @ApiMethod (GET)
|
|
|
+ */
|
|
|
+ public function getTab()
|
|
|
+ {
|
|
|
+ //get请求
|
|
|
+ if(!$this->request->isGet()){
|
|
|
+ $this->error('请求方式错误');
|
|
|
+ }
|
|
|
+ $rows = db()->table('db_qczl')
|
|
|
+ ->field('LEFT(sys_rq, 10) as date, COUNT(*) as counts')
|
|
|
+ ->group('date')
|
|
|
+ ->order('UniqId desc')
|
|
|
+ ->limit(30)
|
|
|
+ ->select();
|
|
|
+
|
|
|
+ $arr = db()->table('db_qczl')
|
|
|
+ ->field('LEFT(sys_rq, 10) as date, rtrim(sys_id) as sys_id, COUNT(sys_id) as count')
|
|
|
+ ->where('sys_rq','>=',$rows[29]['date'])
|
|
|
+ ->group('date, sys_id')
|
|
|
+ ->select();
|
|
|
+
|
|
|
+ foreach($rows as $key=>$value){
|
|
|
+ $rows[$key]['sys'] = [];
|
|
|
+ foreach($arr as $k=>$v){
|
|
|
+ if($value['date'] == $v['date']){
|
|
|
+ unset($v['date']);
|
|
|
+ array_push($rows[$key]['sys'],$v);
|
|
|
+ unset($arr[$k]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $this->success('成功',$rows);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取工单核验单列表
|
|
|
+ * @ApiMethod (GET)
|
|
|
+ * @param string $date 时间
|
|
|
+ * @param string $sys_id 用户
|
|
|
+ */
|
|
|
+ public function getList()
|
|
|
+ {
|
|
|
+ //get请求
|
|
|
+ if(!$this->request->isGet()){
|
|
|
+ $this->error('请求方式错误');
|
|
|
+ }
|
|
|
+ $req = $this->request->param();
|
|
|
+
|
|
|
+ $page = 1;
|
|
|
+ $limit = 15;
|
|
|
+ if (isset($req['page']) && !empty($req['page'])) $page = $req['page'];
|
|
|
+ if (isset($req['limit']) && !empty($req['limit'])) $limit = $req['limit'];
|
|
|
+
|
|
|
+ $where = [];
|
|
|
+ if (isset($req['date']) && !empty($req['date'])){
|
|
|
+ $where['b.sys_rq'] = ['LIKE',$req['date'].'%'];
|
|
|
+ }else{
|
|
|
+ $this->error('参数错误');
|
|
|
+ }
|
|
|
+ if (isset($req['sys_id']) && !empty($req['sys_id'])) $where['b.sys_id'] = ['LIKE','%'.$req['sys_id'].'%'];
|
|
|
+
|
|
|
+ $rows = db()->table('db_qczl')->alias('b')
|
|
|
+ ->field('b.qczl_gdbh, b.qczl_yjno, rtrim(g.Gd_cpmc) as Gd_cpmc, LEFT(b.qczl_rq, 10) as qczl_rq, b.qczl_num, rtrim(b.qczl_NumDesc) as qczl_NumDesc, b.qczl_fp,
|
|
|
+ b.fp_lb1, b.fp_lb2, b.fp_lb3, b.fp_lb4, b.fp_lb5, b.fp_lb6, b.fp_lb7, b.fp_lb8, b.fp_lb9, b.fp_lb10, b.fp_lb11, b.fp_lb12, b.fp_lb13, b.fp_lb14, b.fp_lb15, b.fp_lb16, b.fp_lb17,
|
|
|
+ b.fp_sl1, b.fp_sl2, b.fp_sl3, b.fp_sl4, b.fp_sl5, b.fp_sl6, b.fp_sl7, b.fp_sl8, b.fp_sl9, b.fp_sl10, b.fp_sl11, b.fp_sl12, b.fp_sl13, b.fp_sl14, b.fp_sl15, b.fp_sl16, b.fp_sl17,
|
|
|
+ rtrim(b.sys_id) as sys_id')
|
|
|
+ ->where($where)
|
|
|
+ ->join(['工单_基本资料'=>'g'],'b.qczl_gdbh = g.Gd_gdbh')
|
|
|
+ ->order('b.UniqId desc')
|
|
|
+ ->page($page,$limit)
|
|
|
+ ->select();
|
|
|
+ foreach ($rows as $key=>$value){
|
|
|
+ for ($i=1;$i<=17;$i++){
|
|
|
+ if ($value['fp_sl'.$i]==0){
|
|
|
+ $rows[$key]['sl_lb'.$i] = '';
|
|
|
+ }else{
|
|
|
+ $rows[$key]['sl_lb'.$i] = trim($value['fp_sl'.$i].'-->'.$value['fp_lb'.$i]);
|
|
|
+ }
|
|
|
+ unset($rows[$key]['fp_sl'.$i]);
|
|
|
+ unset($rows[$key]['fp_lb'.$i]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $data = [
|
|
|
+ 'rows' => $rows,
|
|
|
+ ];
|
|
|
+ $this->success('成功',$data);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取工单核验单信息
|
|
|
+ * @ApiMethod (GET)
|
|
|
+ * @param string $UniqId UniqId
|
|
|
+ */
|
|
|
+ public function getInfo()
|
|
|
+ {
|
|
|
+ //get请求
|
|
|
+ if(!$this->request->isGet()){
|
|
|
+ $this->error('请求方式错误');
|
|
|
+ }
|
|
|
+ $req = $this->request->param();
|
|
|
+ if (isset($req['UniqId']) && !empty($req['UniqId'])){
|
|
|
+ $UniqId = $req['UniqId'];
|
|
|
+ }else{
|
|
|
+ $this->error('参数错误');
|
|
|
+ }
|
|
|
+
|
|
|
+ $rows = db()->table('db_qczl')->alias('d')
|
|
|
+ ->field('d.*, ')
|
|
|
+ ->join('工单_基本资料 g', 'd.')
|
|
|
+ ->where('d.UniqId',$UniqId)
|
|
|
+ ->select();
|
|
|
+
|
|
|
+
|
|
|
+ $this->success('成功',$rows);
|
|
|
+ }
|
|
|
+}
|