增加组装和拆卸单的库存计算
This commit is contained in:
@@ -162,10 +162,19 @@ public class DepotItemController {
|
||||
BigDecimal prevSum = sumNumber("入库", pid, materialId, monthTime, true).subtract(sumNumber("出库", pid, materialId, monthTime, true));
|
||||
BigDecimal InSum = sumNumber("入库", pid, materialId, monthTime, false);
|
||||
BigDecimal OutSum = sumNumber("出库", pid, materialId, monthTime, false);
|
||||
// +组装(组合件)-组装(普通子件)+拆卸(普通子件)-拆卸(组合件)
|
||||
BigDecimal prevAssembleSum = assembleNumber("组装单","组合件", pid, materialId, monthTime, true)
|
||||
.subtract(assembleNumber("组装单","普通子件", pid, materialId, monthTime, true))
|
||||
.add(assembleNumber("拆卸单","普通子件", pid, materialId, monthTime, true))
|
||||
.subtract(assembleNumber("拆卸单","组合件", pid, materialId, monthTime, true));
|
||||
BigDecimal notPrevAssembleSum = assembleNumber("组装单","组合件", pid, materialId, monthTime, false)
|
||||
.subtract(assembleNumber("组装单","普通子件", pid, materialId, monthTime, false))
|
||||
.add(assembleNumber("拆卸单","普通子件", pid, materialId, monthTime, false))
|
||||
.subtract(assembleNumber("拆卸单","组合件", pid, materialId, monthTime, false));
|
||||
item.put("MaterialId", di.getMaterialid() == null ? "" : di.getMaterialid());
|
||||
item.put("MaterialName", di.getMname());
|
||||
item.put("MaterialModel", di.getMmodel());
|
||||
item.put("thisSum", prevSum.add(InSum).subtract(OutSum));
|
||||
item.put("thisSum", prevSum.add(InSum).subtract(OutSum).add(prevAssembleSum).add(notPrevAssembleSum));
|
||||
dataArray.add(item);
|
||||
}
|
||||
}
|
||||
@@ -735,6 +744,19 @@ public class DepotItemController {
|
||||
return sumNumber;
|
||||
}
|
||||
|
||||
public BigDecimal assembleNumber(String subType, String mType, Integer ProjectId, Long MId, String MonthTime, Boolean isPrev) {
|
||||
BigDecimal assembleNumber = BigDecimal.ZERO;
|
||||
try {
|
||||
BigDecimal sum = depotItemService.findAssembleByType(subType, mType, ProjectId, MId, MonthTime, isPrev);
|
||||
if(sum != null) {
|
||||
assembleNumber = sum;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return assembleNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* 价格合计
|
||||
*
|
||||
|
||||
@@ -109,6 +109,20 @@ public interface DepotItemMapperEx {
|
||||
@Param("MId") Long MId,
|
||||
@Param("MonthTime") String MonthTime);
|
||||
|
||||
BigDecimal findAssembleIsPrev(
|
||||
@Param("subType") String subType,
|
||||
@Param("mType") String mType,
|
||||
@Param("ProjectId") Integer ProjectId,
|
||||
@Param("MId") Long MId,
|
||||
@Param("MonthTime") String MonthTime);
|
||||
|
||||
BigDecimal findAssembleIsNotPrev(
|
||||
@Param("subType") String subType,
|
||||
@Param("mType") String mType,
|
||||
@Param("ProjectId") Integer ProjectId,
|
||||
@Param("MId") Long MId,
|
||||
@Param("MonthTime") String MonthTime);
|
||||
|
||||
BigDecimal buyOrSaleNumber(
|
||||
@Param("type") String type,
|
||||
@Param("subType") String subType,
|
||||
|
||||
@@ -214,6 +214,14 @@ public class DepotItemService {
|
||||
}
|
||||
}
|
||||
|
||||
public BigDecimal findAssembleByType(String subType, String mType, Integer ProjectId, Long MId, String MonthTime, Boolean isPrev) {
|
||||
if (isPrev) {
|
||||
return depotItemMapperEx.findAssembleIsPrev(subType, mType, ProjectId, MId, MonthTime);
|
||||
} else {
|
||||
return depotItemMapperEx.findAssembleIsNotPrev(subType, mType, ProjectId, MId, MonthTime);
|
||||
}
|
||||
}
|
||||
|
||||
public BigDecimal buyOrSale(String type, String subType, Long MId, String MonthTime, String sumType) {
|
||||
if (SUM_TYPE.equals(sumType)) {
|
||||
return depotItemMapperEx.buyOrSaleNumber(type, subType, MId, MonthTime, sumType);
|
||||
|
||||
Reference in New Issue
Block a user