From e2bb23f0cafeef3200c4e992ae3db390e2c59ca2 Mon Sep 17 00:00:00 2001 From: wangcl Date: Mon, 27 Dec 2021 16:44:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=80=E9=94=AE=E5=85=A5=E5=BA=93=E5=92=8C?= =?UTF-8?q?=E5=87=BA=E5=BA=93=E4=BB=A3=E7=A0=81=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusiMaterialOperateController.java | 9 ++-- .../ruoyi/busi/domain/BusiMaterialStock.java | 8 +++- .../main/resources/static/ruoyi/js/ry-ui.js | 31 ++++++++++++++ .../templates/busi/materialperate/add.html | 41 +++++++++++-------- .../busi/materialperate/materialperate.html | 5 ++- .../busi/materialtock/materialtock.html | 7 +--- 6 files changed, 69 insertions(+), 32 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/busi/controller/BusiMaterialOperateController.java b/ruoyi-admin/src/main/java/com/ruoyi/busi/controller/BusiMaterialOperateController.java index 5076e2c20..d6e9440c5 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/busi/controller/BusiMaterialOperateController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/busi/controller/BusiMaterialOperateController.java @@ -8,11 +8,7 @@ import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.bind.annotation.*; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.busi.domain.BusiMaterialOperate; @@ -75,8 +71,9 @@ public class BusiMaterialOperateController extends BaseController * 新增物料操作流水 */ @GetMapping("/add") - public String add() + public String add(@RequestParam(name = "operType",required = false) String operType,ModelMap mmap) { + mmap.put("operType",operType); return prefix + "/add"; } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/busi/domain/BusiMaterialStock.java b/ruoyi-admin/src/main/java/com/ruoyi/busi/domain/BusiMaterialStock.java index 6c14877cc..adc6494d6 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/busi/domain/BusiMaterialStock.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/busi/domain/BusiMaterialStock.java @@ -27,11 +27,11 @@ public class BusiMaterialStock extends BaseEntity /** 进库量 */ @Excel(name = "进库量") - private Long amountIn; + private Long amountIn = 0l; /** 出库量 */ @Excel(name = "出库量") - private Long amountOut; + private Long amountOut = 0l; /** 单位 */ @Excel(name = "单位") @@ -116,6 +116,10 @@ public class BusiMaterialStock extends BaseEntity this.orderName = orderName; } + public Long getStockAmount(){ + return this.amountIn - this.amountOut; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) diff --git a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js index 54591c270..05967ff38 100644 --- a/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js +++ b/ruoyi-admin/src/main/resources/static/ruoyi/js/ry-ui.js @@ -1015,6 +1015,37 @@ var table = { }; $.ajax(config) }, + ajaxSubmit: function(url, type, dataType, data, callback) { + var config = { + url: url, + type: type, + dataType: dataType, + data: data, + beforeSend: function () { + $.modal.loading("正在处理中,请稍候..."); + }, + success: function(result) { + if (result.code == web_status.SUCCESS) { + if (typeof callback == "function") { + callback(result); + } + } else if (result.code == web_status.WARNING) { + $.modal.alertWarning(result.msg) + } else { + $.modal.alertError(result.msg); + } + $.modal.closeLoading(); + } + }; + $.ajax(config) + }, + ajaxPost: function(url, data, callback) { + $.operate.ajaxSubmit(url, "post", "json", data, callback); + }, + // get请求传输 + ajaxGet: function(url, callback) { + $.operate.ajaxSubmit(url, "get", "json", "", callback); + }, // post请求传输 post: function(url, data, callback) { $.operate.submit(url, "post", "json", data, callback); diff --git a/ruoyi-admin/src/main/resources/templates/busi/materialperate/add.html b/ruoyi-admin/src/main/resources/templates/busi/materialperate/add.html index 8fc4d916b..7bbdb48c7 100644 --- a/ruoyi-admin/src/main/resources/templates/busi/materialperate/add.html +++ b/ruoyi-admin/src/main/resources/templates/busi/materialperate/add.html @@ -28,12 +28,12 @@ -
+
@@ -43,6 +43,19 @@
+ +
+
+ +
@@ -80,26 +93,20 @@ $.modal.openOptions(options); } - /*物料查询*/ + /*物料需求查询*/ function queryMetarial(orderId) { var url = ctx + "busi/productRequire/listByOrderId?orderId=" + orderId; - $.modal.loading("正在查询中,请稍候..."); - $.post(url, {}, function (result) { + $.operate.ajaxPost(url, {}, function (result) { var data = result.data; $("#post").empty(); $("#post").append(""); - if (result.code == web_status.SUCCESS) { - for (var i = 0; i < data.length; i++) { - var val = data[i].colorCode + ';' + data[i].classifyCode + ';' + data[i].unitCode; - var text = data[i].colorVal + ',' + data[i].classifyVal; - var requireAmount = data[i].amount + data[i].unitVal; - $("#post").append(""); - } - } else { - $.modal.alertError(result.msg); + for (var i = 0; i < data.length; i++) { + var val = data[i].colorCode + ';' + data[i].classifyCode + ';' + data[i].unitCode; + var text = data[i].colorVal + ',' + data[i].classifyVal; + var requireAmount = data[i].amount + data[i].unitVal; + $("#post").append(""); } - $.modal.closeLoading(); - }); + }) } diff --git a/ruoyi-admin/src/main/resources/templates/busi/materialperate/materialperate.html b/ruoyi-admin/src/main/resources/templates/busi/materialperate/materialperate.html index e1f55c60a..96f457c77 100644 --- a/ruoyi-admin/src/main/resources/templates/busi/materialperate/materialperate.html +++ b/ruoyi-admin/src/main/resources/templates/busi/materialperate/materialperate.html @@ -78,7 +78,7 @@ updateUrl: prefix + "/edit/{id}", removeUrl: prefix + "/remove", exportUrl: prefix + "/export", - modalName: "物料操作流水", + modalName: "物料操作", columns: [{ checkbox: true }, @@ -136,7 +136,8 @@ { field: 'createTime', title: '操作时间' - }, + } + // , // { // title: '操作', // align: 'center', diff --git a/ruoyi-admin/src/main/resources/templates/busi/materialtock/materialtock.html b/ruoyi-admin/src/main/resources/templates/busi/materialtock/materialtock.html index c2a2f727e..6a9d317c5 100644 --- a/ruoyi-admin/src/main/resources/templates/busi/materialtock/materialtock.html +++ b/ruoyi-admin/src/main/resources/templates/busi/materialtock/materialtock.html @@ -95,11 +95,8 @@ // title: '出库量' // }, { - field: 'amount', - title: '库存量', - formatter: function(value, row, index) { - return row.amountIn - row.amountOut; - } + field: 'stockAmount', + title: '库存量' }, { field: 'unit',