排班
This commit is contained in:
parent
c975b9b702
commit
c3f6850a37
@ -4,6 +4,7 @@ using DOAN.Model.MES.group.Dto;
|
||||
using DOAN.Service.group.IService;
|
||||
using DOAN.Admin.WebApi.Filters;
|
||||
using SqlSugar.Extensions;
|
||||
using System.Collections.Generic;
|
||||
|
||||
//创建时间:2024-08-08
|
||||
namespace DOAN.Admin.WebApi.Controllers
|
||||
@ -85,23 +86,6 @@ namespace DOAN.Admin.WebApi.Controllers
|
||||
return ToResponse(response);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除排班
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpDelete("{ids}")]
|
||||
// [ActionPermissionFilter(Permission = "business:groupschedule:delete")]
|
||||
[Log(Title = "排班", BusinessType = BusinessType.DELETE)]
|
||||
public IActionResult DeleteGroupSchedule(string ids)
|
||||
{
|
||||
int[] idsArr = Tools.SpitIntArrary(ids);
|
||||
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
|
||||
|
||||
var response = _GroupScheduleService.Delete(idsArr);
|
||||
|
||||
return ToResponse(response);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 1 根据日期获取班组
|
||||
@ -144,7 +128,86 @@ namespace DOAN.Admin.WebApi.Controllers
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
// TODO 2 根据日期添加班组
|
||||
// TODO
|
||||
/// <summary>
|
||||
/// 3 删除班组
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
[HttpDelete("{ids}")]
|
||||
// [ActionPermissionFilter(Permission = "business:groupschedule:delete")]
|
||||
[Log(Title = "排班", BusinessType = BusinessType.DELETE)]
|
||||
public IActionResult DeleteGroupSchedule(string ids)
|
||||
{
|
||||
int[] idsArr = Tools.SpitIntArrary(ids);
|
||||
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
|
||||
|
||||
var response = _GroupScheduleService.Delete(idsArr);
|
||||
|
||||
return ToResponse(response);
|
||||
}
|
||||
/// <summary>
|
||||
/// //TODO 查询班组绑定的人员
|
||||
/// </summary>
|
||||
/// <param name="group_schedule_id">班组id</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("list_person_bind")]
|
||||
public IActionResult SearchPerson_group_bind(string group_schedule_id)
|
||||
{
|
||||
if (string.IsNullOrEmpty(group_schedule_id))
|
||||
{
|
||||
return SUCCESS(null);
|
||||
}
|
||||
var response = _GroupScheduleService.SearchPerson_group_bind(group_schedule_id);
|
||||
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// TODO 查询排班未绑定的人员
|
||||
/// </summary>
|
||||
/// <param name="group_schedule_id">班id</param>
|
||||
/// <returns></returns>
|
||||
[HttpGet("list_person_bind_no")]
|
||||
public IActionResult SearchPerson_group_bind_No(string group_schedule_id)
|
||||
{
|
||||
if (string.IsNullOrEmpty(group_schedule_id))
|
||||
{
|
||||
return SUCCESS(null);
|
||||
}
|
||||
|
||||
var response = _GroupScheduleService.SearchPerson_group_bind_No(group_schedule_id);
|
||||
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
|
||||
//TODO 班组添加人员
|
||||
[HttpGet("add_person")]
|
||||
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); }
|
||||
|
||||
|
||||
var response = _GroupScheduleService
|
||||
.GroupAddPerson(group_schedule_id, person_id, HttpContext.GetName());
|
||||
|
||||
return SUCCESS(response);
|
||||
}
|
||||
//TODO 班组删除人员
|
||||
[HttpGet("delete_person")]
|
||||
public IActionResult GroupRemovePerson(string group_schedule_id, string person_id)
|
||||
{
|
||||
if (string.IsNullOrEmpty(group_schedule_id)) { return SUCCESS(null); }
|
||||
if (string.IsNullOrEmpty(person_id)) { return SUCCESS(null); }
|
||||
|
||||
|
||||
var response = _GroupScheduleService
|
||||
.GroupRemovePerson(group_schedule_id, person_id);
|
||||
|
||||
return SUCCESS(response);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -21,7 +21,7 @@ namespace DOAN.Model.MES.group.Dto
|
||||
/// </summary>
|
||||
public class GroupPersonDto
|
||||
{
|
||||
[Required(ErrorMessage = "雪花不能为空")]
|
||||
|
||||
public string Id { get; set; }
|
||||
|
||||
[Required(ErrorMessage = "岗位不能为空")]
|
||||
|
||||
@ -11,6 +11,7 @@ using DOAN.Service.group.IService;
|
||||
using System.Linq;
|
||||
using DOAN.Model.MES.group.Dto;
|
||||
using Aliyun.OSS;
|
||||
using Microsoft.AspNetCore.Http.HttpResults;
|
||||
|
||||
namespace DOAN.Service.Business
|
||||
{
|
||||
@ -92,11 +93,70 @@ namespace DOAN.Service.Business
|
||||
public PagedInfo<GroupScheduleDto> ListGroupByDate(GroupScheduleQueryDto2 query)
|
||||
{
|
||||
query.ScheduleDate = query.ScheduleDate.Date;
|
||||
return Queryable().Where(it => it.ScheduleDate == query.ScheduleDate).
|
||||
ToPage<GroupSchedule, GroupScheduleDto>(query);
|
||||
return Queryable().Where(it => it.ScheduleDate == query.ScheduleDate).ToPage<GroupSchedule, GroupScheduleDto>(query);
|
||||
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 查询班组绑定的人员
|
||||
/// </summary>
|
||||
/// <param name="group_schedule_id"></param>
|
||||
/// <returns></returns>
|
||||
public List<GroupPerson> SearchPerson_group_bind(string group_schedule_id)
|
||||
{
|
||||
List<GroupPerson> peopleList = Context.Queryable<GroupRelPersonGroup>()
|
||||
.LeftJoin<GroupPerson>((rel, p) => rel.FkPersonId == p.Id)
|
||||
.Where((rel, p) => rel.FkGroupId == group_schedule_id)
|
||||
.Select((rel, p) => p).ToList();
|
||||
|
||||
return peopleList;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询班组未绑定的人员
|
||||
/// </summary>
|
||||
/// <param name="group_schedule_id"></param>
|
||||
/// <param name="date"></param>
|
||||
/// <returns></returns>
|
||||
public List<GroupPerson> SearchPerson_group_bind_No(string group_schedule_id)
|
||||
{
|
||||
// 查询日期内所有绑定人员
|
||||
|
||||
//查询指定日期排班
|
||||
var ScheduleDate1= SqlFunc.Subqueryable<GroupSchedule>().Where(it => it.Id == group_schedule_id).Select(it => it.ScheduleDate);
|
||||
|
||||
var ScheduleDate2 = SqlFunc.Subqueryable<GroupSchedule>().Where(it => it.ScheduleDate == ScheduleDate1);
|
||||
|
||||
//查询排班所有绑定的人员
|
||||
var query = SqlFunc.Subqueryable<GroupRelPersonGroup>()
|
||||
.LeftJoin<GroupPerson>((rel, p) => rel.FkPersonId == p.Id)
|
||||
.Where((rel, p) => ScheduleDate2.Where(it => it.Id == rel.FkGroupId).Any());
|
||||
|
||||
|
||||
// 查询排班内所有未绑定人员
|
||||
return Context.Queryable<GroupPerson>().Where(it => query.Where((rel, p) => p.Id == it.Id).NotAny()).ToList();
|
||||
|
||||
}
|
||||
|
||||
public int GroupAddPerson(string group_schedule_id, string person_id,string CreatedBy)
|
||||
{
|
||||
GroupRelPersonGroup relPersonGroup = new GroupRelPersonGroup();
|
||||
relPersonGroup.FkGroupId = group_schedule_id;
|
||||
relPersonGroup.FkPersonId = person_id;
|
||||
relPersonGroup.CreatedTime = DateTime.Now;
|
||||
relPersonGroup.CreatedBy = CreatedBy;
|
||||
return Context.Insertable(relPersonGroup).ExecuteCommand();
|
||||
}
|
||||
|
||||
public int GroupRemovePerson(string group_schedule_id, string person_id)
|
||||
{
|
||||
return Context.Deleteable<GroupRelPersonGroup>()
|
||||
.Where(it=>it.FkGroupId == group_schedule_id)
|
||||
.Where(it=>it.FkPersonId == person_id)
|
||||
.ExecuteCommand();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -21,5 +21,9 @@ namespace DOAN.Service.group.IService
|
||||
|
||||
PagedInfo<GroupScheduleDto> ListGroupByDate(GroupScheduleQueryDto2 query);
|
||||
|
||||
List<GroupPerson> SearchPerson_group_bind(string group_schedule_id);
|
||||
List<GroupPerson> SearchPerson_group_bind_No(string group_schedule_id);
|
||||
int GroupAddPerson(string group_schedule_id, string person_id, string CreatedBy);
|
||||
int GroupRemovePerson(string group_schedule_id, string person_id);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user