|
@@ -58,7 +58,7 @@ class FinancialCancel extends Base
|
|
|
$ProductInfo=$ManagerInfo->ProductRela;
|
|
|
$up=[];
|
|
|
$ProductInfo->each(function ($item) use (&$up){
|
|
|
- $info = FinancialProducts::where('id',$item->product_id)->findOrEmpty();
|
|
|
+ $info = FinancialProducts::with(['ProductStock'])->where('id',$item->product_id)->findOrEmpty();
|
|
|
if($info->isEmpty()) throw new \Exception($item->goodName.'商品不存在');
|
|
|
if($item->status==1){
|
|
|
if($item['type']==2)$up[]=ProductStock::AddSingleStock($info,$item->num);
|
|
@@ -102,7 +102,7 @@ class FinancialCancel extends Base
|
|
|
$up=[];
|
|
|
if($status==2){
|
|
|
$ProductInfo->each(function ($item) use (&$up,$status){
|
|
|
- $info = FinancialProducts::where('id',$item->product_id)->findOrEmpty();
|
|
|
+ $info = FinancialProducts::with(['ProductStock'])->where('id',$item->product_id)->findOrEmpty();
|
|
|
if($item['type']==2)$up[]=ProductStock::AddSingleStock($info,$item->num);
|
|
|
if($item['type']==1){
|
|
|
if($info->residue_stock<$item->num) throw new \Exception($item->goodName.'库存不足');
|