添加损耗操作

This commit is contained in:
wangcl 2021-12-29 10:54:30 +08:00
parent 0aee0b8971
commit 316638ed97
5 changed files with 44 additions and 31 deletions

View File

@ -68,20 +68,23 @@ public class BusiMaterialOperateController extends BaseController
}
/**
* 新增物料操作流水
* 新增来料和损耗
*/
@GetMapping("/addIn")
public String addIn()
{
public String addIn(@RequestParam(name = "operType", required = false) String operType, @RequestParam(name = "inTab", required = false) String inTab, ModelMap mmap) {
mmap.put("operType",operType);
mmap.put("inTab",inTab);
return prefix + "/addIn";
}
/**
* 新增物料操作流水
* 新增分料
*/
@GetMapping("/addOut")
public String addOut()
{
public String addOut(@RequestParam(name = "operType", required = false) String operType, @RequestParam(name = "inTab", required = false) String inTab, ModelMap mmap) {
mmap.put("operType",operType);
mmap.put("inTab",inTab);
return prefix + "/addOut";
}

View File

@ -70,7 +70,7 @@ public class BusiMaterialOperateServiceImpl implements IBusiMaterialOperateServi
} else {// 2为入库
double stockAmount = busiMaterialStock.getAmountIn() - busiMaterialStock.getAmountOut();
if(busiMaterialOperate.getAmount() > stockAmount){
throw new ServiceException("出库超过库存");
throw new ServiceException("出库或损耗超过库存,库存值:" + stockAmount);
}
busiMaterialStock.setAmountOut(busiMaterialOperate.getAmount() + busiMaterialStock.getAmountOut());
}
@ -87,7 +87,7 @@ public class BusiMaterialOperateServiceImpl implements IBusiMaterialOperateServi
if ("1".equals(busiMaterialOperate.getOprateType())) {
busiMaterialStock.setAmountIn(busiMaterialOperate.getAmount());
} else {
throw new ServiceException("尚未建立库存,请先库再出");
throw new ServiceException("尚未建立库存,请先操作物料入库");
}
busiMaterialStockMapper.insertBusiMaterialStock(busiMaterialStock);
}

View File

@ -6,33 +6,33 @@
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-materialperate-add">
<input name="oprateType" type="hidden" value="1">
<input name="oprateType" type="hidden" th:value="${operType}">
<div class="form-group">
<label class="col-sm-3 control-label">订单:</label>
<label class="col-sm-3 control-label is-required">订单:</label>
<div class="col-sm-8">
<input id="treeId" name="orderId" type="hidden">
<input id="treeName" name="orderName" readonly="true" onclick="selectOrder(1)" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label" title="若无对应的物料选项,请先在产品需求中添加物料需求">物料选择:<i class="fa fa-question-circle-o"></i></label>
<div class="col-sm-3">
<label class="col-sm-3 control-label is-required" title="若无对应的物料选项,请先在产品需求中添加物料需求">物料选择:<i class="fa fa-question-circle-o"></i></label>
<div class="col-sm-4">
<select id="classify" name="classify" class="form-control required" >
</select>
</div>
<div class="col-sm-3">
<div class="col-sm-4">
<select id="color" name="color" class="form-control required" >
</select>
</div>
<label class="control-label text-danger">需求量:<span id="requireAmount" class=""> -- </span></label>
<!-- <label class="control-label text-danger">需求量:<span id="requireAmount" class=""> &#45;&#45; </span></label>-->
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">来料数量:</label>
<div class="col-sm-6">
<label class="col-sm-3 control-label is-required">数量:</label>
<div class="col-sm-8">
<input name="amount" class="form-control" type="text" required>
</div>
<label class="control-label text-danger">当前库存量:<span id="requireAmount" class=""> -- </span></label>
<!-- <label class="control-label text-danger">当前库存量:<span id="requireAmount" class=""> &#45;&#45; </span></label>-->
</div>
<!-- <div class="form-group" th:style="${operType==null}?'':'display:none'">-->
<!-- <label class="col-sm-3 control-label">操作类型:</label>-->
@ -50,7 +50,7 @@
</div>
</div>
<div class="form-group" th:if="${operType!=null}">
<div class="form-group" th:if="${inTab!=null}">
<div class="col-sm-5"></div>
<div class="col-sm-2">
<a class="btn btn-success" onclick="submitHandler()" >

