|
|
@@ -5,7 +5,6 @@ namespace app\api\controller;
|
|
|
use app\common\controller\Api;
|
|
|
use \think\Request;
|
|
|
use \think\Db;
|
|
|
-use \think\cache;
|
|
|
/**
|
|
|
* 工单核验单维护接口
|
|
|
*/
|
|
|
@@ -33,35 +32,29 @@ class WorkOrderVerification extends Api
|
|
|
if(!$this->request->isGet()){
|
|
|
$this->error('请求方式错误');
|
|
|
}
|
|
|
- $is_have_cache = Cache::get('WorkOrderVerification/getTab');
|
|
|
- if ($is_have_cache === false){
|
|
|
- $rows = db()->table('db_qczl')
|
|
|
- ->field('LEFT(sys_rq, 10) as date, COUNT(*) as counts')
|
|
|
- ->group('date')
|
|
|
- ->order('UniqId desc')
|
|
|
- ->limit(30)
|
|
|
- ->select();
|
|
|
+ $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(*) as count')
|
|
|
- ->where('sys_rq','>=',$rows[count($rows)-1]['date'])
|
|
|
- ->group('date, sys_id')
|
|
|
- ->select();
|
|
|
+ $arr = db()->table('db_qczl')
|
|
|
+ ->field('LEFT(sys_rq, 10) as date, rtrim(sys_id) as sys_id, COUNT(*) as count')
|
|
|
+ ->where('sys_rq','>=',$rows[count($rows)-1]['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]);
|
|
|
- }
|
|
|
+ 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]);
|
|
|
}
|
|
|
- $rows[$key]['date'] = str_replace('-', '.', $rows[$key]['date']);
|
|
|
}
|
|
|
- Cache::set('WorkOrderVerification/getTab',$rows,86400);
|
|
|
- }else{
|
|
|
- $rows = Cache::get('WorkOrderVerification/getTab');
|
|
|
+ $rows[$key]['date'] = str_replace('-', '.', $rows[$key]['date']);
|
|
|
}
|
|
|
|
|
|
$this->success('成功',$rows);
|
|
|
@@ -79,7 +72,7 @@ class WorkOrderVerification extends Api
|
|
|
}
|
|
|
$date = date('Y-m-d',strtotime("-1 year"));
|
|
|
|
|
|
- $rows = db()->table('db_qczl')->alias('d')->cache(true)
|
|
|
+ $rows = db()->table('db_qczl')->alias('d')
|
|
|
->field('d.qczl_gdbh, rtrim(y.Gd_cpmc) as Gd_cpmc')
|
|
|
->join('工单_基本资料 y','y.Gd_gdbh = d.qczl_gdbh','left')
|
|
|
->where('d.sys_rq','>=',$date)
|
|
|
@@ -87,7 +80,7 @@ class WorkOrderVerification extends Api
|
|
|
->order('d.qczl_gdbh desc')
|
|
|
->limit(65)
|
|
|
->select();
|
|
|
- $arr = db()->table('db_qczl')->cache(true)
|
|
|
+ $arr = db()->table('db_qczl')
|
|
|
->field('qczl_gdbh, rtrim(sys_id) as sys_id, COUNT(*) as count')
|
|
|
->where('qczl_gdbh','>=',$rows[count($rows)-1]['qczl_gdbh'])
|
|
|
->group('qczl_gdbh, sys_id')
|
|
|
@@ -145,7 +138,6 @@ class WorkOrderVerification extends Api
|
|
|
rtrim(sys_id) as sys_id,UniqId')
|
|
|
->where($where)
|
|
|
->order('UniqId desc')
|
|
|
- ->cache(true,300)
|
|
|
->page($page,$limit)
|
|
|
->select();
|
|
|
|
|
|
@@ -401,7 +393,7 @@ class WorkOrderVerification extends Api
|
|
|
$where['a.sczl_type'] = array('like','%'.$search.'%');
|
|
|
$list = db('设备_产量计酬')->alias('a')
|
|
|
->join('人事_基本资料 b','a.sczl_bh1 = b.员工编号','left')
|
|
|
- ->where($where)->cache(true,86400)->field('distinct(a.sczl_gxmc),a.sczl_bzdh,a.sczl_jtbh,a.sczl_bh1,b.员工姓名 as name')
|
|
|
+ ->where($where)->field('distinct(a.sczl_gxmc),a.sczl_bzdh,a.sczl_jtbh,a.sczl_bh1,b.员工姓名 as name')
|
|
|
->select();
|
|
|
$count = count($list);
|
|
|
$list[$count]['sczl_gxmc'] = '99-外发加工';
|
|
|
@@ -748,8 +740,6 @@ class WorkOrderVerification extends Api
|
|
|
';
|
|
|
$resultArray = array();
|
|
|
$key = 'getDaysWast'.$params['start_date'].'/'.$params['end_date'];
|
|
|
- $is_have_cache = Cache::has($key);
|
|
|
- if ($is_have_cache === false){
|
|
|
$data = db('db_qczl')
|
|
|
->where($where)
|
|
|
->where(function ($query) {
|
|
|
@@ -811,10 +801,6 @@ class WorkOrderVerification extends Api
|
|
|
$compareBh = strcmp($a['fp_bh'], $b['fp_bh']);
|
|
|
return $compareBh;
|
|
|
});
|
|
|
- Cache::set($key,$resultArray,86400);
|
|
|
- }else{
|
|
|
- $resultArray = Cache::get($key);
|
|
|
- }
|
|
|
|
|
|
$this->success('请求成功',$resultArray);
|
|
|
}
|