...
|
...
|
@@ -210,11 +210,11 @@ class Goods extends Model |
|
|
public function getDepot($goodsId,$areaId,$number,$type){
|
|
|
$arr = [];//仓库对应需扣除库存信息
|
|
|
//获取全部仓库库存
|
|
|
$sum_stock_num = $this->alias('g')
|
|
|
->join('fa_depot d','g.id=d.goods_id')
|
|
|
->where(['g.id' => $goodsId,'d.type' => $type])
|
|
|
->field('d.id,d.stock_num')
|
|
|
->sum('d.stock_num');
|
|
|
$depotModel = new Depot();
|
|
|
$sum_stock_num = $depotModel
|
|
|
->where(['goods_id' => $goodsId])
|
|
|
->where('type',"'".$type."'")
|
|
|
->sum('stock_num');
|
|
|
if($number > $sum_stock_num){
|
|
|
return false; //库存不足
|
|
|
}
|
...
|
...
|
|