Эх сурвалжийг харах

Merge branch 'master-new-wgg' of wugg/phpstock into master-new

wugg 1 жил өмнө
parent
commit
538bb19056

+ 16 - 139
app/admin/controller/Action.php

@@ -60,50 +60,6 @@ class Action extends BaseController
             ]);
 
         return $rs ? json_show(0, "修改成功") : json_show(0, "修改失败");
-
-//        $post = $this->request->post();
-//        $actionid = isset($post['id']) ? intval($post['id']) : "";
-//        if ($actionid != "") {
-//            $isf = Db::name("action_list")->where("id", "=", $actionid)->find();
-//            if ($isf == false) {
-//                return json_show(1005, "未找到数据");
-//            }
-//        }
-//        $action = isset($post['action_name']) ? trim($post['action_name']) : "";
-//        if ($action == "") {
-//            return json_show(1003, '功能名称不能为空');
-//        }
-//        $desc = isset($post['action_desc']) ? trim($post['action_desc']) : "";
-//        $status = isset($post['status']) ? intval($post['status']) : 0;
-//        $data = [
-//            "action_name" => $action,
-//            "action_desc" => $desc,
-//            "action_code" => "",
-//        ];
-//
-//        $isTrue = Db::name("action_list")->where(["action_name" => $action])->find();
-//        if ($isTrue) {
-//            if ($isTrue['id'] != $actionid || $actionid == "") {
-//                return json_show(1003, '功能名称不能重复');
-//            }
-//        }
-//
-//        try {
-//            $message = "";
-//            if ($actionid == "") {
-//                $data['status'] = $status;
-//                $data['is_show'] = 1;
-//                $message = "新建成功";
-//            } else {
-//                $data['status'] = $status;
-//                $data['id'] = $actionid;
-//                $message = "更新成功";
-//            }
-//            Db::name("action_list")->save($data);
-//            return json_show(0, $message);
-//        } catch (\Exception $e) {
-//            return json_show(1005, $e->getMessage());
-//        }
     }
 
     public function ActionStatus()
@@ -120,104 +76,12 @@ class Action extends BaseController
             $result = Db::name("action")->where("id", "=", $actid)->save($data);
 
             return $result ? json_show(0, "更新成功") : json_show(1004, "更新失败");
-
-//            if ($result) {
-//                return json_show(0, "更新成功");
-//            } else {
-//                return json_show(1004, "更新失败");
-//            }
+            
         } catch (\Exception $e) {
             return json_show(1003, $e->getMessage());
         }
     }
 
-    /*
-     *
-     * public function ActionAdd(){
-     * $post  =$this->request->post();
-     *
-     * $pageid = isset($post['menuid']) ? intval($post['menuid']) : "";
-     * if($pageid==""){
-     * return json_show(1001,'页面id不能为空');
-     * }
-     * $code = isset($post['action_code']) ? trim($post['action_code']) : "";
-     *
-     * $status = isset($post['status']) ? intval($post['status']) : 1;
-     * if($code==""){
-     * return json_show(1002,'功能code不能为空');
-     * }
-     * try{
-     * $where = ['menuid'=>$pageid,'action_code'=>$code];
-     * $true =Db::name("action")->where($where)->find();
-     * $data = ['menuid'=>$pageid,'action_code'=>$code,'status'=>$status,"updatetime"=>date("Y-m-d H:i:s"),"addtime"=>date("Y-m-d H:i:s")];
-     * if($true){
-     * return json_show(1003,'此功能已存在');
-     * }else{
-     * Db::name("action")->insert($data);
-     * return json_show(0,"添加成功");
-     * }
-     * }catch (\Exception $e){
-     * return json_show(1005,$e->getMessage());
-     * }
-     * }
-     *
-     * public function index(){
-     * $post  =$this->request->post();
-     * $data = Db::name("admin_menu")->where(["pid"=>0,"status"=>1,"is_del"=>0])->select();
-     * $result = [];
-     * if(empty($data)){
-     * return json_show(0,"获取成功",$result);
-     * }
-     * foreach ($data as $key=>$val){
-     * $val["child"]=[];
-     * $result[$val['id']] =$val;
-     * }
-     *
-     * $child =Db::name("admin_menu")->where([["pid","<>",0],['status',"=",1],["is_del","=",0]])->select();
-     * foreach ($child as $k=>$value){
-     * // $act = PasAction::all(['menuid'=>$value['id'],"status"=>1]);
-     * $act =Db::name("action")
-     * ->alias("a")
-     * ->leftJoin("action_list l","a.action_code=l.action_code")
-     * ->field("a.*,action_name")
-     * ->where(['a.menuid'=>$value['id'],"a.status"=>1])
-     * ->withAttr('id',function($val){
-     * return (string)$val;
-     * })
-     * ->select()
-     * ->toArray();
-     * $act_data = Db::name("action_field")->where(['menuid'=>$value['id'],"status"=>1])->select();
-     * $value['action'] = $act;
-     * $value['action_data'] = $act_data;
-     * if(array_key_exists($value['pid'],$result)){
-     * $result[$value['pid']]["child"][]=$value;
-     * }
-     * }
-     *
-     * return json_show(0,"获取成功",array_values($result));
-     * }
-     *
-     * public function ActionInfo(){
-     * $post  =$this->request->post();
-     * $token = isset($post['token']) ? trim($post['token']) : "";
-     * if($token==""){
-     * return json_show(101,'token不能为空');
-     * }
-     * $effetc = VerifyTokens($token);
-     * if(!empty($effetc) && $effetc['code']!=0){
-     * return json_show($effetc['code'],$effetc['message']);
-     * }
-     * $id = isset($post['id'])? intval($post['id']) :"";
-     * if($id==""){
-     * return json_show(1002,'功能id不能为空');
-     * }
-     * $menu =  Db::name("action_list")->where("id","=",$id)->find();
-     * if(empty($menu)){
-     * return json_show(1003,"未找到对应的数据");
-     * }
-     * return json_show(0,"获取成功!",$menu);
-     * }
-     * **/
 
     //11获取所有菜单列表数据
     public function index()
