wugg 2 years ago
parent
commit
dd133f3e95

+ 10 - 10
app/admin/controller/After.php

@@ -103,7 +103,7 @@ class After extends Base
             $orde = ["order_code"=>$returnCode,"status"=>$in['status'],"action_remark"=>'',"action_type"=>"create"];
             ActionLog::logAdd($this->post['token'],$orde,'SHD',1,$orde);
             if($create>0){
-                    $process=["order_code"=>$returnCode,"order_id"=>$create,"order_status"=>$in['status'],"order_type"=>'SHD'];
+                    $process=["order_code"=>$returnCode,"order_id"=>$create,"order_status"=>$in['status'],"order_type"=>'SHD',"before_status"=>1];
                     ProcessOrder::AddProcess($token,$process);
                     Db::commit();
                     return app_show(0,"售后申请单新建成功",["returnCode"=>$returnCode]);
@@ -324,7 +324,7 @@ class After extends Base
             if($up){
                 $order = ["order_code"=>$info['returnCode'],"status"=>$var,"action_remark"=>'',"action_type"=>"edit"];
                 ActionLog::logAdd($this->post['token'],$order,"SHD", $info['status'],$this->post);
-                $process=["order_code"=>$info['returnCode'],"order_id"=>$info['id'],"order_status"=>$status,"order_type"=>"SHD"];
+                $process=["order_code"=>$info['returnCode'],"order_id"=>$info['id'],"order_status"=>$status,"order_type"=>"SHD","before_status"=>$var];
                 ProcessOrder::AddProcess($this->post['token'],$process);
                 Db::commit();
                 return app_show(0,"更新成功");
@@ -428,7 +428,7 @@ class After extends Base
                         "order_type" => 'SHD',
                         "order_code" => $info['returnCode'],//销售单code
                         "order_id" => $info['id'],
-                        "order_status" => $info['status']
+                        "order_status" => $info['status'],"before_status"=>$old_info_status
                     ]);
 
                     Db::commit();
@@ -544,7 +544,7 @@ class After extends Base
                 if($in){
                     $order = ["order_code"=>$info['returnCode'],"status"=>$var,"action_remark"=>'',"action_type"=>"edit"];
                     ActionLog::logAdd($this->post['token'],$order,"SHD",$info['status'],$this->post);
-                    $process=["order_code"=>$info['returnCode'],"order_id"=>$info['id'],"order_status"=>$info['status'],"order_type"=>"SHD"];
+                    $process=["order_code"=>$info['returnCode'],"order_id"=>$info['id'],"order_status"=>$info['status'],"order_type"=>"SHD","before_status"=>$var];
                     ProcessOrder::AddProcess($this->post['token'],$process);
                     Db::commit();
                     return app_show(0,"更新成功");
@@ -618,7 +618,7 @@ class After extends Base
             if($up){
                 $order = ["order_code"=>$info['orderCode'],"status"=>$str,"action_remark"=>'',"action_type"=>"edit"];
                 ActionLog::logAdd($this->post['token'],$order,"SHD",$info['status'],$this->post);
-                $process=["order_code"=>$info['returnCode'],"order_id"=>$info['id'],"order_status"=>$info['status'],"order_type"=>"SHD"];
+                $process=["order_code"=>$info['returnCode'],"order_id"=>$info['id'],"order_status"=>$info['status'],"order_type"=>"SHD","before_status"=>$str];
                 ProcessOrder::AddProcess($this->post['token'],$process);
                 $in=Db::name("order_returninfo")->save($return_info);
                 if($in){
@@ -649,7 +649,7 @@ class After extends Base
                     if($back>0){
                         $order = ["order_code"=>$data['thNo'],"status"=>0,"action_remark"=>'',"action_type"=>"create"];
                         ActionLog::logAdd($this->post['token'],$order,"CKTHD", 0,$data);
-                        $process=["order_code"=>$data['thNo'],"order_id"=>$back,"order_status"=>0,"order_type"=>"CKTHD"];
+                        $process=["order_code"=>$data['thNo'],"order_id"=>$back,"order_status"=>0,"order_type"=>"CKTHD","before_status"=>0];
                         ProcessOrder::AddProcess($this->post['token'],$process);
                         Db::commit();
                         return app_show(0,"更新成功");
@@ -744,7 +744,7 @@ class After extends Base
                 if($in){
                     $order = ["order_code"=>$info['returnCode'],"status"=>$stat,"action_remark"=>'',"action_type"=>"edit"];
                     ActionLog::logAdd($this->post['token'],$order,"SHD", $info['status'],$this->post);
-                    $process=["order_code"=>$info['returnCode'],"order_id"=>$info['id'],"order_status"=>$info['status'],"SHD"];
+                    $process=["order_code"=>$info['returnCode'],"order_id"=>$info['id'],"order_status"=>$info['status'],"SHD","before_status"=>$stat];
                     ProcessOrder::AddProcess($this->post['token'],$process);
                     Db::commit();
                     return app_show(0,"更新成功");
@@ -904,7 +904,7 @@ class After extends Base
                         "order_type" => 'SHD',
                         "order_code" => $info['returnCode'],//销售单code
                         "order_id" => $info['id'],
-                        "order_status" => $info['status']
+                        "order_status" => $info['status'],"before_status"=>$old_info_status
                     ]);
 
                     $thNo =makeNo("ST");
@@ -954,7 +954,7 @@ class After extends Base
                             "order_type" => 'CKTHD',
                             "order_code" => $thdata['thNo'],//销售单code
                             "order_id" => $sav,
-                            "order_status" => $thdata['status']
+                            "order_status" => $thdata['status'],"before_status"=>1
                         ]);
 
 //                        $out['status']=$info['is_receive']==1&&$info['total_num']>$info['error_num'] ?3:4;
@@ -1001,7 +1001,7 @@ class After extends Base
 
             //记录日志
             ActionLog::logAdd($data['token'], ["order_code" => $data['returnCode'], "status" => $rs['status'], "action_remark" => '', "action_type" => "cancel"], 'SHD', 8, $this->post);
-            ProcessOrder::AddProcess($this->post['token'], ["order_code" => $data['returnCode'], "order_id" => $rs['id'], "order_status" => 8, "order_type" => 'SHD']);
+            ProcessOrder::AddProcess($this->post['token'], ["order_code" => $data['returnCode'], "order_id" => $rs['id'], "order_status" => 8, "order_type" => 'SHD',"before_status"=>$rs['status']]);
 
             //提交
             Db::commit();

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

@@ -228,7 +228,7 @@ class Allot extends Base
                 if ($io) {
                     $order = ["order_code"=>$allot_code,"status"=>$status,"action_remark"=>'',"action_type"=>"create"];
                     ActionLog::logAdd($this->post['token'],$order,"DBD",$status,$this->post);
-                    $process=["order_code"=>$allot_code,"order_id"=>$pd,"order_status"=>$status,"order_type"=>'DBD'];
+                    $process=["order_code"=>$allot_code,"order_id"=>$pd,"order_status"=>$status,"order_type"=>'DBD',"before_status"=>0];
                     ProcessOrder::AddProcess($token,$process);
                     Db::commit();
                     return error_show(0, "调拨创建成功");
@@ -394,8 +394,8 @@ class Allot extends Base
                 }
                 $order = ["order_code"=>$etid['allot_code'],"status"=>$etid['status'],"action_remark"=>'',"action_type"=>"edit"];
                 ActionLog::logAdd($this->post['token'],$order,"DBD",$etid['status'],$this->post);
-                $process=["order_code"=>$etid['allot_code'],"order_id"=>$etid['id'],"order_status"=>$etid['status'],"order_type"=>'DBD'];
-                ProcessOrder::AddProcess($token,$process);
+//                $process=["order_code"=>$etid['allot_code'],"order_id"=>$etid['id'],"order_status"=>$etid['status'],"order_type"=>'DBD',"before_status"=>1];
+//                ProcessOrder::AddProcess($token,$process);
                 Db::commit();
                 return error_show(0, "调拨更新成功");
             }
