编写获取一个库位接口
This commit is contained in:
parent
2b8219d01e
commit
2e81d77dee
@ -121,4 +121,6 @@ public interface BaseKnifeMapper {
|
|||||||
public Boolean isDuplicateRfid(String rfid);
|
public Boolean isDuplicateRfid(String rfid);
|
||||||
|
|
||||||
List<BaseKnife> selectBaseKnifeNotValidList(BaseKnife baseKnifeWrapper);
|
List<BaseKnife> selectBaseKnifeNotValidList(BaseKnife baseKnifeWrapper);
|
||||||
|
|
||||||
|
List<String> selectAreaCodeList();
|
||||||
}
|
}
|
||||||
|
@ -1,42 +1,34 @@
|
|||||||
package com.ktg.mes.wm.controller;
|
package com.ktg.mes.wm.controller;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
|
||||||
|
|
||||||
import com.ktg.common.constant.UserConstants;
|
|
||||||
import com.ktg.mes.wm.domain.vo.WmStorageLocationVo;
|
|
||||||
import com.ktg.mes.wm.service.IWmStorageAreaService;
|
|
||||||
import com.ktg.mes.wm.utils.WmBarCodeUtil;
|
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PutMapping;
|
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
import com.ktg.common.annotation.Log;
|
import com.ktg.common.annotation.Log;
|
||||||
|
import com.ktg.common.constant.UserConstants;
|
||||||
import com.ktg.common.core.controller.BaseController;
|
import com.ktg.common.core.controller.BaseController;
|
||||||
import com.ktg.common.core.domain.AjaxResult;
|
import com.ktg.common.core.domain.AjaxResult;
|
||||||
import com.ktg.common.enums.BusinessType;
|
|
||||||
import com.ktg.mes.wm.domain.WmStorageLocation;
|
|
||||||
import com.ktg.mes.wm.service.IWmStorageLocationService;
|
|
||||||
import com.ktg.common.utils.poi.ExcelUtil;
|
|
||||||
import com.ktg.common.core.page.TableDataInfo;
|
import com.ktg.common.core.page.TableDataInfo;
|
||||||
|
import com.ktg.common.enums.BusinessType;
|
||||||
|
import com.ktg.common.utils.poi.ExcelUtil;
|
||||||
|
import com.ktg.mes.wm.domain.WmStorageLocation;
|
||||||
|
import com.ktg.mes.wm.domain.vo.WmStorageLocationVo;
|
||||||
|
import com.ktg.mes.wm.service.IWmStorageAreaService;
|
||||||
|
import com.ktg.mes.wm.service.IWmStorageLocationService;
|
||||||
|
import com.ktg.mes.wm.utils.WmBarCodeUtil;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 库区设置Controller
|
* 库区设置Controller
|
||||||
*
|
*
|
||||||
* @author yinjinlu
|
* @author yinjinlu
|
||||||
* @date 2022-05-07
|
* @date 2022-05-07
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/mes/wm/location")
|
@RequestMapping("/mes/wm/location")
|
||||||
public class WmStorageLocationController extends BaseController
|
public class WmStorageLocationController extends BaseController {
|
||||||
{
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IWmStorageLocationService wmStorageLocationService;
|
private IWmStorageLocationService wmStorageLocationService;
|
||||||
|
|
||||||
@ -50,8 +42,7 @@ public class WmStorageLocationController extends BaseController
|
|||||||
* 查询库区设置列表
|
* 查询库区设置列表
|
||||||
*/
|
*/
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public TableDataInfo list(WmStorageLocation wmStorageLocation)
|
public TableDataInfo list(WmStorageLocation wmStorageLocation) {
|
||||||
{
|
|
||||||
startPage();
|
startPage();
|
||||||
List<WmStorageLocationVo> list = wmStorageLocationService.selectWmStorageLocationListVo(wmStorageLocation);
|
List<WmStorageLocationVo> list = wmStorageLocationService.selectWmStorageLocationListVo(wmStorageLocation);
|
||||||
return getDataTable(list);
|
return getDataTable(list);
|
||||||
@ -63,8 +54,7 @@ public class WmStorageLocationController extends BaseController
|
|||||||
@PreAuthorize("@ss.hasPermi('mes:wm:location:export')")
|
@PreAuthorize("@ss.hasPermi('mes:wm:location:export')")
|
||||||
@Log(title = "库区设置", businessType = BusinessType.EXPORT)
|
@Log(title = "库区设置", businessType = BusinessType.EXPORT)
|
||||||
@PostMapping("/export")
|
@PostMapping("/export")
|
||||||
public void export(HttpServletResponse response, WmStorageLocation wmStorageLocation)
|
public void export(HttpServletResponse response, WmStorageLocation wmStorageLocation) {
|
||||||
{
|
|
||||||
List<WmStorageLocation> list = wmStorageLocationService.selectWmStorageLocationList(wmStorageLocation);
|
List<WmStorageLocation> list = wmStorageLocationService.selectWmStorageLocationList(wmStorageLocation);
|
||||||
ExcelUtil<WmStorageLocation> util = new ExcelUtil<WmStorageLocation>(WmStorageLocation.class);
|
ExcelUtil<WmStorageLocation> util = new ExcelUtil<WmStorageLocation>(WmStorageLocation.class);
|
||||||
util.exportExcel(response, list, "库区设置数据");
|
util.exportExcel(response, list, "库区设置数据");
|
||||||
@ -75,8 +65,7 @@ public class WmStorageLocationController extends BaseController
|
|||||||
*/
|
*/
|
||||||
@PreAuthorize("@ss.hasPermi('mes:wm:location:query')")
|
@PreAuthorize("@ss.hasPermi('mes:wm:location:query')")
|
||||||
@GetMapping(value = "/{locationId}")
|
@GetMapping(value = "/{locationId}")
|
||||||
public AjaxResult getInfo(@PathVariable("locationId") Long locationId)
|
public AjaxResult getInfo(@PathVariable("locationId") Long locationId) {
|
||||||
{
|
|
||||||
return AjaxResult.success(wmStorageLocationService.selectWmStorageLocationVoByLocationId(locationId));
|
return AjaxResult.success(wmStorageLocationService.selectWmStorageLocationVoByLocationId(locationId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,16 +75,15 @@ public class WmStorageLocationController extends BaseController
|
|||||||
@PreAuthorize("@ss.hasPermi('mes:wm:location:add')")
|
@PreAuthorize("@ss.hasPermi('mes:wm:location:add')")
|
||||||
@Log(title = "库区设置", businessType = BusinessType.INSERT)
|
@Log(title = "库区设置", businessType = BusinessType.INSERT)
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public AjaxResult add(@RequestBody WmStorageLocation wmStorageLocation)
|
public AjaxResult add(@RequestBody WmStorageLocation wmStorageLocation) {
|
||||||
{
|
if (UserConstants.NOT_UNIQUE.equals(wmStorageLocationService.checkLocationCodeUnique(wmStorageLocation))) {
|
||||||
if(UserConstants.NOT_UNIQUE.equals(wmStorageLocationService.checkLocationCodeUnique(wmStorageLocation))){
|
|
||||||
return AjaxResult.error("库区编码已存在!");
|
return AjaxResult.error("库区编码已存在!");
|
||||||
}
|
}
|
||||||
if(UserConstants.NOT_UNIQUE.equals(wmStorageLocationService.checkLocationNameUnique(wmStorageLocation))){
|
if (UserConstants.NOT_UNIQUE.equals(wmStorageLocationService.checkLocationNameUnique(wmStorageLocation))) {
|
||||||
return AjaxResult.error("库区名称已存在!");
|
return AjaxResult.error("库区名称已存在!");
|
||||||
}
|
}
|
||||||
wmStorageLocationService.insertWmStorageLocation(wmStorageLocation);
|
wmStorageLocationService.insertWmStorageLocation(wmStorageLocation);
|
||||||
wmBarCodeUtil.generateBarCode(UserConstants.BARCODE_TYPE_WAREHOUSE,wmStorageLocation.getLocationId(),wmStorageLocation.getLocationCode(),wmStorageLocation.getLocationName());
|
wmBarCodeUtil.generateBarCode(UserConstants.BARCODE_TYPE_WAREHOUSE, wmStorageLocation.getLocationId(), wmStorageLocation.getLocationCode(), wmStorageLocation.getLocationName());
|
||||||
return AjaxResult.success(wmStorageLocation.getLocationId());
|
return AjaxResult.success(wmStorageLocation.getLocationId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,8 +93,7 @@ public class WmStorageLocationController extends BaseController
|
|||||||
@PreAuthorize("@ss.hasPermi('mes:wm:location:edit')")
|
@PreAuthorize("@ss.hasPermi('mes:wm:location:edit')")
|
||||||
@Log(title = "库区设置", businessType = BusinessType.UPDATE)
|
@Log(title = "库区设置", businessType = BusinessType.UPDATE)
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public AjaxResult edit(@RequestBody WmStorageLocation wmStorageLocation)
|
public AjaxResult edit(@RequestBody WmStorageLocation wmStorageLocation) {
|
||||||
{
|
|
||||||
return toAjax(wmStorageLocationService.updateWmStorageLocation(wmStorageLocation));
|
return toAjax(wmStorageLocationService.updateWmStorageLocation(wmStorageLocation));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,13 +103,12 @@ public class WmStorageLocationController extends BaseController
|
|||||||
@PreAuthorize("@ss.hasPermi('mes:wm:location:remove')")
|
@PreAuthorize("@ss.hasPermi('mes:wm:location:remove')")
|
||||||
@Log(title = "库区设置", businessType = BusinessType.DELETE)
|
@Log(title = "库区设置", businessType = BusinessType.DELETE)
|
||||||
@Transactional
|
@Transactional
|
||||||
@DeleteMapping("/{locationIds}")
|
@DeleteMapping("/{locationIds}")
|
||||||
public AjaxResult remove(@PathVariable Long[] locationIds)
|
public AjaxResult remove(@PathVariable Long[] locationIds) {
|
||||||
{
|
|
||||||
//TODO:库区删除之前的逻辑校验
|
//TODO:库区删除之前的逻辑校验
|
||||||
|
|
||||||
for (Long locationId: locationIds
|
for (Long locationId : locationIds
|
||||||
) {
|
) {
|
||||||
wmStorageAreaService.deleteByLocationId(locationId);
|
wmStorageAreaService.deleteByLocationId(locationId);
|
||||||
}
|
}
|
||||||
return toAjax(wmStorageLocationService.deleteWmStorageLocationByLocationIds(locationIds));
|
return toAjax(wmStorageLocationService.deleteWmStorageLocationByLocationIds(locationIds));
|
||||||
|
@ -1,20 +1,21 @@
|
|||||||
package com.ktg.mes.wm.service;
|
package com.ktg.mes.wm.service;
|
||||||
|
|
||||||
import java.util.List;
|
import com.ktg.mes.wm.domain.WmStorageArea;
|
||||||
import com.ktg.mes.wm.domain.WmStorageLocation;
|
import com.ktg.mes.wm.domain.WmStorageLocation;
|
||||||
import com.ktg.mes.wm.domain.vo.WmStorageLocationVo;
|
import com.ktg.mes.wm.domain.vo.WmStorageLocationVo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 库区设置Service接口
|
* 库区设置Service接口
|
||||||
*
|
*
|
||||||
* @author yinjinlu
|
* @author yinjinlu
|
||||||
* @date 2022-05-07
|
* @date 2022-05-07
|
||||||
*/
|
*/
|
||||||
public interface IWmStorageLocationService
|
public interface IWmStorageLocationService {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* 查询库区设置
|
* 查询库区设置
|
||||||
*
|
*
|
||||||
* @param locationId 库区设置主键
|
* @param locationId 库区设置主键
|
||||||
* @return 库区设置
|
* @return 库区设置
|
||||||
*/
|
*/
|
||||||
@ -31,6 +32,7 @@ public interface IWmStorageLocationService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据库区编码查询库区
|
* 根据库区编码查询库区
|
||||||
|
*
|
||||||
* @param locationCode
|
* @param locationCode
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -39,7 +41,7 @@ public interface IWmStorageLocationService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询库区设置列表
|
* 查询库区设置列表
|
||||||
*
|
*
|
||||||
* @param wmStorageLocation 库区设置
|
* @param wmStorageLocation 库区设置
|
||||||
* @return 库区设置集合
|
* @return 库区设置集合
|
||||||
*/
|
*/
|
||||||
@ -55,6 +57,7 @@ public interface IWmStorageLocationService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 检查库区编码是否唯一
|
* 检查库区编码是否唯一
|
||||||
|
*
|
||||||
* @param wmStorageLocation
|
* @param wmStorageLocation
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -62,6 +65,7 @@ public interface IWmStorageLocationService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 检查库区名称是否唯一
|
* 检查库区名称是否唯一
|
||||||
|
*
|
||||||
* @param wmStorageLocation
|
* @param wmStorageLocation
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -69,7 +73,7 @@ public interface IWmStorageLocationService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增库区设置
|
* 新增库区设置
|
||||||
*
|
*
|
||||||
* @param wmStorageLocation 库区设置
|
* @param wmStorageLocation 库区设置
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@ -77,7 +81,7 @@ public interface IWmStorageLocationService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改库区设置
|
* 修改库区设置
|
||||||
*
|
*
|
||||||
* @param wmStorageLocation 库区设置
|
* @param wmStorageLocation 库区设置
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@ -85,7 +89,7 @@ public interface IWmStorageLocationService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量删除库区设置
|
* 批量删除库区设置
|
||||||
*
|
*
|
||||||
* @param locationIds 需要删除的库区设置主键集合
|
* @param locationIds 需要删除的库区设置主键集合
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@ -93,7 +97,7 @@ public interface IWmStorageLocationService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除库区设置信息
|
* 删除库区设置信息
|
||||||
*
|
*
|
||||||
* @param locationId 库区设置主键
|
* @param locationId 库区设置主键
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@ -101,8 +105,18 @@ public interface IWmStorageLocationService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据仓库删除对应的库区
|
* 根据仓库删除对应的库区
|
||||||
|
*
|
||||||
* @param warehouseId
|
* @param warehouseId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public int deleteByWarehouseId(Long warehouseId);
|
public int deleteByWarehouseId(Long warehouseId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询一个库位
|
||||||
|
*
|
||||||
|
* @param code 库区编码
|
||||||
|
* @param isBig 是否大件
|
||||||
|
* @return 库位
|
||||||
|
*/
|
||||||
|
WmStorageArea queryOneAreaByLocationCode(String code, Boolean isBig);
|
||||||
}
|
}
|
||||||
|
@ -1,39 +1,46 @@
|
|||||||
package com.ktg.mes.wm.service.impl;
|
package com.ktg.mes.wm.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
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.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 org.apache.catalina.User;
|
import com.ktg.mes.wm.mapper.WmStorageAreaMapper;
|
||||||
|
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;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private BaseKnifeMapper baseKnifeMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private WmStorageAreaMapper wmStorageAreaMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询库区设置
|
* 查询库区设置
|
||||||
*
|
*
|
||||||
* @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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,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);
|
||||||
@ -55,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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,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;
|
||||||
@ -90,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;
|
||||||
@ -99,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);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,4 +152,27 @@ public class WmStorageLocationServiceImpl implements IWmStorageLocationService
|
|||||||
public int deleteByWarehouseId(Long warehouseId) {
|
public int deleteByWarehouseId(Long warehouseId) {
|
||||||
return wmStorageLocationMapper.deleteByWarehouseId(warehouseId);
|
return wmStorageLocationMapper.deleteByWarehouseId(warehouseId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public WmStorageArea queryOneAreaByLocationCode(String code, Boolean isBig) {
|
||||||
|
// 获取库区
|
||||||
|
WmStorageLocation wmStorageLocationByCode = this.wmStorageLocationMapper.selectWmStorageLocationByLocationCode(code);
|
||||||
|
if (wmStorageLocationByCode == null) throw new RuntimeException("自动获取库位失败,该库区不存在");
|
||||||
|
|
||||||
|
// 获取台账中已经使用的库位编码
|
||||||
|
List<String> selectAreaCodeList = this.baseKnifeMapper.selectAreaCodeList();
|
||||||
|
|
||||||
|
// 获取库位列表
|
||||||
|
WmStorageArea wmStorageAreaQuery = new WmStorageArea();
|
||||||
|
wmStorageAreaQuery.setLocationId(wmStorageLocationByCode.getLocationId());
|
||||||
|
if (isBig) wmStorageAreaQuery.setAttr3(1L);
|
||||||
|
List<WmStorageArea> wmStorageAreaList = this.wmStorageAreaMapper.selectWmStorageAreaList(wmStorageAreaQuery).stream()
|
||||||
|
// 过滤掉全部存在物品的库位
|
||||||
|
.filter(it -> !selectAreaCodeList.contains(it.getAreaCode()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
if (wmStorageAreaList.isEmpty()) throw new RuntimeException("自动获取库位失败,无可用库位");
|
||||||
|
|
||||||
|
// 返回第一个可用的库位
|
||||||
|
return wmStorageAreaList.get(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -612,4 +612,10 @@
|
|||||||
FROM BASE_KNIFE
|
FROM BASE_KNIFE
|
||||||
WHERE RFID = #{value}
|
WHERE RFID = #{value}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="selectAreaCodeList" resultType="java.lang.String">
|
||||||
|
SELECT AREA_CODE
|
||||||
|
FROM BASE_KNIFE
|
||||||
|
GROUP BY AREA_CODE
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
@ -69,6 +69,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="enableFlag != null and enableFlag != ''"> and enable_flag = #{enableFlag}</if>
|
<if test="enableFlag != null and enableFlag != ''"> and enable_flag = #{enableFlag}</if>
|
||||||
and IS_DELETE = 0
|
and IS_DELETE = 0
|
||||||
</where>
|
</where>
|
||||||
|
ORDER BY AREA_CODE ASC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectWmStorageAreaListVo" parameterType="AreaVo" resultMap="WmStorageAreaVoResult">
|
<select id="selectWmStorageAreaListVo" parameterType="AreaVo" resultMap="WmStorageAreaVoResult">
|
||||||
|
Loading…
Reference in New Issue
Block a user