qiuenguang преди 1 година
родител
ревизия
f6a2f04aec
променени са 2 файла, в които са добавени 44 реда и са изтрити 7 реда
  1. 8 2
      application/api/controller/Facility.php
  2. 36 5
      application/api/controller/WorkOrder.php

+ 8 - 2
application/api/controller/Facility.php

@@ -1556,8 +1556,14 @@ class Facility extends Api
         }
     }
 
-    //首页数据
-
+    /**
+     * 首页数据
+     * @return void
+     * @throws \think\Exception
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
     public function index()
     {
         if ($this->request->isGet() === false){

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

@@ -342,12 +342,16 @@ class WorkOrder extends Api
             ->cache(true,84600)
             ->find();
         if (empty($printData)){
-            $this->error('未找到该工单印件资料');
+            $list['印件名称'] = '';
+            $list['印件代号'] = '';
+            $list['平张投料'] = '';
+            $list['印件ID'] = '';
+        }else{
+            $list['印件名称'] = $printData['印件名称'];
+            $list['印件代号'] = $printData['印件代号'];
+            $list['平张投料'] = $printData['平张投料'];
+            $list['印件ID'] = $printData['id'];
         }
-        $list['印件名称'] = $printData['印件名称'];
-        $list['印件代号'] = $printData['印件代号'];
-        $list['平张投料'] = $printData['平张投料'];
-        $list['印件ID'] = $printData['id'];
         $this->success('成功',$list);
     }
 
@@ -1648,4 +1652,31 @@ class WorkOrder extends Api
             $this->error('删除失败');
         }
     }
+
+    /**
+     * 工艺资料添加->工序损耗代码
+     * @return void
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    public function WastageList()
+    {
+        if ($this->request->isGet() === false){
+            $this->error('请求错误');
+        }
+        $param = $this->request->param();
+        if (isset($param['search']) === false){
+            $this->error('参数错误');
+        }
+        $order = \db('dic_lzsh')
+            ->where('sys_mc','like',substr($param['search'],0,6).'%')
+            ->value('rtrim(sys_bh) as 编号');
+        $list = \db('dic_lzsh')
+            ->where('sys_bh','like',$order.'%')
+            ->where('sys_bh','<>',$order)
+            ->field('rtrim(sys_bh) as 编号,rtrim(sys_mc) as 名称,rtrim(UniqId) as UniqId')
+            ->select();
+        $this->success('成功',$list);
+    }
 }