@@ -477,7 +477,7 @@ class Allot extends Base
                 }
                 $order = ["order_code"=>$st['allot_code'],"status"=>$sr,"action_remark"=>'',"action_type"=>"status"];
                 ActionLog::logAdd($this->post['token'],$order,"DBD",$status,$this->post);
-                $process=["order_code"=>$st['allot_code'],"order_id"=>$st['id'],"order_status"=>$st['status'],"order_type"=>'DBD'];
+                $process=["order_code"=>$st['allot_code'],"order_id"=>$st['id'],"order_status"=>$st['status'],"order_type"=>'DBD',"before_status"=>$sr];
                 ProcessOrder::AddProcess($this->post['token'],$process);
                 Db::commit();
                 return error_show(0,"状态更新成功");
@@ -550,7 +550,7 @@ class Allot extends Base
                 }
                 $order = ["order_code"=>$al['allot_code'],"status"=>$al['status'],"action_remark"=>'',"action_type"=>"edit"];
                 ActionLog::logAdd($this->post['token'],$order,"DBD",3,$this->post);
-                $process=["order_code"=>$allot_code,"order_id"=>$al['id'],"order_status"=>3,"order_type"=>'DBD'];
+                $process=["order_code"=>$allot_code,"order_id"=>$al['id'],"order_status"=>3,"order_type"=>'DBD',"before_status"=>$al['status']];
                 ProcessOrder::AddProcess($this->post['token'],$process);
                 Db::commit();
                 return error_show(0,"发货更新成功");
@@ -659,7 +659,7 @@ class Allot extends Base
             GoodLog::LogAdd($this->post['token'],$good_data,'DBD');
             $order = ["order_code"=>$al['allot_code'],"status"=>$al['status'],"action_remark"=>'',"action_type"=>"edit"];
             ActionLog::logAdd($this->post['token'],$order,"DBD",4,$this->post);
-            $process=["order_code"=>$allot_code,"order_id"=>$al['id'],"order_status"=>4,"order_type"=>'DBD'];
+            $process=["order_code"=>$allot_code,"order_id"=>$al['id'],"order_status"=>4,"order_type"=>'DBD',"before_status"=>$al['status']];
             ProcessOrder::AddProcess($this->post['token'],$process);
             Db::commit();
             return error_show(0, "入库验货更新成功");
@@ -742,7 +742,7 @@ public function vesio(){
                 $good_data[] = ['good_log_code' => $allot_code, "stock_id" => $stock['id'], "type" => 1, 'stock' => $p['stock_num'], "stock_name" => "usable_stock"];
             }
             GoodLog::LogAdd($this->post['token'],$good_data,'DBD');
-            $process=["order_code"=>$allot_code,"order_id"=>$al['id'],"order_status"=>5,"order_type"=>'DBD'];
+            $process=["order_code"=>$allot_code,"order_id"=>$al['id'],"order_status"=>5,"order_type"=>'DBD',"before_status"=>$al['status']];
             ProcessOrder::AddProcess($this->post['token'],$process);
             Db::commit();
             return error_show(0, "验货更新成功");

+ 4 - 3
app/admin/controller/Check.php

@@ -313,7 +313,7 @@ public function create(){
         if($da){
             $orde = ["order_code"=>$check_code,"status"=>$data['status'],"action_remark"=>'',"action_type"=>"create"];
             ActionLog::logAdd($this->post['token'],$orde,'PDD',$data['status'],$orde);
-            $process=["order_code"=>$check_code,"order_id"=>$da,"order_status"=>$data['status'],"order_type"=>'PDD'];
+            $process=["order_code"=>$check_code,"order_id"=>$da,"order_status"=>$data['status'],"order_type"=>'PDD',"before_status"=>$data['status']];
             ProcessOrder::AddProcess($this->post['token'],$process);
            Db::commit();
             return error_show(0,"盘点创建成功");
@@ -512,7 +512,8 @@ public function edit()
                         return error_show(1003,"未上传盘点结果");
                     }
                 }
-                $process=["order_code"=>$st['check_code'],"order_id"=>$st['id'],"order_status"=>$stauts,"order_type"=>'PDD'];
+                $process=["order_code"=>$st['check_code'],"order_id"=>$st['id'],"order_status"=>$stauts,
+                    "order_type"=>'PDD',"before_status"=>$temp];
                 ProcessOrder::AddProcess($this->post['token'],$process);
                 Db::commit();
                 return error_show(0,"状态更新成功");
@@ -618,7 +619,7 @@ public function edit()
                 if($check_up){
                     $orde = ["order_code"=>$fo['check_code'],$fo['status'],"action_remark"=>'',"action_type"=>"edit"];
                     ActionLog::logAdd($this->post['token'],$orde,'PDD',2,["status"=>2,"updatetime"=>date("Y-m-d H:i:s")]);
-                    $process=["order_code"=>$fo['check_code'],"order_id"=>$fo['id'],"order_status"=>2,"order_type"=>'PDD'];
+                    $process=["order_code"=>$fo['check_code'],"order_id"=>$fo['id'],"order_status"=>2,"order_type"=>'PDD',"before_status"=>$fo['status']];
                     ProcessOrder::AddProcess($this->post['token'],$process);
                     Db::commit();
                     return app_show(0,"盘点数据导入成功");

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

@@ -862,7 +862,7 @@ class Consult extends Base
                                                 "order_type" => 'PRO',
                                                 "order_code" => $projetc['projectNo'],
                                                 "order_id" => $projetc['id'],
-                                                "order_status" => 2
+                                                "order_status" => 2,"before_status"=>1
                                             ]);
                                         }
                                     }
@@ -1170,7 +1170,7 @@ class Consult extends Base
                                         "order_type" => 'PRO',
                                         "order_code" => $projectinfo['projectNo'],
                                         "order_id" => $project_id,
