diff --git a/ZR.Admin.WebApi/AutoMapperProfile/AutoMapperProfile.cs b/ZR.Admin.WebApi/AutoMapperProfile/AutoMapperProfile.cs new file mode 100644 index 00000000..2d82960d --- /dev/null +++ b/ZR.Admin.WebApi/AutoMapperProfile/AutoMapperProfile.cs @@ -0,0 +1,12 @@ +using AutoMapper; + +namespace ZR.Admin.WebApi.AutoMapperProfile +{ + public class AutoMapperProfile : Profile + { + public AutoMapperProfile() { + + + } + } +} diff --git a/ZR.Admin.WebApi/Controllers/mes/op/quality/QualityStatisticsController.cs b/ZR.Admin.WebApi/Controllers/mes/op/quality/QualityStatisticsController.cs index b2c53051..3928afdc 100644 --- a/ZR.Admin.WebApi/Controllers/mes/op/quality/QualityStatisticsController.cs +++ b/ZR.Admin.WebApi/Controllers/mes/op/quality/QualityStatisticsController.cs @@ -36,6 +36,21 @@ namespace ZR.Admin.WebApi.Controllers.mes.op.quality return ToResponse(new ApiResult(200, "success", data)); } + + /// + /// 获取缺陷项详情 + /// + /// 工单 + /// 缺陷项类型 + /// + [HttpGet("QueryDetailsOfDetectionItems")] + public IActionResult QueryDetailsOfDetectionItems(string fkWorkorderId,int index) + { + List data= operationService.QueryDetailsOfDetection(fkWorkorderId, index); + + return ToResponse(new ApiResult(200, "success", data)); + } + } } diff --git a/ZR.Admin.WebApi/Program.cs b/ZR.Admin.WebApi/Program.cs index 7b077e5b..97dca4d7 100644 --- a/ZR.Admin.WebApi/Program.cs +++ b/ZR.Admin.WebApi/Program.cs @@ -4,6 +4,7 @@ using Microsoft.AspNetCore.Authentication.JwtBearer; using Microsoft.AspNetCore.DataProtection; using Microsoft.IdentityModel.Tokens; using System.Text.Json.Serialization; +using ZR.Admin.WebApi.AutoMapperProfile; using ZR.Admin.WebApi.Extensions; using ZR.Admin.WebApi.Filters; using ZR.Admin.WebApi.Framework; @@ -90,6 +91,8 @@ builder.Services.AddMvc(options => builder.Services.AddSwaggerConfig(); +builder.Services.AddAutoMapper(typeof(AutoMapperProfile)); + var app = builder.Build(); InternalApp.ServiceProvider = app.Services; InternalApp.Configuration = builder.Configuration; diff --git a/ZR.Model/MES/op/DTO/DetailsOfDetectionDTO.cs b/ZR.Model/MES/op/DTO/DetailsOfDetectionDTO.cs new file mode 100644 index 00000000..7f78e073 --- /dev/null +++ b/ZR.Model/MES/op/DTO/DetailsOfDetectionDTO.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ZR.Model.MES.op.DTO +{ + public class DetailsOfDetectionDTO + { + /// + /// 检测项名称 + /// + public string InspectionName { get; set; } + /// + /// 检测项值 + /// + public int Counter { get; set; } + } +} diff --git a/ZR.Service/ZR.Service.csproj b/ZR.Service/ZR.Service.csproj index f03125bf..fc2336e0 100644 --- a/ZR.Service/ZR.Service.csproj +++ b/ZR.Service/ZR.Service.csproj @@ -4,6 +4,10 @@ net7.0 + + + + diff --git a/ZR.Service/mes/op/IService/IOperationService.cs b/ZR.Service/mes/op/IService/IOperationService.cs index a1f4f0e6..b98d4156 100644 --- a/ZR.Service/mes/op/IService/IOperationService.cs +++ b/ZR.Service/mes/op/IService/IOperationService.cs @@ -15,5 +15,7 @@ namespace ZR.Service.MES.op.IService public List GetAllData(string workshopID); public (List,int) GueryQualityStatistics(string workorderid, int pageNum, int pageSize, int year = -1, int week = -1, int date = -1); + + public List QueryDetailsOfDetection(string fkWorkorderId, int order); } } diff --git a/ZR.Service/mes/op/OperationService.cs b/ZR.Service/mes/op/OperationService.cs index 58a54438..b4f1ecc2 100644 --- a/ZR.Service/mes/op/OperationService.cs +++ b/ZR.Service/mes/op/OperationService.cs @@ -19,6 +19,7 @@ using ZR.Model.mes.pro; using static System.Runtime.InteropServices.JavaScript.JSType; using System.Drawing; using Newtonsoft.Json; +using ZR.Model.MES.qu; namespace ZR.Service.MES.op { @@ -131,6 +132,98 @@ namespace ZR.Service.MES.op return (QcFqcDTOList, totalCount); } + /// + /// 获取工单 缺陷详细信息 + /// + /// + /// + /// + public List QueryDetailsOfDetection(string fkWorkorderId, int order) + { + List detailsList = null; + switch(order) + { + case 1: + // 首检抛光数量 + detailsList = Context.Queryable().LeftJoin((f, i) => f.FKInpectionId == i.InspectionCode).Where("f.FKInpectionId like @FKInpectionId", new { FKInpectionId = "_" + 1 + "_" }) + .Select((f, i) => new DetailsOfDetectionDTO + { + InspectionName = i.InspectionName, + Counter = (int)f.Counter, + + }).ToList(); break; + case 2: + // 首检打磨数量 + detailsList = Context.Queryable().LeftJoin((f, i) => f.FKInpectionId == i.InspectionCode).Where("FKInpectionId like @FKInpectionId", new { FKInpectionId = "_" + 2 + "_" }) + .Select((f, i) => new DetailsOfDetectionDTO + { + InspectionName = i.InspectionName, + Counter = (int)f.Counter, + + }).ToList(); + break; + + case 3: + // 首检报废数量 + detailsList = Context.Queryable().LeftJoin((f, i) => f.FKInpectionId == i.InspectionCode).Where("FKInpectionId like @FKInpectionId", new { FKInpectionId = "_" + 3 + "_" }) + .Select((f, i) => new DetailsOfDetectionDTO + { + InspectionName = i.InspectionName, + Counter = (int)f.Counter, + + }).ToList(); + break; + + case 4: + // 二检打磨数量 + detailsList = Context.Queryable().LeftJoin((f, i) => f.FkInpectionId == i.InspectionCode).Where("FKInpectionId like @FKInpectionId", new { FKInpectionId = "_" + 2 + "_" }) + .Select((f, i) => new DetailsOfDetectionDTO + { + InspectionName = i.InspectionName, + Counter = (int)f.Counter, + + }).ToList(); + break; + case 5: + // 二检报废数量 + detailsList = Context.Queryable().LeftJoin((f, i) => f.FkInpectionId == i.InspectionCode).Where("FKInpectionId like @FKInpectionId", new { FKInpectionId = "_" + 3 + "_" }) + .Select((f, i) => new DetailsOfDetectionDTO + { + InspectionName = i.InspectionName, + Counter = (int)f.Counter, + + }).ToList(); + break; + case 6: + // 三检打磨数量 + detailsList = Context.Queryable().LeftJoin((f, i) => f.FkInpectionId == i.InspectionCode).Where("FKInpectionId like @FKInpectionId", new { FKInpectionId = "_" + 2 + "_" }) + .Select((f, i) => new DetailsOfDetectionDTO + { + InspectionName = i.InspectionName, + Counter = (int)f.Counter, + + }).ToList(); + + break; + case 7: + // 三检报废数量 + detailsList = Context.Queryable().LeftJoin((f, i) => f.FkInpectionId == i.InspectionCode).Where("FKInpectionId like @FKInpectionId", new { FKInpectionId = "_" + 3+ "_" }) + .Select((f, i) => new DetailsOfDetectionDTO + { + InspectionName = i.InspectionName, + Counter = (int)f.Counter, + + }).ToList(); + break; + + default:break; + } + + + + + return detailsList; + } } }