shish 3 лет назад
Родитель
Сommit
85a5b23343
1 измененных файлов с 15 добавлено и 13 удалено
  1. 15 13
      biz-hd/refund/classes/HdRefundItemClass.php

+ 15 - 13
biz-hd/refund/classes/HdRefundItemClass.php

@@ -33,19 +33,21 @@ class HdRefundItemClass extends BaseClass
         $sjId = $data['sjId'] ?? 0;
         $shopAdminName = $post['shopAdminName'] ?? '';
 
-        $stockInfo = ProductClass::addStock($itemId, $bigNum, $smallNum);
-        $recordData = [];
-        $recordData['sjId'] = $sjId;
-        $recordData['shopId'] = $shopId;
-        $recordData['mainId'] = $mainId;
-        $recordData['itemId'] = $ptItemId;
-        $recordData['itemNum'] = ProductClass::mergeItemNum($bigNum, $smallNum, $ratio);
-        $recordData['oldStock'] = $stockInfo['oldStock'];
-        $recordData['newStock'] = $stockInfo['newStock'];
-        $recordData['productId'] = $itemId;
-        $recordData['orderSn'] = $refundSn;
-        $recordData['relateName'] = $shopAdminName;
-        StockRecordClass::hdRefundAddRecord($recordData);
+        if ($bigNum > 0) {
+            $stockInfo = ProductClass::addStock($itemId, $bigNum, $smallNum);
+            $recordData = [];
+            $recordData['sjId'] = $sjId;
+            $recordData['shopId'] = $shopId;
+            $recordData['mainId'] = $mainId;
+            $recordData['itemId'] = $ptItemId;
+            $recordData['itemNum'] = ProductClass::mergeItemNum($bigNum, $smallNum, $ratio);
+            $recordData['oldStock'] = $stockInfo['oldStock'];
+            $recordData['newStock'] = $stockInfo['newStock'];
+            $recordData['productId'] = $itemId;
+            $recordData['orderSn'] = $refundSn;
+            $recordData['relateName'] = $shopAdminName;
+            StockRecordClass::hdRefundAddRecord($recordData);
+        }
 
         return self::add($data);
     }