소스 검색

机台查询优化

qiuenguang 1 년 전
부모
커밋
2c7a3e38fb
3개의 변경된 파일19개의 추가작업 그리고 4개의 파일을 삭제
  1. 1 0
      application/api/controller/Facility.php
  2. 17 4
      application/api/controller/Manufacture.php
  3. 1 0
      application/api/controller/WorkOrder.php

+ 1 - 0
application/api/controller/Facility.php

@@ -42,6 +42,7 @@ class Facility extends Api
             ->distinct(true)
             ->where('使用部门','<>','研发中心')
             ->where('设备编组','<>','')
+            ->where('sys_sbID','<>','')
             ->where($where)
             ->order('设备编组')
             ->column('rtrim(使用部门) as 使用部门');

+ 17 - 4
application/api/controller/Manufacture.php

@@ -50,7 +50,7 @@ class Manufacture extends Api
         }
         $where = [
             'gd_statu' => $status,
-            '行号' => '1',
+//            '行号' => '1',
         ];
         if (isset($param['search'])){
             $where['Gd_lx|Gd_gdbh|Gd_客户代号|Gd_客户名称|Gd_khdh|Gd_khmc|Gd_cpdh|Gd_cpmc|成品代号|成品名称|产品版本号'] = ['like','%'.$param['search'].'%'];
@@ -317,6 +317,7 @@ class Manufacture extends Api
             ->distinct(true)
             ->where('使用部门','<>','研发中心')
             ->where('设备编组','<>','')
+            ->where('sys_sbID','<>','')
             ->where($where)
             ->order('设备编组')
             ->column('使用部门');
@@ -324,10 +325,22 @@ class Manufacture extends Api
             $this->success('为获取到机台数据');
         }
         foreach ($department as $value){
-            $benchClass = \db('设备_基本资料')->where('使用部门',$value)->distinct(true)->order('设备编组')->column('设备编组');
+            $benchClass = \db('设备_基本资料')
+                ->where('使用部门',$value)
+                ->where('设备编组','<>','')
+                ->where('sys_sbID','<>','')
+                ->distinct(true)
+                ->order('设备编组')
+                ->column('设备编组');
             foreach ($benchClass as $v){
                 if (rtrim($v) !== ''){
-                    $machine = \db('设备_基本资料')->where('使用部门',$value)->where('设备编组',$v)->field('rtrim(设备编号) as 设备编号,rtrim(设备名称) as 设备名称')->select();
+                    $machine = \db('设备_基本资料')
+                        ->where('使用部门',$value)
+                        ->where('设备编组',$v)
+                        ->where('sys_sbID','<>','')
+                        ->field('rtrim(设备编号) as 设备编号,rtrim(设备名称) as 设备名称')
+                        ->order('设备编号')
+                        ->select();
                     foreach ($machine as $kk=>$vv){
                         $data[rtrim($value)][rtrim($v)][$kk] = $vv['设备编号'].'-->'.$vv['设备名称'];
                     }
@@ -825,7 +838,7 @@ class Manufacture extends Api
                 'RTRIM( b.`销售订单号` )' => '销售订单号',
             ])
             ->join('工单_印件资料 c','c.Yj_Gdbh = a.Gy0_gdbh AND c.yj_Yjno = a.Gy0_yjno')
-            ->join('工单_基本资料 b','b.Gd_gdbh = a.Gy0_gdbh')
+            ->join('工单_基本资料 b','b.Gd_gdbh = a.Gy0_gdbh AND b.行号 = a.Gy0_yjno')
             ->join('设备_产量计酬 d','a.Gy0_gdbh = d.sczl_gdbh AND a.Gy0_yjno = d.sczl_yjno AND a.Gy0_gxh = d.sczl_gxh AND a.Gy0_sbbh = d.sczl_jtbh','LEFT')
             ->where([
                 'b.gd_statu' => '2-生产中',

+ 1 - 0
application/api/controller/WorkOrder.php

@@ -2306,6 +2306,7 @@ class WorkOrder extends Api
                 ->where('生产工序','like','%'.$value['gy0_gxmc'].'%')
                 ->where('使用部门','<>','研发中心')
                 ->where('设备编组','<>','')
+                ->where('sys_sbID','<>',null)
                 ->order('设备编号')
                 ->value('设备编号');
             $ProcessList[$key]['Gy0_sbbh'] = '';