如下代码是单据转换插件中的
for (ExtendedDataEntity entry : extendedDataEntities) {
DynamicObject bill = entry.getDataEntity();
//目标单数据
DynamicObjectCollection recordchange = bill.getDynamicObjectCollection("yfsw_method_relation1");
// 源单数据
List<DynamicObject> convertSource = (List<DynamicObject>) entry.getValue("ConvertSource");
for (DynamicObject dynamicObject : convertSource) {
// 获取源单id,通过源单id获取源单的信息
long sourceId = dynamicObject.getLong("id");
DynamicObject yuandan = BusinessDataServiceHelper.loadSingle(sourceId, "yfsw_dcxys_change_record");
DynamicObjectCollection dcxy_recordchange = yuandan.getDynamicObjectCollection("yfsw_method_relation");
bill.set("yfsw_mothername", yuandan.get("yfsw_mo"));
bill.set("yfsw_fathername", yuandan.get("yfsw_fa"));
bill.set("yfsw_agreementid", yuandan.get("yfsw_textfield"));
for(DynamicObject dcxy : dcxy_recordchange){
DynamicObject recordchange_newcol = recordchange.addNew();
recordchange_newcol.set("yfsw_before_type", dcxy.get("yfsw_before_type"));
recordchange_newcol.set("yfsw_beforemethod", dcxy.get("yfsw_beforemethod"));
recordchange_newcol.set("yfsw_perferamt", dcxy.get("yfsw_perferamt"));
recordchange_newcol.set("yfsw_actualamt", dcxy.get("yfsw_actualamt"));
recordchange_newcol.set("yfsw_after_type", dcxy.get("yfsw_after_type"));
recordchange_newcol.set("yfsw_aftermethod", dcxy.get("yfsw_aftermethod"));
recordchange_newcol.set("yfsw_afterpreferamt", dcxy.get("yfsw_afterpreferamt"));
recordchange_newcol.set("yfsw_amountfield", dcxy.get("yfsw_amountfield"));
recordchange_newcol.set("yfsw_afteractulamt", dcxy.get("yfsw_afteractulamt"));
DynamicObject objet = recordchange_newcol.getDynamicObject("yfsw_beforemethod");
DynamicObject object1 = recordchange_newcol.getDynamicObject("yfsw_aftermethod");
String way = objet.getString("yfsw_combofield");
String way1 = object1.getString("yfsw_combofield");
if (way.equals("0")) {way = "趸交";}if (way.equals("1")) {way = "分次交";}if (way.equals("2")) {way = "分年交";}if (way.equals("3")) {way = "免费";} if (way.equals("4")){ way = "特殊";}
if (way1.equals("0")) {way1 = "趸交";}if (way1.equals("1")) {way1 = "分次交";}if (way1.equals("2")) {way1 = "分年交";}if (way1.equals("3")) {way1 = "免费";} if (way1.equals("4")){ way1 = "特殊";}
recordchange_newcol.set("yfsw_beforepaytype", way);
recordchange_newcol.set("yfsw_afterpaytype", way1);
BigDecimal temp = new BigDecimal("0");
temp = recordchange_newcol.getBigDecimal("yfsw_afteractulamt").subtract(recordchange_newcol.getBigDecimal("yfsw_actualamt"));
all = all.add(temp);
}
}
本文链接:https://www.naiteiy.site/index.php/archives/84/