Browse Source

包装工序产量维护、包装计件单据维护、其他计件单据维护、计件工计时单维护侧边栏接口 列表接口

曹鹤洋 1 năm trước cách đây
mục cha
commit
de1cd5c56f

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

@@ -0,0 +1,119 @@
+<?php
+
+namespace app\api\controller;
+
+use app\common\controller\Api;
+
+/**
+ * 其他计件单据维护接口
+ */
+class OtherCountDocument 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_拉料计件')
+            ->field('LEFT(Sczl_rq, 7) as date, sum(Sczl_cl) as counts')
+            ->group('date')
+            ->order('UniqId desc')
+            ->limit(13)
+            ->select();
+
+        foreach($rows as $key=>$value){
+            $arr = db()->table('db_拉料计件')->alias('l')
+                ->field('rtrim(l.Sczl_bh1) as Sczl_bh1, rtrim(r.员工姓名) as name, sum(l.Sczl_cl) as count')
+                ->where('l.sczl_rq','LIKE',$value['date'].'%')
+                ->join(['人事_基本资料'=>'r'],'l.Sczl_bh1 = r.员工编号')
+                ->group('Sczl_bh1')
+                ->select();
+            $rows[$key]['sys'] = [];
+            array_push($rows[$key]['sys'],$arr);
+        }
+        $this->success('成功',$rows);
+    }
+
+    /**
+     * 获取其他计件单据列表
+     * @ApiMethod (GET)
+     * @param string $date 时间
+     * @param string $Sczl_bh1 员工编号
+     */
+    public function getList()
+    {
+        //get请求
+        if(!$this->request->isGet()){
+            $this->error('请求方式错误');
+        }
+        $req = $this->request->param();
+
+        $where = [];
+        if (isset($req['date']) && !empty($req['date'])){
+            $where['b.Sczl_rq'] = ['LIKE',$req['date'].'%'];
+        }else{
+            $this->error('参数错误');
+        }
+        if (isset($req['Sczl_bh1']) && !empty($req['Sczl_bh1'])) $where['b.Sczl_bh1'] = $req['Sczl_bh1'];
+
+        $rows = db()->table('db_拉料计件')->alias('b')
+            ->field('rtrim(b.sczl_Type) as sczl_Type, b.Sczl_rq, b.Sczl_bh1, rtrim(r.员工姓名) as name, b.sczl_gdbh, rtrim(g.Gd_cpmc) as Gd_cpmc, b.Sczl_cl,
+            rtrim(b.Sczl_desc) as Sczl_desc, rtrim(b.Sczl_gxmc) as Sczl_gxmc, b.sczl_yjno, b.sczl_gxh, rtrim(b.sys_id) as sys_id, b.sys_rq, b.mod_rq, b.UniqId')
+            ->where($where)
+            ->join(['人事_基本资料'=>'r'],'b.Sczl_bh1 = r.员工编号')
+            ->join(['工单_基本资料'=>'g'],'b.sczl_gdbh = g.Gd_gdbh')
+            ->group('b.sys_rq')
+            ->order('b.Sczl_rq asc, b.UniqId asc')
+            ->select();
+
+        $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_拉料计件')->alias('d')
+            ->field('d.*, ')
+            ->join('工单_基本资料 g', 'd.')
+            ->where('d.UniqId',$UniqId)
+            ->select();
+
+
+        $this->success('成功',$rows);
+    }
+}

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

