给库存流水增加强审核的过滤

This commit is contained in:
季圣华
2023-03-17 23:50:51 +08:00
parent 548e31a7e2
commit 09633e8d95
4 changed files with 21 additions and 9 deletions

View File

@@ -92,7 +92,8 @@ public class DepotItemController {
if(StringUtil.isNotEmpty(endTime)) { if(StringUtil.isNotEmpty(endTime)) {
endTime = endTime + BusinessConstants.DAY_LAST_TIME; endTime = endTime + BusinessConstants.DAY_LAST_TIME;
} }
List<DepotItemVo4DetailByTypeAndMId> list = depotItemService.findDetailByDepotIdsAndMaterialIdList(depotIds, sku, Boolean forceFlag = systemConfigService.getForceApprovalFlag();
List<DepotItemVo4DetailByTypeAndMId> list = depotItemService.findDetailByDepotIdsAndMaterialIdList(depotIds, forceFlag, sku,
batchNumber, StringUtil.toNull(number), beginTime, endTime, mId, (currentPage-1)*pageSize, pageSize); batchNumber, StringUtil.toNull(number), beginTime, endTime, mId, (currentPage-1)*pageSize, pageSize);
JSONArray dataArray = new JSONArray(); JSONArray dataArray = new JSONArray();
if (list != null) { if (list != null) {
@@ -120,7 +121,7 @@ public class DepotItemController {
return returnJson(objectMap, "查找不到数据", ErpInfo.OK.code); return returnJson(objectMap, "查找不到数据", ErpInfo.OK.code);
} }
objectMap.put("rows", dataArray); objectMap.put("rows", dataArray);
objectMap.put("total", depotItemService.findDetailByDepotIdsAndMaterialIdCount(depotIds, sku, objectMap.put("total", depotItemService.findDetailByDepotIdsAndMaterialIdCount(depotIds, forceFlag, sku,
batchNumber, StringUtil.toNull(number), beginTime, endTime, mId)); batchNumber, StringUtil.toNull(number), beginTime, endTime, mId));
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code); return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
} }

View File

