1.采购全流程携带(供方入围,标书编制,标底编制,招标交底,发标开标,答疑记录,评标谈判,定标)

2.立项提交时控制,立项控制金额不能大于采购计划的源单控制金额+申请单明细合并后申请金额+合约规划中规划金额
3.采购需求代码调用编码规则
4.优化需求,计划,立项,根据组织携带项目的逻辑(缺省值:虚拟项目)

S
This commit is contained in:
weiyunlong 2024-12-17 12:39:25 +08:00
parent df26e7a0c0
commit d0f4cc31d2
5 changed files with 136 additions and 93 deletions

View File

@ -72,11 +72,16 @@ public class ImportPurchaseApplyBillPlugin extends AbstractBillPlugIn implements
//采购项目 //采购项目
DynamicObject[] projectbills = BusinessDataServiceHelper.load("rebm_purproject", "id", DynamicObject[] projectbills = BusinessDataServiceHelper.load("rebm_purproject", "id",
new QFilter[]{new QFilter("org.id", QCP.equals, org.getPkValue())}); new QFilter[]{new QFilter("org.id", QCP.equals, org.getPkValue())});
DynamicObject projectbill = null;
if (projectbills.length > 0) { if (projectbills.length > 0) {
DynamicObject projectbill = projectbills[0]; projectbill = projectbills[0];
this.getModel().setValue("qeug_renovation_proj", projectbill); }else {
this.getView().updateView("qeug_renovation_proj"); DynamicObject[] projectbillss = BusinessDataServiceHelper.load("rebm_purproject", "id",
new QFilter[]{new QFilter("number", QCP.equals, "XM-202412-008")});
projectbill = projectbillss[0];
} }
this.getModel().setValue("qeug_renovation_proj", projectbill);
this.getView().updateView("qeug_renovation_proj");
} }

View File

@ -1,11 +1,17 @@
package shkd.repc.rebm.formplugin; package shkd.repc.rebm.formplugin;
import kd.bos.coderule.api.CodeRuleInfo;
import kd.bos.coderule.service.cache.CodeRuleCache;
import kd.bos.dataentity.entity.DynamicObject; import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.entity.datamodel.events.PropertyChangedArgs; import kd.bos.entity.datamodel.events.PropertyChangedArgs;
import kd.bos.form.plugin.AbstractFormPlugin; import kd.bos.form.plugin.AbstractFormPlugin;
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.bos.servicehelper.QueryServiceHelper;
import kd.bos.servicehelper.coderule.CodeRuleServiceHelper;
import kd.bos.servicehelper.operation.SaveServiceHelper;
import kd.bos.util.StringUtils;
import java.util.EventObject; import java.util.EventObject;
@ -20,6 +26,36 @@ public class PurDemandFormPlugin extends AbstractFormPlugin {
super.afterBindData(e); super.afterBindData(e);
//根据组织携带项目 //根据组织携带项目
updateRenovationProject(); updateRenovationProject();
DynamicObject dataEntity = this.getModel().getDataEntity(true);
if (StringUtils.isEmpty(dataEntity.getString("billno"))) {
QFilter q1 = new QFilter("number","=","CGXQ");
DynamicObject coderule = BusinessDataServiceHelper.loadSingle("bos_coderule", "id", new QFilter[]{q1});
if (null != coderule) {
CodeRuleInfo codeRule = CodeRuleCache.reloadCodeRuleById(coderule.getString("id"));
String number = CodeRuleServiceHelper.getNumber(codeRule, dataEntity);
String purissue = codeRuleNumberIsExits(number, codeRule, dataEntity);
this.getModel().setValue("billno", purissue);
}
}
}
/**
* 递归,若生成的采购单号已存在则重新生成
* @param purissue
* @param codeRule
* @param purapplybill
* @return
*/
public static String codeRuleNumberIsExits(String purissue,CodeRuleInfo codeRule,DynamicObject purapplybill){
QFilter filter = new QFilter("billno", QCP.equals,purissue);
boolean exists = QueryServiceHelper.exists("recon_settleplanbill", new QFilter[]{filter});
if(exists){
purissue = CodeRuleServiceHelper.getNumber(codeRule, purapplybill);
return codeRuleNumberIsExits(purissue,codeRule,purapplybill);
}else{
return purissue;
}
} }
@Override @Override
@ -55,11 +91,16 @@ public class PurDemandFormPlugin extends AbstractFormPlugin {
//采购项目 //采购项目
DynamicObject[] projectbills = BusinessDataServiceHelper.load("rebm_purproject", "id", DynamicObject[] projectbills = BusinessDataServiceHelper.load("rebm_purproject", "id",
new QFilter[]{new QFilter("org.id", QCP.equals, org.getPkValue())}); new QFilter[]{new QFilter("org.id", QCP.equals, org.getPkValue())});
DynamicObject projectbill = null;
if (projectbills.length > 0) { if (projectbills.length > 0) {
DynamicObject projectbill = projectbills[0]; projectbill = projectbills[0];
this.getModel().setValue("qeug_renovation_proj", projectbill); }else {
this.getView().updateView("qeug_renovation_proj"); DynamicObject[] projectbillss = BusinessDataServiceHelper.load("rebm_purproject", "id",
new QFilter[]{new QFilter("number", QCP.equals, "XM-202412-008")});
projectbill = projectbillss[0];
} }
this.getModel().setValue("qeug_renovation_proj", projectbill);
this.getView().updateView("qeug_renovation_proj");
} }
} }

