refactor(WmsMaterialCoilService): 移除钢卷号重复检查逻辑和步骤标识创建方法
- 删除了 createStepKey 方法,移除了基于操作类型的步骤唯一标识生成功能 - 注释掉了钢卷回滚操作中的钢卷号重复检查逻辑 - 移除了分卷、合卷、新增等操作的重复性验证代码 - 简化了子钢卷创建时的重复性检查流程
This commit is contained in:
@@ -2085,36 +2085,6 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
|||||||
return nicknameMap;
|
return nicknameMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 创建步骤唯一标识
|
|
||||||
*/
|
|
||||||
private String createStepKey(Map<String, Object> step) {
|
|
||||||
StringBuilder keyBuilder = new StringBuilder();
|
|
||||||
|
|
||||||
// 使用操作类型和主要标识符创建唯一key
|
|
||||||
String operation = (String) step.get("operation");
|
|
||||||
keyBuilder.append(operation).append("-");
|
|
||||||
|
|
||||||
// 根据操作类型使用不同的标识符
|
|
||||||
if ("分卷".equals(operation)) {
|
|
||||||
// 分卷:使用原钢卷号作为唯一标识,避免同一分卷操作的重复
|
|
||||||
keyBuilder.append(step.get("old_current_coil_no"));
|
|
||||||
} else if ("合卷".equals(operation)) {
|
|
||||||
// 合卷:使用父钢卷列表 + 新钢卷号
|
|
||||||
keyBuilder.append(step.get("parent_coil_nos")).append("->");
|
|
||||||
keyBuilder.append(step.get("new_current_coil_no"));
|
|
||||||
} else if ("新增".equals(operation)) {
|
|
||||||
// 新增:使用当前钢卷号
|
|
||||||
keyBuilder.append(step.get("current_coil_no"));
|
|
||||||
} else {
|
|
||||||
// 其他更新:使用原钢卷号 -> 新钢卷号
|
|
||||||
keyBuilder.append(step.get("old_current_coil_no")).append("->");
|
|
||||||
keyBuilder.append(step.get("new_current_coil_no"));
|
|
||||||
}
|
|
||||||
|
|
||||||
return keyBuilder.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 从step中提取钢卷号
|
* 从step中提取钢卷号
|
||||||
@@ -3168,16 +3138,16 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
|||||||
throw new RuntimeException("部分原始钢卷不存在,无法回滚");
|
throw new RuntimeException("部分原始钢卷不存在,无法回滚");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查恢复的钢卷的当前钢卷号是否重复
|
// // 检查恢复的钢卷的当前钢卷号是否重复
|
||||||
for (WmsMaterialCoil originalCoil : originalCoils) {
|
// for (WmsMaterialCoil originalCoil : originalCoils) {
|
||||||
Map<String, Object> duplicateCheck = checkCoilNoDuplicate(originalCoil.getCoilId(), originalCoil.getEnterCoilNo(), originalCoil.getCurrentCoilNo());
|
// Map<String, Object> duplicateCheck = checkCoilNoDuplicate(originalCoil.getCoilId(), originalCoil.getEnterCoilNo(), originalCoil.getCurrentCoilNo());
|
||||||
boolean currentCoilNoDuplicate = (boolean) duplicateCheck.get("currentCoilNoDuplicate");
|
// boolean currentCoilNoDuplicate = (boolean) duplicateCheck.get("currentCoilNoDuplicate");
|
||||||
if (currentCoilNoDuplicate) {
|
// if (currentCoilNoDuplicate) {
|
||||||
String errorMsg = "无法恢复原始钢卷,存在重复的钢卷号:原始钢卷的当前钢卷号[" + originalCoil.getCurrentCoilNo() + "]重复。";
|
// String errorMsg = "无法恢复原始钢卷,存在重复的钢卷号:原始钢卷的当前钢卷号[" + originalCoil.getCurrentCoilNo() + "]重复。";
|
||||||
errorMsg += "重复的钢卷无法进行回滚操作。";
|
// errorMsg += "重复的钢卷无法进行回滚操作。";
|
||||||
throw new RuntimeException(errorMsg);
|
// throw new RuntimeException(errorMsg);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 释放当前合卷钢卷占用的实际库区
|
// 释放当前合卷钢卷占用的实际库区
|
||||||
if (currentCoil.getActualWarehouseId() != null) {
|
if (currentCoil.getActualWarehouseId() != null) {
|
||||||
@@ -3283,19 +3253,19 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
|||||||
throw new RuntimeException("以下钢卷不是现存钢卷,无法回滚:" + String.join(", ", invalidCoilNos));
|
throw new RuntimeException("以下钢卷不是现存钢卷,无法回滚:" + String.join(", ", invalidCoilNos));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查恢复的母卷的当前钢卷号是否重复
|
// // 检查恢复的母卷的当前钢卷号是否重复
|
||||||
if (motherCoilId != null) {
|
// if (motherCoilId != null) {
|
||||||
WmsMaterialCoil motherCoil = baseMapper.selectById(motherCoilId);
|
// WmsMaterialCoil motherCoil = baseMapper.selectById(motherCoilId);
|
||||||
if (motherCoil != null) {
|
// if (motherCoil != null) {
|
||||||
Map<String, Object> duplicateCheck = checkCoilNoDuplicate(motherCoilId, motherCoil.getEnterCoilNo(), motherCoil.getCurrentCoilNo());
|
// Map<String, Object> duplicateCheck = checkCoilNoDuplicate(motherCoilId, motherCoil.getEnterCoilNo(), motherCoil.getCurrentCoilNo());
|
||||||
boolean currentCoilNoDuplicate = (boolean) duplicateCheck.get("currentCoilNoDuplicate");
|
// boolean currentCoilNoDuplicate = (boolean) duplicateCheck.get("currentCoilNoDuplicate");
|
||||||
if (currentCoilNoDuplicate) {
|
// if (currentCoilNoDuplicate) {
|
||||||
String errorMsg = "无法恢复母卷,存在重复的钢卷号:母卷的当前钢卷号[" + motherCoil.getCurrentCoilNo() + "]重复。";
|
// String errorMsg = "无法恢复母卷,存在重复的钢卷号:母卷的当前钢卷号[" + motherCoil.getCurrentCoilNo() + "]重复。";
|
||||||
errorMsg += "重复的钢卷无法进行回滚操作。";
|
// errorMsg += "重复的钢卷无法进行回滚操作。";
|
||||||
throw new RuntimeException(errorMsg);
|
// throw new RuntimeException(errorMsg);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 释放所有子钢卷占用的实际库区并删除所有子钢卷
|
// 释放所有子钢卷占用的实际库区并删除所有子钢卷
|
||||||
for (WmsMaterialCoil childCoil : childCoils) {
|
for (WmsMaterialCoil childCoil : childCoils) {
|
||||||
@@ -3392,14 +3362,14 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
|||||||
throw new RuntimeException("目标钢卷不是历史数据,无法恢复");
|
throw new RuntimeException("目标钢卷不是历史数据,无法恢复");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查历史钢卷的当前钢卷号是否重复
|
// // 检查历史钢卷的当前钢卷号是否重复
|
||||||
Map<String, Object> duplicateCheck = checkCoilNoDuplicate(currentCoil.getCoilId(), historyCoil.getEnterCoilNo(), historyCoil.getCurrentCoilNo());
|
// Map<String, Object> duplicateCheck = checkCoilNoDuplicate(currentCoil.getCoilId(), historyCoil.getEnterCoilNo(), historyCoil.getCurrentCoilNo());
|
||||||
boolean currentCoilNoDuplicate = (boolean) duplicateCheck.get("currentCoilNoDuplicate");
|
// boolean currentCoilNoDuplicate = (boolean) duplicateCheck.get("currentCoilNoDuplicate");
|
||||||
if (currentCoilNoDuplicate) {
|
// if (currentCoilNoDuplicate) {
|
||||||
String errorMsg = "无法恢复历史钢卷,存在重复的钢卷号:历史钢卷的当前钢卷号[" + historyCoil.getCurrentCoilNo() + "]重复。";
|
// String errorMsg = "无法恢复历史钢卷,存在重复的钢卷号:历史钢卷的当前钢卷号[" + historyCoil.getCurrentCoilNo() + "]重复。";
|
||||||
errorMsg += "重复的钢卷无法进行回滚操作。";
|
// errorMsg += "重复的钢卷无法进行回滚操作。";
|
||||||
throw new RuntimeException(errorMsg);
|
// throw new RuntimeException(errorMsg);
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 执行回滚操作
|
// 执行回滚操作
|
||||||
// 1. 释放当前钢卷占用的实际库区
|
// 1. 释放当前钢卷占用的实际库区
|
||||||
@@ -3893,11 +3863,11 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
|||||||
throw new RuntimeException("待操作记录不存在或不匹配");
|
throw new RuntimeException("待操作记录不存在或不匹配");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4. 检查子钢卷号是否重复
|
// // 4. 检查子钢卷号是否重复
|
||||||
Map<String, Object> duplicateCheck = checkCoilNoDuplicate(null, parentCoil.getEnterCoilNo(), childCoilBo.getCurrentCoilNo());
|
// Map<String, Object> duplicateCheck = checkCoilNoDuplicate(null, parentCoil.getEnterCoilNo(), childCoilBo.getCurrentCoilNo());
|
||||||
if ("current".equals(duplicateCheck.get("duplicateType")) || "both".equals(duplicateCheck.get("duplicateType"))) {
|
// if ("current".equals(duplicateCheck.get("duplicateType")) || "both".equals(duplicateCheck.get("duplicateType"))) {
|
||||||
throw new RuntimeException("子钢卷号[" + childCoilBo.getCurrentCoilNo() + "]已存在");
|
// throw new RuntimeException("子钢卷号[" + childCoilBo.getCurrentCoilNo() + "]已存在");
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 校验每个子卷的实际库位
|
// 校验每个子卷的实际库位
|
||||||
if (childCoilBo.getActualWarehouseId() != null) {
|
if (childCoilBo.getActualWarehouseId() != null) {
|
||||||
|
|||||||
Reference in New Issue
Block a user