From e5ce3194ee4c3b934f3fe336a8b3f36a9c7afbfc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=A3=E5=9C=A3=E5=8D=8E?= <752718920@qq.com> Date: Sun, 20 Jun 2021 22:34:04 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=95=86=E5=93=81=E5=BA=93?= =?UTF-8?q?=E5=AD=98=E6=8A=A5=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- jshERP-boot/docs/jsh_erp.sql | 1 + .../docs/数据库更新记录-首次安装请勿使用.txt | 14 +++ .../erp/controller/MaterialController.java | 47 ++++++++ .../datasource/entities/MaterialVo4Unit.java | 30 ++++++ .../datasource/mappers/MaterialMapperEx.java | 17 +++ .../erp/service/material/MaterialService.java | 12 +++ .../resources/mapper_xml/MaterialMapperEx.xml | 100 ++++++++++++++++++ 7 files changed, 221 insertions(+) diff --git a/jshERP-boot/docs/jsh_erp.sql b/jshERP-boot/docs/jsh_erp.sql index 40c82295..9c6b1ff2 100644 --- a/jshERP-boot/docs/jsh_erp.sql +++ b/jshERP-boot/docs/jsh_erp.sql @@ -327,6 +327,7 @@ INSERT INTO `jsh_function` VALUES ('242', '060301', '销售订单', '0603', '/bi INSERT INTO `jsh_function` VALUES ('243', '000108', '机构管理', '0001', '/system/organization', '/system/OrganizationList', '', '0150', '', '电脑版', '1', 'profile', '0'); INSERT INTO `jsh_function` VALUES ('244', '030112', '库存预警', '0301', '/report/stock_warning_report', '/report/StockWarningReport', '\0', '0670', '', '电脑版', '', 'profile', '0'); INSERT INTO `jsh_function` VALUES ('245', '000107', '插件管理', '0001', '/system/plugin', '/system/PluginList', '\0', '0170', '', '电脑版', '1', 'profile', '0'); +INSERT INTO `jsh_function` VALUES ('246', '030113', '商品库存', '0301', '/report/material_stock', '/report/MaterialStock', '\0', '0605', '', '电脑版', '', 'profile', '0'); -- ---------------------------- -- Table structure for jsh_in_out_item diff --git a/jshERP-boot/docs/数据库更新记录-首次安装请勿使用.txt b/jshERP-boot/docs/数据库更新记录-首次安装请勿使用.txt index 261bdd69..5c8d9f7f 100644 --- a/jshERP-boot/docs/数据库更新记录-首次安装请勿使用.txt +++ b/jshERP-boot/docs/数据库更新记录-首次安装请勿使用.txt @@ -1084,3 +1084,17 @@ INSERT INTO `jsh_function` (`id`, `number`, `name`, `parent_number`, `url`, `com -- 更新jsh_platform_config数据 -- -------------------------------------------------------- INSERT INTO `jsh_platform_config` (`id`, `platform_key`, `platform_key_info`, `platform_value`) VALUES ('3', 'platform_url', '官方网站', 'http://www.huaxiaerp.com/'); + +-- -------------------------------------------------------- +-- 时间 2021年6月20日 +-- by jishenghua +-- 将库存状态报表改为进销存统计报表 +-- -------------------------------------------------------- +update jsh_function set name='进销存统计', sort='0658' where id=59 + +-- -------------------------------------------------------- +-- 时间 2021年6月20日 +-- by jishenghua +-- 增加商品库存报表 +-- -------------------------------------------------------- +INSERT INTO `jsh_function` (`id`, `number`, `name`, `parent_number`, `url`, `component`, `state`, `sort`, `enabled`, `type`, `push_btn`, `icon`, `delete_flag`) VALUES ('246', '030113', '商品库存', '0301', '/report/material_stock', '/report/MaterialStock', b'0', '0605', b'1', '电脑版', '', 'profile', '0'); diff --git a/jshERP-boot/src/main/java/com/jsh/erp/controller/MaterialController.java b/jshERP-boot/src/main/java/com/jsh/erp/controller/MaterialController.java index 058a2534..bf74081f 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/controller/MaterialController.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/controller/MaterialController.java @@ -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 map = new HashMap<>(); + try { + List idList = new ArrayList<>(); + if(categoryId != null){ + idList = materialService.getListByParentId(categoryId); + } + List 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; + } } diff --git a/jshERP-boot/src/main/java/com/jsh/erp/datasource/entities/MaterialVo4Unit.java b/jshERP-boot/src/main/java/com/jsh/erp/datasource/entities/MaterialVo4Unit.java index d5895475..c9dfa167 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/datasource/entities/MaterialVo4Unit.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/datasource/entities/MaterialVo4Unit.java @@ -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; + } } \ No newline at end of file diff --git a/jshERP-boot/src/main/java/com/jsh/erp/datasource/mappers/MaterialMapperEx.java b/jshERP-boot/src/main/java/com/jsh/erp/datasource/mappers/MaterialMapperEx.java index 0522c6d0..d5fcfc6f 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/datasource/mappers/MaterialMapperEx.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/datasource/mappers/MaterialMapperEx.java @@ -85,4 +85,21 @@ public interface MaterialMapperEx { int setUnitIdToNull(@Param("id") Long id); List getMaterialByBarCode(@Param("barCode") String barCode); + + List getListWithStock( + @Param("depotId") Long depotId, + @Param("idList") List idList, + @Param("materialParam") String materialParam, + @Param("offset") Integer offset, + @Param("rows") Integer rows); + + int getListWithStockCount( + @Param("depotId") Long depotId, + @Param("idList") List idList, + @Param("materialParam") String materialParam); + + MaterialVo4Unit getTotalStockAndPrice( + @Param("depotId") Long depotId, + @Param("idList") List idList, + @Param("materialParam") String materialParam); } diff --git a/jshERP-boot/src/main/java/com/jsh/erp/service/material/MaterialService.java b/jshERP-boot/src/main/java/com/jsh/erp/service/material/MaterialService.java index e4bb4a58..1e09653a 100644 --- a/jshERP-boot/src/main/java/com/jsh/erp/service/material/MaterialService.java +++ b/jshERP-boot/src/main/java/com/jsh/erp/service/material/MaterialService.java @@ -797,4 +797,16 @@ public class MaterialService { public List getMaterialByBarCode(String barCode) { return materialMapperEx.getMaterialByBarCode(barCode); } + + public List getListWithStock(Long depotId, List idList, String materialParam, Integer offset, Integer rows) { + return materialMapperEx.getListWithStock(depotId, idList, materialParam, offset, rows); + } + + public int getListWithStockCount(Long depotId, List idList, String materialParam) { + return materialMapperEx.getListWithStockCount(depotId, idList, materialParam); + } + + public MaterialVo4Unit getTotalStockAndPrice(Long depotId, List idList, String materialParam) { + return materialMapperEx.getTotalStockAndPrice(depotId, idList, materialParam); + } } diff --git a/jshERP-boot/src/main/resources/mapper_xml/MaterialMapperEx.xml b/jshERP-boot/src/main/resources/mapper_xml/MaterialMapperEx.xml index 31c6907b..14b2f27b 100644 --- a/jshERP-boot/src/main/resources/mapper_xml/MaterialMapperEx.xml +++ b/jshERP-boot/src/main/resources/mapper_xml/MaterialMapperEx.xml @@ -12,6 +12,17 @@ + + + + + + + + + + + @@ -306,4 +317,93 @@ and ifnull(delete_flag,'0') !='1' and id = #{id} + + + + + + \ No newline at end of file