增加组装和拆卸单的库存计算
This commit is contained in:
@@ -155,7 +155,7 @@
|
|||||||
listSubType = "拆卸单";
|
listSubType = "拆卸单";
|
||||||
payTypeTitle = "隐藏";
|
payTypeTitle = "隐藏";
|
||||||
organUrl = supUrl;
|
organUrl = supUrl;
|
||||||
amountNum = "CSD";
|
amountNum = "CXD";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//初始化系统基础信息
|
//初始化系统基础信息
|
||||||
|
|||||||
@@ -162,10 +162,19 @@ public class DepotItemController {
|
|||||||
BigDecimal prevSum = sumNumber("入库", pid, materialId, monthTime, true).subtract(sumNumber("出库", pid, materialId, monthTime, true));
|
BigDecimal prevSum = sumNumber("入库", pid, materialId, monthTime, true).subtract(sumNumber("出库", pid, materialId, monthTime, true));
|
||||||
BigDecimal InSum = sumNumber("入库", pid, materialId, monthTime, false);
|
BigDecimal InSum = sumNumber("入库", pid, materialId, monthTime, false);
|
||||||
BigDecimal OutSum = 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("MaterialId", di.getMaterialid() == null ? "" : di.getMaterialid());
|
||||||
item.put("MaterialName", di.getMname());
|
item.put("MaterialName", di.getMname());
|
||||||
item.put("MaterialModel", di.getMmodel());
|
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);
|
dataArray.add(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -735,6 +744,19 @@ public class DepotItemController {
|
|||||||
return sumNumber;
|
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("MId") Long MId,
|
||||||
@Param("MonthTime") String MonthTime);
|
@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(
|
BigDecimal buyOrSaleNumber(
|
||||||
@Param("type") String type,
|
@Param("type") String type,
|
||||||
@Param("subType") String subType,
|
@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) {
|
public BigDecimal buyOrSale(String type, String subType, Long MId, String MonthTime, String sumType) {
|
||||||
if (SUM_TYPE.equals(sumType)) {
|
if (SUM_TYPE.equals(sumType)) {
|
||||||
return depotItemMapperEx.buyOrSaleNumber(type, subType, MId, MonthTime, sumType);
|
return depotItemMapperEx.buyOrSaleNumber(type, subType, MId, MonthTime, sumType);
|
||||||
|
|||||||
@@ -296,6 +296,29 @@
|
|||||||
and ifnull(di.delete_Flag,'0') !='1'
|
and ifnull(di.delete_Flag,'0') !='1'
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="findAssembleIsPrev" resultType="java.math.BigDecimal">
|
||||||
|
select sum(BasicNumber) as BasicNumber from jsh_depotitem di,jsh_depothead dh
|
||||||
|
where di.HeaderId = dh.id
|
||||||
|
and dh.SubType= '${subType}'
|
||||||
|
and di.MType= '${mType}'
|
||||||
|
and di.MaterialId = ${MId}
|
||||||
|
and dh.OperTime < '${MonthTime}-01 00:00:00'
|
||||||
|
and ifnull(dh.delete_Flag,'0') !='1'
|
||||||
|
and ifnull(di.delete_Flag,'0') !='1'
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="findAssembleIsNotPrev" resultType="java.math.BigDecimal">
|
||||||
|
select sum(BasicNumber) as BasicNumber from jsh_depotitem di,jsh_depothead dh
|
||||||
|
where di.HeaderId = dh.id
|
||||||
|
and dh.SubType= '${subType}'
|
||||||
|
and di.MType= '${mType}'
|
||||||
|
and di.MaterialId = ${MId}
|
||||||
|
and dh.OperTime >= '${MonthTime}-01 00:00:00'
|
||||||
|
and dh.OperTime <= '${MonthTime}-31 23:59:59'
|
||||||
|
and ifnull(dh.delete_Flag,'0') !='1'
|
||||||
|
and ifnull(di.delete_Flag,'0') !='1'
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="buyOrSaleNumber" resultType="java.math.BigDecimal">
|
<select id="buyOrSaleNumber" resultType="java.math.BigDecimal">
|
||||||
select sum(BasicNumber) as BasicNumber from jsh_depotitem di,jsh_depothead dh
|
select sum(BasicNumber) as BasicNumber from jsh_depotitem di,jsh_depothead dh
|
||||||
where di.HeaderId = dh.id
|
where di.HeaderId = dh.id
|
||||||
|
|||||||
Reference in New Issue
Block a user