-                                        "order_status" => 2
+                                        "order_status" => 2,"before_status"=>1
                                     ]);
                                 }
 
@@ -1291,7 +1291,7 @@ class Consult extends Base
                     "order_type" => 'YJD',
                     "order_code" => $bargainNo,
                     "order_id" =>Db::name("bargain_order")->getLastInsID(),
-                    "order_status" =>0
+                    "order_status" =>0,"before_status"=>0
                 ]);
                 $odlstatus=$info['status'];
                 $info['status']=3;

+ 9 - 9
app/admin/controller/Goodup.php

@@ -495,7 +495,7 @@ class Goodup extends Base
                             "order_type" => 'SPCB',
                             "order_code" => $spucode,//咨询单详情编号
                             "order_id" => Db::name("good_basic")->getLastInsID(),
-                            "order_status" =>0
+                            "order_status" =>0,"before_status"=>0
                         ]);
                     Db::commit();
                     return app_show(0,"创建成功",["spuCode"=>$spucode]);
@@ -747,7 +747,7 @@ class Goodup extends Base
                     "order_type" => 'SPCB',
                     "order_code" => $supcode,//咨询单详情编号
                     "order_id" => $data['id'],
-                    "order_status" =>$temp['status']
+                    "order_status" =>$temp['status'],"before_status"=>$data['status']
                 ]);
                 Db::commit();
                 return app_show(0,"更新成功");
@@ -836,7 +836,7 @@ class Goodup extends Base
                     "order_type" => 'SPCB',
                     "order_code" => $supcode,//咨询单详情编号
                     "order_id" => $datas['id'],
-                    "order_status" =>$data['status']
+                    "order_status" =>$data['status'],"before_status"=>$datas['status']
                 ]);
                 $online =  Db::name("good_platform")->where(["spuCode"=>$supcode,"is_del"=>0])->find();
                 if($online){
@@ -858,7 +858,7 @@ class Goodup extends Base
                         "order_type" => 'SPSX',
                         "order_code" => $online['skuCode'],//咨询单详情编号
                         "order_id" => $online['id'],
-                        "order_status" =>2
+                        "order_status" =>2,"before_status"=>$online['exam_status']
                     ]);
                 }
                 if($good_ladder!=="" && !empty($good_ladder)){
@@ -967,7 +967,7 @@ class Goodup extends Base
                         "order_type" => 'SPSX',
                         "order_code" =>$online['skuCode'],//咨询单详情编号
                         "order_id" => $online['id'],
-                        "order_status" => 2
+                        "order_status" => 2,"before_status"=>$online['exam_status']
                     ]);
                 }
             }
@@ -995,7 +995,7 @@ class Goodup extends Base
                     "order_type" => 'SPCB',
                     "order_code" => $supcode,//咨询单详情编号
                     "order_id" => $data['id'],
-                    "order_status" =>$data['status']
+                    "order_status" =>$data['status'],"before_status"=>$status
                 ]);
                 $data=[
                     "code"=>$supcode,
@@ -1216,7 +1216,7 @@ class Goodup extends Base
                         "order_type" => 'SPSX',
                         "order_code" =>$skuCode,//咨询单详情编号
                         "order_id" => $create,
-                        "order_status" =>$tmp['exam_status']
+                        "order_status" =>$tmp['exam_status'],"before_status"=>$temp['exam_status']
                     ]);
                     $iso = Db::name("good")->where(["spuCode"=>$value['spuCode'],"is_del"=>0])->find();
                     if($iso==false){
@@ -1371,7 +1371,7 @@ class Goodup extends Base
                         "order_type" => 'SPSX',
                         "order_code" => $skuCode,//咨询单详情编号
                         "order_id" => $platform['id'],
-                        "order_status" => $exam_status,
+                        "order_status" => $exam_status,"before_status"=>$bifore
                     ]);
 
                     Db::commit();
@@ -1461,7 +1461,7 @@ class Goodup extends Base
                     "order_type" => 'SPSX',
                     "order_code" =>$platform['skuCode'],//咨询单详情编号
                     "order_id" => $platform['id'],
-                    "order_status" => $platform['exam_status']
+                    "order_status" => $platform['exam_status'],"before_status"=>$bifore
                 ]);
                 $proof=[
                     'spuCode'=>$platform['spuCode'],

+ 4 - 4
app/admin/controller/Orderback.php

@@ -223,7 +223,7 @@ 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'],"CKTHD"];
+              $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(empty($errorlist)){
                   Db::commit();
@@ -276,7 +276,7 @@ class Orderback extends Base
           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"];
+              $process=["order_code"=>$info['thNo'],"order_id"=>$info['id'],"order_status"=>3,"order_type"=>"CKTHD","before_status"=>$temp];
               ProcessOrder::AddProcess($this->post['token'],$process);
               if(empty($errorlist)){
                   $up =Db::name("order_backinfo")->where(["thNo"=>$thNo,"is_del"=>0])->save(["status"=>1,
@@ -369,7 +369,7 @@ class Orderback extends Base
             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"];
+                $process=["order_code"=>$info['thNo'],"order_id"=>$info['id'],"order_status"=>$status,"order_type"=>"CKTHD","before_status"=>$var];
                 ProcessOrder::AddProcess($this->post['token'],$process);
                 Db::commit();
                 return app_show(0,'更新成功');
@@ -621,7 +621,7 @@ class Orderback extends Base
             if ($res) {
                 $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"];
+                $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);
 
                 Db::commit();

+ 6 - 6
app/admin/controller/Project.php

@@ -130,7 +130,7 @@ class Project extends Base
                             "action_remark" => '',//备注
                             "action_type" => "create"//新建create,编辑edit,更改状态status
                         ], "PRO", 1, $this->post);
-                        $process = ["order_code" => $projectNo, "order_id" => Db::name("project")->getLastInsID(), "order_status" =>1, "order_type" =>"PRO"];
+                        $process = ["order_code" => $projectNo, "order_id" => Db::name("project")->getLastInsID(), "order_status" =>1, "order_type" =>"PRO","before_status"=>1];
                         ProcessOrder::AddProcess($this->post['token'], $process);
                         Db::commit();
                         return app_show(0,"项目新建成功",['projectNo'=>$projectNo]);
@@ -259,7 +259,7 @@ class Project extends Base
                                 "order_type"=>'PRO',
                                 "order_code"=>$projectinfo['projectNo'],
                                 "order_id"=>$project['id'],//这里更新是根据编码更新的,没有主键id
-                                "order_status"=>2
+                                "order_status"=>2,"before_status"=>1
                             ]);
 
                             Db::commit();
@@ -637,7 +637,7 @@ class Project extends Base
                             "order_type" => 'PRO',
                             "order_code" => $projectNo,
                             "order_id" => $info['id'],
-                            "order_status" => 4
+                            "order_status" => 4,"before_status"=>$old_project_status
                         ]);
                         Db::commit();
                         return app_show(0,"方案制作成功",["planNo"=>$planNo]);
