班组修改

This commit is contained in:
qianhao.xu
2025-03-12 15:32:38 +08:00
parent 2ca013bcb5
commit d09cb93aa7
35 changed files with 3408 additions and 0 deletions

View File

@@ -0,0 +1,108 @@
using Microsoft.AspNetCore.Mvc;
using DOAN.Model.MES.group;
using DOAN.Model.MES.group.Dto;
using DOAN.Service.group.IService;
using DOAN.Admin.WebApi.Filters;
//创建时间2024-08-07
namespace DOAN.Admin.WebApi.Controllers
{
/// <summary>
/// 人员
/// </summary>
[Verify]
[Route("mes/groupManagement/GroupPerson")]
public class GroupPersonController : BaseController
{
/// <summary>
/// 人员接口
/// </summary>
private readonly IGroupPersonService _GroupPersonService;
public GroupPersonController(IGroupPersonService GroupPersonService)
{
_GroupPersonService = GroupPersonService;
}
/// <summary>
/// 查询人员列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
[HttpGet("list")]
[ActionPermissionFilter(Permission = "groupManagement:groupperson:list")]
public IActionResult QueryGroupPerson([FromQuery] GroupPersonQueryDto parm)
{
var response = _GroupPersonService.GetList(parm);
return SUCCESS(response);
}
/// <summary>
/// 查询人员详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
[HttpGet("{Id}")]
[ActionPermissionFilter(Permission = "groupManagement:groupperson:query")]
public IActionResult GetGroupPerson(string Id)
{
var response = _GroupPersonService.GetInfo(Id);
var info = response.Adapt<GroupPerson>();
return SUCCESS(info);
}
/// <summary>
/// 添加人员
/// </summary>
/// <returns></returns>
[HttpPost]
[ActionPermissionFilter(Permission = "groupManagement:groupperson:add")]
[Log(Title = "人员", BusinessType = BusinessType.INSERT)]
public IActionResult AddGroupPerson([FromBody] GroupPersonDto parm)
{
var modal = parm.Adapt<GroupPerson>().ToCreate(HttpContext);
var response = _GroupPersonService.AddGroupPerson(modal);
return SUCCESS(response);
}
/// <summary>
/// 更新人员
/// </summary>
/// <returns></returns>
[HttpPut]
[ActionPermissionFilter(Permission = "groupManagement:groupperson:edit")]
[Log(Title = "人员", BusinessType = BusinessType.UPDATE)]
public IActionResult UpdateGroupPerson([FromBody] GroupPersonDto parm)
{
var modal = parm.Adapt<GroupPerson>().ToUpdate(HttpContext);
var response = _GroupPersonService.UpdateGroupPerson(modal);
return ToResponse(response);
}
/// <summary>
/// 删除人员
/// </summary>
/// <returns></returns>
[HttpDelete("{ids}")]
[ActionPermissionFilter(Permission = "groupManagement:groupperson:delete")]
[Log(Title = "人员", BusinessType = BusinessType.DELETE)]
public IActionResult DeleteGroupPerson(string ids)
{
string[] idsArr = Tools.SpitStrArrary(ids);
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
var response = _GroupPersonService.Delete(idsArr);
return ToResponse(response);
}
}
}

View File

@@ -0,0 +1,67 @@
using Microsoft.AspNetCore.Mvc;
using DOAN.Model.MES.group;
using DOAN.Model.MES.group.Dto;
using DOAN.Service.group.IService;
using DOAN.Admin.WebApi.Filters;
using Aliyun.OSS;
using DOAN.Service.MES.group.IService;
//创建时间2024-08-07
namespace DOAN.Admin.WebApi.Controllers
{
/// <summary>
/// 人员技能矩阵图
/// </summary>
[Verify]
[Route("mes/groupManagement/SkillMatrix")]
public class GroupPersonOfSkillMatrixController : BaseController
{
private readonly ISkillMatrixService _SkillMatrixService;
public GroupPersonOfSkillMatrixController(ISkillMatrixService SkillMatrixService)
{
_SkillMatrixService = SkillMatrixService;
}
//TODO 1 获取班组
[HttpGet("get_all_group")]
public IActionResult GetAllGroups(DateTime date)
{
var response = _SkillMatrixService.GetAllGroups(date.Date);
return SUCCESS(response);
}
//TODO 2 获取工艺流程
[HttpGet("get_all_route")]
public IActionResult GetAllRoutes()
{
var response = _SkillMatrixService.GetAllRoutes();
return SUCCESS(response);
}
//TODO 3 根据班组获取人员
[HttpGet("get_persons")]
public IActionResult GetPersonsList(string group_schedule_id) {
if (string.IsNullOrWhiteSpace(group_schedule_id)) { return SUCCESS(null); }
var response = _SkillMatrixService.GetPersonsList(group_schedule_id);
return SUCCESS(response);
}
//TODO 获取人员在某一工艺流程下技能的详情
[HttpPost("get_detail")]
public IActionResult GetSkillsDetailofPepole([FromBody] HandleSkillQueryDto parm)
{
var response = _SkillMatrixService.GetSkillsDetailofPepole(parm);
return SUCCESS(response);
}
}
}