@@ -338,7 +202,7 @@ class Action extends BaseController
         if ($action == false) {
             return json_show(1004, "未找到功能数据");
         }
-        $upda = ["is_del" => 0, "updatetime" => date("Y-m-d H:i:s")];
+        $upda = ["is_del" => 1, "updatetime" => date("Y-m-d H:i:s")];
         Db::startTrans();
         try {
             $up = Db::name("action_list")->where($action)->update($upda);
@@ -354,5 +218,18 @@ class Action extends BaseController
             return json_show(1005, $e->getMessage());
         }
     }
-
+    /** 菜单下功能信息状态修改
+     * @return \think\response\Json|void
+     * @throws \think\exception\DbException
+     */
+    public function ActionCreate()
+    {
+        $post = $this->request->param(["action_name"=>"","action_code"=>"","is_del"=>0]);
+        $valid = Validate::rule([
+        	"action_name|功能名称"=>"require",
+            "action_code|功能编号"=>"require|unique:action_list,action_code^is_del"]);
+        if($valid->check($post)==false)return error_show(1004,$valid->getError());
+        $save=Db::name("action_list")->save($post);
+        return  $save? app_show(0,"创建成功"):error_show(1004,"创建失败");
+    }
 }

+ 7 - 7
app/admin/controller/Allot.php

@@ -245,8 +245,8 @@ class Allot extends Base
                 foreach ($dain as $value) {
                     $st = Db::name("good_stock_info")->alias("a")
                      ->leftJoin("good_stock d" ,"d.id=a.stockid")
-                    ->leftJoin("good b" ,"d.spuCode=b.spuCode")
-                        ->where(['wsm_code' => $wsm_out, 'a.bnCode' => $value['bnCode'], 'd.is_del' => 0])
+                    ->leftJoin("good_basic b" ,"d.spuCode=b.spuCode")
+                        ->where(['wsm_code' => $wsm_out, 'a.bnCode' => $value['bnCode'], 'd.is_del' => 0, 'b.status'=> 1])
                         ->field("d.spuCode,wsm_code,d.usable_stock,d.wait_out_stock,d.wait_in_stock,b.good_name,a.total_num,a.balance_num,a.origin_price")
                         ->find();
 
@@ -413,8 +413,8 @@ class Allot extends Base
                 foreach ($dain as $value) {
                     $st = Db::name("good_stock_info")->alias("a")
                      ->leftJoin("good_stock d" ,"d.id=a.stockid")
-                    ->leftJoin("good b" ,"d.spuCode=b.spuCode")
-                        ->where(['wsm_code' => $wsm_out, 'a.bnCode' => $value['bnCode'], 'd.is_del' => 0])
+                    ->leftJoin("good_basic b" ,"d.spuCode=b.spuCode")
+                        ->where(['wsm_code' => $wsm_out, 'a.bnCode' => $value['bnCode'], 'd.is_del' => 0, 'd.is_del' => 0])
                         ->field("d.spuCode,wsm_code,d.usable_stock,d.wait_out_stock,d.wait_in_stock,b.good_name,a.total_num,a.balance_num,a.origin_price")
                         ->find();
                     if (empty($st)) {
@@ -838,7 +838,7 @@ public function vesio(){
     {
         $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;
-        $condtion = [['b.is_del', "=", 0], ['c.is_del', "=", 0],["d.balance_num",">=",0]];
+	    $condtion=[['b.is_del' , '=' , 0] , ['c.is_del' , '=' , 0] , ['d.balance_num' , '>=' , 0] , ['b.status' , '=' , 1]];
         $wsmcode = isset($this->post['wsm_code']) && $this->post['wsm_code'] !== "" ? trim($this->post['wsm_code']) : "";
         if ($wsmcode !== "") {
             //return error_show(1002,"仓库code不能为空");
@@ -890,14 +890,14 @@ public function vesio(){
         $company_name = isset($this->post['company_name']) && $this->post['company_name'] !== "" ? trim($this->post['company_name']) : "";
         if ($company_name !== "") $condtion[] = ["b.createrid", 'in', get_company_item_user_by_name($company_name)];
 
-        $count = Db::name("good")
+        $count = Db::name("good_basic")
             ->alias("b")
             ->join("good_stock c", "c.spuCode=b.spuCode", "left")
             ->join("good_stock_info d", "c.id=d.stockid", "left")
             ->where($condtion)
             ->count();
         $page >= ceil($count / $size) ? $page = ceil($count / $size) : "";
-        $list = Db::name("good")
+        $list = Db::name("good_basic")
             ->alias("b")
             ->leftJoin("good_stock c", "c.spuCode=b.spuCode")
             ->join("good_stock_info d", "c.id=d.stockid", "left")

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

@@ -27,6 +27,8 @@ Route::rule("actionsave", "admin/Action/ActionSave");
 Route::rule("actionstatus", "admin/Action/ActionStatus");
 Route::rule("actioninfo", "admin/Action/ActionInfo");
 Route::rule("actionlist", "admin/Action/ActionList");
+Route::rule("actionlistcreate", "admin/Action/ActionCreate");
+Route::rule("actionlistdel", "admin/Action/ActionDel");
 
 Route::rule('grouplist', 'admin/Group/GroupList');
 Route::rule('groupall', 'admin/Group/GroupAll');