|
|
@ -2248,9 +2248,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
Integer outId = ObjectFormatUtil.toInteger(mainId); |
|
|
Integer outId = ObjectFormatUtil.toInteger(mainId); |
|
|
// 获取对应的出库订单
|
|
|
// 获取对应的出库订单
|
|
|
ApplicationOutRecord recordP = depositoryRecordMapper.findApplicationOutRecordPById(outId); |
|
|
ApplicationOutRecord recordP = depositoryRecordMapper.findApplicationOutRecordPById(outId); |
|
|
|
|
|
// 获取当前出库的仓库是否为开放仓库
|
|
|
// 获取当前审批所在部门
|
|
|
int flagForOpenDepository = recordP.getFlagForOpenDepository(); |
|
|
|
|
|
|
|
|
if (!flagForFirst) { |
|
|
if (!flagForFirst) { |
|
|
|
|
|
|
|
|
String depositoryManagerTime = recordP.getDepositoryManagerTime(); |
|
|
String depositoryManagerTime = recordP.getDepositoryManagerTime(); |
|
|
@ -2266,6 +2265,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
|
|
|
|
|
|
// 获取部门负责人审批时间
|
|
|
// 获取部门负责人审批时间
|
|
|
String departmentheadTime = recordP.getDepartmentheadTime(); |
|
|
String departmentheadTime = recordP.getDepartmentheadTime(); |
|
|
|
|
|
|
|
|
// 定义标志位为部门负责人已经审批
|
|
|
// 定义标志位为部门负责人已经审批
|
|
|
boolean flagForDepartmentHeadPass = false; |
|
|
boolean flagForDepartmentHeadPass = false; |
|
|
if ("0".equals(departmentheadTime)) { |
|
|
if ("0".equals(departmentheadTime)) { |
|
|
@ -2284,8 +2284,6 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
// 定义类型列表
|
|
|
// 定义类型列表
|
|
|
List<Long> materialTypeIdList = new ArrayList<>(); |
|
|
List<Long> materialTypeIdList = new ArrayList<>(); |
|
|
|
|
|
|
|
|
// 根据仓库分类明细
|
|
|
|
|
|
Map<String, Object> minIdByDepository = new HashMap<>(); |
|
|
|
|
|
// 定义类型列表
|
|
|
// 定义类型列表
|
|
|
List<Integer> depositoryIdList = new ArrayList<>(); |
|
|
List<Integer> depositoryIdList = new ArrayList<>(); |
|
|
// 获取所有详情
|
|
|
// 获取所有详情
|
|
|
@ -2483,7 +2481,6 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
// 如果点击的是通过
|
|
|
// 如果点击的是通过
|
|
|
map.put("departmentheadPass", 1); |
|
|
map.put("departmentheadPass", 1); |
|
|
map.put("state", "待仓储中心负责人审核"); |
|
|
map.put("state", "待仓储中心负责人审核"); |
|
|
|
|
|
|
|
|
// 获取仓储中心负责人标签的用户userId
|
|
|
// 获取仓储中心负责人标签的用户userId
|
|
|
List<String> qyWxLabelUserList = QyWxConfig.getQyWxLabelUserList(userAgent); |
|
|
List<String> qyWxLabelUserList = QyWxConfig.getQyWxLabelUserList(userAgent); |
|
|
StringBuilder depositoryManager = new StringBuilder(); |
|
|
StringBuilder depositoryManager = new StringBuilder(); |
|
|
@ -2492,6 +2489,28 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
UserByPort user = (UserByPort) userByQyWxUserId.get("user"); |
|
|
UserByPort user = (UserByPort) userByQyWxUserId.get("user"); |
|
|
depositoryManager.append(user.getId()).append(","); |
|
|
depositoryManager.append(user.getId()).append(","); |
|
|
} |
|
|
} |
|
|
|
|
|
if (flagForOpenDepository == 2) { |
|
|
|
|
|
map.put("state", "待部门负责人审核"); |
|
|
|
|
|
depositoryManager = new StringBuilder(); |
|
|
|
|
|
// 获取当前选中的仓库
|
|
|
|
|
|
Depository depositoryById = depositoryMapper.findDepositoryById(recordP.getDepositoryId()); |
|
|
|
|
|
// 获取当前仓库所属的部门
|
|
|
|
|
|
String adminorg = depositoryById.getAdminorg(); |
|
|
|
|
|
// 获取当前部门id对应的企业微信id
|
|
|
|
|
|
JSONObject portByQyWx = PortConfig.getUserPortByQyWx(ObjectFormatUtil.toInteger(adminorg)); |
|
|
|
|
|
Integer wechatorganizationid = portByQyWx.getInteger("wechatorganizationid"); |
|
|
|
|
|
|
|
|
|
|
|
// 获取当前部门信息
|
|
|
|
|
|
qywxDepartment wxDepartment = QyWxConfig.getQyWxDepartment(userAgent, wechatorganizationid); |
|
|
|
|
|
// 获取部门负责人id列表
|
|
|
|
|
|
List<String> otherDepartmentIdList = new ArrayList<>(wxDepartment.getDepartment_leader()); |
|
|
|
|
|
for (String s : otherDepartmentIdList) { |
|
|
|
|
|
Map<String, Object> userByQyWxUserId = PortConfig.findUserByQyWxUserId(s); |
|
|
|
|
|
UserByPort user = (UserByPort) userByQyWxUserId.get("user"); |
|
|
|
|
|
depositoryManager.append(user.getId()).append(","); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
map.put("depositoryManager", depositoryManager.toString()); |
|
|
map.put("depositoryManager", depositoryManager.toString()); |
|
|
} else { |
|
|
} else { |
|
|
// 如果点击的是驳回
|
|
|
// 如果点击的是驳回
|
|
|
@ -2824,7 +2843,18 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
map.remove("id"); |
|
|
map.remove("id"); |
|
|
|
|
|
|
|
|
List<ApplicationOutRecordMin> minByParent = depositoryRecordMapper.findApplicationOutRecordMinByParent(record.getId()); |
|
|
List<ApplicationOutRecordMin> minByParent = depositoryRecordMapper.findApplicationOutRecordMinByParent(record.getId()); |
|
|
boolean flagForHasOtherDepository = true; |
|
|
// 获取申请用户
|
|
|
|
|
|
UserByPort applicantUser = LinkInterfaceUtil.FindUserById(record.getApplicantId(), userToken); |
|
|
|
|
|
// 用于标志该仓库是否为前置仓下的仓库
|
|
|
|
|
|
boolean flagForHasOtherDepository = true; //默认是前置仓下的仓库
|
|
|
|
|
|
// 获取当前出库是否为开放出库
|
|
|
|
|
|
int flagForOpenDepository = record.getFlagForOpenDepository(); |
|
|
|
|
|
if (flagForOpenDepository != 1) { |
|
|
|
|
|
|
|
|
|
|
|
// 如果是开放仓库
|
|
|
|
|
|
flagForHasOtherDepository = false; |
|
|
|
|
|
} else { |
|
|
|
|
|
// 如果不是
|
|
|
for (ApplicationOutRecordMin min : minByParent |
|
|
for (ApplicationOutRecordMin min : minByParent |
|
|
) { |
|
|
) { |
|
|
Depository depositoryById = depositoryMapper.findDepositoryById(min.getDepositoryId()); |
|
|
Depository depositoryById = depositoryMapper.findDepositoryById(min.getDepositoryId()); |
|
|
@ -2839,10 +2869,11 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
flagForHasOtherDepository = false; |
|
|
flagForHasOtherDepository = false; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
UserByPort applicantUser = LinkInterfaceUtil.FindUserById(record.getApplicantId(), userToken); |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (map.containsKey("departmentheadPass") && !flagForHasOtherDepository) { |
|
|
|
|
|
// 如果是第一位部门负责人审批且可进入该流程
|
|
|
|
|
|
|
|
|
if (map.containsKey("departmentheadPass") && !flagForHasOtherDepository && Integer.compare(applicantUser.getMaindeparment(), 361) != 0) { |
|
|
|
|
|
String result = ""; |
|
|
String result = ""; |
|
|
String simpleTime = DateUtil.getSimpleTime(new Date()); |
|
|
String simpleTime = DateUtil.getSimpleTime(new Date()); |
|
|
map.put("departmentheadTime", DateUtil.DateTimeToTimeStamp(simpleTime)); |
|
|
map.put("departmentheadTime", DateUtil.DateTimeToTimeStamp(simpleTime)); |
|
|
@ -2851,24 +2882,59 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
if (departmentheadPass == 1) { |
|
|
if (departmentheadPass == 1) { |
|
|
result = "通过"; |
|
|
result = "通过"; |
|
|
map.put("state", "待仓储中心负责人审核"); |
|
|
map.put("state", "待仓储中心负责人审核"); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 用于存储下节点审批人id
|
|
|
|
|
|
StringBuilder depositoryManager = new StringBuilder(); |
|
|
|
|
|
// 用于存储下节点审批人的企业微信id
|
|
|
|
|
|
StringBuilder QyWxUid = new StringBuilder(); |
|
|
|
|
|
if(flagForOpenDepository == 2){ |
|
|
|
|
|
// 如果是开放仓库
|
|
|
|
|
|
map.put("state","待部门负责人审核"); |
|
|
|
|
|
|
|
|
|
|
|
// 获取当前选中的仓库
|
|
|
|
|
|
Depository depositoryById = depositoryMapper.findDepositoryById(record.getDepositoryId()); |
|
|
|
|
|
// 获取当前仓库所属的部门
|
|
|
|
|
|
String adminorg = depositoryById.getAdminorg(); |
|
|
|
|
|
// 获取当前部门id对应的企业微信id
|
|
|
|
|
|
JSONObject portByQyWx = PortConfig.getUserPortByQyWx(ObjectFormatUtil.toInteger(adminorg)); |
|
|
|
|
|
Integer wechatorganizationid = portByQyWx.getInteger("wechatorganizationid"); |
|
|
|
|
|
|
|
|
|
|
|
// 获取当前部门信息
|
|
|
|
|
|
qywxDepartment wxDepartment = QyWxConfig.getQyWxDepartment(userAgent, wechatorganizationid); |
|
|
|
|
|
// 获取部门负责人企业微信id列表
|
|
|
|
|
|
List<String> otherDepartmentIdList = new ArrayList<>(wxDepartment.getDepartment_leader()); |
|
|
|
|
|
for (String s:otherDepartmentIdList |
|
|
|
|
|
) { |
|
|
|
|
|
Map<String, Object> userByQyWxUserId = PortConfig.findUserByQyWxUserId(s); |
|
|
|
|
|
UserByPort otherDepartment = (UserByPort) userByQyWxUserId.get("user"); |
|
|
|
|
|
QyWxUid.append(s).append(","); |
|
|
|
|
|
depositoryManager.append(otherDepartment.getId()).append(","); |
|
|
|
|
|
} |
|
|
|
|
|
}else{ |
|
|
|
|
|
// 如果是正常仓库
|
|
|
|
|
|
|
|
|
// 获取仓储中心详情
|
|
|
// 获取仓储中心详情
|
|
|
Administration company = LinkInterfaceUtil.getCompany(361, userToken); |
|
|
Administration company = LinkInterfaceUtil.getCompany(361, userToken); |
|
|
|
|
|
|
|
|
// 获取仓储中心负责人
|
|
|
// 获取仓储中心负责人
|
|
|
List<UserByPort> departmentHeadByUser = PortConfig.findDepartmentHeadByUser(company, userToken); |
|
|
List<UserByPort> departmentHeadByUser = PortConfig.findDepartmentHeadByUser(company, userToken); |
|
|
StringBuilder depositoryManager = new StringBuilder(); |
|
|
|
|
|
StringBuilder QyWxUid = new StringBuilder(); |
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < departmentHeadByUser.size(); i++) { |
|
|
for (UserByPort userByPort : departmentHeadByUser) { |
|
|
depositoryManager.append(departmentHeadByUser.get(i).getId() + ","); |
|
|
depositoryManager.append(userByPort.getId()).append(","); |
|
|
String workwechat = departmentHeadByUser.get(i).getWorkwechat(); |
|
|
String workwechat = userByPort.getWorkwechat(); |
|
|
if (workwechat == null || "".equals(workwechat)) { |
|
|
if (workwechat == null || "".equals(workwechat)) { |
|
|
workwechat = departmentHeadByUser.get(i).getWechat(); |
|
|
workwechat = userByPort.getWechat(); |
|
|
|
|
|
} |
|
|
|
|
|
QyWxUid.append(workwechat).append(","); |
|
|
} |
|
|
} |
|
|
QyWxUid.append(workwechat + ","); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
QyWxUid.append("PangFuZhen,"); |
|
|
QyWxUid.append("PangFuZhen,"); |
|
|
map.put("depositoryManager", depositoryManager.toString()); |
|
|
map.put("depositoryManager", depositoryManager.toString()); |
|
|
// 向仓储中心负责人发送新的消息
|
|
|
// 向仓储中心负责人发送新的消息
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
new Thread(new Runnable() { |
|
|
new Thread(new Runnable() { |
|
|
@Override |
|
|
@Override |
|
|
public void run() { |
|
|
public void run() { |
|
|
@ -2931,7 +2997,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
qyWxOperationService.sendMessageForOtherUserByCard(ObjectFormatUtil.toInteger(id), s, userAgent, 1); |
|
|
qyWxOperationService.sendMessageForOtherUserByCard(ObjectFormatUtil.toInteger(id), s, userAgent, 1); |
|
|
} |
|
|
} |
|
|
}).start(); |
|
|
}).start(); |
|
|
} else { |
|
|
} |
|
|
|
|
|
else { |
|
|
String result = ""; |
|
|
String result = ""; |
|
|
// 开启线程更改其他用户卡片模板样式
|
|
|
// 开启线程更改其他用户卡片模板样式
|
|
|
String simpleTime = DateUtil.getSimpleTime(new Date()); |
|
|
String simpleTime = DateUtil.getSimpleTime(new Date()); |
|
|
@ -2940,8 +3007,6 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
map.put("depositoryId", record.getDepositoryId()); |
|
|
map.put("depositoryId", record.getDepositoryId()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// map.put("mid", record.getMid());
|
|
|
|
|
|
// Material material = materialMapper.findMaterialById(record.getMid());
|
|
|
|
|
|
Integer depositoryManagerPass = (Integer) map.get("depositoryManagerPass"); |
|
|
Integer depositoryManagerPass = (Integer) map.get("depositoryManagerPass"); |
|
|
if (depositoryManagerPass == null) { |
|
|
if (depositoryManagerPass == null) { |
|
|
depositoryManagerPass = (Integer) map.get("departmentheadPass"); |
|
|
depositoryManagerPass = (Integer) map.get("departmentheadPass"); |
|
|
@ -2962,8 +3027,6 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
// 定义仓库列表
|
|
|
// 定义仓库列表
|
|
|
List<Long> materialTypeIdList = new ArrayList<>(); |
|
|
List<Long> materialTypeIdList = new ArrayList<>(); |
|
|
|
|
|
|
|
|
// 根据仓库分类明细
|
|
|
|
|
|
Map<String, Object> minIdByDepository = new HashMap<>(); |
|
|
|
|
|
// 定义类型列表
|
|
|
// 定义类型列表
|
|
|
List<Integer> depositoryIdList = new ArrayList<>(); |
|
|
List<Integer> depositoryIdList = new ArrayList<>(); |
|
|
StringBuilder minRecordByMain = new StringBuilder("[]"); |
|
|
StringBuilder minRecordByMain = new StringBuilder("[]"); |
|
|
@ -3001,7 +3064,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
if (!flagForMtOrDepository) { |
|
|
if (!flagForMtOrDepository) { |
|
|
// 如果是通过类型
|
|
|
// 如果是通过类型
|
|
|
|
|
|
|
|
|
// 获取当前仓库下的子订单
|
|
|
// 获取具体物料类型
|
|
|
Long materialTypeId = inventory.getMaterialTypeId(); |
|
|
Long materialTypeId = inventory.getMaterialTypeId(); |
|
|
if (!findThisIdIsExistForMaterialType(materialTypeIdList, materialTypeId)) { |
|
|
if (!findThisIdIsExistForMaterialType(materialTypeIdList, materialTypeId)) { |
|
|
// 如果当前仓库id没有存入过
|
|
|
// 如果当前仓库id没有存入过
|
|
|
@ -3054,7 +3117,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent); |
|
|
JSONObject jsonObject = qyWxOperationService.sendNotificationToDepositoryManager(QyWxUid.toString(), applicationOutRecordMin.getId(), userAgent); |
|
|
} |
|
|
} |
|
|
}).start(); |
|
|
}).start(); |
|
|
} else { |
|
|
} |
|
|
|
|
|
else { |
|
|
// 如果是通过仓库
|
|
|
// 如果是通过仓库
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -3120,8 +3184,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
String depositoryManager = record.getDepositoryManager(); |
|
|
String depositoryManager = record.getDepositoryManager(); |
|
|
String[] split = depositoryManager.split(","); |
|
|
String[] split = depositoryManager.split(","); |
|
|
StringBuilder QyWxUid = new StringBuilder(); |
|
|
StringBuilder QyWxUid = new StringBuilder(); |
|
|
for (int i = 0; i < split.length; i++) { |
|
|
for (String s : split) { |
|
|
String s = split[i]; |
|
|
|
|
|
if ("".equals(s)) { |
|
|
if ("".equals(s)) { |
|
|
continue; |
|
|
continue; |
|
|
} |
|
|
} |
|
|
@ -3142,7 +3205,7 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
redisTemplate.opsForHash().put("record:" + record.getId(), "minRecord", minRecordByMain.toString()); |
|
|
redisTemplate.opsForHash().put("record:" + record.getId(), "minRecord", minRecordByMain.toString()); |
|
|
map.put("state", "仓储中心负责人审核通过"); |
|
|
map.put("state", "仓储中心负责人审核通过"); |
|
|
|
|
|
|
|
|
if (flagFordepartmentTime) { |
|
|
if (flagFordepartmentTime || flagForOpenDepository == 2) { |
|
|
map.put("state", "部门负责人审核通过"); |
|
|
map.put("state", "部门负责人审核通过"); |
|
|
map.put("departmentheadTime", DateUtil.DateTimeToTimeStamp(simpleTime)); |
|
|
map.put("departmentheadTime", DateUtil.DateTimeToTimeStamp(simpleTime)); |
|
|
map.put("depositoryManagerPass", 4); |
|
|
map.put("depositoryManagerPass", 4); |
|
|
@ -3150,7 +3213,8 @@ public class DepositoryRecordServiceImpl implements DepositoryRecordService { |
|
|
map.put("departmentheadPass", 1); |
|
|
map.put("departmentheadPass", 1); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
} else { |
|
|
} |
|
|
|
|
|
else { |
|
|
updateInventoryForOutRefused(record); |
|
|
updateInventoryForOutRefused(record); |
|
|
result = "驳回"; |
|
|
result = "驳回"; |
|
|
map.put("pass", 2); |
|
|
map.put("pass", 2); |
|
|
|