View File

@@ -0,0 +1,237 @@
using Microsoft.AspNetCore.Mvc;
using DOAN.Model.MES.group;
using DOAN.Model.MES.group.Dto;
using DOAN.Service.group.IService;
using DOAN.Admin.WebApi.Filters;
using DOAN.Model.MES.base_.Dto;
//创建时间2024-08-12
namespace DOAN.Admin.WebApi.Controllers
{
/// <summary>
/// 人员技能
/// </summary>
[Verify]
[Route("mes/groupManagement/GroupPersonSkill")]
public class GroupPersonSkillController : BaseController
{
/// <summary>
/// 人员技能接口
/// </summary>
private readonly IGroupPersonSkillService _GroupPersonSkillService;
public GroupPersonSkillController(IGroupPersonSkillService GroupPersonSkillService)
{
_GroupPersonSkillService = GroupPersonSkillService;
}
/// <summary>
/// 查询人员技能列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
[HttpGet("list")]
[ActionPermissionFilter(Permission = "groupManagement:GroupPersonSkill:list")]
public IActionResult QueryGroupPersonSkill([FromQuery] GroupPersonSkillQueryDto parm)
{
var response = _GroupPersonSkillService.GetList(parm);
return SUCCESS(response);
}
/// <summary>
/// 查询人员技能详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
[HttpGet("{Id}")]
[ActionPermissionFilter(Permission = "groupManagement:GroupPersonSkill:query")]
public IActionResult GetGroupPersonSkill(string Id)
{
var response = _GroupPersonSkillService.GetInfo(Id);
var info = response.Adapt<GroupPersonSkill>();
return SUCCESS(info);
}
/// <summary>
/// 添加人员技能
/// </summary>
/// <returns></returns>
[HttpPost]
[ActionPermissionFilter(Permission = "groupManagement:GroupPersonSkill:add")]
[Log(Title = "人员技能", BusinessType = BusinessType.INSERT)]
public IActionResult AddGroupPersonSkill([FromBody] GroupPersonSkillDto parm)
{
var modal = parm.Adapt<GroupPersonSkill>().ToCreate(HttpContext);
var response = _GroupPersonSkillService.AddGroupPersonSkill(modal);
return SUCCESS(response);
}
/// <summary>
/// 更新人员技能
/// </summary>
/// <returns></returns>
[HttpPut]
[ActionPermissionFilter(Permission = "groupManagement:GroupPersonSkill:edit")]
[Log(Title = "人员技能", BusinessType = BusinessType.UPDATE)]
public IActionResult UpdateGroupPersonSkill([FromBody] GroupPersonSkillDto parm)
{
var modal = parm.Adapt<GroupPersonSkill>().ToUpdate(HttpContext);
var response = _GroupPersonSkillService.UpdateGroupPersonSkill(modal);
return ToResponse(response);
}
/// <summary>
/// 删除人员技能
/// </summary>
/// <returns></returns>
[HttpDelete("{ids}")]
[ActionPermissionFilter(Permission = "groupManagement:GroupPersonSkill:delete")]
[Log(Title = "人员技能", BusinessType = BusinessType.DELETE)]
public IActionResult DeleteGroupPersonSkill(string ids)
{
string[] idsArr = Tools.SpitStrArrary(ids);
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
var response = _GroupPersonSkillService.Delete(idsArr);
return ToResponse(response);
}
//TODO 获取人员已经拥有的技能
[HttpGet("get_person_own_skills")]
public IActionResult GetPersonSkills(string person_id)
{
if (string.IsNullOrEmpty(person_id)) { return SUCCESS(null); }
var response = _GroupPersonSkillService.GetPersonSkills(person_id);
return SUCCESS(response);
}
//TODO 获取人员未拥有的技能
[HttpPost("get_person_unown_skills")]
public IActionResult GetPersonUnownSkills([FromBody]GroupPersonSkillQueryDto2 parm)
{
if (string.IsNullOrEmpty(parm.person_id)) { return SUCCESS(null); }
var response = _GroupPersonSkillService.GetPersonUnownSkills(parm);
return SUCCESS(response);
}
//TODO 人员技能评估
/// <summary>
/// 人员技能评估
/// </summary>
/// <param name="relPersonSkill"></param>
/// <returns></returns>
[HttpPost("person_skill_assessment")]
public IActionResult PersonskillAssessment([FromBody] GroupRelPersonSkill relPersonSkill)
{
if (relPersonSkill == null)
{
return SUCCESS(null);
}
relPersonSkill.ToCreate(HttpContext);
var response = _GroupPersonSkillService.PersonskillAssessment(relPersonSkill);
return ToResponse(response);
}
/// <summary>
/// 取消绑定
/// </summary>
/// <param name="person_id"></param>
/// <param name="skill_id"></param>
/// <returns></returns>
[HttpGet("cancal_person_skill_bind")]
public IActionResult CancalPersonSkillBind(string person_id,string skill_id)
{
if (string.IsNullOrEmpty(person_id)) { return SUCCESS(null); }
if (string.IsNullOrEmpty(skill_id)) { return SUCCESS(null); }
var response = _GroupPersonSkillService.CancalPersonSkillBind(person_id, skill_id);
return ToResponse(response);
}
#region 线 ---------
//TODO 1 获取工艺路线
[HttpPost("get_route")]
public IActionResult GetWorkRouteList([FromBody] BaseWorkRouteQueryDto query)
{
if (query == null) { return SUCCESS(null); }
var response = _GroupPersonSkillService.GetWorkRouteList(query);
return SUCCESS(response);
}
//TODO 2 获取工艺路线绑定的工位 分页
[HttpPost("get_workstation_by_route")]
public IActionResult GetWorkstationbyRoute([FromBody] BaseWorkStationQueryDto2 query)
{
var response = _GroupPersonSkillService.GetWorkstationbyRoute(query);
return SUCCESS(response);
}
//TODO 获取工艺路线与工序父子表(废弃)
[HttpPost("route_process_parent_son")]
public IActionResult RouteProcessParentSon([FromBody] BaseWorkRouteQueryDto query)
{
if (query == null) { return SUCCESS(null); }
var response = _GroupPersonSkillService.RouteProcessParentSon(query);
return SUCCESS(response);
}
//TODO 根据工序查工位(废弃)
[HttpGet("workstation_by_process")]
public IActionResult GetWorkstationList_byProccess(int workProcess_id)
{
if(workProcess_id == 0) { return SUCCESS(null); }
var response = _GroupPersonSkillService.GetWorkstationList_byProccess(workProcess_id);
return SUCCESS(response);
}
//TODO 获取工位绑定的技能
[HttpGet("get_workstation_bind_skills")]
public IActionResult GetWorkstationBindSkillList(int workstation_id)
{
var response = _GroupPersonSkillService.GetWorkstationBindSkillList(workstation_id);
return SUCCESS(response);
}
//TODO 获取工位没有绑定的技能 分页
[HttpPost("get_workstation_unbind_skills")]
public IActionResult GetWorkstationunBindSkillList([FromBody] GroupPersonSkillQueryDto3 parm)
{
var response = _GroupPersonSkillService.GetWorkstationunBindSkillList(parm);
return SUCCESS(response);
}
//TODO 工位绑定技能
[HttpGet("workstation_bind_skill")]
public IActionResult HandleWorkstationbindSkill(int workstation_id,string skill_id)
{
var response = _GroupPersonSkillService.HandleWorkstationbindSkill(workstation_id, skill_id);
return SUCCESS(response);
}
//TODO 工位解除绑定技能
[HttpGet("lifted_workstation_bind_skill")]
public IActionResult LiftedWorkstationbindSkill(int workstation_id, string skill_id)
{
var response = _GroupPersonSkillService.LiftedWorkstationbindSkill(workstation_id, skill_id);
return SUCCESS(response);
}
#endregion
}
}

