Compare commits

..

2 Commits

Author SHA1 Message Date
0ed12d3870 Merge branch 'refs/heads/fix-report-zzs' into test 2024-09-05 21:25:43 +08:00
1d42c39d8c change:报表产品分类多选 2024-09-05 20:44:19 +08:00
4 changed files with 46 additions and 6 deletions

View File

@ -20,8 +20,7 @@ import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.*;
import static com.yem.rf.utils.RFUtils.formatDate;
import static com.yem.rf.utils.RFUtils.getBaseQFilter;
import static com.yem.rf.utils.RFUtils.*;
/**
* @Description: 整机发运明细表
@ -107,6 +106,10 @@ public class CompleteShipDetailReportPlugin extends AbstractReportListDataPlugin
if (producttype > 0) {
qFilter.and("yem_bd_products.id", "=", producttype);
}
List<Long> fproducttypem = getFBaseDataIds(filter, "yem_fproducttypem");
if (!fproducttypem.isEmpty()) {
qFilter.and("yem_bd_products.id", "IN", fproducttypem);
}
ArrayList<String> selectfields = Lists.newArrayList();
selectfields.add("yem_es_materialinfo.id main_detail_id");
selectfields.add("id main_id");

View File

@ -17,8 +17,7 @@ import kd.bos.servicehelper.QueryServiceHelper;
import java.math.BigDecimal;
import java.util.*;
import static com.yem.rf.utils.RFUtils.formatDate;
import static com.yem.rf.utils.RFUtils.getBaseQFilter;
import static com.yem.rf.utils.RFUtils.*;
/**
* @Description: TODO
@ -107,6 +106,10 @@ public class ITCOrderDetailsReportPlugin extends AbstractReportListDataPlugin {
sb.append(" AND yem_products = ").append(producttype);
}
List<Long> fproducttypem = getFBaseDataIds(filter, "yem_fproducttypem");
String concated = concatFBaseDataFilter(fproducttypem, "yem_products");
sb.append(concated);
resDataSet = resDataSet.addField("0.0", "yem_inventoryqty");
DataSet where = resDataSet.where(sb.toString());

View File

@ -18,8 +18,7 @@ import java.util.List;
import static com.yem.rf.salescommission.CompleteShipDetailReportPlugin.queryGathering_ClaimDate;
import static com.yem.rf.salescommission.CompleteShipDetailReportPlugin.querySalesOrder_PayRate;
import static com.yem.rf.utils.RFUtils.formatDate;
import static com.yem.rf.utils.RFUtils.getBaseQFilter;
import static com.yem.rf.utils.RFUtils.*;
/**
* @Description: TODO
@ -116,6 +115,10 @@ public class SalesCommissionReportPlugin extends AbstractReportListDataPlugin {
where.append(" AND yem_salesman = ").append(foperator);
}
List<Long> fproducttypem = getFBaseDataIds(filter, "yem_fproducttypem");
String concated = concatFBaseDataFilter(fproducttypem, "yem_products");
where.append(concated);
resDataSet = resDataSet.where(where.toString());
return resDataSet;

View File

@ -1,10 +1,12 @@
package com.yem.rf.utils;
import com.yem.wm.utils.YEM;
import kd.bos.algo.DataSet;
import kd.bos.dataentity.entity.DynamicObject;
import kd.bos.dataentity.entity.DynamicObjectCollection;
import kd.bos.dataentity.metadata.IDataEntityProperty;
import kd.bos.dataentity.metadata.clr.DataEntityPropertyCollection;
import kd.bos.entity.report.FilterInfo;
import kd.bos.orm.ORM;
import kd.bos.orm.query.QFilter;
@ -87,4 +89,33 @@ public class RFUtils {
}
return list;
}
public static List<Long> getFBaseDataIds(FilterInfo filter, String propName) {
List<Long> ids = new ArrayList<>();
DynamicObjectCollection collection = filter.getDynamicObjectCollection(propName);
for (DynamicObject d : collection) {
long id = d.getLong("id");
ids.add(id);
}
return ids;
}
public static String concatFBaseDataFilter(List<Long> ids, String propName) {
StringBuilder sb = new StringBuilder();
if (YEM.isNotEmpty(ids)) {
sb.append(" AND ").append(propName).append(" IN (");
for (Long i : ids) {
int idx = ids.indexOf(i);
if (idx == ids.size() - 1) {
sb.append(i);
} else {
sb.append(i).append(",");
}
}
sb.append(")");
}
return sb.toString();
}
}