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