View File

@@ -0,0 +1,109 @@
using Microsoft.AspNetCore.Mvc;
using DOAN.Model.Dto;
using DOAN.Model.MES.group;
using DOAN.Model.MES.group.Dto;
using DOAN.Service.group.IService;
using DOAN.Admin.WebApi.Filters;
//创建时间2024-08-07
namespace DOAN.Admin.WebApi.Controllers
{
/// <summary>
/// 岗位
/// </summary>
[Verify]
[Route("mes/groupManagement/GroupPost")]
public class GroupPostController : BaseController
{
/// <summary>
/// 岗位接口
/// </summary>
private readonly IGroupPostService _GroupPostService;
public GroupPostController(IGroupPostService GroupPostService)
{
_GroupPostService = GroupPostService;
}
/// <summary>
/// 查询岗位列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
[HttpGet("list")]
[ActionPermissionFilter(Permission = "groupManagement:grouppost:list")]
public IActionResult QueryGroupPost([FromQuery] GroupPostQueryDto parm)
{
var response = _GroupPostService.GetList(parm);
return SUCCESS(response);
}
/// <summary>
/// 查询岗位详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
[HttpGet("{Id}")]
[ActionPermissionFilter(Permission = "groupManagement:grouppost:query")]
public IActionResult GetGroupPost(string Id)
{
var response = _GroupPostService.GetInfo(Id);
var info = response.Adapt<GroupPost>();
return SUCCESS(info);
}
/// <summary>
/// 添加岗位
/// </summary>
/// <returns></returns>
[HttpPost]
[ActionPermissionFilter(Permission = "groupManagement:grouppost:add")]
[Log(Title = "岗位", BusinessType = BusinessType.INSERT)]
public IActionResult AddGroupPost([FromBody] GroupPostDto parm)
{
var modal = parm.Adapt<GroupPost>().ToCreate(HttpContext);
var response = _GroupPostService.AddGroupPost(modal);
return SUCCESS(response);
}
/// <summary>
/// 更新岗位
/// </summary>
/// <returns></returns>
[HttpPut]
[ActionPermissionFilter(Permission = "groupManagement:grouppost:edit")]
[Log(Title = "岗位", BusinessType = BusinessType.UPDATE)]
public IActionResult UpdateGroupPost([FromBody] GroupPostDto parm)
{
var modal = parm.Adapt<GroupPost>().ToUpdate(HttpContext);
var response = _GroupPostService.UpdateGroupPost(modal);
return ToResponse(response);
}
/// <summary>
/// 删除岗位
/// </summary>
/// <returns></returns>
[HttpDelete("{ids}")]
[ActionPermissionFilter(Permission = "groupManagement:grouppost:delete")]
[Log(Title = "岗位", BusinessType = BusinessType.DELETE)]
public IActionResult DeleteGroupPost(string ids)
{
string[] idsArr = Tools.SpitStrArrary(ids);
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
var response = _GroupPostService.RemoveGroupPost(idsArr);
return ToResponse(response);
}
}
}

