| 1234567891011121314151617181920212223242526272829303132 |
- <?php
- namespace addons\CloudStock\common\services;
- use addons\CloudStock\common\models\CloudStockLevel;
- use common\enums\StatusEnum;
- class CloudStockLevelService extends BaseService
- {
- /**
- * @param int $number
- * @param bool $isCheckMin
- *
- * @return bool
- */
- public function checkFillOnceMinAndMax(int $number, bool $isCheckMin = true): bool
- {
- $cloud_stock_level = CloudStockLevel::findOne(['mall_id'=>$this->mall_id,'status'=>StatusEnum::ENABLED,'level'=>$this->stock_agent->level]);
- if(!empty($cloud_stock_level) && !empty($cloud_stock_level['is_open_fill_min_once'])){
- if($number > $cloud_stock_level['fill_max_once']){
- $this->setError('提货数量超过了一次性最高提货数量');
- return false;
- }
- if($isCheckMin && $number < $cloud_stock_level['fill_min_once']){
- $this->setError('提货数量未达到一次性最低提货数量');
- return false;
- }
- }
- return true;
- }
- }
|