修复库存判断bug
This commit is contained in:
parent
db56df7a00
commit
5c42122443
@ -610,11 +610,13 @@ class CommunityRepository extends BaseRepository
|
|||||||
// if ($exist) {
|
// if ($exist) {
|
||||||
// throw new ValidateException('已发起转售');
|
// throw new ValidateException('已发起转售');
|
||||||
// }
|
// }
|
||||||
if (empty($purchaseRecord) || ($purchaseRecord['number'] - $purchaseRecord['sales_volume']) <= 0) {
|
$totalNumber = PurchaseRecord::where('unique', $value['product_attr_unique'])->sum('number');
|
||||||
|
$totalSalesVolume = PurchaseRecord::where('unique', $value['product_attr_unique'])->sum('sales_volume');
|
||||||
|
if (empty($purchaseRecord) || ($totalNumber - $totalSalesVolume) <= 0) {
|
||||||
throw new ValidateException('进货记录不存在或已售罄');
|
throw new ValidateException('进货记录不存在或已售罄');
|
||||||
}
|
}
|
||||||
if (($purchaseRecord['number'] - $purchaseRecord['sales_volume']) < $value['number']) {
|
if (($totalNumber - $totalSalesVolume) < $value['number']) {
|
||||||
throw new ValidateException('库存不足123');
|
throw new ValidateException('库存不足');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($value) {
|
if ($value) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user