//单据体标识 private static final String ENTRY_FIELD = "entryentity";
//单据体中物料编码标识 private static final String ENTRY_MATERIA_NUMBER_FIELD = "kingdee_materia.number";
//二维码控件标识 private static final String QRCODE = "QRCode";
//主数据源标识 private static final String MAIN_DATASOURCE = "kingdee_purreq_gfh";
@Override public void afterLoadData(AfterLoadDataEvent evt) { super.afterLoadData(evt); List<DataRowSet> rowSets = evt.getDataRowSets(); List<DataRowSet> newRows = new ArrayList<>();
Iterator<DataRowSet> rowIterator = rowSets.iterator(); while (rowIterator.hasNext()) { DataRowSet rowSet = rowIterator.next(); List<DataRowSet> entryRows = rowSet.getCollectionField(ENTRY_FIELD).getValue();
entryRows.forEach(entryRow -> { //深拷贝新行,每行分录新增一行,如果不需要展示单据头和单据体字段,则可不用深拷贝 DataRowSet copy = rowSet.deepCopy(); copy.put(ENTRY_MATERIA_NUMBER_FIELD, entryRow.getField(ENTRY_MATERIA_NUMBER_FIELD)); newRows.add(copy); }); //删除当前单据行 rowIterator.remove(); } //添加所有分录行 rowSets.addAll(newRows); } |