|
|
@@ -84,26 +84,29 @@ class PurchaseOrderClass extends BaseClass
|
|
|
$currentNum = $cgItem['itemNum'] ?? 0;
|
|
|
$ptItemId = $cgItem['itemId'] ?? 0;
|
|
|
$unitCost = $cgItem['cost'] ?? 0;
|
|
|
+ $presell = $cgItem['presell'] ?? 0;
|
|
|
|
|
|
$product = ProductClass::getLockById($productId);
|
|
|
if (empty($product)) {
|
|
|
util::fail('没有找到花材哦');
|
|
|
}
|
|
|
|
|
|
- //加库存和流水记录
|
|
|
- $stockInfo = ProductClass::addStockByItemNum($productId, $currentNum);
|
|
|
- $record = [];
|
|
|
- $record['sjId'] = $sjId;
|
|
|
- $record['shopId'] = $shopId;
|
|
|
- $record['mainId'] = $mainId;
|
|
|
- $record['orderSn'] = $orderSn;
|
|
|
- $record['productId'] = $productId;
|
|
|
- $record['itemId'] = $ptItemId;
|
|
|
- $record['relateName'] = $ghsName;
|
|
|
- $record['itemNum'] = $currentNum;
|
|
|
- $record['oldStock'] = $stockInfo['oldStock'];
|
|
|
- $record['newStock'] = $stockInfo['newStock'];
|
|
|
- StockRecordClass::addPurchaseOrderRecord($record);
|
|
|
+ if ($presell == 0) {
|
|
|
+ //加库存和流水记录
|
|
|
+ $stockInfo = ProductClass::addStockByItemNum($productId, $currentNum);
|
|
|
+ $record = [];
|
|
|
+ $record['sjId'] = $sjId;
|
|
|
+ $record['shopId'] = $shopId;
|
|
|
+ $record['mainId'] = $mainId;
|
|
|
+ $record['orderSn'] = $orderSn;
|
|
|
+ $record['productId'] = $productId;
|
|
|
+ $record['itemId'] = $ptItemId;
|
|
|
+ $record['relateName'] = $ghsName;
|
|
|
+ $record['itemNum'] = $currentNum;
|
|
|
+ $record['oldStock'] = $stockInfo['oldStock'];
|
|
|
+ $record['newStock'] = $stockInfo['newStock'];
|
|
|
+ StockRecordClass::addPurchaseOrderRecord($record);
|
|
|
+ }
|
|
|
|
|
|
$product->cost = $unitCost;
|
|
|
$product->priceLabel = ProductClass::PRICE_LABEL_AUTO;
|
|
|
@@ -422,22 +425,26 @@ class PurchaseOrderClass extends BaseClass
|
|
|
$itemId = $v['itemId'];
|
|
|
$productId = $v['productId'];
|
|
|
|
|
|
- if ($inType == self::IN_TYPE_NOW) {
|
|
|
- //流水记录
|
|
|
- $record = [];
|
|
|
- $record['sjId'] = $sjId;
|
|
|
- $record['shopId'] = $shopId;
|
|
|
- $record['mainId'] = $mainId;
|
|
|
- $record['orderSn'] = $orderSn;
|
|
|
- $record['productId'] = $productId;
|
|
|
- $record['itemId'] = $itemId;
|
|
|
- $record['relateName'] = $ghsName;
|
|
|
- $record['itemNum'] = $v['itemNum'];
|
|
|
- $record['oldStock'] = $v['itemStock'];
|
|
|
- $record['newStock'] = bcadd($v['itemStock'], $v['itemNum'], 2);
|
|
|
- StockRecordClass::addPurchaseOrderRecord($record);
|
|
|
- //加库存
|
|
|
- ProductClass::addStockByItemNum($productId, $v['itemNum']);
|
|
|
+ $presell = $productList[$productId]['presell'] ?? 0;
|
|
|
+ //非预售增加库存,预售不增加库存 ssh 20220109
|
|
|
+ if ($presell == 0) {
|
|
|
+ if ($inType == self::IN_TYPE_NOW) {
|
|
|
+ //流水记录
|
|
|
+ $record = [];
|
|
|
+ $record['sjId'] = $sjId;
|
|
|
+ $record['shopId'] = $shopId;
|
|
|
+ $record['mainId'] = $mainId;
|
|
|
+ $record['orderSn'] = $orderSn;
|
|
|
+ $record['productId'] = $productId;
|
|
|
+ $record['itemId'] = $itemId;
|
|
|
+ $record['relateName'] = $ghsName;
|
|
|
+ $record['itemNum'] = $v['itemNum'];
|
|
|
+ $record['oldStock'] = $v['itemStock'];
|
|
|
+ $record['newStock'] = bcadd($v['itemStock'], $v['itemNum'], 2);
|
|
|
+ StockRecordClass::addPurchaseOrderRecord($record);
|
|
|
+ //加库存
|
|
|
+ ProductClass::addStockByItemNum($productId, $v['itemNum']);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//单位采购价
|
|
|
@@ -458,7 +465,6 @@ class PurchaseOrderClass extends BaseClass
|
|
|
$currentBigUnit = $productList[$productId]['bigUnit'] ?? '';
|
|
|
$currentSmallUnit = $productList[$productId]['smallUnit'] ?? '';
|
|
|
$currentRatio = $productList[$productId]['ratio'] ?? 0;
|
|
|
- $presell = $productList[$productId]['presell'] ?? 0;
|
|
|
$batchData[$currentKey]['bigUnit'] = $currentBigUnit;
|
|
|
$batchData[$currentKey]['smallUnit'] = $currentSmallUnit;
|
|
|
$batchData[$currentKey]['ratio'] = $currentRatio;
|