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(); $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'].'%']; }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') ->page($page,$limit) ->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); } }