Browse Source

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

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

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

@ -766,8 +766,8 @@ public class MaterialController {
String type = map.get("type").toString(); String type = map.get("type").toString();
String key = "WMS_temporaryValue_" + type + userByPort.getNumber(); String key = "WMS_temporaryValue_" + type + userByPort.getNumber();
List<String> range = redisPool.getRedisTemplateByDb(15).opsForList().range(key, 0, -1); List<String> range = redisPool.getRedisTemplateByDb(15).opsForList().range(key, 0, -1);
if (!map.containsKey("simple")) {
List<Inventory> result = new ArrayList<>(); List<Inventory> result = new ArrayList<>();
if (range != null && range.size() > 0) { if (range != null && range.size() > 0) {
for (String value : for (String value :
range) { range) {
@ -788,6 +788,10 @@ public class MaterialController {
} }
} }
return new RestResponse(result); return new RestResponse(result);
} else {
return new RestResponse(range);
}
} else { } else {
return CrudUtil.insertHandle(-1, 0); return CrudUtil.insertHandle(-1, 0);
} }
@ -831,7 +835,7 @@ public class MaterialController {
@PostMapping("/delTemporaryValue") @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"); String token = request.getHeader("user-token");
if (token == null) { if (token == null) {
token = (String) request.getSession().getAttribute("userToken"); token = (String) request.getSession().getAttribute("userToken");
@ -841,7 +845,10 @@ public class MaterialController {
String s = map.get("id").toString(); String s = map.get("id").toString();
String type = map.get("type").toString(); String type = map.get("type").toString();
redisPool.getRedisTemplateByDb(15).opsForList().remove("WMS_temporaryValue_" + type + userByPort.getNumber(), 0, s); 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'); $("#stepForm").css("height", height - 520 + 'px');
params = remove(params, parentId); params = remove(params, parentId);
reparent.removeChild(parent); 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"
})
}; };

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

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

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

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

Loading…
Cancel
Save