Browse Source

工单核验单维护

曹鹤洋 1 year ago
parent
commit
15c03fe3dc

+ 6 - 0
application/api/controller/OtherCountDocument.php

@@ -65,6 +65,11 @@ class OtherCountDocument extends Api
         }
         $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.Sczl_rq'] = ['LIKE',$req['date'].'%'];
@@ -79,6 +84,7 @@ class OtherCountDocument extends Api
             ->where($where)
             ->join(['人事_基本资料'=>'r'],'b.Sczl_bh1 = r.员工编号')
             ->join(['工单_基本资料'=>'g'],'b.sczl_gdbh = g.Gd_gdbh')
+            ->page($page,$limit)
             ->group('b.sys_rq')
             ->order('b.Sczl_rq asc, b.UniqId asc')
             ->select();

+ 6 - 0
application/api/controller/PackagingCountDocument.php

@@ -71,6 +71,11 @@ class PackagingCountDocument extends Api
         }
         $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'].'%'];
@@ -87,6 +92,7 @@ class PackagingCountDocument extends Api
             b.sczl_gdbh1, rtrim(b.sys_id) as sys_id, b.sys_rq, b.mod_rq, b.UniqId')
             ->where($where)
             ->join(['人事_基本资料'=>'r'],'b.sczl_bh = r.员工编号')
+            ->page($page,$limit)
             ->select();
 
         $data = [

+ 7 - 9
application/api/controller/PackagingProcessOutput.php

@@ -71,14 +71,12 @@ class PackagingProcessOutput extends Api
             $this->error('请求方式错误');
         }
         $req = $this->request->param();
-//        $rows = db()->table('db_包装产量预报')
-//            ->field('sys_id, sczl_rq,
-//            sczl_cl1 + sczl_cl2 + sczl_cl3 + sczl_cl4 + sczl_cl5 + sczl_cl6 as sczl_cl,
-//            (sczl_cl1 * sczl_PgCl1 + sczl_clAdd1) + (sczl_cl2 * sczl_PgCl2 + sczl_clAdd2) + (sczl_cl3 * sczl_PgCl3 + sczl_clAdd3) + (sczl_cl4 * sczl_PgCl4 + sczl_clAdd4) + (sczl_cl5 * sczl_PgCl5 + sczl_clAdd5) + (sczl_cl6 * sczl_PgCl6 + sczl_clAdd6) as sczl_PgCl,
-//            sys_rq, mod_rq, UniqId')
-//            ->where('sczl_rq','>=',$date1)
-//            ->where('sczl_rq','<',$date2)
-//            ->select();
+
+        $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['sys_rq'] = ['LIKE',$req['date'].'%'];
@@ -93,6 +91,7 @@ class PackagingProcessOutput extends Api
             (sczl_cl1 * sczl_PgCl1 + sczl_clAdd1) + (sczl_cl2 * sczl_PgCl2 + sczl_clAdd2) + (sczl_cl3 * sczl_PgCl3 + sczl_clAdd3) + (sczl_cl4 * sczl_PgCl4 + sczl_clAdd4) + (sczl_cl5 * sczl_PgCl5 + sczl_clAdd5) + (sczl_cl6 * sczl_PgCl6 + sczl_clAdd6) as sczl_PgCl, 
             sys_rq, mod_rq, UniqId')
             ->where($where)
+            ->page($page,$limit)
             ->select();
         $sczl_cls = $sczl_PgCls = 0;
         foreach ($rows as $row){
@@ -135,7 +134,6 @@ class PackagingProcessOutput extends Api
                 'd.sczl_gdbh6 = g.Gd_gdbh')
             ->where('d.UniqId',$UniqId)
             ->select();
-halt($rows);
 
         $this->success('成功',$rows);
     }

+ 6 - 0
application/api/controller/PieceWorkSchedule.php

@@ -55,6 +55,11 @@ class PieceWorkSchedule extends Api
         }
         $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.wgjs_rq'] = ['LIKE',$req['date'].'%'];
@@ -73,6 +78,7 @@ class PieceWorkSchedule extends Api
             ->where($where)
             ->join(['人事_基本资料'=>'r'],'b.wgjs_bh1 = r.员工编号')
             ->order('b.wgjs_rq desc, b.UniqId asc')
+            ->page($page,$limit)
             ->select();
 
         foreach ($rows as $key=>$row){

+ 142 - 0
application/api/controller/WorkOrderVerification.php

@@ -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);
+    }
+}