Ver código fonte

检品机每日上报产量废品率系数修改

qiuenguang 1 ano atrás
pai
commit
9c9a698c6b
1 arquivos alterados com 35 adições e 0 exclusões
  1. 35 0
      application/api/controller/Facility.php

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

@@ -2330,6 +2330,41 @@ class Facility extends Api
         }
     }
 
+    /**
+     * 废品率系数批量修改
+     * @return void
+     * @throws \think\Exception
+     * @throws \think\db\exception\BindParamException
+     * @throws \think\exception\PDOException
+     */
+    public function RejectionEdit()
+    {
+        if (Request::instance()->isPost() === false){
+            $this->error('请求错误');
+        }
+        $params = Request::instance()->post();
+        if (empty($params['id'])){
+            $this->error('参数错误');
+        }
+        $idList = explode(',',$params['id']);
+        $i=0;
+        foreach ($idList as $key=>$value){
+            $sql = \db('设备_产量计酬')
+                ->where('UniqId',$value)
+                ->fetchSql(true)
+                ->update(['sczl_废品率系数'=>$params['rejection']]);
+            $res = \db()->query($sql);
+            if ($res === false){
+                $i++;
+            }
+        }
+        if ($i!==0){
+            $this->error('修改失败');
+        }else{
+            $this->success('修改成功');
+        }
+    }
+
     /**
      * 日产量上报班组信息批量修改
      * @return void