diff --git a/DOAN.Admin.WebApi/Controllers/MES/group/GroupScheduleController.cs b/DOAN.Admin.WebApi/Controllers/MES/group/GroupScheduleController.cs
index 7c5aecb..2add882 100644
--- a/DOAN.Admin.WebApi/Controllers/MES/group/GroupScheduleController.cs
+++ b/DOAN.Admin.WebApi/Controllers/MES/group/GroupScheduleController.cs
@@ -208,7 +208,44 @@ namespace DOAN.Admin.WebApi.Controllers
return SUCCESS(response);
}
+ //TODO 获取月份的排班情况
+ ///
+ /// 获取月份的排班情况
+ ///
+ ///
+ /// <日期,排组的数量>
+ [HttpGet("month_schedule_result")]
+ public IActionResult GetMonthScheduleResult(string month_str)
+ {
+ int HandleMonth = 0;
+ switch (month_str)
+ {
+ case "today":
+ HandleMonth = DateTime.Now.Month;
+ break;
+ case "prev-month":
+ HandleMonth = DateTime.Now.Month - 1;
+ if (HandleMonth == 0)
+ {
+ HandleMonth = 12; // 如果月份为0,则应该是12月
+ }
+ break;
+ case "next-month":
+ HandleMonth = DateTime.Now.Month + 1;
+ if (HandleMonth == 13)
+ {
+ HandleMonth = 1; // 如果月份为13,则应该是1月
+ }
+ break;
+ default:
+ HandleMonth = -1; // 表示无效的输入
+ break;
+ }
+ var response= _GroupScheduleService.GetMonthScheduleResult(HandleMonth);
+ return SUCCESS(response);
+
+ }
diff --git a/DOAN.Service/MES/group/GroupScheduleService.cs b/DOAN.Service/MES/group/GroupScheduleService.cs
index cd198be..0d215e2 100644
--- a/DOAN.Service/MES/group/GroupScheduleService.cs
+++ b/DOAN.Service/MES/group/GroupScheduleService.cs
@@ -12,6 +12,7 @@ using System.Linq;
using DOAN.Model.MES.group.Dto;
using Aliyun.OSS;
using Microsoft.AspNetCore.Http.HttpResults;
+using MimeKit.Tnef;
namespace DOAN.Service.Business
{
@@ -149,7 +150,7 @@ namespace DOAN.Service.Business
.Where((q,p)=>q.Status == 1)
.WhereIF(!string.IsNullOrEmpty(parm.WorkNum),(q,p)=>q.WorkNum.Contains(parm.WorkNum))
.WhereIF(!string.IsNullOrEmpty(parm.Name),(q,p)=>q.Name.Contains(parm.Name))
- .WhereIF(!string.IsNullOrEmpty(parm.FkPost),(q,p)=>q.FkPost.Contains(parm.FkPost))
+ .WhereIF(!string.IsNullOrEmpty(parm.FkPost),(q,p)=>q.FkPost==parm.FkPost)
.Select((q, p) => new GroupPersonDto { PostName = p.PostName }, true)
.ToPage(parm);
@@ -173,6 +174,43 @@ namespace DOAN.Service.Business
.Where(it => it.FkPersonId == person_id)
.ExecuteCommand();
}
+ ///
+ /// 获取本月排班情况
+ ///
+ ///
+ ///
+ public Dictionary GetMonthScheduleResult(int HandleMonth)
+ {
+ Dictionary results = new Dictionary();
+ //获取月份所有日期
+ List GetDatesOfMonth(int month)
+ {
+ int year = DateTime.Now.Year; // 获取当前年份
+ List dates = new List();
+ DateTime firstDayOfMonth = new DateTime(year, month, 1);
+ DateTime lastDayOfMonth = firstDayOfMonth.AddMonths(1).AddDays(-1); // 获取下个月的第一天,然后减去一天得到本月的最后一天
+
+ for (DateTime date = firstDayOfMonth; date <= lastDayOfMonth; date = date.AddDays(1))
+ {
+ dates.Add(date);
+ }
+
+ return dates;
+ }
+ List All_Dates= GetDatesOfMonth(HandleMonth);
+
+ foreach (DateTime date in All_Dates)
+ {
+ int counts= Queryable().Where(it=>it.ScheduleDate==date).Count();
+ results.Add(date, counts);
+
+
+
+ }
+
+ return results;
+
+ }
}
}
\ No newline at end of file
diff --git a/DOAN.Service/MES/group/IService/IGroupScheduleService.cs b/DOAN.Service/MES/group/IService/IGroupScheduleService.cs
index 451c224..dae0107 100644
--- a/DOAN.Service/MES/group/IService/IGroupScheduleService.cs
+++ b/DOAN.Service/MES/group/IService/IGroupScheduleService.cs
@@ -25,5 +25,7 @@ namespace DOAN.Service.group.IService
PagedInfo SearchPerson_group_bind_No(GroupScheduleQueryDto3 parm);
int GroupAddPerson(string group_schedule_id, string person_id, string CreatedBy);
int GroupRemovePerson(string group_schedule_id, string person_id);
+
+ public Dictionary GetMonthScheduleResult(int HandleMonth)
}
}