@@ -815,7 +815,7 @@ class Project extends Base
                                     "order_type" => 'PRO',
                                     "order_code" =>$value['projectNo'],
                                     "order_id" => $poject['id'],
-                                    "order_status" => 3
+                                    "order_status" => 3,"before_status"=>$poject['status']
                                 ]);
                             }
                         }
@@ -888,7 +888,7 @@ class Project extends Base
                             "order_type" => 'PRO',
                             "order_code" =>$value,
                             "order_id" => $poject['id'],
-                            "order_status" => 5
+                            "order_status" => 5,"before_status"=>4
                         ]);
                     }
 
@@ -932,7 +932,7 @@ class Project extends Base
                 "action_type" => "edit"//新建create,编辑edit更改状态status
             ], "PRT", 1, $info);
 
-            $process = ["order_code" => $projectNo, "order_id" => $info['id'], "order_status" =>1, "order_type" => 'PRT'];//order_status==7修改毛利率
+            $process = ["order_code" => $projectNo, "order_id" => $info['id'], "order_status" =>1, "order_type" => 'PRT',"before_status"=>1];//order_status==7修改毛利率
             ProcessOrder::AddProcess($this->post['token'], $process);
 
             return app_show(0,"利润率修改成功");

+ 6 - 6
app/admin/controller/Purch.php

@@ -391,12 +391,12 @@ class Purch extends Base
             //修改状态,添加待办
             ActionLog::logAdd($this->post['token'], $order, "CGD", $data['status'], $this->post);
 
-            ProcessOrder::AddProcess($this->post['token'], [
-                "order_type" => 'CGD',
-                "order_code" => $cgdNo,//销售单code
-                "order_id" => $data['id'],
-                "order_status" => $data['status']
-            ]);
+//            ProcessOrder::AddProcess($this->post['token'], [
+//                "order_type" => 'CGD',
+//                "order_code" => $cgdNo,//销售单code
+//                "order_id" => $data['id'],
+//                "order_status" => $data['status'],"before_status"=>1
+//            ]);
 
 
             return app_show(0,"更新成功");

+ 19 - 15
app/admin/controller/Purchin.php

@@ -231,7 +231,7 @@ class Purchin extends Base
             if($win){
                 $sto = ["order_code"=>$wsm_in_code,"status"=>$status,"action_remark"=>'',"action_type"=>"edit"];
                 ActionLog::logAdd($this->post['token'],$sto,"RKD",$status,$this->post);
-                $process=["order_code"=>$wsm_in_code,"order_id"=>$win,"order_status"=>$status,"order_type"=>'RKD'];
+                $process=["order_code"=>$wsm_in_code,"order_id"=>$win,"order_status"=>$status,"order_type"=>'RKD',"before_status"=>$status];
                 ProcessOrder::AddProcess($this->post['token'],$process);
                 $order = ["order_code"=>$cgdNo,"status"=>$cgdinfo['status'],"action_remark"=>'',"action_type"=>"edit"];
                 if($status==1){
@@ -255,9 +255,11 @@ class Purchin extends Base
                                     "addtime"=>date("Y-m-d H:i:s"),
                                     "updatetime"=>date("Y-m-d H:i:s"),
                                 ];
-                                $order = ["order_code"=>$good['spuCode'],"status"=>1,"action_remark"=>'', "action_type"=>"create"];
+                              //  $order = ["order_code"=>$good['spuCode'],"status"=>1,"action_remark"=>'',
+                                // "action_type"=>"create"];
                             }else{
-                                $order = ["order_code"=>$good['spuCode'],"status"=>1,"action_remark"=>'', "action_type"=>"edit"];
+                              //  $order = ["order_code"=>$good['spuCode'],"status"=>1,"action_remark"=>'',
+                                // "action_type"=>"edit"];
                             }
                             $good['wait_in_stock']+=$send_num;
                             $good['updatetime'] = date("Y-m-d H:i:s");
@@ -272,7 +274,7 @@ class Purchin extends Base
 
 
                             ActionLog::logAdd($this->post['token'],$order,"CGD", $cgdinfo['status'],$cgdinfo);
-                            $process=["order_code"=>$cgdNo,"order_id"=>$cgdinfo['id'],"order_status"=>$cgdinfo['status'],"order_type"=>'CGD'];
+                            $process=["order_code"=>$cgdNo,"order_id"=>$cgdinfo['id'],"order_status"=>$cgdinfo['status'],"order_type"=>'CGD',"before_status"=>$order['status']];
                             ProcessOrder::AddProcess($this->post['token'],$process);
                             Db::commit();
                             return app_show(0,'新建成功',["wsm_in_code"=>$wsm_in_code]);
@@ -304,9 +306,11 @@ class Purchin extends Base
                             "addtime"=>date("Y-m-d H:i:s"),
                             "updatetime"=>date("Y-m-d H:i:s"),
                         ];
-                        $order = ["order_code"=>$good['spuCode'],"status"=>1,"action_remark"=>'', "action_type"=>"create"];
+                     //   $order = ["order_code"=>$good['spuCode'],"status"=>1,"action_remark"=>'',
+                        // "action_type"=>"create"];
                     }else{
-                        $order = ["order_code"=>$good['spuCode'],"status"=>1,"action_remark"=>'', "action_type"=>"edit"];
+                     //   $order = ["order_code"=>$good['spuCode'],"status"=>1,"action_remark"=>'',
+                        // "action_type"=>"edit"];
                     }
                     $good['wait_in_stock']-=$send_num;
                     $good['usable_stock']+=$send_num;
@@ -368,7 +372,7 @@ class Purchin extends Base
                                                 "order_type" => 'CKD',
                                                 "order_code" => $v_outCode['outCode'],//出库单号
                                                 "order_id" => $v_outCode['id'],
-                                                "order_status" => 1
+                                                "order_status" => 1,"before_status"=>0
                                             ]);
                                         }
                                     }
@@ -403,7 +407,7 @@ class Purchin extends Base
                             }
                         }
                         ActionLog::logAdd($this->post['token'],$order,"CGD", $cgdinfo['status'],$cgdinfo);
-                        $process=["order_code"=>$cgdNo,"order_id"=>$cgdinfo['id'],"order_status"=>$cgdinfo['status'],"order_type"=>'CGD'];
+                        $process=["order_code"=>$cgdNo,"order_id"=>$cgdinfo['id'],"order_status"=>$cgdinfo['status'],"order_type"=>'CGD',"before_status"=>$order['status']];
                         ProcessOrder::AddProcess($this->post['token'],$process);
                         Db::commit();
                         return app_show(0,'商品入库成功',["wsm_in_code"=>$wsm_in_code]);
