Merge remote-tracking branch 'origin/main' into main

This commit is contained in:
陈绍鑫 2024-12-15 19:49:52 +08:00
commit 978f9ca88a
6 changed files with 338 additions and 139 deletions

View File

@ -5,9 +5,12 @@ import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.DynamicObjectCollection; import kd.bos.dataentity.entity.DynamicObjectCollection;
import kd.bos.dataentity.metadata.IDataEntityProperty; import kd.bos.dataentity.metadata.IDataEntityProperty;
import kd.bos.dataentity.metadata.dynamicobject.DynamicPropertyCollection; import kd.bos.dataentity.metadata.dynamicobject.DynamicPropertyCollection;
import kd.bos.dataentity.resource.ResManager;
import kd.bos.dataentity.utils.StringUtils;
import kd.bos.entity.datamodel.IDataModel; import kd.bos.entity.datamodel.IDataModel;
import kd.bos.entity.datamodel.ListSelectedRow; import kd.bos.entity.datamodel.ListSelectedRow;
import kd.bos.entity.datamodel.ListSelectedRowCollection; import kd.bos.entity.datamodel.ListSelectedRowCollection;
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
import kd.bos.entity.list.option.ListUserOption; import kd.bos.entity.list.option.ListUserOption;
import kd.bos.form.CloseCallBack; import kd.bos.form.CloseCallBack;
import kd.bos.form.ShowFormHelper; import kd.bos.form.ShowFormHelper;
@ -24,124 +27,100 @@ import kd.sdk.plugin.Plugin;
import java.util.*; import java.util.*;
/** /**
* 单据界面插件 * 采购立项
* qeug_rebm_project_ext
*/ */
public class ImportPurchaseApplyBillPlugin extends AbstractBillPlugIn implements Plugin { public class ImportPurchaseApplyBillPlugin extends AbstractBillPlugIn implements Plugin {
/* @Override
* 采购计划单/标前预备会-引入采购需求单 public void afterBindData(EventObject e) {
* */ super.afterBindData(e);
//根据组织携带项目
updateRenovationProject();
}
@Override
public void propertyChanged(PropertyChangedArgs e) {
super.propertyChanged(e);
String name = e.getProperty().getName();
//根据组织携带项目
if ("org".equals(name)) {
updateRenovationProject();
}
}
private void updateRenovationProject() {
DynamicObject org = (DynamicObject) this.getModel().getValue("org");
DynamicObject qeugRenovationProj = (DynamicObject) this.getModel().getValue("qeug_renovation_proj");
// 只有在需求组织不为空的情况下才进行查询
if (org != null) {
if (qeugRenovationProj == null) {
setRenovationProjectByOrg(org);
} else {
// 如果已存在项目字段且组织发生了变化需更新
setRenovationProjectByOrg(org);
}
} else {
// 组织为空清空项目
this.getModel().setValue("qeug_renovation_proj", null);
this.getView().updateView("qeug_renovation_proj");
}
}
private void setRenovationProjectByOrg(DynamicObject org) {
//采购项目
DynamicObject[] projectbills = BusinessDataServiceHelper.load("rebm_purproject", "id",
new QFilter[]{new QFilter("org.id", QCP.equals, org.getPkValue())});
if (projectbills.length > 0) {
DynamicObject projectbill = projectbills[0];
this.getModel().setValue("qeug_renovation_proj", projectbill);
this.getView().updateView("qeug_renovation_proj");
}
}
String[] fields = new String[]{
"qeug_auditoption",
"qeug_option",
"qeug_linetype",
"qeug_materialmasterid",
"qeug_materialname",
"qeug_materialversion",
"qeug_auxpty",
"qeug_unit",
"qeug_qty",
"qeug_classtype",
"qeug_baseunit",
"qeug_baseqty",
"qeug_auxunit",
"qeug_auxqty",
"qeug_reqdate",
"qeug_reqkind",
"qeug_entrybizorg",
"qeug_reqdes",
"qeug_project",
"qeug_supplier",
"qeug_originorg",
"qeug_material",
"qeug_entryorg",
"qeug_rowclosestatus",
"qeug_rowterminatestatus",
"qeug_entrycomment",
"qeug_entrycreator",
"qeug_entrycreatetime",
"qeug_entrymodifier",
"qeug_entrymodifytime",
"qeug_reqsource",
"qeug_srcbillentity",
"qeug_srcbillid",
"qeug_srcbillnumber",
"qeug_srcbillentryid",
"qeug_srcbillentryseq",
"qeug_propurqty",
"qeug_propurbaseqty",
"qeug_unionsumqty",
"qeug_unionsumbaseqty",
"qeug_sumqty",
"qeug_sumbaseqty",
"qeug_applyqty",
"qeug_applybaseqty",
"qeug_promatqty",
"qeug_promatbaseqty",
"qeug_matapplyqty",
"qeug_matapplybaseqty",
"qeug_matoutqty",
"qeug_matoutbaseqty",
"qeug_protranqty",
"qeug_protranbaseqty",
"qeug_balancestatus",
"qeug_project_info",
"qeug_quantities",
"qeug_added_tax",
"qeug_exctax_price",
"qeug_added_taxamount",
"qeug_price_includetax",
"qeug_totalprice_tax",
"qeug_labor_cost",
"qeug_auxmaterial_cost",
"qeug_mainma_price",
"qeug_mainma_brand",
"qeug_mainma_consum",
"qeug_mainma_unit",
"qeug_mainma_cost",
"qeug_equipment_costs",
"qeug_omnibus_fee",
"qeug_linetype_id",
"qeug_materialmasterid_id",
"qeug_materialversion_id",
"qeug_auxpty_id",
"qeug_unit_id",
"qeug_baseunit_id",
"qeug_auxunit_id",
"qeug_entrybizorg_id",
"qeug_project_id",
"qeug_supplier_id",
"qeug_originorg_id",
"qeug_material_id",
"qeug_entryorg_id",
"qeug_entrycreator_id",
"qeug_entrymodifier_id"};
@Override @Override
public void beforeDoOperation(BeforeDoOperationEventArgs args) { public void beforeDoOperation(BeforeDoOperationEventArgs args) {
super.beforeDoOperation(args); super.beforeDoOperation(args);
FormOperate operate = (FormOperate) args.getSource(); FormOperate operate = (FormOperate) args.getSource();
String operateKey = operate.getOperateKey(); String operateKey = operate.getOperateKey();
if ("importpurchase".equals(operateKey)) { if ("importpurchase2".equals(operateKey)) {
//showPurchaseApplyBill("purchase");
} else if ("importpurchase2".equals(operateKey)) {
showPurchaseApplyBill("purchase2"); showPurchaseApplyBill("purchase2");
} }
//增行时检查是否选择了采购项目
if (StringUtils.equals(operateKey, "newprojectentry")) {
DynamicObject qeugRenovationProj = (DynamicObject) this.getModel().getValue("qeug_renovation_proj");
if (null == qeugRenovationProj) {
this.getView().showTipNotification(ResManager.loadKDString("请先选择采购项目", "BidPurPlanEditUI_12", "repc-rebm-formplugin", new Object[0]));
args.setCancel(true);
}
// else {
// //存在项目,携带到明细
// int index = this.getModel().createNewEntryRow("projectentry");
// this.getModel().setValue("purentryproject", qeugRenovationProj, index);
// }
}
} }
/**
* 去重展示采购需求单
* @param actionId 操作标识
*/
private void showPurchaseApplyBill(String actionId) { private void showPurchaseApplyBill(String actionId) {
ListShowParameter listShowParameter = ShowFormHelper.createShowListForm("qeug_purchaseapplybill", true); ListShowParameter listShowParameter = ShowFormHelper.createShowListForm("recon_settleplanbill", true);
listShowParameter.setFormId("bos_listf7"); listShowParameter.setFormId("bos_listf7");
listShowParameter.getOpenStyle().setShowType(ShowType.Modal); listShowParameter.getOpenStyle().setShowType(ShowType.Modal);
listShowParameter.setCloseCallBack(new CloseCallBack(this, actionId)); listShowParameter.setCloseCallBack(new CloseCallBack(this, actionId));
if ("purchase2".equals(actionId)) { if ("purchase2".equals(actionId)) {
IDataModel model = this.getModel(); IDataModel model = this.getModel();
List<Long> ids = new ArrayList<>(); List<Long> ids = new ArrayList<>();
DynamicObjectCollection bidSections = model.getEntryEntity("bidsection"); DynamicObjectCollection bidSections = model.getEntryEntity("bidsection");//标段
if (bidSections != null) { if (bidSections != null) {
for (DynamicObject bidSection : bidSections) { for (DynamicObject bidSection : bidSections) {
DynamicObjectCollection projectEntries = bidSection.getDynamicObjectCollection("projectentry"); DynamicObjectCollection projectEntries = bidSection.getDynamicObjectCollection("projectentry");//采购明细
if (projectEntries != null) { if (projectEntries != null) {
for (DynamicObject projectEntry : projectEntries) { for (DynamicObject projectEntry : projectEntries) {
long id = projectEntry.getLong("qeug_purentry_id"); long id = projectEntry.getLong("qeug_purentry_id");
@ -153,44 +132,23 @@ public class ImportPurchaseApplyBillPlugin extends AbstractBillPlugIn implements
} }
if (!ids.isEmpty()) { if (!ids.isEmpty()) {
listShowParameter.getListFilterParameter().getQFilters().add(new QFilter("qeug_entryentity.id", QCP.not_in, ids)); listShowParameter.getListFilterParameter().getQFilters().add(new QFilter("qeug_cgxqentry.id", QCP.not_in, ids));
} }
} }
} }
this.getView().showForm(listShowParameter); this.getView().showForm(listShowParameter);
} }
/**
* 反写页面子单据体
*/
@Override @Override
public void closedCallBack(ClosedCallBackEvent closedCallBackEvent) { public void closedCallBack(ClosedCallBackEvent closedCallBackEvent) {
super.closedCallBack(closedCallBackEvent); super.closedCallBack(closedCallBackEvent);
String actionId = closedCallBackEvent.getActionId(); String actionId = closedCallBackEvent.getActionId();
if ("purchase".equals(actionId)) { if ("purchase2".equals(actionId)) {
IDataModel model = this.getModel();
ListSelectedRowCollection selectedRows = (ListSelectedRowCollection) closedCallBackEvent.getReturnData();
if (selectedRows != null && !selectedRows.isEmpty()) {
for (ListSelectedRow selectedRow : selectedRows) {
Object keyValue = selectedRow.getPrimaryKeyValue();
int rowKey = selectedRow.getRowKey();
DynamicObject purchase = BusinessDataServiceHelper.loadSingle(keyValue, "qeug_purchaseapplybill");
DynamicObjectCollection entryEntities = purchase.getDynamicObjectCollection("qeug_entryentity");// 明细
DynamicObject entry = entryEntities.get(rowKey);
int index = model.createNewEntryRow("entryentity");
for (String field : fields) {
model.setValue(field, entry.get(field), index);
}
model.setValue("planname", entry.get("qeug_materialname"), index);
DynamicObject project = entry.getDynamicObject("qeug_project");
if (project != null) {
QFilter projectQF = new QFilter("number", QCP.equals, project.getString("number"));
DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle("rebm_purproject", projectQF.toArray());
model.setValue("purentryproject", dynamicObject, index);
}
}
}
} else if ("purchase2".equals(actionId)) {
IDataModel model = this.getModel(); IDataModel model = this.getModel();
//获取采购需求id
ListSelectedRowCollection selectedRows = (ListSelectedRowCollection) closedCallBackEvent.getReturnData(); ListSelectedRowCollection selectedRows = (ListSelectedRowCollection) closedCallBackEvent.getReturnData();
if (selectedRows != null && !selectedRows.isEmpty()) { if (selectedRows != null && !selectedRows.isEmpty()) {
HashMap<Long, ArrayList<Long>> ids = new HashMap<>(); HashMap<Long, ArrayList<Long>> ids = new HashMap<>();
@ -213,27 +171,25 @@ public class ImportPurchaseApplyBillPlugin extends AbstractBillPlugIn implements
Set<Long> billIds = ids.keySet(); Set<Long> billIds = ids.keySet();
for (Long billId : billIds) { for (Long billId : billIds) {
DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle(billId, "qeug_purchaseapplybill"); DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle(billId, "recon_settleplanbill");//采购需求
DynamicObjectCollection entries = dynamicObject.getDynamicObjectCollection("qeug_entryentity"); DynamicObject project = dynamicObject.getDynamicObject("qeug_renovation_proj");//项目
DynamicObjectCollection entries = dynamicObject.getDynamicObjectCollection("qeug_cgxqentry");
for (DynamicObject entry : entries) { for (DynamicObject entry : entries) {
long entryId = entry.getLong("id"); long entryId = entry.getLong("id");
ArrayList<Long> entryIds = ids.get(billId); ArrayList<Long> entryIds = ids.get(billId);
if (entryIds.contains(entryId)) { if (entryIds.contains(entryId)) {
int index = model.createNewEntryRow("projectentry"); int index = model.createNewEntryRow("projectentry");
model.setValue("qeug_purentry_id", entryId, index); model.setValue("qeug_purxq_id", billId, index);//需求id
model.setValue("qeug_purentry_id", entryId, index);//分录id
model.setValue("purentrycontent", entry.get("qeug_materialname"), index);// 物料名称 model.setValue("purentrycontent", entry.get("qeug_materialname"), index);// 物料名称
model.setValue("qeug_qty", entry.get("qeug_qty"), index);// 数量 // model.setValue("qeug_qty", entry.get("qeug_qty"), index);// 数量
model.setValue("qeug_unit", entry.get("qeug_unit"), index);// 单位 model.setValue("purentryproject", project, index);// 项目
DynamicObject project = entry.getDynamicObject("qeug_project");// 项目 model.setValue("qeug_cgxq", dynamicObject, index);//需求单据
if (project != null) {
QFilter projectQF = new QFilter("number", QCP.equals, project.getString("number"));
DynamicObject purproject = BusinessDataServiceHelper.loadSingle("rebm_purproject", projectQF.toArray());
model.setValue("purentryproject", purproject, index);
}
} }
} }
} }
} }
} }
} }
} }

View File

@ -0,0 +1,65 @@
package shkd.repc.rebm.formplugin;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
import kd.bos.form.plugin.AbstractFormPlugin;
import kd.bos.orm.query.QCP;
import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import java.util.EventObject;
/**
* 采购需求
* qeug_recon_settleplan_ext
*/
public class PurDemandFormPlugin extends AbstractFormPlugin {
@Override
public void afterBindData(EventObject e) {
super.afterBindData(e);
//根据组织携带项目
updateRenovationProject();
}
@Override
public void propertyChanged(PropertyChangedArgs e) {
super.propertyChanged(e);
String name = e.getProperty().getName();
//根据组织携带项目
if ("org".equals(name)) {
updateRenovationProject();
}
}
private void updateRenovationProject() {
DynamicObject org = (DynamicObject) this.getModel().getValue("org");
DynamicObject qeugRenovationProj = (DynamicObject) this.getModel().getValue("qeug_renovation_proj");
// 只有在需求组织不为空的情况下才进行查询
if (org != null) {
if (qeugRenovationProj == null) {
setRenovationProjectByOrg(org);
} else {
// 如果已存在项目字段且组织发生了变化需更新
setRenovationProjectByOrg(org);
}
} else {
// 组织为空清空项目
this.getModel().setValue("qeug_renovation_proj", null);
this.getView().updateView("qeug_renovation_proj");
}
}
private void setRenovationProjectByOrg(DynamicObject org) {
//采购项目
DynamicObject[] projectbills = BusinessDataServiceHelper.load("rebm_purproject", "id",
new QFilter[]{new QFilter("org.id", QCP.equals, org.getPkValue())});
if (projectbills.length > 0) {
DynamicObject projectbill = projectbills[0];
this.getModel().setValue("qeug_renovation_proj", projectbill);
this.getView().updateView("qeug_renovation_proj");
}
}
}

View File

@ -5,6 +5,7 @@ import kd.bos.bill.BillShowParameter;
import kd.bos.bill.OperationStatus; import kd.bos.bill.OperationStatus;
import kd.bos.dataentity.entity.DynamicObject; import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.DynamicObjectCollection; import kd.bos.dataentity.entity.DynamicObjectCollection;
import kd.bos.entity.datamodel.events.PropertyChangedArgs;
import kd.bos.form.ShowType; import kd.bos.form.ShowType;
import kd.bos.form.control.EntryGrid; import kd.bos.form.control.EntryGrid;
import kd.bos.form.events.HyperLinkClickEvent; import kd.bos.form.events.HyperLinkClickEvent;
@ -42,7 +43,7 @@ public class PurPlanFormPlugin extends AbstractBillPlugIn implements HyperLinkCl
private void showPurplan(String formId, String shkd_purplanno) { private void showPurplan(String formId, String shkd_purplanno) {
if (shkd_purplanno != null) { if (shkd_purplanno != null) {
DynamicObject object = BusinessDataServiceHelper.loadSingle(formId, new QFilter[]{new QFilter("qeug_billno", QCP.equals, shkd_purplanno)}); DynamicObject object = BusinessDataServiceHelper.loadSingle(formId, new QFilter[]{new QFilter("billno", QCP.equals, shkd_purplanno)});
if (null != object) { if (null != object) {
BillShowParameter params = new BillShowParameter(); BillShowParameter params = new BillShowParameter();
params.setFormId(formId); params.setFormId(formId);
@ -54,4 +55,51 @@ public class PurPlanFormPlugin extends AbstractBillPlugIn implements HyperLinkCl
} }
} }
} }
@Override
public void afterBindData(EventObject e) {
super.afterBindData(e);
//根据组织携带项目
updateRenovationProject();
}
@Override
public void propertyChanged(PropertyChangedArgs e) {
super.propertyChanged(e);
String name = e.getProperty().getName();
//根据组织携带项目
if ("org".equals(name)) {
updateRenovationProject();
}
}
private void updateRenovationProject() {
DynamicObject org = (DynamicObject) this.getModel().getValue("org");
DynamicObject purproject = (DynamicObject) this.getModel().getValue("purproject");
// 只有在需求组织不为空的情况下才进行查询
if (org != null) {
if (purproject == null) {
setRenovationProjectByOrg(org);
} else {
// 如果已存在项目字段且组织发生了变化需更新
setRenovationProjectByOrg(org);
}
} else {
// 组织为空清空项目
this.getModel().setValue("purproject", null);
this.getView().updateView("purproject");
}
}
private void setRenovationProjectByOrg(DynamicObject org) {
//采购项目
DynamicObject[] projectbills = BusinessDataServiceHelper.load("rebm_purproject", "id",
new QFilter[]{new QFilter("org.id", QCP.equals, org.getPkValue())});
if (projectbills.length > 0) {
DynamicObject projectbill = projectbills[0];
this.getModel().setValue("purproject", projectbill);
this.getView().updateView("purproject");
}
}
} }

View File

@ -0,0 +1,42 @@
package shkd.repc.rebm.opplugin;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.DynamicObjectCollection;
import kd.bos.entity.ExtendedDataEntity;
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
import kd.bos.entity.plugin.AddValidatorsEventArgs;
import kd.bos.entity.validate.AbstractValidator;
import kd.bos.logging.Log;
import kd.bos.logging.LogFactory;
public class PurPlanSubmitOPPlugin extends AbstractOperationServicePlugIn {
private static final Log logger = LogFactory.getLog(PurPlanSubmitOPPlugin.class);
@Override
public void onAddValidators(AddValidatorsEventArgs e) {
super.onAddValidators(e);
e.addValidator(new AbstractValidator() {
@Override
public void validate() {
String operateKey = this.getOperateKey();
ExtendedDataEntity[] dataEntities1 = this.getDataEntities();
switch (operateKey) {
case "submit":
for (ExtendedDataEntity extendedDataEntity : dataEntities1) {
//采购需求明细
DynamicObject dataEntity = extendedDataEntity.getDataEntity();
DynamicObjectCollection cgxuentry = dataEntity.getDynamicObjectCollection("qeug_cgxuentryss");
if (cgxuentry.isEmpty()) {
this.addErrorMessage(extendedDataEntity, "采购需求明细不能为空,不允许提交。");
}
}
break;
default:
break;
}
}
});
}
}

View File

@ -0,0 +1,87 @@
package shkd.repc.rebm.opplugin;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.DynamicObjectCollection;
import kd.bos.entity.ExtendedDataEntity;
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
import kd.bos.entity.plugin.AddValidatorsEventArgs;
import kd.bos.entity.validate.AbstractValidator;
import kd.bos.logging.Log;
import kd.bos.logging.LogFactory;
import kd.bos.orm.query.QCP;
import kd.bos.orm.query.QFilter;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 采购立项提交
* qeug_rebm_project_ext
*/
public class PurProjectSubmitOPPlugin extends AbstractOperationServicePlugIn {
private static final Log logger = LogFactory.getLog(PurProjectSubmitOPPlugin.class);
@Override
public void onAddValidators(AddValidatorsEventArgs e) {
super.onAddValidators(e);
e.addValidator(new AbstractValidator() {
@Override
public void validate() {
String operateKey = this.getOperateKey();
ExtendedDataEntity[] dataEntities1 = this.getDataEntities();
switch (operateKey) {
case "submit":
for (ExtendedDataEntity extendedDataEntity : dataEntities1) {
//控制金额校验
DynamicObject dataEntity = extendedDataEntity.getDataEntity();
List<Long> ids = new ArrayList<>();
Map<Long, BigDecimal> XqMap = new HashMap<>();
DynamicObjectCollection bidSections = dataEntity.getDynamicObjectCollection("bidsection");//标段
BigDecimal totalAmount = BigDecimal.ZERO;//遍历明细,需求单去重后累加申请金额,非需求单累加规划金额
if (bidSections != null) {
for (DynamicObject bidSection : bidSections) {
DynamicObjectCollection projectEntries = bidSection.getDynamicObjectCollection("projectentry");//采购明细
if (projectEntries != null) {
for (DynamicObject projectEntry : projectEntries) {
long id = projectEntry.getLong("qeug_purentry_id");
//非采购需求,计算规划金额
if (id == 0) {
totalAmount = totalAmount.add(projectEntry.getBigDecimal("planamount"));
}else {
//需求_对应金额,若id相同,覆盖
DynamicObject qeugCgxq = projectEntry.getDynamicObject("qeug_cgxq");
if (null != qeugCgxq) {
qeugCgxq = BusinessDataServiceHelper.loadSingle(qeugCgxq.getPkValue(),"recon_settleplanbill");
XqMap.put(qeugCgxq.getLong("id"), qeugCgxq.getBigDecimal("qeug_applyamount"));
}
}
}
}
}
if (!XqMap.isEmpty()) {
for (Map.Entry<Long, BigDecimal> entry : XqMap.entrySet()) {
BigDecimal value = entry.getValue();
totalAmount = totalAmount.add(value);
}
}
}
//采购立项_采购控制总金额(单头)
BigDecimal totalcontrol = dataEntity.getBigDecimal("totalcontrol");
if (totalcontrol.compareTo(totalAmount) > 0) {
this.addErrorMessage(extendedDataEntity, "采购控制总金额不能大于采购申请总金额与规划金额之和");
}
}
break;
default:
break;
}
}
});
}
}

View File

@ -4,10 +4,11 @@ import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.DynamicObjectCollection; import kd.bos.dataentity.entity.DynamicObjectCollection;
import kd.bos.entity.plugin.AbstractOperationServicePlugIn; import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
import kd.bos.entity.plugin.args.AfterOperationArgs; import kd.bos.entity.plugin.args.AfterOperationArgs;
import kd.bos.servicehelper.operation.SaveServiceHelper;
/** /**
* 采购需求单 * 采购需求单
* qeug_purchaseapplybill * qeug_recon_settleplan_ext
*/ */
public class PurapplyAuditOPPlugin extends AbstractOperationServicePlugIn { public class PurapplyAuditOPPlugin extends AbstractOperationServicePlugIn {
@ -15,15 +16,15 @@ public class PurapplyAuditOPPlugin extends AbstractOperationServicePlugIn {
public void afterExecuteOperationTransaction(AfterOperationArgs e) { public void afterExecuteOperationTransaction(AfterOperationArgs e) {
super.afterExecuteOperationTransaction(e); super.afterExecuteOperationTransaction(e);
String operationKey = e.getOperationKey(); String operationKey = e.getOperationKey();
if ("audit".equals(operationKey)) { if ("audit1".equals(operationKey)) {
DynamicObject[] dataEntities = e.getDataEntities(); DynamicObject[] dataEntities = e.getDataEntities();
DynamicObject dataEntity = dataEntities[0]; DynamicObject dataEntity = dataEntities[0];
DynamicObjectCollection collection = dataEntity.getDynamicObjectCollection("qeug_entryentity"); DynamicObjectCollection collection = dataEntity.getDynamicObjectCollection("qeug_cgxqentry");
if (collection.isEmpty()) { if (collection.isEmpty()) {
DynamicObject add = collection.addNew(); DynamicObject add = collection.addNew();
// add.set("",); add.set("qeug_reqdes","本次采购需求未填写明细");
} }
SaveServiceHelper.save(new DynamicObject[]{dataEntity});
} }
} }