diff --git a/APT.BaseData.Domain/IServices/FM/IFMNotificationTaskService.cs b/APT.BaseData.Domain/IServices/FM/IFMNotificationTaskService.cs index 4f81a10..cc2e58a 100644 --- a/APT.BaseData.Domain/IServices/FM/IFMNotificationTaskService.cs +++ b/APT.BaseData.Domain/IServices/FM/IFMNotificationTaskService.cs @@ -308,7 +308,13 @@ namespace APT.BaseData.Domain.IServices.FM /// 审批明细 /// 下一个审批待办 /// 上一个审批待办 - void TaskToHead(IEnumerable appdetails, T_FM_NOTIFICATION_TASK taskNext, List listModelNext, T_FM_NOTIFICATION_TASK taskLast); - + void TaskToHead(IEnumerable appdetails, T_FM_NOTIFICATION_TASK taskNext, List listModelNext, T_FM_NOTIFICATION_TASK taskLast); + /// + /// 审批流 待办处理 判断到总部数据 + /// + /// 审批明细 + /// 下一个审批待办 + /// 上一个审批待办 + void TaskToHeads(IEnumerable appdetails, List taskNexts, List listModelNext, T_FM_NOTIFICATION_TASK taskLast); } } diff --git a/APT.BaseData.Services/Services/FM/FMFlowPermitService.cs b/APT.BaseData.Services/Services/FM/FMFlowPermitService.cs index 18e33f5..a12a5ff 100644 --- a/APT.BaseData.Services/Services/FM/FMFlowPermitService.cs +++ b/APT.BaseData.Services/Services/FM/FMFlowPermitService.cs @@ -643,7 +643,7 @@ namespace APT.BaseData.Services.Services.FM #region //涉及到总部的人员 待办 直接把数据传到总部去 //待办同步 - NotificationTaskService.TaskToHead(appdetails, notice, null, finishNotice); + NotificationTaskService.TaskToHeads(appdetails, notices, null, finishNotice); #endregion diff --git a/APT.BaseData.Services/Services/FM/FMNotificationTaskService.cs b/APT.BaseData.Services/Services/FM/FMNotificationTaskService.cs index 6bc4fa4..9c19432 100644 --- a/APT.BaseData.Services/Services/FM/FMNotificationTaskService.cs +++ b/APT.BaseData.Services/Services/FM/FMNotificationTaskService.cs @@ -1562,6 +1562,76 @@ namespace APT.BaseData.Services.Services.FM catch (Exception ex) { } } } + } + + #endregion + #region 总部待办处理 + + /// + /// 审批流 待办处理 判断到总部数据 + /// + /// 审批明细 + /// 下一个审批待办 + /// 下一个审批待办 + /// 上一个审批待办 + public void TaskToHeads(IEnumerable appdetails, List taskNexts, List listModelNext, T_FM_NOTIFICATION_TASK taskLast) + { + if (appdetails != null) + { + var checkAdd = appdetails.FirstOrDefault(e => e.ISHEAD && e.IS_CURRENT); + if (checkAdd == null) + { + //审批的最后一步 IS_CURRENT =false + if ((taskNexts == null || taskNexts.Count() < 1) && (listModelNext == null || listModelNext.Count() < 1) && taskLast != null) + { + checkAdd = appdetails.FirstOrDefault(e => e.APPROVE_USER_ID.HasValue && e.ISHEAD && e.APPROVE_USER_ID.Value == taskLast.USER_ID); + if (checkAdd != null) + { + if (checkAdd.NUM != appdetails.Max(e => e.NUM)) + { + checkAdd = null; + } + } + } + } + if (checkAdd != null) + { + var isLastDeal = false;//上一个是审批相关 + if (taskLast != null) + { + var checkLast = appdetails.FirstOrDefault(e => e.ISHEAD && e.APPROVE_USER_ID.HasValue && e.APPROVE_USER_ID.Value == taskLast.USER_ID); + if (checkLast != null) + isLastDeal = true; + } + + try + { + IEnumerable listSync = null; + if (listModelNext != null && listModelNext.Any()) + { + var userids = appdetails.Where(e => e.ISHEAD && e.IS_CURRENT && e.APPROVE_USER_ID.HasValue).Select(e => e.APPROVE_USER_ID.Value); + if (userids != null && userids.Any()) + { + listSync = listModelNext.Where(e => userids.Contains(e.USER_ID)); + } + } + + if (isLastDeal && taskLast != null) + { + this.UpdateEntityByTenant(taskLast, HeadHelper.HeadtelnetCode); + } + if (taskNexts != null && taskNexts.Any()) + { + this.AddEntitiesByTenant(taskNexts, HeadHelper.HeadtelnetCode); + } + if (listSync != null && listSync.Count() > 0) + { + this.AddEntitiesByTenant(listSync, HeadHelper.HeadtelnetCode); + } + } + catch (Exception ex) { } + } + } } #endregion