多个标段符合金额条件、执行金额变更的标段控制字段

This commit is contained in:
ggxl 2024-11-22 14:35:37 +08:00
parent 7530eb6f0d
commit a4d9fcaa75
3 changed files with 93 additions and 26 deletions

View File

@ -19,11 +19,15 @@ import kd.bos.exception.KDException;
import kd.bos.form.*;
import kd.bos.form.container.Tab;
import kd.bos.form.control.Control;
import kd.bos.form.control.EntryGrid;
import kd.bos.form.control.Toolbar;
import kd.bos.form.control.events.CellClickEvent;
import kd.bos.form.control.events.CellClickListener;
import kd.bos.form.control.events.ItemClickEvent;
import kd.bos.form.events.AfterDoOperationEventArgs;
import kd.bos.form.field.AmountEdit;
import kd.bos.form.field.DecimalEdit;
import kd.bos.form.field.TextEdit;
import kd.bos.portal.util.OpenPageUtils;
import kd.bos.servicehelper.BusinessDataServiceHelper;
import kd.sdk.plugin.Plugin;
@ -35,7 +39,7 @@ import java.util.*;
/**
* 单据界面插件
*/
public class DecisionJumpToConPlanPlugin extends AbstractBillPlugIn implements Plugin {
public class DecisionJumpToConPlanPlugin extends AbstractBillPlugIn implements CellClickListener {
/*
* 定标
@ -43,12 +47,20 @@ public class DecisionJumpToConPlanPlugin extends AbstractBillPlugIn implements P
* 2.将采购明细中的规划金额 < 供应商信息的最终价 所对应的采购项目带到目标成本调整中
* */
@Override
public void registerListener(EventObject e) {
super.registerListener(e);
EntryGrid entryGrid = this.getControl("bottomsection");
entryGrid.addCellClickListener(this);
}
@Override
public void afterBindData(EventObject e) {
super.afterBindData(e);
IDataModel model = this.getModel();
String conPlanAdjust = (String) model.getValue("qeug_conplan_adjust");// 关联合约规划调整
if (!conPlanAdjust.isEmpty()) {
String changeSection = (String) model.getValue("qeug_change_section");// 参与变更标段
if (!conPlanAdjust.isEmpty() && changeSection.contains("1")) {
IFormView view = this.getView();
view.setVisible(true, "qeug_planamount");
view.setVisible(true, "qeug_botcontrolamount");
@ -106,11 +118,9 @@ public class DecisionJumpToConPlanPlugin extends AbstractBillPlugIn implements P
}
IDataModel model = this.getModel();
String purProjectNum = "";
DynamicObjectCollection bidSections = model.getEntryEntity("bidsection");// 标段
DynamicObjectCollection bottomSections = model.getEntryEntity("bottomsection");// 标底标段
int seqNum = 0;
if (bidSections != null && bottomSections != null) {
for (DynamicObject bidSection : bidSections) {
BigDecimal finalPriceSum = new BigDecimal(0);
@ -146,14 +156,15 @@ public class DecisionJumpToConPlanPlugin extends AbstractBillPlugIn implements P
if (finalPriceSum.compareTo(controlAmountSum) >= 1) {
if (project != null) {
purProjectNum = project.getString("number");
seqNum = seq;
break;
generateAimAdjustBill(mainView, model.getDataEntity().getLong("id"), project.getString("number"), seq);
}
}
}
}
}
}
private void generateAimAdjustBill(IFormView mainView,Long id, String purProjectNum, int seqNum) {
String appPageID = "recos" + mainView.getPageId();
IFormView appPageView = mainView.getViewNoPlugin(appPageID);
@ -163,12 +174,58 @@ public class DecisionJumpToConPlanPlugin extends AbstractBillPlugIn implements P
billShowParameter.getOpenStyle().setShowType(ShowType.MainNewTabPage);
billShowParameter.getOpenStyle().setTargetKey("_submaintab_");
billShowParameter.setCustomParam("decision_id", model.getDataEntity().getLong("id"));
billShowParameter.setCustomParam("decision_id", id);
billShowParameter.setCustomParam("purproject_number", purProjectNum);
billShowParameter.setCustomParam("seqNum", seqNum);
appPageView.showForm(billShowParameter);
getView().sendFormAction(appPageView);
}
@Override
public void cellClick(CellClickEvent cellClickEvent) {
String fieldKey = cellClickEvent.getFieldKey();
if ("botsectionname".equals(fieldKey)) {
int rowIndex = this.getModel().getEntryCurrentRowIndex("bottomsection");
String changeSection = (String) this.getModel().getValue("qeug_change_section");// 参与变更标段
if (!changeSection.contains(String.valueOf(rowIndex + 1))) {
IFormView view = this.getView();
view.setVisible(false, "qeug_planamount");
view.setVisible(false, "qeug_botcontrolamount");
DecimalEdit planAmount = getControl("planamount");// 规划金额含税
AmountEdit controlAmount = getControl("botcontrolamount");// 采购控制金额含税
planAmount.setCaption(new LocaleString("规划金额(含税)"));
controlAmount.setCaption(new LocaleString("采购控制金额(含税)"));
Map<String, IDataEntityProperty> allFields = this.getModel().getDataEntityType().getAllFields();
IDataEntityProperty field1 = allFields.get("planamount");
IDataEntityProperty field2 = allFields.get("botcontrolamount");
field1.getDisplayName().setLocaleValue("规划金额(含税)");
field2.getDisplayName().setLocaleValue("采购控制金额(含税)");
} else {
IFormView view = this.getView();
view.setVisible(true, "qeug_planamount");
view.setVisible(true, "qeug_botcontrolamount");
DecimalEdit planAmount = getControl("planamount");// 规划金额含税
AmountEdit controlAmount = getControl("botcontrolamount");// 采购控制金额含税
planAmount.setCaption(new LocaleString("规划金额(变更后)"));
controlAmount.setCaption(new LocaleString("采购控制金额(变更后)"));
Map<String, IDataEntityProperty> allFields = this.getModel().getDataEntityType().getAllFields();
IDataEntityProperty field1 = allFields.get("planamount");
IDataEntityProperty field2 = allFields.get("botcontrolamount");
field1.getDisplayName().setLocaleValue("规划金额(变更后)");
field2.getDisplayName().setLocaleValue("采购控制金额(变更后)");
}
}
}
@Override
public void cellDoubleClick(CellClickEvent cellClickEvent) {
}
}

View File

@ -43,9 +43,14 @@ public class WriteBackAdjustAmountOpPlugin extends AbstractOperationServicePlugI
DynamicObjectCollection bottomEntries = bottomSection.getDynamicObjectCollection("bottomentry");// 采购明细
if (bottomEntries != null) {
String billNo = dynamicObject.getString("billno");
String changeSection = dynamicObject.getString("qeug_change_section");// 参与变更的标段
QFilter billNoQF = new QFilter("billno", QCP.equals, billNo);
DynamicObject project = BusinessDataServiceHelper.loadSingle("rebm_project", billNoQF.toArray());// 标前预备会
if (project != null) {
if (!changeSection.contains(String.valueOf(sectionSeq)))
changeSection = changeSection + ";" + sectionSeq;
DynamicObjectCollection bidSections = project.getDynamicObjectCollection("bidsection");// 标段
DynamicObject bidSection = bidSections.get(sectionSeq - 1);
DynamicObjectCollection projectEntries = bidSection.getDynamicObjectCollection("projectentry");// 采购明细
@ -53,7 +58,7 @@ public class WriteBackAdjustAmountOpPlugin extends AbstractOperationServicePlugI
for (int i = 0; i < bottomEntries.size(); i++) {
DynamicObject bottomEntry = bottomEntries.get(i);
BigDecimal planAmount = bottomEntry.getBigDecimal("planamount");
if (planAmount.intValue() == 0) continue;
if (planAmount.equals(new BigDecimal("0.0000000000"))) continue;
DynamicObject projectEntry = projectEntries.get(i);
DynamicObject cqprogcon = projectEntry.getDynamicObject("cqprogcon");// 合约规划
@ -78,8 +83,7 @@ public class WriteBackAdjustAmountOpPlugin extends AbstractOperationServicePlugI
}
}
bottomSection.set("bottomentry", bottomEntries);
dynamicObject.set("bottomsection", bottomSections);
dynamicObject.set("qeug_change_section", changeSection);
dynamicObject.set("qeug_conplan_adjust", String.valueOf(dataEntity.getPkValue()));
SaveServiceHelper.update(dynamicObject);
}

View File

@ -20,6 +20,12 @@ public class GetDecisionAndPurProjectPlugin extends AbstractBillPlugIn implement
* 目标成本调整-若本单据是从定标跳转过来则将定标上的采购项目赋值到项目
* */
@Override
public void beforeBindData(EventObject e) {
super.beforeBindData(e);
}
@Override
public void afterBindData(EventObject e) {
super.afterBindData(e);