qiankanghui 2 months ago
parent
commit
5c5cc4d9a4
  1. 3
      src/main/java/com/heai/modules/pms/controller/QcController.java
  2. 43
      src/main/java/com/heai/modules/pms/service/Impl/QcServiceImpl.java
  3. 6
      src/main/java/com/heai/modules/pms/service/QcService.java
  4. 28
      src/main/java/com/heai/modules/production/dao/PrintLabelRecordMapper.java
  5. 2
      src/main/resources/application-test.yml

3
src/main/java/com/heai/modules/pms/controller/QcController.java

@ -1750,9 +1750,6 @@ public class QcController {
/**
* 根据实验室单号查询批次明细清单
* 用于SQC检验单的"批次明细"按钮
*
* @param params 包含 laboratoryOrderNo 的参数对象
* @return 批次库存清单列表
*/
@PostMapping("/getBatchDetailsByLaboratoryOrder")
public R getBatchDetailsByLaboratoryOrder(@RequestBody Map<String, String> params) {

43
src/main/java/com/heai/modules/pms/service/Impl/QcServiceImpl.java

@ -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);
// 不抛出异常避免影响正常的取消审核流程
}
}

6
src/main/java/com/heai/modules/pms/service/QcService.java

@ -469,11 +469,5 @@ public interface QcService {
List<Map<String, Object>> searchQcSopFileList(Map<String, Object> params);
/**
* 根据实验室单号查询批次明细清单
*
* @param laboratoryOrderNo 实验室单号
* @return 批次明细列表
*/
List<BatchDetailVO> getBatchDetailsByLaboratoryOrder(String laboratoryOrderNo);
}

28
src/main/java/com/heai/modules/production/dao/PrintLabelRecordMapper.java

@ -35,36 +35,16 @@ public interface PrintLabelRecordMapper extends BaseMapper<PrintLabelRecord> {
IPage<PrintLabelRecord> queryBagList(@Param("page") Page<PrintLabelRecord> page,
@Param("params") PrintLabelRecord printLabelRecord);
/**
* 查询呆滞品标签在库时长>3个月
*
* @return 呆滞品标签列表
*/
List<PrintLabelRecord> selectStagnationLabels();
/**
* 查询临期品标签
*
* @return 临期品标签列表
*/
List<PrintLabelRecord> selectExpiredLabels();
/**
* 更新呆滞刷新日期
*
* @param id 标签ID
* @param refreshDate 刷新日期
* @return 更新数量
*/
int updateStagnationRefreshDate(@Param("id") Long id, @Param("refreshDate") Date refreshDate);
/**
* 更新库存过期日期用于临期品检验完成
*
* @param labelRecordId 标签ID
* @param newExpiredDate 新的过期日期
* @return 更新数量
*/
int updateInventoryStockExpiredDate(@Param("labelRecordId") Long labelRecordId, @Param("newExpiredDate") Date newExpiredDate);
}

2
src/main/resources/application-test.yml

@ -64,4 +64,4 @@ scheduler:
stagnation:
# 是否启用定时任务(true-启用,false-禁用)
enabled: false
cron: "0 35 11 * * ?"
cron: "0 33 14 * * ?"
Loading…
Cancel
Save