parent
8f07dbca40
commit
6a8af1f362
|
|
@ -51,7 +51,7 @@ public class QmsCoaTaskController extends BaseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改COA通知任务(仅状态为0时可修改)
|
* 修改COA通知任务(只允许修改报告要求和报告模板,修改后状态改为0)
|
||||||
*/
|
*/
|
||||||
@Transactional
|
@Transactional
|
||||||
@PostMapping("update")
|
@PostMapping("update")
|
||||||
|
|
@ -60,6 +60,16 @@ public class QmsCoaTaskController extends BaseController {
|
||||||
return ApiResult.success();
|
return ApiResult.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 直接发布COA通知任务(状态直接变为1,并填入发送时间)
|
||||||
|
*/
|
||||||
|
@Transactional
|
||||||
|
@PostMapping("publish")
|
||||||
|
public ApiResult<Void> publish(@Valid @RequestBody QmsCoaTaskAddQO qo) {
|
||||||
|
coaTaskService.publish(qo);
|
||||||
|
return ApiResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量发送(状态改为1,填入发送时间)
|
* 批量发送(状态改为1,填入发送时间)
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,8 @@ package com.nflg.wms.common.pojo.qo;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.time.LocalDate;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改COA通知任务参数(id必传,其余可选)
|
* 修改COA通知任务参数(id必传,只允许修改报告要求和报告模板)
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class QmsCoaTaskUpdateQO {
|
public class QmsCoaTaskUpdateQO {
|
||||||
|
|
@ -17,26 +15,11 @@ public class QmsCoaTaskUpdateQO {
|
||||||
@NotNull(message = "ID不能为空")
|
@NotNull(message = "ID不能为空")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/**
|
|
||||||
* 供应商编号(可选)
|
|
||||||
*/
|
|
||||||
private String supplierCode;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 物料编号(可选)
|
|
||||||
*/
|
|
||||||
private String materialNo;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 报告要求(可选)
|
* 报告要求(可选)
|
||||||
*/
|
*/
|
||||||
private String requirement;
|
private String requirement;
|
||||||
|
|
||||||
/**
|
|
||||||
* 最晚提交时间(可选)
|
|
||||||
*/
|
|
||||||
private LocalDate lastSubTime;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 报告模板(可选)
|
* 报告模板(可选)
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,11 @@ public class QmsQualityInspectorMaterialVO {
|
||||||
*/
|
*/
|
||||||
private String drawingNo;
|
private String drawingNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 图纸版本号
|
||||||
|
*/
|
||||||
|
private String drawingNoVer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 物料类别编码
|
* 物料类别编码
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -27,10 +27,15 @@ public interface IQmsCoaTaskService extends IService<QmsCoaTask> {
|
||||||
void delete(Long id);
|
void delete(Long id);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改COA通知任务(状态不为0时不可修改)
|
* 修改COA通知任务(只允许修改报告要求和报告模板,修改后状态改为0)
|
||||||
*/
|
*/
|
||||||
void update(QmsCoaTaskUpdateQO qo);
|
void update(QmsCoaTaskUpdateQO qo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 直接发布COA通知任务(状态改为1,填入发送时间)
|
||||||
|
*/
|
||||||
|
void publish(QmsCoaTaskAddQO qo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 批量发送(状态改为1,填入发送时间)
|
* 批量发送(状态改为1,填入发送时间)
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -111,25 +111,38 @@ public class QmsCoaTaskServiceImpl extends ServiceImpl<QmsCoaTaskMapper, QmsCoaT
|
||||||
if (Objects.isNull(task)) {
|
if (Objects.isNull(task)) {
|
||||||
throw new NflgException(STATE.BusinessError, "任务不存在");
|
throw new NflgException(STATE.BusinessError, "任务不存在");
|
||||||
}
|
}
|
||||||
if (!Objects.equals(task.getStatus(), 0)) {
|
|
||||||
throw new NflgException(STATE.BusinessError, "当前状态不允许修改,只有待发送(状态0)的任务才能修改");
|
|
||||||
}
|
|
||||||
|
|
||||||
String operator = UserUtil.getUserName();
|
String operator = UserUtil.getUserName();
|
||||||
LocalDateTime now = LocalDateTime.now();
|
LocalDateTime now = LocalDateTime.now();
|
||||||
|
|
||||||
var updater = lambdaUpdate().eq(QmsCoaTask::getId, qo.getId());
|
var updater = lambdaUpdate().eq(QmsCoaTask::getId, qo.getId());
|
||||||
|
|
||||||
// 按供应商编号更新
|
// 只允许修改报告要求和报告模板
|
||||||
if (Objects.nonNull(qo.getSupplierCode()) && !qo.getSupplierCode().isEmpty()) {
|
if (Objects.nonNull(qo.getRequirement()) && !qo.getRequirement().isEmpty()) {
|
||||||
|
updater.set(QmsCoaTask::getRequirement, qo.getRequirement());
|
||||||
|
}
|
||||||
|
if (Objects.nonNull(qo.getReportTemplate())) {
|
||||||
|
updater.set(QmsCoaTask::getReportTemplate, qo.getReportTemplate());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改后状态改为0(待发送)
|
||||||
|
updater.set(QmsCoaTask::getStatus, 0)
|
||||||
|
.set(QmsCoaTask::getUpdateBy, operator)
|
||||||
|
.set(QmsCoaTask::getUpdateTime, now)
|
||||||
|
.update();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ==================== 直接发布 ====================
|
||||||
|
|
||||||
|
@Transactional
|
||||||
|
@Override
|
||||||
|
public void publish(QmsCoaTaskAddQO qo) {
|
||||||
|
// 按供应商编号查供应商
|
||||||
UserSupplier supplier = userSupplierService.getByCode(qo.getSupplierCode());
|
UserSupplier supplier = userSupplierService.getByCode(qo.getSupplierCode());
|
||||||
if (Objects.isNull(supplier)) {
|
if (Objects.isNull(supplier)) {
|
||||||
throw new NflgException(STATE.BusinessError, "供应商编号不存在:" + qo.getSupplierCode());
|
throw new NflgException(STATE.BusinessError, "供应商编号不存在:" + qo.getSupplierCode());
|
||||||
}
|
}
|
||||||
updater.set(QmsCoaTask::getSupplierId, supplier.getId());
|
// 按物料编号查物料
|
||||||
}
|
|
||||||
// 按物料编号更新
|
|
||||||
if (Objects.nonNull(qo.getMaterialNo()) && !qo.getMaterialNo().isEmpty()) {
|
|
||||||
QmsQcMaterial material = qcMaterialService.lambdaQuery()
|
QmsQcMaterial material = qcMaterialService.lambdaQuery()
|
||||||
.eq(QmsQcMaterial::getMaterialNo, qo.getMaterialNo())
|
.eq(QmsQcMaterial::getMaterialNo, qo.getMaterialNo())
|
||||||
.last("LIMIT 1")
|
.last("LIMIT 1")
|
||||||
|
|
@ -137,20 +150,26 @@ public class QmsCoaTaskServiceImpl extends ServiceImpl<QmsCoaTaskMapper, QmsCoaT
|
||||||
if (Objects.isNull(material)) {
|
if (Objects.isNull(material)) {
|
||||||
throw new NflgException(STATE.BusinessError, "物料编号不存在:" + qo.getMaterialNo());
|
throw new NflgException(STATE.BusinessError, "物料编号不存在:" + qo.getMaterialNo());
|
||||||
}
|
}
|
||||||
updater.set(QmsCoaTask::getMaterialId, material.getId());
|
|
||||||
}
|
String operator = UserUtil.getUserName();
|
||||||
if (Objects.nonNull(qo.getRequirement()) && !qo.getRequirement().isEmpty()) {
|
LocalDateTime now = LocalDateTime.now();
|
||||||
updater.set(QmsCoaTask::getRequirement, qo.getRequirement());
|
|
||||||
}
|
// 直接创建状态为1(已发送)的任务,并填入发送时间
|
||||||
if (Objects.nonNull(qo.getLastSubTime())) {
|
QmsCoaTask task = new QmsCoaTask()
|
||||||
updater.set(QmsCoaTask::getLastSubTime, qo.getLastSubTime());
|
.setSupplierId(supplier.getId())
|
||||||
}
|
.setMaterialId(material.getId())
|
||||||
if (Objects.nonNull(qo.getReportTemplate())) {
|
.setUserId(UserUtil.getUserId())
|
||||||
updater.set(QmsCoaTask::getReportTemplate, qo.getReportTemplate());
|
.setStatus(1)
|
||||||
}
|
.setNoticeTime(now)
|
||||||
updater.set(QmsCoaTask::getUpdateBy, operator)
|
.setRequirement(qo.getRequirement())
|
||||||
.set(QmsCoaTask::getUpdateTime, now)
|
.setReportTemplate(qo.getReportTemplate())
|
||||||
.update();
|
.setLastSubTime(qo.getLastSubTime())
|
||||||
|
.setDeleted(false)
|
||||||
|
.setCreateBy(operator)
|
||||||
|
.setCreateTime(now)
|
||||||
|
.setUpdateBy(operator)
|
||||||
|
.setUpdateTime(now);
|
||||||
|
save(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ==================== 发送 ====================
|
// ==================== 发送 ====================
|
||||||
|
|
|
||||||
|
|
@ -111,6 +111,7 @@
|
||||||
qi.material_id,
|
qi.material_id,
|
||||||
m.material_no,
|
m.material_no,
|
||||||
m.drawing_no,
|
m.drawing_no,
|
||||||
|
m.drawing_no_ver,
|
||||||
m.material_category_code,
|
m.material_category_code,
|
||||||
m.material_category_code_path_name AS material_category_name,
|
m.material_category_code_path_name AS material_category_name,
|
||||||
m.material_desc AS material_name,
|
m.material_desc AS material_name,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue