Browse Source

为移动端扫码查看库存页面添加出入库选项

lwx_dev
erdanergou 2 years ago
parent
commit
5bd553c2d2
  1. 49
      src/main/java/com/dreamchaser/depository_manage/controller/MaterialController.java
  2. 9
      src/main/resources/templates/pages/application/application-in_temporaryValue.html
  3. 138
      src/main/resources/templates/pages/showInventory/showInventoryForLocation.html
  4. 9
      target/classes/templates/pages/application/application-in_temporaryValue.html
  5. 138
      target/classes/templates/pages/showInventory/showInventoryForLocation.html

49
src/main/java/com/dreamchaser/depository_manage/controller/MaterialController.java

@ -766,28 +766,32 @@ public class MaterialController {
String type = map.get("type").toString();
String key = "WMS_temporaryValue_" + type + userByPort.getNumber();
List<String> range = redisPool.getRedisTemplateByDb(15).opsForList().range(key, 0, -1);
List<Inventory> result = new ArrayList<>();
if (range != null && range.size() > 0) {
for (String value :
range) {
if ("".equals(value)) {
continue;
if (!map.containsKey("simple")) {
List<Inventory> result = new ArrayList<>();
if (range != null && range.size() > 0) {
for (String value :
range) {
if ("".equals(value)) {
continue;
}
// 获取当前用户可见的仓库
List<Depository> depositoryList = new ArrayList<>();
Inventory inventoryById = materialService.findInventoryById(ObjectFormatUtil.toInteger(value));
Depository depository = new Depository();
depository.setId(inventoryById.getDepositoryId());
depository.setDname(inventoryById.getDepositoryName());
depositoryList.add(depository);
List<SplitInfo> splitInfoByMid = splitUnitService.findSplitInfoByMid(inventoryById.getMid());
inventoryById.setSplitInfoList(splitInfoByMid);
inventoryById.setDepositoryList(depositoryList);
result.add(inventoryById);
}
// 获取当前用户可见的仓库
List<Depository> depositoryList = new ArrayList<>();
Inventory inventoryById = materialService.findInventoryById(ObjectFormatUtil.toInteger(value));
Depository depository = new Depository();
depository.setId(inventoryById.getDepositoryId());
depository.setDname(inventoryById.getDepositoryName());
depositoryList.add(depository);
List<SplitInfo> splitInfoByMid = splitUnitService.findSplitInfoByMid(inventoryById.getMid());
inventoryById.setSplitInfoList(splitInfoByMid);
inventoryById.setDepositoryList(depositoryList);
result.add(inventoryById);
}
return new RestResponse(result);
} else {
return new RestResponse(range);
}
return new RestResponse(result);
} else {
return CrudUtil.insertHandle(-1, 0);
}
@ -831,7 +835,7 @@ public class MaterialController {
@PostMapping("/delTemporaryValue")
public void delTemporaryValue(@RequestBody Map<String, Object> map, HttpServletRequest request) {
public RestResponse delTemporaryValue(@RequestBody Map<String, Object> map, HttpServletRequest request) {
String token = request.getHeader("user-token");
if (token == null) {
token = (String) request.getSession().getAttribute("userToken");
@ -841,7 +845,10 @@ public class MaterialController {
String s = map.get("id").toString();
String type = map.get("type").toString();
redisPool.getRedisTemplateByDb(15).opsForList().remove("WMS_temporaryValue_" + type + userByPort.getNumber(), 0, s);
Long size = redisPool.getRedisTemplateByDb(15).opsForList().size("WMS_temporaryValue_" + type + userByPort.getNumber());
return new RestResponse(size);
} else {
throw new MyException("缺少必要参数,不进行删除");
}
}

9
src/main/resources/templates/pages/application/application-in_temporaryValue.html

@ -490,6 +490,15 @@
$("#stepForm").css("height", height - 520 + 'px');
params = remove(params, parentId);
reparent.removeChild(parent);
let value = parent.childNodes[5].childNodes[3].childNodes[3].value;
$.ajax({
url: "/material/delTemporaryValue",
type: 'post',
data: JSON.stringify({"id": value, "type": "In"}),
dataType: 'json',
contentType: "application/json;charset=utf-8"
})
};

138
src/main/resources/templates/pages/showInventory/showInventoryForLocation.html

@ -43,6 +43,15 @@
.lay-step {
display: none;
}
#chooseBusinessType {
position: fixed;
width: 400px;
bottom: 20px;
left: 0;
right: 0;
margin: auto;
}
</style>
</head>
<body>
@ -72,6 +81,17 @@
</div>
</form>
<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>
</div>
</div>
</div>
</div>
@ -89,12 +109,20 @@
}
function applicationIn() {
}
function applicationOut() {
}
var depositoryId = "-1";
var placeId = "0";
layui.use(['form', 'step', 'flow', 'inputTag'], function () {
layui.use(['form', 'step', 'flow', 'miniTab'], function () {
var $ = layui.$,
inputTag = layui.inputTag,
miniTab = layui.miniTab,
flow = layui.flow,
dropdown = layui.dropdown, //下拉菜单
step = layui.step;
@ -103,6 +131,8 @@
let takingPre = 0;
let size = 8;
let chooseIdList = [];
$(function () {
let loading2 = layer.open({type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
$.ajax({
@ -138,6 +168,16 @@
}
}
});
$.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);
});
@ -179,8 +219,10 @@
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" onclick="showDetail(' + resultElement.iid + ')">' +
'<div class="layui-card-header"><h2>' + "物料名称:" + resultElement.mname + '</h2></div>');
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" style="height: 100%;line-height: normal">' +
'<input id=' + resultElement.iid + ' type="checkbox" style="position: absolute;right: 1%;height: 100%;width: 20px" onchange="chooseBusiness(this)" lay-skin="tag">' +
'<h2>' + "物料名称:" + resultElement.mname + '</h2></div>');
lis.push('<div class="layui-col-md4 my-info" style="margin-left: 15px; color: #999;font-size: 15px;">'
+ '<p>' + "物料编码:" + resultElement.mcode + '</p>'
+ '<p>' + "物料型号:" + resultElement.version + '</p>'
@ -194,26 +236,90 @@
//执行下一页渲染,第二参数为:满足“加载更多”的条件,即后面仍有分页
//pages为Ajax返回的总页数,只有当前页小于总页数的情况下,才会继续出现加载更多
next(lis.join(''), takingPre < res.count);
checkedInputCheck()
}
})
}
});
};
showDetail = function (obj) {
var index = layer.open({
title: '库存信息详情',
type: 2,
shade: 0.2,
maxmin: true,
shadeClose: true,
area: ['100%', '100%'],
content: '/InventoryView?id=' + obj,
chooseBusiness = function (obj) {
// 获取当前点击结果
let checked = $(obj).prop("checked");
// 获取要处理的id
let id = $(obj).attr("id");
if (checked) {
// 保存出入库id到redis中
$.ajax({
url: "/material/temporaryValue",
type: "post",
dataType: 'json',
data: JSON.stringify({"id": id, "type": "Out"}),
contentType: "application/json;charset=utf-8",
});
$.ajax({
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();
}
}
});
$.ajax({
url: "/material/delTemporaryValue",
type: 'post',
data: JSON.stringify({"id": id, "type": "In"}),
dataType: 'json',
contentType: "application/json;charset=utf-8"
})
}
return false;
};
applicationIn = function(){
miniTab.openNewTabByIframeNew({
href: "/application_In_temporaryValue",
title: "入库申请"
});
$(window).on("resize", function () {
layer.full(index);
};
applicationOut = function () {
miniTab.openNewTabByIframeNew({
href: "/application_Out_temporaryValue",
title: "出库申请"
});
return false;
}
checkedInputCheck = function () {
if(chooseIdList.length > 0){
for (const checkedId of chooseIdList) {
$("#"+checkedId).attr("checked","checked");
}
$("#chooseBusinessType").show();
}
}
})

9
target/classes/templates/pages/application/application-in_temporaryValue.html

@ -490,6 +490,15 @@
$("#stepForm").css("height", height - 520 + 'px');
params = remove(params, parentId);
reparent.removeChild(parent);
let value = parent.childNodes[5].childNodes[3].childNodes[3].value;
$.ajax({
url: "/material/delTemporaryValue",
type: 'post',
data: JSON.stringify({"id": value, "type": "In"}),
dataType: 'json',
contentType: "application/json;charset=utf-8"
})
};

