From 99d856111e19bdc419c61d70b9e055785bd0fe79 Mon Sep 17 00:00:00 2001 From: qiankunpingtai Date: Tue, 11 Jun 2019 10:50:51 +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 --- erp_web/pages/materials/material.html | 11 +- .../pages/materials/material_forselect.html | 428 ++++++++---------- .../erp/controller/DepotItemController.java | 53 +-- .../DepotItemVo4DetailByTypeAndMId.java | 20 + .../mapper_xml/DepotItemMapperEx.xml | 62 ++- 5 files changed, 260 insertions(+), 314 deletions(-) diff --git a/erp_web/pages/materials/material.html b/erp_web/pages/materials/material.html index ac3222c3..9c8e132f 100644 --- a/erp_web/pages/materials/material.html +++ b/erp_web/pages/materials/material.html @@ -538,10 +538,7 @@ type: "get", url: '/depotItem/findStockNumByMaterialId', data: { - materialId: mId, - monthTime: monthTime, - currentPage: 1, - pageSize: 10 + materialId: mId }, dataType: "json", success: function (res) { @@ -667,6 +664,7 @@ pageSize: initPageSize, pageList: initPageNum, columns: [[ + { title: '单据编号', field: 'Number', width: 150, formatter: function (value, row) { @@ -676,7 +674,10 @@ }, {title: '类型', field: 'Type', width: 100}, {title: '数量', field: 'BasicNumber', width: 80}, - {title: '日期', field: 'OperTime', width: 180} + {title: '仓库', field: 'depotName', width: 180}, + {title: '日期', field: 'OperTime', width: 180}, + {title: '调入仓库', field: 'depotInName', width: 180} + ]], onLoadError: function () { $.messager.alert('页面加载提示', '页面加载异常,请稍后再试!', 'error'); diff --git a/erp_web/pages/materials/material_forselect.html b/erp_web/pages/materials/material_forselect.html index 4497ea2f..f64e978d 100644 --- a/erp_web/pages/materials/material_forselect.html +++ b/erp_web/pages/materials/material_forselect.html @@ -46,273 +46,213 @@
-
-
-
- - + diff --git a/src/main/java/com/jsh/erp/controller/DepotItemController.java b/src/main/java/com/jsh/erp/controller/DepotItemController.java index d040eb64..301eaccb 100644 --- a/src/main/java/com/jsh/erp/controller/DepotItemController.java +++ b/src/main/java/com/jsh/erp/controller/DepotItemController.java @@ -4,7 +4,8 @@ import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.jsh.erp.constants.BusinessConstants; import com.jsh.erp.constants.ExceptionConstants; -import com.jsh.erp.datasource.entities.*; +import com.jsh.erp.datasource.entities.DepotItemVo4DetailByTypeAndMId; +import com.jsh.erp.datasource.entities.DepotItemVo4WithInfoEx; import com.jsh.erp.datasource.vo.DepotItemStockWarningCount; import com.jsh.erp.exception.BusinessRunTimeException; import com.jsh.erp.service.depotItem.DepotItemService; @@ -12,8 +13,10 @@ import com.jsh.erp.service.material.MaterialService; import com.jsh.erp.utils.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.dao.DataAccessException; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; @@ -73,6 +76,8 @@ public class DepotItemController { item.put("Type", d.getNewtype()); //进出类型 item.put("BasicNumber", d.getBnum()); //数量 item.put("OperTime", d.getOtime()); //时间 + item.put("depotName", d.getDepotName()); //仓库名称 + item.put("depotInName", d.getDepotInName()); //调入仓库名称 dataArray.add(item); } } @@ -113,55 +118,21 @@ public class DepotItemController { /** * 只根据商品id查询库存数量 - * @param pageSize - * @param currentPage * @param mId * @param request * @return */ - @GetMapping(value = "/findStockNumByMaterialId") + @RequestMapping(value = "/findStockNumByMaterialId") public String findStockNumByMaterialId( - @RequestParam(value = Constants.PAGE_SIZE, required = false) Integer pageSize, - @RequestParam(value = Constants.CURRENT_PAGE, required = false) Integer currentPage, @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数组 JSONArray dataArray = new JSONArray(); - if (null != list) { - for (DepotItemVo4Material di : list) { - JSONObject item = new JSONObject(); - int InSum = sumNumberByMaterialId("入库", di.getMaterialid()); - int OutSum = sumNumberByMaterialId("出库", di.getMaterialid()); - item.put("MaterialId", di.getMaterialid() == null ? "" : di.getMaterialid()); - item.put("MaterialName", di.getMname()); - item.put("MaterialModel", di.getMmodel()); - item.put("thisSum", InSum - OutSum); - dataArray.add(item); - } - } + JSONObject item = new JSONObject(); + item.put("thisSum", depotItemService.getCurrentRepByMaterialIdAndDepotId(Long.valueOf(mId),null)); + 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); } diff --git a/src/main/java/com/jsh/erp/datasource/entities/DepotItemVo4DetailByTypeAndMId.java b/src/main/java/com/jsh/erp/datasource/entities/DepotItemVo4DetailByTypeAndMId.java index d6ad0a58..4577ca97 100644 --- a/src/main/java/com/jsh/erp/datasource/entities/DepotItemVo4DetailByTypeAndMId.java +++ b/src/main/java/com/jsh/erp/datasource/entities/DepotItemVo4DetailByTypeAndMId.java @@ -11,6 +11,10 @@ public class DepotItemVo4DetailByTypeAndMId { private Integer bnum; private Date otime; + //仓库名称 + private String depotName; + //调入仓库名称 + private String depotInName; public String getNumber() { return number; @@ -43,4 +47,20 @@ public class DepotItemVo4DetailByTypeAndMId { public void setOtime(Date otime) { this.otime = otime; } + + public String getDepotName() { + return depotName; + } + + public void setDepotName(String depotName) { + this.depotName = depotName; + } + + public String getDepotInName() { + return depotInName; + } + + public void setDepotInName(String depotInName) { + this.depotInName = depotInName; + } } \ No newline at end of file diff --git a/src/main/resources/mapper_xml/DepotItemMapperEx.xml b/src/main/resources/mapper_xml/DepotItemMapperEx.xml index 57f27f7f..545c50fd 100644 --- a/src/main/resources/mapper_xml/DepotItemMapperEx.xml +++ b/src/main/resources/mapper_xml/DepotItemMapperEx.xml @@ -7,6 +7,8 @@ + + @@ -91,12 +93,22 @@ @@ -589,24 +603,24 @@ AND intype.BasicInNumber > 0