Bläddra i källkod

换型清场记录

qiuenguang 1 år sedan
förälder
incheckning
8a96a19c4f
1 ändrade filer med 80 tillägg och 1 borttagningar
  1. 80 1
      application/api/controller/Facility.php

+ 80 - 1
application/api/controller/Facility.php

@@ -595,7 +595,8 @@ class Facility extends Api
         $param['sys_rq'] = date('Y-m-d H:i:s',time());
         $param['UniqId'] = $lastId + 1;
         $param['mod_rq'] = date('Y-m-d H:i:s',time());
-        $res = \db('设备_班组资料')->insert($param);
+        $sql = \db('设备_班组资料')->fetchSql(true)->insert($param);
+        $res = \db()->query($sql);
         if ($res !== false){
             $this->success('成功');
         }else{
@@ -1657,4 +1658,82 @@ class Facility extends Api
         }
         $this->success('成功',$res);
     }
+
+    /**
+     * 换型清场添加
+     * @return void
+     * @throws \think\db\exception\BindParamException
+     * @throws \think\exception\PDOException
+     */
+    public function remodelDataAdd()
+    {
+        if (Request::instance()->isPost() === false){
+            $this->error('请求错误');
+        }
+        $param = Request::instance()->post();
+        if (empty($param)){
+            $this->error('参数错误');
+        }
+        $lastId = \db('制程_换型清场')->order('UniqId desc')->value('UniqId');
+        $param['sys_id'] = '['.$param['机台编号'].']';
+        $param['sys_rq'] = date('Y-m-d H:i:s',time());
+        $param['mod_rq'] = date('Y-m-d H:i:s',time());
+        $param['UniqId'] = $lastId + 1;
+        $sql = \db('制程_换型清场')->fetchSql(true)->insert($param);
+        $res = \db()->query($sql);
+        if ($res !== false){
+            $this->success('成功');
+        }else{
+            $this->error('失败');
+        }
+    }
+
+    /**
+     * 换型清场记录修改
+     * @return void
+     * @throws \think\Exception
+     * @throws \think\db\exception\BindParamException
+     * @throws \think\exception\PDOException
+     */
+    public function remodelDataEdit()
+    {
+        if (Request::instance()->isPost() === false){
+            $this->error('请求错误');
+        }
+        $param = Request::instance()->post();
+        if (empty($param)){
+            $this->error('参数错误');
+        }
+        $param['mod_rq'] = date('Y-m-d H:i:s',time());
+        $sql = \db('制程_换型清场')->fetchSql(true)->update($param);
+        $res = \db()->query($sql);
+        if ($res !== false){
+            $this->success('成功');
+        }else{
+            $this->error('失败');
+        }
+    }
+
+    /**
+     * 换型清场记录删除
+     * @return void
+     * @throws \think\Exception
+     * @throws \think\exception\PDOException
+     */
+    public function remodelDataDel()
+    {
+        if ($this->request->isGet() === false){
+            $this->error('请求错误');
+        }
+        $param = $this->request->param();
+        if (empty($param)){
+            $this->error('参数错误');
+        }
+        $res = \db('制程_换型清场')->where('UniqId',$param['UniqId'])->delete();
+        if ($res !== false){
+            $this->success('删除成功');
+        }else{
+            $this->error('删除失败');
+        }
+    }
 }