@@ -0,0 +1,125 @@
+<?php
+
+namespace app\api\controller;
+
+use app\common\controller\Api;
+
+/**
+ * 包装计件单据维护接口
+ */
+class PackagingCountDocument 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_包装计件')
+            ->field('LEFT(sys_rq, 10) as date, COUNT(*) as counts')
+            ->group('date')
+            ->order('UniqId desc')
+            ->limit(30)
+            ->select();
+
+        $arr = db()->table('db_包装计件')
+            ->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();
+
+        $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_包装计件')->alias('b')
+            ->field('b.sczl_bh, rtrim(r.员工姓名) as name, b.sczl_rq, b.sczl_bzdh, 
+            b.sczl_cl1 + b.sczl_cl2 + b.sczl_cl3 + b.sczl_cl4 + b.sczl_cl5 + b.sczl_cl6 as sczl_cl, 
+            b.sczl_返工产量1 + b.sczl_返工产量2 + b.sczl_返工产量3 + b.sczl_返工产量4 + b.sczl_返工产量5 + b.sczl_返工产量6 as sczl_fgsl, 
+            b.sczl_cl1 + b.sczl_cl2 + b.sczl_cl3 + b.sczl_cl4 + b.sczl_cl5 + b.sczl_cl6 + b.sczl_返工产量1 + b.sczl_返工产量2 + b.sczl_返工产量3 + b.sczl_返工产量4 + b.sczl_返工产量5 + b.sczl_返工产量6 as sczl_jjcl, 
+            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.员工编号')
+            ->select();
+
+        $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_包装计件')->alias('d')
+            ->field('d.*, ')
+            ->join('工单_基本资料 g', 'd.')
+            ->where('d.UniqId',$UniqId)
+            ->select();
+
+
+        $this->success('成功',$rows);
+    }
+}

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

@@ -0,0 +1,142 @@
+<?php
+
+namespace app\api\controller;
+
+use app\common\controller\Api;
+
+/**
+ * 包装工序产量维护接口
+ */
+class PackagingProcessOutput 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_包装产量预报')
+            ->field('LEFT(sys_rq, 10) as date, COUNT(*) as counts')
+            ->group('date')
+            ->order('UniqId desc')
+            ->limit(30)
+            ->select();
+
+        $arr = db()->table('db_包装产量预报')
+            ->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();
+//        $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();
+        $where = [];
+        if (isset($req['date']) && !empty($req['date'])){
+            $where['sys_rq'] = ['LIKE',$req['date'].'%'];
+        }else{
+            $this->error('参数错误');
+        }
+        if (isset($req['sys_id']) && !empty($req['sys_id'])) $where['sys_id'] = ['LIKE','%'.$req['sys_id'].'%'];
+
+        $rows = db()->table('db_包装产量预报')
+            ->field('rtrim(sys_id) as 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($where)
+            ->select();
+        $sczl_cls = $sczl_PgCls = 0;
+        foreach ($rows as $row){
+            $sczl_cls += $row['sczl_cl'];
+            $sczl_PgCls += $row['sczl_PgCl'];
+        }
+        $data = [
+            'sczl_cls'      => $sczl_cls,
+            'sczl_PgCls'    => $sczl_PgCls,
+            '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_包装产量预报')->alias('d')
+            ->field('d.*, g1.Gd_cpmc, g2.Gd_cpmc, g3.Gd_cpmc, g4.Gd_cpmc, g5.Gd_cpmc, g6.Gd_cpmc')
+            ->join(['工单_基本资料'=>'g'], 'd.sczl_gdbh1 = g.Gd_gdbh or '.
+                'd.sczl_gdbh2 = g.Gd_gdbh or '.
+                'd.sczl_gdbh3 = g.Gd_gdbh or '.
+                'd.sczl_gdbh4 = g.Gd_gdbh or '.
+                'd.sczl_gdbh5 = g.Gd_gdbh or '.
+                'd.sczl_gdbh6 = g.Gd_gdbh')
+            ->where('d.UniqId',$UniqId)
+            ->select();
+halt($rows);
+
+        $this->success('成功',$rows);
+    }
+}

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

