From 20565c9e36b30242ecf2eaef57c3899165d628ab Mon Sep 17 00:00:00 2001 From: "qianhao.xu" Date: Tue, 13 Aug 2024 14:09:08 +0800 Subject: [PATCH] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=9C=A8=E8=BF=99=E4=B8=AA?= =?UTF-8?q?=E5=B7=A5=E8=89=BA=E6=B5=81=E7=A8=8B=E4=B8=8B=E4=BA=BA=E5=91=98?= =?UTF-8?q?=E7=9A=84=E6=8A=80=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MES/group/GroupScheduleController.cs | 19 +++++++++ .../MES/group/Dto/GroupPersonOfSkillDto.cs | 31 ++++++++++++++ DOAN.Model/MES/group/Dto/GroupScheduleDto.cs | 2 +- DOAN.Model/MES/group/GroupSchedule.cs | 4 +- .../MES/group/GroupScheduleService.cs | 41 +++++++++++++++++++ .../group/IService/IGroupScheduleService.cs | 6 +++ 6 files changed, 100 insertions(+), 3 deletions(-) create mode 100644 DOAN.Model/MES/group/Dto/GroupPersonOfSkillDto.cs diff --git a/DOAN.Admin.WebApi/Controllers/MES/group/GroupScheduleController.cs b/DOAN.Admin.WebApi/Controllers/MES/group/GroupScheduleController.cs index c6a4d27..64e1fab 100644 --- a/DOAN.Admin.WebApi/Controllers/MES/group/GroupScheduleController.cs +++ b/DOAN.Admin.WebApi/Controllers/MES/group/GroupScheduleController.cs @@ -6,6 +6,7 @@ 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 @@ -146,6 +147,9 @@ namespace DOAN.Admin.WebApi.Controllers return ToResponse(response); } + + + /// /// //TODO 查询班组绑定的人员 /// @@ -261,6 +265,21 @@ namespace DOAN.Admin.WebApi.Controllers } + //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.Model/MES/group/Dto/GroupPersonOfSkillDto.cs b/DOAN.Model/MES/group/Dto/GroupPersonOfSkillDto.cs new file mode 100644 index 0000000..57e062e --- /dev/null +++ b/DOAN.Model/MES/group/Dto/GroupPersonOfSkillDto.cs @@ -0,0 +1,31 @@ +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 + { + /// + /// 技能id + /// + public string FkSkillId { get; set; } + /// + /// 技能名称 + /// + + public string SkillName { get; set; } + + /// + /// 评分 + /// + public int? Score { get; set; } + + + } +} diff --git a/DOAN.Model/MES/group/Dto/GroupScheduleDto.cs b/DOAN.Model/MES/group/Dto/GroupScheduleDto.cs index 23d07f1..1449630 100644 --- a/DOAN.Model/MES/group/Dto/GroupScheduleDto.cs +++ b/DOAN.Model/MES/group/Dto/GroupScheduleDto.cs @@ -36,7 +36,7 @@ namespace DOAN.Model.MES.group.Dto public string GroupCode { get; set; } - public string BelongRoute { get; set; } + public int FkBelongRoute { get; set; } public int FkShift { get; set; } public string ShiftName { get; set; } diff --git a/DOAN.Model/MES/group/GroupSchedule.cs b/DOAN.Model/MES/group/GroupSchedule.cs index c62ce67..4821a51 100644 --- a/DOAN.Model/MES/group/GroupSchedule.cs +++ b/DOAN.Model/MES/group/GroupSchedule.cs @@ -34,8 +34,8 @@ namespace DOAN.Model.MES.group /// /// 归属线 /// - [SugarColumn(ColumnName = "belong_route")] - public string BelongRoute { get; set; } + [SugarColumn(ColumnName = "fk_belong_route")] + public int FkBelongRoute { get; set; } /// diff --git a/DOAN.Service/MES/group/GroupScheduleService.cs b/DOAN.Service/MES/group/GroupScheduleService.cs index 40907f8..d9c194b 100644 --- a/DOAN.Service/MES/group/GroupScheduleService.cs +++ b/DOAN.Service/MES/group/GroupScheduleService.cs @@ -14,6 +14,7 @@ using Aliyun.OSS; using Microsoft.AspNetCore.Http.HttpResults; using MimeKit.Tnef; using System.Collections.Generic; +using DOAN.Model.MES.base_; namespace DOAN.Service.Business { @@ -286,5 +287,45 @@ namespace DOAN.Service.Business 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)); + return 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(); + + } } } \ No newline at end of file diff --git a/DOAN.Service/MES/group/IService/IGroupScheduleService.cs b/DOAN.Service/MES/group/IService/IGroupScheduleService.cs index 0c04bc7..1da589a 100644 --- a/DOAN.Service/MES/group/IService/IGroupScheduleService.cs +++ b/DOAN.Service/MES/group/IService/IGroupScheduleService.cs @@ -3,6 +3,7 @@ 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 { @@ -29,5 +30,10 @@ namespace DOAN.Service.group.IService List GetMonthScheduleResult(int year,int HandleMonth); int CopyPreDaySchedule(DateTime date, string CreatedBy); + + List GetAllRoutes(); + + + List GetSkillsOFperson(string person_id, int route_id); } }