采购订单-采购需求带出物料明细
This commit is contained in:
parent
dda0b27e25
commit
f79ca2888f
|
@ -0,0 +1,70 @@
|
||||||
|
package shkd.repc.repe.formplugin;
|
||||||
|
|
||||||
|
import kd.bos.dataentity.entity.DynamicObject;
|
||||||
|
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||||
|
import kd.bos.entity.datamodel.ListSelectedRow;
|
||||||
|
import kd.bos.form.field.RefBillEdit;
|
||||||
|
import kd.bos.form.field.events.AfterF7SelectEvent;
|
||||||
|
import kd.bos.form.field.events.AfterF7SelectListener;
|
||||||
|
import kd.bos.form.plugin.AbstractFormPlugin;
|
||||||
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
|
import kd.sdk.plugin.Plugin;
|
||||||
|
|
||||||
|
import java.util.EventObject;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 动态表单插件
|
||||||
|
*/
|
||||||
|
public class OrderFormCarryMaterialPlugin extends AbstractFormPlugin implements Plugin, AfterF7SelectListener {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerListener(EventObject e) {
|
||||||
|
super.registerListener(e);
|
||||||
|
RefBillEdit bEdit = this.getView().getControl("qeug_refbillfield");
|
||||||
|
bEdit.addAfterF7SelectListener(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterF7Select(AfterF7SelectEvent afterF7SelectEvent) {
|
||||||
|
// 获取选中行主键
|
||||||
|
ListSelectedRow listSelectedRow = afterF7SelectEvent.getListSelectedRow();
|
||||||
|
Long primaryKeyValue = (Long) listSelectedRow.getPrimaryKeyValue();
|
||||||
|
|
||||||
|
// 验证主键有效性
|
||||||
|
if (primaryKeyValue == null || primaryKeyValue.compareTo(0L) == 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 加载单据数据
|
||||||
|
DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle(primaryKeyValue, "recon_settleplanbill");
|
||||||
|
if (dynamicObject == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取结算计划单明细
|
||||||
|
DynamicObjectCollection entryCollection = dynamicObject.getDynamicObjectCollection("qeug_cgxqentry");
|
||||||
|
if (entryCollection == null || entryCollection.isEmpty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取当前单据物料明细
|
||||||
|
DynamicObjectCollection entryEntity = this.getModel().getEntryEntity("orderformentry");
|
||||||
|
|
||||||
|
// 清空现有数据(如果有)
|
||||||
|
if (!entryEntity.isEmpty()) {
|
||||||
|
this.getModel().deleteEntryData("orderformentry");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 填充物料数据
|
||||||
|
for (int i = 0; i < entryCollection.size(); i++) {
|
||||||
|
DynamicObject settlePlanMaterial = entryCollection.get(i).getDynamicObject("qeug_materialmasterid");
|
||||||
|
if (settlePlanMaterial != null) {
|
||||||
|
this.getModel().insertEntryRow("orderformentry", i);
|
||||||
|
this.getModel().setValue("material", settlePlanMaterial, i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 刷新界面
|
||||||
|
this.getView().updateView("orderformentry");
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue