企业成本核算优化

This commit is contained in:
xuhaihui 2025-11-28 10:45:24 +08:00
parent 1bd3f83051
commit 813de02ef8
2 changed files with 29 additions and 32 deletions

View File

@ -43,6 +43,7 @@ import java.util.*;
* 说明1点击自动取数按钮获取核算余额表
* 2子分录成本分解结构跟随父分录成本分解结构赋值
* 3子分录成本分解结构过滤逻辑
* 4二级分类过滤逻辑
* 工序即为成本分解结构
*/
public class EntCostSplitBillPlugin extends AbstractBillPlugIn implements BeforeF7SelectListener, Plugin {
@ -51,6 +52,8 @@ public class EntCostSplitBillPlugin extends AbstractBillPlugIn implements Before
super.registerListener(e);
BasedataEdit cbs = (BasedataEdit) this.getControl("zcgj_cbs");
cbs.addBeforeF7SelectListener(this);
BasedataEdit zcgj_sectypef7 = (BasedataEdit) this.getControl("zcgj_sectypef7");
zcgj_sectypef7.addBeforeF7SelectListener(this);
this.addItemClickListeners("advcontoolbarap");
}
@ -71,44 +74,22 @@ public class EntCostSplitBillPlugin extends AbstractBillPlugIn implements Before
this.getView().updateView("zcgj_subentryentity");//刷新成本核算维度明细
} else if ("costtype".equals(key)) {
//成本项
/* ComboEdit comboEdit = this.getControl("zcgj_sectype");
List<ComboItem> data = new ArrayList<>();
data.add(new ComboItem(new LocaleString("工资奖金"), "10."));
data.add(new ComboItem(new LocaleString("60.10"), "60."));
comboEdit.setComboItems(data);*/
/* ChangeData[] changeSet = e.getChangeSet();
ChangeData changeData = changeSet[0];
Object newValue = changeData.getNewValue();//新值
MainEntityType dataEntityType = this.getModel().getDataEntityType();
ComboProp zcgj_sectype = (ComboProp) dataEntityType.getProperty("zcgj_sectype");
List<ValueMapItem> comboItems = zcgj_sectype.getComboItems();
this.getModel().setValue("zcgj_sectype", null);
List<ComboItem> comboItemss = new ArrayList<>();
List<String> item1 = new ArrayList<>();
item1.add("10.10");
item1.add("10.20");
item1.add("10.30");
List<String> item6 = new ArrayList<>();
item6.add("60.10");
if (newValue.equals("10.")) {
comboItemFor(comboItems, item1, comboItemss);
} else if (newValue.equals("60.")) {
comboItemFor(comboItems, item6, comboItemss);
ChangeData changeData = e.getChangeSet()[0];
int rowIndex = changeData.getRowIndex();
Object newValue = changeData.getNewValue();
Object oldValue = changeData.getOldValue();
if (newValue == null || !newValue.equals(oldValue)) {
this.getModel().setValue("zcgj_sectypef7", null, rowIndex);//二级分类
}
ComboEdit comboEdit = this.getControl("zcgj_sectype");//二级分类
comboEdit.setComboItems(comboItemss);*/
}
}
public void beforeF7Select(BeforeF7SelectEvent arg0) {
ListShowParameter parameter = (ListShowParameter) arg0.getFormShowParameter();
int row = arg0.getRow();
String name = arg0.getProperty().getName();
if (StringUtils.equals(name, "zcgj_cbs")) {
//成本核算维度明细-成本分解结构
int row = arg0.getRow();
ListShowParameter parameter = (ListShowParameter) arg0.getFormShowParameter();
arg0.setCancel(true);
DynamicObject project = (DynamicObject) this.getModel().getValue("zcgj_project", row);//成本核算维度明细-成本分解结构
if (project == null) {
@ -122,6 +103,19 @@ public class EntCostSplitBillPlugin extends AbstractBillPlugIn implements Before
parameter.getListFilterParameter().setFilter(qFilter);
parameter.setFormId("bos_listf7");
this.getView().showForm(parameter);
} else if (StringUtils.equals(name, "zcgj_sectypef7")) {
//企业费用成本分摊明细分录-二级分类
Object costType = this.getModel().getValue("costtype", row);//成本项
List<QFilter> qFilter = new ArrayList<>();
if (costType != null) {
String costTypeStr = costType.toString();
qFilter.add(new QFilter("number", QCP.like, costTypeStr.substring(0, Math.min(3, costTypeStr.length())) + "%"));
} else {
this.getView().showMessage(ResManager.loadKDString("请先选择成本项。", "EntCostSplitEditPlugin_0", "ec-ecco-formplugin", new Object[0]));
arg0.setCancel(true);
return;
}
parameter.getListFilterParameter().setQFilters(qFilter);
}
}

View File

@ -32,6 +32,9 @@ import kd.ec.basedata.common.utils.EcNumberHelper;
import kd.ec.basedata.common.utils.OpenPageUtils;
import kd.ec.cost.formplugin.AbstractEccoBillPlugin;
/**
* 企业成本核算系统插件二开
*/
public class EntCostSplitEditPluginExt extends AbstractEccoBillPlugin implements BeforeF7SelectListener {
private static final String PROJECT = "project";
private static final String EC_PROJECT = "ec_project";
@ -228,10 +231,10 @@ public class EntCostSplitEditPluginExt extends AbstractEccoBillPlugin implements
break;
case "project":
this.getModel().setValue("boq", (Object) null, rowIndex);
this.getModel().setValue("cbs", (Object) null, rowIndex);
// this.getModel().setValue("cbs", (Object) null, rowIndex);//二开注释掉的
this.getModel().setValue("unitproject", (Object) null, rowIndex);
this.getModel().setValue("costaccount", (Object) null, rowIndex);
this.getModel().setValue("costamount", (Object) null, rowIndex);
// this.getModel().setValue("costamount", (Object) null, rowIndex);//二开注释掉的
this.getModel().setValue("resource", (Object) null, rowIndex);
this.getModel().setValue("costqty", (Object) null, rowIndex);
}