qiuenguang 1 gadu atpakaļ
vecāks
revīzija
128d7d1f41
1 mainītis faili ar 44 papildinājumiem un 30 dzēšanām
  1. 44 30
      application/api/controller/Facility.php

+ 44 - 30
application/api/controller/Facility.php

@@ -230,7 +230,6 @@ class Facility extends Api
         if ($endTime['PD_WG'] === '1900-01-01 00:00:00'){
             $list['工单编号'] = $data['工单编号'];
             $list['印件号'] = $data['印件号'];
-            $list['班组编号'] = $data['班组编号'];
             $name = \db('工单_基本资料')->where('Gd_Gdbh',$data['工单编号'])->value('成品名称');
             $list['产品名称'] = rtrim($name);
             $where['Gy0_gdbh'] = $data['工单编号'];
@@ -249,10 +248,10 @@ class Facility extends Api
         }else{
             $list['工单编号'] = '';
             $list['印件号'] = 0;
-            $list['班组编号'] = '';
             $list['产品名称'] = '';
             $list['工序名称'] = '';
         }
+        $list['班组编号'] = rtrim($data['班组编号']);
         $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();
@@ -561,24 +560,46 @@ class Facility extends Api
         $this->success('成功',$data);
     }
 
-    //班组维护
 
-    public function TeamMaintenance()
+    /**
+     * 班组维护->班组添加
+     * @ApiMethod (GET)
+     * @param void
+     * @return void
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
+    public function MachineTeamAdd()
     {
-        if (Request::instance()->isPost() === false){
+        if ($this->request->isGet() === false){
             $this->error('请求错误');
         }
-        $data = Request::instance()->post();
-        if (empty($data)){
+        $param = $this->request->param();
+        if (empty($param)){
             $this->error('参数错误');
         }
-        $field = 'rtrim(sczl_bzdh) as sczl_bzdh,rtrim(sczl_bh1) as sczl_bh1,rtrim(sczl_bh2) as sczl_bh2,rtrim(sczl_bh3) as sczl_bh3,rtrim(sczl_bh4) as sczl_bh4,
-        rtrim(sczl_bh5) as sczl_bh5,rtrim(sczl_bh6) as sczl_bh6,rtrim(sczl_bh7) as sczl_bh7,rtrim(sczl_bh8) as sczl_bh8,rtrim(sczl_bh9) as sczl_bh9,
-        rtrim(sczl_bh10) as sczl_bh10,rtrim(sczl_rate1) as sczl_rate1,rtrim(sczl_rate2) as sczl_rate2,rtrim(sczl_rate3) as sczl_rate3,rtrim(sczl_rate4) as sczl_rate4,
-        rtrim(sczl_rate5) as sczl_rate5,rtrim(sczl_rate6) as sczl_rate6,rtrim(sczl_rate7) as sczl_rate7,rtrim(sczl_rate8) as sczl_rate8,
-        rtrim(sczl_rate9) as sczl_rate9,rtrim(sczl_rate10) as sczl_rate10';
-        $TeamList = \db('设备_班组资料')->where('UniqId',$data['ID'])->field($field)->find();
-
+        $teamDetail = \db('设备_班组资料')
+            ->where('UniqId',$param['UniqId'])
+            ->find();
+        if (empty($teamDetail)){
+            $this->error('数据错误');
+        }
+        $lastId = \db('设备_班组资料')
+            ->order('UniqId desc')
+            ->value('UniqId');
+        if ($lastId<100000){
+            $lastId = 1000000;
+        }
+        $teamDetail['sczl_jtbh'] = $param['machine'].'#';
+        $teamDetail['UniqId'] = $lastId + 1;
+        $teamDetail['sczl_bzdh'] = $param['team'];
+        $res = \db('设备_班组资料')->insert($teamDetail);
+        if ($res !== false){
+            $this->success('成功');
+        }else{
+            $this->error('失败');
+        }
     }
 
 
@@ -631,20 +652,6 @@ class Facility extends Api
 
     }
 
-    //制程检验记录->指标检验
-
-    public function ProcessInspectionRecords()
-    {
-        if ($this->request->isGet() === false){
-            $this->error('请求错误');
-        }
-        $param = $this->request->param();
-        if (empty($param)){
-            $this->error('参数错误');
-        }
-//        $filed = ''
-    }
-
     /**
      * 管理人员现场巡检记录->展示
      * @ApiMethod (GET)
@@ -860,7 +867,6 @@ class Facility extends Api
         }
     }
 
-
     /**
      * 机台印版领用->左侧菜单
      * @ApiMethod (GET)
@@ -1401,7 +1407,15 @@ class Facility extends Api
         }
     }
 
-    //客诉记录
+    /**
+     * 客诉记录
+     * @ApiMethod (GET)
+     * @param  void
+     * @return void
+     * @throws \think\db\exception\DataNotFoundException
+     * @throws \think\db\exception\ModelNotFoundException
+     * @throws \think\exception\DbException
+     */
      public function ComplaintRecord()
      {
          if ($this->request->isGet() === false){