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