Преглед изворни кода

售后退货单,退货验收审核节点优化

wufeng пре 2 година
родитељ
комит
71fa56164c
2 измењених фајлова са 36 додато и 12 уклоњено
  1. 34 10
      app/admin/controller/Orderback.php
  2. 2 2
      app/admin/controller/Resigninfo.php

+ 34 - 10
app/admin/controller/Orderback.php

@@ -228,8 +228,16 @@ class Orderback extends Base
           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);
+
+              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];
+              ProcessOrder::AddProcess(['id' => $this->uid, 'nickname' => $this->uname], $process);
               if(empty($errorlist)){
                   Db::commit();
                   return app_show(0,'更新成功');
@@ -373,9 +381,17 @@ 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 ($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" => $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 +440,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 +753,18 @@ 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 ($param['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" => $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, '操作成功');

+ 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,"状态更新失败");