feat(wms): 更新钢卷号重复检查功能支持修改场景
- 在 checkCoilNoDuplicate 方法中添加 coilId 参数以支持修改操作 - 修改控制器层接口,增加可选的 coilId 请求参数 - 实现修改操作时排除自身的重复检查逻辑 - 添加历史数据类型验证,防止对已更新钢卷进行操作 - 在钢卷修改和删除方法中增加 dataType 为 0 的历史数据检查
This commit is contained in:
@@ -266,9 +266,10 @@ public class WmsMaterialCoilController extends BaseController {
|
|||||||
*/
|
*/
|
||||||
@GetMapping("/checkCoilNoDuplicate")
|
@GetMapping("/checkCoilNoDuplicate")
|
||||||
public R<Map<String, Object>> checkCoilNoDuplicate(
|
public R<Map<String, Object>> checkCoilNoDuplicate(
|
||||||
|
@RequestParam(required = false) Long coilId,
|
||||||
@RequestParam(required = false) String enterCoilNo,
|
@RequestParam(required = false) String enterCoilNo,
|
||||||
@RequestParam(required = false) String currentCoilNo) {
|
@RequestParam(required = false) String currentCoilNo) {
|
||||||
Map<String, Object> result = iWmsMaterialCoilService.checkCoilNoDuplicate(enterCoilNo, currentCoilNo);
|
Map<String, Object> result = iWmsMaterialCoilService.checkCoilNoDuplicate(coilId,enterCoilNo, currentCoilNo);
|
||||||
return R.ok(result);
|
return R.ok(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ public interface IWmsMaterialCoilService {
|
|||||||
* - enterCoilNoDuplicate: 入场钢卷号是否重复 (true/false)
|
* - enterCoilNoDuplicate: 入场钢卷号是否重复 (true/false)
|
||||||
* - currentCoilNoDuplicate: 当前钢卷号是否重复 (true/false)
|
* - currentCoilNoDuplicate: 当前钢卷号是否重复 (true/false)
|
||||||
*/
|
*/
|
||||||
Map<String, Object> checkCoilNoDuplicate(String enterCoilNo, String currentCoilNo);
|
Map<String, Object> checkCoilNoDuplicate(Long coilId, String enterCoilNo, String currentCoilNo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据入场钢卷号前缀查询最大的入场钢卷号
|
* 根据入场钢卷号前缀查询最大的入场钢卷号
|
||||||
|
|||||||
@@ -984,6 +984,10 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
|||||||
if (oldCoil == null) {
|
if (oldCoil == null) {
|
||||||
throw new RuntimeException("钢卷不存在");
|
throw new RuntimeException("钢卷不存在");
|
||||||
}
|
}
|
||||||
|
// 判断数据类型 0=历史数据 1=正常数据
|
||||||
|
if (oldCoil.getDataType() == 0) {
|
||||||
|
throw new RuntimeException("原钢卷已被更新");
|
||||||
|
}
|
||||||
|
|
||||||
// 若修改实际库位,先进行校验
|
// 若修改实际库位,先进行校验
|
||||||
if (bo.getActualWarehouseId() != null) {
|
if (bo.getActualWarehouseId() != null) {
|
||||||
@@ -1033,6 +1037,11 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
|||||||
throw new RuntimeException("原钢卷不存在");
|
throw new RuntimeException("原钢卷不存在");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// oldCoil 如果是历史卷也就是date_type=0 的时候就是历史钢卷
|
||||||
|
if (oldCoil.getDataType() == 0) {
|
||||||
|
throw new RuntimeException("原钢卷已被更新");
|
||||||
|
}
|
||||||
|
|
||||||
// 若修改实际库位,先进行校验
|
// 若修改实际库位,先进行校验
|
||||||
if (bo.getActualWarehouseId() != null) {
|
if (bo.getActualWarehouseId() != null) {
|
||||||
Long ignoreOccupiedId = Objects.equals(bo.getActualWarehouseId(), oldCoil.getActualWarehouseId())
|
Long ignoreOccupiedId = Objects.equals(bo.getActualWarehouseId(), oldCoil.getActualWarehouseId())
|
||||||
@@ -2590,7 +2599,7 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
|||||||
* 根据入场钢卷号和当前钢卷号查询数据库,判断哪个钢卷号重复
|
* 根据入场钢卷号和当前钢卷号查询数据库,判断哪个钢卷号重复
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> checkCoilNoDuplicate(String enterCoilNo, String currentCoilNo) {
|
public Map<String, Object> checkCoilNoDuplicate(Long coilId, String enterCoilNo, String currentCoilNo) {
|
||||||
Map<String, Object> result = new HashMap<>();
|
Map<String, Object> result = new HashMap<>();
|
||||||
|
|
||||||
boolean enterCoilNoDuplicate = false;
|
boolean enterCoilNoDuplicate = false;
|
||||||
@@ -2602,6 +2611,10 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
|||||||
enterWrapper.eq(WmsMaterialCoil::getEnterCoilNo, enterCoilNo)
|
enterWrapper.eq(WmsMaterialCoil::getEnterCoilNo, enterCoilNo)
|
||||||
.eq(WmsMaterialCoil::getDelFlag, 0)
|
.eq(WmsMaterialCoil::getDelFlag, 0)
|
||||||
.eq(WmsMaterialCoil::getDataType, 1);
|
.eq(WmsMaterialCoil::getDataType, 1);
|
||||||
|
// 如果是修改操作,排除自身
|
||||||
|
if (coilId != null) {
|
||||||
|
enterWrapper.ne(WmsMaterialCoil::getCoilId, coilId);
|
||||||
|
}
|
||||||
long enterCount = baseMapper.selectCount(enterWrapper);
|
long enterCount = baseMapper.selectCount(enterWrapper);
|
||||||
enterCoilNoDuplicate = enterCount > 0;
|
enterCoilNoDuplicate = enterCount > 0;
|
||||||
}
|
}
|
||||||
@@ -2612,6 +2625,10 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
|||||||
currentWrapper.eq(WmsMaterialCoil::getCurrentCoilNo, currentCoilNo)
|
currentWrapper.eq(WmsMaterialCoil::getCurrentCoilNo, currentCoilNo)
|
||||||
.eq(WmsMaterialCoil::getDelFlag, 0)
|
.eq(WmsMaterialCoil::getDelFlag, 0)
|
||||||
.eq(WmsMaterialCoil::getDataType, 1);
|
.eq(WmsMaterialCoil::getDataType, 1);
|
||||||
|
// 如果是修改操作,排除自身
|
||||||
|
if (coilId != null) {
|
||||||
|
currentWrapper.ne(WmsMaterialCoil::getCoilId, coilId);
|
||||||
|
}
|
||||||
|
|
||||||
long currentCount = baseMapper.selectCount(currentWrapper);
|
long currentCount = baseMapper.selectCount(currentWrapper);
|
||||||
currentCoilNoDuplicate = currentCount > 0;
|
currentCoilNoDuplicate = currentCount > 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user