|
|
@@ -51,14 +51,26 @@ class Entrust extends Backend
|
|
|
$params['name'] = preg_replace('/\s+/','',$params['name']);//去掉所有空格
|
|
|
$params['user_id'] = Session::get('admin')['id'];
|
|
|
$params['user_name'] = Session::get('admin')['username'];
|
|
|
- $params = $this->preExcludeFields($params);
|
|
|
+// $params = $this->preExcludeFields($params);
|
|
|
+ $is_exit = false;//默认样品编号唯一
|
|
|
if ($params['is_two'] == 1){//双样
|
|
|
for ($i=0;$i<2;$i++){
|
|
|
$data[$i] = $params;
|
|
|
$data[$i]['sample_no'] = $params['sample_no'].'-'.($i+1);
|
|
|
+ $is_exit = Db::name('entrust')->where('sample_no',$data[$i]['sample_no'])->find();
|
|
|
+ if ($is_exit){
|
|
|
+ $is_exit = true;
|
|
|
+ }
|
|
|
}
|
|
|
}else{//单样
|
|
|
- $data = $params;
|
|
|
+ $data[0] = $params;
|
|
|
+ $is_exit = Db::name('entrust')->where('sample_no',$params['sample_no'])->find();
|
|
|
+ if ($is_exit){
|
|
|
+ $is_exit = true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if ($is_exit === true){
|
|
|
+ $this->error('样品编号已存在,请关闭此页面后重新打开!');
|
|
|
}
|
|
|
$result = false;
|
|
|
Db::startTrans();
|
|
|
@@ -155,10 +167,10 @@ class Entrust extends Backend
|
|
|
* 1、先去找gcms表 没有查到数据 再找gc表
|
|
|
*/
|
|
|
$data_txt = $entrust['sample_no'].'MS.D'; //如果是GCMS机台,数据文件为委托编号+MS.D
|
|
|
- $gather_gcms = Db::name('gather_txt_gcms')->where('data_txt_name',$data_txt)->find();
|
|
|
+ $gather_gcms = Db::name('gather_txt_gcms')->where('data_txt_name',$data_txt)->order('id desc')->find();
|
|
|
if (empty($gather_gcms)){
|
|
|
$data_txt_gc = $entrust['sample_no'].'.D';
|
|
|
- $gather_gc = Db::name('gather_txt_gc')->where('data_txt_name',$data_txt_gc)->find();
|
|
|
+ $gather_gc = Db::name('gather_txt_gc')->where('data_txt_name',$data_txt_gc)->order('id desc')->find();
|
|
|
if (empty($gather_gc)){
|
|
|
$this->error('未获取到检测数据');
|
|
|
}
|
|
|
@@ -327,16 +339,34 @@ class Entrust extends Backend
|
|
|
$data = Db::name('gather_txt_check_gcms')->where('pid',$gather_id['gather_id'])->select();
|
|
|
$this->view->assign('gather', $gather);
|
|
|
$this->view->assign('data', $data);
|
|
|
+ $this->view->assign('id', $params);
|
|
|
return $this->view->fetch();
|
|
|
}else if ($gather_id['gather_tab'] == 'gather_txt_check_gc'){
|
|
|
$gather = Db::name('gather_txt_gc')->where('id',$gather_id['gather_id'])->find();
|
|
|
$data = Db::name('gather_txt_check_gc')->where('pid',$gather_id['gather_id'])->select();
|
|
|
$this->view->assign('gather', $gather);
|
|
|
$this->view->assign('data', $data);
|
|
|
+ $this->view->assign('id', $params);
|
|
|
return $this->fetch('datagc');
|
|
|
}
|
|
|
|
|
|
}
|
|
|
+ public function dataSure(){
|
|
|
+ $params = input('id');
|
|
|
+ if (empty($params)){
|
|
|
+ $this->error('参数错误');
|
|
|
+ }
|
|
|
+ $gather_id = Db::name('entrust')->where('id',$params)->find();
|
|
|
+ if (empty($gather_id['gather_id'])){
|
|
|
+ $this->error('此委托单还未提交检测,暂无检测数据');
|
|
|
+ }
|
|
|
+ if ($gather_id['gather_tab'] == 'gather_txt_check_gcms'){
|
|
|
+ Db::name('gather_txt_gcms')->where('id',$gather_id['gather_id'])->setField('status',1);
|
|
|
+ }else{
|
|
|
+ Db::name('gather_txt_gc')->where('id',$gather_id['gather_id'])->setField('status',1);
|
|
|
+ }
|
|
|
+ $this->success('确认成功');
|
|
|
+ }
|
|
|
//委托单
|
|
|
public function commissionSheet(){
|
|
|
|