feat: 修改OpurchaseGoodsOfferValidate验证逻辑,增加商品名称和采购数量校验
This commit is contained in:
parent
0d2318d86f
commit
d6d23b2fd0
@ -1,8 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace app\api\validate;
|
||||
|
||||
use app\common\model\opurchase\OpurchaseGoodsOffer;
|
||||
|
||||
use app\common\model\goods\Goods;
|
||||
use app\common\model\opurchase\OpurchaseGoodsOffer;
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
class OpurchaseGoodsOfferValidate extends BaseValidate
|
||||
@ -42,8 +43,9 @@
|
||||
if(!isset($v['nums']) || $v['nums'] == '') {
|
||||
return '第'.($k+1).'行缺少数量';
|
||||
}
|
||||
if($data['nums']<$v['nums']){
|
||||
return '第'.($k+1).'行数量不能大于采购数量';
|
||||
if($data['need_num']<$v['nums']){
|
||||
$name=Goods::where('id',$data['goods_id'])->value('name');
|
||||
return '第'.($k+1).'行数量不能大于商品'.$name.'的采购数量:'.$data['need_num'];
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
Loading…
x
Reference in New Issue
Block a user