shish 3 rokov pred
rodič
commit
3d909d5a97

+ 1 - 1
biz-ghs/order/classes/OrderItemClass.php

@@ -114,7 +114,7 @@ class OrderItemClass extends BaseClass
             $weight = bcadd($w, $weight, 2);
 
             if ($stockMayChange == true) {
-                //小单位花材开单不扣库存
+                //小单位花材开单暂时不扣库存
                 if (intval($itemNum) > 0) {
                     $checkStock = true;
                     $stockInfo = ProductClass::decreaseStock($productId, $bigNum, $smallNum, $checkStock);

+ 17 - 13
biz-hd/order/classes/OrderItemClass.php

@@ -37,21 +37,25 @@ class OrderItemClass extends BaseClass
         } else {
             $smallNum = $num;
         }
+
         //库存减少
-        $stockInfo = ProductClass::decreaseStock($itemId, $bigNum, $smallNum, true);
-        $recordData = [];
-        $recordData['sjId'] = $sjId;
-        $recordData['shopId'] = $shopId;
-        $recordData['mainId'] = $mainId;
-        $recordData['itemId'] = $ptItemId;
         $itemNum = ProductClass::mergeItemNum($bigNum, $smallNum, $ratio);
-        $recordData['itemNum'] = $itemNum;
-        $recordData['oldStock'] = $stockInfo['oldStock'];
-        $recordData['newStock'] = $stockInfo['newStock'];
-        $recordData['productId'] = $itemId;
-        $recordData['orderSn'] = $orderSn;
-        $recordData['relateName'] = $customName;
-        StockRecordClass::hdKdAddRecord($recordData);
+        //开单时如果是小单位暂时不扣库存
+        if (intval($itemNum) > 0) {
+            $stockInfo = ProductClass::decreaseStock($itemId, $bigNum, $smallNum, true);
+            $recordData = [];
+            $recordData['sjId'] = $sjId;
+            $recordData['shopId'] = $shopId;
+            $recordData['mainId'] = $mainId;
+            $recordData['itemId'] = $ptItemId;
+            $recordData['itemNum'] = $itemNum;
+            $recordData['oldStock'] = $stockInfo['oldStock'];
+            $recordData['newStock'] = $stockInfo['newStock'];
+            $recordData['productId'] = $itemId;
+            $recordData['orderSn'] = $orderSn;
+            $recordData['relateName'] = $customName;
+            StockRecordClass::hdKdAddRecord($recordData);
+        }
 
         $result = self::add($data, true);