浏览代码

Merge branch 'dev_wf' of wugg/phpstock into version1.5

wufeng 2 年之前
父节点
当前提交
91500b3c5c
共有 3 个文件被更改,包括 58 次插入19 次删除
  1. 53 14
      app/admin/controller/Orderback.php
  2. 3 3
      app/admin/controller/Proorder.php
  3. 2 2
      app/admin/controller/Resigninfo.php

+ 53 - 14
app/admin/controller/Orderback.php

@@ -227,9 +227,17 @@ class Orderback extends Base
           $up=Db::name("order_back")->save($info);
           if($up){
               $stn = ["order_code"=>$info['thNo'],"status"=>$str,"action_remark"=>'',"action_type"=>"edit"];
-              ActionLog::logAdd($this->post['token'],$stn,"CKTHD",$info['status'],$info);
-              $process=["order_code"=>$info['thNo'],"order_id"=>$info['id'],"order_status"=>$info['status'],'order_type'=>"CKTHD","before_status"=>$str];
-              ProcessOrder::AddProcess($this->post['token'],$process);
+              ActionLog::logAdd(['id' => $this->uid, 'nickname' => $this->uname],$stn,"CKTHD",$info['status'],$info);
+
+              if($info['status'] == 2) $roleid = [10, 31, 41];//特殊处理,写入到10采购负责人、31库管人员、41库管-张凯旋这三个角色下的所有人
+              else $roleid = [31,41];//特殊处理,写入到31库管人员、41库管-张凯旋这三个角色下的所有人
+
+              $handle_user_list = Db::name('user_role')
+                  ->where('is_del', 0)
+                  ->whereIn('roleid', $roleid)
+                  ->column('uid');
+              $process = ["order_code" => $info['thNo'], "order_id" => $info['id'], "order_status" => $info['status'], 'order_type' => "CKTHD", "before_status" => $str, 'handle_user_list' => implode(',', $handle_user_list)];
+              ProcessOrder::AddProcess(['id' => $this->uid, 'nickname' => $this->uname], $process);
               if(empty($errorlist)){
                   Db::commit();
                   return app_show(0,'更新成功');
@@ -280,9 +288,16 @@ class Orderback extends Base
           $up=Db::name("order_back")->save($info);
           if($up){
               $stn = ["order_code"=>$thNo,"status"=>$temp,"action_remark"=>'',"action_type"=>"edit"];
-              ActionLog::logAdd($this->post['token'],$stn,"CKTHD",$info['status'],$stn);
-              $process=["order_code"=>$info['thNo'],"order_id"=>$info['id'],"order_status"=>3,"order_type"=>"CKTHD","before_status"=>$temp];
-              ProcessOrder::AddProcess($this->post['token'],$process);
+              ActionLog::logAdd(['id' => $this->uid, 'nickname' => $this->uname], $stn, "CKTHD", $info['status'], $stn);
+
+              //特殊处理,写入到31库管人员、41库管-张凯旋这三个角色下的所有人
+              $handle_user_list = Db::name('user_role')
+                  ->where('is_del', 0)
+                  ->whereIn('roleid', [31, 41])
+                  ->column('uid');
+              $process = ["order_code" => $info['thNo'], "order_id" => $info['id'], "order_status" => 3, "order_type" => "CKTHD", "before_status" => $temp, 'handle_user_list' => implode(',', $handle_user_list)];
+              ProcessOrder::AddProcess(['id' => $this->uid, 'nickname' => $this->uname], $process);
+
               if(empty($errorlist)){
                   $up =Db::name("order_backinfo")->where(["thNo"=>$thNo,"is_del"=>0])->save(["status"=>1,
                       "updatetime"=>date("Y-m-d H:i:s")]);
@@ -373,9 +388,22 @@ class Orderback extends Base
             $up=Db::name("order_back")->save($info);
             if($up){
                 $stn = ["order_code"=>$thNo,"status"=>$var,"action_remark"=>'',"action_type"=>"edit"];
-                ActionLog::logAdd($this->post['token'],$stn,"CKTHD",$info['status'],$this->post);
-                $process=["order_code"=>$info['thNo'],"order_id"=>$info['id'],"order_status"=>$status,"order_type"=>"CKTHD","before_status"=>$var];
-                ProcessOrder::AddProcess($this->post['token'],$process);
+                ActionLog::logAdd(['id'=>$this->uid,'nickname'=>$this->uname],$stn,"CKTHD",$info['status'],$this->post);
+
+                if (in_array($status, [2, 3])) {
+
+                    if ($status == 2) $roleid = [10, 31, 41];//特殊处理,写入到10采购负责人、31库管人员、41库管-张凯旋这三个角色下的所有人
+                    else $roleid = [31, 41];//特殊处理,写入到、31库管人员、41库管-张凯旋这三个角色下的所有人
+
+                    $handle_user_list = Db::name('user_role')
+                        ->where('is_del', 0)
+                        ->whereIn('roleid', $roleid)
+                        ->column('uid');
+                    $process = ["order_code" => $info['thNo'], "order_id" => $info['id'], "order_status" => $status, "order_type" => "CKTHD", "before_status" => $var, 'handle_user_list' => implode(',', $handle_user_list)];
+
+                } else $process = ["order_code" => $info['thNo'], "order_id" => $info['id'], "order_status" => $status, "order_type" => "CKTHD", "before_status" => $var];
+
+                ProcessOrder::AddProcess(['id' => $this->uid, 'nickname' => $this->uname], $process);
                 Db::commit();
                 return app_show(0,'更新成功');
             }
@@ -424,8 +452,7 @@ class Orderback extends Base
                 Db::rollback();
                 return error_show(1004,"未找到售后单数据");
             }
-			$sabebn =Db::name("sale_info")->where([["orderCode",'=',$info['orderCode']],["num",">",0]])->select()
-			->toArray();
+			$sabebn =Db::name("sale_info")->where([["orderCode",'=',$info['orderCode']],["num",">",0]])->select()->toArray();
             if($param['can_sell_num']!=0&& $param['can_sell_wsm']!=''){
                     if($sale['is_stock']==1){ //库存品退回原仓库 备库单释放数量 采购单
                         $param['can_sell_wsm'] = $out['wsm_code'];
@@ -738,9 +765,21 @@ class Orderback extends Base
                 }
 
                 $stn = ["order_code" => $param['thNo'], "status" => $info['status'], "action_remark" => '', "action_type" => "edit"];
-                ActionLog::logAdd($this->post['token'], $stn, "CKTHD",  $param['status'], $stn);
-                $process = ["order_code" => $param['thNo'], "order_id" => $info['id'], "order_status" => $param['status'], "order_type" =>"CKTHD","before_status"=>$info['status']];
-                ProcessOrder::AddProcess($this->post['token'], $process);
+                ActionLog::logAdd(['id'=>$this->uid,'nickname'=>$this->uname], $stn, "CKTHD",  $param['status'], $stn);
+
+                if (in_array($param['status'], [2, 3])) {
+                    if ($param['status'] == 2) $roleid = [10, 31, 41];//特殊处理,写入到10采购负责人、31库管人员、41库管-张凯旋这三个角色下的所有人
+                    else $roleid = [31, 41];//特殊处理,写入到、31库管人员、41库管-张凯旋这三个角色下的所有人
+
+                    $handle_user_list = Db::name('user_role')
+                        ->where('is_del', 0)
+                        ->whereIn('roleid', $roleid)
+                        ->column('uid');
+                    $process = ["order_code" => $param['thNo'], "order_id" => $info['id'], "order_status" => $param['status'], "order_type" => "CKTHD", "before_status" => $info['status'], 'handle_user_list' => implode(',', $handle_user_list)];
+
+                } else $process = ["order_code" => $param['thNo'], "order_id" => $info['id'], "order_status" => $param['status'], "order_type" => "CKTHD", "before_status" => $info['status']];
+
+                ProcessOrder::AddProcess(['id' => $this->uid, 'nickname' => $this->uname], $process);
 
                 Db::commit();
                 return app_show(0, '操作成功');

+ 3 - 3
app/admin/controller/Proorder.php

@@ -27,10 +27,10 @@ class Proorder extends Base
          * if(!empty($role['write'])){
          * $where[]=["a.action_uid","in",$role['write']];
          * }
-         * $count = Db::name('process_order')->alias("a")->leftJoin("workflow b","a.order_type=b.order_type and a.order_code=b.order_code")->where($where)->count();
+         * $count = Db::name('process_order')->alias("a")->leftJoin("workflow b","a.order_id=b.order_id and a.order_code=b.order_code")->where($where)->count();
          * $total = ceil("$count/$size");
          * $page = $page>$total ? $total:$page;
-         * $list = Db::name('process_order')->alias("a")->leftJoin("workflow b","a.order_type=b.order_type and a.order_code=b.order_code")
+         * $list = Db::name('process_order')->alias("a")->leftJoin("workflow b","a.order_id=b.order_id and a.order_code=b.order_code")
          * ->field("b.apply_id,b.apply_name,a.addtime,a.action_uid,a.action_name,a.order_status,a.action_status,a.order_type,a.action_process,a.order_code,a.order_id,a.id")
          * ->where($where)->page($page,$size)->order("a.addtime desc")->select();
          * $data=[];
@@ -99,7 +99,7 @@ class Proorder extends Base
             $list = ProcessWait::alias("a")
                 ->field("b.apply_id,b.apply_name,a.addtime,a.action_uid,a.action_name,a.order_status,a.order_type,a.order_code,a.order_id,a.id,a.order_process_finally order_process")
                 ->whereIn('a.id', array_column($order_types, 'ids'))
-                ->leftJoin("workflow b", "a.order_type=b.order_type and a.order_code=b.order_code")
+                ->leftJoin("workflow b", "a.order_type=b.order_type and a.order_id=b.order_id")
 //                ->page($page, $param['size'])
                 ->order("a.addtime desc")
                 ->select()

+ 2 - 2
app/admin/controller/Resigninfo.php

@@ -255,9 +255,9 @@ class Resigninfo extends Base
         $sv = Db::name('resign_info')->save($st);
         if($sv){
             $stn = ["order_code"=>$id,"status"=>$tn,"action_remark"=>'',"action_type"=>"edit"];
-            ActionLog::logAdd($this->post['token'],$stn,"LZJJ",$stauts,$st);
+            ActionLog::logAdd(['id'=>$this->uid,'nickname'=>$this->uname],$stn,"LZJJ",$stauts,$st);
             $process = ["order_code" => '', "order_id" => $id, "order_status" => $st['status'], "order_type" => 'LZJJ', "before_status" => $tn, 'holder_id' => $this->uid];
-            ProcessOrder::AddProcess($this->post['token'],$process);
+            ProcessOrder::AddProcess(['id'=>$this->uid,'nickname'=>$this->uname],$process);
             return error_show(0,"状态更新成功");
         }else{
             return error_show(1002,"状态更新失败");