Browse Source

添加组合入库审批

lwx_dev
erdanergou 3 years ago
parent
commit
3c4915746a
  1. 2
      src/main/java/com/dreamchaser/depository_manage/pojo/ResultForGroupReturn.java
  2. 58
      src/main/java/com/dreamchaser/depository_manage/service/impl/GroupServiceImpl.java

2
src/main/java/com/dreamchaser/depository_manage/pojo/ResultForGroupReturn.java

@ -13,7 +13,7 @@ public class ResultForGroupReturn {
// 定义列表用于储存入库单id // 定义列表用于储存入库单id
List<Integer> recordIds; List<Integer> recordIds;
// 定义列表用于存储入库仓库id // 定义列表用于存储入库仓库id
List<Integer> depositoryIds; List<Long> mtIdList;
// 定义列表用于存储展示的入库单id // 定义列表用于存储展示的入库单id
List<Integer> showRecordIds; List<Integer> showRecordIds;
// 用于存储申请数 // 用于存储申请数

58
src/main/java/com/dreamchaser/depository_manage/service/impl/GroupServiceImpl.java

@ -736,7 +736,7 @@ public class GroupServiceImpl implements GroupService {
// 定义列表用于储存入库单id // 定义列表用于储存入库单id
List<Integer> recordIds = new ArrayList<>(); List<Integer> recordIds = new ArrayList<>();
// 定义列表用于存储入库仓库id // 定义列表用于存储入库仓库id
List<Integer> depositoryIds = new ArrayList<>(); List<Long> mtIdList = new ArrayList<>();
// 定义列表用于存储展示的入库单id // 定义列表用于存储展示的入库单id
List<Integer> showRecordIds = new ArrayList<>(); List<Integer> showRecordIds = new ArrayList<>();
@ -755,7 +755,7 @@ public class GroupServiceImpl implements GroupService {
// 获取需要审批的入库订单 // 获取需要审批的入库订单
recordIds.addAll(resultForGroupReturn.getRecordIds()); recordIds.addAll(resultForGroupReturn.getRecordIds());
// 获取需要审批的入库订单的仓库 // 获取需要审批的入库订单的仓库
depositoryIds.addAll(resultForGroupReturn.getDepositoryIds()); mtIdList.addAll(resultForGroupReturn.getMtIdList());
// 获取用于展示的入库订单 // 获取用于展示的入库订单
showRecordIds.addAll(resultForGroupReturn.getShowRecordIds()); showRecordIds.addAll(resultForGroupReturn.getShowRecordIds());
@ -766,7 +766,7 @@ public class GroupServiceImpl implements GroupService {
// 获取需要审批的入库订单 // 获取需要审批的入库订单
recordIds.addAll(resultForGroupReturn.getRecordIds()); recordIds.addAll(resultForGroupReturn.getRecordIds());
// 获取需要审批的入库订单的仓库 // 获取需要审批的入库订单的仓库
depositoryIds.addAll(resultForGroupReturn.getDepositoryIds()); mtIdList.addAll(resultForGroupReturn.getMtIdList());
// 获取用于展示的入库订单 // 获取用于展示的入库订单
showRecordIds.addAll(resultForGroupReturn.getShowRecordIds()); showRecordIds.addAll(resultForGroupReturn.getShowRecordIds());
@ -775,14 +775,14 @@ public class GroupServiceImpl implements GroupService {
new Thread(new Runnable() { new Thread(new Runnable() {
@Override @Override
public void run() { public void run() {
Map<Integer, List<Integer>> depositoryIdToRecordId = new HashMap<>(); Map<Long, List<Integer>> mtIdToRecordId = new HashMap<>();
for (int i = 0; i < recordIds.size(); i++) { for (int i = 0; i < recordIds.size(); i++) {
Integer recordId = recordIds.get(i); Integer recordId = recordIds.get(i);
if (recordId != null) { if (recordId != null) {
// 如果当前id不是空 获取对应的入库仓库id // 如果当前id不是空 获取对应的入库仓库id
Integer depositoryId = depositoryIds.get(i); Long mtId = mtIdList.get(i);
// 将对应仓库与订单id添加映射关系 // 将对应仓库与订单id添加映射关系
List<Integer> integers = depositoryIdToRecordId.get(depositoryId); List<Integer> integers = mtIdToRecordId.get(mtId);
if (integers != null) { if (integers != null) {
// 如果有对应关系 // 如果有对应关系
integers.add(recordId); integers.add(recordId);
@ -790,31 +790,35 @@ public class GroupServiceImpl implements GroupService {
// 如果没有 // 如果没有
integers = new ArrayList<>(); integers = new ArrayList<>();
integers.add(recordId); integers.add(recordId);
depositoryIdToRecordId.put(depositoryId, integers); mtIdToRecordId.put(mtId, integers);
} }
} }
} }
// 获取遍历器 // 获取遍历器
Iterator<Integer> iterator = depositoryIdToRecordId.keySet().iterator(); Iterator<Long> iterator = mtIdToRecordId.keySet().iterator();
if (iterator.hasNext()) { if (iterator.hasNext()) {
// 获取当前仓库 // 获取当前仓库
Integer next = iterator.next(); Long next = iterator.next();
// 获取入库到当前仓库的订单id // 获取入库到当前仓库的订单id
List<Integer> integerList = depositoryIdToRecordId.get(next); List<Integer> integerList = mtIdToRecordId.get(next);
// 获取当前仓库的管理员
// List<RoleAndDepository> depositoryIdForIn = roleMapper.findRoleAndDepositoryByDepositoryIdForIn(next);
// 获取当前类型的管理员
Map<String, Object> paramForMtManagers = new HashMap<>();
paramForMtManagers.put("mtid",next);
List<RoleAndMaterialType> materialTypeIdForIn = roleMapper.findRoleAndMaterialTypeByCondition(paramForMtManagers);
// 用于存储当前仓库的管理员企业微信userId // 用于存储当前仓库的管理员企业微信userId
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
// for (RoleAndDepository depository : depositoryIdForIn for (RoleAndMaterialType mt : materialTypeIdForIn
// ) { ) {
// 获取管理员数据 // 获取管理员数据
// UserByPort userByPort = LinkInterfaceUtil.FindUserById(depository.getUserId(), userToken); UserByPort userByPort = LinkInterfaceUtil.FindUserById(mt.getUid(), userToken);
// String workwechat = userByPort.getWorkwechat(); String workwechat = userByPort.getWorkwechat();
// if (workwechat == null || "".equals(workwechat)) { if (workwechat == null || "".equals(workwechat)) {
// workwechat = userByPort.getWechat(); workwechat = userByPort.getWechat();
// } }
// sb.append(workwechat).append(","); sb.append(workwechat).append(",");
// } }
JSONObject jsonObject = qyWxOperationService.sendApprovalTemplateIn(userAgent, userToken, integerList, sb.toString()); JSONObject jsonObject = qyWxOperationService.sendApprovalTemplateIn(userAgent, userToken, integerList, sb.toString());
String sp_no = jsonObject.getString("sp_no"); String sp_no = jsonObject.getString("sp_no");
Map<String, Object> QyWxApprovalMap = new HashMap<>(); Map<String, Object> QyWxApprovalMap = new HashMap<>();
@ -848,7 +852,7 @@ public class GroupServiceImpl implements GroupService {
// 定义列表用于储存入库单id // 定义列表用于储存入库单id
List<Integer> recordIds = new ArrayList<>(); List<Integer> recordIds = new ArrayList<>();
// 定义列表用于存储入库仓库id // 定义列表用于存储入库仓库id
List<Integer> depositoryIds = new ArrayList<>(); List<Long> mtIdLIst = new ArrayList<>();
// 定义列表用于存储展示的入库单id // 定义列表用于存储展示的入库单id
List<Integer> showRecordIds = new ArrayList<>(); List<Integer> showRecordIds = new ArrayList<>();
@ -899,10 +903,10 @@ public class GroupServiceImpl implements GroupService {
insertForApplicationInRecord.put("quantity", String.valueOf(groupInfo.getQuantity() * quantityForGroup)); insertForApplicationInRecord.put("quantity", String.valueOf(groupInfo.getQuantity() * quantityForGroup));
insertForApplicationInRecord.put("code", groupInfo.getMcode()); insertForApplicationInRecord.put("code", groupInfo.getMcode());
insertForApplicationInRecord.put("toGroupId", gid); insertForApplicationInRecord.put("toGroupId", gid);
Material material = materialMapper.findMaterialById(groupInfo.getMid());
if ("-1".equals(unit)) { if ("-1".equals(unit)) {
// 如果是基础单位 // 如果是基础单位
insertForApplicationInRecord.put("price", String.valueOf(0)); insertForApplicationInRecord.put("price", String.valueOf(0));
Material material = materialMapper.findMaterialById(groupInfo.getMid());
insertForApplicationInRecord.put("unit", material.getUnit()); insertForApplicationInRecord.put("unit", material.getUnit());
result += depositoryRecordService.applicationInPlace(insertForApplicationInRecord, false); result += depositoryRecordService.applicationInPlace(insertForApplicationInRecord, false);
if (!flagForApproval) { if (!flagForApproval) {
@ -911,7 +915,7 @@ public class GroupServiceImpl implements GroupService {
} else { } else {
// 如果需要将其添加到列表中待后续使用 // 如果需要将其添加到列表中待后续使用
recordIds.add(ObjectFormatUtil.toInteger(insertForApplicationInRecord.get("applicationInId"))); recordIds.add(ObjectFormatUtil.toInteger(insertForApplicationInRecord.get("applicationInId")));
depositoryIds.add(ObjectFormatUtil.toInteger(insertForApplicationInRecord.get("depositoryId"))); mtIdLIst.add(material.getMaterialTypeId());
insertForApplicationInRecord.remove("applicationInId"); insertForApplicationInRecord.remove("applicationInId");
} }
} else { } else {
@ -925,7 +929,7 @@ public class GroupServiceImpl implements GroupService {
} else { } else {
// 如果需要将其添加到列表中待后续使用 // 如果需要将其添加到列表中待后续使用
recordIds.add(ObjectFormatUtil.toInteger(insertForApplicationInRecord.get("applicationInId"))); recordIds.add(ObjectFormatUtil.toInteger(insertForApplicationInRecord.get("applicationInId")));
depositoryIds.add(ObjectFormatUtil.toInteger(insertForApplicationInRecord.get("depositoryId"))); mtIdLIst.add(material.getMaterialTypeId());
insertForApplicationInRecord.remove("applicationInId"); insertForApplicationInRecord.remove("applicationInId");
} }
insertForApplicationInRecord.remove("applicationInId"); insertForApplicationInRecord.remove("applicationInId");
@ -956,7 +960,7 @@ public class GroupServiceImpl implements GroupService {
ResultForGroupReturn resultForGroupReturn = new ResultForGroupReturn(); ResultForGroupReturn resultForGroupReturn = new ResultForGroupReturn();
resultForGroupReturn.setRecordIds(recordIds); resultForGroupReturn.setRecordIds(recordIds);
resultForGroupReturn.setDepositoryIds(depositoryIds); resultForGroupReturn.setMtIdList(mtIdLIst);
resultForGroupReturn.setShowRecordIds(showRecordIds); resultForGroupReturn.setShowRecordIds(showRecordIds);
resultForGroupReturn.setResult(result); resultForGroupReturn.setResult(result);
return resultForGroupReturn; return resultForGroupReturn;

Loading…
Cancel
Save