|
|
|
@ -4,9 +4,9 @@ import cn.hutool.core.util.StrUtil;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
import com.glxp.udi.admin.dao.basic.StockRulesDao;
|
|
|
|
|
import com.glxp.udi.admin.entity.basic.StockRulesEntity;
|
|
|
|
|
import com.glxp.udi.admin.req.basic.FilterStockRulesRequest;
|
|
|
|
|
import com.glxp.udi.admin.dao.basic.StackRulesDao;
|
|
|
|
|
import com.glxp.udi.admin.entity.basic.StackRulesEntity;
|
|
|
|
|
import com.glxp.udi.admin.req.basic.FilterStackRulesRequest;
|
|
|
|
|
import com.glxp.udi.admin.service.auth.AuthAdminService;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
@ -21,10 +21,10 @@ import java.util.Date;
|
|
|
|
|
@Slf4j
|
|
|
|
|
@Service
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public class StockRulesService {
|
|
|
|
|
public class StackRulesService {
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private StockRulesDao stockRulesDao;
|
|
|
|
|
private StackRulesDao stackRulesDao;
|
|
|
|
|
@Resource
|
|
|
|
|
private AuthAdminService authAdminService;
|
|
|
|
|
|
|
|
|
@ -34,10 +34,10 @@ public class StockRulesService {
|
|
|
|
|
* @param filterStockRulesRequest
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public IPage<StockRulesEntity> filter(FilterStockRulesRequest filterStockRulesRequest) {
|
|
|
|
|
QueryWrapper<StockRulesEntity> wrapper = buildWrapper(filterStockRulesRequest);
|
|
|
|
|
IPage<StockRulesEntity> page = new Page<>(filterStockRulesRequest.getPage(), filterStockRulesRequest.getLimit());
|
|
|
|
|
return stockRulesDao.selectPage(page, wrapper);
|
|
|
|
|
public IPage<StackRulesEntity> filter(FilterStackRulesRequest filterStockRulesRequest) {
|
|
|
|
|
QueryWrapper<StackRulesEntity> wrapper = buildWrapper(filterStockRulesRequest);
|
|
|
|
|
IPage<StackRulesEntity> page = new Page<>(filterStockRulesRequest.getPage(), filterStockRulesRequest.getLimit());
|
|
|
|
|
return stackRulesDao.selectPage(page, wrapper);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -46,8 +46,8 @@ public class StockRulesService {
|
|
|
|
|
* @param filterStockRulesRequest
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
private QueryWrapper<StockRulesEntity> buildWrapper(FilterStockRulesRequest filterStockRulesRequest) {
|
|
|
|
|
QueryWrapper<StockRulesEntity> wrapper = new QueryWrapper<>();
|
|
|
|
|
private QueryWrapper<StackRulesEntity> buildWrapper(FilterStackRulesRequest filterStockRulesRequest) {
|
|
|
|
|
QueryWrapper<StackRulesEntity> wrapper = new QueryWrapper<>();
|
|
|
|
|
wrapper.like(StrUtil.isNotBlank(filterStockRulesRequest.getName()), "name", filterStockRulesRequest.getName())
|
|
|
|
|
.eq(null != filterStockRulesRequest.getStatus(), "status", filterStockRulesRequest.getStatus())
|
|
|
|
|
.eq(StrUtil.isNotBlank(filterStockRulesRequest.getCustomerId()), "customerId", filterStockRulesRequest.getCustomerId());
|
|
|
|
@ -57,24 +57,24 @@ public class StockRulesService {
|
|
|
|
|
/**
|
|
|
|
|
* 添加建垛规则
|
|
|
|
|
*
|
|
|
|
|
* @param stockRulesEntity
|
|
|
|
|
* @param stackRulesEntity
|
|
|
|
|
*/
|
|
|
|
|
public void addStockRules(StockRulesEntity stockRulesEntity) {
|
|
|
|
|
stockRulesEntity.setCreateTime(new Date());
|
|
|
|
|
stockRulesEntity.setUpdateTime(new Date());
|
|
|
|
|
public void addStackRules(StackRulesEntity stackRulesEntity) {
|
|
|
|
|
stackRulesEntity.setCreateTime(new Date());
|
|
|
|
|
stackRulesEntity.setUpdateTime(new Date());
|
|
|
|
|
String customerId = authAdminService.getCurrentUserCustomerId();
|
|
|
|
|
stockRulesEntity.setCustomerId(Long.valueOf(customerId));
|
|
|
|
|
stockRulesDao.insert(stockRulesEntity);
|
|
|
|
|
stackRulesEntity.setCustomerId(Long.valueOf(customerId));
|
|
|
|
|
stackRulesDao.insert(stackRulesEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 更新建垛规则
|
|
|
|
|
*
|
|
|
|
|
* @param stockRulesEntity
|
|
|
|
|
* @param stackRulesEntity
|
|
|
|
|
*/
|
|
|
|
|
public void updateStockRules(StockRulesEntity stockRulesEntity) {
|
|
|
|
|
stockRulesEntity.setUpdateTime(new Date());
|
|
|
|
|
stockRulesDao.updateStockRules(stockRulesEntity);
|
|
|
|
|
public void updateStackRules(StackRulesEntity stackRulesEntity) {
|
|
|
|
|
stackRulesEntity.setUpdateTime(new Date());
|
|
|
|
|
stackRulesDao.updateStackRules(stackRulesEntity);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -83,7 +83,7 @@ public class StockRulesService {
|
|
|
|
|
* @param id 规则ID
|
|
|
|
|
*/
|
|
|
|
|
public void delete(String id) {
|
|
|
|
|
stockRulesDao.deleteById(id);
|
|
|
|
|
stackRulesDao.deleteById(id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -92,11 +92,11 @@ public class StockRulesService {
|
|
|
|
|
* @param customerId 客户ID
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public StockRulesEntity getEnableStockRule(String customerId) {
|
|
|
|
|
StockRulesEntity stockRulesEntity = stockRulesDao.selectOne(new QueryWrapper<StockRulesEntity>()
|
|
|
|
|
.eq(StockRulesEntity.COL_CUSTOMERID, customerId)
|
|
|
|
|
.eq(StockRulesEntity.COL_STATUS, 1));
|
|
|
|
|
return stockRulesEntity;
|
|
|
|
|
public StackRulesEntity getEnableStockRule(String customerId) {
|
|
|
|
|
StackRulesEntity stackRulesEntity = stackRulesDao.selectOne(new QueryWrapper<StackRulesEntity>()
|
|
|
|
|
.eq(StackRulesEntity.COL_CUSTOMERID, customerId)
|
|
|
|
|
.eq(StackRulesEntity.COL_STATUS, 1));
|
|
|
|
|
return stackRulesEntity;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|