@@ -529,7 +533,7 @@ class Purchin extends Base
             $up =Db::name("purchease_in")->save($info);
             if($up){
                 ActionLog::logAdd($this->post['token'],$order,"RKD",2,$this->post);
-                $process=["order_code"=>$info['wsm_in_code'],"order_id"=>$info['id'],"order_status"=>$info['status'],"order_type"=>'RKD'];
+                $process=["order_code"=>$info['wsm_in_code'],"order_id"=>$info['id'],"order_status"=>$info['status'],"order_type"=>'RKD',"before_status"=>$order['status']];
                 ProcessOrder::AddProcess($this->post['token'],$process);
                 if(!empty($error_list)){
                     $data=[];
@@ -591,7 +595,7 @@ class Purchin extends Base
             $update = Db::name("purchease_in")->save($info);
             if($update){
                 ActionLog::logAdd($this->post['token'],$order,"RKD",$status,$this->post);
-                $process=["order_code"=>$info['wsm_in_code'],"order_id"=>$info['id'],"order_status"=>$status,"order_type"=>'RKD'];
+                $process=["order_code"=>$info['wsm_in_code'],"order_id"=>$info['id'],"order_status"=>$status,"order_type"=>'RKD',"before_status"=>$order['status']];
                 ProcessOrder::AddProcess($this->post['token'],$process);
                 if($status==0){
                     $cgdinfo=Db::name("purchease_order")->where(['cgdNo'=>$info['cgdNo'],"is_del"=>0])->find();
@@ -608,7 +612,7 @@ class Purchin extends Base
                     $up=Db::name("purchease_order")->save($cgdinfo);
                     if($up){
                         ActionLog::logAdd($this->post['token'],$order,"CGD", $cgdinfo['status'],$cgdinfo);
-                        $process=["order_code"=>$info['cgdNo'],"order_id"=>$cgdinfo['id'],"order_status"=>$cgdinfo['status'],"order_type"=>'CGD'];
+                        $process=["order_code"=>$info['cgdNo'],"order_id"=>$cgdinfo['id'],"order_status"=>$cgdinfo['status'],"order_type"=>'CGD',"before_status"=>$order['status']];
                         ProcessOrder::AddProcess($this->post['token'],$process);
                         Db::commit();
                         return app_show(0,'取消成功');
@@ -632,7 +636,7 @@ class Purchin extends Base
                     $up=Db::name("purchease_order")->save($cgdinfo);
                     if($up){
                         ActionLog::logAdd($this->post['token'],$order,"CGD", $cgdinfo['status'],$cgdinfo);
-                        $process=["order_code"=>$info['cgdNo'],"order_id"=>$cgdinfo['id'],"order_status"=>$cgdinfo['status'],"order_type"=>'CGD'];
+                        $process=["order_code"=>$info['cgdNo'],"order_id"=>$cgdinfo['id'],"order_status"=>$cgdinfo['status'],"order_type"=>'CGD',"before_status"=>$order['status']];
                         ProcessOrder::AddProcess($this->post['token'],$process);
                         Db::commit();
                         return app_show(0,'发货成功');
@@ -814,7 +818,7 @@ class Purchin extends Base
 
             }
             ActionLog::logAdd($this->post['token'],$sto,"RKD", $info['status'],$this->post);
-            $process=["order_code"=>$info['wsm_in_code'],"order_id"=>$info['id'],"order_status"=>$info['status'],"order_type"=>'RKD'];
+            $process=["order_code"=>$info['wsm_in_code'],"order_id"=>$info['id'],"order_status"=>$info['status'],"order_type"=>'RKD',"before_status"=>$sto['status']];
             ProcessOrder::AddProcess($this->post['token'],$process);
 
             //需要在详情页把相关退货记录原样取出来,所以这里把if去掉,所有记录都入purchease_return表
@@ -905,7 +909,7 @@ class Purchin extends Base
                 if($sa){
                     $stn = ["order_code"=>$info['wsm_in_code'],"status"=>$ark,"action_remark"=>'',"action_type"=>"edit"];
                     ActionLog::logAdd($this->post['token'],$stn,"RKD",6,$info);
-                    $process=["order_code"=>$info['wsm_in_code'],"order_id"=>$info['id'],"order_status"=>6,"order_type"=>'RKD'];
+                    $process=["order_code"=>$info['wsm_in_code'],"order_id"=>$info['id'],"order_status"=>6,"order_type"=>'RKD',"before_status"=>$stn['status']];
                     ProcessOrder::AddProcess($this->post['token'],$process);
                     if($info['status']==6){
                         $good = Db::name("good_stock")->where(["wsm_code"=>$info['wsm_code'], "spuCode"=>$cgdinfo['spuCode'],"is_del"=>0])->find();
@@ -977,7 +981,7 @@ class Purchin extends Base
                         return error_show(1004,"采购单数量更新失败");
                     }
                     ActionLog::logAdd($this->post['token'],$order,"CGD", $cgdinfo['status'],$cgdinfo);
-                    $process=["order_code"=>$cgdinfo['cgdNo'],"order_id"=>$cgdinfo['id'],"order_status"=>$cgdinfo['status'],"order_type"=>'CGD'];
+                    $process=["order_code"=>$cgdinfo['cgdNo'],"order_id"=>$cgdinfo['id'],"order_status"=>$cgdinfo['status'],"order_type"=>'CGD',"before_status"=>$order['status']];
                     ProcessOrder::AddProcess($this->post['token'],$process);
                     Db::commit();
                     return  app_show(0,"退货发货成功");

+ 10 - 8
app/admin/controller/Resign.php

@@ -180,7 +180,7 @@ class Resign extends Base
         ];
         $in = Db::name("purchease")->insert($info,true);
         if($in>0){
-            $order=["order_type"=>'BHD',"order_code"=>$bk_code,"order_id"=>$in,"order_status"=>1];
+            $order=["order_type"=>'BHD',"order_code"=>$bk_code,"order_id"=>$in,"order_status"=>1,"before_status"=>1];
             ProcessOrder::AddProcess($token,$order);
             $ste = ["order_code"=>$bk_code,"status"=>0,"action_remark"=>'',"action_type"=>"create"];
             ActionLog::logAdd($token,$ste,"BHD",1,$info);
@@ -226,7 +226,7 @@ class Resign extends Base
         unset($info['id']);
         $in = Db::name("purchease")->insert($info,true);
         if($in>0){
-            $order=["order_type"=>'BHD',"order_code"=>$bk_code,"order_id"=>$in,"order_status"=>1];
+            $order=["order_type"=>'BHD',"order_code"=>$bk_code,"order_id"=>$in,"order_status"=>1,"before_status"=>1];
             ProcessOrder::AddProcess($this->post['token'],$order);
             $ste = ["order_code"=>$bk_code,"status"=>0,"action_remark"=>'',"action_type"=>"create"];
             ActionLog::logAdd($this->post['token'],$ste,"BHD",1,$info);
@@ -338,7 +338,7 @@ class Resign extends Base
         ];
         $in = Db::name("purchease")->where($info)->save($up);
         if($in){
-            $order=["order_type"=>'BHD',"order_code"=>$info['bk_code'],"order_id"=>$info['id'],"order_status"=>$info['status']];
+            $order=["order_type"=>'BHD',"order_code"=>$info['bk_code'],"order_id"=>$info['id'],"order_status"=>$info['status'],"before_status"=>1];
             ProcessOrder::AddProcess($this->post['token'],$order);
             $ste = ["order_code"=>$info['bk_code'],"status"=>$info['status'],"action_remark"=>'',"action_type"=>"edit"];
             ActionLog::logAdd($this->post['token'],$ste,"BHD",$info['status'],$up);
@@ -387,7 +387,8 @@ class Resign extends Base
         $info['updatetime']=date("Y-m-d H:i:s");
         $up = Db::name("purchease")->update($info);
         if($up){
-            $order=["order_type"=>'BHD',"order_code"=>$info['bk_code'],"order_id"=>$info['id'],"order_status"=>$status];
+            $order=["order_type"=>'BHD',"order_code"=>$info['bk_code'],"order_id"=>$info['id'],
+                "order_status"=>$status,"before_status"=>$temp];
             ProcessOrder::AddProcess($this->post['token'],$order);
             $ste = ["order_code"=>$info['bk_code'],"status"=> $temp,"action_remark"=>'',"action_type"=>"status"];
             ActionLog::logAdd($this->post['token'],$ste,"BHD",$status,$info);
@@ -502,7 +503,7 @@ class Resign extends Base
                 $info['addtime']=date("Y-m-d H:i:s");
                 $ood=Db::name('purchease')->save($info);
                 if($ood){
-                    $order=["order_type"=>'BHD',"order_code"=>$info['bk_code'],"order_id"=>$info['id'], "order_status"=>$info['status']];
+                    $order=["order_type"=>'BHD',"order_code"=>$info['bk_code'],"order_id"=>$info['id'], "order_status"=>$info['status'],"before_status"=>$temp];
                     ProcessOrder::AddProcess($this->post['token'],$order);
                     $ste = ["order_code"=>$info['bk_code'],"status"=>$temp,"action_remark"=>'',"action_type"=>"status"];
                     ActionLog::logAdd($this->post['token'],$ste,"BHD",$info['status'],$info);
@@ -731,7 +732,7 @@ class Resign extends Base
                 "order_type" => 'BHD',
                 "order_code" => $info['bk_code'],//销售单code
                 "order_id" => $info['id'],
-                "order_status" => $info['status']
+                "order_status" => $info['status'],"before_status"=>$old_info_status
             ]);
 
             return app_show(0,"备库单仓库选择成功");
@@ -835,9 +836,10 @@ class Resign extends Base
                         'stock' => $info['good_num'], "stock_name" => "wait_in_stock"];
                     if ($upd) {
                    // 商品变动日志表,good_log_code字段存储采购单号
+                        $order = ["order_code" =>  $cgdCode, "status" => 0, "action_remark" => '', "action_type" => "create"];
                         GoodLog::LogAdd($this->post['token'], $good_data, 'CGD');
                         ActionLog::logAdd($this->post['token'], $order, "CGD", 0, $good);
-                        $process = ["order_code" => $cgdCode, "order_id" => Db::name("purchease_order")->getLastInsID(), "order_status" => $cg['status'], "order_type" => 'CGD'];
+                        $process = ["order_code" => $cgdCode, "order_id" => Db::name("purchease_order")->getLastInsID(), "order_status" => $cg['status'], "order_type" => 'CGD',"before_status"=>0];
                         ProcessOrder::AddProcess($this->post['token'], $process);
                         $info['wsm_code'] = $wsm_code;
                         $old_info_status = $info['status'];
@@ -858,7 +860,7 @@ class Resign extends Base
                                 "order_type" => 'BHD',
                                 "order_code" => $info['bk_code'],//销售单code
                                 "order_id" => $info['id'],
-                                "order_status" => $info['status']
+                                "order_status" => $info['status'],"before_status"=> $old_info_status
                             ]);
 
                             Db::commit();

+ 30 - 28
app/admin/controller/Sale.php

@@ -116,7 +116,7 @@ class Sale extends Base
 
                 //$saleprice(最终售价) = (打样费/购买数量 + 开模费/购买数量 + 商品重量* 最新金价 + 工艺费* 商品重量+包装费+加标费+证书费+产品裸价+物流费)/(1-成本售价/100);
                 $sale_price = $ct['demo_fee'] / $good_num + $ct['open_fee'] / $good_num + $ct['noble_weight'] * $gold["price"] + $good['cost_fee'] * $ct['noble_weight'] + $origin['package_fee'] + $origin['mark_fee'] + $origin['cert_fee'] + $origin['nake_fee'] + $origin['delivery_fee'];
-
+                $ct['cgd_gold_price']=$gold["price"];
 //                $order_rate = Db::name("cat")->where(["id" => $ct['cat_id']])->value('order_rate');
 //                $budget = isset($order_rate) ? $order_rate / 100 : 0;
 
@@ -238,7 +238,7 @@ class Sale extends Base
                     "order_type" => 'XSQRD',
                     "order_code" => $orderCode,//销售单code
                     "order_id" => $datainfo,
-                    "order_status" =>0
+                    "order_status" =>0,"before_status"=>0
                 ]);
 
                 if($is_activity==1){
@@ -378,7 +378,7 @@ class Sale extends Base
                                             "order_type" => 'CKD',
                                             "order_code" => $outCode,//出库单号
                                             "order_id" => Db::name("order_out")->getLastInsID(),
-                                            "order_status" => $out['status']
+                                            "order_status" => $out['status'],"before_status"=> $out['status']
                                         ]);
                                     }
                              //   }
@@ -490,7 +490,7 @@ class Sale extends Base
                 "order_type" => 'CGD',
                 "order_code" => $cg['cgdNo'],//销售单code
                 "order_id" => $up,
-                "order_status" => $cg['status']
+                "order_status" => $cg['status'],"before_status"=> 0
             ]);
 
             $rela=[
@@ -670,8 +670,8 @@ class Sale extends Base
                             ProcessOrder::AddProcess($this->post['token'], [
                                 "order_type" => 'CKD',
                                 "order_code" => $outCode,//出库单号
-                                "order_id" => 0,
-                                "order_status" => 0
+                                "order_id" => Db::name("order_out")->getLastInsID(),
+                                "order_status" => 0,"before_status"=> 0
                             ]);
                         }
 
