|
@@ -150,8 +150,9 @@ class IntegralGoods extends Model |
|
@@ -150,8 +150,9 @@ class IntegralGoods extends Model |
150
|
*/
|
150
|
*/
|
151
|
public function checkStockNum($goodsId,$number){
|
151
|
public function checkStockNum($goodsId,$number){
|
152
|
$sum_stock_num = $this->alias('g')
|
152
|
$sum_stock_num = $this->alias('g')
|
153
|
- ->join('fa_integral_depot d','g.id=d.goods_id')
|
153
|
+ ->join('fa_depot d','g.id=d.goods_id')
|
154
|
->where(['g.id' => $goodsId])
|
154
|
->where(['g.id' => $goodsId])
|
|
|
155
|
+ ->where('type',2)
|
155
|
->field('d.id,d.stock_num')
|
156
|
->field('d.id,d.stock_num')
|
156
|
->sum('d.stock_num');
|
157
|
->sum('d.stock_num');
|
157
|
if($number > $sum_stock_num){
|
158
|
if($number > $sum_stock_num){
|