修复获取分录为空BUG、修正错误字段标识-龚宇杰
This commit is contained in:
parent
8944160f16
commit
7ad00cc967
|
@ -30,9 +30,9 @@ public class GetExpenseStandardPlugin extends AbstractBillPlugIn implements Plug
|
||||||
@Override
|
@Override
|
||||||
public void propertyChanged(PropertyChangedArgs e) {
|
public void propertyChanged(PropertyChangedArgs e) {
|
||||||
IDataModel model = this.getModel();
|
IDataModel model = this.getModel();
|
||||||
DynamicObject bill = model.getDataEntity();
|
DynamicObject bill = model.getDataEntity(true);
|
||||||
|
|
||||||
String reimburseType = bill.getString("reimburseType");
|
String reimburseType = bill.getString("zf47_reimburse_type");// 报账类型
|
||||||
if (reimburseType == null || reimburseType.isEmpty()) return;
|
if (reimburseType == null || reimburseType.isEmpty()) return;
|
||||||
|
|
||||||
DynamicObjectCollection expenseEntries = bill.getDynamicObjectCollection("expenseentryentity");// 费用明细分录
|
DynamicObjectCollection expenseEntries = bill.getDynamicObjectCollection("expenseentryentity");// 费用明细分录
|
||||||
|
@ -71,6 +71,7 @@ public class GetExpenseStandardPlugin extends AbstractBillPlugIn implements Plug
|
||||||
}
|
}
|
||||||
|
|
||||||
String changeName = e.getProperty().getName();
|
String changeName = e.getProperty().getName();
|
||||||
|
log.info("GetExpenseStandardPlugin:值更新字段标识(" + changeName + ")");
|
||||||
if (headFields.contains(changeName)) {//值更新字段在单据头
|
if (headFields.contains(changeName)) {//值更新字段在单据头
|
||||||
for (int i = 0; i < expenseEntries.size(); i++) {
|
for (int i = 0; i < expenseEntries.size(); i++) {
|
||||||
DynamicObject expenseEntry = expenseEntries.get(i);
|
DynamicObject expenseEntry = expenseEntries.get(i);
|
||||||
|
@ -83,11 +84,11 @@ public class GetExpenseStandardPlugin extends AbstractBillPlugIn implements Plug
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
model.setValue("zf47_expense_standards", BigDecimal.ZERO, i);
|
model.setValue("zf47_expense_standards", BigDecimal.ZERO, i);
|
||||||
model.setValue("fk_zf47_standard_unit", "", i);
|
model.setValue("zf47_standard_unit", "", i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (entryFields.contains(changeName)) {//值更新字段在费用明细分录
|
} else if (entryFields.contains(changeName) || "expenseitem".equals(changeName)) {//值更新字段在费用明细分录
|
||||||
int rowIndex = e.getChangeSet()[0].getRowIndex();
|
int rowIndex = e.getChangeSet()[0].getRowIndex();
|
||||||
DynamicObject expenseEntry = expenseEntries.get(rowIndex);
|
DynamicObject expenseEntry = expenseEntries.get(rowIndex);
|
||||||
DynamicObject expenseItem = expenseEntry.getDynamicObject("expenseitem");
|
DynamicObject expenseItem = expenseEntry.getDynamicObject("expenseitem");
|
||||||
|
@ -99,14 +100,17 @@ public class GetExpenseStandardPlugin extends AbstractBillPlugIn implements Plug
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
model.setValue("zf47_expense_standards", BigDecimal.ZERO, rowIndex);
|
model.setValue("zf47_expense_standards", BigDecimal.ZERO, rowIndex);
|
||||||
model.setValue("fk_zf47_standard_unit", "", rowIndex);
|
model.setValue("zf47_standard_unit", "", rowIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
log.warn("GetExpenseStandardPlugin:值更新字段(" + changeName + ")不在HeadFields(" + headFields + ")、EntryFields(" + entryFields + ")");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据报账类型、费用项目编码组成的过滤条件从费用标准配置表中取值,并一一与分录对象进行比较,最终获取到对应的费用标准和标准单位,组成HashMap集合并返回
|
* 根据报账类型、费用项目编码组成的过滤条件从费用标准配置表中取值,并一一与分录对象进行比较,最终获取到对应的费用标准和标准单位,组成HashMap集合并返回
|
||||||
|
*
|
||||||
* @param entryFields 费用明细分录字段标识集合
|
* @param entryFields 费用明细分录字段标识集合
|
||||||
* @param reimburseType 报账类型
|
* @param reimburseType 报账类型
|
||||||
* @param expenseItem 费用项目编码
|
* @param expenseItem 费用项目编码
|
||||||
|
@ -117,9 +121,9 @@ public class GetExpenseStandardPlugin extends AbstractBillPlugIn implements Plug
|
||||||
QFilter filter = new QFilter("zf47_reimburse_type", QCP.equals, reimburseType)
|
QFilter filter = new QFilter("zf47_reimburse_type", QCP.equals, reimburseType)
|
||||||
.and(new QFilter("zf47_expense_item.number", QCP.equals, expenseItem));
|
.and(new QFilter("zf47_expense_item.number", QCP.equals, expenseItem));
|
||||||
|
|
||||||
DynamicObject[] standardConfigIds = BusinessDataServiceHelper.load("zf47_exp_standard_conf","id", filter.toArray());
|
DynamicObject[] standardConfigIds = BusinessDataServiceHelper.load("zf47_exp_standard_conf", "id", filter.toArray());
|
||||||
if (standardConfigIds == null || standardConfigIds.length == 0) {
|
if (standardConfigIds == null || standardConfigIds.length == 0) {
|
||||||
log.info("GetExpenseStandardPlugin:根据reimburseType:"+reimburseType+"、expenseItem:"+expenseItem+",没有获取到费用标准");
|
log.info("GetExpenseStandardPlugin:根据reimburseType:" + reimburseType + "、expenseItem:" + expenseItem + ",没有获取到费用标准");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,6 +141,7 @@ public class GetExpenseStandardPlugin extends AbstractBillPlugIn implements Plug
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 遍历费用明细分录字段标识集合,从两个对象中取值判断是否相等,都相等则符合该标准返回true
|
* 遍历费用明细分录字段标识集合,从两个对象中取值判断是否相等,都相等则符合该标准返回true
|
||||||
|
*
|
||||||
* @param entryFields 费用明细分录字段标识集合
|
* @param entryFields 费用明细分录字段标识集合
|
||||||
* @param expenseEntry 费用明细分录对象
|
* @param expenseEntry 费用明细分录对象
|
||||||
* @param standardConfig 费用标准配置对象
|
* @param standardConfig 费用标准配置对象
|
||||||
|
@ -144,8 +149,6 @@ public class GetExpenseStandardPlugin extends AbstractBillPlugIn implements Plug
|
||||||
private boolean isAccordWithExpenseStandards(ArrayList<String> entryFields, DynamicObject expenseEntry, DynamicObject standardConfig) {
|
private boolean isAccordWithExpenseStandards(ArrayList<String> entryFields, DynamicObject expenseEntry, DynamicObject standardConfig) {
|
||||||
int num = 0;
|
int num = 0;
|
||||||
for (String entryField : entryFields) {
|
for (String entryField : entryFields) {
|
||||||
if ("zf47_expense_item".equals(entryField)) continue;
|
|
||||||
|
|
||||||
Object object1 = expenseEntry.get(entryField);
|
Object object1 = expenseEntry.get(entryField);
|
||||||
Object object2 = standardConfig.get(entryField);
|
Object object2 = standardConfig.get(entryField);
|
||||||
if (object1 == null && object2 == null) {
|
if (object1 == null && object2 == null) {
|
||||||
|
|
Loading…
Reference in New Issue