View File

@@ -0,0 +1,284 @@
using Microsoft.AspNetCore.Mvc;
using DOAN.Model.MES.group;
using DOAN.Model.MES.group.Dto;
using DOAN.Service.group.IService;
using DOAN.Admin.WebApi.Filters;
using SqlSugar.Extensions;
using System.Collections.Generic;
using System;
using static System.Runtime.InteropServices.JavaScript.JSType;
//创建时间2024-08-08
namespace DOAN.Admin.WebApi.Controllers
{
/// <summary>
/// 排班
/// </summary>
[Verify]
[Route("mes/groupManagement/GroupSchedule")]
public class GroupScheduleController : BaseController
{
/// <summary>
/// 排班接口
/// </summary>
private readonly IGroupScheduleService _GroupScheduleService;
public GroupScheduleController(IGroupScheduleService GroupScheduleService)
{
_GroupScheduleService = GroupScheduleService;
}
/// <summary>
/// 查询排班列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
[HttpGet("list")]
// [ActionPermissionFilter(Permission = "business:groupschedule:list")]
public IActionResult QueryGroupSchedule([FromQuery] GroupScheduleQueryDto parm)
{
var response = _GroupScheduleService.GetList(parm);
return SUCCESS(response);
}
/// <summary>
/// 查询排班详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
[HttpGet("{Id}")]
// [ActionPermissionFilter(Permission = "business:groupschedule:query")]
public IActionResult GetGroupSchedule(string Id)
{
var response = _GroupScheduleService.GetInfo(Id);
var info = response.Adapt<GroupSchedule>();
return SUCCESS(info);
}
/// <summary>
/// 添加排班
/// </summary>
/// <returns></returns>
[HttpPost]
// [ActionPermissionFilter(Permission = "business:groupschedule:add")]
[Log(Title = "排班", BusinessType = BusinessType.INSERT)]
public IActionResult AddGroupSchedule([FromBody] GroupScheduleDto parm)
{
var modal = parm.Adapt<GroupSchedule>().ToCreate(HttpContext);
var response = _GroupScheduleService.AddGroupSchedule(modal);
return SUCCESS(response);
}
/// <summary>
/// 更新排班
/// </summary>
/// <returns></returns>
[HttpPut]
// [ActionPermissionFilter(Permission = "business:groupschedule:edit")]
[Log(Title = "排班", BusinessType = BusinessType.UPDATE)]
public IActionResult UpdateGroupSchedule([FromBody] GroupScheduleDto parm)
{
var modal = parm.Adapt<GroupSchedule>().ToUpdate(HttpContext);
var response = _GroupScheduleService.UpdateGroupSchedule(modal);
return ToResponse(response);
}
//TODO 获取班组
[HttpGet("get_group")]
public IActionResult GetGroup(string group_name="", string group_code = "")
{
var response = _GroupScheduleService.GetALLGroup(group_code, group_name);
return SUCCESS(response);
}
/// <summary>
/// 1 根据日期获取班组
/// </summary>
/// <param name="date"></param>
/// <returns></returns>
[HttpGet("list_by_date")]
public IActionResult ListGroupByDate(GroupScheduleQueryDto2 query)
{
if (query.ScheduleDate == DateTime.MinValue)
{
return SUCCESS(null);
}
var response = _GroupScheduleService.ListGroupByDate(query);
return SUCCESS(response);
}
// TODO 2 根据日期添加班组
/// <summary>
/// 添加排班
/// </summary>
/// <returns></returns>
[HttpPost("bydate_add")]
[Log(Title = "排班", BusinessType = BusinessType.INSERT)]
public IActionResult AddGroupSchedule2([FromBody] GroupScheduleDto parm)
{
if (parm.ScheduleDate == DateTime.MinValue)
{
return SUCCESS(null);
};
parm.ScheduleDate = parm.ScheduleDate.Date;
var modal = parm.Adapt<GroupSchedule>().ToCreate(HttpContext);
var response = _GroupScheduleService.AddGroupSchedule(modal);
return SUCCESS(response);
}
// TODO
/// <summary>
/// 3 删除班组
/// </summary>
/// <returns></returns>
[HttpDelete("{ids}")]
// [ActionPermissionFilter(Permission = "business:groupschedule:delete")]
[Log(Title = "排班", BusinessType = BusinessType.DELETE)]
public IActionResult DeleteGroupSchedule(string ids)
{
string[] idsArr = Tools.SpitStrArrary(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>
[HttpPost("list_person_bind_no")]
public IActionResult SearchPerson_group_bind_No([FromBody] GroupScheduleQueryDto3 parm)
{
if (string.IsNullOrEmpty(parm.group_schedule_id))
{
return SUCCESS(null);
}
var response = _GroupScheduleService.SearchPerson_group_bind_No(parm);
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);
}
//TODO 获取月份的排班情况
/// <summary>
/// 获取月份的排班情况
/// </summary>
/// <param name="month_str"></param>
/// <returns> <日期,排组的数量></returns>
[HttpGet("month_schedule_result")]
public IActionResult GetMonthScheduleResult(string yearmonth)
{
if (string.IsNullOrEmpty(yearmonth)) { return SUCCESS(null); }
(int Year, int Month) ExtractYearAndMonth(string dateString)
{
if (DateTime.TryParseExact(dateString, "yyyy-MM", null, 0, out DateTime date)) // 使用 0 代替 None
{
return (date.Year, date.Month);
}
else
{
throw new ArgumentException("Invalid date format.", nameof(dateString));
}
}
(int Year, int Month) result = ExtractYearAndMonth(yearmonth);
var response = _GroupScheduleService.GetMonthScheduleResult(result.Year, result.Month);
return SUCCESS(response);
}
//TODO 复制班组
/// <summary>
/// 复制班组
/// </summary>
/// <param name="date">要排的日期</param>
/// <returns>-2 已有数据不可复制 -1 前一天无数据无法复制 >=1 复制的数量</returns>
[HttpGet("CopyGroup")]
public IActionResult CopyGroup(DateTime date)
{
var response= _GroupScheduleService.CopyPreDaySchedule(date,HttpContext.GetName());
return SUCCESS(response);
}
//TODO 获取工艺路线
public IActionResult GetAllRoutes()
{
var response = _GroupScheduleService.GetAllRoutes();
return SUCCESS(response);
}
//TODO 获取人员拥有的技能
public IActionResult GetSkillsOFperson(string person_id,int route_id)
{
var response = _GroupScheduleService.GetSkillsOFperson(person_id, route_id);
return SUCCESS(response);
}
}
}

View File

@@ -0,0 +1,110 @@
using Microsoft.AspNetCore.Mvc;
using DOAN.Model.Dto;
using DOAN.Model.MES.group;
using DOAN.Model.MES.group.Dto;
using DOAN.Service.group.IService;
using DOAN.Service.group;
using DOAN.Admin.WebApi.Filters;
//创建时间2024-08-08
namespace DOAN.Admin.WebApi.Controllers
{
/// <summary>
/// 班次
/// </summary>
[Verify]
[Route("mes/groupManagement/GroupShift")]
public class GroupShiftController : BaseController
{
/// <summary>
/// 班次接口
/// </summary>
private readonly IGroupShiftService _GroupShiftService;
public GroupShiftController(IGroupShiftService GroupShiftService)
{
_GroupShiftService = GroupShiftService;
}
/// <summary>
/// 查询班次列表
/// </summary>
/// <param name="parm"></param>
/// <returns></returns>
[HttpGet("list")]
[ActionPermissionFilter(Permission = "groupManagement:groupshift:list")]
public IActionResult QueryGroupShift([FromQuery] GroupShiftQueryDto parm)
{
var response = _GroupShiftService.GetList(parm);
return SUCCESS(response);
}
/// <summary>
/// 查询班次详情
/// </summary>
/// <param name="Id"></param>
/// <returns></returns>
[HttpGet("{Id}")]
[ActionPermissionFilter(Permission = "groupManagement:groupshift:query")]
public IActionResult GetGroupShift(int Id)
{
var response = _GroupShiftService.GetInfo(Id);
var info = response.Adapt<GroupShift>();
return SUCCESS(info);
}
/// <summary>
/// 添加班次
/// </summary>
/// <returns></returns>
[HttpPost]
[ActionPermissionFilter(Permission = "groupManagement:groupshift:add")]
[Log(Title = "班次", BusinessType = BusinessType.INSERT)]
public IActionResult AddGroupShift([FromBody] GroupShiftDto parm)
{
var modal = parm.Adapt<GroupShift>().ToCreate(HttpContext);
var response = _GroupShiftService.AddGroupShift(modal);
return SUCCESS(response);
}
/// <summary>
/// 更新班次
/// </summary>
/// <returns></returns>
[HttpPut]
[ActionPermissionFilter(Permission = "groupManagement:groupshift:edit")]
[Log(Title = "班次", BusinessType = BusinessType.UPDATE)]
public IActionResult UpdateGroupShift([FromBody] GroupShiftDto parm)
{
var modal = parm.Adapt<GroupShift>().ToUpdate(HttpContext);
var response = _GroupShiftService.UpdateGroupShift(modal);
return ToResponse(response);
}
/// <summary>
/// 删除班次
/// </summary>
/// <returns></returns>
[HttpDelete("{ids}")]
[ActionPermissionFilter(Permission = "groupManagement:groupshift:delete")]
[Log(Title = "班次", BusinessType = BusinessType.DELETE)]
public IActionResult DeleteGroupShift(string ids)
{
int[] idsArr = Tools.SpitIntArrary(ids);
if (idsArr.Length <= 0) { return ToResponse(ApiResult.Error($"删除失败Id 不能为空")); }
var response = _GroupShiftService.Delete(idsArr);
return ToResponse(response);
}
}
}