一键入库和出库代码优化
This commit is contained in:
parent
ddf707460a
commit
e2bb23f0ca
|
|
@ -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";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -28,12 +28,12 @@
|
|||
</div>
|
||||
<label class="control-label text-danger">库存量:<span id="requireAmount" class=""> -- </span></label>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="form-group" th:style="${operType==null}?'':'display:none'">
|
||||
<label class="col-sm-3 control-label">操作类型:</label>
|
||||
<div class="col-sm-8">
|
||||
<select name="oprateType" class="form-control m-b">
|
||||
<option value="1" selected>入库</option>
|
||||
<option value="2">出库</option>
|
||||
<option value="1" th:selected="${operType ne '2'}">入库</option>
|
||||
<option value="2" th:selected="${operType eq '2'}">出库</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -43,6 +43,19 @@
|
|||
<textarea name="remark" class="form-control"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" th:if="${operType!=null}">
|
||||
<div class="col-sm-5"></div>
|
||||
<div class="col-sm-2">
|
||||
<a class="btn btn-success" onclick="submitHandler()" >
|
||||
保存
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-sm-3">
|
||||
<a class="btn btn-info" onclick="$.modal.closeTab()" >
|
||||
关闭
|
||||
</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<th:block th:include="include :: footer" />
|
||||
|
|
@ -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("<option value=''>请选择物料</option>");
|
||||
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("<option requireAmount='" + requireAmount + "' value='" + val + "'>" + text + "</option>");
|
||||
}
|
||||
} 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("<option requireAmount='" + requireAmount + "' value='" + val + "'>" + text + "</option>");
|
||||
}
|
||||
$.modal.closeLoading();
|
||||
});
|
||||
})
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -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',
|
||||
|
|
|
|||
|
|
@ -95,11 +95,8 @@
|
|||
// title: '出库量'
|
||||
// },
|
||||
{
|
||||
field: 'amount',
|
||||
title: '库存量',
|
||||
formatter: function(value, row, index) {
|
||||
return row.amountIn - row.amountOut;
|
||||
}
|
||||
field: 'stockAmount',
|
||||
title: '库存量'
|
||||
},
|
||||
{
|
||||
field: 'unit',
|
||||
|
|
|
|||
Loading…
Reference in New Issue