Browse Source

售后退货单流程中退货业务审核节点,要将待办数据推给库管人员和库管-张凯旋两个角色

wufeng 2 years ago
parent
commit
b8ec4c4085
1 changed files with 39 additions and 24 deletions
  1. 39 24
      app/admin/controller/Orderback.php

+ 39 - 24
app/admin/controller/Orderback.php

@@ -227,16 +227,16 @@ 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);
-
-              if($info['status'] == 2){
-                  //特殊处理,写入到10采购负责人、31库管人员、41库管-张凯旋这三个角色下的所有人
-                  $handle_user_list = Db::name('user_role')
-                      ->where('is_del', 0)
-                      ->whereIn('roleid', [10, 31, 41])
-                      ->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)];
-              }else $process=["order_code"=>$info['thNo'],"order_id"=>$info['id'],"order_status"=>$info['status'],'order_type'=>"CKTHD","before_status"=>$str];
+              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();
@@ -288,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")]);
@@ -383,14 +390,19 @@ class Orderback extends Base
                 $stn = ["order_code"=>$thNo,"status"=>$var,"action_remark"=>'',"action_type"=>"edit"];
                 ActionLog::logAdd(['id'=>$this->uid,'nickname'=>$this->uname],$stn,"CKTHD",$info['status'],$this->post);
 
-                if ($status == 2) {
-                    //特殊处理,写入到10采购负责人、31库管人员、41库管-张凯旋这三个角色下的所有人
+                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', [10, 31, 41])
+                        ->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];
+                    $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,'更新成功');
@@ -755,16 +767,19 @@ class Orderback extends Base
                 $stn = ["order_code" => $param['thNo'], "status" => $info['status'], "action_remark" => '', "action_type" => "edit"];
                 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库管-张凯旋这三个角色下的所有人
 
-                if ($param['status'] == 2) {
-                    //特殊处理,写入到10采购负责人、31库管人员、41库管-张凯旋这三个角色下的所有人
                     $handle_user_list = Db::name('user_role')
                         ->where('is_del', 0)
-                        ->whereIn('roleid', [10, 31, 41])
+                        ->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);
+                    $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, '操作成功');