From 0b07e2d61fdf64eef560951282718b461d5a460d Mon Sep 17 00:00:00 2001 From: qiankunpingtai Date: Mon, 10 Jun 2019 15:50:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=A0=B9=E6=8D=AE=E6=9D=90?= =?UTF-8?q?=E6=96=99=E5=92=8C=E4=BB=93=E5=BA=93=E8=8E=B7=E5=8F=96=E5=BA=93?= =?UTF-8?q?=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../js/pages/materials/allocation_out_list.js | 5 +- erp_web/js/pages/materials/assemble_list.js | 5 +- .../js/pages/materials/disassemble_list.js | 5 +- erp_web/js/pages/materials/other_in_list.js | 5 +- erp_web/js/pages/materials/other_out_list.js | 5 +- .../js/pages/materials/purchase_back_list.js | 5 +- .../js/pages/materials/purchase_in_list.js | 5 +- .../pages/materials/purchase_orders_list.js | 5 +- .../js/pages/materials/retail_back_list.js | 5 +- erp_web/js/pages/materials/retail_out_list.js | 5 +- erp_web/js/pages/materials/sale_back_list.js | 5 +- .../js/pages/materials/sale_orders_list.js | 5 +- erp_web/js/pages/materials/sale_out_list.js | 5 +- .../erp/controller/DepotItemController.java | 55 +++---------------- 14 files changed, 20 insertions(+), 100 deletions(-) diff --git a/erp_web/js/pages/materials/allocation_out_list.js b/erp_web/js/pages/materials/allocation_out_list.js index 614960a9..f85c8eb6 100644 --- a/erp_web/js/pages/materials/allocation_out_list.js +++ b/erp_web/js/pages/materials/allocation_out_list.js @@ -487,10 +487,7 @@ function findStockNumById(depotId, mId, monthTime, body, input, ratio, type){ url: '/depotItem/findStockNumById', data:{ projectId: depotId, - materialId: mId, - monthTime: monthTime, - currentPage: 1, - pageSize: 10 + materialId: mId }, dataType: "json", success: function (res) { diff --git a/erp_web/js/pages/materials/assemble_list.js b/erp_web/js/pages/materials/assemble_list.js index b4124e99..5dc7bd78 100644 --- a/erp_web/js/pages/materials/assemble_list.js +++ b/erp_web/js/pages/materials/assemble_list.js @@ -489,10 +489,7 @@ function findStockNumById(depotId, mId, monthTime, body, input, ratio, type){ url: '/depotItem/findStockNumById', data:{ projectId: depotId, - materialId: mId, - monthTime: monthTime, - currentPage: 1, - pageSize: 10 + materialId: mId }, dataType: "json", success: function (res) { diff --git a/erp_web/js/pages/materials/disassemble_list.js b/erp_web/js/pages/materials/disassemble_list.js index c41c921f..f1676356 100644 --- a/erp_web/js/pages/materials/disassemble_list.js +++ b/erp_web/js/pages/materials/disassemble_list.js @@ -488,10 +488,7 @@ function findStockNumById(depotId, mId, monthTime, body, input, ratio, type){ url: '/depotItem/findStockNumById', data:{ projectId: depotId, - materialId: mId, - monthTime: monthTime, - currentPage: 1, - pageSize: 10 + materialId: mId }, dataType: "json", success: function (res) { diff --git a/erp_web/js/pages/materials/other_in_list.js b/erp_web/js/pages/materials/other_in_list.js index bad7c8bd..bee33a09 100644 --- a/erp_web/js/pages/materials/other_in_list.js +++ b/erp_web/js/pages/materials/other_in_list.js @@ -494,10 +494,7 @@ function findStockNumById(depotId, mId, monthTime, body, input, ratio, type){ url: '/depotItem/findStockNumById', data:{ projectId: depotId, - materialId: mId, - monthTime: monthTime, - currentPage: 1, - pageSize: 10 + materialId: mId }, dataType: "json", success: function (res) { diff --git a/erp_web/js/pages/materials/other_out_list.js b/erp_web/js/pages/materials/other_out_list.js index ebec038f..4ea33997 100644 --- a/erp_web/js/pages/materials/other_out_list.js +++ b/erp_web/js/pages/materials/other_out_list.js @@ -488,10 +488,7 @@ function findStockNumById(depotId, mId, monthTime, body, input, ratio, type){ url: '/depotItem/findStockNumById', data:{ projectId: depotId, - materialId: mId, - monthTime: monthTime, - currentPage: 1, - pageSize: 10 + materialId: mId }, dataType: "json", success: function (res) { diff --git a/erp_web/js/pages/materials/purchase_back_list.js b/erp_web/js/pages/materials/purchase_back_list.js index a5b0d7c0..1fa1f936 100644 --- a/erp_web/js/pages/materials/purchase_back_list.js +++ b/erp_web/js/pages/materials/purchase_back_list.js @@ -498,10 +498,7 @@ function findStockNumById(depotId, mId, monthTime, body, input, ratio, type){ url: '/depotItem/findStockNumById', data:{ projectId: depotId, - materialId: mId, - monthTime: monthTime, - currentPage: 1, - pageSize: 10 + materialId: mId }, dataType: "json", success: function (res) { diff --git a/erp_web/js/pages/materials/purchase_in_list.js b/erp_web/js/pages/materials/purchase_in_list.js index eea38d55..f046cf4a 100644 --- a/erp_web/js/pages/materials/purchase_in_list.js +++ b/erp_web/js/pages/materials/purchase_in_list.js @@ -501,10 +501,7 @@ function findStockNumById(depotId, mId, monthTime, body, input, ratio, type){ url: '/depotItem/findStockNumById', data:{ projectId: depotId, - materialId: mId, - monthTime: monthTime, - currentPage: 1, - pageSize: 10 + materialId: mId }, dataType: "json", success: function (res) { diff --git a/erp_web/js/pages/materials/purchase_orders_list.js b/erp_web/js/pages/materials/purchase_orders_list.js index cd2a30c2..0bc2f56d 100644 --- a/erp_web/js/pages/materials/purchase_orders_list.js +++ b/erp_web/js/pages/materials/purchase_orders_list.js @@ -503,10 +503,7 @@ function findStockNumById(depotId, mId, monthTime, body, input, ratio, type){ url: '/depotItem/findStockNumById', data:{ projectId: depotId, - materialId: mId, - monthTime: monthTime, - currentPage: 1, - pageSize: 10 + materialId: mId }, dataType: "json", success: function (res) { diff --git a/erp_web/js/pages/materials/retail_back_list.js b/erp_web/js/pages/materials/retail_back_list.js index f2f51115..1890d826 100644 --- a/erp_web/js/pages/materials/retail_back_list.js +++ b/erp_web/js/pages/materials/retail_back_list.js @@ -502,10 +502,7 @@ function findStockNumById(depotId, mId, monthTime, body, input, ratio, type){ url: '/depotItem/findStockNumById', data:{ projectId: depotId, - materialId: mId, - monthTime: monthTime, - currentPage: 1, - pageSize: 10 + materialId: mId }, dataType: "json", success: function (res) { diff --git a/erp_web/js/pages/materials/retail_out_list.js b/erp_web/js/pages/materials/retail_out_list.js index c2a78287..6a16bbf6 100644 --- a/erp_web/js/pages/materials/retail_out_list.js +++ b/erp_web/js/pages/materials/retail_out_list.js @@ -494,10 +494,7 @@ function findStockNumById(depotId, mId, monthTime, body, input, ratio, type){ url: '/depotItem/findStockNumById', data:{ projectId: depotId, - materialId: mId, - monthTime: monthTime, - currentPage: 1, - pageSize: 10 + materialId: mId }, dataType: "json", success: function (res) { diff --git a/erp_web/js/pages/materials/sale_back_list.js b/erp_web/js/pages/materials/sale_back_list.js index 1459eb1e..8c55e093 100644 --- a/erp_web/js/pages/materials/sale_back_list.js +++ b/erp_web/js/pages/materials/sale_back_list.js @@ -504,10 +504,7 @@ function findStockNumById(depotId, mId, monthTime, body, input, ratio, type){ url: '/depotItem/findStockNumById', data:{ projectId: depotId, - materialId: mId, - monthTime: monthTime, - currentPage: 1, - pageSize: 10 + materialId: mId }, dataType: "json", success: function (res) { diff --git a/erp_web/js/pages/materials/sale_orders_list.js b/erp_web/js/pages/materials/sale_orders_list.js index f60a1035..9605ec90 100644 --- a/erp_web/js/pages/materials/sale_orders_list.js +++ b/erp_web/js/pages/materials/sale_orders_list.js @@ -503,10 +503,7 @@ function findStockNumById(depotId, mId, monthTime, body, input, ratio, type){ url: '/depotItem/findStockNumById', data:{ projectId: depotId, - materialId: mId, - monthTime: monthTime, - currentPage: 1, - pageSize: 10 + materialId: mId }, dataType: "json", success: function (res) { diff --git a/erp_web/js/pages/materials/sale_out_list.js b/erp_web/js/pages/materials/sale_out_list.js index 9a8e46e8..c8a9dd2c 100644 --- a/erp_web/js/pages/materials/sale_out_list.js +++ b/erp_web/js/pages/materials/sale_out_list.js @@ -501,10 +501,7 @@ function findStockNumById(depotId, mId, monthTime, body, input, ratio, type){ url: '/depotItem/findStockNumById', data:{ projectId: depotId, - materialId: mId, - monthTime: monthTime, - currentPage: 1, - pageSize: 10 + materialId: mId }, dataType: "json", success: function (res) { diff --git a/src/main/java/com/jsh/erp/controller/DepotItemController.java b/src/main/java/com/jsh/erp/controller/DepotItemController.java index fc6e56f4..d040eb64 100644 --- a/src/main/java/com/jsh/erp/controller/DepotItemController.java +++ b/src/main/java/com/jsh/erp/controller/DepotItemController.java @@ -89,66 +89,25 @@ public class DepotItemController { /** * 根据商品id和仓库id查询库存数量 - * @param pageSize - * @param currentPage * @param mId * @param request * @return */ - @GetMapping(value = "/findStockNumById") + @RequestMapping(value = "/findStockNumById") public String findStockNumById( - @RequestParam(value = Constants.PAGE_SIZE, required = false) Integer pageSize, - @RequestParam(value = Constants.CURRENT_PAGE, required = false) Integer currentPage, @RequestParam("projectId") Integer pid, @RequestParam("materialId") String mId, - @RequestParam("monthTime") String monthTime, HttpServletRequest request) throws Exception{ - Map parameterMap = ParamUtils.requestToMap(request); - parameterMap.put("mId", mId); - parameterMap.put("monthTime", monthTime); - PageQueryInfo queryInfo = new PageQueryInfo(); Map objectMap = new HashMap(); - if (pageSize != null && pageSize <= 0) { - pageSize = 10; - } - String offset = ParamUtils.getPageOffset(currentPage, pageSize); - if (StringUtil.isNotEmpty(offset)) { - parameterMap.put(Constants.OFFSET, offset); - } - List list = depotItemService.findStockNumByMaterialIdList(parameterMap); //存放数据json数组 - Long materialId = Long.parseLong(mId); + Long materialId = Long.valueOf(mId); + Long depotId = Long.valueOf(pid); JSONArray dataArray = new JSONArray(); - if (null != list) { - for (DepotItemVo4Material di : list) { - JSONObject item = new JSONObject(); - BigDecimal prevSum = sumNumber("入库", pid, materialId, monthTime, true).subtract(sumNumber("出库", pid, materialId, monthTime, true)); - BigDecimal InSum = sumNumber("入库", pid, materialId, monthTime, false); - BigDecimal OutSum = sumNumber("出库", pid, materialId, monthTime, false); - // +组装(组合件)-组装(普通子件)+拆卸(普通子件)-拆卸(组合件) - BigDecimal prevAssembleSum = assembleNumber("组装单","组合件", pid, materialId, monthTime, true) - .subtract(assembleNumber("组装单","普通子件", pid, materialId, monthTime, true)) - .add(assembleNumber("拆卸单","普通子件", pid, materialId, monthTime, true)) - .subtract(assembleNumber("拆卸单","组合件", pid, materialId, monthTime, true)); - BigDecimal notPrevAssembleSum = assembleNumber("组装单","组合件", pid, materialId, monthTime, false) - .subtract(assembleNumber("组装单","普通子件", pid, materialId, monthTime, false)) - .add(assembleNumber("拆卸单","普通子件", pid, materialId, monthTime, false)) - .subtract(assembleNumber("拆卸单","组合件", pid, materialId, monthTime, false)); - item.put("MaterialId", di.getMaterialid() == null ? "" : di.getMaterialid()); - item.put("MaterialName", di.getMname()); - item.put("MaterialModel", di.getMmodel()); - item.put("thisSum", prevSum.add(InSum).subtract(OutSum).add(prevAssembleSum).add(notPrevAssembleSum)); - dataArray.add(item); - } - } + JSONObject item = new JSONObject(); + /**查询指定仓库下指定材料的库存数量*/ + item.put("thisSum", depotItemService.getCurrentRepByMaterialIdAndDepotId(materialId,depotId)); + dataArray.add(item); objectMap.put("page", dataArray); - if (list == null) { - queryInfo.setRows(new ArrayList()); - queryInfo.setTotal(BusinessConstants.DEFAULT_LIST_NULL_NUMBER); - return returnJson(objectMap, "查找不到数据", ErpInfo.OK.code); - } - queryInfo.setRows(list); - queryInfo.setTotal(depotItemService.findStockNumByMaterialIdCounts(parameterMap)); return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code); }