This commit is contained in:
赵正易 2024-08-13 14:18:25 +08:00
commit 9136a9ebc0
6 changed files with 100 additions and 3 deletions

View File

@ -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);
}
/// <summary>
/// //TODO 查询班组绑定的人员
/// </summary>
@ -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);
}
}
}

View File

@ -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
{
/// <summary>
/// 人员的技能
/// </summary>
public class GroupPersonOfSkillDto
{
/// <summary>
/// 技能id
/// </summary>
public string FkSkillId { get; set; }
/// <summary>
/// 技能名称
/// </summary>
public string SkillName { get; set; }
/// <summary>
/// 评分
/// </summary>
public int? Score { get; set; }
}
}

View File

@ -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; }

View File

@ -34,8 +34,8 @@ namespace DOAN.Model.MES.group
/// <summary>
/// 归属线
/// </summary>
[SugarColumn(ColumnName = "belong_route")]
public string BelongRoute { get; set; }
[SugarColumn(ColumnName = "fk_belong_route")]
public int FkBelongRoute { get; set; }
/// <summary>

View File

@ -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<BaseWorkRoute> GetAllRoutes()
{
return Context.Queryable<BaseWorkRoute>().Where(it=>it.Status==1).ToList();
}
/// <summary>
/// 获取在这个工艺流程下人员的技能
/// </summary>
/// <param name="person_id"></param>
/// <param name="route_id"></param>
/// <returns></returns>
public List<GroupPersonOfSkillDto> GetSkillsOFperson(string person_id, int route_id)
{
//获取工艺流程下的工位的技能
var query= Context.Queryable<BaseRelWorkRouteProcesses>()
.Where(it => it.FkWorkRoute == route_id);
var query2 = Context.Queryable(query)
.LeftJoin<BaseWorkProcesses>((q, p) => q.FkWorkProcesses == p.Id)
.Where((q, p) => p.Status == 1).Select((q, p) => p);
var query3 = Context.Queryable(query2).LeftJoin<BaseWorkStation>((q, s) => q.Id == s.Id)
.Where((q, s) => s.Status == 1).Select((q, s) => s);
List<GroupRelWorkstationSkill> SkillList= Context.Queryable(query3).LeftJoin<GroupRelWorkstationSkill>((q,skill)=>q.Id==skill.FkWorkstationId)
.Select((q, skill) => skill).ToList();
string[] queryArray=SkillList.Select(it=>it.FkSkillId).ToArray();
var query4 = Context.Queryable<GroupRelPersonSkill>().Where(it => it.FkPersonId == person_id)
.Where(it => queryArray.Contains(it.FkSkillId));
return Context.Queryable(query4).LeftJoin<GroupPersonSkill>((q,s)=>q.FkSkillId==s.Id)
.Select((q, s) => new GroupPersonOfSkillDto()
{
FkSkillId = q.FkSkillId,
SkillName=s.SkillName,
Score = q.Score,
}).ToList();
}
}
}

View File

@ -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<SchedulingSituation> GetMonthScheduleResult(int year,int HandleMonth);
int CopyPreDaySchedule(DateTime date, string CreatedBy);
List<BaseWorkRoute> GetAllRoutes();
List<GroupPersonOfSkillDto> GetSkillsOFperson(string person_id, int route_id);
}
}