From a4d9fcaa75d46a58d624e24bf3190cc08bf89846 Mon Sep 17 00:00:00 2001 From: ggxl <194689125@qq.com> Date: Fri, 22 Nov 2024 14:35:37 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=9A=E4=B8=AA=E6=A0=87=E6=AE=B5=E7=AC=A6?= =?UTF-8?q?=E5=90=88=E9=87=91=E9=A2=9D=E6=9D=A1=E4=BB=B6=E3=80=81=E6=89=A7?= =?UTF-8?q?=E8=A1=8C=E9=87=91=E9=A2=9D=E5=8F=98=E6=9B=B4=E7=9A=84=E6=A0=87?= =?UTF-8?q?=E6=AE=B5=E6=8E=A7=E5=88=B6=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DecisionJumpToConPlanPlugin.java | 103 ++++++++++++++---- .../WriteBackAdjustAmountOpPlugin.java | 10 +- .../GetDecisionAndPurProjectPlugin.java | 6 + 3 files changed, 93 insertions(+), 26 deletions(-) diff --git a/main/java/shkd/repc/rebm/formplugin/DecisionJumpToConPlanPlugin.java b/main/java/shkd/repc/rebm/formplugin/DecisionJumpToConPlanPlugin.java index 2d511a6..1b6895d 100644 --- a/main/java/shkd/repc/rebm/formplugin/DecisionJumpToConPlanPlugin.java +++ b/main/java/shkd/repc/rebm/formplugin/DecisionJumpToConPlanPlugin.java @@ -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,29 +156,76 @@ 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); } } } } - - String appPageID = "recos" + mainView.getPageId(); - IFormView appPageView = mainView.getViewNoPlugin(appPageID); - - BillShowParameter billShowParameter = new BillShowParameter(); - billShowParameter.setFormId("recos_aimadjust"); - billShowParameter.setBillStatusValue(0); - billShowParameter.getOpenStyle().setShowType(ShowType.MainNewTabPage); - billShowParameter.getOpenStyle().setTargetKey("_submaintab_"); - - billShowParameter.setCustomParam("decision_id", model.getDataEntity().getLong("id")); - billShowParameter.setCustomParam("purproject_number", purProjectNum); - billShowParameter.setCustomParam("seqNum", seqNum); - - appPageView.showForm(billShowParameter); - getView().sendFormAction(appPageView); } } + + private void generateAimAdjustBill(IFormView mainView,Long id, String purProjectNum, int seqNum) { + String appPageID = "recos" + mainView.getPageId(); + IFormView appPageView = mainView.getViewNoPlugin(appPageID); + + BillShowParameter billShowParameter = new BillShowParameter(); + billShowParameter.setFormId("recos_aimadjust"); + billShowParameter.setBillStatusValue(0); + billShowParameter.getOpenStyle().setShowType(ShowType.MainNewTabPage); + billShowParameter.getOpenStyle().setTargetKey("_submaintab_"); + + 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 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 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) { + + } } \ No newline at end of file diff --git a/main/java/shkd/repc/rebm/opplugin/WriteBackAdjustAmountOpPlugin.java b/main/java/shkd/repc/rebm/opplugin/WriteBackAdjustAmountOpPlugin.java index aa39519..7dad41e 100644 --- a/main/java/shkd/repc/rebm/opplugin/WriteBackAdjustAmountOpPlugin.java +++ b/main/java/shkd/repc/rebm/opplugin/WriteBackAdjustAmountOpPlugin.java @@ -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); } diff --git a/main/java/shkd/repc/recos/formplugin/GetDecisionAndPurProjectPlugin.java b/main/java/shkd/repc/recos/formplugin/GetDecisionAndPurProjectPlugin.java index 6d0b85d..59c13ac 100644 --- a/main/java/shkd/repc/recos/formplugin/GetDecisionAndPurProjectPlugin.java +++ b/main/java/shkd/repc/recos/formplugin/GetDecisionAndPurProjectPlugin.java @@ -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);