wugg 2 years ago
parent
commit
c5dc39b5f6
2 changed files with 28 additions and 30 deletions
  1. 1 2
      app/admin/controller/Purchin.php
  2. 27 28
      app/admin/controller/Resign.php

+ 1 - 2
app/admin/controller/Purchin.php

@@ -299,7 +299,7 @@ class Purchin extends BaseController
                             "wsm_code"=>$cgdinfo['wsm_code'],
                             "usable_stock"=>0,
                             "wait_out_stock"=>0,
-                            "wait_in_stock"=>$cgdinfo['good_num'],
+                            "wait_in_stock"=>0,
                             "total_stock"=>0,
                             "addtime"=>date("Y-m-d H:i:s"),
                             "updatetime"=>date("Y-m-d H:i:s"),
@@ -309,7 +309,6 @@ class Purchin extends BaseController
                         $order = ["order_code"=>$good['spuCode'],"status"=>1,"action_remark"=>'', "action_type"=>"edit"];
                     }
                     $good['usable_stock']+=$send_num;
-                    $good['wait_in_stock']-=$send_num;
                     $good['total_stock']=$good['usable_stock']+$good['wait_out_stock'];
                     $good['updatetime'] = date("Y-m-d H:i:s");
                     $upd=  Db::name("good_stock")->save($good);

+ 27 - 28
app/admin/controller/Resign.php

@@ -791,32 +791,32 @@ class Resign extends BaseController
                 ];
                 $in =Db::name("order_bk")->insert($data);
                 if($in) {
-                    $good = Db::name("good_stock")->where(["wsm_code" => $info['wsm_code'], "spuCode" => $info['spuCode'], "is_del" => 0])->find();
-                    if ($good == false) {
-                        $good = [
-                            "spuCode" => $info['spuCode'],
-                            "wsm_code" => $info['wsm_code'],
-                            "usable_stock" => 0,
-                            "wait_out_stock" => 0,
-                            "wait_in_stock" => 0,
-                            "total_stock" => 0,
-                            "addtime" => date("Y-m-d H:i:s"),
-                            "updatetime" => date("Y-m-d H:i:s"),
-                        ];
-                        $order = ["order_code" => $info['spuCode'], "status" => 1, "action_remark" => '', "action_type" => "create"];
-                    } else {
-                        $order = ["order_code" => $info['spuCode'], "status" => 1, "action_remark" => '', "action_type" => "edit"];
-                    }
-                    $good['wait_in_stock'] += $info['good_num'];
-                    $good['updatetime'] = date("Y-m-d H:i:s");
-                    $upd = Db::name("good_stock")->save($good);
-                    $good_data[] = ["stock_id" => isset($good['id']) ? $good['id'] : Db::name("good_stock")->getLastInsID(), "type" => 1,
-                        'stock' => $info['good_num'], "stock_name" => "wait_in_stock"];
-                    if ($upd) {
-                        GoodLog::LogAdd($this->post['token'], $good_data, 'RKD');
-                        ActionLog::logAdd($this->post['token'], $order, "RKD", 1, $good);
-                        $process = ["order_code" => $cgdCode, "order_id" => Db::name("purchease_order")->getLastInsID(), "order_status" => $cg['status'], "order_type" => 'CGD'];
-                        ProcessOrder::AddProcess($this->post['token'], $process);
+//                    $good = Db::name("good_stock")->where(["wsm_code" => $info['wsm_code'], "spuCode" => $info['spuCode'], "is_del" => 0])->find();
+//                    if ($good == false) {
+//                        $good = [
+//                            "spuCode" => $info['spuCode'],
+//                            "wsm_code" => $info['wsm_code'],
+//                            "usable_stock" => 0,
+//                            "wait_out_stock" => 0,
+//                            "wait_in_stock" => 0,
+//                            "total_stock" => 0,
+//                            "addtime" => date("Y-m-d H:i:s"),
+//                            "updatetime" => date("Y-m-d H:i:s"),
+//                        ];
+//                        $order = ["order_code" => $info['spuCode'], "status" => 1, "action_remark" => '', "action_type" => "create"];
+//                    } else {
+//                        $order = ["order_code" => $info['spuCode'], "status" => 1, "action_remark" => '', "action_type" => "edit"];
+//                    }
+//                    $good['wait_in_stock'] += $info['good_num'];
+//                    $good['updatetime'] = date("Y-m-d H:i:s");
+//                    $upd = Db::name("good_stock")->save($good);
+//                    $good_data[] = ["stock_id" => isset($good['id']) ? $good['id'] : Db::name("good_stock")->getLastInsID(), "type" => 1,
+//                        'stock' => $info['good_num'], "stock_name" => "wait_in_stock"];
+//                    if ($upd) {
+//                        GoodLog::LogAdd($this->post['token'], $good_data, 'RKD');
+//                        ActionLog::logAdd($this->post['token'], $order, "RKD", 1, $good);
+//                        $process = ["order_code" => $cgdCode, "order_id" => Db::name("purchease_order")->getLastInsID(), "order_status" => $cg['status'], "order_type" => 'CGD'];
+//                        ProcessOrder::AddProcess($this->post['token'], $process);
                         $info['wsm_code'] = $wsm_code;
                         $info['status'] = 2;
                         $info['updatetime'] = date("Y-m-d H:i:s");
@@ -826,10 +826,9 @@ class Resign extends BaseController
                             return app_show(0, "采购单新建成功", ["cgdNo" => $cgdCode]);
                         }
 
-                    }
+//                    }
                     }
                 }
-
                 Db::rollback();
                 return error_show(1004,"采购单新建失败");
         }catch (\Exception $e){