Browse Source

财务定价的时候,库存品不足采购起订量的时候,取采购最小起订量计算价格

wufeng 2 years ago
parent
commit
0cfb4de00d
1 changed files with 10 additions and 3 deletions
  1. 10 3
      app/admin/controller/Goodup.php

+ 10 - 3
app/admin/controller/Goodup.php

@@ -2097,11 +2097,18 @@ class Goodup extends Base
         if($num==""){
             return error_show(1005,"参数min_num不能为空");
         }
-        $nakelist = Db::name("good_nake")->where(['spuCode'=>$spuCode,"is_del"=>0])->where([["min_num","<=",$num]])
-            ->order("min_num desc")->find();
+
+        $nakelist = Db::name("good_nake")
+            ->where(['spuCode'=>$spuCode,"is_del"=>0])
+            ->where([["min_num","<=",$num]])
+            ->order("min_num desc")
+            ->find();
         if($nakelist==false){
             $nakelist = Db::name("good_nake")->where(['spuCode'=>$spuCode,"is_del"=>0])->order("min_num asc")->find();
-            return error_show(1010,"起订量不足{$nakelist['min_num']}");
+
+            //非库存品的话,继续校验最小起订量
+            //库存品的话,不足采购起订量的时候,取采购最小起订量
+            if ($good['is_stock'] == 0) return error_show(1010, "起订量不足{$nakelist['min_num']}");
         }
         $catinfo = Db::name("cat")->where(["id"=>$good['cat_id']])->find();
         $budget = isset($catinfo['sale_rate']) ? $catinfo['sale_rate']/100:0;