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