|
@@ -43,6 +43,8 @@ public class SapVoucherSaveOpPlugin extends AbstractOperationServicePlugIn {
|
|
|
DynamicObject[] billEntities = e.getDataEntities();
|
|
|
|
|
|
List<Long> publicIds = new ArrayList<>();
|
|
|
+ List<Long> tripIds = new ArrayList<>();
|
|
|
+
|
|
|
for (DynamicObject billInfo : billEntities) {
|
|
|
DynamicObjectCollection entrys = billInfo.getDynamicObjectCollection("entryentity");
|
|
|
for(DynamicObject entry : entrys){
|
|
@@ -52,22 +54,21 @@ public class SapVoucherSaveOpPlugin extends AbstractOperationServicePlugIn {
|
|
|
|
|
|
String billNo = entry.getString("nckd_bxbillno");
|
|
|
Long billId = entry.getLong("nckd_bxbillid");
|
|
|
- String entityName = "";
|
|
|
- if("CL".equals(billNo.substring(0, 2))){
|
|
|
|
|
|
- } else {
|
|
|
- entityName = "er_publicreimbursebill";
|
|
|
+ //差旅报销单
|
|
|
+ if("CL".equals(billNo.substring(0, 2))){
|
|
|
+ tripIds.add(billId);
|
|
|
}
|
|
|
-
|
|
|
- if(StringUtils.isEmpty(entityName)){
|
|
|
- continue;
|
|
|
+ //对公报销单
|
|
|
+ else {
|
|
|
+ publicIds.add(billId);
|
|
|
}
|
|
|
-
|
|
|
- publicIds.add(billId);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- String operationKey = "nckd_returnbudget";
|
|
|
+ String operationKey = "nckd_returnbudge";
|
|
|
+
|
|
|
+ //对公报销单返还
|
|
|
if(publicIds.size() > 0) {
|
|
|
String entityName = "er_publicreimbursebill";
|
|
|
MainEntityType entityType= EntityMetadataCache.getDataEntityType(entityName);
|
|
@@ -76,5 +77,15 @@ public class SapVoucherSaveOpPlugin extends AbstractOperationServicePlugIn {
|
|
|
//调用报销付款单预算返还操作
|
|
|
OperationResult returnResult = OperationServiceHelper.executeOperate(operationKey, entityName, publicBills, OperateOption.create());
|
|
|
}
|
|
|
+
|
|
|
+ //差旅报销单返还
|
|
|
+ if(publicIds.size() > 0) {
|
|
|
+ String entityName = "er_tripreimbursebill";
|
|
|
+ MainEntityType entityType= EntityMetadataCache.getDataEntityType(entityName);
|
|
|
+ DynamicObject[] publicBills = BusinessDataServiceHelper.load(publicIds.toArray(), entityType);
|
|
|
+
|
|
|
+ //调用报销付款单预算返还操作
|
|
|
+ OperationResult returnResult = OperationServiceHelper.executeOperate(operationKey, entityName, publicBills, OperateOption.create());
|
|
|
+ }
|
|
|
}
|
|
|
}
|