|
|
|
@ -2171,6 +2171,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
// 设置新库位
|
|
|
|
applicationOutMinById.setPlaceId(placeId); |
|
|
|
|
|
|
|
applicationOutMinById.setCompleteOutTime(""+System.currentTimeMillis()); |
|
|
|
// 修改子订单
|
|
|
|
depositoryRecordMapper.updateApplicationOutRecordMin(applicationOutMinById); |
|
|
|
|
|
|
|
@ -2273,12 +2274,14 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
// 获取当前出库的仓库是否为开放仓库
|
|
|
|
int flagForOpenDepository = recordP.getFlagForOpenDepository(); |
|
|
|
if (!flagForFirst) { |
|
|
|
// 如果不是第一个审批节点
|
|
|
|
|
|
|
|
// 获取审批时间
|
|
|
|
String depositoryManagerTime = recordP.getDepositoryManagerTime(); |
|
|
|
if ("0".equals(depositoryManagerTime)) { |
|
|
|
// 如果当前申请没有处理
|
|
|
|
|
|
|
|
flag = false; |
|
|
|
// 如果点击的是通过
|
|
|
|
String simpleTime = DateUtil.getSimpleTime(new Date()); |
|
|
|
map.put("depositoryManagerTime", DateUtil.DateTimeToTimeStamp(simpleTime)); |
|
|
|
map.put("depositoryManager", userByPort.getId()); |
|
|
|
@ -2287,7 +2290,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
// 获取部门负责人审批时间
|
|
|
|
String departmentheadTime = recordP.getDepartmentheadTime(); |
|
|
|
|
|
|
|
// 定义标志位为部门负责人已经审批
|
|
|
|
// 声明标志位,部门负责人是否已经审批(默认已经审批)
|
|
|
|
boolean flagForDepartmentHeadPass = false; |
|
|
|
if ("0".equals(departmentheadTime)) { |
|
|
|
// 如果没有审批
|
|
|
|
@ -2297,17 +2300,17 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
if ("2".equals(spStatus)) { |
|
|
|
// 如果点击的是通过
|
|
|
|
map.put("depositoryManagerPass", 1); |
|
|
|
|
|
|
|
// 声明子单的stringbuilder
|
|
|
|
StringBuilder minRecordByMain = new StringBuilder("[]"); |
|
|
|
|
|
|
|
// 根据物料类型分类明细
|
|
|
|
Map<String, Object> minIdByMaterialType = new HashMap<>(); |
|
|
|
|
|
|
|
// 定义类型列表
|
|
|
|
List<Long> materialTypeIdList = new ArrayList<>(); |
|
|
|
|
|
|
|
// 定义仓库列表
|
|
|
|
List<Integer> depositoryIdList = new ArrayList<>(); |
|
|
|
|
|
|
|
// 遍历子单给对应的出库人员发送出库通知
|
|
|
|
for (ApplicationOutRecordMin applicationOutRecordMin : applicationOutRecordMinByParent) { |
|
|
|
// 获取子单信息
|
|
|
|
|
|
|
|
@ -2322,13 +2325,13 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
// 获取出库仓库
|
|
|
|
Integer depositoryId = applicationOutRecordMin.getDepositoryId(); |
|
|
|
Depository depositoryById = depositoryMapper.findDepositoryById(depositoryId); |
|
|
|
// 获取当前仓库的顶级父仓库
|
|
|
|
Depository parentDepository = findParentDepository(depositoryById, depositoryAll); |
|
|
|
if (!parentDepository.getDname().contains("前置仓")) { |
|
|
|
// 如果不是前置仓下的仓库
|
|
|
|
flagForMtOrDepository = false; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//设置子订单在redis中的主键
|
|
|
|
String minRecordKey = "minRecord:" + applicationOutRecordMin.getId(); |
|
|
|
// 将子订单主键插入到主订单的子订单列表
|
|
|
|
@ -2344,42 +2347,40 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
if (!flagForMtOrDepository) { |
|
|
|
// 如果是通过类型
|
|
|
|
|
|
|
|
// 声明要进行出库的人员企业微信id
|
|
|
|
StringBuilder QyWxUid = new StringBuilder(); |
|
|
|
|
|
|
|
// 获取当前仓库下的子订单
|
|
|
|
// 获取当前出库物料的类型id
|
|
|
|
Long materialTypeId = inventory.getMaterialTypeId(); |
|
|
|
if (!findThisIdIsExistForMaterialType(materialTypeIdList, materialTypeId)) { |
|
|
|
// 如果当前仓库id没有存入过
|
|
|
|
materialTypeIdList.add(materialTypeId); |
|
|
|
} |
|
|
|
List<Integer> minIdList = new ArrayList<>(); |
|
|
|
Object o = minIdByMaterialType.get("materialType" + materialTypeId); |
|
|
|
if (o != null) { |
|
|
|
minIdList = (List<Integer>) o; |
|
|
|
} |
|
|
|
// 将当前子订单添加到该仓库下的子订单列表中
|
|
|
|
minIdList.add(applicationOutRecordMin.getId()); |
|
|
|
minIdByMaterialType.put("materialType" + materialTypeId, minIdList); |
|
|
|
|
|
|
|
// 获取该物料所处类型的管理员
|
|
|
|
List<Integer> userIdByDid = new ArrayList<>(); |
|
|
|
List<Integer> userIdByMtId = new ArrayList<>(); |
|
|
|
|
|
|
|
// 用于查询对应的管理员权限
|
|
|
|
Map<String, Object> paramForUserManager = new HashMap<>(); |
|
|
|
paramForUserManager.put("mtid", materialTypeId); |
|
|
|
|
|
|
|
// 获取当前类型的管理记录
|
|
|
|
List<RoleAndMaterialType> roleAndMaterialTypeByCondition = roleService.findRoleAndMaterialTypeByCondition(paramForUserManager); |
|
|
|
for (RoleAndMaterialType roleAndMaterialType : roleAndMaterialTypeByCondition) { |
|
|
|
// 获取当前记录类型(1是人2是岗位)
|
|
|
|
int classes = roleAndMaterialType.getClasses(); |
|
|
|
if (classes == 1) { |
|
|
|
// 如果是对人设置的权限
|
|
|
|
userIdByDid.add(roleAndMaterialType.getUid()); |
|
|
|
userIdByMtId.add(roleAndMaterialType.getUid()); |
|
|
|
} else { |
|
|
|
// 如果是对岗位
|
|
|
|
|
|
|
|
// 定义用于获取当前岗位下的人的参数map
|
|
|
|
Map<String, Object> paramForGetUserByPost = new HashMap<>(); |
|
|
|
paramForGetUserByPost.put("position", roleAndMaterialType.getUid()); |
|
|
|
// 获取当前岗位对应的人员
|
|
|
|
List<UserByPort> userByPortList = PublicConfig.FindUserByMap(paramForGetUserByPost, userKey, token); |
|
|
|
for (UserByPort userByPort1 : userByPortList) { |
|
|
|
Integer userId1 = userByPort1.getId(); |
|
|
|
@ -2396,8 +2397,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
for (Integer integer : userIdByDid) { |
|
|
|
// 将没有插入的用户进行插入
|
|
|
|
for (Integer integer : userIdByMtId) { |
|
|
|
// 获取仓库管理员信息
|
|
|
|
UserByPort manager = PublicConfig.FindUserById(integer, userKey, token); |
|
|
|
updateRedisDataForUserManager(integer, minRecordKey); |
|
|
|
@ -2409,6 +2410,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
// QyWxUid.append(workwechat+",");
|
|
|
|
} |
|
|
|
QyWxUid.append("PangFuZhen,"); |
|
|
|
// 将当前子单的管理员插入到子单记录中
|
|
|
|
minRecord.put("manager", minRecordManage.toString()); |
|
|
|
// 添加子订单到redis中
|
|
|
|
redisPool.getRedisTemplateByDb(15).opsForHash().putAll(minRecordKey, minRecord); |
|
|
|
@ -2423,21 +2425,15 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
} else { |
|
|
|
// 如果是通过仓库
|
|
|
|
|
|
|
|
|
|
|
|
// 声明要发送的企业微信uid记录
|
|
|
|
StringBuilder QyWxUid = new StringBuilder(); |
|
|
|
|
|
|
|
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<>(); |
|
|
|
@ -2445,9 +2441,10 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
// 用于查询对应的管理员权限
|
|
|
|
Map<String, Object> paramForUserManager = new HashMap<>(); |
|
|
|
paramForUserManager.put("depositoryId", depositoryId); |
|
|
|
|
|
|
|
// 获取当前仓库的管理记录
|
|
|
|
List<RoleAndDepository> roleAndDepositoryByCondition = roleService.findRoleAndDepositoryByCondition(paramForUserManager); |
|
|
|
for (RoleAndDepository roleAndDepository : roleAndDepositoryByCondition) { |
|
|
|
// 获取当前管理记录的类型(1人2岗位)
|
|
|
|
int classes = roleAndDepository.getClasses(); |
|
|
|
if (classes == 1) { |
|
|
|
// 如果是对人设置的权限
|
|
|
|
@ -2508,8 +2505,9 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
// 将主订单插入到redis中
|
|
|
|
redisPool.getRedisTemplateByDb(15).opsForHash().put("record:" + recordP.getId(), "minRecord", minRecordByMain.toString()); |
|
|
|
map.put("state", userByPort.getName() + "审核通过"); |
|
|
|
if (flagForDepartmentHeadPass || flagForOpenDepository == 2) { |
|
|
|
map.put("state", userByPort.getName() + "审核通过"); |
|
|
|
// if (flagForDepartmentHeadPass || flagForOpenDepository == 2) {
|
|
|
|
if (flagForDepartmentHeadPass) { |
|
|
|
// 如果前一个节点没有进行审批
|
|
|
|
map.put("depositoryManagerPass", 4); |
|
|
|
if ("0".equals(departmentheadTime)) { |
|
|
|
map.put("departmenthead", userByPort.getId()); |
|
|
|
@ -2524,11 +2522,10 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
map.put("depositoryManagerPass", 2); |
|
|
|
map.put("pass", 2); |
|
|
|
map.put("state", userByPort.getName() + "审核未通过"); |
|
|
|
if (flagForDepartmentHeadPass || flagForOpenDepository == 2) { |
|
|
|
map.put("state", userByPort.getName() + "审核未通过"); |
|
|
|
// if (flagForDepartmentHeadPass || flagForOpenDepository == 2) {
|
|
|
|
if (flagForDepartmentHeadPass) { |
|
|
|
map.put("depositoryManagerPass", 4); |
|
|
|
if ("0".equals(departmentheadTime)) { |
|
|
|
|
|
|
|
map.put("departmentheadPass", 2); |
|
|
|
map.put("departmentheadTime", DateUtil.DateTimeToTimeStamp(simpleTime)); |
|
|
|
map.put("departmenthead", userByPort.getId()); |
|
|
|
@ -2538,8 +2535,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
// 将当前redis中存储的spno删除
|
|
|
|
redisPool.getRedisTemplateByDb(14).delete("wms_QyWxMessage_" + spNo); |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
} else { |
|
|
|
// 如果是前两个审批节点
|
|
|
|
|
|
|
|
//定义处理时间
|
|
|
|
|