@@ -880,7 +880,7 @@ class Sale extends Base
                     "order_type" => 'XSQRD',
                     "order_code" => $orderCode,//销售单code
                     "order_id" => $datainfo,
-                    "order_status" => $data['status']
+                    "order_status" => $data['status'],"before_status"=> 0
                 ]);
                     $old_zx_status = $zx['status'];
                     $zx['status']=5;
@@ -1016,7 +1016,7 @@ class Sale extends Base
                                         "order_type" => 'CKD',
                                         "order_code" => $outCode,//出库单号
                                         "order_id" => Db::name("order_out")->getLastInsID(),
-                                        "order_status" => 0
+                                        "order_status" => 0,"before_status"=> 0
                                     ]);
                                 }
                                 $order['send_num']+=$value['receipt_quantity'];
@@ -1212,7 +1212,7 @@ class Sale extends Base
                     "order_type" => 'PRO',
                     "order_code" => $project['projectNo'],
                     "order_id" => $project['id'],
-                    "order_status" => 6
+                    "order_status" => 6,"before_status"=> $old_project_status
                 ]);
             }
             //修改状态,添加待办,只记录动作
@@ -1222,7 +1222,7 @@ class Sale extends Base
                 "action_remark" => '',//备注
                 "action_type" => "create"//新建create,编辑edit,更改状态status
             ], "PRT", 2, $this->post);
