瀏覽代碼

优化提交到检测

liuhairui 2 年之前
父節點
當前提交
9b00c2befe
共有 1 個文件被更改,包括 20 次插入16 次删除
  1. 20 16
      application/admin/controller/Entrust.php

+ 20 - 16
application/admin/controller/Entrust.php

@@ -338,12 +338,27 @@ class Entrust extends Backend
         $data_txt_gc = $entrust['sample_no'] . '.D';
         $gather_gc = Db::name('gather_txt_gc')->where('data_txt_name', ['=',$data_txt_gc],['=',$entrust['sample_no'].'R.D'],'or')->order('id desc')->find();
 
-        if (empty($gather_gcms)) {
+//        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],['=',$entrust['sample_no'].'R.D'],'or')->order('id desc')->find();
+//            if (empty($gather_gc)) {
+//                $this->error('序号为'.$id.'的样品未获取到检测数据,请取消选中');
+//            }
+//            $gather = $gather_gc;
+//            $gather_tab = 'gather_txt_check_gc';
+//        } else {
+//            $gather = $gather_gcms;
+//            $gather_tab = 'gather_txt_check_gcms';
+//        }
+
+        if (empty($gather_gcms) && empty($gather_gc)) {
+            $this->error('没获取到检测数据');
+        }else if(empty($gather_gcms)){
             $gather = $gather_gc;
             $gather_tab = 'gather_txt_check_gc';
-            if (empty($gather_gc)) {
-                $this->error('没获取到检测数据');
-            }
+        }else if(empty($gather_gc)){
+            $gather = $gather_gcms;
+            $gather_tab = 'gather_txt_check_gcms';
         }else{
             $gcms_time = strtotime($gather_gcms['create']);//gcms创建时间转换为时间戳
             $gc_time = strtotime($gather_gc['create']);    //gc创建时间转换为时间戳
@@ -357,18 +372,7 @@ class Entrust extends Backend
                 $gather_tab = 'gather_txt_check_gc';
             }
         }
-//        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],['=',$entrust['sample_no'].'R.D'],'or')->order('id desc')->find();
-//            if (empty($gather_gc)) {
-//                $this->error('序号为'.$id.'的样品未获取到检测数据,请取消选中');
-//            }
-//            $gather = $gather_gc;
-//            $gather_tab = 'gather_txt_check_gc';
-//        } else {
-//            $gather = $gather_gcms;
-//            $gather_tab = 'gather_txt_check_gcms';
-//        }
+
         $detail_data = Db::name($gather_tab)->where('pid', $gather['id'])->field('chemical_compound,potency')->select();
         $is_qualified = [];//默认合格,当有一项不合格时,判定此次检测不合格
         $dis = 0;//溶剂残留总量