标准成本调整回传反写调整后金额
This commit is contained in:
parent
2b9d90fef7
commit
f6b3c01b15
|
@ -25,6 +25,7 @@ import kd.bos.form.events.AfterDoOperationEventArgs;
|
|||
import kd.bos.form.field.AmountEdit;
|
||||
import kd.bos.form.field.DecimalEdit;
|
||||
import kd.bos.portal.util.OpenPageUtils;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
import kd.sdk.plugin.Plugin;
|
||||
import kd.svc.control.events.AppNavigationMenuEvent;
|
||||
|
||||
|
@ -108,34 +109,34 @@ public class DecisionJumpToConPlanPlugin extends AbstractBillPlugIn implements P
|
|||
String purProjectNum = "";
|
||||
DynamicObjectCollection bidSections = model.getEntryEntity("bidsection");// 标段
|
||||
DynamicObjectCollection bottomSections = model.getEntryEntity("bottomsection");// 标底标段
|
||||
DynamicObjectCollection supplierEntries = model.getEntryEntity("supplierentry");// 定标供应商
|
||||
DynamicObjectCollection bottomEntries = model.getEntryEntity("bottomentry");// 采购明细
|
||||
if (bidSections != null && supplierEntries != null && bottomSections != null && bottomEntries != null) {
|
||||
|
||||
int seqNum = 0;
|
||||
if (bidSections != null && bottomSections != null) {
|
||||
for (DynamicObject bidSection : bidSections) {
|
||||
BigDecimal finalPriceSum = new BigDecimal(0);
|
||||
int seq = bidSection.getInt("seq");
|
||||
long entryId = bidSection.getLong("id");
|
||||
DynamicObjectCollection supplierEntries = bidSection.getDynamicObjectCollection("supplierentry");// 定标供应商
|
||||
if (supplierEntries == null) continue;
|
||||
for (DynamicObject supplierEntry : supplierEntries) {
|
||||
DynamicObject parent = (DynamicObject) supplierEntry.getParent();
|
||||
if (entryId == parent.getLong("id")) {// 判断是否该标段对应的供应商
|
||||
if (supplierEntry.getBoolean("isrecommended")) {// 是否中标单位
|
||||
BigDecimal finalPrice = supplierEntry.getBigDecimal("finalprice");
|
||||
finalPriceSum = finalPriceSum.add(finalPrice);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (finalPriceSum.equals(new BigDecimal(0))) continue;
|
||||
|
||||
DynamicObject project = null;
|
||||
BigDecimal controlAmountSum = new BigDecimal(0);
|
||||
for (DynamicObject bottomSection : bottomSections) {
|
||||
int bottomSeq = bottomSection.getInt("seq");
|
||||
if (seq == bottomSeq) {
|
||||
long bottomEntryId = bottomSection.getLong("id");
|
||||
if (!bottomEntries.isEmpty()) project = bottomEntries.get(0).getDynamicObject("botpurentryproject");
|
||||
DynamicObjectCollection bottomEntries = bottomSection.getDynamicObjectCollection("bottomentry");// 采购明细
|
||||
if (bottomEntries != null) {
|
||||
if (!bottomEntries.isEmpty())
|
||||
project = bottomEntries.get(0).getDynamicObject("botpurentryproject");
|
||||
|
||||
for (DynamicObject bottomEntry : bottomEntries) {
|
||||
DynamicObject parent = (DynamicObject) bottomEntry.getParent();
|
||||
if (bottomEntryId == parent.getLong("id")) {
|
||||
BigDecimal controlAmount = bottomEntry.getBigDecimal("botcontrolamount");// 采购控制金额(含税)
|
||||
controlAmountSum = controlAmountSum.add(controlAmount);
|
||||
}
|
||||
|
@ -144,8 +145,9 @@ public class DecisionJumpToConPlanPlugin extends AbstractBillPlugIn implements P
|
|||
}
|
||||
|
||||
if (finalPriceSum.compareTo(controlAmountSum) >= 1) {
|
||||
if (!bottomEntries.isEmpty() && project != null) {
|
||||
if (project != null) {
|
||||
purProjectNum = project.getString("number");
|
||||
seqNum = seq;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -163,6 +165,7 @@ public class DecisionJumpToConPlanPlugin extends AbstractBillPlugIn implements P
|
|||
|
||||
billShowParameter.setCustomParam("decision_id", model.getDataEntity().getLong("id"));
|
||||
billShowParameter.setCustomParam("purproject_number", purProjectNum);
|
||||
billShowParameter.setCustomParam("seqNum", seqNum);
|
||||
|
||||
appPageView.showForm(billShowParameter);
|
||||
getView().sendFormAction(appPageView);
|
||||
|
|
|
@ -0,0 +1,94 @@
|
|||
package shkd.repc.rebm.opplugin;
|
||||
|
||||
import kd.bos.dataentity.entity.DynamicObject;
|
||||
import kd.bos.dataentity.entity.DynamicObjectCollection;
|
||||
import kd.bos.entity.plugin.AbstractOperationServicePlugIn;
|
||||
import kd.bos.entity.plugin.args.AfterOperationArgs;
|
||||
import kd.bos.orm.query.QCP;
|
||||
import kd.bos.orm.query.QFilter;
|
||||
import kd.bos.servicehelper.BusinessDataServiceHelper;
|
||||
import kd.bos.servicehelper.operation.SaveServiceHelper;
|
||||
import kd.sdk.plugin.Plugin;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 单据操作插件
|
||||
*/
|
||||
public class WriteBackAdjustAmountOpPlugin extends AbstractOperationServicePlugIn implements Plugin {
|
||||
|
||||
/*
|
||||
* 目标成本调整-审核/反审核时触发,根据合约规划回‘传调整后金额’
|
||||
* */
|
||||
|
||||
@Override
|
||||
public void afterExecuteOperationTransaction(AfterOperationArgs e) {
|
||||
super.afterExecuteOperationTransaction(e);
|
||||
String operationKey = e.getOperationKey();
|
||||
if ("audit".equals(operationKey) || "test".equals(operationKey)) {
|
||||
DynamicObject[] dataEntities = e.getDataEntities();
|
||||
for (DynamicObject dataEntity : dataEntities) {
|
||||
dataEntity = BusinessDataServiceHelper.loadSingle(dataEntity.getPkValue(), "recos_aimadjust");
|
||||
DynamicObject decision = dataEntity.getDynamicObject("qeug_decision");//定标
|
||||
DynamicObjectCollection conPlanAdjustEntries = dataEntity.getDynamicObjectCollection("conplanadjustentry");// 未签约调整分录
|
||||
if (decision != null) {
|
||||
DynamicObject dynamicObject = BusinessDataServiceHelper.loadSingle(decision.getPkValue(), "rebm_decision");
|
||||
int sectionSeq = dataEntity.getInt("qeug_section_seq");
|
||||
|
||||
DynamicObjectCollection bottomSections = dynamicObject.getDynamicObjectCollection("bottomsection");
|
||||
if (bottomSections != null) {
|
||||
for (DynamicObject bottomSection : bottomSections) {
|
||||
int bottomSeq = bottomSection.getInt("seq");
|
||||
if (sectionSeq == bottomSeq) {
|
||||
DynamicObjectCollection bottomEntries = bottomSection.getDynamicObjectCollection("bottomentry");// 采购明细
|
||||
if (bottomEntries != null) {
|
||||
String billNo = dynamicObject.getString("billno");
|
||||
QFilter billNoQF = new QFilter("billno", QCP.equals, billNo);
|
||||
DynamicObject project = BusinessDataServiceHelper.loadSingle("rebm_project", billNoQF.toArray());// 标前预备会
|
||||
if (project != null) {
|
||||
DynamicObjectCollection bidSections = project.getDynamicObjectCollection("bidsection");// 标段
|
||||
DynamicObject bidSection = bidSections.get(sectionSeq - 1);
|
||||
DynamicObjectCollection projectEntries = bidSection.getDynamicObjectCollection("projectentry");// 采购明细
|
||||
|
||||
for (int i = 0; i < bottomEntries.size(); i++) {
|
||||
DynamicObject bottomEntry = bottomEntries.get(i);
|
||||
BigDecimal planAmount = bottomEntry.getBigDecimal("planamount");
|
||||
if (planAmount.intValue() == 0) continue;
|
||||
|
||||
DynamicObject projectEntry = projectEntries.get(i);
|
||||
DynamicObject cqprogcon = projectEntry.getDynamicObject("cqprogcon");// 合约规划
|
||||
if (conPlanAdjustEntries != null) {
|
||||
for (DynamicObject conPlanAdjustEntry : conPlanAdjustEntries) {
|
||||
DynamicObject conplan = conPlanAdjustEntry.getDynamicObject("cpentry_conplan");
|
||||
if (conplan.getLong("id") == cqprogcon.getLong("id")) {
|
||||
BigDecimal adjustSumAmt = conPlanAdjustEntry.getBigDecimal("cpentry_adjustsumamt");// 调整后金额
|
||||
bottomEntry.set("qeug_planamount", bottomEntry.getBigDecimal("planamount"));
|
||||
bottomEntry.set("qeug_botcontrolamount", bottomEntry.getBigDecimal("botcontrolamount"));
|
||||
|
||||
bottomEntry.set("planamount", adjustSumAmt);
|
||||
bottomEntry.set("botcontrolamount", adjustSumAmt);
|
||||
bottomEntry.set("botctrlamtexceptvat", adjustSumAmt);
|
||||
bottomEntry.set("nottaxplanamount", adjustSumAmt);
|
||||
|
||||
BigDecimal controlamount = dynamicObject.getBigDecimal("controlamount").add(adjustSumAmt.subtract(bottomEntry.getBigDecimal("botcontrolamount")));
|
||||
dynamicObject.set("controlamount", controlamount);
|
||||
dynamicObject.set("exctaxcontrolamount", controlamount);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bottomSection.set("bottomentry", bottomEntries);
|
||||
dynamicObject.set("bottomsection", bottomSections);
|
||||
dynamicObject.set("qeug_conplan_adjust", String.valueOf(dataEntity.getPkValue()));
|
||||
SaveServiceHelper.update(dynamicObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -26,12 +26,17 @@ public class GetDecisionAndPurProjectPlugin extends AbstractBillPlugIn implement
|
|||
FormShowParameter formShowParameter = this.getView().getFormShowParameter();
|
||||
Object decisionId = formShowParameter.getCustomParam("decision_id");
|
||||
Object purProjectNumber = formShowParameter.getCustomParam("purproject_number");
|
||||
Object seqNum = formShowParameter.getCustomParam("seqNum");
|
||||
|
||||
IDataModel model = this.getModel();
|
||||
if (decisionId != null && 0 != (Long) decisionId) {
|
||||
model.setValue("qeug_decision", decisionId);
|
||||
}
|
||||
|
||||
if (seqNum != null) {
|
||||
model.setValue("qeug_section_seq", seqNum);
|
||||
}
|
||||
|
||||
if (purProjectNumber != null && !((String) purProjectNumber).isEmpty()) {
|
||||
DynamicObject project = (DynamicObject) this.getModel().getValue("project");
|
||||
if (project == null) {
|
||||
|
|
Loading…
Reference in New Issue