|
|
@@ -60,17 +60,18 @@ class Entrust extends Backend
|
|
|
->paginate($limit);
|
|
|
}else{
|
|
|
$userinfo = Db::name('admin')->where('id',$user_id)->find();
|
|
|
- $pidList = Db::name('company')->where('pid',$userinfo['company'])->select();
|
|
|
- $map = [];
|
|
|
- if (!empty($pidList)){//总公司
|
|
|
- $pid = [];
|
|
|
- foreach ($pidList as $key=>$value){
|
|
|
- $pid[$key] = $value['id'];
|
|
|
- }
|
|
|
- $map['work_unit'] = array('in',$pid);
|
|
|
- }else{//分公司
|
|
|
- $map['work_unit'] = $userinfo['company'];
|
|
|
- }
|
|
|
+// $pidList = Db::name('company')->where('pid',$userinfo['company'])->select();
|
|
|
+// $map = [];
|
|
|
+// if (!empty($pidList)){//总公司
|
|
|
+// $pid = [];
|
|
|
+// foreach ($pidList as $key=>$value){
|
|
|
+// $pid[$key] = $value['id'];
|
|
|
+// }
|
|
|
+// $map['work_unit'] = array('in',$pid);
|
|
|
+// }else{//分公司
|
|
|
+// $map['work_unit'] = $userinfo['company'];
|
|
|
+// }
|
|
|
+ $map['work_unit'] = $userinfo['company'];
|
|
|
$list = $this->model
|
|
|
->where($where)
|
|
|
->where($map)
|
|
|
@@ -110,10 +111,12 @@ class Entrust extends Backend
|
|
|
if (empty($company)){
|
|
|
$company = Db::name('company')->where('id',$company_id)->column('id,name');
|
|
|
}
|
|
|
- $this->assign('company',$company);
|
|
|
$judgeData = Db::name('item_judge')->whereNull('delete')->order('weigh asc')->column('id,name');
|
|
|
+ $receiveData = Db::name('receive_people')->where('company_id',$company_id)->column('id,name');
|
|
|
+ $this->assign('company',$company);
|
|
|
$this->view->assign('judgeData', $judgeData);
|
|
|
$this->view->assign('nickname', $nickname);
|
|
|
+ $this->view->assign('receiveData', $receiveData);
|
|
|
return $this->view->fetch();
|
|
|
}
|
|
|
$params = $this->request->post('row/a');
|
|
|
@@ -131,11 +134,12 @@ class Entrust extends Backend
|
|
|
$params['standard_id'] = preg_replace('/\s+/','',$params['standard_id']);
|
|
|
$judge = Db::name('item_judge')->where('id',$params['standard_id'])->find();
|
|
|
$params['standard_name'] = $judge['name'];
|
|
|
+ $params['receive_sample'] = Db::name('receive_people')->where('id',$params['receive_sample'])->value('name');
|
|
|
$params['user_name'] = $userinfo['username'];
|
|
|
$params['work_unit'] = $userinfo['company'];
|
|
|
$params['work_name'] = Db::name('company')->where('id',$userinfo['company'])->value('name');
|
|
|
$params['company'] = Db::name('company')->where('id',$params['company'])->value('name');
|
|
|
-
|
|
|
+ print_r($params);die;
|
|
|
$is_exit = false;//默认样品编号唯一
|
|
|
if ($params['is_two'] == 1){//双样
|
|
|
for ($i=0;$i<2;$i++){
|
|
|
@@ -201,6 +205,8 @@ class Entrust extends Backend
|
|
|
$company = Db::name('company')->where('pid',$pid)->column('id,name');
|
|
|
$report_grant = explode(',',$row['report_grant']);
|
|
|
$sample_stand = explode(',',$row['sample_stand']);
|
|
|
+ $receiveData = Db::name('receive_people')->where('company_id',$company_id)->column('id,name');
|
|
|
+ $this->view->assign('receiveData', $receiveData);
|
|
|
$this->assign('company',$company);
|
|
|
$this->assign('report_grant',$report_grant);
|
|
|
$this->assign('sample_stand',$sample_stand);
|
|
|
@@ -220,6 +226,7 @@ class Entrust extends Backend
|
|
|
$item_judge = Db::name('item_judge')->field('id,name')->where('id',$params['standard_id'])->find();
|
|
|
$params['standard_id'] = $item_judge['id'];
|
|
|
$params['standard_name'] = $item_judge['name'];
|
|
|
+ $params['receive_sample'] = Db::name('receive_people')->where('id',$params['receive_sample'])->value('name');
|
|
|
$params = $this->preExcludeFields($params);
|
|
|
$result = false;
|
|
|
Db::startTrans();
|
|
|
@@ -748,13 +755,15 @@ class Entrust extends Backend
|
|
|
if (empty($params) || empty($company)){
|
|
|
$this->error('参数错误');
|
|
|
}
|
|
|
- $num = Db::name('entrust')->where('sample_no','like','%'.$params.'%')->whereTime('create','d')->count();
|
|
|
-
|
|
|
- if ($company == '亚欣'){//亚欣送样从100开始
|
|
|
- $num = $num+100;
|
|
|
- }else{
|
|
|
- $num = $num+1;
|
|
|
- }
|
|
|
+ $beginTime = date('Y-m-d 00:00:00');
|
|
|
+ $endTime = date('Y-m-d 24:00:00');
|
|
|
+ $num = Db::name('entrust')->where('sample_no','like','%'.$params.'%')->where('create','between',[$beginTime,$endTime])->count();
|
|
|
+// if ($company == '亚欣'){//亚欣送样从100开始
|
|
|
+// $num = $num+100;
|
|
|
+// }else{
|
|
|
+// $num = $num+1;
|
|
|
+// }
|
|
|
+ $num = $num+1;
|
|
|
if ($num < 10){
|
|
|
$num = '0'.$num;
|
|
|
}
|