|
|
@@ -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);
|
|
|
|