|
|
@@ -39,7 +39,7 @@ class WorkOrderSpotCheck extends Api
|
|
|
->select();
|
|
|
|
|
|
$arr = db()->table('db_抽检记录')
|
|
|
- ->field('LEFT(Sys_rq, 10) as date, rtrim(Sys_id) as Sys_id, COUNT(Sys_id) as count')
|
|
|
+ ->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')
|
|
|
->order('UniqId desc')
|
|
|
@@ -59,6 +59,45 @@ class WorkOrderSpotCheck extends Api
|
|
|
$this->success('成功',$rows);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取侧边栏通过工单编号
|
|
|
+ * @ApiMethod (GET)
|
|
|
+ */
|
|
|
+ public function getTabByGdbh()
|
|
|
+ {
|
|
|
+ //get请求
|
|
|
+ if(!$this->request->isGet()){
|
|
|
+ $this->error('请求方式错误');
|
|
|
+ }
|
|
|
+ $date = date('Y-m-d',strtotime("-1 year"));
|
|
|
+
|
|
|
+ $rows = db()->table('db_抽检记录')->alias('d')->cache(true)
|
|
|
+ ->field('d.Sczl_gdbh, rtrim(y.Gd_cpmc) as Gd_cpmc')
|
|
|
+ ->join('工单_基本资料 y','y.Gd_gdbh = d.Sczl_gdbh','left')
|
|
|
+ // ->where('d.sys_rq','>=',$date)
|
|
|
+ ->group('d.Sczl_gdbh')
|
|
|
+ ->order('d.Sczl_gdbh desc')
|
|
|
+ ->limit(65)
|
|
|
+ ->select();
|
|
|
+ $arr = db()->table('db_抽检记录')->cache(true)
|
|
|
+ ->field('Sczl_gdbh, rtrim(Sys_id) as Sys_id, COUNT(*) as count')
|
|
|
+ ->where('Sczl_gdbh','>=',$rows[count($rows)-1]['Sczl_gdbh'])
|
|
|
+ ->group('Sczl_gdbh, Sys_id')
|
|
|
+ ->select();
|
|
|
+ foreach($rows as $key=>$value){
|
|
|
+ $rows[$key]['sys'] = [];
|
|
|
+ foreach($arr as $k=>$v){
|
|
|
+ if($value['Sczl_gdbh'] == $v['Sczl_gdbh']){
|
|
|
+ unset($v['Sczl_gdbh']);
|
|
|
+ array_push($rows[$key]['sys'],$v);
|
|
|
+ unset($arr[$k]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ $this->success('成功',$rows);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 获取工单抽检记录列表
|
|
|
* @ApiMethod (GET)
|
|
|
@@ -80,7 +119,11 @@ class WorkOrderSpotCheck extends Api
|
|
|
|
|
|
$where = [];
|
|
|
if (isset($req['date']) && !empty($req['date'])){
|
|
|
- $where['Sys_rq'] = ['LIKE',$req['date'].'%'];
|
|
|
+ if(strpos($req['date'],'-')){
|
|
|
+ $where['Sys_rq'] = ['like',$req['date'].'%'];
|
|
|
+ }else{
|
|
|
+ $where['Sczl_gdbh'] = $req['date'];
|
|
|
+ }
|
|
|
}else{
|
|
|
$this->error('参数错误');
|
|
|
}
|