@@ -31,6 +31,7 @@ public interface DepotItemMapperEx {
List<DepotItemVo4DetailByTypeAndMId> findDetailByDepotIdsAndMaterialIdList( List<DepotItemVo4DetailByTypeAndMId> findDetailByDepotIdsAndMaterialIdList(
@Param("depotIdArray") Long[] depotIdArray, @Param("depotIdArray") Long[] depotIdArray,
@Param("forceFlag") Boolean forceFlag,
@Param("sku") String sku, @Param("sku") String sku,
@Param("batchNumber") String batchNumber, @Param("batchNumber") String batchNumber,
@Param("number") String number, @Param("number") String number,
@@ -42,6 +43,7 @@ public interface DepotItemMapperEx {
Long findDetailByDepotIdsAndMaterialIdCount( Long findDetailByDepotIdsAndMaterialIdCount(
@Param("depotIdArray") Long[] depotIdArray, @Param("depotIdArray") Long[] depotIdArray,
@Param("forceFlag") Boolean forceFlag,
@Param("sku") String sku, @Param("sku") String sku,
@Param("batchNumber") String batchNumber, @Param("batchNumber") String batchNumber,
@Param("number") String number, @Param("number") String number,

View File

@@ -174,7 +174,7 @@ public class DepotItemService {
return list==null?0:list.size(); return list==null?0:list.size();
} }
public List<DepotItemVo4DetailByTypeAndMId> findDetailByDepotIdsAndMaterialIdList(String depotIds, String sku, String batchNumber, public List<DepotItemVo4DetailByTypeAndMId> findDetailByDepotIdsAndMaterialIdList(String depotIds, Boolean forceFlag, String sku, String batchNumber,
String number, String beginTime, String endTime, Long mId, int offset, int rows)throws Exception { String number, String beginTime, String endTime, Long mId, int offset, int rows)throws Exception {
Long depotId = null; Long depotId = null;
if(StringUtil.isNotEmpty(depotIds)) { if(StringUtil.isNotEmpty(depotIds)) {
@@ -184,14 +184,14 @@ public class DepotItemService {
Long[] depotIdArray = StringUtil.listToLongArray(depotList); Long[] depotIdArray = StringUtil.listToLongArray(depotList);
List<DepotItemVo4DetailByTypeAndMId> list =null; List<DepotItemVo4DetailByTypeAndMId> list =null;
try{ try{
list = depotItemMapperEx.findDetailByDepotIdsAndMaterialIdList(depotIdArray, sku, batchNumber, number, beginTime, endTime, mId, offset, rows); list = depotItemMapperEx.findDetailByDepotIdsAndMaterialIdList(depotIdArray, forceFlag, sku, batchNumber, number, beginTime, endTime, mId, offset, rows);
}catch(Exception e){ }catch(Exception e){
JshException.readFail(logger, e); JshException.readFail(logger, e);
} }
return list; return list;
} }
public Long findDetailByDepotIdsAndMaterialIdCount(String depotIds, String sku, String batchNumber, public Long findDetailByDepotIdsAndMaterialIdCount(String depotIds, Boolean forceFlag, String sku, String batchNumber,
String number, String beginTime, String endTime, Long mId)throws Exception { String number, String beginTime, String endTime, Long mId)throws Exception {
Long depotId = null; Long depotId = null;
if(StringUtil.isNotEmpty(depotIds)) { if(StringUtil.isNotEmpty(depotIds)) {
@@ -201,7 +201,7 @@ public class DepotItemService {
Long[] depotIdArray = StringUtil.listToLongArray(depotList); Long[] depotIdArray = StringUtil.listToLongArray(depotList);
Long result =null; Long result =null;
try{ try{
result = depotItemMapperEx.findDetailByDepotIdsAndMaterialIdCount(depotIdArray, sku, batchNumber, number, beginTime, endTime, mId); result = depotItemMapperEx.findDetailByDepotIdsAndMaterialIdCount(depotIdArray, forceFlag, sku, batchNumber, number, beginTime, endTime, mId);
}catch(Exception e){ }catch(Exception e){
JshException.readFail(logger, e); JshException.readFail(logger, e);
} }
@@ -873,7 +873,6 @@ public class DepotItemService {
* @return * @return
*/ */
public BigDecimal getSkuStockByParam(Long depotId, Long meId, String beginTime, String endTime) throws Exception { public BigDecimal getSkuStockByParam(Long depotId, Long meId, String beginTime, String endTime) throws Exception {
//获取库存审核开关
Boolean forceFlag = systemConfigService.getForceApprovalFlag(); Boolean forceFlag = systemConfigService.getForceApprovalFlag();
List<Long> depotList = depotService.parseDepotList(depotId); List<Long> depotList = depotService.parseDepotList(depotId);
DepotItemVo4Stock stockObj = depotItemMapperEx.getSkuStockByParamWithDepotList(depotList, meId, forceFlag, beginTime, endTime); DepotItemVo4Stock stockObj = depotItemMapperEx.getSkuStockByParamWithDepotList(depotList, meId, forceFlag, beginTime, endTime);
@@ -915,7 +914,6 @@ public class DepotItemService {
* @return * @return
*/ */
public BigDecimal getStockByParamWithDepotList(List<Long> depotList, Long mId, String beginTime, String endTime) throws Exception { public BigDecimal getStockByParamWithDepotList(List<Long> depotList, Long mId, String beginTime, String endTime) throws Exception {
//获取库存审核开关
Boolean forceFlag = systemConfigService.getForceApprovalFlag(); Boolean forceFlag = systemConfigService.getForceApprovalFlag();
//初始库存 //初始库存
BigDecimal initStock = materialService.getInitStockByMidAndDepotList(depotList, mId); BigDecimal initStock = materialService.getInitStockByMidAndDepotList(depotList, mId);
@@ -947,7 +945,6 @@ public class DepotItemService {
* @return * @return
*/ */
public Map<String, BigDecimal> getIntervalMapByParamWithDepotList(List<Long> depotList, Long mId, String beginTime, String endTime) throws Exception { public Map<String, BigDecimal> getIntervalMapByParamWithDepotList(List<Long> depotList, Long mId, String beginTime, String endTime) throws Exception {
//获取库存审核开关
Boolean forceFlag = systemConfigService.getForceApprovalFlag(); Boolean forceFlag = systemConfigService.getForceApprovalFlag();
Map<String,BigDecimal> intervalMap = new HashMap<>(); Map<String,BigDecimal> intervalMap = new HashMap<>();
BigDecimal inSum = BigDecimal.ZERO; BigDecimal inSum = BigDecimal.ZERO;

View File

@@ -167,6 +167,9 @@
<foreach collection="depotIdArray" item="depotId" separator=",">#{depotId}</foreach> <foreach collection="depotIdArray" item="depotId" separator=",">#{depotId}</foreach>
) )
</if> </if>
<if test="forceFlag">
and dh.status = '1'
</if>
<if test="sku != null and sku !=''"> <if test="sku != null and sku !=''">
and di.sku = #{sku} and di.sku = #{sku}
</if> </if>
@@ -201,6 +204,9 @@
<foreach collection="depotIdArray" item="depotId" separator=",">#{depotId}</foreach> <foreach collection="depotIdArray" item="depotId" separator=",">#{depotId}</foreach>
) )
</if> </if>
<if test="forceFlag">
and dh.status = '1'
</if>
<if test="sku != null and sku !=''"> <if test="sku != null and sku !=''">
and di.sku = #{sku} and di.sku = #{sku}
</if> </if>
@@ -238,6 +244,9 @@
<foreach collection="depotIdArray" item="depotId" separator=",">#{depotId}</foreach> <foreach collection="depotIdArray" item="depotId" separator=",">#{depotId}</foreach>
) )
</if> </if>
<if test="forceFlag">
and dh.status = '1'
</if>
<if test="sku != null and sku !=''"> <if test="sku != null and sku !=''">
and di.sku = #{sku} and di.sku = #{sku}
</if> </if>
@@ -266,6 +275,9 @@
<foreach collection="depotIdArray" item="depotId" separator=",">#{depotId}</foreach> <foreach collection="depotIdArray" item="depotId" separator=",">#{depotId}</foreach>
) )
</if> </if>
<if test="forceFlag">
and dh.status = '1'
</if>
<if test="sku != null and sku !=''"> <if test="sku != null and sku !=''">
and di.sku = #{sku} and di.sku = #{sku}
</if> </if>