设备成本核算审核添加反写设备台账工序逻辑
This commit is contained in:
parent
9ace55f142
commit
2d4a110ad4
|
|
@ -280,9 +280,9 @@ public class EntCostSplitBillPlugin extends AbstractBillPlugIn implements Before
|
|||
try {
|
||||
Double num1 = Double.parseDouble(costType1.toString().replace(".", ""));
|
||||
Double num2 = Double.parseDouble(costType2.toString().replace(".", ""));
|
||||
return num1.compareTo(num2);
|
||||
return num2.compareTo(num1);
|
||||
} catch (NumberFormatException e) {
|
||||
return costType1.toString().compareTo(costType2.toString());
|
||||
return costType2.toString().compareTo(costType1.toString());
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,41 @@
|
|||
package zcgj.zcdev.zcdev.pr.plugin.operate;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* 设备成本核算审核操作插件
|
||||
* 说明:1、设备成本核算审核通过反写对应成本分解结构至对应设备台账的工序中
|
||||
*/
|
||||
public class EcEqCostSplitAuditOp extends AbstractOperationServicePlugIn {
|
||||
@Override
|
||||
public void afterExecuteOperationTransaction(AfterOperationArgs e) {
|
||||
super.afterExecuteOperationTransaction(e);
|
||||
DynamicObject[] dataEntities = e.getDataEntities();
|
||||
for (DynamicObject model : dataEntities) {
|
||||
long id = model.getLong("id");
|
||||
QFilter f1 = new QFilter("id", "=", id);
|
||||
DynamicObject eceq_costsplit = BusinessDataServiceHelper.loadSingle("eceq_costsplit", new QFilter[]{f1});//设备成本核算
|
||||
DynamicObjectCollection settleSplitEntityCollection = eceq_costsplit.getDynamicObjectCollection("settlesplitentity");//结算明细
|
||||
for (DynamicObject settleSplitEntity : settleSplitEntityCollection) {
|
||||
DynamicObjectCollection costSplitEntityCollection = settleSplitEntity.getDynamicObjectCollection("costsplitentity");//成本分摊明细
|
||||
for (DynamicObject costSplitEntity : costSplitEntityCollection) {
|
||||
DynamicObject equipment = costSplitEntity.getDynamicObject("equipment");//设备名称
|
||||
if (equipment != null) {
|
||||
String equipmentNumber = equipment.getString("number");//设备编号
|
||||
QFilter[] qFilters = new QFilter[]{new QFilter("number", QCP.equals, equipmentNumber)};
|
||||
DynamicObject eceq_equipinfo = BusinessDataServiceHelper.loadSingle("eceq_equipinfo", "id,zcgj_cbs", qFilters);//设备台账
|
||||
eceq_equipinfo.set("zcgj_cbs", costSplitEntity.get("procbs"));//设备台账-工序
|
||||
SaveServiceHelper.save(new DynamicObject[]{eceq_equipinfo});//保存
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue