质量统计

This commit is contained in:
qianhao.xu 2023-12-18 19:56:01 +08:00
parent 80ff5f04f2
commit 3a005da0d4
7 changed files with 149 additions and 0 deletions

View File

@ -0,0 +1,12 @@
using AutoMapper;
namespace ZR.Admin.WebApi.AutoMapperProfile
{
public class AutoMapperProfile : Profile
{
public AutoMapperProfile() {
}
}
}

View File

@ -36,6 +36,21 @@ namespace ZR.Admin.WebApi.Controllers.mes.op.quality
return ToResponse(new ApiResult(200, "success", data));
}
/// <summary>
/// 获取缺陷项详情
/// </summary>
/// <param name="fkWorkorderId">工单</param>
/// <param name="order">缺陷项类型</param>
/// <returns></returns>
[HttpGet("QueryDetailsOfDetectionItems")]
public IActionResult QueryDetailsOfDetectionItems(string fkWorkorderId,int index)
{
List<DetailsOfDetectionDTO> data= operationService.QueryDetailsOfDetection(fkWorkorderId, index);
return ToResponse(new ApiResult(200, "success", data));
}
}
}

View File

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

View File

@ -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
{
/// <summary>
/// 检测项名称
/// </summary>
public string InspectionName { get; set; }
/// <summary>
/// 检测项值
/// </summary>
public int Counter { get; set; }
}
}

View File

@ -4,6 +4,10 @@
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="12.0.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ZR.Common\ZR.Common.csproj" />
<ProjectReference Include="..\ZR.Repository\ZR.Repository.csproj" />

View File

@ -15,5 +15,7 @@ namespace ZR.Service.MES.op.IService
public List<OpStatisticsDTO> GetAllData(string workshopID);
public (List<QcFqcDTO>,int) GueryQualityStatistics(string workorderid, int pageNum, int pageSize, int year = -1, int week = -1, int date = -1);
public List<DetailsOfDetectionDTO> QueryDetailsOfDetection(string fkWorkorderId, int order);
}
}

View File

@ -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);
}
/// <summary>
/// 获取工单 缺陷详细信息
/// </summary>
/// <param name="fkWorkorderId"></param>
/// <param name="order"></param>
/// <returns></returns>
public List<DetailsOfDetectionDTO> QueryDetailsOfDetection(string fkWorkorderId, int order)
{
List<DetailsOfDetectionDTO> detailsList = null;
switch(order)
{
case 1:
// 首检抛光数量
detailsList = Context.Queryable<QcFirstinspectionRecord>().LeftJoin<QcInspectionitem>((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<QcFirstinspectionRecord>().LeftJoin<QcInspectionitem>((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<QcFirstinspectionRecord>().LeftJoin<QcInspectionitem>((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<QcAgaininspectionRecord>().LeftJoin<QcInspectionitem>((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<QcAgaininspectionRecord>().LeftJoin<QcInspectionitem>((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<QcFinalinspectionRecord>().LeftJoin<QcInspectionitem>((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<QcFinalinspectionRecord>().LeftJoin<QcInspectionitem>((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;
}
}
}