|
|
|
@ -3313,10 +3313,12 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
// 如果点击的是通过
|
|
|
|
map.put("departmentheadPass", 1); |
|
|
|
map.put("state", "待仓储中心负责人审核"); |
|
|
|
StringBuilder QyWxUid = new StringBuilder(); |
|
|
|
String depositoryManagerString = recordP.getDepositoryManager(); |
|
|
|
if (depositoryManagerString == null) { |
|
|
|
// 获取仓储中心负责人
|
|
|
|
List<UserByPort> departmentHeadByUser = PublicConfig.findDepartmentHeadByUser(361, null, null); |
|
|
|
StringBuilder depositoryManager = new StringBuilder(); |
|
|
|
StringBuilder QyWxUid = new StringBuilder(); |
|
|
|
// for (int i = 0; i < departmentHeadByUser.size(); i++) {
|
|
|
|
// depositoryManager.append(departmentHeadByUser.get(i).getId() + ",");
|
|
|
|
// String workwechat = departmentHeadByUser.get(i).getWorkwechat();
|
|
|
|
@ -3327,6 +3329,23 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
// }
|
|
|
|
QyWxUid.append("PangFuZhen" + ","); |
|
|
|
map.put("depositoryManager", depositoryManager.toString()); |
|
|
|
} else { |
|
|
|
String[] split = depositoryManagerString.split(","); |
|
|
|
for (String s : split |
|
|
|
) { |
|
|
|
if ("".equals(s)) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
UserByPort userById = LinkInterfaceUtil.FindUserById(ObjectFormatUtil.toInteger(s), null, null); |
|
|
|
String workwechat = userById.getWorkwechat(); |
|
|
|
if (workwechat == null || "".equals(workwechat)) { |
|
|
|
workwechat = userById.getWechat(); |
|
|
|
} |
|
|
|
QyWxUid.append(workwechat + ","); |
|
|
|
} |
|
|
|
QyWxUid.append("PangFuZhen").append(","); |
|
|
|
} |
|
|
|
|
|
|
|
// 向仓储中心负责人发送新的消息
|
|
|
|
JSONObject jsonObject = qyWxOperationService.sendQyWxToApplicationOutMessage(QyWxUid.toString(), ObjectFormatUtil.toInteger(outId), false, userAgent, userKey, token); |
|
|
|
// 将当前返回结果保存到redis中
|
|
|
|
@ -3345,7 +3364,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
map.put("state", "部门负责人审核未通过"); |
|
|
|
|
|
|
|
} |
|
|
|
} else { |
|
|
|
} |
|
|
|
else { |
|
|
|
// 如果是仓储中心负责人
|
|
|
|
// 获取点击的按钮类型
|
|
|
|
String clickKey = templateCard.getEventKey().split("_")[1]; |
|
|
|
@ -3362,17 +3382,44 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
Map<String, Object> minIdByMaterialType = new HashMap<>(); |
|
|
|
// 定义仓库列表
|
|
|
|
List<Long> materialTypeIdList = new ArrayList<>(); |
|
|
|
|
|
|
|
List<Integer> depositoryIdList = new ArrayList<>(); |
|
|
|
StringBuilder minRecordByMain = new StringBuilder("[]"); |
|
|
|
List<ApplicationOutRecordMin> applicationOutRecordMinByParent = depositoryRecordMapper.findApplicationOutRecordMinByParent(recordP.getId()); |
|
|
|
List<Depository> depositoryAll = depositoryMapper.findDepositoryAll(); |
|
|
|
for (ApplicationOutRecordMin applicationOutRecordMin : applicationOutRecordMinByParent) { |
|
|
|
// 获取子单信息
|
|
|
|
// 获取对应的物料编号
|
|
|
|
Integer mid = applicationOutRecordMin.getMid(); |
|
|
|
// 获取物料信息
|
|
|
|
Inventory materialById = materialMapper.findInventoryById(mid); |
|
|
|
// 获取当前仓库下的子订单
|
|
|
|
Long materialTypeId = materialById.getMaterialTypeId(); |
|
|
|
Inventory inventory = materialMapper.findInventoryById(mid); |
|
|
|
|
|
|
|
//设置子订单在redis中的主键
|
|
|
|
String minRecordKey = "minRecord:" + applicationOutRecordMin.getId(); |
|
|
|
minRecordByMain.insert(1, minRecordKey + ","); // 将子订单主键插入到主订单的子订单列表
|
|
|
|
// 设置当前子订单对应仓库管理员记录
|
|
|
|
StringBuilder minRecordManage = new StringBuilder(); |
|
|
|
// 将要存储到redis中的子订单信息
|
|
|
|
Map<String, Object> minRecord = new HashMap<>(); |
|
|
|
minRecord.put("parentId", recordP.getId().toString()); // 当前子订单主订单
|
|
|
|
minRecord.put("state", "1"); // 当前子订单状态 1待处理2处理
|
|
|
|
|
|
|
|
|
|
|
|
// 获取出库仓库
|
|
|
|
Integer depositoryId = applicationOutRecordMin.getDepositoryId(); |
|
|
|
Depository depositoryById = depositoryMapper.findDepositoryById(depositoryId); |
|
|
|
// 用于标志出库人员通过物料类型还说仓库获取 // 默认是仓库
|
|
|
|
boolean flagForMtOrDepository = true; |
|
|
|
Depository parentDepository = findParentDepository(depositoryById, depositoryAll); |
|
|
|
if (!parentDepository.getDname().contains("前置仓")) { |
|
|
|
// 如果不是前置仓下的仓库
|
|
|
|
flagForMtOrDepository = false; |
|
|
|
} |
|
|
|
|
|
|
|
if (!flagForMtOrDepository) { |
|
|
|
// 如果是通过类型
|
|
|
|
|
|
|
|
// 获取具体物料类型
|
|
|
|
Long materialTypeId = inventory.getMaterialTypeId(); |
|
|
|
if (!findThisIdIsExistForMaterialType(materialTypeIdList, materialTypeId)) { |
|
|
|
// 如果当前仓库id没有存入过
|
|
|
|
materialTypeIdList.add(materialTypeId); |
|
|
|
@ -3385,19 +3432,10 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
// 将当前子订单添加到该仓库下的子订单列表中
|
|
|
|
minIdList.add(applicationOutRecordMin.getId()); |
|
|
|
minIdByMaterialType.put("materialType" + materialTypeId, minIdList); |
|
|
|
//设置子订单在redis中的主键
|
|
|
|
String minRecordKey = "minRecord:" + applicationOutRecordMin.getId(); |
|
|
|
minRecordByMain.insert(1, minRecordKey + ","); // 将子订单主键插入到主订单的子订单列表
|
|
|
|
// 设置当前子订单对应仓库管理员记录
|
|
|
|
StringBuilder minRecordManage = new StringBuilder(); |
|
|
|
// 将要存储到redis中的子订单信息
|
|
|
|
Map<String, Object> minRecord = new HashMap<>(); |
|
|
|
minRecord.put("parentId", recordP.getId().toString()); // 当前子订单主订单
|
|
|
|
minRecord.put("state", "1"); // 当前子订单状态 1待处理2处理
|
|
|
|
|
|
|
|
// 获取该物料所处仓库的仓库管理员
|
|
|
|
List<Integer> userIdByDid = new ArrayList<>(); |
|
|
|
userIdByDid = roleService.findUserIdByMtId(materialById.getMaterialTypeId()); |
|
|
|
userIdByDid = roleService.findUserIdByMtId(inventory.getMaterialTypeId()); |
|
|
|
StringBuilder QyWxUid = new StringBuilder(); |
|
|
|
for (Integer integer : userIdByDid) { |
|
|
|
// 获取仓库管理员信息
|
|
|
|
@ -3431,6 +3469,60 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent, userKey, token); |
|
|
|
}); |
|
|
|
} |
|
|
|
else { |
|
|
|
// 如果是通过仓库
|
|
|
|
|
|
|
|
|
|
|
|
if (!findThisIdIsExistForDepository(depositoryIdList, depositoryId)) { |
|
|
|
// 如果当前仓库id没有存入过
|
|
|
|
depositoryIdList.add(depositoryId); |
|
|
|
} |
|
|
|
List<Integer> minIdList = new ArrayList<>(); |
|
|
|
Object o = minIdByMaterialType.get("depository" + depositoryId); |
|
|
|
if (o != null) { |
|
|
|
minIdList = (List<Integer>) o; |
|
|
|
} |
|
|
|
// 将当前子订单添加到该仓库下的子订单列表中
|
|
|
|
minIdList.add(applicationOutRecordMin.getId()); |
|
|
|
minIdByMaterialType.put("depository" + depositoryId, minIdList); |
|
|
|
|
|
|
|
// 获取该物料所处仓库的仓库管理员
|
|
|
|
List<Integer> userIdByDid = new ArrayList<>(); |
|
|
|
userIdByDid = roleService.findUserIdByDid(depositoryId); |
|
|
|
StringBuilder QyWxUid = new StringBuilder(); |
|
|
|
for (Integer integer : userIdByDid) { |
|
|
|
// 获取仓库管理员信息
|
|
|
|
UserByPort manager = LinkInterfaceUtil.FindUserById(integer, userKey, token); |
|
|
|
// 仓库管理员订单信息
|
|
|
|
Map<String, Object> userRecord = new HashMap<>(); |
|
|
|
// 用户当前子订单
|
|
|
|
String userMinRecord = (String) redisPool.getRedisTemplateByDb(15).opsForHash().get("user:" + integer, "minRecord"); |
|
|
|
if (userMinRecord == null) { // 如果当前用户没有子订单
|
|
|
|
userRecord.put("minRecord", "[" + minRecordKey + "," + "]"); // 插入一条子订单
|
|
|
|
} else { // 如果当前用户已经有子订单
|
|
|
|
StringBuilder minRecordList = new StringBuilder(userMinRecord); // 转为stringbuilder类型
|
|
|
|
minRecordList.insert(1, minRecordKey + ",");// 将当前子订单插入头部
|
|
|
|
userRecord.put("minRecord", minRecordList.toString()); |
|
|
|
} |
|
|
|
// 更新redis中用户记录
|
|
|
|
redisPool.getRedisTemplateByDb(15).opsForHash().putAll("user:" + integer, userRecord); |
|
|
|
minRecordManage.append(integer).append(","); |
|
|
|
String workwechat = manager.getWorkwechat(); |
|
|
|
if (workwechat == null || "".equals(workwechat)) { |
|
|
|
workwechat = manager.getWechat(); |
|
|
|
} |
|
|
|
// QyWxUid.append(workwechat+",");
|
|
|
|
} |
|
|
|
QyWxUid.append("PangFuZhen,"); |
|
|
|
minRecord.put("manager", minRecordManage.toString()); |
|
|
|
// 添加子订单到redis中
|
|
|
|
redisPool.getRedisTemplateByDb(15).opsForHash().putAll(minRecordKey, minRecord); |
|
|
|
// 开启线程向仓库管理员发送消息
|
|
|
|
SendQyWxMessageThreadPool.execute(() -> { |
|
|
|
JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent, userKey, token); |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// 将主订单插入到redis中
|
|
|
|
redisPool.getRedisTemplateByDb(15).opsForHash().put("record:" + recordP.getId(), "minRecord", minRecordByMain.toString()); |
|
|
|
|