wugg 3 years ago
parent
commit
12aea6230d
3 changed files with 66 additions and 0 deletions
  1. 1 0
      app/admin/controller/Check.php
  2. 58 0
      app/admin/controller/Express.php
  3. 7 0
      app/admin/route/app.php

+ 1 - 0
app/admin/controller/Check.php

@@ -278,6 +278,7 @@ public function create(){
 //            $in= Db::name('check_item')->insertAll($dio);
 //        }
         if($da){
+
            Db::commit();
             return error_show(0,"盘点创建成功");
         }else{

+ 58 - 0
app/admin/controller/Express.php

@@ -0,0 +1,58 @@
+<?php
+
+
+namespace app\admin\controller;
+use think\App;
+use think\facade\Db;
+
+class Express extends \app\BaseController
+{
+    public $post='';
+    public function __construct(App $app)
+    {
+        parent::__construct($app);
+        $this->post = request()->post();
+    }
+
+    public function list(){
+        $page = isset($this->post['page']) &&$this->post['page'] !=="" ? intval($this->post['page']):1;
+        $size = isset($this->post['size']) &&$this->post['size'] !=="" ? intval($this->post['size']):10;
+        $type = isset($this->post['type']) &&$this->post['type'] !=="" ? intval($this->post['type']):'0';
+        $where = [["type","=",$type]];
+        $name =  isset($this->post['name']) &&$this->post['name'] !="" ? trim($this->post['name']):'';
+        if($name!=''){
+            $where[]=["name|shortName","=","%{$name}%"];
+        }
+        $count = Db::name("express")->where($where)->count();
+        $page>=ceil($count/$size) ? $page=ceil($count/$size) :"";
+        $list= Db::name("express")->where($where)->field('type,comTypeName,name,shortName,shortNameEn,shortNumber,canOrder')
+            ->page($page,$size)->select();
+        return app_show(0,'获取成功',['list'=>$list,"count"=>$count]);
+    }
+    public function  SetUse(){
+        $id = isset($this->post['id']) &&$this->post['id'] !="" ? intval($this->post['id']):'';
+        if($id==''){
+            return error_show(1004,"参数id不能为空");
+        }
+        $express = Db::name("express")->where(["id"=>$id])->find();
+        if(empty($express)){
+            return error_show(1004,"未找到数据");
+        }
+        $express['canOrder'] = $express['canOrder']==0 ?1:0;
+        $up = Db::name("express")->save($express);
+        return $up?app_show(0,"更新成功"):error_show(1005,"更新失败");
+    }
+
+    public function GetExpress(){
+        $type = isset($this->post['type']) &&$this->post['type'] !=="" ? intval($this->post['type']):'0';
+
+        $where = [["type","=",$type],['canOrder',"=",1]];
+        $name =  isset($this->post['name']) &&$this->post['name'] !="" ? trim($this->post['name']):'';
+        if($name!=''){
+            $where[]=["name|shortName","=","%{$name}%"];
+        }
+        $list= Db::name("express")->where($where)->field('type,comTypeName,name,shortName,shortNameEn,shortNumber,canOrder')
+            ->select();
+        return app_show(0,'获取成功',$list);
+    }
+}

+ 7 - 0
app/admin/route/app.php

@@ -193,5 +193,12 @@ Route::rule("orderinreturn","admin/Purchin/ReturnAdd");
 Route::rule("returnsend","admin/Purchin/ReturnSend");
 Route::rule("returnstatus","admin/Purchin/ReturnStatus");
 
+Route::rule("processlist","admin/Process/list");
+Route::rule("processinfo","admin/Process/info");
+Route::rule("process","admin/Process/process");
+
+Route::rule("expresslist","admin/Express/list");
+Route::rule("expressuse","admin/Express/SetUse");
+Route::rule("express","admin/Express/GetExpress");