|
|
@ -107,7 +107,21 @@ |
|
|
</form> |
|
|
</form> |
|
|
|
|
|
|
|
|
<ul class="flow-default" id="LAY_InventoryShow"></ul> |
|
|
<ul class="flow-default" id="LAY_InventoryShow"></ul> |
|
|
|
|
|
<div class="layui-form-item " id="chooseBusinessType" style="display: none"> |
|
|
|
|
|
<div class="layui-input-block"> |
|
|
|
|
|
<button class="layui-btn layui-btn-customize" type="button" |
|
|
|
|
|
onclick="applicationIn()">入库申请 |
|
|
|
|
|
</button> |
|
|
|
|
|
|
|
|
|
|
|
<button class="layui-btn layui-btn-customize" type="button" |
|
|
|
|
|
onclick="applicationOut()">出库申请 |
|
|
|
|
|
</button> |
|
|
|
|
|
|
|
|
|
|
|
<button class="layui-btn layui-btn-customize" type="button" th:style="'display:'+${display}" |
|
|
|
|
|
onclick="applicationImmediateOut()">直接出库申请 |
|
|
|
|
|
</button> |
|
|
|
|
|
</div> |
|
|
|
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
</div> |
|
|
|
|
|
|
|
|
@ -126,16 +140,15 @@ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
layui.use(['form', 'step', 'flow', 'inputTag'], function () { |
|
|
layui.use(['form', 'step', 'flow', 'miniTab'], function () { |
|
|
var $ = layui.$, |
|
|
var $ = layui.$, |
|
|
inputTag = layui.inputTag, |
|
|
miniTab = layui.miniTab, //下拉菜单 |
|
|
dropdown = layui.dropdown, //下拉菜单 |
|
|
|
|
|
flow = layui.flow; |
|
|
flow = layui.flow; |
|
|
let id = $("#id").val(); |
|
|
let id = $("#id").val(); |
|
|
|
|
|
|
|
|
let takingPre = 0; |
|
|
let takingPre = 0; |
|
|
let size = 8; |
|
|
let size = 8; |
|
|
|
|
|
let chooseIdList = []; |
|
|
$(function () { |
|
|
$(function () { |
|
|
let loading2 = layer.open({type: 3, shade: [0.25, '#000'], icon: 2, speed: 0}); |
|
|
let loading2 = layer.open({type: 3, shade: [0.25, '#000'], icon: 2, speed: 0}); |
|
|
$.ajax({ |
|
|
$.ajax({ |
|
|
@ -156,6 +169,7 @@ |
|
|
parent.layer.close(index); |
|
|
parent.layer.close(index); |
|
|
}) |
|
|
}) |
|
|
} else { |
|
|
} else { |
|
|
|
|
|
updateFlowShowForMaterial(); |
|
|
$("#mname").val(material.mname); |
|
|
$("#mname").val(material.mname); |
|
|
$("#mcode").val(material.code); |
|
|
$("#mcode").val(material.code); |
|
|
$("#version").val(material.version); |
|
|
$("#version").val(material.version); |
|
|
@ -165,43 +179,154 @@ |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
$.ajax({ |
|
|
|
|
|
url: "/material/getTemporaryValue", |
|
|
|
|
|
type: "post", |
|
|
|
|
|
dataType: 'json', |
|
|
|
|
|
data: JSON.stringify({"type": "Out","simple":"true"}), |
|
|
|
|
|
contentType: "application/json;charset=utf-8", |
|
|
|
|
|
success: function (res) { |
|
|
|
|
|
chooseIdList = res.data; |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
layer.close(loading2); |
|
|
layer.close(loading2); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
updateFlowShowForMaterial = function() { |
|
|
|
|
|
flow.load({ |
|
|
|
|
|
elem: '#LAY_InventoryShow' //流加载容器 |
|
|
|
|
|
, done: function (page, next) { //执行下一页的回调 |
|
|
|
|
|
let result; |
|
|
|
|
|
let lis = []; |
|
|
|
|
|
$.get('/material/findMaterialByConditionForStockTaking?page=' + page + '&size=' + size + '&mid=' + id, function (res) { |
|
|
|
|
|
result = res.data; |
|
|
|
|
|
if (result === null || result === undefined) { |
|
|
|
|
|
result = []; |
|
|
|
|
|
} |
|
|
|
|
|
lis.push("<div class='clearfix'>"); |
|
|
|
|
|
for (let i = 0; i < result.length; i++) { |
|
|
|
|
|
let resultElement = result[i]; |
|
|
|
|
|
let splitInventory = resultElement.splitInventory; |
|
|
|
|
|
let keys = Object.keys(splitInventory); |
|
|
|
|
|
let InventoryItem = ""; |
|
|
|
|
|
for (let j = 0; j < keys.length; j++) { |
|
|
|
|
|
let key = keys[j]; |
|
|
|
|
|
let item = '<p>' + "计量单位:" + key + ";对应库存:" + splitInventory[key] + '</p>'; |
|
|
|
|
|
InventoryItem += item; |
|
|
|
|
|
} |
|
|
|
|
|
lis.push('<li style="width:100%;margin-top: 10px;float:left;border: 1px solid #9999996e;">' + |
|
|
|
|
|
'<div class="layui-card my-shadow my-card flow1"><div class="layui-card-header">' + |
|
|
|
|
|
'<input id=' + resultElement.iid + ' type="checkbox" style="position: absolute;right: 1%;height: 100%;width: 20px" onchange="chooseBusiness(this)" lay-skin="tag">' + |
|
|
|
|
|
'<h2>' + "所处位置:" + resultElement.dname + "-" + resultElement.kingdeecode + '</h2></div>'); |
|
|
|
|
|
lis.push('<div class="layui-col-md4 my-info" style="margin-left: 15px; color: #999;font-size: 15px;">' |
|
|
|
|
|
+ InventoryItem |
|
|
|
|
|
+ '</div></div></li>'); |
|
|
|
|
|
} |
|
|
|
|
|
lis.push('</div>'); |
|
|
|
|
|
takingPre += result.length; |
|
|
|
|
|
//执行下一页渲染,第二参数为:满足“加载更多”的条件,即后面仍有分页 |
|
|
|
|
|
//pages为Ajax返回的总页数,只有当前页小于总页数的情况下,才会继续出现加载更多 |
|
|
|
|
|
next(lis.join(''), takingPre < res.count); |
|
|
|
|
|
checkedInputCheck(); |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
flow.load({ |
|
|
chooseBusiness = function (obj) { |
|
|
elem: '#LAY_InventoryShow' //流加载容器 |
|
|
// 获取当前点击结果 |
|
|
, done: function (page, next) { //执行下一页的回调 |
|
|
let checked = $(obj).prop("checked"); |
|
|
let result; |
|
|
// 获取要处理的id |
|
|
let lis = []; |
|
|
let id = $(obj).attr("id"); |
|
|
$.get('/material/findMaterialByConditionForStockTaking?page=' + page + '&size=' + size + '&mid=' + id, function (res) { |
|
|
if (checked) { |
|
|
result = res.data; |
|
|
// 保存出入库id到redis中 |
|
|
lis.push("<div class='clearfix'>"); |
|
|
$.ajax({ |
|
|
for (let i = 0; i < result.length; i++) { |
|
|
url: "/material/temporaryValue", |
|
|
let splitInventory = result[i].splitInventory; |
|
|
type: "post", |
|
|
let keys = Object.keys(splitInventory); |
|
|
dataType: 'json', |
|
|
let InventoryItem = ""; |
|
|
data: JSON.stringify({"id": id, "type": "Out"}), |
|
|
for (let j = 0; j < keys.length; j++) { |
|
|
contentType: "application/json;charset=utf-8", |
|
|
let key = keys[j]; |
|
|
}); |
|
|
let item = '<p>' + "计量单位:" + key + ";对应库存:" + splitInventory[key] + '</p>'; |
|
|
$.ajax({ |
|
|
InventoryItem += item; |
|
|
url: "/material/temporaryValue", |
|
|
|
|
|
type: "post", |
|
|
|
|
|
dataType: 'json', |
|
|
|
|
|
data: JSON.stringify({"id": id, "type": "In"}), |
|
|
|
|
|
contentType: "application/json;charset=utf-8", |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
$("#chooseBusinessType").show(); |
|
|
|
|
|
} else { |
|
|
|
|
|
// 删除保存redis中的出入库id |
|
|
|
|
|
$.ajax({ |
|
|
|
|
|
url: "/material/delTemporaryValue", |
|
|
|
|
|
type: 'post', |
|
|
|
|
|
data: JSON.stringify({"id": id, "type": "Out"}), |
|
|
|
|
|
dataType: 'json', |
|
|
|
|
|
contentType: "application/json;charset=utf-8", |
|
|
|
|
|
success: function (res) { |
|
|
|
|
|
let data = res.data; |
|
|
|
|
|
if (data === 0) { |
|
|
|
|
|
$("#chooseBusinessType").hide(); |
|
|
} |
|
|
} |
|
|
lis.push('<li style="width:100%;margin-top: 10px;float:left;border: 1px solid #9999996e;"><div class="layui-card my-shadow my-card flow1"><div class="layui-card-header"><h2>' + "所处位置:" + result[i].dname+"-"+result[i].kingdeecode + '</h2></div>'); |
|
|
|
|
|
lis.push('<div class="layui-col-md4 my-info" style="margin-left: 15px; color: #999;font-size: 15px;">' |
|
|
|
|
|
+ InventoryItem |
|
|
|
|
|
+ '</div></div></li>'); |
|
|
|
|
|
} |
|
|
} |
|
|
lis.push('</div>'); |
|
|
|
|
|
takingPre += result.length; |
|
|
|
|
|
//执行下一页渲染,第二参数为:满足“加载更多”的条件,即后面仍有分页 |
|
|
|
|
|
//pages为Ajax返回的总页数,只有当前页小于总页数的情况下,才会继续出现加载更多 |
|
|
|
|
|
next(lis.join(''), takingPre < res.count); |
|
|
|
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
$.ajax({ |
|
|
|
|
|
url: "/material/delTemporaryValue", |
|
|
|
|
|
type: 'post', |
|
|
|
|
|
data: JSON.stringify({"id": id, "type": "In"}), |
|
|
|
|
|
dataType: 'json', |
|
|
|
|
|
contentType: "application/json;charset=utf-8" |
|
|
|
|
|
}) |
|
|
} |
|
|
} |
|
|
}); |
|
|
return false; |
|
|
$('body').on('click', '[data-refresh]', function () { |
|
|
}; |
|
|
location.reload(); |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 用于跳转导入库页面 |
|
|
|
|
|
*/ |
|
|
|
|
|
applicationIn = function(){ |
|
|
|
|
|
miniTab.openNewTabByIframeNew({ |
|
|
|
|
|
href: "/application_In_temporaryValue", |
|
|
|
|
|
title: "入库申请" |
|
|
|
|
|
}); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 用于跳转到出库页面 |
|
|
|
|
|
*/ |
|
|
|
|
|
applicationOut = function () { |
|
|
|
|
|
miniTab.openNewTabByIframeNew({ |
|
|
|
|
|
href: "/application_Out_temporaryValue", |
|
|
|
|
|
title: "出库申请" |
|
|
|
|
|
}); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 用于跳转到直接出库页面 |
|
|
|
|
|
*/ |
|
|
|
|
|
applicationImmediateOut = function () { |
|
|
|
|
|
miniTab.openNewTabByIframeNew({ |
|
|
|
|
|
href: "/application_Immediate_Out_temporaryValue", |
|
|
|
|
|
title: "出库申请" |
|
|
|
|
|
}); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 用于选择选择框 |
|
|
|
|
|
*/ |
|
|
|
|
|
checkedInputCheck = function () { |
|
|
|
|
|
if(chooseIdList.length > 0){ |
|
|
|
|
|
for (const checkedId of chooseIdList) { |
|
|
|
|
|
$("#"+checkedId).attr("checked","checked"); |
|
|
|
|
|
} |
|
|
|
|
|
$("#chooseBusinessType").show(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
}) |
|
|
}) |
|
|
</script> |
|
|
</script> |
|
|
|