材料收发统计表优化系统查询代码

This commit is contained in:
xuhaihui 2025-12-23 14:27:19 +08:00
parent 5f28026d69
commit d0b3bc0463
1 changed files with 12 additions and 3 deletions

View File

@ -32,6 +32,9 @@ import kd.bos.servicehelper.org.OrgUnitServiceHelper;
import kd.ec.basedata.common.utils.CurrencyHelper;
import org.jetbrains.annotations.NotNull;
/**
* 材料收发统计表二开系统查询插件源插件kd.ec.material.report.WarehouseReportQueryPlugin
*/
public class WarehouseReportQueryPluginExt extends AbstractReportListDataPlugin {
private static final String[] sumFieldArr = new String[]{"initqty", "initamtoftax", "initamtofnotax", "inqty", "inamtofnotax", "inamtoftax", "outqty", "outamtoftax", "outamtofnotax", "stockqty", "stockamtoftax", "stockamtofnotax"};
private static final List<String> commonSelectFieldList = (List) Stream.of("materialnumber", " modelnum", "calculateunit", "lotnum", "initqty", "initamtoftax", "initamtofnotax", "inqty", "inamtofnotax", "inamtoftax", "outqty", "outamtoftax", "outamtofnotax", "stockqty", "stockamtoftax", "stockamtofnotax", "project", "unitproject", "warehouse").collect(Collectors.toList());
@ -382,7 +385,9 @@ public class WarehouseReportQueryPluginExt extends AbstractReportListDataPlugin
}
private DataSet getMaterialInitDataSet(List<QFilter> inFilter, DynamicObject orgCurrency, DynamicObject exRateTable) {
String materialInString = "billno,project,warehouse,entryentity.material.resource.name as resourcename,entryentity.material.resource as resource,entryentity.material as materialnumber,entryentity.modelnum as modelnum,entryentity.measureunit as calculateunit,entryentity.lot as lotnum,case when transtype.type='INCREASE' then entryentity.qty when transtype.type='REDUCE' then 0-entryentity.qty else 0 end as initqty,case when transtype.type='INCREASE' then entryentity.oftaxamount when transtype.type='REDUCE' then 0-entryentity.oftaxamount else 0 end as initamtoftax,case when transtype.type='INCREASE' then entryentity.notaxamount when transtype.type='REDUCE' then 0-entryentity.notaxamount else 0 end as initamtofnotax,currency,unitprojectpro as unitproject";
//entryentity.notaxamount更换为entryentity.amount
String materialInString = "billno,project,warehouse,entryentity.material.resource.name as resourcename,entryentity.material.resource as resource,entryentity.material as materialnumber,entryentity.modelnum as modelnum,entryentity.measureunit as calculateunit,entryentity.lot as lotnum,case when transtype.type='INCREASE' then entryentity.qty when transtype.type='REDUCE' then 0-entryentity.qty else 0 end as initqty,case when transtype.type='INCREASE' then entryentity.oftaxamount when transtype.type='REDUCE' then 0-entryentity.oftaxamount else 0 end as initamtoftax,case when transtype.type='INCREASE' then entryentity.amount when transtype.type='REDUCE' then 0-entryentity.amount else 0 end as initamtofnotax,currency,unitprojectpro as unitproject";//二开替代
// String materialInString = "billno,project,warehouse,entryentity.material.resource.name as resourcename,entryentity.material.resource as resource,entryentity.material as materialnumber,entryentity.modelnum as modelnum,entryentity.measureunit as calculateunit,entryentity.lot as lotnum,case when transtype.type='INCREASE' then entryentity.qty when transtype.type='REDUCE' then 0-entryentity.qty else 0 end as initqty,case when transtype.type='INCREASE' then entryentity.oftaxamount when transtype.type='REDUCE' then 0-entryentity.oftaxamount else 0 end as initamtoftax,case when transtype.type='INCREASE' then entryentity.notaxamount when transtype.type='REDUCE' then 0-entryentity.notaxamount else 0 end as initamtofnotax,currency,unitprojectpro as unitproject";//源码
inFilter.add(new QFilter("matbilltype", "=", "materialin"));
inFilter.add(new QFilter("transtype.type", "!=", "UNIMPACT"));
DataSet materialInDataSet = QueryServiceHelper.queryDataSet(this.getClass().getName(), "ecma_materialinbill", materialInString, (QFilter[]) inFilter.toArray(new QFilter[inFilter.size()]), "");
@ -511,7 +516,9 @@ public class WarehouseReportQueryPluginExt extends AbstractReportListDataPlugin
}
private DataSet getMaterialInInOutDataSet(List<QFilter> inFilter, DynamicObject orgCurrency, DynamicObject exRateTable) {
String materialInString = "billno,project,warehouse,entryentity.material.resource.name as resourcename,entryentity.material.resource as resource,entryentity.material as materialnumber,entryentity.modelnum as modelnum,entryentity.measureunit as calculateunit,entryentity.lot as lotnum,case when transtype.type='INCREASE' then entryentity.qty when transtype.type='REDUCE' then 0-entryentity.qty else 0 end as inqty,0 as outqty,case when transtype.type='INCREASE' then entryentity.oftaxamount when transtype.type='REDUCE' then 0-entryentity.oftaxamount else 0 end as inamtoftax,case when transtype.type='INCREASE' then entryentity.notaxamount when transtype.type='REDUCE' then 0-entryentity.notaxamount else 0 end as inamtofnotax,0 as outamtoftax,0 as outamtofnotax,currency,unitprojectpro as unitproject";
//entryentity.notaxamount更换为entryentity.amount
String materialInString = "billno,project,warehouse,entryentity.material.resource.name as resourcename,entryentity.material.resource as resource,entryentity.material as materialnumber,entryentity.modelnum as modelnum,entryentity.measureunit as calculateunit,entryentity.lot as lotnum,case when transtype.type='INCREASE' then entryentity.qty when transtype.type='REDUCE' then 0-entryentity.qty else 0 end as inqty,0 as outqty,case when transtype.type='INCREASE' then entryentity.oftaxamount when transtype.type='REDUCE' then 0-entryentity.oftaxamount else 0 end as inamtoftax,case when transtype.type='INCREASE' then entryentity.amount when transtype.type='REDUCE' then 0-entryentity.amount else 0 end as inamtofnotax,0 as outamtoftax,0 as outamtofnotax,currency,unitprojectpro as unitproject";//二开替代
// String materialInString = "billno,project,warehouse,entryentity.material.resource.name as resourcename,entryentity.material.resource as resource,entryentity.material as materialnumber,entryentity.modelnum as modelnum,entryentity.measureunit as calculateunit,entryentity.lot as lotnum,case when transtype.type='INCREASE' then entryentity.qty when transtype.type='REDUCE' then 0-entryentity.qty else 0 end as inqty,0 as outqty,case when transtype.type='INCREASE' then entryentity.oftaxamount when transtype.type='REDUCE' then 0-entryentity.oftaxamount else 0 end as inamtoftax,case when transtype.type='INCREASE' then entryentity.notaxamount when transtype.type='REDUCE' then 0-entryentity.notaxamount else 0 end as inamtofnotax,0 as outamtoftax,0 as outamtofnotax,currency,unitprojectpro as unitproject";//源码
inFilter.add(new QFilter("matbilltype", "=", "materialin"));
inFilter.add(new QFilter("transtype.type", "!=", "UNIMPACT"));
DataSet materialInDataSet = QueryServiceHelper.queryDataSet(this.getClass().getName(), "ecma_materialinbill", materialInString, (QFilter[]) inFilter.toArray(new QFilter[inFilter.size()]), "");
@ -582,7 +589,9 @@ public class WarehouseReportQueryPluginExt extends AbstractReportListDataPlugin
}
private DataSet getMaterialInStockDataSet(List<QFilter> inFilter, DynamicObject orgCurrency, DynamicObject exRateTable) {
String materialInString = "billno,project,warehouse,entryentity.material.resource.name as resourcename,entryentity.material.resource as resource,entryentity.material as materialnumber,entryentity.modelnum as modelnum,entryentity.measureunit as calculateunit,entryentity.lot as lotnum,case when transtype.type='INCREASE' then entryentity.qty when transtype.type='REDUCE' then 0-entryentity.qty else 0 end as stockqty,case when transtype.type='INCREASE' then entryentity.oftaxamount when transtype.type='REDUCE' then 0-entryentity.oftaxamount else 0 end as stockamtoftax,case when transtype.type='INCREASE' then entryentity.notaxamount when transtype.type='REDUCE' then 0-entryentity.notaxamount else 0 end as stockamtofnotax,currency,unitprojectpro as unitproject";
//entryentity.notaxamount更换为entryentity.amount
String materialInString = "billno,project,warehouse,entryentity.material.resource.name as resourcename,entryentity.material.resource as resource,entryentity.material as materialnumber,entryentity.modelnum as modelnum,entryentity.measureunit as calculateunit,entryentity.lot as lotnum,case when transtype.type='INCREASE' then entryentity.qty when transtype.type='REDUCE' then 0-entryentity.qty else 0 end as stockqty,case when transtype.type='INCREASE' then entryentity.oftaxamount when transtype.type='REDUCE' then 0-entryentity.oftaxamount else 0 end as stockamtoftax,case when transtype.type='INCREASE' then entryentity.amount when transtype.type='REDUCE' then 0-entryentity.amount else 0 end as stockamtofnotax,currency,unitprojectpro as unitproject";//二开替代
// String materialInString = "billno,project,warehouse,entryentity.material.resource.name as resourcename,entryentity.material.resource as resource,entryentity.material as materialnumber,entryentity.modelnum as modelnum,entryentity.measureunit as calculateunit,entryentity.lot as lotnum,case when transtype.type='INCREASE' then entryentity.qty when transtype.type='REDUCE' then 0-entryentity.qty else 0 end as stockqty,case when transtype.type='INCREASE' then entryentity.oftaxamount when transtype.type='REDUCE' then 0-entryentity.oftaxamount else 0 end as stockamtoftax,case when transtype.type='INCREASE' then entryentity.notaxamount when transtype.type='REDUCE' then 0-entryentity.notaxamount else 0 end as stockamtofnotax,currency,unitprojectpro as unitproject";//源码
inFilter.add(new QFilter("matbilltype", "=", "materialin"));
inFilter.add(new QFilter("transtype.type", "!=", "UNIMPACT"));
DataSet materialInDataSet = QueryServiceHelper.queryDataSet(this.getClass().getName(), "ecma_materialinbill", materialInString, (QFilter[]) inFilter.toArray(new QFilter[inFilter.size()]), "");