Selaa lähdekoodia

获取工序接口优化

曹鹤洋 1 vuosi sitten
vanhempi
commit
a54b0ce773
1 muutettua tiedostoa jossa 42 lisäystä ja 2 poistoa
  1. 42 2
      application/api/controller/PackagingProcessOutput.php

+ 42 - 2
application/api/controller/PackagingProcessOutput.php

@@ -217,11 +217,12 @@ class PackagingProcessOutput extends Api
     }
 
     /**
-     * 获取工单信息信息
+     * 查询印件工序及产品名称
      * @ApiMethod (GET)
      * @param string $gdbh 工单编号
+     * @param string $gxmc 工序名称
      */
-    public function getWorkOrder()
+    public function getGxMc()
     {
         //get请求
         if(!$this->request->isGet()){
@@ -233,6 +234,45 @@ class PackagingProcessOutput extends Api
         }else{
             $this->error('参数错误');
         }
+        if (isset($req['gxmc']) && !empty($req['gxmc'])){
+            $gxmc = $req['gxmc'];
+        }else{
+            $this->error('参数错误');
+        }
+
+        $rows = db()->table('工单_基本资料')->alias('g')
+            ->field('rtrim(g.Gd_cpmc) as Gd_cpmc, c.Gy0_yjno, c.Gy0_gxh')
+            ->where(['g.Gd_gdbh'=>$gdbh, 'c.gy0_gxmc'=>['like','%'.$gxmc.'%']])
+            ->join(['产品_印件资料'=>'j'],'g.Gd_cpdh=j.yj_yjdh and g.成品代号=j.yj_cpdh')
+            ->join(['产品_工艺资料'=>'c'],'c.Gy0_yjno=j.yj_yjno and c.Gy0_cpdh=j.yj_cpdh')
+            ->select();
+
+        foreach ($rows as $key=>$value){
+            $rows[$key]['jyGx'] =  sprintf("%02d", $value['Gy0_yjno']).'-'.$value['Gy0_gxh'];
+            unset($rows[$key]['Gy0_yjno']);
+            unset($rows[$key]['Gy0_gxh']);
+        }
+
+        $this->success('成功',$rows);
+    }
+
+    /**
+     * 获取工单信息信息
+     * @ApiMethod (GET)
+     * @param string $gdbh 工单编号
+     */
+    public function add()
+    {
+        //get请求
+        if(!$this->request->post()){
+            $this->error('请求方式错误');
+        }
+        $req = $this->request->param();
+        if (isset($req['gdbh']) && !empty($req['gdbh'])){
+            $gdbh = $req['gdbh'];
+        }else{
+            $this->error('参数错误');
+        }
         $gxmc = '包装';
 
         $rows = db()->table('工单_基本资料')