pdi功能修改
This commit is contained in:
parent
3cb7cb6e7d
commit
3731387ef2
|
|
@ -7,7 +7,7 @@ import com.nflg.wms.common.pojo.PageData;
|
|||
import com.nflg.wms.common.pojo.qo.QmsPdiInspectionResultItemQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsPdiInspectionResultsSearchQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsPdiInspectionResultsSubmitQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsPdiLoadingInspectionFillQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsPdiStatusItemsFillQO;
|
||||
import com.nflg.wms.repository.entity.QmsPdiInspectionResults;
|
||||
import com.nflg.wms.common.pojo.vo.QmsPdiInspectionResultsPageVO;
|
||||
import com.nflg.wms.starter.BaseController;
|
||||
|
|
@ -32,10 +32,11 @@ public class QmsPdiInspectionResultsController extends BaseController {
|
|||
|
||||
/**
|
||||
* 填写动静态/特殊检查项内容(inspection_item_type=0、1或3)
|
||||
* 若 start_detection_time 为空则插入前端传入时间并将 inspection_enable 改为 1(质检中)
|
||||
*/
|
||||
@PostMapping("fillStatusItems")
|
||||
public ApiResult<Void> fillStatusItems(@Valid @RequestBody List<QmsPdiInspectionResultItemQO> items) {
|
||||
inspectionResultsControllerService.fillStatusItems(items);
|
||||
public ApiResult<Void> fillStatusItems(@Valid @RequestBody QmsPdiStatusItemsFillQO request) {
|
||||
inspectionResultsControllerService.fillStatusItems(request);
|
||||
return ApiResult.success();
|
||||
}
|
||||
|
||||
|
|
@ -53,15 +54,6 @@ public class QmsPdiInspectionResultsController extends BaseController {
|
|||
return ApiResult.success(inspectionResultsControllerService.submit(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 填写装车前检查项内容(同步插入装车前图片)
|
||||
*/
|
||||
@PostMapping("fillLoadingItems")
|
||||
public ApiResult<Void> fillLoadingItems(@Valid @RequestBody QmsPdiLoadingInspectionFillQO request) {
|
||||
inspectionResultsControllerService.fillLoadingItems(request);
|
||||
return ApiResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询(以任务单为主体)
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ public class QmsPdiTaskRecordController extends BaseController {
|
|||
* 分页查询检测任务列表
|
||||
*/
|
||||
@PostMapping("search")
|
||||
public ApiResult<PageData<QmsPdiTaskRecordPageVO>> search(@RequestBody QmsPdiTaskRecordSearchQO request) {
|
||||
public ApiResult<PageData<QmsPdiTaskRecordPageVO>> search(@Valid @RequestBody QmsPdiTaskRecordSearchQO request) {
|
||||
return ApiResult.success(taskRecordControllerService.search(request));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,10 +7,12 @@ import com.nflg.wms.repository.entity.QmsPdiDetectionRules;
|
|||
import com.nflg.wms.repository.entity.QmsPdiDetectionRulesDeliveryItem;
|
||||
import com.nflg.wms.repository.entity.QmsPdiDetectionRulesStatusItem;
|
||||
import com.nflg.wms.repository.entity.QmsPdiInspectionResults;
|
||||
import com.nflg.wms.repository.entity.QmsPdiInspectionResultsLoadingRecord;
|
||||
import com.nflg.wms.repository.entity.QmsPdiTaskRecord;
|
||||
import com.nflg.wms.repository.service.IQmsPdiDetectionRulesDeliveryItemService;
|
||||
import com.nflg.wms.repository.service.IQmsPdiDetectionRulesService;
|
||||
import com.nflg.wms.repository.service.IQmsPdiDetectionRulesStatusItemService;
|
||||
import com.nflg.wms.repository.service.IQmsPdiInspectionResultsLoadingRecordService;
|
||||
import com.nflg.wms.repository.service.IQmsPdiInspectionResultsService;
|
||||
import com.nflg.wms.repository.service.IQmsPdiTaskRecordService;
|
||||
import jakarta.annotation.Resource;
|
||||
|
|
@ -43,6 +45,9 @@ public class ExternalPdiTaskRecordControllerService {
|
|||
@Resource
|
||||
private IQmsPdiInspectionResultsService inspectionResultsService;
|
||||
|
||||
@Resource
|
||||
private IQmsPdiInspectionResultsLoadingRecordService loadingRecordService;
|
||||
|
||||
// ========================= 新增 =========================
|
||||
|
||||
/**
|
||||
|
|
@ -118,18 +123,30 @@ public class ExternalPdiTaskRecordControllerService {
|
|||
.setInspectionItemType(3)));
|
||||
|
||||
// 装车前检测项(delivery_item → inspection_item_type=2)
|
||||
// 在 qms_pdi_inspection_results 中只插入一条记录,用于存放整体结果和图片
|
||||
List<QmsPdiDetectionRulesDeliveryItem> deliveryItems = deliveryItemService.lambdaQuery()
|
||||
.eq(QmsPdiDetectionRulesDeliveryItem::getDetectionRulesId, detectionRulesId)
|
||||
.list();
|
||||
deliveryItems.forEach(item -> resultRows.add(new QmsPdiInspectionResults()
|
||||
resultRows.add(new QmsPdiInspectionResults()
|
||||
.setDetectionRulesId(detectionRulesId)
|
||||
.setTaskId(taskId)
|
||||
.setInspectionItemId(item.getId())
|
||||
.setInspectionItemType(2)));
|
||||
.setInspectionItemId(taskId) // 用 taskId 区分,表示这是装车前整体结果
|
||||
.setInspectionItemType(2));
|
||||
|
||||
if (!resultRows.isEmpty()) {
|
||||
inspectionResultsService.saveBatch(resultRows);
|
||||
}
|
||||
|
||||
// 在 qms_pdi_inspection_results_loading_record 中插入每个检测项的明细记录
|
||||
if (!deliveryItems.isEmpty()) {
|
||||
List<QmsPdiInspectionResultsLoadingRecord> loadingRecords = deliveryItems.stream()
|
||||
.map(item -> new QmsPdiInspectionResultsLoadingRecord()
|
||||
.setDeliveryItemId(item.getId())
|
||||
.setTaskId(taskId)
|
||||
.setDeliveryItemResult(null))
|
||||
.toList();
|
||||
loadingRecordService.saveBatch(loadingRecords);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,15 +8,15 @@ import com.nflg.wms.common.pojo.PageData;
|
|||
import com.nflg.wms.common.pojo.qo.QmsPdiInspectionResultItemQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsPdiInspectionResultsSearchQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsPdiInspectionResultsSubmitQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsPdiLoadingInspectionFillQO;
|
||||
import com.nflg.wms.common.pojo.qo.QmsPdiStatusItemsFillQO;
|
||||
import com.nflg.wms.common.pojo.vo.QmsPdiInspectionResultsPageVO;
|
||||
import com.nflg.wms.common.util.UserUtil;
|
||||
import com.nflg.wms.repository.entity.QmsPdiDetectionRules;
|
||||
import com.nflg.wms.repository.entity.QmsPdiInspectionResults;
|
||||
import com.nflg.wms.repository.entity.QmsPdiInspectionResultsLoadingImage;
|
||||
import com.nflg.wms.repository.entity.QmsPdiInspectionResultsLoadingRecord;
|
||||
import com.nflg.wms.repository.entity.QmsPdiTaskRecord;
|
||||
import com.nflg.wms.repository.service.IQmsPdiDetectionRulesService;
|
||||
import com.nflg.wms.repository.service.IQmsPdiInspectionResultsLoadingImageService;
|
||||
import com.nflg.wms.repository.service.IQmsPdiInspectionResultsLoadingRecordService;
|
||||
import com.nflg.wms.repository.service.IQmsPdiInspectionResultsService;
|
||||
import com.nflg.wms.repository.service.IQmsPdiTaskRecordService;
|
||||
import jakarta.annotation.Resource;
|
||||
|
|
@ -38,7 +38,7 @@ public class QmsPdiInspectionResultsControllerService {
|
|||
private IQmsPdiInspectionResultsService inspectionResultsService;
|
||||
|
||||
@Resource
|
||||
private IQmsPdiInspectionResultsLoadingImageService loadingImageService;
|
||||
private IQmsPdiInspectionResultsLoadingRecordService loadingRecordService;
|
||||
|
||||
@Resource
|
||||
private IQmsPdiTaskRecordService taskRecordService;
|
||||
|
|
@ -50,13 +50,35 @@ public class QmsPdiInspectionResultsControllerService {
|
|||
|
||||
/**
|
||||
* 填写动静态/特殊检查项内容(inspection_item_type=0、1或3)
|
||||
* 若 start_detection_time 为空则插入前端传入时间并将 inspection_enable 改为 1(质检中)
|
||||
* 若传入 id 对应的记录类型为2(装车前),抛出异常作为兜底
|
||||
*/
|
||||
@Transactional
|
||||
public void fillStatusItems(List<QmsPdiInspectionResultItemQO> items) {
|
||||
public void fillStatusItems(QmsPdiStatusItemsFillQO request) {
|
||||
String operator = UserUtil.getUserName();
|
||||
Long operatorId = UserUtil.getUserId();
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
for (QmsPdiInspectionResultItemQO item : items) {
|
||||
|
||||
// 通过第一条记录获取 taskId
|
||||
QmsPdiInspectionResultItemQO firstItem = request.getItems().get(0);
|
||||
QmsPdiInspectionResults firstRecord = inspectionResultsService.getById(firstItem.getId());
|
||||
if (Objects.isNull(firstRecord)) {
|
||||
throw new NflgException(STATE.BusinessError, "检验记录不存在,ID=" + firstItem.getId());
|
||||
}
|
||||
Long taskId = firstRecord.getTaskId();
|
||||
|
||||
// 若 start_detection_time 为空,则更新并设置状态为质检中
|
||||
QmsPdiTaskRecord taskRecord = taskRecordService.getById(taskId);
|
||||
if (Objects.nonNull(taskRecord) && Objects.isNull(taskRecord.getStartDetectionTime()) && request.getStartDetectionTime() != null) {
|
||||
taskRecordService.lambdaUpdate()
|
||||
.eq(QmsPdiTaskRecord::getId, taskId)
|
||||
.set(QmsPdiTaskRecord::getStartDetectionTime, request.getStartDetectionTime())
|
||||
.set(QmsPdiTaskRecord::getInspectionEnable, 1)
|
||||
.update();
|
||||
}
|
||||
|
||||
// 更新检测项
|
||||
for (QmsPdiInspectionResultItemQO item : request.getItems()) {
|
||||
QmsPdiInspectionResults record = inspectionResultsService.getById(item.getId());
|
||||
if (Objects.isNull(record)) {
|
||||
throw new NflgException(STATE.BusinessError, "检验记录不存在,ID=" + item.getId());
|
||||
|
|
@ -65,6 +87,23 @@ public class QmsPdiInspectionResultsControllerService {
|
|||
throw new NflgException(STATE.BusinessError,
|
||||
"ID=" + item.getId() + " 为装车前检测项,不允许通过此接口填写,请使用装车前检查项填写接口");
|
||||
}
|
||||
|
||||
// 构建 inspector_id 和 inspection_by 的更新逻辑
|
||||
String newInspectorId = operatorId.toString();
|
||||
String newInspectionBy = operator;
|
||||
|
||||
if (record.getInspectorId() != null && !record.getInspectorId().isEmpty()) {
|
||||
// 已有值,判断是否包含当前用户ID
|
||||
if (!record.getInspectorId().contains(newInspectorId)) {
|
||||
newInspectorId = record.getInspectorId() + "," + newInspectorId;
|
||||
newInspectionBy = record.getInspectionBy() + "/" + operator;
|
||||
} else {
|
||||
// 已包含,不修改
|
||||
newInspectorId = record.getInspectorId();
|
||||
newInspectionBy = record.getInspectionBy();
|
||||
}
|
||||
}
|
||||
|
||||
inspectionResultsService.lambdaUpdate()
|
||||
.eq(QmsPdiInspectionResults::getId, item.getId())
|
||||
.set(item.getInspectionItemImage() != null,
|
||||
|
|
@ -74,7 +113,8 @@ public class QmsPdiInspectionResultsControllerService {
|
|||
.set(item.getRemark() != null,
|
||||
QmsPdiInspectionResults::getRemark, item.getRemark())
|
||||
.set(QmsPdiInspectionResults::getInspectionTime, now)
|
||||
.set(QmsPdiInspectionResults::getInspectionBy, operator)
|
||||
.set(QmsPdiInspectionResults::getInspectorId, newInspectorId)
|
||||
.set(QmsPdiInspectionResults::getInspectionBy, newInspectionBy)
|
||||
.update();
|
||||
}
|
||||
}
|
||||
|
|
@ -84,14 +124,16 @@ public class QmsPdiInspectionResultsControllerService {
|
|||
/**
|
||||
* 提交现场检测记录
|
||||
* 1. 若 start_detection_time 为空则插入前端传入时间,否则跳过
|
||||
* 2. 更新装车前检测项(type=2),按 detection_rules_id + inspection_item_id 匹配
|
||||
* 3. 检查所有检测项是否有未填写结果的,有则抛异常
|
||||
* 4. 设置当前时间为 detection_completion_time
|
||||
* 5. 检查是否有不合格项,有则以 list 返回,无则返回 null
|
||||
* 2. 更新 qms_pdi_inspection_results_loading_record 中的每条明细结果
|
||||
* 3. 更新 qms_pdi_inspection_results 中 type=2 那条记录的整体结果和图片
|
||||
* 4. 检查所有检测项(含 loading_record)是否都有结果
|
||||
* 5. 设置 detection_completion_time,将 inspection_enable 改为 2(已完成)
|
||||
* 6. 检查是否有不合格项,有则以 list 返回,无则返回 null
|
||||
*/
|
||||
@Transactional
|
||||
public List<QmsPdiInspectionResults> submit(QmsPdiInspectionResultsSubmitQO request) {
|
||||
String operator = UserUtil.getUserName();
|
||||
Long operatorId = UserUtil.getUserId();
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
|
||||
// 查任务单
|
||||
|
|
@ -108,35 +150,75 @@ public class QmsPdiInspectionResultsControllerService {
|
|||
.update();
|
||||
}
|
||||
|
||||
// 更新装车前检测项(inspection_item_type=2)
|
||||
Long detectionRulesId = taskRecord.getDetectionRulesId();
|
||||
// 更新 qms_pdi_inspection_results_loading_record 中的每条明细结果
|
||||
request.getLoadingItems().forEach(item ->
|
||||
inspectionResultsService.lambdaUpdate()
|
||||
.eq(QmsPdiInspectionResults::getDetectionRulesId, detectionRulesId)
|
||||
.eq(QmsPdiInspectionResults::getInspectionItemId, item.getId())
|
||||
.eq(QmsPdiInspectionResults::getInspectionItemType, 2)
|
||||
.set(item.getInspectionItemResults() != null,
|
||||
QmsPdiInspectionResults::getInspectionItemResults, item.getInspectionItemResults())
|
||||
.set(item.getRemark() != null,
|
||||
QmsPdiInspectionResults::getRemark, item.getRemark())
|
||||
.set(QmsPdiInspectionResults::getInspectionTime, now)
|
||||
.set(QmsPdiInspectionResults::getInspectionBy, operator)
|
||||
loadingRecordService.lambdaUpdate()
|
||||
.eq(QmsPdiInspectionResultsLoadingRecord::getTaskId, request.getTaskId())
|
||||
.eq(QmsPdiInspectionResultsLoadingRecord::getDeliveryItemId, item.getId())
|
||||
.set(QmsPdiInspectionResultsLoadingRecord::getDeliveryItemResult, item.getResult())
|
||||
.update()
|
||||
);
|
||||
|
||||
// 检查所有检测项是否都有结果
|
||||
long unfilledCount = inspectionResultsService.lambdaQuery()
|
||||
// 更新 qms_pdi_inspection_results 中 type=2 那条记录(整体结果和图片)
|
||||
QmsPdiInspectionResults loadingResult = inspectionResultsService.lambdaQuery()
|
||||
.eq(QmsPdiInspectionResults::getTaskId, request.getTaskId())
|
||||
.isNull(QmsPdiInspectionResults::getInspectionItemResults)
|
||||
.count();
|
||||
if (unfilledCount > 0) {
|
||||
throw new NflgException(STATE.BusinessError, "还有" + unfilledCount + "项检测未填写,无法提交");
|
||||
.eq(QmsPdiInspectionResults::getInspectionItemType, 2)
|
||||
.one();
|
||||
|
||||
String newInspectorId = operatorId.toString();
|
||||
String newInspectionBy = operator;
|
||||
|
||||
if (loadingResult != null && loadingResult.getInspectorId() != null && !loadingResult.getInspectorId().isEmpty()) {
|
||||
if (!loadingResult.getInspectorId().contains(newInspectorId)) {
|
||||
newInspectorId = loadingResult.getInspectorId() + "," + newInspectorId;
|
||||
newInspectionBy = loadingResult.getInspectionBy() + "/" + operator;
|
||||
} else {
|
||||
newInspectorId = loadingResult.getInspectorId();
|
||||
newInspectionBy = loadingResult.getInspectionBy();
|
||||
}
|
||||
}
|
||||
|
||||
// 设置检测完成时间
|
||||
inspectionResultsService.lambdaUpdate()
|
||||
.eq(QmsPdiInspectionResults::getTaskId, request.getTaskId())
|
||||
.eq(QmsPdiInspectionResults::getInspectionItemType, 2)
|
||||
.set(request.getOverallResult() != null,
|
||||
QmsPdiInspectionResults::getInspectionItemResults, request.getOverallResult())
|
||||
.set(request.getOverallImages() != null && !request.getOverallImages().isEmpty(),
|
||||
QmsPdiInspectionResults::getInspectionItemImage, String.join(",", request.getOverallImages()))
|
||||
.set(QmsPdiInspectionResults::getInspectionTime, now)
|
||||
.set(QmsPdiInspectionResults::getInspectorId, newInspectorId)
|
||||
.set(QmsPdiInspectionResults::getInspectionBy, newInspectionBy)
|
||||
.update();
|
||||
|
||||
// 检查所有检测项是否都有结果(含 loading_record)
|
||||
long unfilledResults = inspectionResultsService.lambdaQuery()
|
||||
.eq(QmsPdiInspectionResults::getTaskId, request.getTaskId())
|
||||
.ne(QmsPdiInspectionResults::getInspectionItemType, 2) // 排除 type=2(整体结果单独检查)
|
||||
.isNull(QmsPdiInspectionResults::getInspectionItemResults)
|
||||
.count();
|
||||
if (unfilledResults > 0) {
|
||||
throw new NflgException(STATE.BusinessError, "还有" + unfilledResults + "项检测未填写,无法提交");
|
||||
}
|
||||
|
||||
// 检查装车前明细是否都有结果
|
||||
long unfilledLoading = loadingRecordService.lambdaQuery()
|
||||
.eq(QmsPdiInspectionResultsLoadingRecord::getTaskId, request.getTaskId())
|
||||
.isNull(QmsPdiInspectionResultsLoadingRecord::getDeliveryItemResult)
|
||||
.count();
|
||||
if (unfilledLoading > 0) {
|
||||
throw new NflgException(STATE.BusinessError, "还有" + unfilledLoading + "项装车前检测未填写,无法提交");
|
||||
}
|
||||
|
||||
// 检查整体结果是否填写
|
||||
if (request.getOverallResult() == null) {
|
||||
throw new NflgException(STATE.BusinessError, "请填写装车前整体检测结果");
|
||||
}
|
||||
|
||||
// 设置检测完成时间,将 inspection_enable 改为 2(已完成)
|
||||
taskRecordService.lambdaUpdate()
|
||||
.eq(QmsPdiTaskRecord::getId, taskRecord.getId())
|
||||
.set(QmsPdiTaskRecord::getDetectionCompletionTime, now)
|
||||
.set(QmsPdiTaskRecord::getInspectionEnable, 2)
|
||||
.update();
|
||||
|
||||
// 检查不合格项
|
||||
|
|
@ -147,49 +229,6 @@ public class QmsPdiInspectionResultsControllerService {
|
|||
return failedItems.isEmpty() ? null : failedItems;
|
||||
}
|
||||
|
||||
// ========================= 装车前检查项填写 =========================
|
||||
|
||||
/**
|
||||
* 填写装车前检查项内容
|
||||
* 1. 通过 taskNo 查任务单,取 taskId
|
||||
* 2. 将 taskId + loadingImage 插入装车前图片表
|
||||
* 3. 更新 list 中各检验项结果(inspection_item_type=2)
|
||||
*/
|
||||
@Transactional
|
||||
public void fillLoadingItems(QmsPdiLoadingInspectionFillQO request) {
|
||||
String operator = UserUtil.getUserName();
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
|
||||
// 查任务单
|
||||
QmsPdiTaskRecord taskRecord = taskRecordService.lambdaQuery()
|
||||
.eq(QmsPdiTaskRecord::getTaskNo, request.getTaskNo())
|
||||
.one();
|
||||
if (Objects.isNull(taskRecord)) {
|
||||
throw new NflgException(STATE.BusinessError, "任务单不存在,taskNo=" + request.getTaskNo());
|
||||
}
|
||||
|
||||
// 批量插入装车前图片
|
||||
List<QmsPdiInspectionResultsLoadingImage> imageEntities = request.getLoadingImages().stream()
|
||||
.map(img -> new QmsPdiInspectionResultsLoadingImage()
|
||||
.setTaskId(taskRecord.getId())
|
||||
.setLoadingImage(img))
|
||||
.collect(Collectors.toList());
|
||||
loadingImageService.saveBatch(imageEntities);
|
||||
|
||||
// 更新检验项结果
|
||||
request.getItems().forEach(item ->
|
||||
inspectionResultsService.lambdaUpdate()
|
||||
.eq(QmsPdiInspectionResults::getId, item.getId())
|
||||
.set(item.getInspectionItemResults() != null,
|
||||
QmsPdiInspectionResults::getInspectionItemResults, item.getInspectionItemResults())
|
||||
.set(item.getRemark() != null,
|
||||
QmsPdiInspectionResults::getRemark, item.getRemark())
|
||||
.set(QmsPdiInspectionResults::getInspectionTime, now)
|
||||
.set(QmsPdiInspectionResults::getInspectionBy, operator)
|
||||
.update()
|
||||
);
|
||||
}
|
||||
|
||||
// ========================= 分页查询 =========================
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -119,7 +119,16 @@ public class QmsPdiStatusItemControllerService {
|
|||
*/
|
||||
public void export(HttpServletResponse response, List<Long> ids, Long detectionRulesId, Integer status) throws IOException {
|
||||
List<QmsPdiStatusItemExportDTO> data = statusItemMapper.listForExport(ids, detectionRulesId, status);
|
||||
String statusName = status == 0 ? "静态" : "动态";
|
||||
String statusName;
|
||||
if (status == 0) {
|
||||
statusName = "静态";
|
||||
} else if (status == 1) {
|
||||
statusName = "动态";
|
||||
} else if (status == 2) {
|
||||
statusName = "特殊";
|
||||
} else {
|
||||
statusName = "";
|
||||
}
|
||||
EecExcelUtil.export("PDI" + statusName + "检测项", "PDI" + statusName + "检测项", data, response);
|
||||
}
|
||||
|
||||
|
|
@ -169,7 +178,7 @@ public class QmsPdiStatusItemControllerService {
|
|||
})
|
||||
.collect(Collectors.toList());
|
||||
if (CollectionUtil.isEmpty(entities)) {
|
||||
throw new NflgException(STATE.BusinessError, "导入数据中必填字段(部件描述、检查核实内容)均为空,请检查文件");
|
||||
throw new NflgException(STATE.BusinessError, "导入数据中必填字段(检查核实内容)为空,请检查文件");
|
||||
}
|
||||
statusItemService.saveBatch(entities);
|
||||
markMaintained(detectionRulesId);
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ package com.nflg.wms.common.pojo.qo;
|
|||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 新增COA审核参数
|
||||
*/
|
||||
|
|
@ -32,4 +34,9 @@ public class QmsCoaReviewAddQO {
|
|||
*/
|
||||
@NotBlank(message = "COA报告不能为空")
|
||||
private String coaFile;
|
||||
|
||||
/**
|
||||
* 图片列表(可选)
|
||||
*/
|
||||
private List<String> images;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ package com.nflg.wms.common.pojo.qo;
|
|||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 修改COA审核参数
|
||||
* 状态0时都可以改,状态3时只能改COA报告
|
||||
|
|
@ -30,4 +32,9 @@ public class QmsCoaReviewUpdateQO {
|
|||
* COA报告(可选,状态0或3时可改)
|
||||
*/
|
||||
private String coaFile;
|
||||
|
||||
/**
|
||||
* 图片列表(可选)
|
||||
*/
|
||||
private List<String> images;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import jakarta.validation.constraints.NotNull;
|
|||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 新增COA通知任务参数
|
||||
|
|
@ -39,4 +40,9 @@ public class QmsCoaTaskAddQO {
|
|||
* 报告模板(可选)
|
||||
*/
|
||||
private String reportTemplate;
|
||||
|
||||
/**
|
||||
* 图片列表(可选)
|
||||
*/
|
||||
private List<String> images;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ package com.nflg.wms.common.pojo.qo;
|
|||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 修改COA通知任务参数(id必传,只允许修改报告要求和报告模板)
|
||||
*/
|
||||
|
|
@ -24,4 +26,9 @@ public class QmsCoaTaskUpdateQO {
|
|||
* 报告模板(可选)
|
||||
*/
|
||||
private String reportTemplate;
|
||||
|
||||
/**
|
||||
* 图片列表(可选)
|
||||
*/
|
||||
private List<String> images;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,4 +32,14 @@ public class QmsPdiInspectionResultsSubmitQO {
|
|||
@Valid
|
||||
@NotEmpty(message = "装车前检测项不能为空")
|
||||
private List<QmsPdiLoadingInspectionItemQO> loadingItems;
|
||||
|
||||
/**
|
||||
* 装车前整体检测结果
|
||||
*/
|
||||
private Boolean overallResult;
|
||||
|
||||
/**
|
||||
* 装车前整体图片列表
|
||||
*/
|
||||
private List<String> overallImages;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,18 +10,13 @@ import lombok.Data;
|
|||
public class QmsPdiLoadingInspectionItemQO {
|
||||
|
||||
/**
|
||||
* qms_pdi_inspection_results.id(必传)
|
||||
* 装车前检测项ID(qms_pdi_detection_rules_delivery_item.id)
|
||||
*/
|
||||
@NotNull(message = "检验记录ID不能为空")
|
||||
@NotNull(message = "检测项ID不能为空")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 检验项结果:false=不合格,true=合格
|
||||
*/
|
||||
private Boolean inspectionItemResults;
|
||||
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
private Boolean result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ public class QmsPdiStatusItemExportQO {
|
|||
private Long detectionRulesId;
|
||||
|
||||
/**
|
||||
* 状态:0为静态,1为动态(必传)
|
||||
* 状态:0为静态,1为动态,2为特殊(必传)
|
||||
*/
|
||||
@NotNull(message = "状态不能为空")
|
||||
private Integer status;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,27 @@
|
|||
package com.nflg.wms.common.pojo.qo;
|
||||
|
||||
import jakarta.validation.Valid;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 填写动静态/特殊检查项请求参数
|
||||
*/
|
||||
@Data
|
||||
public class QmsPdiStatusItemsFillQO {
|
||||
|
||||
/**
|
||||
* 检测开始时间
|
||||
*/
|
||||
private LocalDateTime startDetectionTime;
|
||||
|
||||
/**
|
||||
* 检测项列表
|
||||
*/
|
||||
@Valid
|
||||
@NotEmpty(message = "检测项列表不能为空")
|
||||
private List<QmsPdiInspectionResultItemQO> items;
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package com.nflg.wms.common.pojo.qo;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
|
|
@ -38,6 +39,12 @@ public class QmsPdiTaskRecordSearchQO {
|
|||
*/
|
||||
private String factoryNo;
|
||||
|
||||
/**
|
||||
* 检验类型(必传):0=静态,1=动态,2=特殊
|
||||
*/
|
||||
@NotNull(message = "检验类型不能为空")
|
||||
private Integer inspectionType;
|
||||
|
||||
/**
|
||||
* 当前页
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.nflg.wms.common.pojo.vo;
|
|||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* COA审核详情 VO
|
||||
|
|
@ -91,4 +92,9 @@ public class QmsCoaReviewDetailVO {
|
|||
* 创建人
|
||||
*/
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* 图片列表
|
||||
*/
|
||||
private List<String> images;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ package com.nflg.wms.common.pojo.vo;
|
|||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* COA审核分页列表 VO
|
||||
|
|
@ -81,4 +82,14 @@ public class QmsCoaReviewVO {
|
|||
* 创建人
|
||||
*/
|
||||
private String createBy;
|
||||
|
||||
/**
|
||||
* COA文件地址
|
||||
*/
|
||||
private String coaFile;
|
||||
|
||||
/**
|
||||
* 图片列表
|
||||
*/
|
||||
private List<String> images;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,8 @@ package com.nflg.wms.common.pojo.vo;
|
|||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* COA通知任务详情 VO
|
||||
*/
|
||||
|
|
@ -39,4 +41,9 @@ public class QmsCoaTaskDetailVO {
|
|||
* 报告模板
|
||||
*/
|
||||
private String reportTemplate;
|
||||
|
||||
/**
|
||||
* 图片列表
|
||||
*/
|
||||
private List<String> images;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import lombok.Data;
|
|||
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* COA通知任务分页列表 VO
|
||||
|
|
@ -53,6 +54,11 @@ public class QmsCoaTaskVO {
|
|||
*/
|
||||
private String reportTemplate;
|
||||
|
||||
/**
|
||||
* 图片列表
|
||||
*/
|
||||
private List<String> images;
|
||||
|
||||
/**
|
||||
* 通知发送时间
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -71,6 +71,11 @@ public class QmsCoaReview implements Serializable {
|
|||
*/
|
||||
private String coaFile;
|
||||
|
||||
/**
|
||||
* 图片(多个图片地址用逗号分隔)
|
||||
*/
|
||||
private String image;
|
||||
|
||||
/**
|
||||
* 驳回原因
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -62,6 +62,11 @@ public class QmsCoaTask implements Serializable {
|
|||
*/
|
||||
private String reportTemplate;
|
||||
|
||||
/**
|
||||
* 图片(多个图片地址用逗号分隔)
|
||||
*/
|
||||
private String image;
|
||||
|
||||
/**
|
||||
* 通知发送时间
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -57,6 +57,11 @@ public class QmsPdiInspectionResults implements Serializable {
|
|||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 质检人ID(多个用逗号隔开)
|
||||
*/
|
||||
private String inspectorId;
|
||||
|
||||
/**
|
||||
* 质检时间
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -0,0 +1,38 @@
|
|||
package com.nflg.wms.repository.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 装车前检测项明细表
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@TableName("qms_pdi_inspection_results_loading_record")
|
||||
public class QmsPdiInspectionResultsLoadingRecord implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 装车前检测项ID(关联 qms_pdi_detection_rules_delivery_item.id)
|
||||
*/
|
||||
private Long deliveryItemId;
|
||||
|
||||
/**
|
||||
* 装车前检测结果
|
||||
*/
|
||||
private Boolean deliveryItemResult;
|
||||
|
||||
/**
|
||||
* 任务ID(关联 qms_pdi_task_record.id)
|
||||
*/
|
||||
private Long taskId;
|
||||
}
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
package com.nflg.wms.repository.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.nflg.wms.repository.entity.QmsPdiInspectionResultsLoadingRecord;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 装车前检测项明细表 Mapper
|
||||
*/
|
||||
@Mapper
|
||||
public interface QmsPdiInspectionResultsLoadingRecordMapper extends BaseMapper<QmsPdiInspectionResultsLoadingRecord> {
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
package com.nflg.wms.repository.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.nflg.wms.repository.entity.QmsPdiInspectionResultsLoadingRecord;
|
||||
|
||||
/**
|
||||
* 装车前检测项明细表 Service
|
||||
*/
|
||||
public interface IQmsPdiInspectionResultsLoadingRecordService extends IService<QmsPdiInspectionResultsLoadingRecord> {
|
||||
}
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
package com.nflg.wms.repository.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
|
@ -119,6 +120,7 @@ public class QmsCoaReviewServiceImpl extends ServiceImpl<QmsCoaReviewMapper, Qms
|
|||
.setPurchaseNo(qo.getPurchaseNo())
|
||||
.setBatchNo(qo.getBatchNo())
|
||||
.setCoaFile(qo.getCoaFile())
|
||||
.setImage(CollUtil.isNotEmpty(qo.getImages()) ? String.join(",", qo.getImages()) : null)
|
||||
.setStatus(0)
|
||||
.setDeleted(false)
|
||||
.setCreateBy(operator)
|
||||
|
|
@ -196,17 +198,25 @@ public class QmsCoaReviewServiceImpl extends ServiceImpl<QmsCoaReviewMapper, Qms
|
|||
if (Objects.nonNull(qo.getCoaFile()) && !qo.getCoaFile().isEmpty()) {
|
||||
updater.set(QmsCoaReview::getCoaFile, qo.getCoaFile());
|
||||
}
|
||||
// 修改图片
|
||||
if (qo.getImages() != null) {
|
||||
updater.set(QmsCoaReview::getImage, qo.getImages().isEmpty() ? null : String.join(",", qo.getImages()));
|
||||
}
|
||||
} else if (Objects.equals(status, 3)) {
|
||||
// 状态3时只能改COA报告
|
||||
// 状态3时只能改COA报告和图片
|
||||
if (Objects.nonNull(qo.getMaterialNo()) && !qo.getMaterialNo().isEmpty()) {
|
||||
throw new NflgException(STATE.BusinessError, "已驳回状态只能修改COA报告");
|
||||
throw new NflgException(STATE.BusinessError, "已驳回状态只能修改COA报告和图片");
|
||||
}
|
||||
if (Objects.nonNull(qo.getPurchaseNo()) && !qo.getPurchaseNo().isEmpty()) {
|
||||
throw new NflgException(STATE.BusinessError, "已驳回状态只能修改COA报告");
|
||||
throw new NflgException(STATE.BusinessError, "已驳回状态只能修改COA报告和图片");
|
||||
}
|
||||
if (Objects.nonNull(qo.getCoaFile()) && !qo.getCoaFile().isEmpty()) {
|
||||
updater.set(QmsCoaReview::getCoaFile, qo.getCoaFile());
|
||||
}
|
||||
// 修改图片
|
||||
if (qo.getImages() != null) {
|
||||
updater.set(QmsCoaReview::getImage, qo.getImages().isEmpty() ? null : String.join(",", qo.getImages()));
|
||||
}
|
||||
} else {
|
||||
throw new NflgException(STATE.BusinessError, "当前状态不允许修改");
|
||||
}
|
||||
|
|
@ -531,6 +541,7 @@ public class QmsCoaReviewServiceImpl extends ServiceImpl<QmsCoaReviewMapper, Qms
|
|||
vo.setReviewTime(review.getReviewTime());
|
||||
vo.setRejectionReason(review.getRejectionReason());
|
||||
vo.setCoaFile(review.getCoaFile());
|
||||
vo.setImages(StrUtil.isNotBlank(review.getImage()) ? List.of(review.getImage().split(",")) : List.of());
|
||||
vo.setCreateTime(review.getCreateTime());
|
||||
vo.setCreateBy(review.getCreateBy());
|
||||
|
||||
|
|
@ -580,6 +591,8 @@ public class QmsCoaReviewServiceImpl extends ServiceImpl<QmsCoaReviewMapper, Qms
|
|||
vo.setReviewBy(r.getReviewBy());
|
||||
vo.setReviewTime(r.getReviewTime());
|
||||
vo.setRejectionReason(r.getRejectionReason());
|
||||
vo.setCoaFile(r.getCoaFile());
|
||||
vo.setImages(StrUtil.isNotBlank(r.getImage()) ? List.of(r.getImage().split(",")) : List.of());
|
||||
vo.setCreateTime(r.getCreateTime());
|
||||
vo.setCreateBy(r.getCreateBy());
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.nflg.wms.repository.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
|
@ -85,6 +86,7 @@ public class QmsCoaTaskServiceImpl extends ServiceImpl<QmsCoaTaskMapper, QmsCoaT
|
|||
.setStatus(0)
|
||||
.setRequirement(qo.getRequirement())
|
||||
.setReportTemplate(qo.getReportTemplate())
|
||||
.setImage(CollUtil.isNotEmpty(qo.getImages()) ? String.join(",", qo.getImages()) : null)
|
||||
.setLastSubTime(qo.getLastSubTime())
|
||||
.setDeleted(false)
|
||||
.setCreateBy(operator)
|
||||
|
|
@ -136,6 +138,10 @@ public class QmsCoaTaskServiceImpl extends ServiceImpl<QmsCoaTaskMapper, QmsCoaT
|
|||
if (Objects.nonNull(qo.getReportTemplate())) {
|
||||
updater.set(QmsCoaTask::getReportTemplate, qo.getReportTemplate());
|
||||
}
|
||||
// 修改图片
|
||||
if (qo.getImages() != null) {
|
||||
updater.set(QmsCoaTask::getImage, qo.getImages().isEmpty() ? null : String.join(",", qo.getImages()));
|
||||
}
|
||||
|
||||
// 修改后状态改为0(待发送)
|
||||
updater.set(QmsCoaTask::getStatus, 0)
|
||||
|
|
@ -312,6 +318,7 @@ public class QmsCoaTaskServiceImpl extends ServiceImpl<QmsCoaTaskMapper, QmsCoaT
|
|||
vo.setId(task.getId());
|
||||
vo.setRequirement(task.getRequirement());
|
||||
vo.setReportTemplate(task.getReportTemplate());
|
||||
vo.setImages(StrUtil.isNotBlank(task.getImage()) ? List.of(task.getImage().split(",")) : List.of());
|
||||
|
||||
// 供应商名称
|
||||
if (Objects.nonNull(task.getSupplierId())) {
|
||||
|
|
@ -342,6 +349,7 @@ public class QmsCoaTaskServiceImpl extends ServiceImpl<QmsCoaTaskMapper, QmsCoaT
|
|||
vo.setStatus(t.getStatus());
|
||||
vo.setRequirement(t.getRequirement());
|
||||
vo.setReportTemplate(t.getReportTemplate());
|
||||
vo.setImages(StrUtil.isNotBlank(t.getImage()) ? List.of(t.getImage().split(",")) : List.of());
|
||||
vo.setNoticeTime(t.getNoticeTime());
|
||||
vo.setLastSubTime(t.getLastSubTime());
|
||||
vo.setCreateBy(t.getCreateBy());
|
||||
|
|
|
|||
|
|
@ -0,0 +1,16 @@
|
|||
package com.nflg.wms.repository.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.nflg.wms.repository.entity.QmsPdiInspectionResultsLoadingRecord;
|
||||
import com.nflg.wms.repository.mapper.QmsPdiInspectionResultsLoadingRecordMapper;
|
||||
import com.nflg.wms.repository.service.IQmsPdiInspectionResultsLoadingRecordService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 装车前检测项明细表 ServiceImpl
|
||||
*/
|
||||
@Service
|
||||
public class QmsPdiInspectionResultsLoadingRecordServiceImpl
|
||||
extends ServiceImpl<QmsPdiInspectionResultsLoadingRecordMapper, QmsPdiInspectionResultsLoadingRecord>
|
||||
implements IQmsPdiInspectionResultsLoadingRecordService {
|
||||
}
|
||||
|
|
@ -8,7 +8,7 @@
|
|||
s.components_des,
|
||||
s.inspection_content,
|
||||
s.inspection_image,
|
||||
CASE s.status WHEN 0 THEN '静态' WHEN 1 THEN '动态' ELSE '' END AS status_name,
|
||||
CASE s.status WHEN 0 THEN '静态' WHEN 1 THEN '动态' WHEN 2 THEN '特殊' ELSE '' END AS status_name,
|
||||
s.set_by,
|
||||
s.set_time
|
||||
FROM qms_pdi_detection_rules_status_item s
|
||||
|
|
|
|||
|
|
@ -25,6 +25,9 @@
|
|||
LEFT JOIN "user" ui ON ui.id = r.inspector_id
|
||||
LEFT JOIN "user" ua ON ua.id = t.assistant_id
|
||||
<where>
|
||||
<if test="request.inspectionType != null">
|
||||
AND r.inspection_type = #{request.inspectionType}
|
||||
</if>
|
||||
<if test="request.machineNo != null and request.machineNo != ''">
|
||||
AND r.machine_no = #{request.machineNo}
|
||||
</if>
|
||||
|
|
@ -43,6 +46,13 @@
|
|||
<if test="request.factoryNo != null and request.factoryNo != ''">
|
||||
AND t.factory_no = #{request.factoryNo}
|
||||
</if>
|
||||
<!-- 排除有不合格项的任务单(允许为空,但不能有false) -->
|
||||
AND NOT EXISTS (
|
||||
SELECT 1
|
||||
FROM qms_pdi_inspection_results ir
|
||||
WHERE ir.task_id = t.id
|
||||
AND ir.inspection_item_results = false
|
||||
)
|
||||
</where>
|
||||
ORDER BY t.id DESC
|
||||
</select>
|
||||
|
|
|
|||
Loading…
Reference in New Issue