-            $process = ["order_code" => $project['projectNo'], "order_id" => $project['id'], "order_status" =>2, "order_type" =>"PRT"];
+            $process = ["order_code" => $project['projectNo'], "order_id" => $project['id'], "order_status" =>2, "order_type" =>"PRT","before_status"=> 1];
             ProcessOrder::AddProcess($this->post['token'], $process);
             Db::commit();
             return app_show(0, "咨询订单生成成功");
@@ -1325,7 +1325,7 @@ class Sale extends Base
                 "order_type" => 'XSQRD',
                 "order_code" => $orderCode,
                 "order_id" => $datainfo,
-                "order_status" => 0
+                "order_status" => 0,"before_status"=> 0
             ]);
             $bol = $this->createCgd($cgd);
             if ($bol == false) {
@@ -1459,7 +1459,7 @@ class Sale extends Base
                             "order_type" => 'CKD',
                             "order_code" => $outCode,
                             "order_id" => Db::name("order_out")->getLastInsID(),
-                            "order_status" => 0
+                            "order_status" => 0,"before_status"=> 0
                         ]);
                         $order['send_num'] += $value['receipt_quantity'];
                         $order['wsend_num'] -= $value['receipt_quantity'];
@@ -1573,7 +1573,7 @@ class Sale extends Base
                 "order_type" => 'XSQRD',
                 "order_code" => $orderCode,
                 "order_id" => $datainfo,
