|
@@ -1318,6 +1318,22 @@ public class PlanServiceImpl extends ServiceImpl<PlanMapper, Plan> implements Pl
|
|
|
}
|
|
|
boolean update = planProcedureTotalService.update(new UpdateWrapper<PlanProcedureTotal>().set("station_id", stationId).set("is_transfer", 1).in("id", collect));
|
|
|
//todo 发送改派通知
|
|
|
+ if (update){
|
|
|
+ List<User> userList = userMapper.selectList(new QueryWrapper<User>().eq("department_id", stationId).eq("work_type", "工位长"));
|
|
|
+ List<ProdProcedure> procedureList = prodProcedureMapper.selectList(new QueryWrapper<ProdProcedure>().in("id", totalList.stream().map(PlanProcedureTotal::getProdProcedureId)));
|
|
|
+ String procedureNames = procedureList.stream().map(ProdProcedure::getName).collect(Collectors.joining("|"));
|
|
|
+ if (!userList.isEmpty()){
|
|
|
+ List<WxCorpInfo> wxCorpInfoList = wxCorpInfoService.list(new QueryWrapper<WxCorpInfo>().eq("company_id", user.getCompanyId()));
|
|
|
+ if(!wxCorpInfoList.isEmpty()){
|
|
|
+ WxCorpInfo wxCorpInfo = wxCorpInfoList.get(0);
|
|
|
+ String userIds = userList.stream().map(User::getCorpwxRealUserid).collect(Collectors.joining("|"));
|
|
|
+ StringBuilder stringBuilder=new StringBuilder();
|
|
|
+ stringBuilder.append("工序名称:"+procedureNames+"\n"
|
|
|
+ +" 排产工单号:"+plan.getProductSchedulingNum()+"转派");
|
|
|
+ wxCorpInfoService.sendWXCorpTemplateMsgWithPLan(wxCorpInfo,userIds,stringBuilder.toString(),"plan/today",null,plan);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
return msg;
|
|
|
}
|
|
|
|
|
@@ -1344,9 +1360,35 @@ public class PlanServiceImpl extends ServiceImpl<PlanMapper, Plan> implements Pl
|
|
|
msg.setError("不是计划初始分配的工位,不能取消转派");
|
|
|
return msg;
|
|
|
}
|
|
|
-
|
|
|
+ //todo 改派完之后分配好,不能再去取消改派
|
|
|
+ List<ProdProcedureTeam> teamList = prodProcedureTeamService.list(new QueryWrapper<ProdProcedureTeam>().in("plan_procedure_id", collect));
|
|
|
+ if (!teamList.isEmpty()){
|
|
|
+ msg.setError("已经分配好,不能取消转派");
|
|
|
+ return msg;
|
|
|
+ }
|
|
|
boolean update = planProcedureTotalService.update(new UpdateWrapper<PlanProcedureTotal>().set("station_id",null).set("is_transfer", 0).in("id", collect));
|
|
|
//todo 发送改派通知
|
|
|
+ if (update){
|
|
|
+ List<Integer> stationList = totalList.stream().distinct().map(PlanProcedureTotal::getStationId).collect(Collectors.toList());
|
|
|
+ if (!stationList.isEmpty()){
|
|
|
+ for (Integer stationId : stationList) {
|
|
|
+ List<User> userList = userMapper.selectList(new QueryWrapper<User>().eq("department_id", stationId).eq("work_type", "工位长"));
|
|
|
+ List<ProdProcedure> procedureList = prodProcedureMapper.selectList(new QueryWrapper<ProdProcedure>().in("id", totalList.stream().map(PlanProcedureTotal::getProdProcedureId)));
|
|
|
+ String procedureNames = procedureList.stream().map(ProdProcedure::getName).collect(Collectors.joining("|"));
|
|
|
+ if (!userList.isEmpty()){
|
|
|
+ List<WxCorpInfo> wxCorpInfoList = wxCorpInfoService.list(new QueryWrapper<WxCorpInfo>().eq("company_id", user.getCompanyId()));
|
|
|
+ if(!wxCorpInfoList.isEmpty()){
|
|
|
+ WxCorpInfo wxCorpInfo = wxCorpInfoList.get(0);
|
|
|
+ String userIds = userList.stream().map(User::getCorpwxRealUserid).collect(Collectors.joining("|"));
|
|
|
+ StringBuilder stringBuilder=new StringBuilder();
|
|
|
+ stringBuilder.append("工序名称:"+procedureNames+"\n"
|
|
|
+ +" 排产工单号:"+plan.getProductSchedulingNum()+"转派");
|
|
|
+ wxCorpInfoService.sendWXCorpTemplateMsgWithPLan(wxCorpInfo,userIds,stringBuilder.toString(),"plan/today",null,plan);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
return msg;
|
|
|
}
|
|
|
|