优化点击选择采购申请按钮后弹出的采购申请分录中的数据的条数

This commit is contained in:
xuhaihui 2025-07-29 15:48:56 +08:00
parent f125fad5b8
commit 40ff221682
1 changed files with 17 additions and 4 deletions

View File

@ -23,6 +23,7 @@ import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.bos.servicehelper.QueryServiceHelper;
import kd.sdk.plugin.Plugin;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
@ -48,15 +49,27 @@ public class MaterialInbPurchaseApplyPlugin extends AbstractBillPlugIn implement
HashMap<String, Object> paramters = new HashMap<>();
DynamicObjectCollection entryEntityCollection = this.getModel().getDataEntity(true).getDynamicObjectCollection("entryentity");//入库单分录
List<Long> entryIds = new ArrayList<>();
List<Long> entryIds2 = new ArrayList<>();
// List<Long> entryIds2 = new ArrayList<>();
for (DynamicObject entryEntity : entryEntityCollection) {
Long entryEntityId = entryEntity.getLong("listingid");//合同清单id
entryIds.add(entryEntityId);
entryIds2.add(entryEntityId);
// entryIds2.add(entryEntityId);
}
long purchaseApplyId = purchaseApply.getLong("id");//采购申请单id
QFilter[] qFilte = new QFilter[]{new QFilter("zcgj_purchaseapply.id", QCP.equals, purchaseApplyId)};
QFilter[] qFilter = new QFilter[]{new QFilter("id", QCP.equals, purchaseApplyId)};
DynamicObject ecma_purchaseApply = BusinessDataServiceHelper.loadSingle("ecma_purchaseapply",
"purchaseentry,purchaseentry.purchaseqty,purchaseentry.zcgj_incount,purchaseentry.id", qFilter);//采购申请单
DynamicObjectCollection purchaseEntryCollection = ecma_purchaseApply.getDynamicObjectCollection("purchaseentry");//采购明细单据体
for (DynamicObject purchaseEntry : purchaseEntryCollection) {
BigDecimal purchaseQty = purchaseEntry.getBigDecimal("purchaseqty");//采购数量
BigDecimal zcgj_inCount = purchaseEntry.getBigDecimal("zcgj_incount");//已入库数量
if (purchaseQty.compareTo(zcgj_inCount) == 0) {
long purchaseEntryId = purchaseEntry.getLong("id");
entryIds.add(purchaseEntryId);
}
}
/* QFilter[] qFilte = new QFilter[]{new QFilter("zcgj_purchaseapply.id", QCP.equals, purchaseApplyId)};
DynamicObject[] ecma_materialInBills = BusinessDataServiceHelper.load("ecma_materialinbill","entryentity,entryentity.listingid", qFilte);//入库单
for (DynamicObject materialInBill : ecma_materialInBills) {
DynamicObjectCollection entryEntityCollection1 = materialInBill.getDynamicObjectCollection("entryentity");//入库单分录
@ -69,7 +82,7 @@ public class MaterialInbPurchaseApplyPlugin extends AbstractBillPlugIn implement
}
entryIds.add(entryEntityId);
}
}
}*/
paramters.put("purchaseApplyId", purchaseApplyId);
paramters.put("entryIds", entryIds);
formShowParameter.setCustomParams(paramters);