diff --git a/src/main/java/com/dreamchaser/depository_manage/controller/PageController.java b/src/main/java/com/dreamchaser/depository_manage/controller/PageController.java index dc4dfb92..ca1ac8c5 100644 --- a/src/main/java/com/dreamchaser/depository_manage/controller/PageController.java +++ b/src/main/java/com/dreamchaser/depository_manage/controller/PageController.java @@ -1593,6 +1593,11 @@ public class PageController { public String scanQrCode(){ return "pages/scanQrCode/ScanQrCode"; } + // 跳转到扫码入库界面 + @GetMapping("/scanQrCodeIn") + public String scanQrCodeIn(){ + return "pages/scanQrCode/ScanQrCodeIn"; + } // 跳转到扫码出库界面 @GetMapping("/scanQrCodeByOut") public ModelAndView scanQrCodeByOut(Integer id,HttpServletRequest request){ diff --git a/src/main/java/com/dreamchaser/depository_manage/mapper/MaterialMapper.java b/src/main/java/com/dreamchaser/depository_manage/mapper/MaterialMapper.java index db381305..973e48ef 100644 --- a/src/main/java/com/dreamchaser/depository_manage/mapper/MaterialMapper.java +++ b/src/main/java/com/dreamchaser/depository_manage/mapper/MaterialMapper.java @@ -143,6 +143,13 @@ public interface MaterialMapper { */ List findMaterialByDepositorys(List ids); + /** + * 根据仓库与类别查询物品 + * @param map + * @return + */ + List findMaterialByDepositorysAndType(Map map); + /** diff --git a/src/main/java/com/dreamchaser/depository_manage/mapper/MaterialMapper.xml b/src/main/java/com/dreamchaser/depository_manage/mapper/MaterialMapper.xml index cf078e80..53a3690c 100644 --- a/src/main/java/com/dreamchaser/depository_manage/mapper/MaterialMapper.xml +++ b/src/main/java/com/dreamchaser/depository_manage/mapper/MaterialMapper.xml @@ -210,6 +210,18 @@ + + diff --git a/src/main/java/com/dreamchaser/depository_manage/service/impl/MaterialServiceImpl.java b/src/main/java/com/dreamchaser/depository_manage/service/impl/MaterialServiceImpl.java index 3b005987..e5efe982 100644 --- a/src/main/java/com/dreamchaser/depository_manage/service/impl/MaterialServiceImpl.java +++ b/src/main/java/com/dreamchaser/depository_manage/service/impl/MaterialServiceImpl.java @@ -14,6 +14,7 @@ import com.dreamchaser.depository_manage.service.PlaceService; import com.dreamchaser.depository_manage.service.RoleService; import com.dreamchaser.depository_manage.utils.HttpUtils; import com.dreamchaser.depository_manage.utils.ObjectFormatUtil; +import com.dreamchaser.depository_manage.utils.TaskCenterUtil; import org.apache.http.protocol.HTTP; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -24,6 +25,8 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; /** * @author Dreamchaser @@ -512,18 +515,31 @@ public class MaterialServiceImpl implements MaterialService { */ public List InitTreeMenus(String mname){ List materialTypeNoParent = materialTypeMapper.findMaterialTypeNoParent(); + // 创造一个线程池 + TaskCenterUtil taskCenterUtil = TaskCenterUtil.getTaskCenterUtil(); List list = new ArrayList<>(); for (int i = 0; i < materialTypeNoParent.size(); i++) { + Map result = new HashMap<>(); MaterialType mt = materialTypeNoParent.get(i); - List childForMaterialTypeByParent = findChildForMaterialTypeByParent(mt.getId(),mname,""); - Map stringObjectMap = new HashMap<>(); - if(childForMaterialTypeByParent != null) { - stringObjectMap = InitTreeMenus(mt, childForMaterialTypeByParent); - }else{ - List materialByType = AddMaterialByType(mt,mname,""); - stringObjectMap = InitTreeMenus(mt, materialByType); + Future objectFuture = taskCenterUtil.submitTask(() -> { + List childForMaterialTypeByParent = findChildForMaterialTypeByParent(mt.getId(), mname, ""); + Map stringObjectMap = new HashMap<>(); + if (childForMaterialTypeByParent != null) { + stringObjectMap = InitTreeMenus(mt, childForMaterialTypeByParent); + } else { + List materialByType = AddMaterialByType(mt, mname, ""); + stringObjectMap = InitTreeMenus(mt, materialByType); + } + return stringObjectMap; + }); + try { + result = (Map) objectFuture.get(); + } catch (InterruptedException ignored) { + + } catch (ExecutionException e) { + e.printStackTrace(); } - list.add(stringObjectMap); + list.add(result); } return list; } @@ -555,31 +571,17 @@ public class MaterialServiceImpl implements MaterialService { dids.add(depository.getId()); } List materialPByCondition = new ArrayList<>(); - List materialByDepositorys = new ArrayList<>(); +// List materialByDepositorys = new ArrayList<>(); if("".equals(adminorg)){ - materialByDepositorys = materialMapper.findMaterialByCondition(new HashMap()); + // 获取当前类别下的物料 + materialPByCondition = materialMapper.findMaterialByCondition(param); }else{ // 获取当前仓库下的所有物料库存 - materialByDepositorys = materialMapper.findMaterialByDepositorys(dids); - } - for (int i = 0; i < materialByDepositorys.size(); i++) { - // 循环便利物料 - if (Integer.compare(materialByDepositorys.get(i).getTypeId(), mt.getId()) == 0){ - // 如果该物料是当前类别下的物料 - boolean flag = false; - for (int j = 0; j < materialPByCondition.size(); j++) { - // 判断当前物料是否在最终结果中 - if(materialByDepositorys.get(i).getCode().equals(materialPByCondition.get(j).getCode())){ - flag = true; // 设置标志位为true - break; // 跳出本循环 - } - } - if(flag){ // 如果当前物料存在 - continue; - } - materialPByCondition.add(materialByDepositorys.get(i)); - } + param.put("list",dids); + materialPByCondition = materialMapper.findMaterialByDepositorysAndType(param); } + + List result = new ArrayList<>(); if("".equals(mname)) { // 如果没有输入名称 for (Material material : materialPByCondition) { diff --git a/src/main/java/com/dreamchaser/depository_manage/utils/TaskCenterUtil.java b/src/main/java/com/dreamchaser/depository_manage/utils/TaskCenterUtil.java index 25e9a47c..20d0f928 100644 --- a/src/main/java/com/dreamchaser/depository_manage/utils/TaskCenterUtil.java +++ b/src/main/java/com/dreamchaser/depository_manage/utils/TaskCenterUtil.java @@ -23,9 +23,10 @@ public class TaskCenterUtil { return taskCenterUtil; } - public void submitTask(Callable task) { - poolExecutor.submit(task); + public Future submitTask(Callable task) { + return poolExecutor.submit(task); } + } diff --git a/src/main/resources/static/js/lay-module/layuimini/miniTab.js b/src/main/resources/static/js/lay-module/layuimini/miniTab.js index 1baa6d7e..820b3fb1 100644 --- a/src/main/resources/static/js/lay-module/layuimini/miniTab.js +++ b/src/main/resources/static/js/lay-module/layuimini/miniTab.js @@ -273,8 +273,10 @@ layui.define(["element", "layer", "jquery"], function (exports) { * 关闭选项卡 **/ $('body').on('click', '.layuimini-tab .layui-tab-title .layui-tab-close', function () { + var loading = layer.load(0, {shade: false, time: 2 * 1000}); var $parent = $(this).parent(); + console.log($parent); var tabId = $parent.attr('lay-id'); if (tabId !== undefined || tabId !== null) { miniTab.delete(tabId); diff --git a/src/main/resources/templates/pages/application/application-in.html b/src/main/resources/templates/pages/application/application-in.html index 5d6aa386..892eaa45 100644 --- a/src/main/resources/templates/pages/application/application-in.html +++ b/src/main/resources/templates/pages/application/application-in.html @@ -56,10 +56,12 @@
-
+
+
- + class="layui-input" lay-verify="required" style="border-style: none"> + +
@@ -146,14 +148,22 @@ function selectMaterialByName(obj){} // 用于加载仓库菜单 function openDepositoryTree(obj){} + + // 用于扫码入库 + function scanCodeInStorage(obj) {} + + // 用于删除当前选项卡 + function deleteTable() { + + } // 用于暂存卡片个数 var params = []; // 用于卡片编号 var NewIdNumber = 1; - layui.use(['form', 'step','flow'], function () { + layui.use(['form','miniTab', 'step','flow'], function () { var $ = layui.$, form = layui.form, - flow = layui.flow, + miniTab = layui.miniTab, step = layui.step; // 用于分步表单加载 @@ -262,15 +272,18 @@
+
+ class="layui-input" lay-verify="required" style="border-style: none"> + +
+ class="layui-input" lay-verify="number" >
@@ -305,7 +318,7 @@ // 获取当前高度 var height = parseInt(($("#stepForm").css('height')).split("px")[0]); params.push(NewIdNumber) - $("#stepForm").css("height",height+475 +'px'); + $("#stepForm").css("height",height+477 +'px'); $("#"+parentId).after(materialItem); }; @@ -318,7 +331,7 @@ // 获取祖父节点 var reparent = parent.parentNode; var height = parseInt(($("#stepForm").css('height')).split("px")[0]); - $("#stepForm").css("height",height-475 +'px'); + $("#stepForm").css("height",height-477 +'px'); params = remove(params,parentId); reparent.removeChild(parent); }; @@ -342,7 +355,7 @@ // 输入code var code = obj.value; // 获取对应元素 - var parent = obj.parentNode.parentNode.parentNode; + var parent = obj.parentNode.parentNode.parentNode.parentNode; var children = parent.childNodes[5]; var materialItem = children.childNodes[3].childNodes[1].childNodes; var materialName = materialItem[1]; @@ -377,8 +390,8 @@ var parentId = parent.id; var codeChildren = parent.childNodes[7]; var materialChildren = parent.childNodes[5]; - var codeItem = codeChildren.childNodes[3].childNodes; - var codeValue = codeItem[1]; + var codeItem = codeChildren.childNodes[3].childNodes[1]; + var codeValue = codeItem.childNodes[1]; var materialItem = materialChildren.childNodes[3].childNodes[1].childNodes; var materialName = materialItem[1]; var materialId = materialName.parentNode.parentNode.childNodes[3]; @@ -422,8 +435,8 @@ var parent = obj.parentNode.parentNode.parentNode.parentNode; var materialChildren = parent.childNodes[5]; var codeChildren = parent.childNodes[7]; - var codeItem = codeChildren.childNodes[3].childNodes; - var codeValue = codeItem[1]; + var codeItem = codeChildren.childNodes[3].childNodes[1]; + var codeValue = codeItem.childNodes[1]; var materialItem = materialChildren.childNodes[3].childNodes[1].childNodes; var materialName = materialItem[1]; var materialId = materialName.parentNode.parentNode.childNodes[3]; @@ -458,6 +471,25 @@ }); }; + // 用于扫码入库 + scanCodeInStorage = function(obj){ + layer.open({ + type: 2, + title: '扫码', + skin: 'layui-layer-rim', + maxmin: true, + shadeClose: true, //点击遮罩关闭层 + area: ['100%', '100%'], + move : '.layui-layer-title', + fixed:false, + content: '/scanQrCodeIn', + end: function () { + miniTab.deleteCurrentByIframe(); + } + }) + }; + + // 用于打开仓库树形菜单 openDepositoryTree = function (obj) { var parent = obj.parentNode.parentNode.parentNode; diff --git a/src/main/resources/templates/pages/material/selectMaterialByCard.html b/src/main/resources/templates/pages/material/selectMaterialByCard.html index c38f5494..56e0282c 100644 --- a/src/main/resources/templates/pages/material/selectMaterialByCard.html +++ b/src/main/resources/templates/pages/material/selectMaterialByCard.html @@ -44,6 +44,7 @@ parent.layer.close(index); } }); + $.ajax({ url: "/material/treeMenus", data: JSON.stringify(req), diff --git a/src/main/resources/templates/pages/scanQrCode/ScanQrCodeIn.html b/src/main/resources/templates/pages/scanQrCode/ScanQrCodeIn.html new file mode 100644 index 00000000..14268ce0 --- /dev/null +++ b/src/main/resources/templates/pages/scanQrCode/ScanQrCodeIn.html @@ -0,0 +1,268 @@ + + + + + + 扫码 + + + + + + + + + + + + + +
+ +
+ Long validation in progress... +
+
+
+ + + + \ No newline at end of file diff --git a/src/test/java/com/dreamchaser/depository_manage/Test.java b/src/test/java/com/dreamchaser/depository_manage/Test.java index 0258ca59..3b088b29 100644 --- a/src/test/java/com/dreamchaser/depository_manage/Test.java +++ b/src/test/java/com/dreamchaser/depository_manage/Test.java @@ -10,6 +10,7 @@ import com.dreamchaser.depository_manage.config.QyWxJMJM.com.qq.weixin.mp.aes.Ae import com.dreamchaser.depository_manage.config.QyWxJMJM.com.qq.weixin.mp.aes.WXBizMsgCrypt; import com.dreamchaser.depository_manage.controller.PageController; import com.dreamchaser.depository_manage.entity.*; +import com.dreamchaser.depository_manage.mapper.MaterialMapper; import com.dreamchaser.depository_manage.mapper.MaterialTypeMapper; import com.dreamchaser.depository_manage.pojo.MaterialP; import com.dreamchaser.depository_manage.pojo.UserByPortP; @@ -68,13 +69,19 @@ public class Test { @Autowired QyWxOperationService qyWxOperationService; + + @Autowired + MaterialService materialService; + @org.junit.Test public void test1() throws AesException, IOException, ParserConfigurationException, SAXException { // JSONObject jsonObject = qyWxOperationService.sendCcMessageToUsers("PangFuZhen,", 1); // System.out.println(jsonObject); - QyWxConfig.token = QyWxConfig.GetQYWXToken(); - String s = qyWxOperationService.withdrawQyWxMessage("Dv0oBVNA9p2BIWPODPqgkuvhQHsXWsMOEPE8cUQ2ZwA9ytIKtwNrGT68xhiplY3lFjCSVlIMmRed5izSY_pU-Q"); - System.out.println(s); +// QyWxConfig.token = QyWxConfig.GetQYWXToken(); +// String s = qyWxOperationService.withdrawQyWxMessage("Dv0oBVNA9p2BIWPODPqgkuvhQHsXWsMOEPE8cUQ2ZwA9ytIKtwNrGT68xhiplY3lFjCSVlIMmRed5izSY_pU-Q"); +// System.out.println(s); + List objectList = materialService.InitTreeMenus(""); + System.out.println(objectList); } diff --git a/target/classes/com/dreamchaser/depository_manage/mapper/MaterialMapper.xml b/target/classes/com/dreamchaser/depository_manage/mapper/MaterialMapper.xml index cf078e80..53a3690c 100644 --- a/target/classes/com/dreamchaser/depository_manage/mapper/MaterialMapper.xml +++ b/target/classes/com/dreamchaser/depository_manage/mapper/MaterialMapper.xml @@ -210,6 +210,18 @@ + + diff --git a/target/classes/static/js/lay-module/layuimini/miniTab.js b/target/classes/static/js/lay-module/layuimini/miniTab.js index 1baa6d7e..820b3fb1 100644 --- a/target/classes/static/js/lay-module/layuimini/miniTab.js +++ b/target/classes/static/js/lay-module/layuimini/miniTab.js @@ -273,8 +273,10 @@ layui.define(["element", "layer", "jquery"], function (exports) { * 关闭选项卡 **/ $('body').on('click', '.layuimini-tab .layui-tab-title .layui-tab-close', function () { + var loading = layer.load(0, {shade: false, time: 2 * 1000}); var $parent = $(this).parent(); + console.log($parent); var tabId = $parent.attr('lay-id'); if (tabId !== undefined || tabId !== null) { miniTab.delete(tabId); diff --git a/target/classes/templates/pages/application/application-in.html b/target/classes/templates/pages/application/application-in.html index 5d6aa386..892eaa45 100644 --- a/target/classes/templates/pages/application/application-in.html +++ b/target/classes/templates/pages/application/application-in.html @@ -56,10 +56,12 @@
-
+
+
- + class="layui-input" lay-verify="required" style="border-style: none"> + +
@@ -146,14 +148,22 @@ function selectMaterialByName(obj){} // 用于加载仓库菜单 function openDepositoryTree(obj){} + + // 用于扫码入库 + function scanCodeInStorage(obj) {} + + // 用于删除当前选项卡 + function deleteTable() { + + } // 用于暂存卡片个数 var params = []; // 用于卡片编号 var NewIdNumber = 1; - layui.use(['form', 'step','flow'], function () { + layui.use(['form','miniTab', 'step','flow'], function () { var $ = layui.$, form = layui.form, - flow = layui.flow, + miniTab = layui.miniTab, step = layui.step; // 用于分步表单加载 @@ -262,15 +272,18 @@
+
+ class="layui-input" lay-verify="required" style="border-style: none"> + +
+ class="layui-input" lay-verify="number" >
@@ -305,7 +318,7 @@ // 获取当前高度 var height = parseInt(($("#stepForm").css('height')).split("px")[0]); params.push(NewIdNumber) - $("#stepForm").css("height",height+475 +'px'); + $("#stepForm").css("height",height+477 +'px'); $("#"+parentId).after(materialItem); }; @@ -318,7 +331,7 @@ // 获取祖父节点 var reparent = parent.parentNode; var height = parseInt(($("#stepForm").css('height')).split("px")[0]); - $("#stepForm").css("height",height-475 +'px'); + $("#stepForm").css("height",height-477 +'px'); params = remove(params,parentId); reparent.removeChild(parent); }; @@ -342,7 +355,7 @@ // 输入code var code = obj.value; // 获取对应元素 - var parent = obj.parentNode.parentNode.parentNode; + var parent = obj.parentNode.parentNode.parentNode.parentNode; var children = parent.childNodes[5]; var materialItem = children.childNodes[3].childNodes[1].childNodes; var materialName = materialItem[1]; @@ -377,8 +390,8 @@ var parentId = parent.id; var codeChildren = parent.childNodes[7]; var materialChildren = parent.childNodes[5]; - var codeItem = codeChildren.childNodes[3].childNodes; - var codeValue = codeItem[1]; + var codeItem = codeChildren.childNodes[3].childNodes[1]; + var codeValue = codeItem.childNodes[1]; var materialItem = materialChildren.childNodes[3].childNodes[1].childNodes; var materialName = materialItem[1]; var materialId = materialName.parentNode.parentNode.childNodes[3]; @@ -422,8 +435,8 @@ var parent = obj.parentNode.parentNode.parentNode.parentNode; var materialChildren = parent.childNodes[5]; var codeChildren = parent.childNodes[7]; - var codeItem = codeChildren.childNodes[3].childNodes; - var codeValue = codeItem[1]; + var codeItem = codeChildren.childNodes[3].childNodes[1]; + var codeValue = codeItem.childNodes[1]; var materialItem = materialChildren.childNodes[3].childNodes[1].childNodes; var materialName = materialItem[1]; var materialId = materialName.parentNode.parentNode.childNodes[3]; @@ -458,6 +471,25 @@ }); }; + // 用于扫码入库 + scanCodeInStorage = function(obj){ + layer.open({ + type: 2, + title: '扫码', + skin: 'layui-layer-rim', + maxmin: true, + shadeClose: true, //点击遮罩关闭层 + area: ['100%', '100%'], + move : '.layui-layer-title', + fixed:false, + content: '/scanQrCodeIn', + end: function () { + miniTab.deleteCurrentByIframe(); + } + }) + }; + + // 用于打开仓库树形菜单 openDepositoryTree = function (obj) { var parent = obj.parentNode.parentNode.parentNode; diff --git a/target/classes/templates/pages/material/selectMaterialByCard.html b/target/classes/templates/pages/material/selectMaterialByCard.html index c38f5494..56e0282c 100644 --- a/target/classes/templates/pages/material/selectMaterialByCard.html +++ b/target/classes/templates/pages/material/selectMaterialByCard.html @@ -44,6 +44,7 @@ parent.layer.close(index); } }); + $.ajax({ url: "/material/treeMenus", data: JSON.stringify(req),