企业成本核算优化

This commit is contained in:
xuhaihui 2025-11-27 10:44:22 +08:00
parent e997ac2157
commit e957e0a375
1 changed files with 17 additions and 16 deletions

View File

@ -3,6 +3,7 @@ package zcgj.zcdev.zcdev.pr.plugin.form;
import kd.bos.bill.AbstractBillPlugIn;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.DynamicObjectCollection;
import kd.bos.dataentity.entity.LocaleString;
import kd.bos.dataentity.metadata.dynamicobject.DynamicObjectType;
import kd.bos.dataentity.resource.ResManager;
import kd.bos.dataentity.utils.StringUtils;
@ -57,9 +58,14 @@ public class EntCostSplitBillPlugin extends AbstractBillPlugIn implements Before
subEntryEntity.set("zcgj_cbs", cbs);//成本核算维度明细-成本分解结构
}
this.getView().updateView("zcgj_subentryentity");//刷新成本核算维度明细
} /*else if ("costtype".equals(key)) {
} else if ("costtype".equals(key)) {
//成本项
ChangeData[] changeSet = e.getChangeSet();
/* 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();//新值
@ -82,8 +88,8 @@ public class EntCostSplitBillPlugin extends AbstractBillPlugIn implements Before
}
ComboEdit comboEdit = this.getControl("zcgj_sectype");//二级分类
comboEdit.setComboItems(comboItemss);
}*/
comboEdit.setComboItems(comboItemss);*/
}
}
public void beforeF7Select(BeforeF7SelectEvent arg0) {
@ -188,14 +194,15 @@ public class EntCostSplitBillPlugin extends AbstractBillPlugIn implements Before
Object costType = zcgj_accountcost != null ? zcgj_accountcost.get("zcgj_acccostentry.zcgj_costtype") : null; // 成本项
Object secType = zcgj_accountcost != null ? zcgj_accountcost.get("zcgj_acccostentry.zcgj_sectype") : null; // 二级分类
if (costType == null) {
continue;
}
String secTypeName = "";
String costTypeName = "";
if (secType != null) {
secTypeName = secType.toString();
}
if (costType != null) {
costTypeName = costType.toString();
}
String costTypeName = costType.toString();
// 如果二级分类为"70.55"且成本项为"70"则对该行的成本金额进行扣减
if ("70.55".equals(secTypeName) && "70.".equals(costTypeName)) {
@ -303,7 +310,6 @@ public class EntCostSplitBillPlugin extends AbstractBillPlugIn implements Before
}
// 在添加数据前进行排序
entryCollection.clear();
// 将summaryMap转换为List并按成本项数值排序
List<DynamicObject> sortedEntries = new ArrayList<>(summaryMap.values());
sortedEntries.sort((entry1, entry2) -> {
@ -323,14 +329,9 @@ public class EntCostSplitBillPlugin extends AbstractBillPlugIn implements Before
}
});
entryCollection.clear();
// 按排序后的顺序添加数据
for (DynamicObject entry : sortedEntries) {
/* Object costtype = entry.get("costtype");
if (costtype == null) {
continue;
}*/
entryCollection.add(entry);
}
entryCollection.addAll(sortedEntries);
this.getView().updateView("entryentity");//刷新分录
this.getView().updateView("zcgj_subentryentity");//刷新分录