Browse Source

引用产品资料工单资料获取

qiuenguang 1 year ago
parent
commit
a2512cc0b1
1 changed files with 36 additions and 0 deletions
  1. 36 0
      application/api/controller/WorkOrder.php

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

@@ -1920,4 +1920,40 @@ class WorkOrder extends Api
 
     }
 
+    /**
+     * 引用工单资料数据查询
+     * @return void
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    public function WorkOrderDetailCope()
+    {
+        if ($this->request->isGet() === false){
+            $this->error('请求错误');
+        }
+        $param = $this->request->param();
+        if (empty($param['search'])){
+            $this->error('参数错误');
+        }
+        $list = \db('工单_基本资料')
+            ->alias('a')
+            ->field([
+                'rtrim(a.Gd_gdbh)' => '工单编号',
+                'rtrim(b.客户编号)' => '客户编号',
+                'rtrim(b.客户名称)' => '客户名称',
+                'rtrim(b.产品编号)' => '产品编号',
+                'rtrim(b.产品名称)' => '产品名称'
+            ])
+            ->join('产品_基本资料 b','a.成品代号 = b.产品编号')
+            ->where('a.Gd_gdbh','like','%'.$param['search'].'%')
+            ->whereOr('a.成品名称','like','%'.$param['search'].'%')
+            ->select();
+        if (empty($list)){
+            $this->success('未找到工单资料');
+        }else{
+            $this->success('成功',$list);
+        }
+    }
+
 }