增加商品库存报表

This commit is contained in:
季圣华
2021-06-20 22:34:04 +08:00
parent f0da067230
commit e5ce3194ee
7 changed files with 221 additions and 0 deletions

View File

@@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONObject;
import com.jsh.erp.constants.BusinessConstants;
import com.jsh.erp.constants.ExceptionConstants;
import com.jsh.erp.datasource.entities.DepotEx;
import com.jsh.erp.datasource.entities.DepotItemVo4WithInfoEx;
import com.jsh.erp.datasource.entities.Material;
import com.jsh.erp.datasource.entities.MaterialVo4Unit;
import com.jsh.erp.exception.BusinessRunTimeException;
@@ -484,4 +485,50 @@ public class MaterialController {
}
return res;
}
/**
* 商品库存查询
* @param currentPage
* @param pageSize
* @param depotId
* @param categoryId
* @param materialParam
* @param mpList
* @param request
* @return
* @throws Exception
*/
@GetMapping(value = "/getListWithStock")
public BaseResponseInfo getListWithStock(@RequestParam("currentPage") Integer currentPage,
@RequestParam("pageSize") Integer pageSize,
@RequestParam("depotId") Long depotId,
@RequestParam("categoryId") Long categoryId,
@RequestParam("materialParam") String materialParam,
@RequestParam("mpList") String mpList,
HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
Map<String, Object> map = new HashMap<>();
try {
List<Long> idList = new ArrayList<>();
if(categoryId != null){
idList = materialService.getListByParentId(categoryId);
}
List<MaterialVo4Unit> dataList = materialService.getListWithStock(depotId, idList, StringUtil.toNull(materialParam),
(currentPage-1)*pageSize, pageSize);
int total = materialService.getListWithStockCount(depotId, idList, StringUtil.toNull(materialParam));
MaterialVo4Unit materialVo4Unit= materialService.getTotalStockAndPrice(depotId, idList, StringUtil.toNull(materialParam));
map.put("total", total);
map.put("currentStock", materialVo4Unit.getCurrentStock());
map.put("currentStockPrice", materialVo4Unit.getCurrentStockPrice());
//存放数据json数组
map.put("rows", dataList);
res.code = 200;
res.data = map;
} catch(Exception e){
e.printStackTrace();
res.code = 500;
res.data = "获取数据失败";
}
return res;
}
}

View File

@@ -28,6 +28,12 @@ public class MaterialVo4Unit extends Material{
private Long meId;
private BigDecimal initialStock;
private BigDecimal currentStock;
private BigDecimal currentStockPrice;
public String getUnitName() {
return unitName;
}
@@ -123,4 +129,28 @@ public class MaterialVo4Unit extends Material{
public void setMeId(Long meId) {
this.meId = meId;
}
public BigDecimal getInitialStock() {
return initialStock;
}
public void setInitialStock(BigDecimal initialStock) {
this.initialStock = initialStock;
}
public BigDecimal getCurrentStock() {
return currentStock;
}
public void setCurrentStock(BigDecimal currentStock) {
this.currentStock = currentStock;
}
public BigDecimal getCurrentStockPrice() {
return currentStockPrice;
}
public void setCurrentStockPrice(BigDecimal currentStockPrice) {
this.currentStockPrice = currentStockPrice;
}
}

View File

@@ -85,4 +85,21 @@ public interface MaterialMapperEx {
int setUnitIdToNull(@Param("id") Long id);
List<MaterialVo4Unit> getMaterialByBarCode(@Param("barCode") String barCode);
List<MaterialVo4Unit> getListWithStock(
@Param("depotId") Long depotId,
@Param("idList") List<Long> idList,
@Param("materialParam") String materialParam,
@Param("offset") Integer offset,
@Param("rows") Integer rows);
int getListWithStockCount(
@Param("depotId") Long depotId,
@Param("idList") List<Long> idList,
@Param("materialParam") String materialParam);
MaterialVo4Unit getTotalStockAndPrice(
@Param("depotId") Long depotId,
@Param("idList") List<Long> idList,
@Param("materialParam") String materialParam);
}

View File

@@ -797,4 +797,16 @@ public class MaterialService {
public List<MaterialVo4Unit> getMaterialByBarCode(String barCode) {
return materialMapperEx.getMaterialByBarCode(barCode);
}
public List<MaterialVo4Unit> getListWithStock(Long depotId, List<Long> idList, String materialParam, Integer offset, Integer rows) {
return materialMapperEx.getListWithStock(depotId, idList, materialParam, offset, rows);
}
public int getListWithStockCount(Long depotId, List<Long> idList, String materialParam) {
return materialMapperEx.getListWithStockCount(depotId, idList, materialParam);
}
public MaterialVo4Unit getTotalStockAndPrice(Long depotId, List<Long> idList, String materialParam) {
return materialMapperEx.getTotalStockAndPrice(depotId, idList, materialParam);
}
}