feat(service): 扩展钢卷号重复检查功能支持厂家原料卷号
- 在 checkCoilNoDuplicate 方法中新增 supplierCoilNo 参数 - 添加厂家原料卷号重复检查逻辑并排除自身记录 - 更新重复类型判断增加 supplier 选项 - 完善返回结果包含厂家原料卷号重复状态 - 同步更新控制器层接口参数传递 - 修正方法注释文档说明新增参数和返回值字段
This commit is contained in:
@@ -296,19 +296,23 @@ public class WmsMaterialCoilController extends BaseController {
|
||||
* 检查钢卷号是否重复
|
||||
* 前端传入入场钢卷号和当前钢卷号,返回哪个钢卷号重复
|
||||
*
|
||||
* @param coilId 钢卷ID(修改时传入,用于排除自身)
|
||||
* @param enterCoilNo 入场钢卷号
|
||||
* @param currentCoilNo 当前钢卷号
|
||||
* @param supplierCoilNo 厂家原料卷号
|
||||
* @return 返回结果,包含:
|
||||
* - duplicateType: "enter" (入场钢卷号重复), "current" (当前钢卷号重复), "both" (都重复), "none" (都不重复)
|
||||
* - duplicateType: "enter" (入场钢卷号重复), "current" (当前钢卷号重复), "supplier" (厂家原料卷号重复), "both" (都重复), "none" (都不重复)
|
||||
* - enterCoilNoDuplicate: 入场钢卷号是否重复
|
||||
* - currentCoilNoDuplicate: 当前钢卷号是否重复
|
||||
* - supplierCoilNoDuplicate: 厂家原料卷号是否重复
|
||||
*/
|
||||
@GetMapping("/checkCoilNoDuplicate")
|
||||
public R<Map<String, Object>> checkCoilNoDuplicate(
|
||||
@RequestParam(required = false) Long coilId,
|
||||
@RequestParam(required = false) String enterCoilNo,
|
||||
@RequestParam(required = false) String currentCoilNo) {
|
||||
Map<String, Object> result = iWmsMaterialCoilService.checkCoilNoDuplicate(coilId,enterCoilNo, currentCoilNo);
|
||||
@RequestParam(required = false) String currentCoilNo,
|
||||
@RequestParam(required = false) String supplierCoilNo) {
|
||||
Map<String, Object> result = iWmsMaterialCoilService.checkCoilNoDuplicate(coilId, enterCoilNo, currentCoilNo, supplierCoilNo);
|
||||
return R.ok(result);
|
||||
}
|
||||
|
||||
|
||||
@@ -139,16 +139,19 @@ public interface IWmsMaterialCoilService {
|
||||
|
||||
/**
|
||||
* 检查钢卷号是否重复
|
||||
* 根据入场钢卷号和当前钢卷号查询数据库,判断哪个钢卷号重复
|
||||
* 根据入场钢卷号、当前钢卷号和厂家原料卷号查询数据库,判断哪个钢卷号重复
|
||||
*
|
||||
* @param coilId 钢卷ID(修改时传入,用于排除自身)
|
||||
* @param enterCoilNo 入场钢卷号
|
||||
* @param currentCoilNo 当前钢卷号
|
||||
* @param supplierCoilNo 厂家原料卷号
|
||||
* @return 返回结果Map,包含:
|
||||
* - duplicateType: "enter" (入场钢卷号重复), "current" (当前钢卷号重复), "both" (都重复), "none" (都不重复)
|
||||
* - duplicateType: "enter" (入场钢卷号重复), "current" (当前钢卷号重复), "supplier" (厂家原料卷号重复), "both" (都重复), "none" (都不重复)
|
||||
* - enterCoilNoDuplicate: 入场钢卷号是否重复 (true/false)
|
||||
* - currentCoilNoDuplicate: 当前钢卷号是否重复 (true/false)
|
||||
* - supplierCoilNoDuplicate: 厂家原料卷号是否重复 (true/false)
|
||||
*/
|
||||
Map<String, Object> checkCoilNoDuplicate(Long coilId, String enterCoilNo, String currentCoilNo);
|
||||
Map<String, Object> checkCoilNoDuplicate(Long coilId, String enterCoilNo, String currentCoilNo, String supplierCoilNo);
|
||||
|
||||
/**
|
||||
* 根据入场钢卷号前缀查询最大的入场钢卷号
|
||||
|
||||
@@ -2784,11 +2784,11 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
||||
|
||||
/**
|
||||
* 检查钢卷号是否重复
|
||||
* 根据入场钢卷号和当前钢卷号查询数据库,判断哪个钢卷号重复
|
||||
* 根据入场钢卷号、当前钢卷号和厂家原料卷号查询数据库,判断哪个钢卷号重复
|
||||
* 新增逻辑:修改历史记录时不检查重复
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> checkCoilNoDuplicate(Long coilId, String enterCoilNo, String currentCoilNo) {
|
||||
public Map<String, Object> checkCoilNoDuplicate(Long coilId, String enterCoilNo, String currentCoilNo, String supplierCoilNo) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
|
||||
// 新增核心逻辑:先判断是否操作的是历史记录
|
||||
@@ -2800,12 +2800,14 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
||||
result.put("duplicateType", "none");
|
||||
result.put("enterCoilNoDuplicate", false);
|
||||
result.put("currentCoilNoDuplicate", false);
|
||||
result.put("supplierCoilNoDuplicate", false);
|
||||
return result; // 直接返回,不执行后续检查
|
||||
}
|
||||
}
|
||||
|
||||
boolean enterCoilNoDuplicate = false;
|
||||
boolean currentCoilNoDuplicate = false;
|
||||
boolean supplierCoilNoDuplicate = false;
|
||||
|
||||
// 检查入场钢卷号是否重复
|
||||
if (StringUtils.isNotBlank(enterCoilNo)) {
|
||||
@@ -2836,14 +2838,31 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
||||
currentCoilNoDuplicate = currentCount > 0;
|
||||
}
|
||||
|
||||
// 检查厂家原料卷号是否重复
|
||||
if (StringUtils.isNotBlank(supplierCoilNo)) {
|
||||
LambdaQueryWrapper<WmsMaterialCoil> supplierWrapper = Wrappers.lambdaQuery();
|
||||
supplierWrapper.eq(WmsMaterialCoil::getSupplierCoilNo, supplierCoilNo)
|
||||
.eq(WmsMaterialCoil::getDelFlag, 0)
|
||||
.eq(WmsMaterialCoil::getDataType, 1);
|
||||
// 如果是修改操作,排除自身
|
||||
if (coilId != null) {
|
||||
supplierWrapper.ne(WmsMaterialCoil::getCoilId, coilId);
|
||||
}
|
||||
|
||||
long supplierCount = baseMapper.selectCount(supplierWrapper);
|
||||
supplierCoilNoDuplicate = supplierCount > 0;
|
||||
}
|
||||
|
||||
// 判断重复类型
|
||||
String duplicateType;
|
||||
if (enterCoilNoDuplicate && currentCoilNoDuplicate) {
|
||||
if (enterCoilNoDuplicate && currentCoilNoDuplicate && supplierCoilNoDuplicate) {
|
||||
duplicateType = "both";
|
||||
} else if (enterCoilNoDuplicate) {
|
||||
duplicateType = "enter";
|
||||
} else if (currentCoilNoDuplicate) {
|
||||
duplicateType = "current";
|
||||
} else if (supplierCoilNoDuplicate) {
|
||||
duplicateType = "supplier";
|
||||
} else {
|
||||
duplicateType = "none";
|
||||
}
|
||||
@@ -2851,6 +2870,7 @@ public class WmsMaterialCoilServiceImpl implements IWmsMaterialCoilService {
|
||||
result.put("duplicateType", duplicateType);
|
||||
result.put("enterCoilNoDuplicate", enterCoilNoDuplicate);
|
||||
result.put("currentCoilNoDuplicate", currentCoilNoDuplicate);
|
||||
result.put("supplierCoilNoDuplicate", supplierCoilNoDuplicate);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user