shish 1 rok pred
rodič
commit
6782a6410d
1 zmenil súbory, kde vykonal 12 pridanie a 5 odobranie
  1. 12 5
      biz-hd/cg/classes/CgRefundClass.php

+ 12 - 5
biz-hd/cg/classes/CgRefundClass.php

@@ -115,16 +115,23 @@ class CgRefundClass extends BaseClass
                     }
                     $oneItem->refundNum = bcadd($refundNum, $num);
                     $oneItem->save();
-                    //大单位退款才变库存,小单位不变化库存!!
-                    $smallNum = 0;
-                    $bigNum = $num;
-                    if ($bigNum > 0) {
+
+                    if ($refundSingle->xhUnitType == 1) {
+                        $smallNum = $num;
+                        $bigNum = 0;
+                    } else {
+                        $smallNum = 0;
+                        $bigNum = $num;
+                    }
+                    $itemNum = $refundSingle->itemNum;
+
+                    if ($bigNum > 0 || $smallNum > 0) {
                         $stockInfo = ProductClass::decreaseStock($productId, $bigNum, $smallNum);
                         $oldStock = $stockInfo['oldStock'] ?? 0;
                         $newStock = $stockInfo['newStock'] ?? 0;
 
                         $recordData = [];
-                        $recordData['itemNum'] = $bigNum;
+                        $recordData['itemNum'] = $itemNum;
                         $recordData['sjId'] = $sjId;
                         $recordData['shopId'] = $shopId;
                         $recordData['mainId'] = $mainId;