From ad48e22d4668c66bb2c2df4e41628536fca43520 Mon Sep 17 00:00:00 2001 From: erdanergou Date: Wed, 29 Mar 2023 16:54:02 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=87=BA=E5=BA=93=E5=90=8E?= =?UTF-8?q?=E9=80=80=E5=BA=93=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/DepositoryRecordServiceImpl.java | 90 +++++++++++++------ .../form-step-look_minRecordOut.html | 2 +- .../pages/depository/table-stock.html | 1 + .../pages/place/materialForPlace.html | 8 ++ .../pages/depository/table-stock.html | 1 + .../pages/place/materialForPlace.html | 8 ++ 6 files changed, 82 insertions(+), 28 deletions(-) diff --git a/src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java b/src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java index a72c8201..b20097a1 100644 --- a/src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java +++ b/src/main/java/com/dreamchaser/depository_manage/service/impl/DepositoryRecordServiceImpl.java @@ -1790,6 +1790,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { * @param map 待修改数据 * @return */ + @Transactional(rollbackFor = Exception.class) @Override public Integer updateOutMinRecordInfo(Map map, UserByPort userToken, String userAgent) { Integer result = 0; @@ -1837,6 +1838,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { Object applicationInId = null; Object mtId = null; + Object depositoryId = null; + Object type = null; if ("-1".equals(unit)) { // 如果是基础单位 @@ -1859,6 +1862,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { Map paramForUpdateSplitInventory = new HashMap<>(); paramForUpdateSplitInventory.put("placeId", outRecordMin.getPlaceId()); paramForUpdateSplitInventory.put("depositoryId", outRecordMin.getDepositoryId()); + paramForUpdateSplitInventory.put("applicantId", userToken.getId()); paramForUpdateSplitInventory.put("quantity", String.valueOf(returnQuantity)); paramForUpdateSplitInventory.put("mid", inventoryById.getMid()); paramForUpdateSplitInventory.put("unit", unit); @@ -1869,7 +1873,9 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { paramForUpdateSplitInventory.put("applyRemark", "退库"); applicationInPlace(paramForUpdateSplitInventory, false); applicationInId = paramForUpdateSplitInventory.get("applicationInId"); - mtId = map.get("mtId"); + mtId = paramForUpdateSplitInventory.get("mtId"); + depositoryId = paramForUpdateSplitInventory.get("depositoryId"); + type = paramForUpdateSplitInventory.get("inType"); } else { // 如果是拆单 @@ -1899,6 +1905,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { }*/ Map paramForUpdateSplitInventory = new HashMap<>(); paramForUpdateSplitInventory.put("placeId", outRecordMin.getPlaceId()); + paramForUpdateSplitInventory.put("applicantId", userToken.getId()); paramForUpdateSplitInventory.put("depositoryId", outRecordMin.getDepositoryId()); paramForUpdateSplitInventory.put("quantity", String.valueOf(returnQuantity)); paramForUpdateSplitInventory.put("mid", inventoryById.getMid()); @@ -1908,14 +1915,16 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { paramForUpdateSplitInventory.put("applyRemark", "退库"); splitUnitService.addSplitInventory(paramForUpdateSplitInventory); applicationInId = paramForUpdateSplitInventory.get("applicationInId"); - mtId = map.get("mtId"); + mtId = paramForUpdateSplitInventory.get("mtId"); + depositoryId = paramForUpdateSplitInventory.get("depositoryId"); + type = paramForUpdateSplitInventory.get("inType"); } // 修改子单数据 outRecordMin.setQuantity((int) (quantity * 100)); outRecordMin.setTrueOut((int) (quantity * 100)); - depositoryRecordMapper.updateApplicationOutRecordMin(outRecordMin); + result = depositoryRecordMapper.updateApplicationOutRecordMin(outRecordMin); if (Integer.compare(trueOut, outQuantity) != 0) { //如果没有完成出库 @@ -1933,26 +1942,44 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { UserByPort userByPort = LinkInterfaceUtil.FindUserById(outRecordMin.getCheckId(), userToken); outRecord.setPass(1); - updateApplicationMinOutInfo(id, outRecordMin, outRecord, (double) (quantity / 100), userByPort, placeById.getId(), userAgent); + updateApplicationMinOutInfo(id, outRecordMin, outRecord, (double) (quantity), userByPort, placeById.getId(), userAgent); } - if (applicationInId != null && mtId != null) { + if (applicationInId != null) { // 如果成功 - // 获取当前类型的管理员 - List materialTypeIdForIn = roleService.findRoleAndMaterialTypeByMtId(Long.valueOf(mtId.toString())); + // 用于存储当前仓库的管理员企业微信userId StringBuilder sb = new StringBuilder(); - for (RoleAndMaterialType mt : materialTypeIdForIn - ) { - // 获取管理员数据 - UserByPort userByPort = LinkInterfaceUtil.FindUserById(mt.getUid(), userToken); - String workwechat = userByPort.getWorkwechat(); - if (workwechat == null || "".equals(workwechat)) { - workwechat = userByPort.getWechat(); + if("mt".equals(type.toString())){ + // 获取当前类型的管理员 + List materialTypeIdForIn = roleService.findRoleAndMaterialTypeByMtId(Long.valueOf(mtId.toString())); + + for (RoleAndMaterialType mt : materialTypeIdForIn + ) { + // 获取管理员数据 + UserByPort userByPort = LinkInterfaceUtil.FindUserById(mt.getUid(), userToken); + String workwechat = userByPort.getWorkwechat(); + if (workwechat == null || "".equals(workwechat)) { + workwechat = userByPort.getWechat(); + } + sb.append(workwechat).append(","); + } + }else{ + List materialTypeIdForIn = roleService.findRoleAndDepositoryByDid(ObjectFormatUtil.toInteger(depositoryId)); + + for (RoleAndDepository mt : materialTypeIdForIn + ) { + // 获取管理员数据 + UserByPort userByPort = LinkInterfaceUtil.FindUserById(mt.getUserId(), userToken); + String workwechat = userByPort.getWorkwechat(); + if (workwechat == null || "".equals(workwechat)) { + workwechat = userByPort.getWechat(); + } + sb.append(workwechat).append(","); } - sb.append(workwechat).append(","); } + List integerList = new ArrayList<>(); integerList.add(ObjectFormatUtil.toInteger(applicationInId)); JSONObject jsonObject = qyWxOperationService.sendApprovalTemplateIn(userAgent, userToken, integerList, sb.toString()); @@ -1969,14 +1996,17 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { } else { // 如果不大于 - if (inventoryById.getNumberOfTemporary() != null && inventoryById.getNumberOfTemporary() > 0) { - Integer numberOfTemporary = inventoryById.getNumberOfTemporary() + trueOut - outQuantity + (int) (quantity * 100); - if (numberOfTemporary < 0) { - numberOfTemporary = 0; + if("-1".equals(unit)){ + if (inventoryById.getNumberOfTemporary() != null && inventoryById.getNumberOfTemporary() > 0) { + Integer numberOfTemporary = inventoryById.getNumberOfTemporary() + trueOut - outQuantity + (int) (quantity * 100); + if (numberOfTemporary < 0) { + numberOfTemporary = 0; + } + inventoryById.setNumberOfTemporary(numberOfTemporary); + materialMapper.updateInventory(inventoryById); } - inventoryById.setNumberOfTemporary(numberOfTemporary); - materialMapper.updateInventory(inventoryById); } + // 设置新数量 outRecordMin.setQuantity((int) (quantity * 100)); // 修改记录 @@ -1992,14 +2022,17 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { // 修改记录 result = depositoryRecordMapper.updateApplicationOutRecordMin(outRecordMin); - if (inventoryById.getNumberOfTemporary() != null && inventoryById.getNumberOfTemporary() > 0) { - Integer numberOfTemporary = inventoryById.getNumberOfTemporary() - outQuantity + (int) (quantity * 100); - if (numberOfTemporary < 0) { - numberOfTemporary = 0; + if("-1".equals(unit)){ + if (inventoryById.getNumberOfTemporary() != null && inventoryById.getNumberOfTemporary() > 0) { + Integer numberOfTemporary = inventoryById.getNumberOfTemporary() - outQuantity + (int) (quantity * 100); + if (numberOfTemporary < 0) { + numberOfTemporary = 0; + } + inventoryById.setNumberOfTemporary(numberOfTemporary); + materialMapper.updateInventory(inventoryById); } - inventoryById.setNumberOfTemporary(numberOfTemporary); - materialMapper.updateInventory(inventoryById); } + } // 修改主记录的出库数量 @@ -2108,6 +2141,9 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { String key = "user:" + userByPort.getId().toString(); // 获取当前用户所有订单 String minRecord = (String) redisTemplate.opsForHash().get(key, "minRecord"); + if(minRecord == null){ + minRecord = ""; + } // 删除用户中当前已完成的订单 minRecord = minRecord.replace(redisMinRecordKey + ",", ""); if (minRecord.length() == 2) { diff --git a/src/main/resources/templates/pages/application/form-step-look_minRecordOut.html b/src/main/resources/templates/pages/application/form-step-look_minRecordOut.html index 2950572c..ac63ae5e 100644 --- a/src/main/resources/templates/pages/application/form-step-look_minRecordOut.html +++ b/src/main/resources/templates/pages/application/form-step-look_minRecordOut.html @@ -209,7 +209,7 @@ req.id = id; let newQuantity = $("#quantity").val(); if (Number(newQuantity) >= Number(quantity)) { - layer.msg("请申请!", { + layer.msg("数据非法,请申请!", { icon: 0, time: 1000 }, function () { diff --git a/src/main/resources/templates/pages/depository/table-stock.html b/src/main/resources/templates/pages/depository/table-stock.html index bb4e8041..880fbbf4 100644 --- a/src/main/resources/templates/pages/depository/table-stock.html +++ b/src/main/resources/templates/pages/depository/table-stock.html @@ -156,6 +156,7 @@ [ {type: "checkbox", width: 50}, {field: 'mname', width: 200, title: '物料名称'}, + {field: 'brand', width: 200, title: '品牌'}, {field: 'version', width: 200, title: '规格型号'}, {field: 'code', width: 200, title: '存货编码'}, {field: 'typeName', width: 200, title: '物料类型'}, diff --git a/src/main/resources/templates/pages/place/materialForPlace.html b/src/main/resources/templates/pages/place/materialForPlace.html index 5f6dea81..ad58880e 100644 --- a/src/main/resources/templates/pages/place/materialForPlace.html +++ b/src/main/resources/templates/pages/place/materialForPlace.html @@ -28,6 +28,14 @@ 物料名称 骁龙888芯片 + + 物料品牌 + 骁龙888芯片 + + + 物料型号 + 骁龙888芯片 + 存货编码 diff --git a/target/classes/templates/pages/depository/table-stock.html b/target/classes/templates/pages/depository/table-stock.html index bb4e8041..880fbbf4 100644 --- a/target/classes/templates/pages/depository/table-stock.html +++ b/target/classes/templates/pages/depository/table-stock.html @@ -156,6 +156,7 @@ [ {type: "checkbox", width: 50}, {field: 'mname', width: 200, title: '物料名称'}, + {field: 'brand', width: 200, title: '品牌'}, {field: 'version', width: 200, title: '规格型号'}, {field: 'code', width: 200, title: '存货编码'}, {field: 'typeName', width: 200, title: '物料类型'}, diff --git a/target/classes/templates/pages/place/materialForPlace.html b/target/classes/templates/pages/place/materialForPlace.html index 5f6dea81..ad58880e 100644 --- a/target/classes/templates/pages/place/materialForPlace.html +++ b/target/classes/templates/pages/place/materialForPlace.html @@ -28,6 +28,14 @@ 物料名称 骁龙888芯片 + + 物料品牌 + 骁龙888芯片 + + + 物料型号 + 骁龙888芯片 + 存货编码