Browse Source

修改移动端库存查询跳转到入库申请页面

lwx_dev
erdanergou 3 years ago
parent
commit
d4b1d85440
  1. 39
      src/main/java/com/dreamchaser/depository_manage/controller/MaterialController.java
  2. 25
      src/main/java/com/dreamchaser/depository_manage/controller/PageController.java
  3. 16
      src/main/resources/templates/pages/application/application-in_temporaryValue.html
  4. 14
      src/main/resources/templates/pages/application/application-out_temporaryValue.html
  5. 14
      src/main/resources/templates/pages/applicationForStorageCenter/application-out_temporaryValue.html

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

@ -651,12 +651,12 @@ public class MaterialController {
if (map.containsKey("id")) { if (map.containsKey("id")) {
String s = map.get("id").toString(); String s = map.get("id").toString();
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 = redisTemplate.opsForList().range(key, 0, -1); List<String> range = redisTemplate.opsForList().range(key, 0, -1);
if (range != null) { if (range != null) {
if (!range.contains(s)) { if (!range.contains(s)) {
redisTemplate.opsForList().rightPush(key,s); redisTemplate.opsForList().rightPush(key, s);
redisTemplate.expire(key,DateUtil.getSecondsNextEarlyMorning(), TimeUnit.SECONDS); redisTemplate.expire(key, DateUtil.getSecondsNextEarlyMorning(), TimeUnit.SECONDS);
} }
} }
return new RestResponse(); return new RestResponse();
@ -665,6 +665,37 @@ public class MaterialController {
} }
} }
@PostMapping("/getTemporaryValue")
public RestResponse getTemporaryValue(@RequestBody Map<String, Object> map, HttpServletRequest request) {
String token = request.getHeader("user-token");
if (token == null) {
token = (String) request.getSession().getAttribute("userToken");
}
UserByPort userByPort = AuthenticationTokenPool.getUserToken(token);
if (map.containsKey("type")) {
String type = map.get("type").toString();
String key = "WMS_temporaryValue_" + type + userByPort.getNumber();
List<String> range = redisTemplate.opsForList().range(key, 0, -1);
List<Inventory> result = new ArrayList<>();
if (range != null && range.size() > 0) {
for (String value :
range) {
if ("".equals(value)) {
continue;
}
Inventory inventoryById = materialService.findInventoryById(ObjectFormatUtil.toInteger(value));
List<SplitInfo> splitInfoByMid = splitUnitService.findSplitInfoByMid(inventoryById.getMid());
inventoryById.setSplitInfoList(splitInfoByMid);
result.add(inventoryById);
}
}
return new RestResponse(result);
} else {
return CrudUtil.insertHandle(-1, 0);
}
}
@PostMapping("/delTemporaryValue") @PostMapping("/delTemporaryValue")
public void delTemporaryValue(@RequestBody Map<String, Object> map, HttpServletRequest request) { public void delTemporaryValue(@RequestBody Map<String, Object> map, HttpServletRequest request) {
String token = request.getHeader("user-token"); String token = request.getHeader("user-token");
@ -675,7 +706,7 @@ public class MaterialController {
if (map.containsKey("id")) { if (map.containsKey("id")) {
String s = map.get("id").toString(); String s = map.get("id").toString();
String type = map.get("type").toString(); String type = map.get("type").toString();
redisTemplate.opsForList().remove("WMS_temporaryValue_"+type + userByPort.getNumber(), 0, s); redisTemplate.opsForList().remove("WMS_temporaryValue_" + type + userByPort.getNumber(), 0, s);
} }
} }

25
src/main/java/com/dreamchaser/depository_manage/controller/PageController.java

@ -2752,18 +2752,6 @@ public class PageController {
// 获取当前key值存储在redis中的值 // 获取当前key值存储在redis中的值
List<String> range = redisTemplateForHash.opsForList().range("WMS_temporaryValue_In" + userByPort.getNumber(), 0, -1); List<String> range = redisTemplateForHash.opsForList().range("WMS_temporaryValue_In" + userByPort.getNumber(), 0, -1);
if( range != null && range.size() > 0){ if( range != null && range.size() > 0){
List<Inventory> result = new ArrayList<>();
for (String value:
range ) {
if("".equals(value)){
continue;
}
Inventory inventoryById = materialService.findInventoryById(ObjectFormatUtil.toInteger(value));
List<SplitInfo> splitInfoByMid = splitUnitService.findSplitInfoByMid(inventoryById.getMid());
inventoryById.setSplitInfoList(splitInfoByMid);
result.add(inventoryById);
}
mv.addObject("inventoryList", JSONObject.toJSONString(result));
mv.setViewName("pages/application/application-in_temporaryValue"); mv.setViewName("pages/application/application-in_temporaryValue");
}else{ }else{
mv.setViewName("pages/application/application-in"); mv.setViewName("pages/application/application-in");
@ -2819,19 +2807,6 @@ public class PageController {
UserByPort userToken = AuthenticationTokenPool.getUserToken(token); UserByPort userToken = AuthenticationTokenPool.getUserToken(token);
List<String> range = redisTemplateForHash.boundListOps("WMS_temporaryValue_Out" + userToken.getNumber()).range(0, -1); List<String> range = redisTemplateForHash.boundListOps("WMS_temporaryValue_Out" + userToken.getNumber()).range(0, -1);
if (range != null && range.size() > 0) { if (range != null && range.size() > 0) {
List<Inventory> result = new ArrayList<>();
for (String value : range
) {
if ("".equals(value)) {
continue;
}
Inventory inventoryById = materialService.findInventoryById(ObjectFormatUtil.toInteger(value));
List<SplitInfo> splitInfoByMid = splitUnitService.findSplitInfoByMid(inventoryById.getMid());
inventoryById.setSplitInfoList(splitInfoByMid);
result.add(inventoryById);
}
mv.addObject("inventoryList", JSONObject.toJSONString(result));
mv.setViewName("pages/application/application-out_temporaryValue"); mv.setViewName("pages/application/application-out_temporaryValue");
Integer role = userToken.getIsadmin(); Integer role = userToken.getIsadmin();
if (role == null) { if (role == null) {

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

@ -46,7 +46,6 @@
<div class="layui-fluid"> <div class="layui-fluid">
<!-- 入库申请提交--> <!-- 入库申请提交-->
<div class="layui-carousel" id="stepForm" lay-filter="stepForm" style="margin: 0 auto; "> <div class="layui-carousel" id="stepForm" lay-filter="stepForm" style="margin: 0 auto; ">
<input th:value="${inventoryList}" style="display:none;" id="temporaryValue">
<div carousel-item style="overflow: inherit"> <div carousel-item style="overflow: inherit">
<div> <div>
<form class="layui-form layui-form-pane" <form class="layui-form layui-form-pane"
@ -142,16 +141,27 @@
form = layui.form, form = layui.form,
flow = layui.flow, flow = layui.flow,
step = layui.step; step = layui.step;
let scanValue = {};
// 页面初始化 // 页面初始化
$(function () { $(function () {
let inventoryList = JSON.parse($("#temporaryValue").val()); let loading2 = layer.open({type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
$.ajax({
url:"/material/getTemporaryValue",
type: "post",
dataType: 'json',
data:JSON.stringify({"type":"In"}) ,
contentType: "application/json;charset=utf-8",
success: function (res) {
let inventoryList = res.data;
if (inventoryList.length > 0) { if (inventoryList.length > 0) {
for (let i = 0; i < inventoryList.length; i++) { for (let i = 0; i < inventoryList.length; i++) {
initForm(i, inventoryList[i]); initForm(i, inventoryList[i]);
form.render() form.render()
} }
} }
layer.close(loading2);
}
})
}); });

14
src/main/resources/templates/pages/application/application-out_temporaryValue.html

@ -39,7 +39,6 @@
<div class="layui-fluid"> <div class="layui-fluid">
<!-- 出库申请--> <!-- 出库申请-->
<div class="layui-carousel" id="stepForm" lay-filter="stepForm" style="margin: 0 auto;"> <div class="layui-carousel" id="stepForm" lay-filter="stepForm" style="margin: 0 auto;">
<input th:value="${inventoryList}" style="display: none" id="temporaryValue">
<div carousel-item style="overflow: inherit"> <div carousel-item style="overflow: inherit">
<div> <div>
<form class="layui-form layui-form-pane" style="margin: 0 auto;max-width: 460px;"> <form class="layui-form layui-form-pane" style="margin: 0 auto;max-width: 460px;">
@ -133,10 +132,21 @@
let temporaryValue = []; // 用于暂存扫描得到的结果 let temporaryValue = []; // 用于暂存扫描得到的结果
// 页面初始化 // 页面初始化
$(function () { $(function () {
temporaryValue = JSON.parse($("#temporaryValue").val()); let loading2 = layer.open({type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
$.ajax({
url: "/material/getTemporaryValue",
type: "post",
dataType: 'json',
data: JSON.stringify({"type": "Out"}),
contentType: "application/json;charset=utf-8",
success: function (res) {
let temporaryValue = res.data;
for (let i = 0; i < temporaryValue.length; i++) { for (let i = 0; i < temporaryValue.length; i++) {
initForm(i, temporaryValue[i]); initForm(i, temporaryValue[i]);
} }
layer.close(loading2);
}
})
}); });

14
src/main/resources/templates/pages/applicationForStorageCenter/application-out_temporaryValue.html

@ -39,7 +39,6 @@
<div class="layui-fluid"> <div class="layui-fluid">
<!-- 出库申请--> <!-- 出库申请-->
<div class="layui-carousel" id="stepForm" lay-filter="stepForm" style="margin: 0 auto;"> <div class="layui-carousel" id="stepForm" lay-filter="stepForm" style="margin: 0 auto;">
<input th:value="${inventoryList}" style="display: none" id="temporaryValue">
<div carousel-item style="overflow: inherit"> <div carousel-item style="overflow: inherit">
<div> <div>
<form class="layui-form layui-form-pane" style="margin: 0 auto;max-width: 460px;"> <form class="layui-form layui-form-pane" style="margin: 0 auto;max-width: 460px;">
@ -181,10 +180,21 @@
let temporaryValue = []; // 用于暂存扫描得到的结果 let temporaryValue = []; // 用于暂存扫描得到的结果
// 页面初始化 // 页面初始化
$(function () { $(function () {
temporaryValue = JSON.parse($("#temporaryValue").val()); let loading2 = layer.open({type: 3, shade: [0.25, '#000'], icon: 2, speed: 0});
$.ajax({
url: "/material/getTemporaryValue",
type: "post",
dataType: 'json',
data: JSON.stringify({"type": "Out"}),
contentType: "application/json;charset=utf-8",
success: function (res) {
let temporaryValue = res.data;
for (let i = 0; i < temporaryValue.length; i++) { for (let i = 0; i < temporaryValue.length; i++) {
initForm(i, temporaryValue[i]); initForm(i, temporaryValue[i]);
} }
layer.close(loading2);
}
})
}); });

Loading…
Cancel
Save