|
|
@ -1,5 +1,8 @@
|
|
|
|
package org.dromara.wms.service.impl;
|
|
|
|
package org.dromara.wms.service.impl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
|
|
|
|
|
import com.github.yulichang.toolkit.JoinWrappers;
|
|
|
|
|
|
|
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
|
|
|
import net.sf.jsqlparser.statement.Statements;
|
|
|
|
import net.sf.jsqlparser.statement.Statements;
|
|
|
|
import org.dromara.common.core.utils.MapstructUtils;
|
|
|
|
import org.dromara.common.core.utils.MapstructUtils;
|
|
|
|
import org.dromara.common.core.utils.StringUtils;
|
|
|
|
import org.dromara.common.core.utils.StringUtils;
|
|
|
@ -9,8 +12,14 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
|
|
|
import org.dromara.common.mybatis.helper.DataPermissionHelper;
|
|
|
|
|
|
|
|
import org.dromara.system.api.model.LoginUser;
|
|
|
|
|
|
|
|
import org.dromara.wms.domain.BaseMaterialInfo;
|
|
|
|
|
|
|
|
import org.dromara.wms.domain.WmsBaseWarehouse;
|
|
|
|
import org.dromara.wms.domain.WmsConfiguration;
|
|
|
|
import org.dromara.wms.domain.WmsConfiguration;
|
|
|
|
|
|
|
|
import org.dromara.wms.domain.WmsOutstockDetail;
|
|
|
|
import org.dromara.wms.domain.bo.WmsConfigurationBo;
|
|
|
|
import org.dromara.wms.domain.bo.WmsConfigurationBo;
|
|
|
|
|
|
|
|
import org.dromara.wms.domain.bo.WmsOutstockDetailBo;
|
|
|
|
import org.dromara.wms.domain.vo.WmsConfigurationVo;
|
|
|
|
import org.dromara.wms.domain.vo.WmsConfigurationVo;
|
|
|
|
import org.dromara.wms.mapper.WmsConfigurationMapper;
|
|
|
|
import org.dromara.wms.mapper.WmsConfigurationMapper;
|
|
|
|
import org.dromara.wms.service.IWmsConfigurationService;
|
|
|
|
import org.dromara.wms.service.IWmsConfigurationService;
|
|
|
@ -41,7 +50,10 @@ public class WmsConfigurationServiceImpl implements IWmsConfigurationService {
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public WmsConfigurationVo queryById(Long configurationId){
|
|
|
|
public WmsConfigurationVo queryById(Long configurationId){
|
|
|
|
return baseMapper.selectVoById(configurationId);
|
|
|
|
LambdaQueryWrapper<WmsConfiguration> wrapper = new LambdaQueryWrapper<>();
|
|
|
|
|
|
|
|
wrapper.eq(WmsConfiguration::getConfigurationId,configurationId);
|
|
|
|
|
|
|
|
WmsConfigurationVo wmsConfigurationVo = baseMapper.selectVoOne(wrapper);
|
|
|
|
|
|
|
|
return wmsConfigurationVo;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -53,7 +65,8 @@ public class WmsConfigurationServiceImpl implements IWmsConfigurationService {
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public TableDataInfo<WmsConfigurationVo> queryPageList(WmsConfigurationBo bo, PageQuery pageQuery) {
|
|
|
|
public TableDataInfo<WmsConfigurationVo> queryPageList(WmsConfigurationBo bo, PageQuery pageQuery) {
|
|
|
|
LambdaQueryWrapper<WmsConfiguration> lqw = buildQueryWrapper(bo);
|
|
|
|
// LambdaQueryWrapper<WmsConfiguration> lqw = buildQueryWrapper(bo);
|
|
|
|
|
|
|
|
MPJLambdaWrapper<WmsConfiguration> lqw = buildJoinQueryWrapper(bo);
|
|
|
|
lqw.orderByDesc(WmsConfiguration::getCreateTime);
|
|
|
|
lqw.orderByDesc(WmsConfiguration::getCreateTime);
|
|
|
|
Page<WmsConfigurationVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
|
|
|
Page<WmsConfigurationVo> result = baseMapper.selectVoPage(pageQuery.build(), lqw);
|
|
|
|
return TableDataInfo.build(result);
|
|
|
|
return TableDataInfo.build(result);
|
|
|
@ -70,6 +83,22 @@ public class WmsConfigurationServiceImpl implements IWmsConfigurationService {
|
|
|
|
LambdaQueryWrapper<WmsConfiguration> lqw = buildQueryWrapper(bo);
|
|
|
|
LambdaQueryWrapper<WmsConfiguration> lqw = buildQueryWrapper(bo);
|
|
|
|
return baseMapper.selectVoList(lqw);
|
|
|
|
return baseMapper.selectVoList(lqw);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private MPJLambdaWrapper<WmsConfiguration> buildJoinQueryWrapper(WmsConfigurationBo bo) {
|
|
|
|
|
|
|
|
Map<String, Object> params = bo.getParams();
|
|
|
|
|
|
|
|
MPJLambdaWrapper<WmsConfiguration> lqw = JoinWrappers.lambda(WmsConfiguration.class)
|
|
|
|
|
|
|
|
.selectAll(WmsConfiguration.class)
|
|
|
|
|
|
|
|
.select(WmsBaseWarehouse::getWarehouseCode)
|
|
|
|
|
|
|
|
.leftJoin(WmsBaseWarehouse.class, WmsBaseWarehouse::getWarehouseId, WmsConfiguration::getWarehouseId);
|
|
|
|
|
|
|
|
lqw.eq(bo.getConfigurationId() != null, WmsConfiguration::getConfigurationId, bo.getConfigurationId());
|
|
|
|
|
|
|
|
lqw.eq(StringUtils.isNotBlank(bo.getNodeCode()), WmsConfiguration::getNodeCode, bo.getNodeCode());
|
|
|
|
|
|
|
|
lqw.like(StringUtils.isNotBlank(bo.getNodeName()), WmsConfiguration::getNodeName, bo.getNodeName());
|
|
|
|
|
|
|
|
lqw.eq(StringUtils.isNotBlank(bo.getApproveYesNo()), WmsConfiguration::getApproveYesNo, bo.getApproveYesNo());
|
|
|
|
|
|
|
|
lqw.eq(StringUtils.isNotBlank(bo.getApproveType()), WmsConfiguration::getApproveType, bo.getApproveType());
|
|
|
|
|
|
|
|
lqw.eq(StringUtils.isNotBlank(bo.getApproveRoleCode()), WmsConfiguration::getApproveRoleCode, bo.getApproveRoleCode());
|
|
|
|
|
|
|
|
lqw.eq(bo.getWarehouseId() != null, WmsConfiguration::getWarehouseId, bo.getWarehouseId());
|
|
|
|
|
|
|
|
lqw.eq(StringUtils.isNotBlank(bo.getApproveRange()), WmsConfiguration::getApproveRange, bo.getApproveRange());
|
|
|
|
|
|
|
|
return lqw;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private LambdaQueryWrapper<WmsConfiguration> buildQueryWrapper(WmsConfigurationBo bo) {
|
|
|
|
private LambdaQueryWrapper<WmsConfiguration> buildQueryWrapper(WmsConfigurationBo bo) {
|
|
|
|
Map<String, Object> params = bo.getParams();
|
|
|
|
Map<String, Object> params = bo.getParams();
|
|
|
@ -94,6 +123,9 @@ public class WmsConfigurationServiceImpl implements IWmsConfigurationService {
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public Boolean insertByBo(WmsConfigurationBo bo) {
|
|
|
|
public Boolean insertByBo(WmsConfigurationBo bo) {
|
|
|
|
WmsConfiguration add = MapstructUtils.convert(bo, WmsConfiguration.class);
|
|
|
|
WmsConfiguration add = MapstructUtils.convert(bo, WmsConfiguration.class);
|
|
|
|
|
|
|
|
// LoginUser currentUser = DataPermissionHelper.getVariable("user");
|
|
|
|
|
|
|
|
// String tenantId = currentUser.getTenantId();
|
|
|
|
|
|
|
|
// add.setTenantId(Integer.valueOf(tenantId));
|
|
|
|
boolean flag = baseMapper.insert(add) > 0;
|
|
|
|
boolean flag = baseMapper.insert(add) > 0;
|
|
|
|
if (flag) {
|
|
|
|
if (flag) {
|
|
|
|
bo.setConfigurationId(add.getConfigurationId());
|
|
|
|
bo.setConfigurationId(add.getConfigurationId());
|
|
|
@ -111,7 +143,7 @@ public class WmsConfigurationServiceImpl implements IWmsConfigurationService {
|
|
|
|
public Boolean updateByBo(WmsConfigurationBo bo) {
|
|
|
|
public Boolean updateByBo(WmsConfigurationBo bo) {
|
|
|
|
WmsConfiguration update = MapstructUtils.convert(bo, WmsConfiguration.class);
|
|
|
|
WmsConfiguration update = MapstructUtils.convert(bo, WmsConfiguration.class);
|
|
|
|
validEntityBeforeSave(update);
|
|
|
|
validEntityBeforeSave(update);
|
|
|
|
return baseMapper.updateById(update) > 0;
|
|
|
|
return baseMapper.updateByconfigurationId(update) > 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -133,6 +165,8 @@ public class WmsConfigurationServiceImpl implements IWmsConfigurationService {
|
|
|
|
if(isValid){
|
|
|
|
if(isValid){
|
|
|
|
//TODO 做一些业务上的校验,判断是否需要校验
|
|
|
|
//TODO 做一些业务上的校验,判断是否需要校验
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return baseMapper.deleteByIds(ids) > 0;
|
|
|
|
LambdaUpdateWrapper<WmsConfiguration> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
|
|
|
|
|
updateWrapper.in(WmsConfiguration::getConfigurationId,ids);
|
|
|
|
|
|
|
|
return baseMapper.delete(updateWrapper)>0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|