部件判断重复接口(增加新增入库区分验证 新增入库只入库仓库不存在的
This commit is contained in:
parent
adb8eb7011
commit
96c44aa9e1
@ -13,4 +13,8 @@ public class ReqValidateComponentExistenceDto {
|
|||||||
* 部件类型编号 如代表电池,头盔等
|
* 部件类型编号 如代表电池,头盔等
|
||||||
*/
|
*/
|
||||||
private String componentType;
|
private String componentType;
|
||||||
|
/**
|
||||||
|
* 是否新增入库
|
||||||
|
*/
|
||||||
|
private Boolean isNew = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -545,14 +545,19 @@ public class EbikeComponentServiceImpl implements EbikeComponentService {
|
|||||||
|
|
||||||
return JsonResult.success(resComponentOutRecordInfoDto);
|
return JsonResult.success(resComponentOutRecordInfoDto);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 根据部件编号 和部件类型验证仓库中是否已经存在
|
||||||
|
* @params
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public JsonResult<?> validateComponentExistence(ReqValidateComponentExistenceDto params) {
|
public JsonResult<?> validateComponentExistence(ReqValidateComponentExistenceDto params) {
|
||||||
try {
|
try {
|
||||||
String componentCode = params.getComponentCode();
|
String componentCode = params.getComponentCode();
|
||||||
String componentType = params.getComponentType();
|
String componentType = params.getComponentType();
|
||||||
|
Boolean isNew = params.getIsNew();
|
||||||
// 检查是否存在重复记录
|
// 检查是否存在重复记录
|
||||||
boolean duplicateEntry = isDuplicateEntry(componentCode, componentType);
|
boolean duplicateEntry = isDuplicateEntry(componentCode, componentType,isNew);
|
||||||
// 返回成功响应
|
// 返回成功响应
|
||||||
return JsonResult.success(duplicateEntry);
|
return JsonResult.success(duplicateEntry);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@ -808,11 +813,13 @@ public class EbikeComponentServiceImpl implements EbikeComponentService {
|
|||||||
ebikeComponentOutRecords.setState("2");
|
ebikeComponentOutRecords.setState("2");
|
||||||
ebikeComponentOutRecordsMapper.update(ebikeComponentOutRecords);
|
ebikeComponentOutRecordsMapper.update(ebikeComponentOutRecords);
|
||||||
}
|
}
|
||||||
public boolean isDuplicateEntry(String itemCode,String componentType) {
|
public boolean isDuplicateEntry(String itemCode,String componentType,Boolean isNew) {
|
||||||
QueryWrapper query = new QueryWrapper();
|
QueryWrapper query = new QueryWrapper();
|
||||||
query.eq("item_code", itemCode);
|
query.eq("item_code", itemCode);
|
||||||
query.eq("component_type", componentType);
|
query.eq("component_type", componentType);
|
||||||
|
if(!isNew){
|
||||||
query.eq("state", 1); // 假设 1 表示已已入库
|
query.eq("state", 1); // 假设 1 表示已已入库
|
||||||
|
}
|
||||||
long count = ebikeComponentInventoryMapper.selectCountByQuery(query); // 查询符合条件的记录数
|
long count = ebikeComponentInventoryMapper.selectCountByQuery(query); // 查询符合条件的记录数
|
||||||
return count > 0; // 如果记录数大于 0,说明已经存在重复入库
|
return count > 0; // 如果记录数大于 0,说明已经存在重复入库
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user