From d9627ac020260a74dbe616d050db5d14d98d9cc1 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, 16 Jun 2019 21:38:22 +0800
Subject: [PATCH] =?UTF-8?q?=E5=90=88=E5=B9=B6=E5=95=86=E5=93=81=E7=9A=84?=
=?UTF-8?q?=E5=BA=93=E5=AD=98=E5=88=B0=E5=95=86=E5=93=81=E5=88=97=E8=A1=A8?=
=?UTF-8?q?=E6=8E=A5=E5=8F=A3=E4=B8=80=E8=B5=B7=E6=9F=A5=E8=AF=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
erp_web/pages/materials/material.html | 50 +++-------
.../pages/materials/material_forselect.html | 91 +------------------
.../erp/controller/DepotItemController.java | 71 ---------------
.../datasource/entities/MaterialVo4Unit.java | 10 ++
.../datasource/mappers/DepotItemMapperEx.java | 4 +-
.../service/depotItem/DepotItemService.java | 4 +-
.../erp/service/material/MaterialService.java | 6 ++
.../mapper_xml/DepotItemMapperEx.xml | 6 +-
8 files changed, 36 insertions(+), 206 deletions(-)
diff --git a/erp_web/pages/materials/material.html b/erp_web/pages/materials/material.html
index c987bacb..5484faeb 100644
--- a/erp_web/pages/materials/material.html
+++ b/erp_web/pages/materials/material.html
@@ -522,44 +522,10 @@
{title: '单位', field: 'unit', width: 60},
{title: '安全存量', field: 'safetystock', width: 70},
{
- title: '库存', field: 'abc', width: 70, formatter: function (value, rec) {
- var monthTime = getNowFormatMonth();
- var mId = rec.id; //商品id
- var thisStock = 0;
- //查询库存
- $.ajax({
- type: "get",
- url: '/depotItem/findStockNumByMaterialId',
- data: {
- materialId: mId,
- monthTime: monthTime,
- currentPage: 1,
- pageSize: 10
- },
- dataType: "json",
- success: function (res) {
- if(res && res.code === 200) {
- if (res.data && res.data.page && res.data.page[0]) {
- thisStock = res.data.page[0].thisSum - 0;
- if (thisStock > 0) {
- $("#tablePanel .class-" + rec.id).text(thisStock); //延迟加载库存数据
- $("#tablePanel .class-" + rec.id).css("color", "blue").css("text-decoration", "underline").css("cursor", "pointer");
- $("#tablePanel .class-" + rec.id).off("click").on("click", function () {
- $('#materialDetailListDlg').dialog('open').dialog('setTitle', '
查看出入库明细');
- $(".window-mask").css({width: webW, height: webH});
- initMaterialDetailData(mId);
- getMaterialInOutList(mId, 1, initPageSize);
- ininMaterialDetailPager(mId);
- });
- }
- }
- }
- },
- error: function () {
- $.messager.alert('查询提示', '查询数据后台异常,请稍后再试!', 'error');
- }
- });
- return "" + thisStock + "";
+ title: '库存', field: 'stock', width: 70, formatter: function (value, rec) {
+ var str = '';
+ str += '' + rec.stock + '';
+ return str;
}
},
{title: '零售价', field: 'retailprice', width: 60},
@@ -765,6 +731,14 @@
}
}
+ function findStockList(mId) {
+ $('#materialDetailListDlg').dialog('open').dialog('setTitle', '
查看出入库明细');
+ $(".window-mask").css({width: webW, height: webH});
+ initMaterialDetailData(mId);
+ getMaterialInOutList(mId, 1, initPageSize);
+ ininMaterialDetailPager(mId);
+ }
+
//删除商品信息
function deleteMaterial(materialID) {
$.messager.confirm('删除确认', '确定要删除此商品信息吗?', function (r) {
diff --git a/erp_web/pages/materials/material_forselect.html b/erp_web/pages/materials/material_forselect.html
index 4497ea2f..56f58fbc 100644
--- a/erp_web/pages/materials/material_forselect.html
+++ b/erp_web/pages/materials/material_forselect.html
@@ -94,48 +94,7 @@
{title: '品名', field: 'name', width: 150},
{title: '型号', field: 'model', width: 100},
{title: '类别', field: 'categoryName', width: 130},
- {title: '单位', field: 'unit', width: 60},
- {
- title: '库存', field: 'abc', width: 70, formatter: function (value, rec) {
- var monthTime = getNowFormatMonth();
- var mId = rec.id; //商品id
- var thisStock = 0;
- //查询库存
- $.ajax({
- type: "get",
- url: '/depotItem/findStockNumByMaterialId',
- data: {
- materialId: mId,
- monthTime: monthTime,
- currentPage: 1,
- pageSize: 10
- },
- dataType: "json",
- success: function (res) {
- if(res && res.code === 200) {
- if (res.data && res.data.page && res.data.page[0]) {
- thisStock = res.data.page[0].thisSum - 0;
- if (thisStock > 0) {
- $("#tablePanel .class-" + rec.id).text(thisStock); //延迟加载库存数据
- $("#tablePanel .class-" + rec.id).css("color", "blue").css("text-decoration", "underline").css("cursor", "pointer");
- $("#tablePanel .class-" + rec.id).off("click").on("click", function () {
- $('#materialDetailListDlg').dialog('open').dialog('setTitle', '
查看出入库明细');
- $(".window-mask").css({width: webW, height: webH});
- initMaterialDetailData(mId);
- getMaterialInOutList(mId, 1, initPageSize);
- ininMaterialDetailPager(mId);
- });
- }
- }
- }
- },
- error: function () {
- $.messager.alert('查询提示', '查询数据后台异常,请稍后再试!', 'error');
- }
- });
- return "" + thisStock + "";
- }
- },
+ {title: '单位', field: 'unit', width: 60}
]],
toolbar: [
],
@@ -162,54 +121,6 @@
showMaterialDetails(1, initPageSize);
}
-
- //分页信息处理
- function ininMaterialDetailPager(mId) {
- try {
- var opts = $("#materialTableData").datagrid('options');
- var pager = $("#materialTableData").datagrid('getPager');
- pager.pagination({
- onSelectPage: function (pageNum, pageSize) {
- opts.pageNumber = pageNum;
- opts.pageSize = pageSize;
- pager.pagination('refresh', {
- pageNumber: pageNum,
- pageSize: pageSize
- });
- getMaterialInOutList(mId, pageNum, pageSize);
- }
- });
- }
- catch (e) {
- $.messager.alert('异常处理提示', "分页信息异常 : " + e.name + ": " + e.message, 'error');
- }
- }
-
- function getMaterialInOutList(mId, pageNo, pageSize) {
- $.ajax({
- type: "get",
- url: "/depotItem/findDetailByTypeAndMaterialId",
- dataType: "json",
- data: ({
- materialId: mId,
- currentPage: pageNo,
- pageSize: pageSize
- }),
- success: function (res) {
- if(res && res.code === 200){
- if(res.data && res.data.page) {
- $("#materialTableData").datagrid('loadData', res.data.page);
- }
- }
- },
- //此处添加错误处理
- error: function () {
- $.messager.alert('查询提示', '查询数据后台异常,请稍后再试!', 'error');
- return;
- }
- });
- }
-
//初始化键盘enter事件
$(document).keydown(function (event) {
//兼容 IE和firefox 事件
diff --git a/src/main/java/com/jsh/erp/controller/DepotItemController.java b/src/main/java/com/jsh/erp/controller/DepotItemController.java
index f78f0f86..b509c9c7 100644
--- a/src/main/java/com/jsh/erp/controller/DepotItemController.java
+++ b/src/main/java/com/jsh/erp/controller/DepotItemController.java
@@ -152,77 +152,6 @@ public class DepotItemController {
return returnJson(objectMap, ErpInfo.OK.name, ErpInfo.OK.code);
}
- /**
- * 只根据商品id查询库存数量
- * @param pageSize
- * @param currentPage
- * @param mId
- * @param request
- * @return
- */
- @GetMapping(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);
- }
- }
- objectMap.put("page", dataArray);
- if (list == null) {
- queryInfo.setRows(new ArrayList