138
target/classes/templates/pages/showInventory/showInventoryForLocation.html

@ -43,6 +43,15 @@
.lay-step {
display: none;
}
#chooseBusinessType {
position: fixed;
width: 400px;
bottom: 20px;
left: 0;
right: 0;
margin: auto;
}
</style>
</head>
<body>
@ -72,6 +81,17 @@
</div>
</form>
<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>
</div>
</div>
</div>
</div>
@ -89,12 +109,20 @@
}
function applicationIn() {
}
function applicationOut() {
}
var depositoryId = "-1";
var placeId = "0";
layui.use(['form', 'step', 'flow', 'inputTag'], function () {
layui.use(['form', 'step', 'flow', 'miniTab'], function () {
var $ = layui.$,
inputTag = layui.inputTag,
miniTab = layui.miniTab,
flow = layui.flow,
dropdown = layui.dropdown, //下拉菜单
step = layui.step;
@ -103,6 +131,8 @@
let takingPre = 0;
let size = 8;
let chooseIdList = [];
$(function () {
let loading2 = layer.open({type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
$.ajax({
@ -138,6 +168,16 @@
}
}
});
$.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);
});
@ -179,8 +219,10 @@
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" onclick="showDetail(' + resultElement.iid + ')">' +
'<div class="layui-card-header"><h2>' + "物料名称:" + resultElement.mname + '</h2></div>');
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" style="height: 100%;line-height: normal">' +
'<input id=' + resultElement.iid + ' type="checkbox" style="position: absolute;right: 1%;height: 100%;width: 20px" onchange="chooseBusiness(this)" lay-skin="tag">' +
'<h2>' + "物料名称:" + resultElement.mname + '</h2></div>');
lis.push('<div class="layui-col-md4 my-info" style="margin-left: 15px; color: #999;font-size: 15px;">'
+ '<p>' + "物料编码:" + resultElement.mcode + '</p>'
+ '<p>' + "物料型号:" + resultElement.version + '</p>'
@ -194,26 +236,90 @@
//执行下一页渲染,第二参数为:满足“加载更多”的条件,即后面仍有分页
//pages为Ajax返回的总页数,只有当前页小于总页数的情况下,才会继续出现加载更多
next(lis.join(''), takingPre < res.count);
checkedInputCheck()
}
})
}
});
};
showDetail = function (obj) {
var index = layer.open({
title: '库存信息详情',
type: 2,
shade: 0.2,
maxmin: true,
shadeClose: true,
area: ['100%', '100%'],
content: '/InventoryView?id=' + obj,
chooseBusiness = function (obj) {
// 获取当前点击结果
let checked = $(obj).prop("checked");
// 获取要处理的id
let id = $(obj).attr("id");
if (checked) {
// 保存出入库id到redis中
$.ajax({
url: "/material/temporaryValue",
type: "post",
dataType: 'json',
data: JSON.stringify({"id": id, "type": "Out"}),
contentType: "application/json;charset=utf-8",
});
$.ajax({
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();
}
}
});
$.ajax({
url: "/material/delTemporaryValue",
type: 'post',
data: JSON.stringify({"id": id, "type": "In"}),
dataType: 'json',
contentType: "application/json;charset=utf-8"
})
}
return false;
};
applicationIn = function(){
miniTab.openNewTabByIframeNew({
href: "/application_In_temporaryValue",
title: "入库申请"
});
$(window).on("resize", function () {
layer.full(index);
};
applicationOut = function () {
miniTab.openNewTabByIframeNew({
href: "/application_Out_temporaryValue",
title: "出库申请"
});
return false;
}
checkedInputCheck = function () {
if(chooseIdList.length > 0){
for (const checkedId of chooseIdList) {
$("#"+checkedId).attr("checked","checked");
}
$("#chooseBusinessType").show();
}
}
})

Loading…
Cancel
Save