diff --git a/DOAN.Admin.WebApi/Controllers/MES/Group/GroupPersonController.cs b/DOAN.Admin.WebApi/Controllers/MES/Group/GroupPersonController.cs
new file mode 100644
index 0000000..33a0a7d
--- /dev/null
+++ b/DOAN.Admin.WebApi/Controllers/MES/Group/GroupPersonController.cs
@@ -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
+{
+ ///
+ /// 人员
+ ///
+ [Verify]
+ [Route("mes/groupManagement/GroupPerson")]
+ public class GroupPersonController : BaseController
+ {
+ ///
+ /// 人员接口
+ ///
+ private readonly IGroupPersonService _GroupPersonService;
+
+ public GroupPersonController(IGroupPersonService GroupPersonService)
+ {
+ _GroupPersonService = GroupPersonService;
+ }
+
+ ///
+ /// 查询人员列表
+ ///
+ ///
+ ///
+ [HttpGet("list")]
+ [ActionPermissionFilter(Permission = "groupManagement:groupperson:list")]
+ public IActionResult QueryGroupPerson([FromQuery] GroupPersonQueryDto parm)
+ {
+ var response = _GroupPersonService.GetList(parm);
+ return SUCCESS(response);
+ }
+
+
+ ///
+ /// 查询人员详情
+ ///
+ ///
+ ///
+ [HttpGet("{Id}")]
+ [ActionPermissionFilter(Permission = "groupManagement:groupperson:query")]
+ public IActionResult GetGroupPerson(string Id)
+ {
+ var response = _GroupPersonService.GetInfo(Id);
+
+ var info = response.Adapt();
+ return SUCCESS(info);
+ }
+
+ ///
+ /// 添加人员
+ ///
+ ///
+ [HttpPost]
+ [ActionPermissionFilter(Permission = "groupManagement:groupperson:add")]
+ [Log(Title = "人员", BusinessType = BusinessType.INSERT)]
+ public IActionResult AddGroupPerson([FromBody] GroupPersonDto parm)
+ {
+ var modal = parm.Adapt().ToCreate(HttpContext);
+
+ var response = _GroupPersonService.AddGroupPerson(modal);
+
+ return SUCCESS(response);
+ }
+
+ ///
+ /// 更新人员
+ ///
+ ///
+ [HttpPut]
+ [ActionPermissionFilter(Permission = "groupManagement:groupperson:edit")]
+ [Log(Title = "人员", BusinessType = BusinessType.UPDATE)]
+ public IActionResult UpdateGroupPerson([FromBody] GroupPersonDto parm)
+ {
+ var modal = parm.Adapt().ToUpdate(HttpContext);
+ var response = _GroupPersonService.UpdateGroupPerson(modal);
+
+ return ToResponse(response);
+ }
+
+ ///
+ /// 删除人员
+ ///
+ ///
+ [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);
+ }
+
+
+
+
+ }
+}
\ No newline at end of file
diff --git a/DOAN.Admin.WebApi/Controllers/MES/Group/GroupPersonOfSkillMatrixController.cs b/DOAN.Admin.WebApi/Controllers/MES/Group/GroupPersonOfSkillMatrixController.cs
new file mode 100644
index 0000000..7a76bf0
--- /dev/null
+++ b/DOAN.Admin.WebApi/Controllers/MES/Group/GroupPersonOfSkillMatrixController.cs
@@ -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
+{
+ ///
+ /// 人员技能矩阵图
+ ///
+ [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);
+
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/DOAN.Admin.WebApi/Controllers/MES/Group/GroupPersonSkillController.cs b/DOAN.Admin.WebApi/Controllers/MES/Group/GroupPersonSkillController.cs
new file mode 100644
index 0000000..01787e6
--- /dev/null
+++ b/DOAN.Admin.WebApi/Controllers/MES/Group/GroupPersonSkillController.cs
@@ -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
+{
+ ///
+ /// 人员技能
+ ///
+ [Verify]
+ [Route("mes/groupManagement/GroupPersonSkill")]
+ public class GroupPersonSkillController : BaseController
+ {
+ ///
+ /// 人员技能接口
+ ///
+ private readonly IGroupPersonSkillService _GroupPersonSkillService;
+
+ public GroupPersonSkillController(IGroupPersonSkillService GroupPersonSkillService)
+ {
+ _GroupPersonSkillService = GroupPersonSkillService;
+ }
+
+ ///
+ /// 查询人员技能列表
+ ///
+ ///
+ ///
+ [HttpGet("list")]
+ [ActionPermissionFilter(Permission = "groupManagement:GroupPersonSkill:list")]
+ public IActionResult QueryGroupPersonSkill([FromQuery] GroupPersonSkillQueryDto parm)
+ {
+ var response = _GroupPersonSkillService.GetList(parm);
+ return SUCCESS(response);
+ }
+
+
+ ///
+ /// 查询人员技能详情
+ ///
+ ///
+ ///
+ [HttpGet("{Id}")]
+ [ActionPermissionFilter(Permission = "groupManagement:GroupPersonSkill:query")]
+ public IActionResult GetGroupPersonSkill(string Id)
+ {
+ var response = _GroupPersonSkillService.GetInfo(Id);
+
+ var info = response.Adapt();
+ return SUCCESS(info);
+ }
+
+ ///
+ /// 添加人员技能
+ ///
+ ///
+ [HttpPost]
+ [ActionPermissionFilter(Permission = "groupManagement:GroupPersonSkill:add")]
+ [Log(Title = "人员技能", BusinessType = BusinessType.INSERT)]
+ public IActionResult AddGroupPersonSkill([FromBody] GroupPersonSkillDto parm)
+ {
+ var modal = parm.Adapt().ToCreate(HttpContext);
+
+ var response = _GroupPersonSkillService.AddGroupPersonSkill(modal);
+
+ return SUCCESS(response);
+ }
+
+ ///
+ /// 更新人员技能
+ ///
+ ///
+ [HttpPut]
+ [ActionPermissionFilter(Permission = "groupManagement:GroupPersonSkill:edit")]
+ [Log(Title = "人员技能", BusinessType = BusinessType.UPDATE)]
+ public IActionResult UpdateGroupPersonSkill([FromBody] GroupPersonSkillDto parm)
+ {
+ var modal = parm.Adapt().ToUpdate(HttpContext);
+ var response = _GroupPersonSkillService.UpdateGroupPersonSkill(modal);
+
+ return ToResponse(response);
+ }
+
+ ///
+ /// 删除人员技能
+ ///
+ ///
+ [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 人员技能评估
+ ///
+ /// 人员技能评估
+ ///
+ ///
+ ///
+ [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);
+
+ }
+ ///
+ /// 取消绑定
+ ///
+ ///
+ ///
+ ///
+ [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
+ }
+}
\ No newline at end of file
diff --git a/DOAN.Admin.WebApi/Controllers/MES/Group/GroupPostController.cs b/DOAN.Admin.WebApi/Controllers/MES/Group/GroupPostController.cs
new file mode 100644
index 0000000..8e1741a
--- /dev/null
+++ b/DOAN.Admin.WebApi/Controllers/MES/Group/GroupPostController.cs
@@ -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
+{
+ ///
+ /// 岗位
+ ///
+ [Verify]
+ [Route("mes/groupManagement/GroupPost")]
+ public class GroupPostController : BaseController
+ {
+ ///
+ /// 岗位接口
+ ///
+ private readonly IGroupPostService _GroupPostService;
+
+ public GroupPostController(IGroupPostService GroupPostService)
+ {
+ _GroupPostService = GroupPostService;
+ }
+
+ ///
+ /// 查询岗位列表
+ ///
+ ///
+ ///
+ [HttpGet("list")]
+ [ActionPermissionFilter(Permission = "groupManagement:grouppost:list")]
+ public IActionResult QueryGroupPost([FromQuery] GroupPostQueryDto parm)
+ {
+ var response = _GroupPostService.GetList(parm);
+ return SUCCESS(response);
+ }
+
+
+ ///
+ /// 查询岗位详情
+ ///
+ ///
+ ///
+ [HttpGet("{Id}")]
+ [ActionPermissionFilter(Permission = "groupManagement:grouppost:query")]
+ public IActionResult GetGroupPost(string Id)
+ {
+ var response = _GroupPostService.GetInfo(Id);
+
+ var info = response.Adapt();
+ return SUCCESS(info);
+ }
+
+ ///
+ /// 添加岗位
+ ///
+ ///
+ [HttpPost]
+ [ActionPermissionFilter(Permission = "groupManagement:grouppost:add")]
+ [Log(Title = "岗位", BusinessType = BusinessType.INSERT)]
+ public IActionResult AddGroupPost([FromBody] GroupPostDto parm)
+ {
+ var modal = parm.Adapt().ToCreate(HttpContext);
+
+ var response = _GroupPostService.AddGroupPost(modal);
+
+ return SUCCESS(response);
+ }
+
+ ///
+ /// 更新岗位
+ ///
+ ///
+ [HttpPut]
+ [ActionPermissionFilter(Permission = "groupManagement:grouppost:edit")]
+ [Log(Title = "岗位", BusinessType = BusinessType.UPDATE)]
+ public IActionResult UpdateGroupPost([FromBody] GroupPostDto parm)
+ {
+ var modal = parm.Adapt().ToUpdate(HttpContext);
+ var response = _GroupPostService.UpdateGroupPost(modal);
+
+ return ToResponse(response);
+ }
+
+ ///
+ /// 删除岗位
+ ///
+ ///
+ [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);
+ }
+
+
+
+
+ }
+}
\ No newline at end of file
diff --git a/DOAN.Admin.WebApi/Controllers/MES/Group/GroupScheduleController.cs b/DOAN.Admin.WebApi/Controllers/MES/Group/GroupScheduleController.cs
new file mode 100644
index 0000000..601e2fa
--- /dev/null
+++ b/DOAN.Admin.WebApi/Controllers/MES/Group/GroupScheduleController.cs
@@ -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
+{
+ ///
+ /// 排班
+ ///
+ [Verify]
+ [Route("mes/groupManagement/GroupSchedule")]
+ public class GroupScheduleController : BaseController
+ {
+ ///
+ /// 排班接口
+ ///
+ private readonly IGroupScheduleService _GroupScheduleService;
+
+ public GroupScheduleController(IGroupScheduleService GroupScheduleService)
+ {
+ _GroupScheduleService = GroupScheduleService;
+ }
+
+ ///
+ /// 查询排班列表
+ ///
+ ///
+ ///
+ [HttpGet("list")]
+ // [ActionPermissionFilter(Permission = "business:groupschedule:list")]
+ public IActionResult QueryGroupSchedule([FromQuery] GroupScheduleQueryDto parm)
+ {
+ var response = _GroupScheduleService.GetList(parm);
+ return SUCCESS(response);
+ }
+
+
+ ///
+ /// 查询排班详情
+ ///
+ ///
+ ///
+ [HttpGet("{Id}")]
+ // [ActionPermissionFilter(Permission = "business:groupschedule:query")]
+ public IActionResult GetGroupSchedule(string Id)
+ {
+ var response = _GroupScheduleService.GetInfo(Id);
+
+ var info = response.Adapt();
+ return SUCCESS(info);
+ }
+
+ ///
+ /// 添加排班
+ ///
+ ///
+ [HttpPost]
+ // [ActionPermissionFilter(Permission = "business:groupschedule:add")]
+ [Log(Title = "排班", BusinessType = BusinessType.INSERT)]
+ public IActionResult AddGroupSchedule([FromBody] GroupScheduleDto parm)
+ {
+ var modal = parm.Adapt().ToCreate(HttpContext);
+
+ var response = _GroupScheduleService.AddGroupSchedule(modal);
+
+ return SUCCESS(response);
+ }
+
+ ///
+ /// 更新排班
+ ///
+ ///
+ [HttpPut]
+ // [ActionPermissionFilter(Permission = "business:groupschedule:edit")]
+ [Log(Title = "排班", BusinessType = BusinessType.UPDATE)]
+ public IActionResult UpdateGroupSchedule([FromBody] GroupScheduleDto parm)
+ {
+ var modal = parm.Adapt().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);
+ }
+
+
+ ///
+ /// 1 根据日期获取班组
+ ///
+ ///
+ ///
+ [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 根据日期添加班组
+ ///
+ /// 添加排班
+ ///
+ ///
+ [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().ToCreate(HttpContext);
+
+ var response = _GroupScheduleService.AddGroupSchedule(modal);
+
+ return SUCCESS(response);
+ }
+
+ // TODO
+ ///
+ /// 3 删除班组
+ ///
+ ///
+ [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);
+ }
+
+
+ ///
+ /// //TODO 查询班组绑定的人员
+ ///
+ /// 班组id
+ ///
+ [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);
+ }
+
+
+ ///
+ /// TODO 查询排班未绑定的人员
+ ///
+ /// 班id
+ ///
+ [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 获取月份的排班情况
+ ///
+ /// 获取月份的排班情况
+ ///
+ ///
+ /// <日期,排组的数量>
+ [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 复制班组
+ ///
+ /// 复制班组
+ ///
+ /// 要排的日期
+ /// -2 已有数据不可复制 -1 前一天无数据无法复制 >=1 复制的数量
+ [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);
+ }
+ }
+}
\ No newline at end of file
diff --git a/DOAN.Admin.WebApi/Controllers/MES/Group/GroupShiftController.cs b/DOAN.Admin.WebApi/Controllers/MES/Group/GroupShiftController.cs
new file mode 100644
index 0000000..0e04442
--- /dev/null
+++ b/DOAN.Admin.WebApi/Controllers/MES/Group/GroupShiftController.cs
@@ -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
+{
+ ///
+ /// 班次
+ ///
+ [Verify]
+ [Route("mes/groupManagement/GroupShift")]
+ public class GroupShiftController : BaseController
+ {
+ ///
+ /// 班次接口
+ ///
+ private readonly IGroupShiftService _GroupShiftService;
+
+ public GroupShiftController(IGroupShiftService GroupShiftService)
+ {
+ _GroupShiftService = GroupShiftService;
+ }
+
+ ///
+ /// 查询班次列表
+ ///
+ ///
+ ///
+ [HttpGet("list")]
+ [ActionPermissionFilter(Permission = "groupManagement:groupshift:list")]
+ public IActionResult QueryGroupShift([FromQuery] GroupShiftQueryDto parm)
+ {
+ var response = _GroupShiftService.GetList(parm);
+ return SUCCESS(response);
+ }
+
+
+ ///
+ /// 查询班次详情
+ ///
+ ///
+ ///
+ [HttpGet("{Id}")]
+ [ActionPermissionFilter(Permission = "groupManagement:groupshift:query")]
+ public IActionResult GetGroupShift(int Id)
+ {
+ var response = _GroupShiftService.GetInfo(Id);
+
+ var info = response.Adapt();
+ return SUCCESS(info);
+ }
+
+ ///
+ /// 添加班次
+ ///
+ ///
+ [HttpPost]
+ [ActionPermissionFilter(Permission = "groupManagement:groupshift:add")]
+ [Log(Title = "班次", BusinessType = BusinessType.INSERT)]
+ public IActionResult AddGroupShift([FromBody] GroupShiftDto parm)
+ {
+ var modal = parm.Adapt().ToCreate(HttpContext);
+
+ var response = _GroupShiftService.AddGroupShift(modal);
+
+ return SUCCESS(response);
+ }
+
+ ///
+ /// 更新班次
+ ///
+ ///
+ [HttpPut]
+ [ActionPermissionFilter(Permission = "groupManagement:groupshift:edit")]
+ [Log(Title = "班次", BusinessType = BusinessType.UPDATE)]
+ public IActionResult UpdateGroupShift([FromBody] GroupShiftDto parm)
+ {
+ var modal = parm.Adapt().ToUpdate(HttpContext);
+ var response = _GroupShiftService.UpdateGroupShift(modal);
+
+ return ToResponse(response);
+ }
+
+ ///
+ /// 删除班次
+ ///
+ ///
+ [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);
+ }
+
+
+
+
+ }
+}
\ No newline at end of file
diff --git a/DOAN.Model/MES/Group/Dto/GroupPersonDto.cs b/DOAN.Model/MES/Group/Dto/GroupPersonDto.cs
new file mode 100644
index 0000000..2676fb4
--- /dev/null
+++ b/DOAN.Model/MES/Group/Dto/GroupPersonDto.cs
@@ -0,0 +1,54 @@
+using System.ComponentModel.DataAnnotations;
+
+namespace DOAN.Model.MES.group.Dto
+{
+ ///
+ /// 人员查询对象
+ ///
+ public class GroupPersonQueryDto : PagerInfo
+ {
+ public string WorkNum { get; set; }
+
+ public string Name { get; set; }
+
+ public string FkPost { get; set; }
+
+ public int? Status { get; set; }
+ }
+
+ ///
+ /// 人员输入输出对象
+ ///
+ public class GroupPersonDto
+ {
+
+ public string Id { get; set; }
+
+ [Required(ErrorMessage = "岗位不能为空")]
+ public string FkPost { get; set; }
+ public string PostName { get; set; }
+
+ public string WorkNum { get; set; }
+
+ public string Name { get; set; }
+
+ public DateTime? EmploymentTime { get; set; }
+
+ public DateTime? DepartureTime { get; set; }
+
+ public string Phone { get; set; }
+
+ public int? Status { get; set; }
+
+ public string CreatedBy { get; set; }
+
+ public DateTime? CreatedTime { get; set; }
+
+ public string UpdatedBy { get; set; }
+
+ public string UpdatedTime { get; set; }
+
+
+
+ }
+}
\ No newline at end of file
diff --git a/DOAN.Model/MES/Group/Dto/GroupPersonOfSkillDto.cs b/DOAN.Model/MES/Group/Dto/GroupPersonOfSkillDto.cs
new file mode 100644
index 0000000..cfa4679
--- /dev/null
+++ b/DOAN.Model/MES/Group/Dto/GroupPersonOfSkillDto.cs
@@ -0,0 +1,35 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DOAN.Model.MES.group.Dto
+{
+ ///
+ /// 人员的技能
+ ///
+ public class GroupPersonOfSkillDto
+ {
+ ///
+ /// 工位描述
+ ///
+ public string WorkStationDescription { get; set; }
+ ///
+ /// 技能id
+ ///
+ public string FkSkillId { get; set; }
+ ///
+ /// 技能名称
+ ///
+
+ public string SkillName { get; set; }
+
+ ///
+ /// 评分
+ ///
+ public int? Score { get; set; }
+
+
+ }
+}
diff --git a/DOAN.Model/MES/Group/Dto/GroupPersonSkillDto.cs b/DOAN.Model/MES/Group/Dto/GroupPersonSkillDto.cs
new file mode 100644
index 0000000..aebe8a3
--- /dev/null
+++ b/DOAN.Model/MES/Group/Dto/GroupPersonSkillDto.cs
@@ -0,0 +1,90 @@
+using System.ComponentModel.DataAnnotations;
+
+namespace DOAN.Model.MES.group.Dto
+{
+ ///
+ /// 人员技能查询对象
+ ///
+ public class GroupPersonSkillQueryDto : PagerInfo
+ {
+ public string SkillName { get; set; }
+ public int? Status { get; set; }
+ }
+ public class GroupPersonSkillQueryDto2 : PagerInfo
+ {
+ public string SkillName { get; set; }
+ public int? Status { get; set; }
+ public string person_id { get; set; }
+ }
+ public class GroupPersonSkillQueryDto3 : PagerInfo
+ {
+ public string SkillName { get; set; }
+ public int? Status { get; set; }
+ public int workstation_id { get; set; }
+ }
+
+ //public class GroupPersonSkillQueryDto3 : PagerInfo
+ //{
+ // public string DictWorkType { get; set; }
+ // public string WorkStationDescription { get; set; }
+ //}
+
+ ///
+ /// 人员技能输入输出对象
+ ///
+ public class GroupPersonSkillDto
+ {
+ [Required(ErrorMessage = "雪花不能为空")]
+ public string Id { get; set; }
+
+ public string SkillName { get; set; }
+
+ public string Image { get; set; }
+
+ public string Vedio { get; set; }
+
+ public string Remark { get; set; }
+
+ public int? Status { get; set; }
+
+ public string CreatedBy { get; set; }
+
+ public DateTime? CreatedTime { get; set; }
+
+ public string UpdatedBy { get; set; }
+
+ public DateTime? UpdatedTime { get; set; }
+
+
+
+ }
+
+ public class GroupPersonSkillDto2
+ {
+ [Required(ErrorMessage = "雪花不能为空")]
+ public string Id { get; set; }
+
+ public string SkillName { get; set; }
+
+ public int score { get; set; }
+
+ public string Image { get; set; }
+
+ public string Vedio { get; set; }
+
+ public string Remark { get; set; }
+
+ public int? Status { get; set; }
+
+ public string CreatedBy { get; set; }
+
+ public DateTime? CreatedTime { get; set; }
+
+ public string UpdatedBy { get; set; }
+
+ public DateTime? UpdatedTime { get; set; }
+
+
+
+ }
+}
\ No newline at end of file
diff --git a/DOAN.Model/MES/Group/Dto/GroupPostDto.cs b/DOAN.Model/MES/Group/Dto/GroupPostDto.cs
new file mode 100644
index 0000000..282f8f6
--- /dev/null
+++ b/DOAN.Model/MES/Group/Dto/GroupPostDto.cs
@@ -0,0 +1,41 @@
+using System.ComponentModel.DataAnnotations;
+
+namespace DOAN.Model.MES.group.Dto
+{
+ ///
+ /// 岗位查询对象
+ ///
+ public class GroupPostQueryDto : PagerInfo
+ {
+ public string PostName { get; set; }
+ }
+
+ ///
+ /// 岗位输入输出对象
+ ///
+ public class GroupPostDto
+ {
+ [Required(ErrorMessage = "雪花不能为空")]
+ public string Id { get; set; }
+
+ [Required(ErrorMessage = "父id不能为空")]
+ public string ParentId { get; set; }
+
+ public string PostName { get; set; }
+
+ public int? Status { get; set; }
+
+ public string Remark { get; set; }
+
+ public string CreatedBy { get; set; }
+
+ public DateTime? CreatedTime { get; set; }
+
+ public string UpdatedBy { get; set; }
+
+ public DateTime? UpdatedTime { get; set; }
+
+
+
+ }
+}
\ No newline at end of file
diff --git a/DOAN.Model/MES/Group/Dto/GroupRelPersonGroupDto.cs b/DOAN.Model/MES/Group/Dto/GroupRelPersonGroupDto.cs
new file mode 100644
index 0000000..f09af5b
--- /dev/null
+++ b/DOAN.Model/MES/Group/Dto/GroupRelPersonGroupDto.cs
@@ -0,0 +1,34 @@
+using System.ComponentModel.DataAnnotations;
+
+namespace DOAN.Model.MES.group.Dto
+{
+ ///
+ /// 组和员工关联表查询对象
+ ///
+ public class GroupRelPersonGroupQueryDto : PagerInfo
+ {
+ }
+
+ ///
+ /// 组和员工关联表输入输出对象
+ ///
+ public class GroupRelPersonGroupDto
+ {
+ [Required(ErrorMessage = "组别id不能为空")]
+ public string FkGroupId { get; set; }
+
+ [Required(ErrorMessage = "员工id不能为空")]
+ public string FkPersonId { get; set; }
+
+ public string CreatedBy { get; set; }
+
+ public DateTime? CreatedTime { get; set; }
+
+ public string UpdatedBy { get; set; }
+
+ public DateTime? UpdatedTime { get; set; }
+
+
+
+ }
+}
\ No newline at end of file
diff --git a/DOAN.Model/MES/Group/Dto/GroupScheduleDto.cs b/DOAN.Model/MES/Group/Dto/GroupScheduleDto.cs
new file mode 100644
index 0000000..a914f5b
--- /dev/null
+++ b/DOAN.Model/MES/Group/Dto/GroupScheduleDto.cs
@@ -0,0 +1,55 @@
+using System.ComponentModel.DataAnnotations;
+
+namespace DOAN.Model.MES.group.Dto
+{
+ ///
+ /// 排班查询对象
+ ///
+ public class GroupScheduleQueryDto : PagerInfo
+ {}
+ public class GroupScheduleQueryDto2 : PagerInfo
+ {
+ public DateTime ScheduleDate { get; set; }
+ }
+ public class GroupScheduleQueryDto3 : PagerInfo
+ {
+ public string group_schedule_id { get; set; }
+ public string WorkNum { get; set; }
+
+ public string Name { get; set; }
+
+ public string FkPost { get; set; }
+ }
+
+ ///
+ /// 排班输入输出对象
+ ///
+ public class GroupScheduleDto
+ {
+ public string Id { get; set; }
+
+ public DateTime ScheduleDate { get; set; }
+
+ public string GroupName { get; set; }
+
+ public string GroupCode { get; set; }
+
+
+ public int FkShift { get; set; }
+ public string ShiftName { get; set; }
+
+ public string Remark { get; set; }
+
+ public string Status { get; set; }
+
+ public string CreatedBy { get; set; }
+
+ public DateTime? CreatedTime { get; set; }
+
+ public string UpdatedBy { get; set; }
+
+ public DateTime? UpdatedTime { get; set; }
+
+ public decimal WorkHours { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/DOAN.Model/MES/Group/Dto/GroupShiftDto.cs b/DOAN.Model/MES/Group/Dto/GroupShiftDto.cs
new file mode 100644
index 0000000..2bbe6a8
--- /dev/null
+++ b/DOAN.Model/MES/Group/Dto/GroupShiftDto.cs
@@ -0,0 +1,61 @@
+using System.ComponentModel.DataAnnotations;
+
+namespace DOAN.Model.MES.group.Dto
+{
+ ///
+ /// 班次查询对象
+ ///
+ public class GroupShiftQueryDto : PagerInfo
+ {}
+
+ ///
+ /// 班次输入输出对象
+ ///
+ public class GroupShiftDto
+ {
+ [Required(ErrorMessage = "自增不能为空")]
+ public int Id { get; set; }
+
+ public string Name { get; set; }
+
+ public decimal WorkHours { get; set; }
+ public DateTime? StartTime { get; set; }
+
+ public DateTime? EndTime { get; set; }
+
+ public int? Status { get; set; }
+
+ public string Remark { get; set; }
+
+ public string CreatedBy { get; set; }
+
+ public DateTime? CreatedTime { get; set; }
+
+ public string UpdatedBy { get; set; }
+
+ public DateTime? UpdatedTime { get; set; }
+ }
+ public class GroupShiftDto2
+ {
+ [Required(ErrorMessage = "自增不能为空")]
+ public int Id { get; set; }
+
+ public string Name { get; set; }
+ public decimal WorkHours { get; set; }
+ public TimeSpan StartTime { get; set; }
+
+ public TimeSpan EndTime { get; set; }
+
+ public int? Status { get; set; }
+
+ public string Remark { get; set; }
+
+ public string CreatedBy { get; set; }
+
+ public DateTime? CreatedTime { get; set; }
+
+ public string UpdatedBy { get; set; }
+
+ public DateTime? UpdatedTime { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/DOAN.Model/MES/Group/Dto/HandleSkillInfoDto.cs b/DOAN.Model/MES/Group/Dto/HandleSkillInfoDto.cs
new file mode 100644
index 0000000..837f3c5
--- /dev/null
+++ b/DOAN.Model/MES/Group/Dto/HandleSkillInfoDto.cs
@@ -0,0 +1,172 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DOAN.Model.MES.group.Dto
+{
+ public class HandleSkillQueryDto
+ {
+ ///
+ /// 人员清单
+ ///
+ public string[] person_id { get; set; }
+ ///
+ /// 路线id
+ ///
+ public int Route_id { get; set; }
+
+ }
+ ///
+ /// 人员技能矩阵
+ ///
+ public class HandleSkillInfoDto
+ {
+ ///
+ /// 工艺流程名称
+ ///
+ public string RouteName { get; set; }
+
+
+
+ ///
+ /// 工艺流程绑定的工序
+ ///
+ public List colums { get; set; }
+
+
+
+ ///
+ /// 人员技能列表
+ ///
+ public List tableList { get; set; }
+
+
+ }
+ ///
+ /// 工序详情
+ ///
+ public class Columprocesses
+ {
+ ///
+ /// 工序名称
+ ///
+ public string processesName { get; set; }
+ ///
+ /// 工序绑定的工位
+ ///
+ public List children { get; set; }
+
+
+
+ }
+
+ ///
+ /// 工位
+ ///
+ public class StationChlidren
+ {
+ ///
+ /// 工位名称
+ ///
+ public string stationName { get; set; }
+
+ ///
+ /// 技能描述
+ ///
+ public List children { get; set; }
+ }
+
+ ///
+ /// 技能描述
+ ///
+ public class Skillschlidren
+ {
+ ///
+ /// 技能id
+ ///
+ public string skillId { get; set; }
+ ///
+ /// 技能名称
+ ///
+ public string skillName { get; set; }
+ }
+ ///
+ /// 个人的技能
+ ///
+ public class PersonOfKillsBase
+ {
+ ///
+ /// 个人id
+ ///
+ public string personId { get; set; }
+ ///
+ /// 工号
+ ///
+ public string workNum { get; set; }
+ ///
+ /// 职位
+ ///
+ public string postName { get; set; }
+ ///
+ /// 姓名
+ ///
+ public string personName { get; set; }
+
+ }
+
+
+ ///
+ /// 人员技能增加属性
+ ///
+ public static class PersonOfKillsExtensions
+ {
+ ///
+ /// 获取属性
+ ///
+ ///
+ ///
+ ///
+ public static string GetScore(this PersonOfKills person, string Property)
+ {
+ return person.GetType().GetProperty(Property).GetValue(person)?.ToString();
+ }
+ ///
+ /// 设置属性
+ ///
+ ///
+ ///
+ ///
+ public static void SetScore(this PersonOfKills person, string Property, int value)
+ {
+ var propertyInfo = person.GetType().GetProperty(Property);
+ if (propertyInfo != null && propertyInfo.CanWrite)
+ {
+ propertyInfo.SetValue(person, value);
+ }
+ }
+
+
+ }
+ ///
+ /// 增加属性
+ ///
+ public class PersonOfKills : PersonOfKillsBase
+ {
+ private readonly Dictionary _additionalProperties = new Dictionary();
+
+ public object this[string name]
+ {
+ get => _additionalProperties[name];
+ set => _additionalProperties[name] = value;
+
+
+ }
+ }
+}
+
+
+
+
+
diff --git a/DOAN.Model/MES/Group/Dto/SchedulingSituation.cs b/DOAN.Model/MES/Group/Dto/SchedulingSituation.cs
new file mode 100644
index 0000000..cb96fca
--- /dev/null
+++ b/DOAN.Model/MES/Group/Dto/SchedulingSituation.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DOAN.Model.MES.group.Dto
+{
+ public class SchedulingSituation
+ {
+
+ public string Date1 { get; set; }
+ public int groupNum { get; set; }
+ }
+}
diff --git a/DOAN.Model/MES/Group/GroupPerson.cs b/DOAN.Model/MES/Group/GroupPerson.cs
new file mode 100644
index 0000000..73a4c7e
--- /dev/null
+++ b/DOAN.Model/MES/Group/GroupPerson.cs
@@ -0,0 +1,81 @@
+
+namespace DOAN.Model.MES.group
+{
+ ///
+ /// 人员
+ ///
+
+ [SugarTable("group_person")]
+ public class GroupPerson
+ {
+ ///
+ /// 雪花
+ ///
+ [SugarColumn(IsPrimaryKey = true, IsIdentity = false)]
+ public string Id { get; set; }
+
+ ///
+ /// 岗位
+ ///
+ [SugarColumn(ColumnName = "fk_post")]
+ public string FkPost { get; set; }
+
+ ///
+ /// 工号
+ ///
+ [SugarColumn(ColumnName = "work_num")]
+ public string WorkNum { get; set; }
+
+ ///
+ /// 名称
+ ///
+ public string Name { get; set; }
+
+ ///
+ /// 入职日期
+ ///
+ [SugarColumn(ColumnName = "employment_time")]
+ public DateTime? EmploymentTime { get; set; }
+
+ ///
+ /// 离职日期
+ ///
+ [SugarColumn(ColumnName = "departure_time")]
+ public DateTime? DepartureTime { get; set; }
+
+ ///
+ /// 手机号
+ ///
+ public string Phone { get; set; }
+
+ ///
+ /// 状态(1 在岗 0 不在岗)
+ ///
+ public int? Status { get; set; }
+
+ ///
+ /// 创建人
+ ///
+ [SugarColumn(ColumnName = "cREATED_BY")]
+ public string CreatedBy { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ [SugarColumn(ColumnName = "cREATED_TIME")]
+ public DateTime? CreatedTime { get; set; }
+
+ ///
+ /// 更新人
+ ///
+ [SugarColumn(ColumnName = "uPDATED_BY")]
+ public string UpdatedBy { get; set; }
+
+ ///
+ /// 更新时间
+ ///
+ [SugarColumn(ColumnName = "uPDATED_TIME")]
+ public DateTime? UpdatedTime { get; set; }
+
+ }
+}
\ No newline at end of file
diff --git a/DOAN.Model/MES/Group/GroupPersonSkill.cs b/DOAN.Model/MES/Group/GroupPersonSkill.cs
new file mode 100644
index 0000000..1dc2c86
--- /dev/null
+++ b/DOAN.Model/MES/Group/GroupPersonSkill.cs
@@ -0,0 +1,66 @@
+namespace DOAN.Model.MES.group
+{
+ ///
+ /// 人员技能
+ ///
+ [SugarTable("group_person_skill")]
+ public class GroupPersonSkill
+ {
+ ///
+ /// 雪花
+ ///
+ [SugarColumn(IsPrimaryKey = true, IsIdentity = false)]
+ public string Id { get; set; }
+
+ ///
+ /// 技能名称
+ ///
+ [SugarColumn(ColumnName = "skill_name")]
+ public string SkillName { get; set; }
+
+ ///
+ /// 教学图片
+ ///
+ public string Image { get; set; }
+
+ ///
+ /// 教学视频
+ ///
+ public string Vedio { get; set; }
+
+ ///
+ /// 备注
+ ///
+ public string Remark { get; set; }
+
+ ///
+ /// 状态
+ ///
+ public int? Status { get; set; }
+
+ ///
+ /// 创建人
+ ///
+ [SugarColumn(ColumnName = "cREATED_BY")]
+ public string CreatedBy { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ [SugarColumn(ColumnName = "cREATED_TIME")]
+ public DateTime? CreatedTime { get; set; }
+
+ ///
+ /// 更新人
+ ///
+ [SugarColumn(ColumnName = "uPDATED_BY")]
+ public string UpdatedBy { get; set; }
+
+ ///
+ /// 更新时间
+ ///
+ [SugarColumn(ColumnName = "uPDATED_TIME")]
+ public DateTime? UpdatedTime { get; set; }
+
+ }
+}
\ No newline at end of file
diff --git a/DOAN.Model/MES/Group/GroupPost.cs b/DOAN.Model/MES/Group/GroupPost.cs
new file mode 100644
index 0000000..c65b5c9
--- /dev/null
+++ b/DOAN.Model/MES/Group/GroupPost.cs
@@ -0,0 +1,63 @@
+
+namespace DOAN.Model.MES.group
+{
+ ///
+ /// 岗位
+ ///
+ [SugarTable("group_post")]
+ public class GroupPost
+ {
+ ///
+ /// 雪花
+ ///
+ [SugarColumn(IsPrimaryKey = true, IsIdentity = false)]
+ public string Id { get; set; }
+
+ ///
+ /// 父id
+ ///
+ [SugarColumn(ColumnName = "parent_id")]
+ public string ParentId { get; set; }
+
+ ///
+ /// 岗位名称
+ ///
+ [SugarColumn(ColumnName = "post_name")]
+ public string PostName { get; set; }
+
+ ///
+ /// 1:启用 0:停用
+ ///
+ public int? Status { get; set; }
+
+ ///
+ /// 备注
+ ///
+ public string Remark { get; set; }
+
+ ///
+ /// 创建人
+ ///
+ [SugarColumn(ColumnName = "cREATED_BY")]
+ public string CreatedBy { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ [SugarColumn(ColumnName = "cREATED_TIME")]
+ public DateTime? CreatedTime { get; set; }
+
+ ///
+ /// 更新人
+ ///
+ [SugarColumn(ColumnName = "uPDATED_BY")]
+ public string UpdatedBy { get; set; }
+
+ ///
+ /// 更新时间
+ ///
+ [SugarColumn(ColumnName = "uPDATED_TIME")]
+ public DateTime? UpdatedTime { get; set; }
+
+ }
+}
\ No newline at end of file
diff --git a/DOAN.Model/MES/Group/GroupRelPersonGroup.cs b/DOAN.Model/MES/Group/GroupRelPersonGroup.cs
new file mode 100644
index 0000000..70f3006
--- /dev/null
+++ b/DOAN.Model/MES/Group/GroupRelPersonGroup.cs
@@ -0,0 +1,47 @@
+
+namespace DOAN.Model.MES.group
+{
+ ///
+ /// 组和员工关联表
+ ///
+ [SugarTable("group_rel_person_group")]
+ public class GroupRelPersonGroup
+ {
+ ///
+ /// 组别id
+ ///
+ [SugarColumn(IsPrimaryKey = true, IsIdentity = false, ColumnName = "fk_group_id")]
+ public string FkGroupId { get; set; }
+
+ ///
+ /// 员工id
+ ///
+ [SugarColumn(IsPrimaryKey = true, IsIdentity = false, ColumnName = "fk_person_id")]
+ public string FkPersonId { get; set; }
+
+ ///
+ /// 创建人
+ ///
+ [SugarColumn(ColumnName = "cREATED_BY")]
+ public string CreatedBy { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ [SugarColumn(ColumnName = "cREATED_TIME")]
+ public DateTime? CreatedTime { get; set; }
+
+ ///
+ /// 更新人
+ ///
+ [SugarColumn(ColumnName = "uPDATED_BY")]
+ public string UpdatedBy { get; set; }
+
+ ///
+ /// 更新时间
+ ///
+ [SugarColumn(ColumnName = "uPDATED_TIME")]
+ public DateTime? UpdatedTime { get; set; }
+
+ }
+}
\ No newline at end of file
diff --git a/DOAN.Model/MES/Group/GroupRelPersonSkill.cs b/DOAN.Model/MES/Group/GroupRelPersonSkill.cs
new file mode 100644
index 0000000..d852ac7
--- /dev/null
+++ b/DOAN.Model/MES/Group/GroupRelPersonSkill.cs
@@ -0,0 +1,57 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DOAN.Model.MES.group
+{
+ ///
+ /// 人员与技能关联表
+ ///
+ [SugarTable("group_rel_person_skill")]
+ public class GroupRelPersonSkill
+ {
+ ///
+ /// 技能id
+ ///
+ [SugarColumn(IsPrimaryKey = true, IsIdentity = false, ColumnName = "fk_skill_id")]
+ public string FkSkillId { get; set; }
+
+ ///
+ /// 人员id
+ ///
+ [SugarColumn(IsPrimaryKey = true, IsIdentity = false, ColumnName = "fk_person_id")]
+ public string FkPersonId { get; set; }
+
+ ///
+ /// 评分
+ ///
+ public int? Score { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ [SugarColumn(ColumnName = "cREATED_TIME")]
+ public DateTime? CreatedTime { get; set; }
+
+ ///
+ /// 创建人
+ ///
+ [SugarColumn(ColumnName = "cREATED_BY")]
+ public string CreatedBy { get; set; }
+
+ ///
+ /// 更新人
+ ///
+ [SugarColumn(ColumnName = "uPDATED_BY")]
+ public string UpdatedBy { get; set; }
+
+ ///
+ /// 更新时间
+ ///
+ [SugarColumn(ColumnName = "uPDATED_TIME")]
+ public DateTime? UpdatedTime { get; set; }
+
+ }
+}
\ No newline at end of file
diff --git a/DOAN.Model/MES/Group/GroupRelWorkstationSkill.cs b/DOAN.Model/MES/Group/GroupRelWorkstationSkill.cs
new file mode 100644
index 0000000..e4a2cbb
--- /dev/null
+++ b/DOAN.Model/MES/Group/GroupRelWorkstationSkill.cs
@@ -0,0 +1,52 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace DOAN.Model.MES.group
+{
+ ///
+ /// 工位与技能关联表
+ ///
+ [SugarTable("group_rel_workstation_skill")]
+ public class GroupRelWorkstationSkill
+ {
+ ///
+ /// 技能id
+ ///
+ [SugarColumn(IsPrimaryKey = true, IsIdentity = false, ColumnName = "fk_skill_id")]
+ public string FkSkillId { get; set; }
+
+ ///
+ /// 工位id
+ ///
+ [SugarColumn(IsPrimaryKey = true, IsIdentity = false, ColumnName = "fk_workstation_id")]
+ public int FkWorkstationId { get; set; }
+
+ ///
+ /// 创建人
+ ///
+ [SugarColumn(ColumnName = "cREATED_BY")]
+ public string CreatedBy { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ [SugarColumn(ColumnName = "cREATED_TIME")]
+ public DateTime? CreatedTime { get; set; }
+
+ ///
+ /// 更新人
+ ///
+ [SugarColumn(ColumnName = "uPDATED_BY")]
+ public string UpdatedBy { get; set; }
+
+ ///
+ /// 更新时间
+ ///
+ [SugarColumn(ColumnName = "uPDATED_TIME")]
+ public DateTime? UpdatedTime { get; set; }
+
+ }
+}
\ No newline at end of file
diff --git a/DOAN.Model/MES/Group/GroupSchedule.cs b/DOAN.Model/MES/Group/GroupSchedule.cs
new file mode 100644
index 0000000..3a49fe5
--- /dev/null
+++ b/DOAN.Model/MES/Group/GroupSchedule.cs
@@ -0,0 +1,75 @@
+
+namespace DOAN.Model.MES.group
+{
+ ///
+ /// 排班
+ ///
+ [SugarTable("group_schedule")]
+ public class GroupSchedule
+ {
+ ///
+ /// 雪花组id
+ ///
+ [SugarColumn(IsPrimaryKey = true, IsIdentity = false)]
+ public string Id { get; set; }
+
+ ///
+ /// 排班日期
+ ///
+ [SugarColumn(ColumnName = "schedule_date")]
+ public DateTime? ScheduleDate { get; set; }
+
+ ///
+ /// 组名
+ ///
+ [SugarColumn(ColumnName = "group_name")]
+ public string GroupName { get; set; }
+
+ ///
+ /// 组code
+ ///
+ [SugarColumn(ColumnName = "group_code")]
+ public string GroupCode { get; set; }
+
+
+ ///
+ /// 班次
+ ///
+ [SugarColumn(ColumnName = "fk_shift")]
+ public int FkShift { get; set; }
+
+ ///
+ /// 备注
+ ///
+ public string Remark { get; set; }
+
+ ///
+ /// 状态(0 1)
+ ///
+ public int Status { get; set; }
+
+ ///
+ /// 创建人
+ ///
+ [SugarColumn(ColumnName = "cREATED_BY")]
+ public string CreatedBy { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ [SugarColumn(ColumnName = "cREATED_TIME")]
+ public DateTime? CreatedTime { get; set; }
+
+ ///
+ /// 更新人
+ ///
+ [SugarColumn(ColumnName = "uPDATED_BY")]
+ public string UpdatedBy { get; set; }
+
+ ///
+ /// 更新时间
+ ///
+ [SugarColumn(ColumnName = "uPDATED_TIME")]
+ public DateTime? UpdatedTime { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/DOAN.Model/MES/Group/GroupShift.cs b/DOAN.Model/MES/Group/GroupShift.cs
new file mode 100644
index 0000000..654bcec
--- /dev/null
+++ b/DOAN.Model/MES/Group/GroupShift.cs
@@ -0,0 +1,73 @@
+namespace DOAN.Model.MES.group
+{
+ ///
+ /// 班次
+ ///
+ [SugarTable("group_shift")]
+ public class GroupShift
+ {
+ ///
+ /// 自增
+ ///
+ [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
+ public int Id { get; set; }
+
+ ///
+ /// 名称
+ ///
+ public string Name { get; set; }
+
+
+ ///
+ /// 工时
+ ///
+ public decimal WorkHours { get; set; }
+
+
+ ///
+ /// 开始时间
+ ///
+ [SugarColumn(ColumnName = "start_time")]
+ public DateTime? StartTime { get; set; }
+
+ ///
+ /// 结束时间
+ ///
+ [SugarColumn(ColumnName = "end_time")]
+ public DateTime? EndTime { get; set; }
+
+ ///
+ /// 状态(0 是不启用 1是启用)
+ ///
+ public int? Status { get; set; }
+
+ ///
+ /// 备注
+ ///
+ public string Remark { get; set; }
+
+ ///
+ /// 创建人
+ ///
+ [SugarColumn(ColumnName = "cREATED_BY")]
+ public string CreatedBy { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ [SugarColumn(ColumnName = "cREATED_TIME")]
+ public DateTime? CreatedTime { get; set; }
+
+ ///
+ /// 更新人
+ ///
+ [SugarColumn(ColumnName = "uPDATED_BY")]
+ public string UpdatedBy { get; set; }
+
+ ///
+ /// 更新时间
+ ///
+ [SugarColumn(ColumnName = "uPDATED_TIME")]
+ public DateTime? UpdatedTime { get; set; }
+ }
+}
\ No newline at end of file
diff --git a/DOAN.Service/MES/Group/GroupPersonService.cs b/DOAN.Service/MES/Group/GroupPersonService.cs
new file mode 100644
index 0000000..0c67c6f
--- /dev/null
+++ b/DOAN.Service/MES/Group/GroupPersonService.cs
@@ -0,0 +1,137 @@
+using System;
+using SqlSugar;
+using Infrastructure.Attribute;
+using Infrastructure.Extensions;
+using DOAN.Model;
+using DOAN.Model.Dto;
+using DOAN.Model.MES.group;
+using DOAN.Model.MES.group.Dto;
+using DOAN.Repository;
+using DOAN.Service.group.IService;
+using System.Linq;
+
+namespace DOAN.Service.group
+{
+ ///
+ /// 人员Service业务层处理
+ ///
+ [AppService(ServiceType = typeof(IGroupPersonService), ServiceLifetime = LifeTime.Transient)]
+ public class GroupPersonService : BaseService, IGroupPersonService
+ {
+ public List GetDescendants(List nodes, string rootId)
+ {
+ var descendants = new List();
+
+
+ void FindChildren(GroupPost node)
+ {
+ var children = nodes.Where(n => n.ParentId == node.Id).ToList();
+ foreach (var child in children)
+ {
+ descendants.Add(child);
+ FindChildren(child);
+ }
+ }
+
+ var rootNode = nodes.FirstOrDefault(n => n.Id == rootId);
+ if (rootNode != null)
+ {
+ FindChildren(rootNode);
+ }
+
+ return descendants;
+ }
+ ///
+ /// 查询人员列表
+ ///
+ ///
+ ///
+ public PagedInfo GetList(GroupPersonQueryDto parm)
+ {
+
+ string[] FkPostArray_all = null;
+ if (!string.IsNullOrEmpty(parm.FkPost))
+ {
+ string[] FkPostArray= FkPostArray = GetDescendants(Context.Queryable().ToList(), parm.FkPost)
+ .Select(it=>it.Id).ToArray();
+
+ FkPostArray_all = new string[] { parm.FkPost }.Concat(FkPostArray).ToArray();
+
+ }
+
+
+
+
+
+ var predicate = Expressionable.Create()
+ .AndIF(!string.IsNullOrEmpty(parm.WorkNum),it=>it.WorkNum.Contains(parm.WorkNum))
+ .AndIF(!string.IsNullOrEmpty(parm.Name),it=>it.Name.Contains(parm.Name))
+ .AndIF(parm.Status>=0,it=>it.Status==parm.Status)
+ .AndIF(FkPostArray_all!=null&&FkPostArray_all.Length>0, it=> FkPostArray_all.Contains(it.FkPost))
+ ;
+
+ var query = Queryable()
+ .Where(predicate.ToExpression());
+
+
+ var response= Context.Queryable(query)
+ .LeftJoin((q,p)=>q.FkPost==p.Id)
+ .Select((q, p) => new GroupPersonDto { PostName=p.PostName },true)
+ .ToPage(parm);
+
+ return response;
+ }
+
+
+ ///
+ /// 获取详情
+ ///
+ ///
+ ///
+ public GroupPerson GetInfo(string Id)
+ {
+ var response = Queryable()
+ .Where(x => x.Id == Id)
+ .First();
+
+ return response;
+ }
+
+ ///
+ /// 添加人员
+ ///
+ ///
+ ///
+ public GroupPerson AddGroupPerson(GroupPerson model)
+ {
+ model.Id = XueHua;
+ return Context.Insertable(model).ExecuteReturnEntity();
+ }
+
+ ///
+ /// 修改人员
+ ///
+ ///
+ ///
+ public int UpdateGroupPerson(GroupPerson model)
+ {
+ //var response = Update(w => w.Id == model.Id, it => new GroupPerson()
+ //{
+ // FkPost = model.FkPost,
+ // WorkNum = model.WorkNum,
+ // Name = model.Name,
+ // EmploymentTime = model.EmploymentTime,
+ // DepartureTime = model.DepartureTime,
+ // Phone = model.Phone,
+ // Status = model.Status,
+ // CreatedBy = model.CreatedBy,
+ // CreatedTime = model.CreatedTime,
+ // UpdatedBy = model.UpdatedBy,
+ // UpdatedTime = model.UpdatedTime,
+ //});
+ //return response;
+ return Update(model, true);
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/DOAN.Service/MES/Group/GroupPersonSkillMatrixService.cs b/DOAN.Service/MES/Group/GroupPersonSkillMatrixService.cs
new file mode 100644
index 0000000..26e2c97
--- /dev/null
+++ b/DOAN.Service/MES/Group/GroupPersonSkillMatrixService.cs
@@ -0,0 +1,302 @@
+using System;
+using SqlSugar;
+using Infrastructure.Attribute;
+using Infrastructure.Extensions;
+using DOAN.Model;
+using DOAN.Model.Dto;
+using DOAN.Model.MES.group;
+using DOAN.Model.MES.group.Dto;
+using DOAN.Repository;
+using DOAN.Service.group.IService;
+using System.Linq;
+using NPOI.SS.Formula.Functions;
+using NPOI.XSSF.UserModel;
+using Aliyun.OSS;
+using DOAN.Model.MES.base_.Dto;
+using DOAN.Model.MES.base_;
+using Microsoft.IdentityModel.Tokens;
+using Microsoft.AspNetCore.Mvc;
+
+namespace DOAN.Service.group
+{
+ ///
+ /// 人员技能Service业务层处理
+ ///
+ [AppService(ServiceType = typeof(IGroupPersonSkillService), ServiceLifetime = LifeTime.Transient)]
+ public class GroupPersonSkillService : BaseService, IGroupPersonSkillService
+ {
+ ///
+ /// 查询人员技能列表
+ ///
+ ///
+ ///
+ public PagedInfo GetList(GroupPersonSkillQueryDto parm)
+ {
+ var predicate = Expressionable.Create()
+ .AndIF(!string.IsNullOrEmpty(parm.SkillName), it => it.SkillName.Contains(parm.SkillName))
+ .AndIF(parm.Status > 0, it => it.Status == parm.Status)
+
+ ;
+
+ var response = Queryable()
+ .Where(predicate.ToExpression())
+ .ToPage(parm);
+
+ return response;
+ }
+
+
+ ///
+ /// 获取详情
+ ///
+ ///
+ ///
+ public GroupPersonSkill GetInfo(string Id)
+ {
+ var response = Queryable()
+ .Where(x => x.Id == Id)
+ .First();
+
+ return response;
+ }
+
+ ///
+ /// 添加人员技能
+ ///
+ ///
+ ///
+ public GroupPersonSkill AddGroupPersonSkill(GroupPersonSkill model)
+ {
+ if (string.IsNullOrEmpty(model.Id))
+ {
+ model.Id = XueHua;
+ }
+ return Context.Insertable(model).ExecuteReturnEntity();
+ }
+
+ ///
+ /// 修改人员技能
+ ///
+ ///
+ ///
+ public int UpdateGroupPersonSkill(GroupPersonSkill model)
+ {
+ //var response = Update(w => w.Id == model.Id, it => new GroupPersonSkill()
+ //{
+ // SkillName = model.SkillName,
+ // Image = model.Image,
+ // Vedio = model.Vedio,
+ // Remark = model.Remark,
+ // Status = model.Status,
+ // CreatedBy = model.CreatedBy,
+ // CreatedTime = model.CreatedTime,
+ // UpdatedBy = model.UpdatedBy,
+ // UpdatedTime = model.UpdatedTime,
+ //});
+ //return response;
+ return Update(model, true);
+ }
+
+ ///
+ /// 人员技能评估
+ ///
+ ///
+ ///
+ public int PersonskillAssessment(GroupRelPersonSkill relPersonSkill)
+ {
+ return Context.Storageable(relPersonSkill).ExecuteCommand();
+
+ }
+
+ //获取人员已经拥有的技能
+ public List GetPersonSkills(string person_id)
+ {
+ var query = Context.Queryable().Where(it => it.FkPersonId == person_id);
+ return Context.Queryable(query).LeftJoin((rel, s) => rel.FkSkillId == s.Id)
+ .Select((rel, s) => new GroupPersonSkillDto2() { score = rel.Score.Value }, true)
+ .ToList();
+
+
+
+ }
+ //获取人员没有拥有的技能
+ public PagedInfo GetPersonUnownSkills(GroupPersonSkillQueryDto2 parm)
+ {
+ var query = Context.Queryable().Where(it => it.FkPersonId == parm.person_id);
+ return Context.Queryable(query).RightJoin((rel, s) => rel.FkSkillId == s.Id)
+ .Where((rel, s) => rel.FkSkillId == null)
+ .WhereIF(!string.IsNullOrEmpty(parm.SkillName), (rel, s) => s.SkillName.Contains(parm.SkillName))
+ .Select((rel, s) => s)
+ .ToPage(parm);
+
+
+ }
+ ///
+ /// 取消绑定
+ ///
+ ///
+ ///
+ ///
+
+ public int CancalPersonSkillBind(string person_id, string skill_id)
+ {
+ return Context.Deleteable()
+ .Where(it => it.FkPersonId == person_id && it.FkSkillId == skill_id)
+ .ExecuteCommand();
+ }
+
+ ///
+ /// 获取工艺路线
+ ///
+ ///
+ ///
+ public List GetWorkRouteList([FromBody] BaseWorkRouteQueryDto query)
+ {
+ List workRouteList = Context.Queryable()
+ .WhereIF(!string.IsNullOrEmpty(query.Name), it => it.Name.Contains(query.Name))
+ .WhereIF(!string.IsNullOrEmpty(query.Code), it => it.Code.Contains(query.Code))
+ .WhereIF(query.Status > 0, it => it.Status == query.Status)
+ .ToList();
+
+ return workRouteList;
+
+ }
+ ///
+ /// 根据工艺路线查工位
+ ///
+ ///
+ ///
+ public PagedInfo GetWorkstationbyRoute(BaseWorkStationQueryDto2 query)
+ {
+ var query1 = Context.Queryable()
+ .Where(it => it.FkWorkRoute == query.route_id);
+ List workProcesses = Context.Queryable(query1).LeftJoin((q, p) => q.FkWorkProcesses == p.Id)
+ .Select((q, p) => p)
+ .ToList();
+ int?[] filters= workProcesses.Select(it=>it.Id).ToArray();
+
+ return Context.Queryable()
+ .Where(it => filters.Contains(it.FkWorkProcesses))
+ .ToPage(query);
+ }
+ ///
+ /// 获取工艺路线与工序父子表
+ ///
+ ///
+ ///
+ public List RouteProcessParentSon(BaseWorkRouteQueryDto query)
+ {
+ List result = new List();
+
+ List workRouteList = Context.Queryable()
+ .WhereIF(!string.IsNullOrEmpty(query.Name), it => it.Name.Contains(query.Name))
+ .WhereIF(!string.IsNullOrEmpty(query.Code), it => it.Code.Contains(query.Code))
+ .WhereIF(query.Status > 0, it => it.Status == query.Status)
+ .ToList();
+ // int[] queryints = workRouteList.Select(it => it.Id).ToArray();
+ if (workRouteList != null && workRouteList.Count > 0)
+ {
+ foreach (var workRoute in workRouteList)
+ {
+ RouteANDprocess parent = new RouteANDprocess();
+ parent.Name = workRoute.Name;
+ parent.Id = workRoute.Id;
+ parent.parentId = 0;
+
+ result.Add(parent);
+ var query1 = Context.Queryable()
+ .Where(it => it.FkWorkRoute == workRoute.Id);
+ List workProcesses = Context.Queryable(query1).LeftJoin((q, p) => q.FkWorkProcesses == p.Id)
+ .Select((q, p) => p)
+ .ToList();
+
+
+ if (workProcesses != null && workProcesses.Count > 0)
+ {
+ foreach (var process in workProcesses)
+ {
+ RouteANDprocess son = new RouteANDprocess();
+ son.Name = process.Name;
+ son.Id = process.Id.Value;
+ son.parentId = parent.Id;
+ result.Add(son);
+ }
+
+
+ }
+
+
+
+
+ }
+
+
+
+ }
+
+
+ return result;
+ }
+ ///
+ /// 根据工序查工位
+ ///
+ ///
+ ///
+ public List GetWorkstationList_byProccess(int workProcess_id)
+ {
+ return Context.Queryable().Where(it => it.FkWorkProcesses == workProcess_id).ToList();
+
+ }
+ ///
+ /// 获取工位绑定的技能
+ ///
+ ///
+ ///
+ public List GetWorkstationBindSkillList(int workstation_id)
+ {
+
+ var query = Context.Queryable().Where(it => it.FkWorkstationId == workstation_id);
+
+ return Context.Queryable(query).LeftJoin((rel, s) => rel.FkSkillId == s.Id)
+ .Select((rel, s) => s)
+ .ToList();
+
+ }
+
+ ///
+ /// 获取工位没有绑定的技能 分页
+ ///
+ ///
+ ///
+ public PagedInfo GetWorkstationunBindSkillList(GroupPersonSkillQueryDto3 parm)
+ {
+ var query = Context.Queryable().Where(it => it.FkWorkstationId == parm.workstation_id);
+ return Context.Queryable(query).RightJoin((rel, s) => rel.FkSkillId == s.Id)
+ .Where((rel, s) => rel.FkSkillId == null)
+ .WhereIF(!string.IsNullOrEmpty(parm.SkillName),(rel, s) => s.SkillName.Contains(parm.SkillName))
+ .Select((rel, s) => s)
+ .ToPage(parm);
+
+
+ }
+
+ public int HandleWorkstationbindSkill(int workstation_id, string skill_id)
+ {
+ GroupRelWorkstationSkill relWorkstationSkill = new GroupRelWorkstationSkill();
+ relWorkstationSkill.FkSkillId = skill_id;
+ relWorkstationSkill.FkWorkstationId = workstation_id;
+ return Context.Insertable(relWorkstationSkill).ExecuteCommand();
+
+
+ }
+ public int LiftedWorkstationbindSkill(int workstation_id, string skill_id)
+ {
+ return Context.Deleteable()
+ .Where(it => it.FkWorkstationId == workstation_id)
+ .Where(it => it.FkSkillId == skill_id)
+ .ExecuteCommand();
+ }
+
+
+ }
+}
\ No newline at end of file
diff --git a/DOAN.Service/MES/Group/GroupPostService.cs b/DOAN.Service/MES/Group/GroupPostService.cs
new file mode 100644
index 0000000..9c55b4e
--- /dev/null
+++ b/DOAN.Service/MES/Group/GroupPostService.cs
@@ -0,0 +1,135 @@
+using System;
+using SqlSugar;
+using Infrastructure.Attribute;
+using Infrastructure.Extensions;
+using DOAN.Model;
+using DOAN.Model.Dto;
+using DOAN.Model.MES.group;
+using DOAN.Model.MES.group.Dto;
+using DOAN.Repository;
+using DOAN.Service.group.IService;
+using System.Linq;
+using DOAN.Common;
+
+namespace DOAN.Service.group
+{
+ ///
+ /// 岗位Service业务层处理
+ ///
+ [AppService(ServiceType = typeof(IGroupPostService), ServiceLifetime = LifeTime.Transient)]
+ public class GroupPostService : BaseService, IGroupPostService
+ {
+ ///
+ /// 查询岗位列表
+ ///
+ ///
+ ///
+ public PagedInfo GetList(GroupPostQueryDto parm)
+ {
+ var predicate = Expressionable.Create()
+ .AndIF(!string.IsNullOrEmpty(parm.PostName), it => it.PostName.Contains(parm.PostName));
+
+ ;
+
+ var response = Queryable()
+ .Where(predicate.ToExpression())
+ .ToPage(parm);
+
+ return response;
+ }
+
+
+ ///
+ /// 获取详情
+ ///
+ ///
+ ///
+ public GroupPost GetInfo(string Id)
+ {
+ var response = Queryable()
+ .Where(x => x.Id == Id)
+ .First();
+
+ return response;
+ }
+
+ ///
+ /// 添加岗位
+ ///
+ ///
+ ///
+ public GroupPost AddGroupPost(GroupPost model)
+ {
+ model.Id = XueHua;
+ if (string.IsNullOrEmpty(model.ParentId))
+ {
+ model.ParentId = "0";
+ }
+
+ return Context.Insertable(model).ExecuteReturnEntity();
+ }
+
+ ///
+ /// 修改岗位
+ ///
+ ///
+ ///
+ public int UpdateGroupPost(GroupPost model)
+ {
+ //var response = Update(w => w.Id == model.Id, it => new GroupPost()
+ //{
+ // PostName = model.PostName,
+ // Status = model.Status,
+ // Remark = model.Remark,
+ // CreatedBy = model.CreatedBy,
+ // CreatedTime = model.CreatedTime,
+ // UpdatedBy = model.UpdatedBy,
+ // UpdatedTime = model.UpdatedTime,
+ //});
+ //return response;
+ return Update(model, true);
+ }
+
+ ///
+ /// 删除岗位包括子
+ ///
+ ///
+ ///
+ public int RemoveGroupPost(string[] ids)
+ {
+ List all_nodes = Context.Queryable().ToList();
+
+
+ List Descendants = GetDescendants(all_nodes, ids[0]);
+
+
+ List children = Descendants.Select(it => it.Id).ToList();
+ children.Add(ids[0]);
+
+ return Delete(children.ToArray());
+ }
+ public List GetDescendants(List nodes, string rootId)
+ {
+ var descendants = new List();
+
+
+ void FindChildren(GroupPost node)
+ {
+ var children = nodes.Where(n => n.ParentId == node.Id).ToList();
+ foreach (var child in children)
+ {
+ descendants.Add(child);
+ FindChildren(child);
+ }
+ }
+
+ var rootNode = nodes.FirstOrDefault(n => n.Id == rootId);
+ if (rootNode != null)
+ {
+ FindChildren(rootNode);
+ }
+
+ return descendants;
+ }
+ }
+}
\ No newline at end of file
diff --git a/DOAN.Service/MES/Group/GroupScheduleService.cs b/DOAN.Service/MES/Group/GroupScheduleService.cs
new file mode 100644
index 0000000..80e6209
--- /dev/null
+++ b/DOAN.Service/MES/Group/GroupScheduleService.cs
@@ -0,0 +1,359 @@
+using System;
+using SqlSugar;
+using Infrastructure.Attribute;
+using Infrastructure.Extensions;
+using DOAN.Model;
+using DOAN.Model.Dto;
+using DOAN.Model.MES.group;
+using DOAN.Model.MES.group.Dto;
+using DOAN.Repository;
+using DOAN.Service.group.IService;
+using System.Linq;
+using DOAN.Model.MES.group.Dto;
+using Aliyun.OSS;
+using Microsoft.AspNetCore.Http.HttpResults;
+using MimeKit.Tnef;
+using System.Collections.Generic;
+using DOAN.Model.MES.base_;
+
+namespace DOAN.Service.Business
+{
+ ///
+ /// 排班Service业务层处理
+ ///
+ [AppService(ServiceType = typeof(IGroupScheduleService), ServiceLifetime = LifeTime.Transient)]
+ public class GroupScheduleService : BaseService, IGroupScheduleService
+ {
+ ///
+ /// 查询排班列表
+ ///
+ ///
+ ///
+ public PagedInfo GetList(GroupScheduleQueryDto parm)
+ {
+ var predicate = Expressionable.Create();
+ var response = Queryable()
+ .Where(predicate.ToExpression())
+ .ToPage(parm);
+
+ return response;
+ }
+
+
+ ///
+ /// 获取详情
+ ///
+ ///
+ ///
+ public GroupSchedule GetInfo(string Id)
+ {
+ var response = Queryable()
+ .Where(x => x.Id == Id)
+ .First();
+
+ return response;
+ }
+
+ ///
+ /// 添加排班
+ ///
+ ///
+ ///
+ public GroupSchedule AddGroupSchedule(GroupSchedule model)
+ {
+ model.Id = XueHua;
+ return Context.Insertable(model).ExecuteReturnEntity();
+ }
+
+ ///
+ /// 修改排班
+ ///
+ ///
+ ///
+ public int UpdateGroupSchedule(GroupSchedule model)
+ {
+ //var response = Update(w => w.Id == model.Id, it => new GroupSchedule()
+ //{
+ // ScheduleDate = model.ScheduleDate,
+ // GroupName = model.GroupName,
+ // GrouoCode = model.GrouoCode,
+ // BelongRoute = model.BelongRoute,
+ // Remark = model.Remark,
+ // Status = model.Status,
+ // CreatedBy = model.CreatedBy,
+ // CreatedTime = model.CreatedTime,
+ // UpdatedBy = model.UpdatedBy,
+ // UpdatedTime = model.UpdatedTime,
+ //});
+ //return response;
+ return Update(model, true);
+ }
+
+ ///
+ /// 1 根据日期获取班组
+ ///
+ ///
+ ///
+ public PagedInfo ListGroupByDate(GroupScheduleQueryDto2 query)
+ {
+ query.ScheduleDate = query.ScheduleDate.Date;
+ return Queryable().LeftJoin((it, sh) => it.FkShift == sh.Id).Where((it, sh) => it.ScheduleDate == query.ScheduleDate)
+ .Select((it, sh) => new GroupScheduleDto { ShiftName = sh.Name }, true)
+ .ToPage(query);
+
+
+ }
+
+ ///
+ /// 查询班组绑定的人员
+ ///
+ ///
+ ///
+ public List SearchPerson_group_bind(string group_schedule_id)
+ {
+ var query = Context.Queryable()
+ .LeftJoin((rel, p) => rel.FkPersonId == p.Id)
+ .Where((rel, p) => rel.FkGroupId == group_schedule_id)
+ .Where((rel, p) => p.Status == 1)
+ .Select((rel, p) => p);
+
+
+ return Context.Queryable(query)
+ .LeftJoin((q, p) => q.FkPost == p.Id)
+ .Select((q, p) => new GroupPersonDto { PostName = p.PostName }, true)
+ .ToList();
+
+
+ }
+
+ ///
+ /// 查询班组未绑定的人员
+ ///
+ ///
+ ///
+ ///
+ public PagedInfo SearchPerson_group_bind_No(GroupScheduleQueryDto3 parm)
+ {
+ // 查询日期内所有绑定人员
+
+ //查询指定日期排班
+
+ //查询排班所有绑定的人员
+
+ // 查询排班内所有未绑定人员
+ var query = Context.Queryable().Where(it => SqlFunc.Subqueryable()
+ .LeftJoin((rel, p) => rel.FkPersonId == p.Id)
+ .Where((rel, p) => p.Status == 1)
+ .Where((rel, p) => SqlFunc.Subqueryable().Where(it => it.ScheduleDate == SqlFunc.Subqueryable()
+ .Where(it => it.Id == parm.group_schedule_id)
+ .Select(it => it.ScheduleDate)).Where(it => it.Id == rel.FkGroupId).Any()).Where((rel, p) => p.Id == it.Id).NotAny());
+
+
+ return Context.Queryable(query)
+ .LeftJoin((q, p) => q.FkPost == p.Id)
+ .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 == parm.FkPost)
+ .Select((q, p) => new GroupPersonDto { PostName = p.PostName }, true)
+ .ToPage(parm);
+
+
+ }
+
+
+ public List GetALLGroup(string group_code, string group_name)
+ {
+ return Context.Queryable()
+ .WhereIF(!string.IsNullOrEmpty(group_code),it=>it.GroupCode.Contains(group_code))
+ .WhereIF(!string.IsNullOrEmpty(group_name),it=>it.GroupName.Contains(group_name))
+ .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()
+ .Where(it => it.FkGroupId == group_schedule_id)
+ .Where(it => it.FkPersonId == person_id)
+ .ExecuteCommand();
+ }
+
+ ///
+ /// 获取本月排班情况
+ ///
+ ///
+ ///
+ public List GetMonthScheduleResult(int year, int HandleMonth)
+ {
+ List results = new List();
+ //获取月份所有日期
+ List GetDatesOfMonth(int year, int month)
+ {
+
+ 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(year, HandleMonth);
+
+ foreach (DateTime date in All_Dates)
+ {
+ int counts = Queryable().Where(it => it.ScheduleDate == date).Count();
+ SchedulingSituation situation = new SchedulingSituation();
+ situation.Date1 = date.ToString("yyyy-MM-dd");
+ situation.groupNum = counts;
+ results.Add(situation);
+
+
+
+ }
+
+ return results;
+
+ }
+
+
+ public int CopyPreDaySchedule(DateTime date, string CreatedBy)
+ {
+ int result = 0;
+ DateTime PreDate = date.ToLocalTime().AddDays(-1).Date;
+
+ List date_schedules = Queryable().Where(it => it.ScheduleDate == PreDate).ToList();
+
+ if (date_schedules == null || date_schedules.Count == 0) { return -1; }
+ bool isExist = Queryable().Where(it => it.ScheduleDate == date.ToLocalTime()).Any();
+ if (isExist) { return -2; }
+
+ //TODO copy 班组人员
+ string[] collects = date_schedules.Select(it => it.Id).ToArray();
+ List Copy_groups = Context.Queryable().Where(it => collects.Contains(it.FkGroupId)).ToList();
+
+ List inserts_GroupRelPersonGroup = new List();
+
+ foreach (var group in date_schedules)
+ {
+
+ group.ScheduleDate = date.ToLocalTime();
+ group.CreatedBy = CreatedBy;
+ group.CreatedTime = DateTime.Now;
+ group.UpdatedBy = CreatedBy;
+ group.UpdatedTime = DateTime.Now;
+ //组绑定 的人员
+ List Copy_group_presons = Copy_groups.Where(it => it.FkGroupId == group.Id).ToList();
+ if (Copy_group_presons.Count > 0)
+ {
+ group.Id = XueHua;
+ foreach (var person in Copy_group_presons)
+ {
+ person.FkGroupId = group.Id;
+ person.CreatedBy = group.CreatedBy;
+ person.CreatedTime = group.CreatedTime;
+ }
+ string[] person_id_array = Copy_group_presons.Select(it => it.FkPersonId).ToArray();
+
+ string[] Resigneds = Context.Queryable().Where(it => person_id_array.Contains(it.Id))
+ .Where(it => it.Status == 0)
+ .Select(it => it.Id)
+ .ToArray();
+ if (Resigneds.Length > 0)
+ {
+ Copy_group_presons = Copy_group_presons.Where(it => !Resigneds.Contains(it.FkPersonId)).ToList();
+ }
+
+
+ inserts_GroupRelPersonGroup.AddRange(Copy_group_presons);
+
+ }else
+ {
+ group.Id = XueHua;
+ }
+
+ }
+
+
+ UseTran2(() =>
+ {
+ // 删除原有数据
+ // Context.Deleteable(date_schedules).ExecuteCommand();
+ // Context.Deleteable().Where(it => collects.Contains(it.FkGroupId)).ExecuteCommand();
+ result = Context.Insertable(date_schedules).ExecuteCommand();
+ Context.Insertable(inserts_GroupRelPersonGroup).ExecuteCommand();
+
+ });
+
+
+ return result;
+ }
+
+ public List GetAllRoutes()
+ {
+ return Context.Queryable().Where(it=>it.Status==1).ToList();
+ }
+
+ ///
+ /// 获取在这个工艺流程下人员的技能
+ ///
+ ///
+ ///
+ ///
+ public List GetSkillsOFperson(string person_id, int route_id)
+ {
+ //获取工艺流程下的工位的技能
+ var query= Context.Queryable()
+ .Where(it => it.FkWorkRoute == route_id);
+
+
+ var query2 = Context.Queryable(query)
+ .LeftJoin((q, p) => q.FkWorkProcesses == p.Id)
+ .Where((q, p) => p.Status == 1).Select((q, p) => p);
+ //查到工位
+ var query3 = Context.Queryable(query2).LeftJoin((q, s) => q.Id == s.Id)
+ .Where((q, s) => s.Status == 1).Select((q, s) => s);
+ //工位技能要求
+ List SkillList= Context.Queryable(query3).LeftJoin((q,skill)=>q.Id==skill.FkWorkstationId)
+ .Select((q, skill) => skill).ToList();
+ string[] queryArray=SkillList.Select(it=>it.FkSkillId).ToArray();
+ var query4 = Context.Queryable().Where(it => it.FkPersonId == person_id)
+ .Where(it => queryArray.Contains(it.FkSkillId));
+
+
+ List result_List= Context.Queryable(query4).LeftJoin((q,s)=>q.FkSkillId==s.Id)
+ .Select((q, s) => new GroupPersonOfSkillDto()
+ {
+ FkSkillId = q.FkSkillId,
+ SkillName=s.SkillName,
+ Score = q.Score,
+ }).ToList();
+ foreach (var item in result_List)
+ {
+ foreach (var item2 in SkillList)
+ {
+ if(item.FkSkillId == item2.FkSkillId)
+ {
+ item.WorkStationDescription = item.WorkStationDescription;
+ }
+ }
+ }
+ return result_List;
+
+ }
+ }
+}
\ No newline at end of file
diff --git a/DOAN.Service/MES/Group/GroupShiftService.cs b/DOAN.Service/MES/Group/GroupShiftService.cs
new file mode 100644
index 0000000..a09787b
--- /dev/null
+++ b/DOAN.Service/MES/Group/GroupShiftService.cs
@@ -0,0 +1,109 @@
+using System;
+using SqlSugar;
+using Infrastructure.Attribute;
+using Infrastructure.Extensions;
+using DOAN.Model;
+using DOAN.Model.MES.group.Dto;
+using DOAN.Model.MES.group;
+using DOAN.Repository;
+using DOAN.Service.group.IService;
+
+using System.Linq;
+using Mapster;
+
+namespace DOAN.Service.group
+{
+ ///
+ /// 班次Service业务层处理
+ ///
+ [AppService(ServiceType = typeof(IGroupShiftService), ServiceLifetime = LifeTime.Transient)]
+ public class GroupShiftService : BaseService, IGroupShiftService
+ {
+ ///
+ /// 查询班次列表
+ ///
+ ///
+ ///
+ public PagedInfo GetList(GroupShiftQueryDto parm)
+ {
+ var predicate = Expressionable.Create();
+
+ var response = Queryable()
+ .Where(predicate.ToExpression())
+ .ToPage(parm);
+ TypeAdapterConfig.NewConfig()
+ .Map(dest => dest.StartTime, src => src.StartTime.Value.TimeOfDay) // 自定义映射规则
+ .Map(dest => dest.EndTime, src => src.EndTime.Value.TimeOfDay); // 自定义映射规则
+
+
+ List responseresult = new List();
+ foreach (var item in response.Result)
+ {
+ GroupShiftDto2 groupShiftDto2 = new GroupShiftDto2();
+ //groupShiftDto2.StartTime = item.StartTime.Value.TimeOfDay;
+ //groupShiftDto2.EndTime = item.StartTime.Value.TimeOfDay;
+ groupShiftDto2 = item.Adapt();
+ responseresult.Add(groupShiftDto2);
+ }
+
+
+ PagedInfo result= new PagedInfo();
+ result.PageSize= response.PageSize;
+ result.PageIndex = response.PageIndex;
+ result.TotalNum = response.TotalNum;
+ result.TotalPage = response.TotalPage;
+ result.Result = responseresult;
+
+ return result;
+ }
+
+
+ ///
+ /// 获取详情
+ ///
+ ///
+ ///
+ public GroupShift GetInfo(int Id)
+ {
+ var response = Queryable()
+ .Where(x => x.Id == Id)
+ .First();
+
+ return response;
+ }
+
+ ///
+ /// 添加班次
+ ///
+ ///
+ ///
+ public GroupShift AddGroupShift(GroupShift model)
+ {
+ return Context.Insertable(model).ExecuteReturnEntity();
+ }
+
+ ///
+ /// 修改班次
+ ///
+ ///
+ ///
+ public int UpdateGroupShift(GroupShift model)
+ {
+ //var response = Update(w => w.Id == model.Id, it => new GroupShift()
+ //{
+ // Name = model.Name,
+ // StartTime = model.StartTime,
+ // EndTime = model.EndTime,
+ // Status = model.Status,
+ // Remark = model.Remark,
+ // CreatedBy = model.CreatedBy,
+ // CreatedTime = model.CreatedTime,
+ // UpdatedBy = model.UpdatedBy,
+ // UpdatedTime = model.UpdatedTime,
+ //});
+ //return response;
+ return Update(model, true);
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/DOAN.Service/MES/Group/IService/IGroupPersonService.cs b/DOAN.Service/MES/Group/IService/IGroupPersonService.cs
new file mode 100644
index 0000000..cfc3dce
--- /dev/null
+++ b/DOAN.Service/MES/Group/IService/IGroupPersonService.cs
@@ -0,0 +1,28 @@
+using System;
+using DOAN.Model;
+using DOAN.Model.Dto;
+using DOAN.Model.MES.group;
+using DOAN.Model.MES.group.Dto;
+using System.Collections.Generic;
+using DOAN.Model.MES.base_;
+
+namespace DOAN.Service.group.IService
+{
+ ///
+ /// 人员service接口
+ ///
+ public interface IGroupPersonService : IBaseService
+ {
+ PagedInfo GetList(GroupPersonQueryDto parm);
+
+ GroupPerson GetInfo(string Id);
+
+ GroupPerson AddGroupPerson(GroupPerson parm);
+
+ int UpdateGroupPerson(GroupPerson parm);
+
+
+
+
+ }
+}
diff --git a/DOAN.Service/MES/Group/IService/IGroupPersonSkillMatrixService.cs b/DOAN.Service/MES/Group/IService/IGroupPersonSkillMatrixService.cs
new file mode 100644
index 0000000..ac85f75
--- /dev/null
+++ b/DOAN.Service/MES/Group/IService/IGroupPersonSkillMatrixService.cs
@@ -0,0 +1,54 @@
+using System;
+using DOAN.Model;
+using DOAN.Model.Dto;
+using DOAN.Model.MES.group;
+using DOAN.Model.MES.group.Dto;
+using System.Collections.Generic;
+using Microsoft.AspNetCore.Mvc;
+using MimeKit.Tnef;
+using DOAN.Model.MES.base_.Dto;
+using DOAN.Model.MES.base_;
+
+namespace DOAN.Service.group.IService
+{
+ ///
+ /// 人员技能service接口
+ ///
+ public interface IGroupPersonSkillService : IBaseService
+ {
+ PagedInfo GetList(GroupPersonSkillQueryDto parm);
+
+ GroupPersonSkill GetInfo(string Id);
+
+ GroupPersonSkill AddGroupPersonSkill(GroupPersonSkill parm);
+
+ int UpdateGroupPersonSkill(GroupPersonSkill parm);
+
+ int PersonskillAssessment(GroupRelPersonSkill relPersonSkill);
+
+ List GetPersonSkills(string person_id);
+ PagedInfo GetPersonUnownSkills(GroupPersonSkillQueryDto2 parm);
+
+ int CancalPersonSkillBind(string person_id, string skill_id);
+
+
+
+
+
+ List GetWorkRouteList([FromBody] BaseWorkRouteQueryDto query);
+
+ PagedInfo GetWorkstationbyRoute(BaseWorkStationQueryDto2 query);
+
+ List RouteProcessParentSon(BaseWorkRouteQueryDto query);
+
+ List GetWorkstationList_byProccess(int workProcess_id);
+
+ List GetWorkstationBindSkillList(int workstation_id);
+
+ PagedInfo GetWorkstationunBindSkillList(GroupPersonSkillQueryDto3 parm);
+
+ int HandleWorkstationbindSkill(int workstation_id, string skill_id);
+ int LiftedWorkstationbindSkill(int workstation_id, string skill_id);
+
+ }
+}
diff --git a/DOAN.Service/MES/Group/IService/IGroupPostService.cs b/DOAN.Service/MES/Group/IService/IGroupPostService.cs
new file mode 100644
index 0000000..014ef89
--- /dev/null
+++ b/DOAN.Service/MES/Group/IService/IGroupPostService.cs
@@ -0,0 +1,26 @@
+using System;
+using DOAN.Model;
+using DOAN.Model.Dto;
+using DOAN.Model.MES.group;
+using DOAN.Model.MES.group.Dto;
+using System.Collections.Generic;
+
+namespace DOAN.Service.group.IService
+{
+ ///
+ /// 岗位service接口
+ ///
+ public interface IGroupPostService : IBaseService
+ {
+ PagedInfo GetList(GroupPostQueryDto parm);
+
+ GroupPost GetInfo(string Id);
+
+ GroupPost AddGroupPost(GroupPost parm);
+
+ int UpdateGroupPost(GroupPost parm);
+
+ int RemoveGroupPost(string[] ids);
+
+ }
+}
diff --git a/DOAN.Service/MES/Group/IService/IGroupScheduleService.cs b/DOAN.Service/MES/Group/IService/IGroupScheduleService.cs
new file mode 100644
index 0000000..e09660c
--- /dev/null
+++ b/DOAN.Service/MES/Group/IService/IGroupScheduleService.cs
@@ -0,0 +1,43 @@
+using System;
+using DOAN.Model;
+using DOAN.Model.MES.group;
+using DOAN.Model.MES.group.Dto;
+using System.Collections.Generic;
+using DOAN.Model.MES.base_;
+
+namespace DOAN.Service.group.IService
+{
+ ///
+ /// 排班service接口
+ ///
+ public interface
+
+ IGroupScheduleService : IBaseService
+ {
+ PagedInfo GetList(GroupScheduleQueryDto parm);
+
+ GroupSchedule GetInfo(string Id);
+
+ GroupSchedule AddGroupSchedule(GroupSchedule parm);
+
+ int UpdateGroupSchedule(GroupSchedule parm);
+
+ PagedInfo ListGroupByDate(GroupScheduleQueryDto2 query);
+
+ List SearchPerson_group_bind(string group_schedule_id);
+ PagedInfo SearchPerson_group_bind_No(GroupScheduleQueryDto3 parm);
+
+ List GetALLGroup(string group_code,string group_name);
+ int GroupAddPerson(string group_schedule_id, string person_id, string CreatedBy);
+ int GroupRemovePerson(string group_schedule_id, string person_id);
+
+ List GetMonthScheduleResult(int year,int HandleMonth);
+
+ int CopyPreDaySchedule(DateTime date, string CreatedBy);
+
+ List GetAllRoutes();
+
+
+ List GetSkillsOFperson(string person_id, int route_id);
+ }
+}
diff --git a/DOAN.Service/MES/Group/IService/IGroupShiftService.cs b/DOAN.Service/MES/Group/IService/IGroupShiftService.cs
new file mode 100644
index 0000000..43a5197
--- /dev/null
+++ b/DOAN.Service/MES/Group/IService/IGroupShiftService.cs
@@ -0,0 +1,24 @@
+using System;
+using DOAN.Model;
+using DOAN.Model.Dto;
+using DOAN.Model.MES.group;
+using DOAN.Model.MES.group.Dto;
+using System.Collections.Generic;
+
+namespace DOAN.Service.group.IService
+{
+ ///
+ /// 班次service接口
+ ///
+ public interface IGroupShiftService : IBaseService
+ {
+ PagedInfo GetList(GroupShiftQueryDto parm);
+
+ GroupShift GetInfo(int Id);
+
+ GroupShift AddGroupShift(GroupShift parm);
+
+ int UpdateGroupShift(GroupShift parm);
+
+ }
+}
diff --git a/DOAN.Service/MES/Group/IService/ISkillMatrixService.cs b/DOAN.Service/MES/Group/IService/ISkillMatrixService.cs
new file mode 100644
index 0000000..f244515
--- /dev/null
+++ b/DOAN.Service/MES/Group/IService/ISkillMatrixService.cs
@@ -0,0 +1,23 @@
+using System;
+using DOAN.Model;
+using DOAN.Model.Dto;
+using DOAN.Model.MES.group;
+using DOAN.Model.MES.group.Dto;
+using System.Collections.Generic;
+using DOAN.Model.MES.base_;
+using Microsoft.AspNetCore.Mvc;
+
+namespace DOAN.Service.MES.group.IService
+{
+ public interface ISkillMatrixService
+ {
+
+ List GetAllGroups(DateTime date);
+
+ List GetAllRoutes();
+
+ List GetPersonsList(string group_schedule_id);
+
+ HandleSkillInfoDto GetSkillsDetailofPepole(HandleSkillQueryDto parm);
+ }
+}
diff --git a/DOAN.Service/MES/Group/SkillMatrixService.cs b/DOAN.Service/MES/Group/SkillMatrixService.cs
new file mode 100644
index 0000000..be57dc7
--- /dev/null
+++ b/DOAN.Service/MES/Group/SkillMatrixService.cs
@@ -0,0 +1,182 @@
+using DOAN.Model.MES.group;
+using DOAN.Service.group.IService;
+using System;
+using SqlSugar;
+using Infrastructure.Attribute;
+using Infrastructure.Extensions;
+using DOAN.Model;
+using DOAN.Model.MES.group.Dto;
+using DOAN.Model.MES.group;
+using DOAN.Repository;
+using DOAN.Service.group.IService;
+
+using System.Linq;
+using Mapster;
+using DOAN.Service.MES.group.IService;
+using DOAN.Model.MES.base_;
+using NPOI.SS.Formula.Functions;
+using System.Dynamic;
+
+namespace DOAN.Service.group
+{
+ ///
+ /// 班次Service业务层处理
+ ///
+ [AppService(ServiceType = typeof(ISkillMatrixService), ServiceLifetime = LifeTime.Transient)]
+ public class SkillMatrixService : BaseService, ISkillMatrixService
+ {
+ public List GetAllGroups(DateTime date)
+ {
+ return Context.Queryable().Where(it => it.Status == 1)
+ .Where(it => it.ScheduleDate == date)
+ .ToList();
+
+ }
+
+ public List GetAllRoutes()
+ {
+ return Context.Queryable().Where(it => it.Status == 1).ToList();
+ }
+ public List GetPersonsList(string group_schedule_id)
+ {
+ var query = Context.Queryable()
+ .Where(it => it.FkGroupId == group_schedule_id);
+ var result = Context.Queryable(query).LeftJoin((q, p) => q.FkPersonId == p.Id)
+ .Select((q, p) => p).ToList();
+
+ return result;
+ }
+
+ ///
+ /// 获取人员在某一工艺流程下技能的详情
+ ///
+ ///
+ ///
+ public HandleSkillInfoDto GetSkillsDetailofPepole(HandleSkillQueryDto parm)
+ {
+ HandleSkillInfoDto handleSkillInfoDto = new HandleSkillInfoDto();
+
+ // 3 人员技能列表
+
+
+ List personOfKills_List = new List();
+ List groupPeople = Context.Queryable().LeftJoin((pe, po) => pe.FkPost == po.Id)
+ .Where((pe, po) => parm.person_id.Contains(pe.Id))
+ .Select((pe, po) => new GroupPersonDto() { PostName = po.PostName }, true)
+ .ToList();
+ if (groupPeople != null && groupPeople.Count() > 0)
+ {
+ foreach (GroupPersonDto person in groupPeople)
+ {
+ dynamic personOfKills = new ExpandoObject();
+ personOfKills.personId = person.Id;
+ personOfKills.personName = person.Name;
+ personOfKills.workNum = person.WorkNum;
+ personOfKills.postName = person.PostName;
+ personOfKills_List.Add(personOfKills);
+ }
+ }
+ handleSkillInfoDto.tableList = personOfKills_List;
+
+
+
+ // 1 获取工艺流程
+ handleSkillInfoDto.RouteName = Context.Queryable().Where(it => it.Id == parm.Route_id).Select(it => it.Name).First();
+ // 2 获取工艺流程绑定的工序
+ List Processess = Context.Queryable().LeftJoin((rel, p) => rel.FkWorkProcesses == p.Id)
+ .Where((rel, p) => rel.FkWorkRoute == parm.Route_id).Select((rel, p) => p).ToList();
+
+
+ List colums_process_List = new List();
+
+ if (Processess != null && Processess.Count() > 0)
+ {
+
+ foreach (var processItem in Processess)
+ {
+
+ Columprocesses columprocesses = new Columprocesses();
+ columprocesses.processesName = processItem.Name;
+
+ List chlidren_workstation_List = new List();
+ // 获取工序下的工位
+ List workStationList = Context.Queryable().Where(it => it.FkWorkProcesses == processItem.Id).ToList();
+
+ if (workStationList != null && workStationList.Count() > 0)
+ {
+
+ foreach (var workstation_item in workStationList)
+ {
+
+ StationChlidren chlidren = new StationChlidren();
+ chlidren.stationName = workstation_item.WorkStationDescription;
+
+ // 获取工位下的技能
+ List skillList = Context.Queryable()
+ .LeftJoin((rel, skill) => rel.FkSkillId == skill.Id)
+ .Where((rel, skill) => rel.FkWorkstationId == workstation_item.Id)
+ .Select((rel, skill) => skill)
+ .Distinct()
+ .ToList();
+ List children_skill_list = new List();
+
+ if (skillList != null && skillList.Count() > 0)
+ {
+ foreach (var skill_item in skillList)
+ {
+ Skillschlidren skillschlidren = new Skillschlidren();
+ skillschlidren.skillId = skill_item.Id;
+ skillschlidren.skillName = skill_item.SkillName;
+ children_skill_list.Add(skillschlidren);
+
+ // 判断在这个工位这个技能在某个人的评分
+
+ foreach (dynamic person in handleSkillInfoDto.tableList)
+ {
+ string person_id = person.personId;
+ GroupRelPersonSkill skill = Context.Queryable()
+ .Where(it => it.FkSkillId == skill_item.Id)
+ .Where(it => it.FkPersonId == person_id)
+ .First();
+
+ if (skill != null)
+ {
+ //person.SetScore(skill.FkSkillId + index, skill.Score.Value);
+ // person[skill.FkSkillId + index] = skill.Score.Value;
+ IDictionary personDict = (IDictionary)person;
+ string key = skill.FkSkillId;
+ personDict[key] = skill.Score.Value;
+
+ }
+
+
+
+
+
+ }
+
+
+ }
+ }
+ chlidren.children = children_skill_list;
+ chlidren_workstation_List.Add(chlidren);
+
+
+ }
+ }
+
+ columprocesses.children = chlidren_workstation_List;
+ colums_process_List.Add(columprocesses);
+ }
+
+ }
+ handleSkillInfoDto.colums = colums_process_List;
+
+
+
+
+ return handleSkillInfoDto;
+
+ }
+ }
+}
\ No newline at end of file