|
|
@@ -33,32 +33,75 @@ class Index extends Api
|
|
|
|
|
|
if($req[0]=='C'){
|
|
|
$time = date('Y/m/d H:i:s');
|
|
|
- $res = [
|
|
|
- 'data_txt_name' => trim(substr($req[1],strripos($req[1],'\\')+1)),
|
|
|
- 'name' => trim(substr($req[2],stripos($req[2],':')+1)),
|
|
|
- 'remak' => trim($req[3]),
|
|
|
- 'author' => trim(substr($req[4],stripos($req[4],':')+1,strripos($req[4],'序列号')-1-stripos($req[4],':'))),
|
|
|
- 'line' => trim(substr($req[4],strripos($req[4],':')+1)),
|
|
|
- 'instrument' => trim(substr($req[5],stripos($req[5],':')+1,strripos($req[5],'位置')-1-stripos($req[5],':'))),
|
|
|
- 'position' => trim(substr($req[5],strripos($req[5],':')+1)),
|
|
|
- 'in_date' => trim(substr($req[6],stripos($req[6],':')+1,strripos($req[6],'进样次数')-1-stripos($req[6],':'))),
|
|
|
- 'in_times' => trim(substr($req[6],strripos($req[6],':')+1)),
|
|
|
- 'in_type' => trim(substr($req[7],stripos($req[7],':')+1)),
|
|
|
- 'gather_method' => trim(substr($req[8],stripos($req[8],':')+1)),
|
|
|
- 'update_date_one' => trim(substr($req[9],stripos($req[9],':')+1)),
|
|
|
- 'analysis_method' => trim(substr($req[10],stripos($req[10],':')+1)),
|
|
|
- 'update_date_two' => trim(substr($req[11],stripos($req[11],':')+1)),
|
|
|
- 'method_info' => trim(substr($req[12],stripos($req[12],':')+1)),
|
|
|
- 'sort' => trim(substr($req[13],stripos($req[13],':')+1)),
|
|
|
- 'check_data_time' => trim(substr($req[14],stripos($req[14],':')+1)),
|
|
|
- 'sample_product_factor' => trim(substr($req[15],strripos($req[15],':')+1)),
|
|
|
- 'dilution_factor' => trim(substr($req[16],strripos($req[16],':')+1)),
|
|
|
- 'signal_one' => trim(substr($req[17],stripos($req[17],':')+1)),
|
|
|
- 'create' => $time,
|
|
|
- ];
|
|
|
+ $res['data_txt_name'] = trim(substr($req[1],strripos($req[1],'\\')+1));
|
|
|
+ $res['name'] = trim(substr($req[2],stripos($req[2],':')+1));
|
|
|
+ $res['remak'] = trim($req[3]);
|
|
|
+ $res['author'] = trim(substr($req[4],stripos($req[4],':')+1,strripos($req[4],'序列号')-1-stripos($req[4],':')));
|
|
|
+ $res['line'] = trim(substr($req[4],strripos($req[4],':')+1));
|
|
|
+ $res['instrument'] = trim(substr($req[5],stripos($req[5],':')+1,strripos($req[5],'位置')-1-stripos($req[5],':')));
|
|
|
+ $res['position'] = trim(substr($req[5],strripos($req[5],':')+1));
|
|
|
+ $res['in_date'] = trim(substr($req[6],stripos($req[6],':')+1,strripos($req[6],'进样次数')-1-stripos($req[6],':')));
|
|
|
+ $res['in_times'] = trim(substr($req[6],strripos($req[6],':')+1));
|
|
|
+ $res['in_type'] = trim(substr($req[7],stripos($req[7],':')+1));
|
|
|
+
|
|
|
+ $num = 18;
|
|
|
+ if(strpos($req[12], '方法信息') !== false){
|
|
|
+ if(strpos($req[13], '附加信息') !== false){
|
|
|
+ $num = 19;
|
|
|
+ $res['gather_method'] = trim(substr($req[8],stripos($req[8],':')+1));
|
|
|
+ $res['update_date_one'] = trim(substr($req[9],stripos($req[9],':')+1));
|
|
|
+ $res['analysis_method'] = trim(substr($req[10],stripos($req[10],':')+1));
|
|
|
+ $res['update_date_two'] = trim(substr($req[11],stripos($req[11],':')+1));
|
|
|
+ $res['method_info'] = trim(substr($req[12],stripos($req[12],':')+1));
|
|
|
+ $res['add_info'] = trim(mb_substr($req[13],5));
|
|
|
+ $res['sort'] = trim(substr($req[14],stripos($req[14],':')+1));
|
|
|
+ $res['check_data_time'] = trim(substr($req[15],stripos($req[15],':')+1));
|
|
|
+ $res['sample_product_factor'] = trim(substr($req[16],strripos($req[16],':')+1));
|
|
|
+ $res['dilution_factor'] = trim(substr($req[17],strripos($req[17],':')+1));
|
|
|
+ $res['signal_one'] = trim(substr($req[18],stripos($req[18],':')+1));
|
|
|
+ }else{
|
|
|
+ $num = 18;
|
|
|
+ $res['gather_method'] = trim(substr($req[8],stripos($req[8],':')+1));
|
|
|
+ $res['update_date_one'] = trim(substr($req[9],stripos($req[9],':')+1));
|
|
|
+ $res['analysis_method'] = trim(substr($req[10],stripos($req[10],':')+1));
|
|
|
+ $res['update_date_two'] = trim(substr($req[11],stripos($req[11],':')+1));
|
|
|
+ $res['method_info'] = trim(substr($req[12],stripos($req[12],':')+1));
|
|
|
+ $res['sort'] = trim(substr($req[13],stripos($req[13],':')+1));
|
|
|
+ $res['check_data_time'] = trim(substr($req[14],stripos($req[14],':')+1));
|
|
|
+ $res['sample_product_factor'] = trim(substr($req[15],strripos($req[15],':')+1));
|
|
|
+ $res['dilution_factor'] = trim(substr($req[16],strripos($req[16],':')+1));
|
|
|
+ $res['signal_one'] = trim(substr($req[17],stripos($req[17],':')+1));
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ if(strpos($req[13], '附加信息') !== false){
|
|
|
+ $num = 18;
|
|
|
+ $res['sequence_file'] = trim(substr($req[8],stripos($req[8],':')+1));
|
|
|
+ $res['method'] = trim(substr($req[9],stripos($req[9],':')+1));
|
|
|
+ $res['update_date_two'] = trim(substr($req[10],stripos($req[10],':')+1));
|
|
|
+ $res['method_info'] = trim(substr($req[11],stripos($req[11],':')+1));
|
|
|
+ $res['add_info'] = trim(substr($req[12],5));
|
|
|
+ $res['sort'] = trim(substr($req[13],stripos($req[13],':')+1));
|
|
|
+ $res['check_data_time'] = trim(substr($req[14],stripos($req[14],':')+1));
|
|
|
+ $res['sample_product_factor'] = trim(substr($req[15],strripos($req[15],':')+1));
|
|
|
+ $res['dilution_factor'] = trim(substr($req[16],strripos($req[16],':')+1));
|
|
|
+ $res['signal_one'] = trim(substr($req[17],stripos($req[17],':')+1));
|
|
|
+ }else{
|
|
|
+ $num = 17;
|
|
|
+ $res['sequence_file'] = trim(substr($req[8],stripos($req[8],':')+1));
|
|
|
+ $res['method'] = trim(substr($req[9],stripos($req[9],':')+1));
|
|
|
+ $res['update_date_two'] = trim(substr($req[10],stripos($req[10],':')+1));
|
|
|
+ $res['method_info'] = trim(substr($req[11],stripos($req[11],':')+1));
|
|
|
+ $res['sort'] = trim(substr($req[12],stripos($req[12],':')+1));
|
|
|
+ $res['check_data_time'] = trim(substr($req[13],stripos($req[13],':')+1));
|
|
|
+ $res['sample_product_factor'] = trim(substr($req[14],strripos($req[14],':')+1));
|
|
|
+ $res['dilution_factor'] = trim(substr($req[15],strripos($req[15],':')+1));
|
|
|
+ $res['signal_one'] = trim(substr($req[16],stripos($req[16],':')+1));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $res['create'] = $time;
|
|
|
|
|
|
//查询记录是否存在
|
|
|
- $bool = db()->name('gather_txt_gc')->where('remak',$res['remak'])->find();
|
|
|
+ $bool = db()->name('gather_txt_gc')->where('data_txt_name',$res['data_txt_name'])->find();
|
|
|
if($bool){
|
|
|
return '已存在';
|
|
|
}
|
|
|
@@ -70,7 +113,7 @@ class Index extends Api
|
|
|
|
|
|
$row = [];
|
|
|
$j = 0;
|
|
|
- for($i = 18; $i < count($req); $i++){
|
|
|
+ for($i = $num; $i < count($req); $i++){
|
|
|
$str = trim($req[$i]);
|
|
|
$arr = preg_split('/\s+/', $str);
|
|
|
if (count($arr)==6){
|
|
|
@@ -201,29 +244,72 @@ class Index extends Api
|
|
|
|
|
|
if($req[0]=='C'){
|
|
|
$time = date('Y/m/d H:i:s');
|
|
|
- $res = [
|
|
|
- 'data_txt_name' => trim(substr($req[1],strripos($req[1],'\\')+1)),
|
|
|
- 'name' => trim(substr($req[2],stripos($req[2],':')+1)),
|
|
|
- 'remak' => trim($req[3]),
|
|
|
- 'author' => trim(substr($req[4],stripos($req[4],':')+1,strripos($req[4],'序列号')-1-stripos($req[4],':'))),
|
|
|
- 'line' => trim(substr($req[4],strripos($req[4],':')+1)),
|
|
|
- 'instrument' => trim(substr($req[5],stripos($req[5],':')+1,strripos($req[5],'位置')-1-stripos($req[5],':'))),
|
|
|
- 'position' => trim(substr($req[5],strripos($req[5],':')+1)),
|
|
|
- 'in_date' => trim(substr($req[6],stripos($req[6],':')+1,strripos($req[6],'进样次数')-1-stripos($req[6],':'))),
|
|
|
- 'in_times' => trim(substr($req[6],strripos($req[6],':')+1)),
|
|
|
- 'in_type' => trim(substr($req[7],stripos($req[7],':')+1)),
|
|
|
- 'gather_method' => trim(substr($req[8],stripos($req[8],':')+1)),
|
|
|
- 'update_date_one' => trim(substr($req[9],stripos($req[9],':')+1)),
|
|
|
- 'analysis_method' => trim(substr($req[10],stripos($req[10],':')+1)),
|
|
|
- 'update_date_two' => trim(substr($req[11],stripos($req[11],':')+1)),
|
|
|
- 'method_info' => trim(substr($req[12],stripos($req[12],':')+1)),
|
|
|
- 'sort' => trim(substr($req[13],stripos($req[13],':')+1)),
|
|
|
- 'check_data_time' => trim(substr($req[14],stripos($req[14],':')+1)),
|
|
|
- 'sample_product_factor' => trim(substr($req[15],strripos($req[15],':')+1)),
|
|
|
- 'dilution_factor' => trim(substr($req[16],strripos($req[16],':')+1)),
|
|
|
- 'signal_one' => trim(substr($req[17],stripos($req[17],':')+1)),
|
|
|
- 'create' => $time,
|
|
|
- ];
|
|
|
+ $res['data_txt_name'] = trim(substr($req[1],strripos($req[1],'\\')+1));
|
|
|
+ $res['name'] = trim(substr($req[2],stripos($req[2],':')+1));
|
|
|
+ $res['remak'] = trim($req[3]);
|
|
|
+ $res['author'] = trim(substr($req[4],stripos($req[4],':')+1,strripos($req[4],'序列号')-1-stripos($req[4],':')));
|
|
|
+ $res['line'] = trim(substr($req[4],strripos($req[4],':')+1));
|
|
|
+ $res['instrument'] = trim(substr($req[5],stripos($req[5],':')+1,strripos($req[5],'位置')-1-stripos($req[5],':')));
|
|
|
+ $res['position'] = trim(substr($req[5],strripos($req[5],':')+1));
|
|
|
+ $res['in_date'] = trim(substr($req[6],stripos($req[6],':')+1,strripos($req[6],'进样次数')-1-stripos($req[6],':')));
|
|
|
+ $res['in_times'] = trim(substr($req[6],strripos($req[6],':')+1));
|
|
|
+ $res['in_type'] = trim(substr($req[7],stripos($req[7],':')+1));
|
|
|
+
|
|
|
+ $num = 18;
|
|
|
+ if(strpos($req[12], '方法信息') !== false){
|
|
|
+ if(strpos($req[13], '附加信息') !== false){
|
|
|
+ $num = 19;
|
|
|
+ $res['gather_method'] = trim(substr($req[8],stripos($req[8],':')+1));
|
|
|
+ $res['update_date_one'] = trim(substr($req[9],stripos($req[9],':')+1));
|
|
|
+ $res['analysis_method'] = trim(substr($req[10],stripos($req[10],':')+1));
|
|
|
+ $res['update_date_two'] = trim(substr($req[11],stripos($req[11],':')+1));
|
|
|
+ $res['method_info'] = trim(substr($req[12],stripos($req[12],':')+1));
|
|
|
+ $res['add_info'] = trim(mb_substr($req[13],5));
|
|
|
+ $res['sort'] = trim(substr($req[14],stripos($req[14],':')+1));
|
|
|
+ $res['check_data_time'] = trim(substr($req[15],stripos($req[15],':')+1));
|
|
|
+ $res['sample_product_factor'] = trim(substr($req[16],strripos($req[16],':')+1));
|
|
|
+ $res['dilution_factor'] = trim(substr($req[17],strripos($req[17],':')+1));
|
|
|
+ $res['signal_one'] = trim(substr($req[18],stripos($req[18],':')+1));
|
|
|
+ }else{
|
|
|
+ $num = 18;
|
|
|
+ $res['gather_method'] = trim(substr($req[8],stripos($req[8],':')+1));
|
|
|
+ $res['update_date_one'] = trim(substr($req[9],stripos($req[9],':')+1));
|
|
|
+ $res['analysis_method'] = trim(substr($req[10],stripos($req[10],':')+1));
|
|
|
+ $res['update_date_two'] = trim(substr($req[11],stripos($req[11],':')+1));
|
|
|
+ $res['method_info'] = trim(substr($req[12],stripos($req[12],':')+1));
|
|
|
+ $res['sort'] = trim(substr($req[13],stripos($req[13],':')+1));
|
|
|
+ $res['check_data_time'] = trim(substr($req[14],stripos($req[14],':')+1));
|
|
|
+ $res['sample_product_factor'] = trim(substr($req[15],strripos($req[15],':')+1));
|
|
|
+ $res['dilution_factor'] = trim(substr($req[16],strripos($req[16],':')+1));
|
|
|
+ $res['signal_one'] = trim(substr($req[17],stripos($req[17],':')+1));
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ if(strpos($req[13], '附加信息') !== false){
|
|
|
+ $num = 18;
|
|
|
+ $res['sequence_file'] = trim(substr($req[8],stripos($req[8],':')+1));
|
|
|
+ $res['method'] = trim(substr($req[9],stripos($req[9],':')+1));
|
|
|
+ $res['update_date_two'] = trim(substr($req[10],stripos($req[10],':')+1));
|
|
|
+ $res['method_info'] = trim(substr($req[11],stripos($req[11],':')+1));
|
|
|
+ $res['add_info'] = trim(substr($req[12],5));
|
|
|
+ $res['sort'] = trim(substr($req[13],stripos($req[13],':')+1));
|
|
|
+ $res['check_data_time'] = trim(substr($req[14],stripos($req[14],':')+1));
|
|
|
+ $res['sample_product_factor'] = trim(substr($req[15],strripos($req[15],':')+1));
|
|
|
+ $res['dilution_factor'] = trim(substr($req[16],strripos($req[16],':')+1));
|
|
|
+ $res['signal_one'] = trim(substr($req[17],stripos($req[17],':')+1));
|
|
|
+ }else{
|
|
|
+ $num = 17;
|
|
|
+ $res['sequence_file'] = trim(substr($req[8],stripos($req[8],':')+1));
|
|
|
+ $res['method'] = trim(substr($req[9],stripos($req[9],':')+1));
|
|
|
+ $res['update_date_two'] = trim(substr($req[10],stripos($req[10],':')+1));
|
|
|
+ $res['method_info'] = trim(substr($req[11],stripos($req[11],':')+1));
|
|
|
+ $res['sort'] = trim(substr($req[12],stripos($req[12],':')+1));
|
|
|
+ $res['check_data_time'] = trim(substr($req[13],stripos($req[13],':')+1));
|
|
|
+ $res['sample_product_factor'] = trim(substr($req[14],strripos($req[14],':')+1));
|
|
|
+ $res['dilution_factor'] = trim(substr($req[15],strripos($req[15],':')+1));
|
|
|
+ $res['signal_one'] = trim(substr($req[16],stripos($req[16],':')+1));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ $res['create'] = $time;
|
|
|
|
|
|
$id = db()->name('gather_txt_gc')->field('id')->where('data_txt_name',$res['data_txt_name'])->find();
|
|
|
|
|
|
@@ -240,7 +326,7 @@ class Index extends Api
|
|
|
//根据id新增子表数据
|
|
|
$row = [];
|
|
|
$j = 0;
|
|
|
- for($i = 18; $i < count($req); $i++){
|
|
|
+ for($i = $num; $i < count($req); $i++){
|
|
|
$str = trim($req[$i]);
|
|
|
$arr = preg_split('/\s+/', $str);
|
|
|
if (count($arr)==6){
|