给sku商品的库存计算增加盘点的数量
This commit is contained in:
@@ -132,6 +132,13 @@ public interface DepotItemMapperEx {
|
||||
@Param("creatorArray") String[] creatorArray,
|
||||
@Param("forceFlag") Boolean forceFlag);
|
||||
|
||||
BigDecimal getSkuStockCheckSumByDepotList(
|
||||
@Param("depotList") List<Long> depotList,
|
||||
@Param("meId") Long meId,
|
||||
@Param("forceFlag") Boolean forceFlag,
|
||||
@Param("beginTime") String beginTime,
|
||||
@Param("endTime") String endTime);
|
||||
|
||||
BigDecimal getStockCheckSumByDepotList(
|
||||
@Param("depotList") List<Long> depotList,
|
||||
@Param("mId") Long mId,
|
||||
|
||||
@@ -883,6 +883,8 @@ public class DepotItemService {
|
||||
public BigDecimal getSkuStockByParam(Long depotId, Long meId, String beginTime, String endTime) throws Exception {
|
||||
Boolean forceFlag = systemConfigService.getForceApprovalFlag();
|
||||
List<Long> depotList = depotService.parseDepotList(depotId);
|
||||
//盘点复盘后数量的变动
|
||||
BigDecimal stockCheckSum = depotItemMapperEx.getSkuStockCheckSumByDepotList(depotList, meId, forceFlag, beginTime, endTime);
|
||||
DepotItemVo4Stock stockObj = depotItemMapperEx.getSkuStockByParamWithDepotList(depotList, meId, forceFlag, beginTime, endTime);
|
||||
BigDecimal stockSum = BigDecimal.ZERO;
|
||||
if(stockObj!=null) {
|
||||
@@ -897,7 +899,7 @@ public class DepotItemService {
|
||||
stockSum = inTotal.add(transfInTotal).add(assemInTotal).add(disAssemInTotal)
|
||||
.subtract(outTotal).subtract(transfOutTotal).subtract(assemOutTotal).subtract(disAssemOutTotal);
|
||||
}
|
||||
return stockSum;
|
||||
return stockCheckSum.add(stockSum);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -606,6 +606,33 @@
|
||||
and ifnull(di.delete_flag, '0') != '1') tb
|
||||
</select>
|
||||
|
||||
<select id="getSkuStockCheckSumByDepotList" resultType="java.math.BigDecimal">
|
||||
select ifnull(sum(di.basic_number),0) stockCheckSum from jsh_depot_head dh
|
||||
left JOIN jsh_depot_item di on dh.id=di.header_id
|
||||
where 1=1
|
||||
<if test="meId != null">
|
||||
and di.material_extend_id=#{meId}
|
||||
</if>
|
||||
and dh.sub_type='盘点复盘'
|
||||
<if test="depotList.size()>0">
|
||||
and di.depot_id in
|
||||
<foreach collection="depotList" item="item" index="index" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="forceFlag">
|
||||
and dh.status = '1'
|
||||
</if>
|
||||
<if test="beginTime != null">
|
||||
and dh.oper_time >= #{beginTime}
|
||||
</if>
|
||||
<if test="endTime != null">
|
||||
and dh.oper_time <= #{endTime}
|
||||
</if>
|
||||
and ifnull(dh.delete_flag,'0') !='1'
|
||||
and ifnull(di.delete_flag,'0') !='1'
|
||||
</select>
|
||||
|
||||
<select id="getStockCheckSumByDepotList" resultType="java.math.BigDecimal">
|
||||
select ifnull(sum(di.basic_number),0) stockCheckSum from jsh_depot_head dh
|
||||
left JOIN jsh_depot_item di on dh.id=di.header_id
|
||||
|
||||
Reference in New Issue
Block a user