-                "order_status" => 0
+                "order_status" => 0,"before_status"=> 0
             ]);
             $cgd=[
                 "supplierNo"=>$good['supplierNo'],
@@ -1727,7 +1727,7 @@ class Sale extends Base
                                         "order_type" => 'CKD',
                                         "order_code" => $outCode,//出库单号
                                         "order_id" =>Db::name("order_out")->getLastInsID(),
-                                        "order_status" => 0
+                                        "order_status" => 0,"before_status"=> 0
                                     ]);
                                 }
                             } else {
@@ -1937,8 +1937,8 @@ class Sale extends Base
             if ($datninfo > 0) {
                 $stn = ["order_code"=>$etid['orderCode'],"status"=>$etid['status'],"action_remark"=>'',"action_type"=>"edit"];
                 ActionLog::logAdd($this->post['token'],$stn,"XSQRD",$etid['status'],$datn);
-                $order=["order_type"=>'XSQRD',"order_code"=>$etid['orderCode'],"order_id"=>$id,"order_status"=>$etid['status']];
-                ProcessOrder::AddProcess($this->post['token'],$order);
+//                $order=["order_type"=>'XSQRD',"order_code"=>$etid['orderCode'],"order_id"=>$id,"order_status"=>$etid['status'],"before_status"=> 0];
+//                ProcessOrder::AddProcess($this->post['token'],$order);
                 foreach ($vi as $ion) {
                     $iten = [];
                     isset($ion['id']) && $ion['id'] !== "" ? $iten['id'] = $ion['id'] : '';
@@ -2197,7 +2197,7 @@ class Sale extends Base
             if ($st) {
                 $stn = ["order_code"=>$dio['orderCode'],"status"=>$vmp,"action_remark"=>'',"action_type"=>"status"];
                 ActionLog::logAdd($this->post['token'],$stn, $dio['order_type'] == 2?"ZXQRD":"XSQRD",$dio['status'],$dio);
-                $order=["order_type"=>$dio['order_type'] == 2?"ZXQRD":"XSQRD","order_code"=>$dio['orderCode'],"order_id"=>$id,"order_status"=>$dio['status']];
+                $order=["order_type"=>"XSQRD","order_code"=>$dio['orderCode'],"order_id"=>$id,"order_status"=>$dio['status']];
                 ProcessOrder::AddProcess($this->post['token'],$order);
                 if ($status == 3 && $dio['order_type'] == 1) {
                     $dn = Db::name('sale_info')->where(['orderCode' => $st['orderCode']])->select();
@@ -2310,7 +2310,7 @@ class Sale extends Base
                                     "order_type" => 'CKD',
                                     "order_code" => $outCode,//出库单号
                                     "order_id" => 0,
-                                    "order_status" => 0
+                                    "order_status" => 0,"before_status"=> 0
                                 ]);
                             }
                         }
@@ -2398,7 +2398,7 @@ class Sale extends Base
             if ($datainfo) {
                 $stx = ["order_code"=> $etid['orderCode'],"status"=>$etid['status'],"action_remark"=>'',"action_type"=>"edit"];
                 ActionLog::logAdd($this->post['token'],$stx,"XSQRD",2,$data);
-                $order=["order_type"=>"XSQRD","order_code"=>$etid['orderCode'],"order_id"=>$id,"order_status"=>$data['status']];
+                $order=["order_type"=>"XSQRD","order_code"=>$etid['orderCode'],"order_id"=>$id,"order_status"=>$data['status'],"before_status"=> 0];
                 ProcessOrder::AddProcess($this->post['token'],$order);
                 foreach ($vr as $value) {
                     $tm = [];
@@ -2507,7 +2507,7 @@ class Sale extends Base
             if ($datainfo>0) {
                 $stx = ["order_code"=>$outCode,"status"=>$status,"action_remark"=>'',"action_type"=>"create"];
                 ActionLog::logAdd($this->post['token'],$stx,$der['order_type']==1?"CKD":'ZXCKD',$status,$data);
-                $order=["order_type"=>$der['order_type']==1?"CKD":'ZXCKD',"order_code"=>$outCode,"order_id"=>$datainfo,"order_status"=>$data['status']];
+                $order=["order_type"=>"CKD","order_code"=>$outCode,"order_id"=>$datainfo,"order_status"=>$data['status'],"before_status"=> 0];
                 ProcessOrder::AddProcess($this->post['token'],$order);
                 if ($status == 1) {
                     $item =$der['status'];
@@ -2524,7 +2524,7 @@ class Sale extends Base
                     $stx = ["order_code"=>$orderCode,"status"=>$item,"action_remark"=>'',"action_type"=>"edit"];
 
                     ActionLog::logAdd($this->post['token'],$stx,"XSQRD",$der['status'],$der);
-                    $order=["order_type"=>"XSQRD","order_code"=>$orderCode,"order_id"=>$der['id'],"order_status"=>$data['status']];
+                    $order=["order_type"=>"XSQRD","order_code"=>$orderCode,"order_id"=>$der['id'],"order_status"=>$data['status'],"before_status"=> 0];
 
                     ProcessOrder::AddProcess($this->post['token'],$order);
                 }
@@ -2572,7 +2572,7 @@ class Sale extends Base
             if ($cust) {
                 $stx = ["order_code"=>$outCode,"status"=>$time,"action_remark"=>'',"action_type"=>"status"];
                 ActionLog::logAdd($this->post['token'],$stx,"CKD",$codeinfo['status'],$codeinfo);
-                $order=["order_type"=>"CKD","order_code"=>$outCode,"order_id"=>$codeinfo['id'],"order_status"=>$codeinfo['status']];
+                $order=["order_type"=>"CKD","order_code"=>$outCode,"order_id"=>$codeinfo['id'],"order_status"=>$codeinfo['status'],"before_status"=> 0];
                 ProcessOrder::AddProcess($this->post['token'],$order);
                 if ($status == 1) {
 
@@ -2609,7 +2609,7 @@ class Sale extends Base
                     $stx = ["order_code"=>$dr['orderCode'],"status"=>$item,"action_remark"=>'',"action_type"=>"edit"];
                     ActionLog::logAdd($this->post['token'],$stx,$dr['order_type'] == 2?"ZXQRD":"XSQRD",$dr['status'],
                         $dr);
-                    $order=["order_type"=>$dr['order_type'] == 2?"ZXQRD":"XSQRD","order_code"=>$dr['orderCode'],"order_id"=>$dr['id'],"order_status"=>$dr['status']];
+                    $order=["order_type"=>"XSQRD","order_code"=>$dr['orderCode'],"order_id"=>$dr['id'],"order_status"=>$dr['status'],"before_status"=> 0];
                     ProcessOrder::AddProcess($this->post['token'],$order);
 
                     //商品变动日志表,good_log_code字段存储销售订单编号
@@ -2751,7 +2751,8 @@ class Sale extends Base
         if ($up) {
             $stx = ["order_code"=>$info["orderCode"],"status"=>$item,"action_remark"=>'',"action_type"=>"edit"];
             ActionLog::logAdd($this->post['token'],$stx,"XSGCD",$info['status'],$info);
-            $order=["order_type"=>"XSGCD","order_code"=>$info["orderCode"],"order_id"=>$info['id'],"order_status"=>$info['status']];
+            $order=["order_type"=>"XSGCD","order_code"=>$info["orderCode"],"order_id"=>$info['id'],
+                "order_status"=>$info['status'],"before_status"=> $item];
             ProcessOrder::AddProcess($this->post['token'],$order);
             return app_show(0, "更新成功");
         } else {
@@ -2798,7 +2799,8 @@ class Sale extends Base
             if ($up) {
                 $stx = ["order_code"=>$info["orderCode"],"status"=>$ite,"action_remark"=>'',"action_type"=>"status"];
                 ActionLog::logAdd($this->post['token'],$stx,"XSGCD",$status,$info);
-                $order=["order_type"=>"XSGCD","order_code"=>$info["orderCode"],"order_id"=>$info['id'],"order_status"=>$status];
+                $order=["order_type"=>"XSGCD","order_code"=>$info["orderCode"],"order_id"=>$info['id'],
+                    "order_status"=>$status,"before_status"=> $ite];
                 ProcessOrder::AddProcess($this->post['token'],$order);
                 $cgdup =Db::name("purchease_diff")->where(["id"=>$info['cgd_diffid']])->save($upda);
                 if($cgdup){
@@ -3172,7 +3174,7 @@ class Sale extends Base
                                 "order_type" => 'CKD',
                                 "order_code" => $data['outCode'],//出库单号
                                 "order_id" => $datainfo,
-                                "order_status" => $data['status']
+                                "order_status" => $data['status'],"before_status"=> 0
                             ]);
                         Db::commit();
                         return app_show(0,"出库单新建成功");
@@ -3240,7 +3242,7 @@ class Sale extends Base
                     "order_type" => 'CKD',
                     "order_code" => $outinfo['outCode'],//出库单号
                     "order_id" => $outinfo['id'],
-                    "order_status" => $outinfo['status']
+                    "order_status" => $outinfo['status'],"before_status"=> $old_outinfo_status
                 ]);
                     $orderstatus= $einfo['status'];
                     $einfo['send_num']+=$outinfo['send_num'];
@@ -3266,7 +3268,7 @@ class Sale extends Base
                     "order_type" => 'XSQRD',
                     "order_code" =>$einfo['orderCode'],//出库单号
                     "order_id" => $einfo['id'],
-                    "order_status" => $einfo['status']
+                    "order_status" => $einfo['status'],"before_status"=> $orderstatus
                 ]);
 
                 $stokc =Db::name("good_stock")->where(['spuCode'=>$einfo['good_code'],"wsm_code"=>$outinfo['wsm_code'],"is_del"=>0])->find();

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

@@ -332,7 +332,7 @@ class Version extends BaseController
                                 "action_type" => "edit"//新建create,编辑edit更改状态status
                             ], "PRO", 3, ["status" => 3, "updatetime" => date("Y-m-d H:i:s")]);
 
-                            $process = ["order_code" => $value['projectNo'], "order_id" => $pr['id'], "order_status" =>3, "order_type" => 'PRO'];
+                            $process = ["order_code" => $value['projectNo'], "order_id" => $pr['id'], "order_status" =>3, "order_type" => 'PRO',"before_status"=> $pr['status']];
                             ProcessOrder::AddProcess(['id'=>0,"nickname"=>'客户'], $process);
                         }
                     }else{
@@ -411,7 +411,7 @@ class Version extends BaseController
                     "action_type" => "edit"//新建create,编辑edit更改状态status
                 ], "PRO", 5, ["status" => 5, "updatetime" => date("Y-m-d H:i:s")]);
 
-                $process = ["order_code" => $project, "order_id" => $pr['id'], "order_status" =>5, "order_type" => 'PRO'];
+                $process = ["order_code" => $project, "order_id" => $pr['id'], "order_status" =>5, "order_type" => 'PRO',"before_status"=> $pr['status']];
                 ProcessOrder::AddProcess(['id'=>0,"nickname"=>'客户'], $process);
                     Db::commit();
                     return app_show(0, "方案数据修改成功");