View File

@ -6,23 +6,23 @@
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-materialperate-add">
<input name="oprateType" type="hidden" value="1">
<input name="oprateType" type="hidden" th:value=="${operType}">
<div class="form-group">
<label class="col-sm-3 control-label">订单:</label>
<label class="col-sm-3 control-label is-required">订单:</label>
<div class="col-sm-8">
<input id="treeId" name="orderId" type="hidden">
<input id="treeName" name="orderName" readonly="true" onclick="selectOrder(1)" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">产品:</label>
<label class="col-sm-3 control-label is-required" title="若无对应的产品,请先在订单管理中新增产品需求">产品:<i class="fa fa-question-circle-o"></i></label>
<div class="col-sm-8">
<select id="product" class="form-control" >
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label" title="若无对应的物料选项,请先添加来料">物料选择:<i class="fa fa-question-circle-o"></i></label>
<label class="col-sm-3 control-label is-required" title="若无对应的物料选项,请先添加来料">物料选择:<i class="fa fa-question-circle-o"></i></label>
<div class="col-sm-4">
<select id="classify" name="classify" class="form-control required" >
</select>
@ -34,10 +34,10 @@
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">数量:</label>
<div class="col-sm-6">
<div class="col-sm-8">
<input name="amount" class="form-control" type="text" required>
</div>
<label class="control-label text-danger">库存量:<span id="requireAmount" class=""> -- </span></label>
<!-- <label class="control-label text-danger">库存量:<span id="requireAmount" class=""> &#45;&#45; </span></label>-->
</div>
<div class="form-group">
<label class="col-sm-3 control-label">备注信息:</label>
@ -46,7 +46,7 @@
</div>
</div>
<div class="form-group" th:if="${operType!=null}">
<div class="form-group" th:if="${inTab!=null}">
<div class="col-sm-5"></div>
<div class="col-sm-2">
<a class="btn btn-success" onclick="submitHandler()" >
@ -149,6 +149,10 @@
}
})
}
$(function(){
console.log(parent.document);
})
</script>
</body>
</html>

View File

@ -21,6 +21,7 @@
<option value="">所有</option>
<option value="1">入库</option>
<option value="2">出库</option>
<option value="3">损耗</option>
</select>
</li>
<li>
@ -44,10 +45,13 @@
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="addIn()" shiro:hasPermission="busi:materialperate:add">
<i class="fa fa-plus"></i> 添加来料
添加来料
</a>
<a class="btn btn-success" onclick="addOut()" shiro:hasPermission="busi:materialperate:add">
<i class="fa fa-minus"></i> 添加分料
添加分料
</a>
<a class="btn btn-success" onclick="addWastage()" shiro:hasPermission="busi:materialperate:add">
添加损耗
</a>
<!-- <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="busi:materialperate:edit">-->
<!-- <i class="fa fa-edit"></i> 修改-->
@ -128,7 +132,7 @@
} else if (value == "2") {
return "<i class='fa fa-arrow-circle-up'>出库</i>";
} else {
return "未知操作";
return "<i class='fa fa-trash-o'>损耗</i>";
}
}
},
@ -174,11 +178,13 @@
}
function addIn(){
$.modal.open("添加来料", prefix + "/addIn");
$.modal.open("添加来料", prefix + "/addIn?operType=1");
}
function addOut(){
$.modal.open("添加分料", prefix + "/addOut");
$.modal.open("添加分料", prefix + "/addOut?operType=2");
}
function addWastage(){
$.modal.open("添加损耗", prefix + "/addIn?operType=3");
}
</script>
</body>