qiuenguang 1 год назад
Родитель
Сommit
1640ca7f65
1 измененных файлов с 23 добавлено и 19 удалено
  1. 23 19
      application/api/controller/Facility.php

+ 23 - 19
application/api/controller/Facility.php

@@ -277,6 +277,7 @@ class Facility extends Api
         $machineCode = \db('dic_lzde')->where('适用机型',$machine)->value('sys_bh');
         $data = \db('设备_产量采集')->where('设备编号',$machine)->order('UniqId desc')->find();
         $list = [];
+        $row = [];
         if (!empty($data['工单编号'])){
             $endTime = \db('工单_工艺资料')
                 ->where('Gy0_gdbh',$data['工单编号'])
@@ -292,31 +293,34 @@ class Facility extends Api
                     $list['产品代号'] = rtrim($code);
                     $list['工序名称'] = $data['工序名称'];
             }
+            $list['状态'] = rtrim($data['当前状态']);
+            $list['班组编号'] = rtrim($data['班组编号']);
+            $list['班组Id'] = rtrim($data['班组ID']);
+            $class = \db('设备_班组资料')->where('UniqId',$data['班组ID'])->field("rtrim(sczl_bh1) as bh1,rtrim(sczl_bh2) as bh2,rtrim(sczl_bh3) as bh3,rtrim(sczl_bh4) as bh4,
+        rtrim(sczl_bh5) as bh5,rtrim(sczl_bh6) as bh6,rtrim(sczl_bh7) as bh7,rtrim(sczl_bh8) as bh8,rtrim(sczl_bh9) as bh9,
+        rtrim(sczl_bh10) as bh10")->find();
+            if (!empty($class)){
+                for ($i=1;$i<11;$i++) {
+                    if ($class['bh' . $i] != '' && $class['bh' . $i] != '000000') {
+                        $name = \db('人事_基本资料')->where('员工编号', $class['bh' . $i])->field('rtrim(员工姓名) as 姓名')->find();
+                        $row[$i] = [
+                            '编号' => $class['bh' . $i],
+                            '姓名' => $name['姓名']
+                        ];
+                    }
+                }
+                $row = array_values($row);
+            }
+
         }else{
             $list['工单编号'] = '';
             $list['印件号'] = 0;
             $list['产品名称'] = '';
             $list['工序名称'] = '';
             $list['产品代号'] = '';
-        }
-        $list['状态'] = rtrim($data['当前状态']);
-        $list['班组编号'] = rtrim($data['班组编号']);
-        $list['班组Id'] = rtrim($data['班组ID']);
-        $class = \db('设备_班组资料')->where('UniqId',$data['班组ID'])->field("rtrim(sczl_bh1) as bh1,rtrim(sczl_bh2) as bh2,rtrim(sczl_bh3) as bh3,rtrim(sczl_bh4) as bh4,
-        rtrim(sczl_bh5) as bh5,rtrim(sczl_bh6) as bh6,rtrim(sczl_bh7) as bh7,rtrim(sczl_bh8) as bh8,rtrim(sczl_bh9) as bh9,
-        rtrim(sczl_bh10) as bh10")->find();
-        $row = [];
-        if (!empty($class)){
-            for ($i=1;$i<11;$i++) {
-                if ($class['bh' . $i] != '' && $class['bh' . $i] != '000000') {
-                    $name = \db('人事_基本资料')->where('员工编号', $class['bh' . $i])->field('rtrim(员工姓名) as 姓名')->find();
-                    $row[$i] = [
-                        '编号' => $class['bh' . $i],
-                        '姓名' => $name['姓名']
-                    ];
-                }
-            }
-            $row = array_values($row);
+            $list['状态'] = '';
+            $list['班组编号'] = '';
+            $list['班组Id'] = '';
         }
         $list['班组成员'] = $row;
         $list['定额代号'] = $machineCode;