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 afb26e71..e3b90498 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 @@ -2579,6 +2579,10 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { // 获取具体入库订单 ApplicationInRecordP recordP = depositoryRecordMapper.findApplicationInRecordPById(ObjectFormatUtil.toInteger(id)); + + // 用于判断当前入库的是组合还是物料 + Integer flagForGroup = recordP.getFlagForGroup(); + // 获取当前入库对应的物料 Material materialById = materialMapper.findMaterialById(recordP.getMid()); diff --git a/src/main/java/com/dreamchaser/depository_manage/service/impl/GroupServiceImpl.java b/src/main/java/com/dreamchaser/depository_manage/service/impl/GroupServiceImpl.java index 28e5184a..3d50068c 100644 --- a/src/main/java/com/dreamchaser/depository_manage/service/impl/GroupServiceImpl.java +++ b/src/main/java/com/dreamchaser/depository_manage/service/impl/GroupServiceImpl.java @@ -704,74 +704,53 @@ public class GroupServiceImpl implements GroupService { @Transactional(rollbackFor = Exception.class) @Override public Integer insertApplicationInRecord(Map map, UserByPort userToken) { + + + // 获取当前提交数 List params = (List) map.get("params"); // 用于存储申请数 Integer result = 0; - // 定义参数用与入库 - Map insertForApplicationInRecord = new HashMap<>(); - - - insertForApplicationInRecord.put("applicantId", userToken.getId()); // 循环参数列表 for (String temp : params) { - // 获取当前入库的组合数量 - Integer quantityForGroup = ObjectFormatUtil.toInteger(map.get("quantity" + temp)); + Map paramForMethod = new HashMap<>(); + paramForMethod.put("quantity",map.get("quantity" + temp)); + paramForMethod.put("gid",map.get("gid" + temp)); + paramForMethod.put("placeId",map.get("placeId" + temp)); + paramForMethod.put("depositoryId",map.get("depositoryId" + temp)); + paramForMethod.put("applyRemark",map.get("applyRemark" + temp)); + result += insertOrUpdateInventoryForGroupInfo(paramForMethod,userToken,true); - // 获取要出库的组合 - Integer gid = ObjectFormatUtil.toInteger(map.get("gid"+temp)); + } + result += insertOrUpdateInventoryForGroupInfo(map,userToken,false); + return result; + } + + + /** + * 用于处理组合入库时的库位 + * @param map 入库数据 + * @param userToken 入库人员 + * @param flag 标志是否需要保存入库单号(true时不需要,false时需要) + * @return + */ + Integer insertOrUpdateInventoryForGroupInfo(Map map,UserByPort userToken,boolean flag){ + // 用于存储申请数 + Integer result = 0; - // 获取要出库组合的具体信息 - List groupInfoByGid = groupMapper.findGroupInfoByGid(gid); - // 获取入库的库位 - Integer placeId = ObjectFormatUtil.toInteger(map.get("placeId" + temp)); - // 获取入库的仓库 - Integer depositoryId = ObjectFormatUtil.toInteger(map.get("depositoryId" + temp)); + // 获取入库的仓库 + Integer depositoryId = ObjectFormatUtil.toInteger(map.get("depositoryId")); - insertForApplicationInRecord.put("depositoryId",depositoryId); - insertForApplicationInRecord.put("placeId",placeId); - insertForApplicationInRecord.put("applyRemark", map.get("applyRemark" + temp)); - // 循环当前组合信息 - for (GroupInfo groupInfo : - groupInfoByGid) { - // 获取当前组合记录中的单位 - String unit = groupInfo.getUnit(); - insertForApplicationInRecord.put("mid",groupInfo.getMid()); - insertForApplicationInRecord.put("quantity",String.valueOf(groupInfo.getQuantity() * quantityForGroup)); - insertForApplicationInRecord.put("code",groupInfo.getMcode()); - if("-1".equals(unit)){ - // 如果是基础单位 - Material material = materialMapper.findMaterialById(groupInfo.getMid()); - insertForApplicationInRecord.put("unit",material.getUnit()); - insertForApplicationInRecord.put("price", String.valueOf(0)); - result += depositoryRecordService.applicationInPlace(insertForApplicationInRecord,false); - depositoryRecordMapper.deleteApplicationInRecordById(ObjectFormatUtil.toInteger(insertForApplicationInRecord.get("id"))); - }else{ - insertForApplicationInRecord.put("unit",unit); - insertForApplicationInRecord.put("type","in"); - insertForApplicationInRecord.put("price", String.valueOf(0)); - result += splitUnitService.addSplitInventory(insertForApplicationInRecord); - depositoryRecordMapper.deleteApplicationInRecordById(ObjectFormatUtil.toInteger(insertForApplicationInRecord.get("applicationInId"))); - insertForApplicationInRecord.remove("applicationInId"); - } + // 定义参数用与入库 + Map insertForApplicationInRecord = new HashMap<>(); - } - insertForApplicationInRecord.put("flagForGroup",2); - insertForApplicationInRecord.put("quantity",quantityForGroup.toString()); - insertForApplicationInRecord.put("mid",gid); - insertForApplicationInRecord.put("unit",-1); - Depository depository = depositoryMapper.findDepositoryById(depositoryId); - insertForApplicationInRecord.put("code",depositoryRecordService.createCode(depository.getDname(), "InOrderNumber", "in", "")); - insertForApplicationInRecord.put("applicant_time",System.currentTimeMillis()); - depositoryRecordMapper.insertApplicationInRecord(insertForApplicationInRecord); - insertForApplicationInRecord.remove("id"); - } + insertForApplicationInRecord.put("applicantId", userToken.getId()); // 获取当前入库的组合数量 Integer quantityForGroup = ObjectFormatUtil.toInteger(map.get("quantity")); @@ -784,8 +763,7 @@ public class GroupServiceImpl implements GroupService { // 获取入库的库位 Integer placeId = ObjectFormatUtil.toInteger(map.get("placeId")); - // 获取入库的仓库 - Integer depositoryId = ObjectFormatUtil.toInteger(map.get("depositoryId")); + insertForApplicationInRecord.put("depositoryId",depositoryId); insertForApplicationInRecord.put("placeId",placeId); @@ -823,9 +801,12 @@ public class GroupServiceImpl implements GroupService { insertForApplicationInRecord.put("code",depositoryRecordService.createCode(depository.getDname(), "InOrderNumber", "in", "")); insertForApplicationInRecord.put("applicant_time",System.currentTimeMillis()); depositoryRecordMapper.insertApplicationInRecord(insertForApplicationInRecord); + if(!flag){ + depositoryRecordMapper.deleteApplicationInRecordById(ObjectFormatUtil.toInteger(insertForApplicationInRecord.get("applicationInId"))); + insertForApplicationInRecord.remove("applicationInId"); + } return result; } - /** * 用于插入子出库订单 * diff --git a/target/classes/templates/pages/other/welcome.html b/target/classes/templates/pages/other/welcome.html index f2151bd7..194ecbb0 100644 --- a/target/classes/templates/pages/other/welcome.html +++ b/target/classes/templates/pages/other/welcome.html @@ -413,7 +413,26 @@ $(window).on("resize", function () { layer.full(index); }); - } else if (type === "库存盘点请求") { + } + else if (type === '入库请求') { + var index = layer.open({ + title: '请求详情', + type: 2, + shade: 0.2, + maxmin: true, + shadeClose: true, + area: ['100%', '100%'], + content: '/application_in_review?id=' + id, + end: function () { + location.reload() + } + }); + + $(window).on("resize", function () { + layer.full(index); + }); + } + else if (type === "库存盘点请求") { var index = layer.open({ title: '请求详情', type: 2, @@ -429,7 +448,8 @@ $(window).on("resize", function () { layer.full(index); }); - } else if (type === "物料出库请求") { + } + else if (type === "物料出库请求") { var index = layer.open({ title: '请求详情', type: 2, diff --git a/target/classes/templates/pages/other/welcome_mobile.html b/target/classes/templates/pages/other/welcome_mobile.html index 3c364699..53a88da9 100644 --- a/target/classes/templates/pages/other/welcome_mobile.html +++ b/target/classes/templates/pages/other/welcome_mobile.html @@ -418,7 +418,26 @@ $(window).on("resize", function () { layer.full(index); }); - } else if (type === "库存盘点请求") { + } + else if (type === '入库请求') { + var index = layer.open({ + title: '请求详情', + type: 2, + shade: 0.2, + maxmin: true, + shadeClose: true, + area: ['100%', '100%'], + content: '/application_in_review?id=' + id, + end: function () { + location.reload() + } + }); + + $(window).on("resize", function () { + layer.full(index); + }); + } + else if (type === "库存盘点请求") { var index = layer.open({ title: '请求详情', type: 2,