修复BUG

This commit is contained in:
刘名喜 2024-12-18 11:25:10 +08:00
parent faa93f5d7b
commit 79d23c9e99
2 changed files with 31 additions and 37 deletions

View File

@ -1,31 +1,29 @@
package com.ktg.mes.wm.service.impl; package com.ktg.mes.wm.service.impl;
import java.util.List;
import java.util.stream.Collectors;
import com.ktg.common.constant.UserConstants; import com.ktg.common.constant.UserConstants;
import com.ktg.common.utils.DateUtils; import com.ktg.common.utils.DateUtils;
import com.ktg.common.utils.StringUtils; import com.ktg.common.utils.StringUtils;
import com.ktg.mes.md.mapper.BaseKnifeMapper; import com.ktg.mes.md.mapper.BaseKnifeMapper;
import com.ktg.mes.wm.domain.WmStorageArea; import com.ktg.mes.wm.domain.WmStorageArea;
import com.ktg.mes.wm.domain.WmStorageLocation;
import com.ktg.mes.wm.domain.vo.WmStorageLocationVo; import com.ktg.mes.wm.domain.vo.WmStorageLocationVo;
import com.ktg.mes.wm.mapper.WmStorageAreaMapper; import com.ktg.mes.wm.mapper.WmStorageAreaMapper;
import org.apache.catalina.User; import com.ktg.mes.wm.mapper.WmStorageLocationMapper;
import com.ktg.mes.wm.service.IWmStorageLocationService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.ktg.mes.wm.mapper.WmStorageLocationMapper;
import com.ktg.mes.wm.domain.WmStorageLocation; import java.util.List;
import com.ktg.mes.wm.service.IWmStorageLocationService; import java.util.stream.Collectors;
/** /**
* 库区设置Service业务层处理 * 库区设置Service业务层处理
* *
* @author yinjinlu * @author yinjinlu
* @date 2022-05-07 * @date 2022-05-07
*/ */
@Service @Service
public class WmStorageLocationServiceImpl implements IWmStorageLocationService public class WmStorageLocationServiceImpl implements IWmStorageLocationService {
{
@Autowired @Autowired
private WmStorageLocationMapper wmStorageLocationMapper; private WmStorageLocationMapper wmStorageLocationMapper;
@ -37,13 +35,12 @@ public class WmStorageLocationServiceImpl implements IWmStorageLocationService
/** /**
* 查询库区设置 * 查询库区设置
* *
* @param locationId 库区设置主键 * @param locationId 库区设置主键
* @return 库区设置 * @return 库区设置
*/ */
@Override @Override
public WmStorageLocation selectWmStorageLocationByLocationId(Long locationId) public WmStorageLocation selectWmStorageLocationByLocationId(Long locationId) {
{
return wmStorageLocationMapper.selectWmStorageLocationByLocationId(locationId); return wmStorageLocationMapper.selectWmStorageLocationByLocationId(locationId);
} }
@ -54,10 +51,10 @@ public class WmStorageLocationServiceImpl implements IWmStorageLocationService
* @return 库区设置 * @return 库区设置
*/ */
@Override @Override
public WmStorageLocationVo selectWmStorageLocationVoByLocationId(Long locationId) public WmStorageLocationVo selectWmStorageLocationVoByLocationId(Long locationId) {
{
return wmStorageLocationMapper.selectWmStorageLocationByVoLocationId(locationId); return wmStorageLocationMapper.selectWmStorageLocationByVoLocationId(locationId);
} }
@Override @Override
public WmStorageLocation selectWmStorageLocationByLocationCode(String locationCode) { public WmStorageLocation selectWmStorageLocationByLocationCode(String locationCode) {
return wmStorageLocationMapper.selectWmStorageLocationByLocationCode(locationCode); return wmStorageLocationMapper.selectWmStorageLocationByLocationCode(locationCode);
@ -65,13 +62,12 @@ public class WmStorageLocationServiceImpl implements IWmStorageLocationService
/** /**
* 查询库区设置列表 * 查询库区设置列表
* *
* @param wmStorageLocation 库区设置 * @param wmStorageLocation 库区设置
* @return 库区设置 * @return 库区设置
*/ */
@Override @Override
public List<WmStorageLocation> selectWmStorageLocationList(WmStorageLocation wmStorageLocation) public List<WmStorageLocation> selectWmStorageLocationList(WmStorageLocation wmStorageLocation) {
{
return wmStorageLocationMapper.selectWmStorageLocationList(wmStorageLocation); return wmStorageLocationMapper.selectWmStorageLocationList(wmStorageLocation);
} }
@ -82,16 +78,15 @@ public class WmStorageLocationServiceImpl implements IWmStorageLocationService
* @return 库区设置 * @return 库区设置
*/ */
@Override @Override
public List<WmStorageLocationVo> selectWmStorageLocationListVo(WmStorageLocation wmStorageLocation) public List<WmStorageLocationVo> selectWmStorageLocationListVo(WmStorageLocation wmStorageLocation) {
{
return wmStorageLocationMapper.selectWmStorageLocationListVo(wmStorageLocation); return wmStorageLocationMapper.selectWmStorageLocationListVo(wmStorageLocation);
} }
@Override @Override
public String checkLocationCodeUnique(WmStorageLocation wmStorageLocation) { public String checkLocationCodeUnique(WmStorageLocation wmStorageLocation) {
WmStorageLocation location = wmStorageLocationMapper.checkLocationCodeUnique(wmStorageLocation); WmStorageLocation location = wmStorageLocationMapper.checkLocationCodeUnique(wmStorageLocation);
Long locationId = wmStorageLocation.getLocationId()==null?-1L:wmStorageLocation.getLocationId(); Long locationId = wmStorageLocation.getLocationId() == null ? -1L : wmStorageLocation.getLocationId();
if(StringUtils.isNotNull(location) && location.getLocationId().longValue() != locationId.longValue()){ if (StringUtils.isNotNull(location) && location.getLocationId().longValue() != locationId.longValue()) {
return UserConstants.NOT_UNIQUE; return UserConstants.NOT_UNIQUE;
} }
return UserConstants.UNIQUE; return UserConstants.UNIQUE;
@ -100,8 +95,8 @@ public class WmStorageLocationServiceImpl implements IWmStorageLocationService
@Override @Override
public String checkLocationNameUnique(WmStorageLocation wmStorageLocation) { public String checkLocationNameUnique(WmStorageLocation wmStorageLocation) {
WmStorageLocation location = wmStorageLocationMapper.checkLocationNameUnique(wmStorageLocation); WmStorageLocation location = wmStorageLocationMapper.checkLocationNameUnique(wmStorageLocation);
Long locationId = wmStorageLocation.getLocationId()==null?-1L:wmStorageLocation.getLocationId(); Long locationId = wmStorageLocation.getLocationId() == null ? -1L : wmStorageLocation.getLocationId();
if(StringUtils.isNotNull(location) && location.getLocationId().longValue() != locationId.longValue()){ if (StringUtils.isNotNull(location) && location.getLocationId().longValue() != locationId.longValue()) {
return UserConstants.NOT_UNIQUE; return UserConstants.NOT_UNIQUE;
} }
return UserConstants.UNIQUE; return UserConstants.UNIQUE;
@ -109,51 +104,47 @@ public class WmStorageLocationServiceImpl implements IWmStorageLocationService
/** /**
* 新增库区设置 * 新增库区设置
* *
* @param wmStorageLocation 库区设置 * @param wmStorageLocation 库区设置
* @return 结果 * @return 结果
*/ */
@Override @Override
public int insertWmStorageLocation(WmStorageLocation wmStorageLocation) public int insertWmStorageLocation(WmStorageLocation wmStorageLocation) {
{
wmStorageLocation.setCreateTime(DateUtils.getNowDate()); wmStorageLocation.setCreateTime(DateUtils.getNowDate());
return wmStorageLocationMapper.insertWmStorageLocation(wmStorageLocation); return wmStorageLocationMapper.insertWmStorageLocation(wmStorageLocation);
} }
/** /**
* 修改库区设置 * 修改库区设置
* *
* @param wmStorageLocation 库区设置 * @param wmStorageLocation 库区设置
* @return 结果 * @return 结果
*/ */
@Override @Override
public int updateWmStorageLocation(WmStorageLocation wmStorageLocation) public int updateWmStorageLocation(WmStorageLocation wmStorageLocation) {
{
wmStorageLocation.setUpdateTime(DateUtils.getNowDate()); wmStorageLocation.setUpdateTime(DateUtils.getNowDate());
return wmStorageLocationMapper.updateWmStorageLocation(wmStorageLocation); return wmStorageLocationMapper.updateWmStorageLocation(wmStorageLocation);
} }
/** /**
* 批量删除库区设置 * 批量删除库区设置
* *
* @param locationIds 需要删除的库区设置主键 * @param locationIds 需要删除的库区设置主键
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteWmStorageLocationByLocationIds(Long[] locationIds) public int deleteWmStorageLocationByLocationIds(Long[] locationIds) {
{
return wmStorageLocationMapper.deleteWmStorageLocationByLocationIds(locationIds); return wmStorageLocationMapper.deleteWmStorageLocationByLocationIds(locationIds);
} }
/** /**
* 删除库区设置信息 * 删除库区设置信息
* *
* @param locationId 库区设置主键 * @param locationId 库区设置主键
* @return 结果 * @return 结果
*/ */
@Override @Override
public int deleteWmStorageLocationByLocationId(Long locationId) public int deleteWmStorageLocationByLocationId(Long locationId) {
{
return wmStorageLocationMapper.deleteWmStorageLocationByLocationId(locationId); return wmStorageLocationMapper.deleteWmStorageLocationByLocationId(locationId);
} }
@ -174,7 +165,7 @@ public class WmStorageLocationServiceImpl implements IWmStorageLocationService
// 获取库位列表 // 获取库位列表
WmStorageArea wmStorageAreaQuery = new WmStorageArea(); WmStorageArea wmStorageAreaQuery = new WmStorageArea();
wmStorageAreaQuery.setLocationId(wmStorageLocationByCode.getLocationId()); wmStorageAreaQuery.setLocationId(wmStorageLocationByCode.getLocationId());
if (isBig) wmStorageAreaQuery.setAttr3(1L); wmStorageAreaQuery.setAttr3(isBig ? 1L : 0L);
List<WmStorageArea> wmStorageAreaList = this.wmStorageAreaMapper.selectWmStorageAreaList(wmStorageAreaQuery).stream() List<WmStorageArea> wmStorageAreaList = this.wmStorageAreaMapper.selectWmStorageAreaList(wmStorageAreaQuery).stream()
// 过滤掉全部存在物品的库位 // 过滤掉全部存在物品的库位
.filter(it -> !selectNotEmptyAreaCodeList.contains(it.getAreaCode())) .filter(it -> !selectNotEmptyAreaCodeList.contains(it.getAreaCode()))

View File

@ -92,6 +92,9 @@
<if test="maxLoa != null"> <if test="maxLoa != null">
and max_loa = #{maxLoa} and max_loa = #{maxLoa}
</if> </if>
<if test="attr3 != null">
and attr3 = #{attr3}
</if>
<if test="positionX != null and positionX != 0"> <if test="positionX != null and positionX != 0">
and position_x = #{positionX} and position_x = #{positionX}
</if> </if>