parent
24aae452c7
commit
dced18f74d
|
@ -19,10 +19,13 @@ import kd.bos.form.events.BeforeDoOperationEventArgs;
|
||||||
import kd.bos.form.events.ClosedCallBackEvent;
|
import kd.bos.form.events.ClosedCallBackEvent;
|
||||||
import kd.bos.form.operate.FormOperate;
|
import kd.bos.form.operate.FormOperate;
|
||||||
import kd.bos.list.ListShowParameter;
|
import kd.bos.list.ListShowParameter;
|
||||||
|
import kd.bos.logging.Log;
|
||||||
|
import kd.bos.logging.LogFactory;
|
||||||
import kd.bos.orm.query.QCP;
|
import kd.bos.orm.query.QCP;
|
||||||
import kd.bos.orm.query.QFilter;
|
import kd.bos.orm.query.QFilter;
|
||||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||||
import kd.sdk.plugin.Plugin;
|
import kd.sdk.plugin.Plugin;
|
||||||
|
import shkd.repc.recon.formplugin.ContractFormPlugin;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
@ -32,6 +35,8 @@ import java.util.*;
|
||||||
*/
|
*/
|
||||||
public class ImportPurchaseApplyBillPlugin extends AbstractBillPlugIn implements Plugin {
|
public class ImportPurchaseApplyBillPlugin extends AbstractBillPlugIn implements Plugin {
|
||||||
|
|
||||||
|
private static final Log logger = LogFactory.getLog(ImportPurchaseApplyBillPlugin.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterBindData(EventObject e) {
|
public void afterBindData(EventObject e) {
|
||||||
super.afterBindData(e);
|
super.afterBindData(e);
|
||||||
|
@ -146,22 +151,28 @@ public class ImportPurchaseApplyBillPlugin extends AbstractBillPlugIn implements
|
||||||
super.closedCallBack(closedCallBackEvent);
|
super.closedCallBack(closedCallBackEvent);
|
||||||
String actionId = closedCallBackEvent.getActionId();
|
String actionId = closedCallBackEvent.getActionId();
|
||||||
if ("purchase2".equals(actionId)) {
|
if ("purchase2".equals(actionId)) {
|
||||||
|
logger.info("11");
|
||||||
IDataModel model = this.getModel();
|
IDataModel model = this.getModel();
|
||||||
//获取采购需求id
|
//获取采购需求id
|
||||||
ListSelectedRowCollection selectedRows = (ListSelectedRowCollection) closedCallBackEvent.getReturnData();
|
ListSelectedRowCollection selectedRows = (ListSelectedRowCollection) closedCallBackEvent.getReturnData();
|
||||||
if (selectedRows != null && !selectedRows.isEmpty()) {
|
if (selectedRows != null && !selectedRows.isEmpty()) {
|
||||||
|
logger.info("22");
|
||||||
HashMap<Long, ArrayList<Long>> ids = new HashMap<>();
|
HashMap<Long, ArrayList<Long>> ids = new HashMap<>();
|
||||||
|
|
||||||
List<Map<Object, Object>> pkEntryIdValues = selectedRows.getPKEntryIdValues();
|
List<Map<Object, Object>> pkEntryIdValues = selectedRows.getPKEntryIdValues();
|
||||||
for (Map<Object, Object> pkEntryIdValue : pkEntryIdValues) {
|
for (Map<Object, Object> pkEntryIdValue : pkEntryIdValues) {
|
||||||
|
logger.info("33");
|
||||||
ArrayList<Long> entryIds = new ArrayList<>();
|
ArrayList<Long> entryIds = new ArrayList<>();
|
||||||
Set<Object> objects = pkEntryIdValue.keySet();
|
Set<Object> objects = pkEntryIdValue.keySet();
|
||||||
for (Object object : objects) {
|
for (Object object : objects) {
|
||||||
|
logger.info("44");
|
||||||
ArrayList<Long> list = ids.get((Long)object);
|
ArrayList<Long> list = ids.get((Long)object);
|
||||||
if (list != null && !list.isEmpty()) {
|
if (list != null && !list.isEmpty()) {
|
||||||
|
logger.info("55");
|
||||||
list.add((Long) pkEntryIdValue.get(object));
|
list.add((Long) pkEntryIdValue.get(object));
|
||||||
ids.put((Long)object, list);
|
ids.put((Long)object, list);
|
||||||
} else {
|
} else {
|
||||||
|
logger.info("66");
|
||||||
entryIds.add((Long) pkEntryIdValue.get(object));
|
entryIds.add((Long) pkEntryIdValue.get(object));
|
||||||
ids.put((Long)object, entryIds);
|
ids.put((Long)object, entryIds);
|
||||||
}
|
}
|
||||||
|
@ -169,14 +180,40 @@ public class ImportPurchaseApplyBillPlugin extends AbstractBillPlugIn implements
|
||||||
}
|
}
|
||||||
|
|
||||||
Set<Long> billIds = ids.keySet();
|
Set<Long> billIds = ids.keySet();
|
||||||
|
logger.info("77");
|
||||||
for (Long billId : billIds) {
|
for (Long billId : billIds) {
|
||||||
|
logger.info("88");
|
||||||
DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle(billId, "recon_settleplanbill");//采购需求
|
DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle(billId, "recon_settleplanbill");//采购需求
|
||||||
|
if (null != dynamicObject) {
|
||||||
|
logger.info("99");
|
||||||
|
}
|
||||||
DynamicObject project = dynamicObject.getDynamicObject("qeug_renovation_proj");//项目
|
DynamicObject project = dynamicObject.getDynamicObject("qeug_renovation_proj");//项目
|
||||||
DynamicObjectCollection entries = dynamicObject.getDynamicObjectCollection("qeug_cgxqentry");
|
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 (entries.size() == 1) {
|
||||||
|
DynamicObject entrie = entries.get(0);
|
||||||
|
String qeugReqdes = entrie.getString("qeug_reqdes");
|
||||||
|
if ("本次采购需求未填写明细".equals(qeugReqdes)) {
|
||||||
|
int index = model.createNewEntryRow("projectentry");
|
||||||
|
model.setValue("qeug_purxq_id", billId, index);//需求id
|
||||||
|
model.setValue("purentrycontent", dynamicObject.getString("qeug_comment"), index);// 需求描述-->采购明细
|
||||||
|
// model.setValue("qeug_qty", entry.get("qeug_qty"), index);// 数量
|
||||||
|
model.setValue("purentryproject", project, index);// 项目
|
||||||
|
model.setValue("qeug_cgxq", dynamicObject, index);//需求单据
|
||||||
|
model.setValue("controlamount", dynamicObject.getBigDecimal("qeug_applyamount"), index);//采购控制金额(含税)
|
||||||
if (entryIds.contains(entryId)) {
|
if (entryIds.contains(entryId)) {
|
||||||
|
model.setValue("qeug_purentry_id", entryId, index);//分录id
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.info("1010");
|
||||||
|
|
||||||
|
if (entryIds.contains(entryId)) {
|
||||||
|
logger.info("1111");
|
||||||
int index = model.createNewEntryRow("projectentry");
|
int index = model.createNewEntryRow("projectentry");
|
||||||
model.setValue("qeug_purxq_id", billId, index);//需求id
|
model.setValue("qeug_purxq_id", billId, index);//需求id
|
||||||
model.setValue("qeug_purentry_id", entryId, index);//分录id
|
model.setValue("qeug_purentry_id", entryId, index);//分录id
|
||||||
|
@ -186,6 +223,16 @@ public class ImportPurchaseApplyBillPlugin extends AbstractBillPlugIn implements
|
||||||
model.setValue("qeug_cgxq", dynamicObject, index);//需求单据
|
model.setValue("qeug_cgxq", dynamicObject, index);//需求单据
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//采购需求无明细
|
||||||
|
if (entries.isEmpty()) {
|
||||||
|
int index = model.createNewEntryRow("projectentry");
|
||||||
|
model.setValue("qeug_purxq_id", billId, index);//需求id
|
||||||
|
model.setValue("purentrycontent", dynamicObject.getString("qeug_comment"), index);// 需求描述-->采购明细
|
||||||
|
// model.setValue("qeug_qty", entry.get("qeug_qty"), index);// 数量
|
||||||
|
model.setValue("purentryproject", project, index);// 项目
|
||||||
|
model.setValue("qeug_cgxq", dynamicObject, index);//需求单据
|
||||||
|
model.setValue("controlamount", dynamicObject.getBigDecimal("qeug_applyamount"), index);//采购控制金额(含税)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ 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.BusinessDataServiceHelper;
|
||||||
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -19,6 +20,7 @@ public class PurapplyAuditOPPlugin extends AbstractOperationServicePlugIn {
|
||||||
if ("audit1".equals(operationKey)) {
|
if ("audit1".equals(operationKey)) {
|
||||||
DynamicObject[] dataEntities = e.getDataEntities();
|
DynamicObject[] dataEntities = e.getDataEntities();
|
||||||
DynamicObject dataEntity = dataEntities[0];
|
DynamicObject dataEntity = dataEntities[0];
|
||||||
|
dataEntity = BusinessDataServiceHelper.loadSingle(dataEntity.getPkValue(),"recon_settleplanbill");
|
||||||
DynamicObjectCollection collection = dataEntity.getDynamicObjectCollection("qeug_cgxqentry");
|
DynamicObjectCollection collection = dataEntity.getDynamicObjectCollection("qeug_cgxqentry");
|
||||||
if (collection.isEmpty()) {
|
if (collection.isEmpty()) {
|
||||||
DynamicObject add = collection.addNew();
|
DynamicObject add = collection.addNew();
|
||||||
|
|
Loading…
Reference in New Issue