给商品库存接口增加仓位货架的查询参数

This commit is contained in:
季圣华
2023-05-24 23:07:47 +08:00
parent 261c5a069d
commit f56b3774d6
4 changed files with 26 additions and 10 deletions

View File

@@ -558,6 +558,7 @@ public class MaterialController {
@RequestParam("pageSize") Integer pageSize, @RequestParam("pageSize") Integer pageSize,
@RequestParam(value = "depotIds", required = false) String depotIds, @RequestParam(value = "depotIds", required = false) String depotIds,
@RequestParam(value = "categoryId", required = false) Long categoryId, @RequestParam(value = "categoryId", required = false) Long categoryId,
@RequestParam(value = "position", required = false) String position,
@RequestParam("materialParam") String materialParam, @RequestParam("materialParam") String materialParam,
@RequestParam("zeroStock") Integer zeroStock, @RequestParam("zeroStock") Integer zeroStock,
@RequestParam("mpList") String mpList, @RequestParam("mpList") String mpList,
@@ -582,10 +583,10 @@ public class MaterialController {
depotList.add(object.getLong("id")); depotList.add(object.getLong("id"));
} }
} }
List<MaterialVo4Unit> dataList = materialService.getListWithStock(depotList, idList, StringUtil.toNull(materialParam), zeroStock, List<MaterialVo4Unit> dataList = materialService.getListWithStock(depotList, idList, StringUtil.toNull(position), StringUtil.toNull(materialParam),
StringUtil.safeSqlParse(column), StringUtil.safeSqlParse(order), (currentPage-1)*pageSize, pageSize); zeroStock, StringUtil.safeSqlParse(column), StringUtil.safeSqlParse(order), (currentPage-1)*pageSize, pageSize);
int total = materialService.getListWithStockCount(depotList, idList, StringUtil.toNull(materialParam), zeroStock); int total = materialService.getListWithStockCount(depotList, idList, StringUtil.toNull(position), StringUtil.toNull(materialParam), zeroStock);
MaterialVo4Unit materialVo4Unit= materialService.getTotalStockAndPrice(depotList, idList, StringUtil.toNull(materialParam)); MaterialVo4Unit materialVo4Unit= materialService.getTotalStockAndPrice(depotList, idList, StringUtil.toNull(position), StringUtil.toNull(materialParam));
map.put("total", total); map.put("total", total);
map.put("currentStock", materialVo4Unit.getCurrentStock()!=null?materialVo4Unit.getCurrentStock():BigDecimal.ZERO); map.put("currentStock", materialVo4Unit.getCurrentStock()!=null?materialVo4Unit.getCurrentStock():BigDecimal.ZERO);
map.put("currentStockPrice", materialVo4Unit.getCurrentStockPrice()!=null?materialVo4Unit.getCurrentStockPrice():BigDecimal.ZERO); map.put("currentStockPrice", materialVo4Unit.getCurrentStockPrice()!=null?materialVo4Unit.getCurrentStockPrice():BigDecimal.ZERO);

View File

