Merge branch 'qms/develop' into qms/yf
This commit is contained in:
commit
e7027087c1
|
|
@ -155,7 +155,7 @@ public class QmsInspectionStandardControllerService {
|
||||||
detail.setMaterialId(standard.getMaterialId());
|
detail.setMaterialId(standard.getMaterialId());
|
||||||
detail.setInspectionTaskItemId(standard.getInspectionTaskItemId());
|
detail.setInspectionTaskItemId(standard.getInspectionTaskItemId());
|
||||||
detail.setDrawingUrl(standard.getDrawingUrl());
|
detail.setDrawingUrl(standard.getDrawingUrl());
|
||||||
detail.setVersionNo(standard.getVersionNo());
|
detail.setVersionNo(standard.getVersion() != null ? standard.getVersion().toString() : null);
|
||||||
detail.setIsEnabled(standard.getIsEnabled());
|
detail.setIsEnabled(standard.getIsEnabled());
|
||||||
detail.setPackagingMethodId(standard.getPackagingMethodId());
|
detail.setPackagingMethodId(standard.getPackagingMethodId());
|
||||||
detail.setInspectionCycle(standard.getInspectionCycle());
|
detail.setInspectionCycle(standard.getInspectionCycle());
|
||||||
|
|
@ -242,7 +242,7 @@ public class QmsInspectionStandardControllerService {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增检验标准(包含检测项列表)
|
* 新增检验标准
|
||||||
* @param qo 新增请求参数
|
* @param qo 新增请求参数
|
||||||
* @return 新增的检验标准ID
|
* @return 新增的检验标准ID
|
||||||
*/
|
*/
|
||||||
|
|
@ -252,11 +252,14 @@ public class QmsInspectionStandardControllerService {
|
||||||
String userName = UserUtil.getUserName();
|
String userName = UserUtil.getUserName();
|
||||||
LocalDateTime now = LocalDateTime.now();
|
LocalDateTime now = LocalDateTime.now();
|
||||||
|
|
||||||
|
// 自动生成版本号:查询该物料已发布的最大版本号,如果存在则加1,否则默认为1
|
||||||
|
Integer versionNo = generateVersionNo(qo.getMaterialId());
|
||||||
|
|
||||||
QmsInspectionStandard standard = new QmsInspectionStandard();
|
QmsInspectionStandard standard = new QmsInspectionStandard();
|
||||||
standard.setMaterialId(qo.getMaterialId());
|
standard.setMaterialId(qo.getMaterialId());
|
||||||
standard.setInspectionTaskItemId(qo.getInspectionTaskItemId());
|
standard.setInspectionTaskItemId(qo.getInspectionTaskItemId());
|
||||||
standard.setDrawingUrl(qo.getDrawingUrl());
|
standard.setDrawingUrl(qo.getDrawingUrl());
|
||||||
standard.setVersionNo(qo.getVersionNo());
|
standard.setVersion(versionNo);
|
||||||
standard.setPackagingMethodId(qo.getPackagingMethodId());
|
standard.setPackagingMethodId(qo.getPackagingMethodId());
|
||||||
standard.setInspectionCycle(qo.getInspectionCycle());
|
standard.setInspectionCycle(qo.getInspectionCycle());
|
||||||
// 默认值
|
// 默认值
|
||||||
|
|
@ -272,12 +275,38 @@ public class QmsInspectionStandardControllerService {
|
||||||
|
|
||||||
inspectionStandardService.save(standard);
|
inspectionStandardService.save(standard);
|
||||||
|
|
||||||
// 处理检测项列表
|
|
||||||
processItems(standard.getId(), qo.getItems(), userId, userName, now);
|
|
||||||
|
|
||||||
return standard.getId();
|
return standard.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成版本号:查询该物料已发布的最大版本号,如果存在则加1,否则默认为1
|
||||||
|
* @param materialId 物料ID
|
||||||
|
* @return 版本号
|
||||||
|
*/
|
||||||
|
private Integer generateVersionNo(Long materialId) {
|
||||||
|
// 查询该物料已发布的检验标准
|
||||||
|
List<QmsInspectionStandard> publishedStandards = inspectionStandardService.lambdaQuery()
|
||||||
|
.eq(QmsInspectionStandard::getMaterialId, materialId)
|
||||||
|
.eq(QmsInspectionStandard::getPublishStatus, 1)
|
||||||
|
.isNotNull(QmsInspectionStandard::getVersion)
|
||||||
|
.list();
|
||||||
|
|
||||||
|
if (publishedStandards == null || publishedStandards.isEmpty()) {
|
||||||
|
// 如果没有已发布的版本,默认版本号为1
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查找最大版本号
|
||||||
|
int maxVersion = publishedStandards.stream()
|
||||||
|
.map(QmsInspectionStandard::getVersion)
|
||||||
|
.mapToInt(version -> version != null ? version : 0)
|
||||||
|
.max()
|
||||||
|
.orElse(0);
|
||||||
|
|
||||||
|
// 返回最大版本号加1
|
||||||
|
return maxVersion + 1;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 编辑检验标准(包含检测项列表)
|
* 编辑检验标准(包含检测项列表)
|
||||||
* @param qo 编辑请求参数
|
* @param qo 编辑请求参数
|
||||||
|
|
@ -299,11 +328,10 @@ public class QmsInspectionStandardControllerService {
|
||||||
String userName = UserUtil.getUserName();
|
String userName = UserUtil.getUserName();
|
||||||
LocalDateTime now = LocalDateTime.now();
|
LocalDateTime now = LocalDateTime.now();
|
||||||
|
|
||||||
// 3. 更新字段
|
// 3. 更新字段(不修改版本号)
|
||||||
standard.setMaterialId(qo.getMaterialId());
|
standard.setMaterialId(qo.getMaterialId());
|
||||||
standard.setInspectionTaskItemId(qo.getInspectionTaskItemId());
|
standard.setInspectionTaskItemId(qo.getInspectionTaskItemId());
|
||||||
standard.setDrawingUrl(qo.getDrawingUrl());
|
standard.setDrawingUrl(qo.getDrawingUrl());
|
||||||
standard.setVersionNo(qo.getVersionNo());
|
|
||||||
standard.setPackagingMethodId(qo.getPackagingMethodId());
|
standard.setPackagingMethodId(qo.getPackagingMethodId());
|
||||||
standard.setInspectionCycle(qo.getInspectionCycle());
|
standard.setInspectionCycle(qo.getInspectionCycle());
|
||||||
// 审计字段
|
// 审计字段
|
||||||
|
|
@ -312,9 +340,6 @@ public class QmsInspectionStandardControllerService {
|
||||||
standard.setUpdateTime(now);
|
standard.setUpdateTime(now);
|
||||||
|
|
||||||
inspectionStandardService.updateById(standard);
|
inspectionStandardService.updateById(standard);
|
||||||
|
|
||||||
// 4. 处理检测项列表
|
|
||||||
processItems(qo.getId(), qo.getItems(), userId, userName, now);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,8 @@
|
||||||
package com.nflg.wms.common.pojo.qo;
|
package com.nflg.wms.common.pojo.qo;
|
||||||
|
|
||||||
import jakarta.validation.Valid;
|
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检验标准新增参数
|
* 检验标准新增参数
|
||||||
*/
|
*/
|
||||||
|
|
@ -28,11 +25,6 @@ public class QmsInspectionStandardAddQO {
|
||||||
*/
|
*/
|
||||||
private String drawingUrl;
|
private String drawingUrl;
|
||||||
|
|
||||||
/**
|
|
||||||
* 版本号
|
|
||||||
*/
|
|
||||||
private String versionNo;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 包装方式ID
|
* 包装方式ID
|
||||||
*/
|
*/
|
||||||
|
|
@ -42,10 +34,4 @@ public class QmsInspectionStandardAddQO {
|
||||||
* 检验周期
|
* 检验周期
|
||||||
*/
|
*/
|
||||||
private Integer inspectionCycle;
|
private Integer inspectionCycle;
|
||||||
|
|
||||||
/**
|
|
||||||
* 检测项列表
|
|
||||||
*/
|
|
||||||
@Valid
|
|
||||||
private List<QmsInspectionStandardSaveQO.InspectionStandardItemQO> items;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ public class QmsInspectionStandard implements Serializable {
|
||||||
/**
|
/**
|
||||||
* 版本号
|
* 版本号
|
||||||
*/
|
*/
|
||||||
private String versionNo;
|
private Integer version;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否启用
|
* 是否启用
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue