Parcourir la source

Merge branch 'master' of gitee.com:huangsanjia/qua-vocs.com

15168162575 il y a 2 ans
Parent
commit
4e9c9b9452
2 fichiers modifiés avec 45 ajouts et 5 suppressions
  1. 13 4
      application/admin/controller/Entrust.php
  2. 32 1
      application/api/controller/Index.php

+ 13 - 4
application/admin/controller/Entrust.php

@@ -327,8 +327,8 @@ class Entrust extends Backend
          * 无法确认是哪台机器(GC、GCMS)检测
          * 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)->order('id desc')->find();
+        $data_txt = $entrust['sample_no'] . 'MS.D'; //如果是GCMS机台,数据文件为委托编号+MS.D或MSR.D
+        $gather_gcms = Db::name('gather_txt_gcms')->where('data_txt_name', ['=',$data_txt],['=',$entrust['sample_no'].'MSR.D'],'or')->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)->order('id desc')->find();
@@ -375,12 +375,21 @@ class Entrust extends Backend
             }
         }
         $judge = Db::name('item_judge_detail')->where('pid', $temp_id[$ke])->select();
-        $class = Db::name('item_judge')->where('id', $id)->value('class');//获取判定标准类别
+        $class = Db::name('item_judge')->where('id', $temp_id[$ke])->value('class');//获取判定标准类别
         $sum_all_dis_data = array_sum($all_dis_data);
+        if ($ethanol == '-'){
+            $ethanol = 0;
+        }
+        if ($methanol == '-'){
+            $methanol = 0;
+        }
+        if ($ethylacetate == '-'){
+            $ethylacetate = 0;
+        }
         if ($class == 1) {//常规类  26项减去乙醇 杂质总量14项
             $dis = $sum_all_dis_data - $ethanol;    //残留总量
             $dis_impurity = array_sum($dis_impurity_data);  //杂质总量
-        } elseif ($class == 2) {//特殊类1 26项减去乙醇、甲醇、乙酸乙酯,杂质总量减去甲醇
+        } else if ($class == 2) {//特殊类1 26项减去乙醇、甲醇、乙酸乙酯,杂质总量减去甲醇
             $dis = $sum_all_dis_data - $ethanol - $methanol - $ethylacetate;    //残留总量
             $dis_impurity = array_sum($dis_impurity_data) - $methanol;  //杂质总量
         } else {//特殊类2 26项减去乙醇 杂质总量14项减去甲醇

+ 32 - 1
application/api/controller/Index.php

@@ -334,6 +334,13 @@ class Index extends Api
                 //将检测数据插入子表gather_txt_check_gc
                 db()->name('gather_txt_check_gc')->insertAll($row);
 
+                //去除数据文件名称后面的字母和.
+                $sample_no = preg_replace('/[a-zA-Z\.]+\s*$/', '', $res['data_txt_name']);
+                //查询entrust表中是否存在, 如果存在修改状态
+                if(db()->name('entrust')->where('sample_no',$sample_no)->find()){
+                    db()->name('entrust')->where('sample_no',$sample_no)->update(['data_status'=>1]);
+                }
+
                 //提交事务
                 db()->commit();
                 return json_encode(['code'=>'0','msg'=>'成功','time'=>$time,'data'=>[$res,$row]]);
@@ -521,7 +528,15 @@ class Index extends Api
                 }
 
                 //将检测数据插入子表gather_txt_check_gc
-                $id = db()->name('gather_txt_check_gcms')->insertAll($row);
+                db()->name('gather_txt_check_gcms')->insertAll($row);
+
+                //去除数据文件名称后面的字母和.
+                $sample_no = preg_replace('/[a-zA-Z\.]+\s*$/', '', $res['data_txt_name']);
+                //查询entrust表中是否存在, 如果存在修改状态
+                if(db()->name('entrust')->where('sample_no',$sample_no)->find()){
+                    db()->name('entrust')->where('sample_no',$sample_no)->update(['data_status'=>1]);
+                }
+
                 //提交事务
                 db()->commit();
 
@@ -829,6 +844,14 @@ class Index extends Api
 
                         //将检测数据插入子表gather_txt_check_gc
                         db()->name('gather_txt_check_gc')->insertAll($row);
+
+                        //去除数据文件名称后面的字母和.
+                        $sample_no = preg_replace('/[a-zA-Z\.]+\s*$/', '', $res['data_txt_name']);
+                        //查询entrust表中是否存在, 如果存在修改状态
+                        if(db()->name('entrust')->where('sample_no',$sample_no)->find()){
+                            db()->name('entrust')->where('sample_no',$sample_no)->update(['data_status'=>1]);
+                        }
+
                         //提交事务
                         db()->commit();
                         return json_encode(['code'=>'0','msg'=>'修改成功','time'=>$time,'data'=>[$res,$row]]);
@@ -1022,6 +1045,14 @@ class Index extends Api
 
                         //将检测数据插入子表gather_txt_check_gc
                         db()->name('gather_txt_check_gcms')->insertAll($row);
+
+                        //去除数据文件名称后面的字母和.
+                        $sample_no = preg_replace('/[a-zA-Z\.]+\s*$/', '', $res['data_txt_name']);
+                        //查询entrust表中是否存在, 如果存在修改状态
+                        if(db()->name('entrust')->where('sample_no',$sample_no)->find()){
+                            db()->name('entrust')->where('sample_no',$sample_no)->update(['data_status'=>1]);
+                        }
+                        
                         //提交事务
                         db()->commit();
                         return json_encode(['code'=>'0','msg'=>'修改成功','time'=>$time,'data'=>[$res,$row]]);