Compare commits
No commits in common. "e7027087c1098d73c2773a394670f1079e59f2a4" and "0918a6e0bfce056035ad2350881ef01baa516376" have entirely different histories.
e7027087c1
...
0918a6e0bf
|
|
@ -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.getVersion() != null ? standard.getVersion().toString() : null);
|
detail.setVersionNo(standard.getVersionNo());
|
||||||
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,14 +252,11 @@ 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.setVersion(versionNo);
|
standard.setVersionNo(qo.getVersionNo());
|
||||||
standard.setPackagingMethodId(qo.getPackagingMethodId());
|
standard.setPackagingMethodId(qo.getPackagingMethodId());
|
||||||
standard.setInspectionCycle(qo.getInspectionCycle());
|
standard.setInspectionCycle(qo.getInspectionCycle());
|
||||||
// 默认值
|
// 默认值
|
||||||
|
|
@ -275,38 +272,12 @@ 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 编辑请求参数
|
||||||
|
|
@ -328,10 +299,11 @@ 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());
|
||||||
// 审计字段
|
// 审计字段
|
||||||
|
|
@ -340,6 +312,9 @@ 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,8 +1,11 @@
|
||||||
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;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 检验标准新增参数
|
* 检验标准新增参数
|
||||||
*/
|
*/
|
||||||
|
|
@ -25,6 +28,11 @@ public class QmsInspectionStandardAddQO {
|
||||||
*/
|
*/
|
||||||
private String drawingUrl;
|
private String drawingUrl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 版本号
|
||||||
|
*/
|
||||||
|
private String versionNo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 包装方式ID
|
* 包装方式ID
|
||||||
*/
|
*/
|
||||||
|
|
@ -34,4 +42,10 @@ 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 Integer version;
|
private String versionNo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 是否启用
|
* 是否启用
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue