箱变-启源-删除质检报告同步启源

This commit is contained in:
mzr 2025-10-23 13:58:56 +08:00
parent 354ce97839
commit 832e648ee9
1 changed files with 7 additions and 5 deletions

View File

@ -51,18 +51,20 @@ public class SyncDeleteQcQmsRule implements IRule<ReportVO> {
throw new BusinessException("箱变的QMS接口缺少配置");
}
Set<String> firstIds = new HashSet<>();
List<String> cfirstbids = new ArrayList<>();
List<String> delIdSet = new ArrayList<>();
// 收集被删除的质检报告明细关键优化直接从删除的VO中获取避免查库丢失
List<ReportItemVO> deletedItems = new ArrayList<>();
for (ReportVO vo : reportVOS) {
ReportHeaderVO hvo = vo.getHVO();
String pkReportbill = hvo.getPk_reportbill();
delIdSet.add(pkReportbill);
ReportItemVO[] bvo = vo.getBVO();
if (bvo == null) {
continue;
}
for (ReportItemVO itemVO : bvo) {
firstIds.add(itemVO.getCfirstid());
cfirstbids.add(itemVO.getCfirstbid());
deletedItems.add(itemVO); // 保存被删除的明细
}
}
@ -71,7 +73,7 @@ public class SyncDeleteQcQmsRule implements IRule<ReportVO> {
BillQuery<ArriveVO> billquery = new BillQuery(ArriveVO.class);
ArriveVO[] arriveVOS = billquery.query(firstIds.toArray(new String[0]));
// 传递删除的明细到构建方法
buildSyncData(arriveVOS, cfirstbids, deletedItems);
buildSyncData(arriveVOS, delIdSet, deletedItems);
}
} catch (Exception e) {
logger.error("SyncQcQmsRule-exp:" + e.getMessage(), e);
@ -82,7 +84,7 @@ public class SyncDeleteQcQmsRule implements IRule<ReportVO> {
/**
* 构建同步数据新增deletedItems参数接收被删除的明细
*/
private void buildSyncData(ArriveVO[] arriveVOS, List<String> cfirstbids, List<ReportItemVO> deletedItems) throws BusinessException {
private void buildSyncData(ArriveVO[] arriveVOS, List<String> delIdSet, List<ReportItemVO> deletedItems) throws BusinessException {
for (ArriveVO arriveVO : arriveVOS) {
ArriveHeaderVO hvo = arriveVO.getHVO();
ArriveItemVO[] bvo = arriveVO.getBVO();
@ -164,7 +166,7 @@ public class SyncDeleteQcQmsRule implements IRule<ReportVO> {
itemObj.put("wlxhgg", materialtype + materialspec); // 物料型号规格
// 被删除的明细标记为0关键逻辑
if (cfirstbids.contains(reportItemVO.getCfirstbid())) {
if (delIdSet.contains(pkReportbill)) {
itemObj.put("sjsl", "0"); // 删除的记录数量设为0
} else {
itemObj.put("sjsl", reportHeaderVO.getNapplynum() != null ? reportHeaderVO.getNapplynum().toString() : "0");