物料操作完善

This commit is contained in:
wangcl 2021-12-29 16:25:48 +08:00
parent 316638ed97
commit 4a44d46053
6 changed files with 62 additions and 31 deletions

View File

@ -30,7 +30,7 @@ public class BusiProductRequire extends BaseEntity
/** 数量 */
@Excel(name = "数量")
private Long amount;
private double amount;
/** 尺码 */
@Excel(name = "尺码")
@ -66,15 +66,15 @@ public class BusiProductRequire extends BaseEntity
{
return orderId;
}
public void setAmount(Long amount)
{
public double getAmount() {
return amount;
}
public void setAmount(double amount) {
this.amount = amount;
}
public Long getAmount()
{
return amount;
}
public void setSize(String size)
{
this.size = size;

View File

@ -29,7 +29,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="orderId != null and orderId != ''"> and bo.id = #{orderId}</if>
<if test="oprateType != null and oprateType != ''"> and bmo.oprate_type = #{oprateType}</if>
<if test="createBy != null and createBy != ''"> and bmo.create_by = #{createBy}</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and bmo.create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if>
</where>
order by create_time DESC
</select>

View File

@ -138,7 +138,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where bpr.order_id = #{orderId}
</select>
<select id="selMaterialColorListByOrderIdAndType" parameterType="java.util.Map" resultType="java.util.Map">
SELECT DISTINCT bmr.color AS colorCode
SELECT DISTINCT bmr.color AS colorCode, bmr.unit
FROM busi_material_require bmr
LEFT JOIN busi_product_require bpr
ON bmr.product_require_id = bpr.id
@ -150,7 +150,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
WHERE bmr.product_require_id = #{productId}
</select>
<select id="selMaterialColorListByProductIdAndType" parameterType="java.util.Map" resultType="java.util.Map">
SELECT DISTINCT bmr.color AS colorCode
SELECT DISTINCT bmr.color AS colorCode, bmr.amount, bmr.unit
FROM busi_material_require bmr
WHERE bmr.product_require_id = #{productId} AND bmr.classify = #{classify}
</select>

View File

@ -1217,7 +1217,7 @@ var table = {
return url;
},
// 保存信息 刷新表格
save: function(url, data, callback) {
save: function(url, data, callback, successCallback) {
var config = {
url: url,
type: "post",
@ -1231,7 +1231,7 @@ var table = {
if (typeof callback == "function") {
callback(result);
}
$.operate.successCallback(result);
$.operate.successCallback(result, successCallback);
}
};
$.ajax(config)
@ -1310,7 +1310,7 @@ var table = {
$.modal.closeLoading();
},
// 成功回调执行事件(父窗体静默更新)
successCallback: function(result) {
successCallback: function(result, callback) {
if (result.code == web_status.SUCCESS) {
var parent = activeWindow();
if($.common.isEmpty(parent.table)) {
@ -1324,8 +1324,11 @@ var table = {
parent.$.modal.msgSuccess(result.msg);
parent.$.treeTable.refresh();
}
if (typeof callback == "function") {
callback();
}
} else if (result.code == web_status.WARNING) {
$.modal.alertWarning(result.msg)
$.modal.alertWarning(result.msg);
} else {
$.modal.alertError(result.msg);
}

View File

@ -24,6 +24,8 @@
<div class="col-sm-4">
<select id="color" name="color" class="form-control required" >
</select>
<input id="unit" name="unit" type="hidden">
</div>
<!-- <label class="control-label text-danger">需求量:<span id="requireAmount" class=""> &#45;&#45; </span></label>-->
</div>
@ -81,9 +83,18 @@
queryColorList(orderId, classify);
})
$("#color").change(function(){
var unit = $("#color :selected").attr("unit");
$("#unit").val(unit);
})
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-materialperate-add').serialize());
$.operate.save(prefix + "/add", $('#form-materialperate-add').serialize(), {}, function(){
$.modal.alertSuccess("保存成功");
});
}
}
@ -94,7 +105,7 @@
width: "480",
height: "500",
url: ctx + "busi/order/selectOrder/" + status,
callBack: function(index, layero){
callBack: function(index){
var body = $.modal.getChildFrame(index);
$("#treeId").val(body.find('#treeId').val());
$("#treeName").val(body.find('#treeName').val());
@ -131,8 +142,9 @@
$("#color").empty().append("<option value=''>请选择颜色</option>");
for (var i = 0; i < data.length; i++) {
var val = data[i].colorCode;
var text = $.table.getDictText(colorDatas, val);;
$("#color").append("<option value='" + val + "'>" + text + "</option>");
var text = $.table.getDictText(colorDatas, val);
var unit = data[i].unit;
$("#color").append("<option unit='" + unit + "'value='" + val + "'>" + text + "</option>");
}
})
}

View File

@ -6,7 +6,7 @@
<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" th:value=="${operType}">
<input name="oprateType" type="hidden" th:value="${operType}">
<div class="form-group">
<label class="col-sm-3 control-label is-required">订单:</label>
<div class="col-sm-8">
@ -33,11 +33,13 @@
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">数量:</label>
<div class="col-sm-8">
<input name="amount" class="form-control" type="text" required>
<label class="col-sm-3 control-label is-required" title="系统会自动根据每件需求量,计算扣减库存量">数量(件):<i class="fa fa-question-circle-o"></i></label>
<div class="col-sm-4">
<input id="amount" name="amount" type="hidden">
<input id="amountPiece" class="form-control number" type="text" required>
</div>
<!-- <label class="control-label text-danger">库存量:<span id="requireAmount" class=""> &#45;&#45; </span></label>-->
<label class="col-sm-2 text-danger">单件需求量:<span id="requireAmount" class=""> -- </span></label>
<label class="col-sm-2 text-danger">库存扣减量:<span id="totalAmount" class=""> -- </span></label>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">备注信息:</label>
@ -79,9 +81,26 @@
queryColorList($("#product").val(), $("#classify").val());
})
$("#color").change(function(){
$("#requireAmount").empty().append($("#color :selected").attr("amount"));
cacuTotal();
})
$("#amountPiece").keyup(function(){
cacuTotal();
});
function cacuTotal(){
var total = $("#amountPiece").val() * $("#requireAmount").text();
$("#totalAmount").empty().append(total.toFixed(2));
$("#amount").val(total.toFixed(2));
}
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-materialperate-add').serialize());
$.operate.save(prefix + "/add", $('#form-materialperate-add').serialize(), {}, function(){
$.modal.alertSuccess("保存成功");
});
}
}
@ -92,7 +111,7 @@
width: "480",
height: "500",
url: ctx + "busi/order/selectOrder/" + status,
callBack: function(index, layero){
callBack: function(index){
var body = $.modal.getChildFrame(index);
$("#treeId").val(body.find('#treeId').val());
$("#treeName").val(body.find('#treeName').val());
@ -144,15 +163,12 @@
$("#color").empty().append("<option value=''>请选择颜色</option>");
for (var i = 0; i < data.length; i++) {
var val = data[i].colorCode;
var amount = data[i].amount;
var text = $.table.getDictText(colorDatas, val);
$("#color").append("<option value='" + val + "'>" + text + "</option>");
$("#color").append("<option amount='" + amount + "' value='" + val + "'>" + text + "</option>");
}
})
}
$(function(){
console.log(parent.document);
})
</script>
</body>
</html>