@@ -125,6 +125,7 @@ public interface MaterialMapperEx {
List<MaterialVo4Unit> getListWithStock( List<MaterialVo4Unit> getListWithStock(
@Param("depotList") List<Long> depotList, @Param("depotList") List<Long> depotList,
@Param("idList") List<Long> idList, @Param("idList") List<Long> idList,
@Param("position") String position,
@Param("materialParam") String materialParam, @Param("materialParam") String materialParam,
@Param("zeroStock") Integer zeroStock, @Param("zeroStock") Integer zeroStock,
@Param("column") String column, @Param("column") String column,
@@ -135,12 +136,14 @@ public interface MaterialMapperEx {
int getListWithStockCount( int getListWithStockCount(
@Param("depotList") List<Long> depotList, @Param("depotList") List<Long> depotList,
@Param("idList") List<Long> idList, @Param("idList") List<Long> idList,
@Param("position") String position,
@Param("materialParam") String materialParam, @Param("materialParam") String materialParam,
@Param("zeroStock") Integer zeroStock); @Param("zeroStock") Integer zeroStock);
MaterialVo4Unit getTotalStockAndPrice( MaterialVo4Unit getTotalStockAndPrice(
@Param("depotList") List<Long> depotList, @Param("depotList") List<Long> depotList,
@Param("idList") List<Long> idList, @Param("idList") List<Long> idList,
@Param("position") String position,
@Param("materialParam") String materialParam); @Param("materialParam") String materialParam);
int checkIsExist( int checkIsExist(

View File

@@ -1260,14 +1260,14 @@ public class MaterialService {
return materialMapperEx.getInitialStockWithMaterial(depotList); return materialMapperEx.getInitialStockWithMaterial(depotList);
} }
public List<MaterialVo4Unit> getListWithStock(List<Long> depotList, List<Long> idList, String materialParam, Integer zeroStock, public List<MaterialVo4Unit> getListWithStock(List<Long> depotList, List<Long> idList, String position, String materialParam, Integer zeroStock,
String column, String order, Integer offset, Integer rows) throws Exception { String column, String order, Integer offset, Integer rows) throws Exception {
Map<Long, BigDecimal> initialStockMap = new HashMap<>(); Map<Long, BigDecimal> initialStockMap = new HashMap<>();
List<MaterialInitialStockWithMaterial> initialStockList = getInitialStockWithMaterial(depotList); List<MaterialInitialStockWithMaterial> initialStockList = getInitialStockWithMaterial(depotList);
for (MaterialInitialStockWithMaterial mism: initialStockList) { for (MaterialInitialStockWithMaterial mism: initialStockList) {
initialStockMap.put(mism.getMaterialId(), mism.getNumber()); initialStockMap.put(mism.getMaterialId(), mism.getNumber());
} }
List<MaterialVo4Unit> dataList = materialMapperEx.getListWithStock(depotList, idList, materialParam, zeroStock, column, order, offset, rows); List<MaterialVo4Unit> dataList = materialMapperEx.getListWithStock(depotList, idList, position, materialParam, zeroStock, column, order, offset, rows);
for(MaterialVo4Unit item: dataList) { for(MaterialVo4Unit item: dataList) {
item.setUnitName(null!=item.getUnitId()?item.getUnitName() + "[多单位]":item.getUnitName()); item.setUnitName(null!=item.getUnitId()?item.getUnitName() + "[多单位]":item.getUnitName());
item.setInitialStock(null!=initialStockMap.get(item.getId())?initialStockMap.get(item.getId()):BigDecimal.ZERO); item.setInitialStock(null!=initialStockMap.get(item.getId())?initialStockMap.get(item.getId()):BigDecimal.ZERO);
@@ -1276,12 +1276,12 @@ public class MaterialService {
return dataList; return dataList;
} }
public int getListWithStockCount(List<Long> depotList, List<Long> idList, String materialParam, Integer zeroStock) { public int getListWithStockCount(List<Long> depotList, List<Long> idList, String position, String materialParam, Integer zeroStock) {
return materialMapperEx.getListWithStockCount(depotList, idList, materialParam, zeroStock); return materialMapperEx.getListWithStockCount(depotList, idList, position, materialParam, zeroStock);
} }
public MaterialVo4Unit getTotalStockAndPrice(List<Long> depotList, List<Long> idList, String materialParam) { public MaterialVo4Unit getTotalStockAndPrice(List<Long> depotList, List<Long> idList, String position, String materialParam) {
return materialMapperEx.getTotalStockAndPrice(depotList, idList, materialParam); return materialMapperEx.getTotalStockAndPrice(depotList, idList, position, materialParam);
} }
/** /**

View File

@@ -621,6 +621,10 @@
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="position != null and position !=''">
<bind name="bindPosition" value="'%'+position+'%'"/>
and m.position like #{bindPosition}
</if>
<if test="materialParam != null"> <if test="materialParam != null">
<bind name="bindParam" value="'%'+materialParam+'%'"/> <bind name="bindParam" value="'%'+materialParam+'%'"/>
and (me.bar_code like #{bindParam} or m.name like #{bindParam} or m.standard like #{bindParam} or m.model like #{bindParam} or m.color like #{bindParam}) and (me.bar_code like #{bindParam} or m.name like #{bindParam} or m.standard like #{bindParam} or m.model like #{bindParam} or m.color like #{bindParam})
@@ -662,6 +666,10 @@
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="position != null and position !=''">
<bind name="bindPosition" value="'%'+position+'%'"/>
and m.position like #{bindPosition}
</if>
<if test="materialParam != null"> <if test="materialParam != null">
<bind name="bindParam" value="'%'+materialParam+'%'"/> <bind name="bindParam" value="'%'+materialParam+'%'"/>
and (me.bar_code like #{bindParam} or m.name like #{bindParam} or m.standard like #{bindParam} or m.model like #{bindParam} or m.color like #{bindParam}) and (me.bar_code like #{bindParam} or m.name like #{bindParam} or m.standard like #{bindParam} or m.model like #{bindParam} or m.color like #{bindParam})
@@ -698,6 +706,10 @@
#{item} #{item}
</foreach> </foreach>
</if> </if>
<if test="position != null and position !=''">
<bind name="bindPosition" value="'%'+position+'%'"/>
and m.position like #{bindPosition}
</if>
<if test="materialParam != null"> <if test="materialParam != null">
<bind name="bindParam" value="'%'+materialParam+'%'"/> <bind name="bindParam" value="'%'+materialParam+'%'"/>
and (me.bar_code like #{bindParam} or m.name like #{bindParam} or m.standard like #{bindParam} or m.model like #{bindParam}) and (me.bar_code like #{bindParam} or m.name like #{bindParam} or m.standard like #{bindParam} or m.model like #{bindParam})