解决出入库统计报表计算的bug

This commit is contained in:
jishenghua
2024-04-15 13:52:58 +08:00
parent f2fe0ab84f
commit 1531155c7c
5 changed files with 74 additions and 9 deletions

View File

@@ -531,8 +531,8 @@ public class DepotItemController {
dataArray.add(item);
}
}
BigDecimal inSumPriceTotal = depotItemService.buyOrSale("入库", "采购", null, beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, "price");
BigDecimal outSumPriceTotal = depotItemService.buyOrSale("出库", "采购退货", null, beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, "price");
BigDecimal inSumPriceTotal = depotItemService.buyOrSalePriceTotal("入库", "采购", StringUtil.toNull(materialParam), beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag);
BigDecimal outSumPriceTotal = depotItemService.buyOrSalePriceTotal("出库", "采购退货", StringUtil.toNull(materialParam), beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag);
BigDecimal realityPriceTotal = inSumPriceTotal.subtract(outSumPriceTotal);
map.put("rows", dataArray);
map.put("realityPriceTotal", realityPriceTotal);
@@ -615,8 +615,8 @@ public class DepotItemController {
dataArray.add(item);
}
}
BigDecimal outSumPriceTotal = depotItemService.buyOrSale("出库", "零售", null, beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, "price");
BigDecimal inSumPriceTotal = depotItemService.buyOrSale("入库", "零售退货", null, beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, "price");
BigDecimal outSumPriceTotal = depotItemService.buyOrSalePriceTotal("出库", "零售", StringUtil.toNull(materialParam), beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag);
BigDecimal inSumPriceTotal = depotItemService.buyOrSalePriceTotal("入库", "零售退货", StringUtil.toNull(materialParam), beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag);
BigDecimal realityPriceTotal = outSumPriceTotal.subtract(inSumPriceTotal);
map.put("rows", dataArray);
map.put("realityPriceTotal", realityPriceTotal);
@@ -700,8 +700,8 @@ public class DepotItemController {
dataArray.add(item);
}
}
BigDecimal outSumPriceTotal = depotItemService.buyOrSale("出库", "销售", null, beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, "price");
BigDecimal inSumPriceTotal = depotItemService.buyOrSale("入库", "销售退货", null, beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag, "price");
BigDecimal outSumPriceTotal = depotItemService.buyOrSalePriceTotal("出库", "销售", StringUtil.toNull(materialParam), beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag);
BigDecimal inSumPriceTotal = depotItemService.buyOrSalePriceTotal("入库", "销售退货", StringUtil.toNull(materialParam), beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag);
BigDecimal realityPriceTotal = outSumPriceTotal.subtract(inSumPriceTotal);
map.put("rows", dataArray);
map.put("realityPriceTotal", realityPriceTotal);

View File

@@ -121,6 +121,18 @@ public interface DepotItemMapperEx {
@Param("forceFlag") Boolean forceFlag,
@Param("sumType") String sumType);
BigDecimal buyOrSalePriceTotal(
@Param("type") String type,
@Param("subType") String subType,
@Param("materialParam") String materialParam,
@Param("beginTime") String beginTime,
@Param("endTime") String endTime,
@Param("creatorArray") String[] creatorArray,
@Param("organId") Long organId,
@Param("organArray") String [] organArray,
@Param("depotList") List<Long> depotList,
@Param("forceFlag") Boolean forceFlag);
BigDecimal inOrOutPrice(
@Param("type") String type,
@Param("subType") String subType,

View File

@@ -354,6 +354,17 @@ public class DepotItemService {
JshException.readFail(logger, e);
}
return result;
}
public BigDecimal buyOrSalePriceTotal(String type, String subType, String materialParam, String beginTime, String endTime,
String[] creatorArray, Long organId, String [] organArray, List<Long> depotList, Boolean forceFlag) throws Exception{
BigDecimal result= BigDecimal.ZERO;
try{
result= depotItemMapperEx.buyOrSalePriceTotal(type, subType, materialParam, beginTime, endTime, creatorArray, organId, organArray, depotList, forceFlag);
}catch(Exception e){
JshException.readFail(logger, e);
}
return result;
}