View File

@ -96,10 +96,15 @@ public class PurPlanFormPlugin extends AbstractBillPlugIn implements HyperLinkCl
//采购项目 //采购项目
DynamicObject[] projectbills = BusinessDataServiceHelper.load("rebm_purproject", "id", DynamicObject[] projectbills = BusinessDataServiceHelper.load("rebm_purproject", "id",
new QFilter[]{new QFilter("org.id", QCP.equals, org.getPkValue())}); new QFilter[]{new QFilter("org.id", QCP.equals, org.getPkValue())});
DynamicObject projectbill = null;
if (projectbills.length > 0) { if (projectbills.length > 0) {
DynamicObject projectbill = projectbills[0]; projectbill = projectbills[0];
this.getModel().setValue("purproject", projectbill); }else {
this.getView().updateView("purproject"); DynamicObject[] projectbillss = BusinessDataServiceHelper.load("rebm_purproject", "id",
new QFilter[]{new QFilter("number", QCP.equals, "XM-202412-008")});
projectbill = projectbillss[0];
} }
this.getModel().setValue("qeug_renovation_proj", projectbill);
this.getView().updateView("qeug_renovation_proj");
} }
} }

View File

@ -16,22 +16,22 @@ public class SupplierinvitaFormPlugin extends AbstractFormPlugin {
public void afterBindData(EventObject e) { public void afterBindData(EventObject e) {
super.afterBindData(e); super.afterBindData(e);
/** /*
* 供方入围 qeug_rebm_supplierinv_ext 供方入围 qeug_rebm_supplierinv_ext
* 标书编制 qeug_rebm_biddocument_ext 标书编制 qeug_rebm_biddocument_ext
* 标底编制 qeug_rebm_bottom_make_ext 标底编制 qeug_rebm_bottom_make_ext
* 招标交底 qeug_rebm_clarificait_ext 招标交底 qeug_rebm_clarificait_ext
* 技术标开标 技术标开标
* 技术标评标 技术标评标
* 商务标开标 商务标开标
* 商务标评标 商务标评标
* 发标 qeug_rebm_bidpublish_ext 发标 qeug_rebm_bidpublish_ext
* 开标 qeug_rebm_bidopen_ext 开标 qeug_rebm_bidopen_ext
* 答疑记录 qeug_rebm_answerques_ext1 答疑记录 qeug_rebm_answerques_ext1
* 在线评标 在线评标
* 评标 qeug_rebm_bidevaluati_ext 评标 qeug_rebm_bidevaluati_ext
* 商务谈判 qeug_rebm_bustalk_ext 商务谈判 qeug_rebm_bustalk_ext
* 定标 qeug_rebm_decision_ext 定标 qeug_rebm_decision_ext
*/ */
//业务类型携带 //业务类型携带
String qeugCombofield = (String)this.getModel().getValue("qeug_combofield"); String qeugCombofield = (String)this.getModel().getValue("qeug_combofield");

View File

@ -6,17 +6,11 @@ import kd.bos.entity.ExtendedDataEntity;
import kd.bos.entity.plugin.AbstractOperationServicePlugIn; import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
import kd.bos.entity.plugin.AddValidatorsEventArgs; import kd.bos.entity.plugin.AddValidatorsEventArgs;
import kd.bos.entity.validate.AbstractValidator; 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 kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.bos.util.StringUtils; import kd.bos.util.StringUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -25,73 +19,75 @@ import java.util.Map;
*/ */
public class PurProjectSubmitOPPlugin extends AbstractOperationServicePlugIn { public class PurProjectSubmitOPPlugin extends AbstractOperationServicePlugIn {
private static final Log logger = LogFactory.getLog(PurProjectSubmitOPPlugin.class);
@Override @Override
public void onAddValidators(AddValidatorsEventArgs e) { public void onAddValidators(AddValidatorsEventArgs e) {
super.onAddValidators(e); super.onAddValidators(e);
/*
校验金额逻辑
1)引用合约规划:遍历子单据体,取计划,需求均为空并且合约规划名称不为空的行,累加规划金额
2)引用采购计划:遍历子单据体,取计划不为空的行,穿透到计划中累加对应明细的控制金额
3)引用采购需求:合并相同的采购需求单,累加需求金额
*/
e.addValidator(new AbstractValidator() { e.addValidator(new AbstractValidator() {
@Override @Override
public void validate() { public void validate() {
String operateKey = this.getOperateKey(); String operateKey = this.getOperateKey();
ExtendedDataEntity[] dataEntities1 = this.getDataEntities(); ExtendedDataEntity[] dataEntities1 = this.getDataEntities();
switch (operateKey) { if ("submit".equals(operateKey)) {
case "submit": for (ExtendedDataEntity extendedDataEntity : dataEntities1) {
for (ExtendedDataEntity extendedDataEntity : dataEntities1) { // 控制金额校验
// 控制金额校验 DynamicObject dataEntity = extendedDataEntity.getDataEntity();
DynamicObject dataEntity = extendedDataEntity.getDataEntity(); Map<Long, BigDecimal> XqMap = new HashMap<>();
List<Long> ids = new ArrayList<>(); DynamicObjectCollection bidSections = dataEntity.getDynamicObjectCollection("bidsection"); // 标段
Map<Long, BigDecimal> XqMap = new HashMap<>(); BigDecimal totalAmount = BigDecimal.ZERO; // 遍历明细, 需求单去重后累加申请金额, 非需求单累加规划金额
DynamicObjectCollection bidSections = dataEntity.getDynamicObjectCollection("bidsection"); // 标段
BigDecimal totalAmount = BigDecimal.ZERO; // 遍历明细, 需求单去重后累加申请金额, 非需求单累加规划金额
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");
// 需求_对应金额, 若id相同, 覆盖 // 需求_对应金额, 若id相同, 覆盖
if (id != 0) { if (id != 0) {
DynamicObject qeugCgxq = projectEntry.getDynamicObject("qeug_cgxq"); DynamicObject qeugCgxq = projectEntry.getDynamicObject("qeug_cgxq");
if (qeugCgxq != null) {
qeugCgxq = BusinessDataServiceHelper.loadSingle(qeugCgxq.getPkValue(), "recon_settleplanbill");
if (qeugCgxq != null) { if (qeugCgxq != null) {
qeugCgxq = BusinessDataServiceHelper.loadSingle(qeugCgxq.getPkValue(), "recon_settleplanbill"); XqMap.put(qeugCgxq.getLong("id"), qeugCgxq.getBigDecimal("qeug_applyamount"));
if (qeugCgxq != null) {
XqMap.put(qeugCgxq.getLong("id"), qeugCgxq.getBigDecimal("qeug_applyamount"));
}
} }
} }
// 非采购需求 }
else { // 非采购需求
String purplanname = projectEntry.getString("purplanname"); // 采购计划名称 else {
DynamicObject programcontract = projectEntry.getDynamicObject("programcontract"); // 合约规划 String purplanname = projectEntry.getString("purplanname"); // 采购计划名称
DynamicObject cqprogcon = projectEntry.getDynamicObject("cqprogcon"); // 合约规划树形 DynamicObject programcontract = projectEntry.getDynamicObject("programcontract"); // 合约规划
DynamicObject cqprogcon = projectEntry.getDynamicObject("cqprogcon"); // 合约规划树形
// 合约规划 // 合约规划
if (StringUtils.isEmpty(purplanname) && projectEntry.getDynamicObject("qeug_cgxq") == null) { if (StringUtils.isEmpty(purplanname) && projectEntry.getDynamicObject("qeug_cgxq") == null) {
if (programcontract != null || cqprogcon != null) { if (programcontract != null || cqprogcon != null) {
totalAmount = totalAmount.add(projectEntry.getBigDecimal("planamount")); totalAmount = totalAmount.add(projectEntry.getBigDecimal("planamount"));
}
} }
}
// 采购计划 // 采购计划
if (!StringUtils.isEmpty(purplanname)) { if (!StringUtils.isEmpty(purplanname)) {
DynamicObject purplanentry = projectEntry.getDynamicObject("purplanentry"); // 采购计划分录 DynamicObject purplanentry = projectEntry.getDynamicObject("purplanentry"); // 采购计划分录
if (purplanentry != null) { if (purplanentry != null) {
purplanentry = BusinessDataServiceHelper.loadSingle(purplanentry.getPkValue(), "rebm_purplanentry_f7"); purplanentry = BusinessDataServiceHelper.loadSingle(purplanentry.getPkValue(), "rebm_purplanentry_f7");
DynamicObject purplan = purplanentry.getDynamicObject("purplan"); DynamicObject purplan = purplanentry.getDynamicObject("purplan");
if (purplan != null) { if (purplan != null) {
DynamicObject rebm_purplan = BusinessDataServiceHelper.loadSingle(purplan.getPkValue(), "rebm_purplan"); DynamicObject rebm_purplan = BusinessDataServiceHelper.loadSingle(purplan.getPkValue(), "rebm_purplan");
DynamicObjectCollection collection = rebm_purplan.getDynamicObjectCollection("entryentity"); DynamicObjectCollection collection = rebm_purplan.getDynamicObjectCollection("entryentity");
for (DynamicObject dynamicObject : collection) { for (DynamicObject dynamicObject : collection) {
long id1 = purplanentry.getLong("id"); // 计划分录id long id1 = purplanentry.getLong("id"); // 计划分录id
long id2 = dynamicObject.getLong("id"); long id2 = dynamicObject.getLong("id");
if (id1 == id2) { if (id1 == id2) {
totalAmount = totalAmount.add(dynamicObject.getBigDecimal("prucontrolamount")); totalAmount = totalAmount.add(dynamicObject.getBigDecimal("prucontrolamount"));
}
} }
} }
} }
@ -100,24 +96,20 @@ public class PurProjectSubmitOPPlugin extends AbstractOperationServicePlugIn {
} }
} }
} }
// 累加需求对应金额
for (BigDecimal value : XqMap.values()) {
totalAmount = totalAmount.add(value);
}
} }
// 采购立项_采购控制总金额(单头) // 累加需求对应金额
BigDecimal totalcontrol = dataEntity.getBigDecimal("totalcontrol"); for (BigDecimal value : XqMap.values()) {
if (totalcontrol.compareTo(totalAmount) > 0) { totalAmount = totalAmount.add(value);
this.addErrorMessage(extendedDataEntity, "采购控制总金额不能大于采购申请总金额与规划金额之和");
} }
} }
break; // 采购立项_采购控制总金额(单头)
default: BigDecimal totalcontrol = dataEntity.getBigDecimal("totalcontrol");
break; if (totalcontrol.compareTo(totalAmount) > 0) {
this.addErrorMessage(extendedDataEntity, "采购控制总金额不能大于采购申请总金额与规划金额之和");
}
}
} }
} }
}); });