复制班组
This commit is contained in:
parent
21540b4001
commit
bd55c61e15
@ -33,7 +33,7 @@ namespace DOAN.Admin.WebApi.Controllers
|
||||
/// <param name="parm"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("list")]
|
||||
// [ActionPermissionFilter(Permission = "business:groupschedule:list")]
|
||||
// [ActionPermissionFilter(Permission = "business:groupschedule:list")]
|
||||
public IActionResult QueryGroupSchedule([FromQuery] GroupScheduleQueryDto parm)
|
||||
{
|
||||
var response = _GroupScheduleService.GetList(parm);
|
||||
@ -47,11 +47,11 @@ namespace DOAN.Admin.WebApi.Controllers
|
||||
/// <param name="Id"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("{Id}")]
|
||||
// [ActionPermissionFilter(Permission = "business:groupschedule:query")]
|
||||
// [ActionPermissionFilter(Permission = "business:groupschedule:query")]
|
||||
public IActionResult GetGroupSchedule(string Id)
|
||||
{
|
||||
var response = _GroupScheduleService.GetInfo(Id);
|
||||
|
||||
|
||||
var info = response.Adapt<GroupSchedule>();
|
||||
return SUCCESS(info);
|
||||
}
|
||||
@ -61,7 +61,7 @@ namespace DOAN.Admin.WebApi.Controllers
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPost]
|
||||
// [ActionPermissionFilter(Permission = "business:groupschedule:add")]
|
||||
// [ActionPermissionFilter(Permission = "business:groupschedule:add")]
|
||||
[Log(Title = "排班", BusinessType = BusinessType.INSERT)]
|
||||
public IActionResult AddGroupSchedule([FromBody] GroupScheduleDto parm)
|
||||
{
|
||||
@ -77,7 +77,7 @@ namespace DOAN.Admin.WebApi.Controllers
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpPut]
|
||||
// [ActionPermissionFilter(Permission = "business:groupschedule:edit")]
|
||||
// [ActionPermissionFilter(Permission = "business:groupschedule:edit")]
|
||||
[Log(Title = "排班", BusinessType = BusinessType.UPDATE)]
|
||||
public IActionResult UpdateGroupSchedule([FromBody] GroupScheduleDto parm)
|
||||
{
|
||||
@ -94,9 +94,9 @@ namespace DOAN.Admin.WebApi.Controllers
|
||||
/// <param name="date"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("list_by_date")]
|
||||
public IActionResult ListGroupByDate(GroupScheduleQueryDto2 query)
|
||||
{
|
||||
if(query.ScheduleDate == DateTime.MinValue)
|
||||
public IActionResult ListGroupByDate(GroupScheduleQueryDto2 query)
|
||||
{
|
||||
if (query.ScheduleDate == DateTime.MinValue)
|
||||
{
|
||||
return SUCCESS(null);
|
||||
}
|
||||
@ -116,7 +116,7 @@ namespace DOAN.Admin.WebApi.Controllers
|
||||
[Log(Title = "排班", BusinessType = BusinessType.INSERT)]
|
||||
public IActionResult AddGroupSchedule2([FromBody] GroupScheduleDto parm)
|
||||
{
|
||||
if(parm.ScheduleDate == DateTime.MinValue)
|
||||
if (parm.ScheduleDate == DateTime.MinValue)
|
||||
{
|
||||
return SUCCESS(null);
|
||||
};
|
||||
@ -185,10 +185,10 @@ namespace DOAN.Admin.WebApi.Controllers
|
||||
|
||||
//TODO 班组添加人员
|
||||
[HttpGet("add_person")]
|
||||
public IActionResult GroupAddPerson(string group_schedule_id,string person_id)
|
||||
public IActionResult GroupAddPerson(string group_schedule_id, string person_id)
|
||||
{
|
||||
if(string.IsNullOrEmpty(group_schedule_id)) { return SUCCESS(null); }
|
||||
if(string.IsNullOrEmpty(person_id)) { return SUCCESS(null); }
|
||||
if (string.IsNullOrEmpty(group_schedule_id)) { return SUCCESS(null); }
|
||||
if (string.IsNullOrEmpty(person_id)) { return SUCCESS(null); }
|
||||
|
||||
|
||||
var response = _GroupScheduleService
|
||||
@ -225,9 +225,9 @@ namespace DOAN.Admin.WebApi.Controllers
|
||||
[HttpGet("month_schedule_result")]
|
||||
public IActionResult GetMonthScheduleResult(string yearmonth)
|
||||
{
|
||||
if(string.IsNullOrEmpty(yearmonth)) { return SUCCESS(null); }
|
||||
if (string.IsNullOrEmpty(yearmonth)) { return SUCCESS(null); }
|
||||
|
||||
(int Year, int Month) ExtractYearAndMonth(string dateString)
|
||||
(int Year, int Month) ExtractYearAndMonth(string dateString)
|
||||
{
|
||||
if (DateTime.TryParseExact(dateString, "yyyy-MM", null, 0, out DateTime date)) // 使用 0 代替 None
|
||||
{
|
||||
@ -239,13 +239,26 @@ namespace DOAN.Admin.WebApi.Controllers
|
||||
}
|
||||
}
|
||||
|
||||
(int Year, int Month) result= ExtractYearAndMonth(yearmonth);
|
||||
(int Year, int Month) result = ExtractYearAndMonth(yearmonth);
|
||||
|
||||
var response= _GroupScheduleService.GetMonthScheduleResult(result.Year, result.Month);
|
||||
var response = _GroupScheduleService.GetMonthScheduleResult(result.Year, result.Month);
|
||||
return SUCCESS(response);
|
||||
|
||||
}
|
||||
|
||||
//TODO 复制班组
|
||||
/// <summary>
|
||||
/// 复制班组
|
||||
/// </summary>
|
||||
/// <param name="date">要排的日期</param>
|
||||
/// <returns> -1 无法复制 >1 复制的数量</returns>
|
||||
public IActionResult CopyGroup(DateTime date)
|
||||
{
|
||||
|
||||
var response= _GroupScheduleService.CopyPreDaySchedule(date.Date,HttpContext.GetName());
|
||||
return SUCCESS(response);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -223,8 +223,9 @@ namespace DOAN.Service.Business
|
||||
int result = 0;
|
||||
DateTime PreDate = date.AddDays(-1);
|
||||
|
||||
List<GroupSchedule> date_schedules = Queryable().Where(it => it.ScheduleDate == date).ToList();
|
||||
List<GroupSchedule> date_schedules = Queryable().Where(it => it.ScheduleDate == PreDate).ToList();
|
||||
|
||||
if(date_schedules==null|| date_schedules.Count==0) { return -1; }
|
||||
//TODO copy 班组人员
|
||||
string[] collects = date_schedules.Select(it => it.Id).ToArray();
|
||||
List<GroupRelPersonGroup> Copy_groups = Context.Queryable<GroupRelPersonGroup>().Where(it => collects.Contains(it.FkGroupId)).ToList();
|
||||
@ -234,7 +235,7 @@ namespace DOAN.Service.Business
|
||||
foreach (var group in date_schedules)
|
||||
{
|
||||
group.Id = XueHua;
|
||||
group.ScheduleDate = PreDate;
|
||||
group.ScheduleDate = date;
|
||||
group.CreatedBy = CreatedBy;
|
||||
group.CreatedTime = DateTime.Now;
|
||||
group.UpdatedBy = CreatedBy;
|
||||
@ -249,6 +250,8 @@ namespace DOAN.Service.Business
|
||||
}
|
||||
inserts_GroupRelPersonGroup.AddRange(Copy_group_presons);
|
||||
}
|
||||
|
||||
|
||||
UseTran2(() =>
|
||||
{
|
||||
result = Context.Insertable(date_schedules).ExecuteCommand();
|
||||
|
||||
@ -27,5 +27,7 @@ namespace DOAN.Service.group.IService
|
||||
int GroupRemovePerson(string group_schedule_id, string person_id);
|
||||
|
||||
List<SchedulingSituation> GetMonthScheduleResult(int year,int HandleMonth);
|
||||
|
||||
int CopyPreDaySchedule(DateTime date, string CreatedBy)
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user