|
|
@@ -5,6 +5,7 @@ namespace bizGhs\order\classes;
|
|
|
use biz\shop\classes\ShopCapitalClass;
|
|
|
use biz\shop\classes\ShopClass;
|
|
|
use biz\stat\classes\StatOutClass;
|
|
|
+use biz\stat\classes\StatWastClass;
|
|
|
use bizGhs\order\traits\OrderTrait;
|
|
|
use bizGhs\product\classes\ProductClass;
|
|
|
use bizGhs\stock\classes\StockRecordClass;
|
|
|
@@ -57,7 +58,7 @@ class StockWastageOrderClass extends BaseClass
|
|
|
//写入订单表
|
|
|
$order = self::add($data);
|
|
|
foreach ($ghsItemInfo as $k => $v) {
|
|
|
- $stockInfo = ProductClass::decreaseStock($v['productId'], $v['bigNum'], $v['smallNum'],true);
|
|
|
+ $stockInfo = ProductClass::decreaseStock($v['productId'], $v['bigNum'], $v['smallNum'], true);
|
|
|
$ghsItemInfo[$k]['oldStock'] = $stockInfo['oldStock'];
|
|
|
$ghsItemInfo[$k]['newStock'] = $stockInfo['newStock'];
|
|
|
}
|
|
|
@@ -84,11 +85,15 @@ class StockWastageOrderClass extends BaseClass
|
|
|
}
|
|
|
$currentTotalExpend = bcadd($shop->totalExpend, $wastage, 2);
|
|
|
$shop->totalExpend = $currentTotalExpend;
|
|
|
+ $currentWast = bcadd($shop->totalWast, $wastage, 2);
|
|
|
+ $shop->totalWast = $currentWast;
|
|
|
$shop->save();
|
|
|
|
|
|
//当天和当月支出统计
|
|
|
StatOutClass::updateOrInsert($shop, $wastage);
|
|
|
|
|
|
+ StatWastClass::replace($shop, $wastage);
|
|
|
+
|
|
|
//报损支出
|
|
|
$capitalType = dict::getDict('capitalType', 'wastage', 'id');
|
|
|
$sjId = $post['sjId'] ?? 0;
|