@@ -0,0 +1,149 @@
+<?php
+
+namespace app\api\controller;
+
+use app\common\controller\Api;
+
+/**
+ * 计件工计时单维护接口
+ */
+class PieceWorkSchedule 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_wgjs')
+            ->field('LEFT(wgjs_rq, 7) as date')
+            ->group('date')
+            ->order('UniqId desc')
+            ->limit(15)
+            ->select();
+
+        $this->success('成功',$rows);
+    }
+
+    /**
+     * 获取计件工计时单列表
+     * @ApiMethod (GET)
+     * @param string $date 时间
+     * @param string $Sczl_bh1 员工编号
+     */
+    public function getList()
+    {
+        //get请求
+        if(!$this->request->isGet()){
+            $this->error('请求方式错误');
+        }
+        $req = $this->request->param();
+
+        $where = [];
+        if (isset($req['date']) && !empty($req['date'])){
+            $where['b.wgjs_rq'] = ['LIKE',$req['date'].'%'];
+        }else{
+            $this->error('参数错误');
+        }
+
+        $rows = db()->table('db_wgjs')->alias('b')
+            ->field('b.wgjs_rq, b.wgjs_bh1, rtrim(r.员工姓名) as name1, rtrim(r.所在部门) as department, 
+            b.wgjs_js1, rtrim(b.wgjs_yy1) as wgjs_yy1, 
+            b.wgjs_bh2, b.wgjs_js2, rtrim(b.wgjs_yy2) as wgjs_yy2, 
+            b.wgjs_bh3, b.wgjs_js3, rtrim(b.wgjs_yy3) as wgjs_yy3, 
+            b.wgjs_bh4, b.wgjs_js4, rtrim(b.wgjs_yy4) as wgjs_yy4, 
+            b.wgjs_bh5, b.wgjs_js5, rtrim(b.wgjs_yy5) as wgjs_yy5, 
+            b.wgjs_bh6, b.wgjs_js6, rtrim(b.wgjs_yy6) as wgjs_yy6')
+            ->where($where)
+            ->join(['人事_基本资料'=>'r'],'b.wgjs_bh1 = r.员工编号')
+            ->order('b.wgjs_rq desc, b.UniqId asc')
+            ->select();
+
+        foreach ($rows as $key=>$row){
+            if ($row['wgjs_bh2']){
+                if ($row['wgjs_bh2']==$row['wgjs_bh1']){
+                    $rows[$key]['name2'] = $row['name1'];
+                }else{
+                    $rows[$key]['name2'] = trim(db()->table('人事_基本资料')->field('员工姓名')->where('员工编号',$row['wgjs_bh2'])->find()['员工姓名']);
+                }
+            }
+            if ($row['wgjs_bh3']){
+                if ($row['wgjs_bh3']==$row['wgjs_bh1']){
+                    $rows[$key]['name3'] = $row['name1'];
+                }else{
+                    $rows[$key]['name3'] = trim(db()->table('人事_基本资料')->field('员工姓名')->where('员工编号',$row['wgjs_bh3'])->find()['员工姓名']);
+                }
+            }
+            if ($row['wgjs_bh4']){
+                if ($row['wgjs_bh4']==$row['wgjs_bh1']){
+                    $rows[$key]['name4'] = $row['name1'];
+                }else{
+                    $rows[$key]['name4'] = trim(db()->table('人事_基本资料')->field('员工姓名')->where('员工编号',$row['wgjs_bh4'])->find()['员工姓名']);
+                }
+            }
+            if ($row['wgjs_bh5']){
+                if ($row['wgjs_bh5']==$row['wgjs_bh1']){
+                    $rows[$key]['name5'] = $row['name1'];
+                }else{
+                    $rows[$key]['name5'] = trim(db()->table('人事_基本资料')->field('员工姓名')->where('员工编号',$row['wgjs_bh5'])->find()['员工姓名']);
+                }
+            }
+            if ($row['wgjs_bh6']){
+                if ($row['wgjs_bh6']==$row['wgjs_bh1']){
+                    $rows[$key]['name6'] = $row['name1'];
+                }else{
+                    $rows[$key]['name6'] = trim(db()->table('人事_基本资料')->field('员工姓名')->where('员工编号',$row['wgjs_bh6'])->find()['员工姓名']);
+                }
+            }
+        }
+
+        $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_wgjs')->alias('d')
+            ->field('d.*, ')
+            ->join('工单_基本资料 g', 'd.')
+            ->where('d.UniqId',$UniqId)
+            ->select();
+
+
+        $this->success('成功',$rows);
+    }
+}