Index: ssts-diposablegoods/src/main/java/com/forgon/disinfectsystem/diposablegoods/util/GodownEntryUtil.java =================================================================== diff -u --- ssts-diposablegoods/src/main/java/com/forgon/disinfectsystem/diposablegoods/util/GodownEntryUtil.java (revision 0) +++ ssts-diposablegoods/src/main/java/com/forgon/disinfectsystem/diposablegoods/util/GodownEntryUtil.java (revision 13071) @@ -0,0 +1,30 @@ +package com.forgon.disinfectsystem.diposablegoods.util; + +import com.forgon.disinfectsystem.entity.assestmanagement.GodownEntry; +import com.forgon.tools.string.StringTools; + +/** + * GodownEntry实体类的工具方法 + * @author kzh + * + */ +public final class GodownEntryUtil { + /** + * 生成筛选入/退库单类型的where条件子句,并且入库单和退库单会过滤掉调拨单产生的入库单和退库单 + * @param poName po名称 + * @param type 单类型,可选值为{@link com.forgon.disinfectsystem.entity.assestmanagement.GodownEntry.TYPE_IN}、{@link com.forgon.disinfectsystem.entity.assestmanagement.GodownEntry.TYPE_OUT} + *
如果为空,返回值为 (1=1) + * @return + */ + public static String getGodownEntryTypeSqlWhere(String poName,String type){ + String sql = " ( 1=1 ) "; + if(!StringTools.isBlank(type)){ + sql += " and " + poName + ".type='" + type + "'"; + if(GodownEntry.TYPE_IN.equals(type) || GodownEntry.TYPE_OUT.equals(type)){ + sql += " and ( " + poName + ".sourceId is null"; + sql += " or " + poName + ".sourceId=0 )"; + } + } + return sql; + } +} Index: ssts-diposablegoods/src/main/java/com/forgon/disinfectsystem/diposablegoods/util/MaterialEntryUtil.java =================================================================== diff -u --- ssts-diposablegoods/src/main/java/com/forgon/disinfectsystem/diposablegoods/util/MaterialEntryUtil.java (revision 0) +++ ssts-diposablegoods/src/main/java/com/forgon/disinfectsystem/diposablegoods/util/MaterialEntryUtil.java (revision 13071) @@ -0,0 +1,28 @@ +package com.forgon.disinfectsystem.diposablegoods.util; + +import com.forgon.disinfectsystem.entity.materialmanager.MaterialEntry; +import com.forgon.tools.string.StringTools; + +public final class MaterialEntryUtil { + + /** + * 生成筛选入/退库单类型的where条件子句,并且入库单和退库单会过滤掉调拨单产生的入库单和退库单,跟GodownEntryUtil的getGodownEntryTypeSqlWhere的实现一样,只是从概念上加以区分 + * @param poName po名称 + * @param type 单类型,可选值为{@link com.forgon.disinfectsystem.entity.materialmanager.MaterialEntry.TYPE_IN}、{@link com.forgon.disinfectsystem.entity.materialmanager.MaterialEntry.TYPE_OUT} + *
如果为空,返回值为 (1=1) + * @see GodownEntryUtil + * @return + */ + public static String getMaterialEntryTypeSqlWhere(String poName,String type){ + String sql = " ( 1=1 ) "; + if(!StringTools.isBlank(type)){ + sql += " and " + poName + ".type='" + type + "'"; + if(MaterialEntry.TYPE_IN.equals(type) || MaterialEntry.TYPE_OUT.equals(type)){ + sql += " and ( " + poName + ".sourceId is null"; + sql += " or " + poName + ".sourceId=0 )"; + } + } + return sql; + } + +} Index: ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/JasperReportManagerImpl.java =================================================================== diff -u -r13069 -r13071 --- ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/JasperReportManagerImpl.java (.../JasperReportManagerImpl.java) (revision 13069) +++ ssts-reports/src/main/java/com/forgon/disinfectsystem/jasperreports/service/JasperReportManagerImpl.java (.../JasperReportManagerImpl.java) (revision 13071) @@ -47,8 +47,11 @@ import com.forgon.disinfectsystem.common.CssdUtils; import com.forgon.disinfectsystem.diposablegoods.service.DiposableGoodsManager; import com.forgon.disinfectsystem.diposablegoods.service.GodownEntryItemManager; +import com.forgon.disinfectsystem.diposablegoods.util.GodownEntryUtil; +import com.forgon.disinfectsystem.diposablegoods.util.MaterialEntryUtil; import com.forgon.disinfectsystem.entity.assestmanagement.DisposableGoodsBatchStock; import com.forgon.disinfectsystem.entity.assestmanagement.DisposableGoodsStock; +import com.forgon.disinfectsystem.entity.assestmanagement.GodownEntry; import com.forgon.disinfectsystem.entity.assestmanagement.GodownEntryItem; import com.forgon.disinfectsystem.entity.basedatamanager.materialdefinition.MaterialDefinition; import com.forgon.disinfectsystem.entity.basedatamanager.reportoption.GoodsOption; @@ -6310,7 +6313,7 @@ + "from godownentryitem gei,godownentry ge," + DisposableGoodsStock.class.getSimpleName() + " dg " + "where ge.id = gei.godownentry_id and gei.diposablegoods_id = dg.id " + " and " + supplierWhere - + "and ge.type = '入库单' " + + " and " + GodownEntryUtil.getGodownEntryTypeSqlWhere("ge", GodownEntry.TYPE_IN) + " and ge.time >= " + dateQueryAdapter.dateAdapter(timeStart) + " and ge.time <= " + dateQueryAdapter.dateAdapter(timeEnd) + " and " + disposableGoodsWarehouseWhere @@ -6325,7 +6328,8 @@ + "from materialentry me,materialentryitem mei,materialdefinition md " + "where me.id = mei.materialentry_id and mei.materialdefinition_id = md.id " + " and " + materialSupplierWhere - + "and me.type = '入库单' and me.time >= " + dateQueryAdapter.dateAdapter(timeStart) + + " and " + MaterialEntryUtil.getMaterialEntryTypeSqlWhere("me", MaterialEntry.TYPE_IN) + + "and me.time >= " + dateQueryAdapter.dateAdapter(timeStart) + " and me.time <= " + dateQueryAdapter.dateAdapter(timeEnd) + " and " + materialwarehouseWhere + filterSql2 + ") temp2 group by mid,name,specification,serialNumber " @@ -6429,7 +6433,7 @@ + "and " + supplierWhere + "and dg.id = ds.diposablegoods_id " + "and gei.batchnumber = ds.batchnumber " - + "and ge.type = '入库单' " + + " and " + GodownEntryUtil.getGodownEntryTypeSqlWhere("ge", GodownEntry.TYPE_IN) + "and ge.time >= " + dateQueryAdapter.dateAdapter(timeStart) + " and ge.time <= " @@ -6463,7 +6467,7 @@ + "where me.id = mei.materialentry_id " + "and mei.materialdefinition_id = md.id " + " and " + materialSupplierWhere - + "and me.type = '入库单' " + + " and " + MaterialEntryUtil.getMaterialEntryTypeSqlWhere("me", MaterialEntry.TYPE_IN) + "and me.time >= " + dateQueryAdapter.dateAdapter(timeStart) + "and me.time <= "