|
|
|
@ -6143,7 +6143,7 @@ public class QcServiceImpl implements QcService { |
|
|
|
String laboratoryOrderNo = recordData.getRefInfo1(); |
|
|
|
|
|
|
|
// 查询对应的呆滞明细(只通过实验室单号查询) |
|
|
|
List<com.heai.modules.production.entity.StagnationDetail> details = |
|
|
|
List<StagnationDetail> details = |
|
|
|
stagnationDetailMapper.selectByLaboratoryOrder(laboratoryOrderNo); |
|
|
|
|
|
|
|
if (details == null || details.isEmpty()) { |
|
|
|
@ -6154,30 +6154,28 @@ public class QcServiceImpl implements QcService { |
|
|
|
|
|
|
|
// 获取标签ID列表 |
|
|
|
List<Long> labelRecordIds = new ArrayList<>(); |
|
|
|
for (com.heai.modules.production.entity.StagnationDetail detail : details) { |
|
|
|
for (StagnationDetail detail : details) { |
|
|
|
labelRecordIds.add(detail.getLabelRecordId()); |
|
|
|
} |
|
|
|
|
|
|
|
// 更新呆滞明细表的完成状态 |
|
|
|
com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper<com.heai.modules.production.entity.StagnationDetail> updateWrapper = |
|
|
|
new com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper<>(); |
|
|
|
UpdateWrapper<StagnationDetail> updateWrapper = |
|
|
|
new UpdateWrapper<>(); |
|
|
|
updateWrapper.in("label_record_id", labelRecordIds) |
|
|
|
.eq("is_inspection_completed", 0); |
|
|
|
|
|
|
|
com.heai.modules.production.entity.StagnationDetail updateDetail = |
|
|
|
new com.heai.modules.production.entity.StagnationDetail(); |
|
|
|
StagnationDetail updateDetail = |
|
|
|
new StagnationDetail(); |
|
|
|
updateDetail.setIsInspectionCompleted(1); // 已完成 |
|
|
|
|
|
|
|
int updateCount = stagnationDetailMapper.update(updateDetail, updateWrapper); |
|
|
|
log.info("更新呆滞明细完成状态 - 数量: {}, laboratoryOrderNo: {}", |
|
|
|
updateCount, laboratoryOrderNo); |
|
|
|
|
|
|
|
// 更新print_label_record表的呆滞刷新日期 |
|
|
|
Date now = new Date(); |
|
|
|
for (Long labelRecordId : labelRecordIds) { |
|
|
|
printLabelRecordMapper.updateStagnationRefreshDate(labelRecordId, now); |
|
|
|
} |
|
|
|
log.info("更新呆滞刷新日期 - 数量: {}, 日期: {}", labelRecordIds.size(), now); |
|
|
|
log.debug("更新呆滞刷新日期 - 数量: {}, 日期: {}", labelRecordIds.size(), now); |
|
|
|
|
|
|
|
// 如果是临期品检验,还需要更新 InventoryStock.ExpiredDate_new |
|
|
|
boolean isExpiredInspection = details.stream() |
|
|
|
@ -6187,7 +6185,7 @@ public class QcServiceImpl implements QcService { |
|
|
|
for (Long labelRecordId : labelRecordIds) { |
|
|
|
printLabelRecordMapper.updateInventoryStockExpiredDate(labelRecordId, newExpiredDate); |
|
|
|
} |
|
|
|
log.info("✅ 更新临期品库存过期日期 - 数量: {}, 新日期: {}", labelRecordIds.size(), newExpiredDate); |
|
|
|
log.debug("✅ 更新临期品库存过期日期 - 数量: {}, 新日期: {}", labelRecordIds.size(), newExpiredDate); |
|
|
|
} |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
@ -6218,7 +6216,7 @@ public class QcServiceImpl implements QcService { |
|
|
|
} |
|
|
|
|
|
|
|
// 查询对应的呆滞明细(只通过实验室单号查询) |
|
|
|
List<com.heai.modules.production.entity.StagnationDetail> details = |
|
|
|
List<StagnationDetail> details = |
|
|
|
stagnationDetailMapper.selectByLaboratoryOrder(laboratoryOrderNo); |
|
|
|
|
|
|
|
if (details == null || details.isEmpty()) { |
|
|
|
@ -6229,7 +6227,7 @@ public class QcServiceImpl implements QcService { |
|
|
|
|
|
|
|
// 获取标签ID列表 |
|
|
|
List<Long> labelRecordIds = new ArrayList<>(); |
|
|
|
for (com.heai.modules.production.entity.StagnationDetail detail : details) { |
|
|
|
for (StagnationDetail detail : details) { |
|
|
|
labelRecordIds.add(detail.getLabelRecordId()); |
|
|
|
} |
|
|
|
|
|
|
|
@ -6238,11 +6236,11 @@ public class QcServiceImpl implements QcService { |
|
|
|
for (Long labelRecordId : labelRecordIds) { |
|
|
|
printLabelRecordMapper.updateStagnationRefreshDate(labelRecordId, now); |
|
|
|
} |
|
|
|
log.info("SQC保存时更新呆滞刷新日期 - 数量: {}, 日期: {}, inspectionNo: {}", |
|
|
|
log.debug("SQC保存时更新呆滞刷新日期 - 数量: {}, 日期: {}, inspectionNo: {}", |
|
|
|
labelRecordIds.size(), now, data.getInspectionNo()); |
|
|
|
|
|
|
|
// 打印每条明细的类型,用于调试 |
|
|
|
for (com.heai.modules.production.entity.StagnationDetail detail : details) { |
|
|
|
for (StagnationDetail detail : details) { |
|
|
|
log.debug("🔍 检查明细类型 - labelRecordId: {}, type: '{}', preAuditTime: {}", |
|
|
|
detail.getLabelRecordId(), detail.getType(), detail.getPreAuditTime()); |
|
|
|
} |
|
|
|
@ -6256,7 +6254,7 @@ public class QcServiceImpl implements QcService { |
|
|
|
for (Long labelRecordId : labelRecordIds) { |
|
|
|
printLabelRecordMapper.updateInventoryStockExpiredDate(labelRecordId, newExpiredDate); |
|
|
|
} |
|
|
|
log.info("✅ SQC保存时更新临期品库存过期日期 - 数量: {}, 新日期: {}, inspectionNo: {}", |
|
|
|
log.debug("✅ SQC保存时更新临期品库存过期日期 - 数量: {}, 新日期: {}, inspectionNo: {}", |
|
|
|
labelRecordIds.size(), newExpiredDate, data.getInspectionNo()); |
|
|
|
} |
|
|
|
|
|
|
|
@ -6271,7 +6269,7 @@ public class QcServiceImpl implements QcService { |
|
|
|
updateDetail.setIsInspectionCompleted(1); // 设置为已完成 |
|
|
|
|
|
|
|
int updateCount = stagnationDetailMapper.update(updateDetail, updateWrapper); |
|
|
|
log.info("SQC保存时更新呆滞明细完成状态 - 数量: {}, laboratoryOrderNo: {}", |
|
|
|
log.debug("SQC保存时更新呆滞明细完成状态 - 数量: {}, laboratoryOrderNo: {}", |
|
|
|
updateCount, laboratoryOrderNo); |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
@ -6304,7 +6302,7 @@ public class QcServiceImpl implements QcService { |
|
|
|
} |
|
|
|
|
|
|
|
// 查询对应的呆滞明细(包含 pre_audit_time) |
|
|
|
List<com.heai.modules.production.entity.StagnationDetail> details = |
|
|
|
List<StagnationDetail> details = |
|
|
|
stagnationDetailMapper.selectByLaboratoryOrder(laboratoryOrderNo); |
|
|
|
|
|
|
|
if (details == null || details.isEmpty()) { |
|
|
|
@ -6315,7 +6313,7 @@ public class QcServiceImpl implements QcService { |
|
|
|
|
|
|
|
// 将 pre_audit_time 回滚到 print_label_record.stagnation_refresh_date |
|
|
|
int rollbackCount = 0; |
|
|
|
for (com.heai.modules.production.entity.StagnationDetail detail : details) { |
|
|
|
for (StagnationDetail detail : details) { |
|
|
|
if (detail.getPreAuditTime() != null) { |
|
|
|
printLabelRecordMapper.updateStagnationRefreshDate( |
|
|
|
detail.getLabelRecordId(), |
|
|
|
@ -6327,7 +6325,7 @@ public class QcServiceImpl implements QcService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
log.info("SQC取消审核时回滚呆滞刷新日期 - 数量: {}, inspectionNo: {}", |
|
|
|
log.debug("SQC取消审核时回滚呆滞刷新日期 - 数量: {}, inspectionNo: {}", |
|
|
|
rollbackCount, data.getInspectionNo()); |
|
|
|
|
|
|
|
// 回滚 stagnation_detail.is_inspection_completed 为 0(未完成) |
|
|
|
@ -6339,7 +6337,7 @@ public class QcServiceImpl implements QcService { |
|
|
|
rollbackDetail.setIsInspectionCompleted(0); // 设置为未完成 |
|
|
|
|
|
|
|
int rollbackUpdateCount = stagnationDetailMapper.update(rollbackDetail, rollbackWrapper); |
|
|
|
log.info("✅ SQC取消审核时回滚完成状态 - 数量: {}, laboratoryOrderNo: {}", |
|
|
|
log.debug("✅ SQC取消审核时回滚完成状态 - 数量: {}, laboratoryOrderNo: {}", |
|
|
|
rollbackUpdateCount, laboratoryOrderNo); |
|
|
|
|
|
|
|
// 如果是临期品检验,还需要回滚 InventoryStock.ExpiredDate_new |
|
|
|
@ -6347,7 +6345,7 @@ public class QcServiceImpl implements QcService { |
|
|
|
.anyMatch(detail -> "临期品".equals(detail.getType())); |
|
|
|
if (isExpiredInspection) { |
|
|
|
int expiredRollbackCount = 0; |
|
|
|
for (com.heai.modules.production.entity.StagnationDetail detail : details) { |
|
|
|
for (StagnationDetail detail : details) { |
|
|
|
if (detail.getPreAuditTime() != null) { |
|
|
|
// 对于临期品,pre_audit_time 保存的是原来的过期日期 |
|
|
|
printLabelRecordMapper.updateInventoryStockExpiredDate( |
|
|
|
@ -6359,13 +6357,10 @@ public class QcServiceImpl implements QcService { |
|
|
|
detail.getLabelRecordId(), detail.getPreAuditTime()); |
|
|
|
} |
|
|
|
} |
|
|
|
log.info("✅ SQC取消审核时回滚临期品库存过期日期 - 数量: {}, inspectionNo: {}", |
|
|
|
expiredRollbackCount, data.getInspectionNo()); |
|
|
|
} |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
log.error("SQC取消审核时回滚呆滞刷新日期失败 - inspectionNo: {}", data.getInspectionNo(), e); |
|
|
|
// 不抛出异常,避免影响正常的取消审核流程 |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|