diff --git a/src/main/java/com/dreamchaser/depository_manage/controller/MaterialController.java b/src/main/java/com/dreamchaser/depository_manage/controller/MaterialController.java index 8cb99ab3..11496fb4 100644 --- a/src/main/java/com/dreamchaser/depository_manage/controller/MaterialController.java +++ b/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 range = redisPool.getRedisTemplateByDb(15).opsForList().range(key, 0, -1); - List result = new ArrayList<>(); - - if (range != null && range.size() > 0) { - for (String value : - range) { - if ("".equals(value)) { - continue; + if (!map.containsKey("simple")) { + List result = new ArrayList<>(); + if (range != null && range.size() > 0) { + for (String value : + range) { + if ("".equals(value)) { + continue; + } + // 获取当前用户可见的仓库 + List 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 splitInfoByMid = splitUnitService.findSplitInfoByMid(inventoryById.getMid()); + inventoryById.setSplitInfoList(splitInfoByMid); + inventoryById.setDepositoryList(depositoryList); + result.add(inventoryById); } - // 获取当前用户可见的仓库 - List 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 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 map, HttpServletRequest request) { + public RestResponse delTemporaryValue(@RequestBody Map 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("缺少必要参数,不进行删除"); } } diff --git a/src/main/resources/templates/pages/application/application-in_temporaryValue.html b/src/main/resources/templates/pages/application/application-in_temporaryValue.html index c1eb6e16..3f9bfa76 100644 --- a/src/main/resources/templates/pages/application/application-in_temporaryValue.html +++ b/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" + }) }; diff --git a/src/main/resources/templates/pages/showInventory/showInventoryForLocation.html b/src/main/resources/templates/pages/showInventory/showInventoryForLocation.html index e402be5f..1aae1b00 100644 --- a/src/main/resources/templates/pages/showInventory/showInventoryForLocation.html +++ b/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; + } @@ -72,6 +81,17 @@
    + @@ -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 = '

    ' + "计量单位:" + key + ";对应库存:" + splitInventory[key] + '

    '; InventoryItem += item; } - lis.push('
  • ' + - '

    ' + "物料名称:" + resultElement.mname + '

    '); + lis.push('
  • ' + + '
    ' + + '' + + '

    ' + "物料名称:" + resultElement.mname + '

    '); lis.push('
    ' + '

    ' + "物料编码:" + resultElement.mcode + '

    ' + '

    ' + "物料型号:" + resultElement.version + '

    ' @@ -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(); + } + } }) diff --git a/target/classes/templates/pages/application/application-in_temporaryValue.html b/target/classes/templates/pages/application/application-in_temporaryValue.html index c1eb6e16..3f9bfa76 100644 --- a/target/classes/templates/pages/application/application-in_temporaryValue.html +++ b/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" + }) }; diff --git a/target/classes/templates/pages/showInventory/showInventoryForLocation.html b/target/classes/templates/pages/showInventory/showInventoryForLocation.html index e402be5f..1aae1b00 100644 --- a/target/classes/templates/pages/showInventory/showInventoryForLocation.html +++ b/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; + } @@ -72,6 +81,17 @@
      +
      @@ -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 = '

      ' + "计量单位:" + key + ";对应库存:" + splitInventory[key] + '

      '; InventoryItem += item; } - lis.push('
    • ' + - '

      ' + "物料名称:" + resultElement.mname + '

      '); + lis.push('
    • ' + + '
      ' + + '' + + '

      ' + "物料名称:" + resultElement.mname + '

      '); lis.push('
      ' + '

      ' + "物料编码:" + resultElement.mcode + '

      ' + '

      ' + "物料型号:" + resultElement.version + '

      ' @@ -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(); + } + } })