1
This commit is contained in:
parent
5b3b6f6fbb
commit
4e2b817762
@ -135,11 +135,11 @@ namespace ZR.Admin.WebApi.Controllers.mes.qc.IQC
|
||||
/// <param name="query">查询值</param>
|
||||
/// <returns>QcCommonFqcBoardDto 看板数据</returns>
|
||||
[HttpPost("getProductAndPolishAndOneTimeFqcBoardData")]
|
||||
public IActionResult GetProductAndPolishAndOneTimeFqcBoardData()
|
||||
public IActionResult GetProductAndPolishAndOneTimeFqcBoardData([FromBody] QcProductAndPolishAndOneTimeFqcBoardQuery query)
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = _commonFQCService.GetProductAndPolishAndOneTimeFqcBoardData();
|
||||
var result = _commonFQCService.GetProductAndPolishAndOneTimeFqcBoardData(query);
|
||||
return ToResponse(new ApiResult(200, "ok", result));
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
||||
@ -173,6 +173,26 @@
|
||||
public string Remark { get; set; } = default;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 产线,抛光,一次合格品质量报表看板查询条件
|
||||
///</summary>
|
||||
public class QcProductAndPolishAndOneTimeFqcBoardQuery
|
||||
{
|
||||
/// <summary>
|
||||
/// 物料号(成品零件号)
|
||||
/// </summary>
|
||||
public string Partnumber { get; set; }
|
||||
/// <summary>
|
||||
/// 开始时间
|
||||
///</summary>
|
||||
public DateTime? StartTime { get; set; } = default;
|
||||
/// <summary>
|
||||
/// 开始时间
|
||||
///</summary>
|
||||
public DateTime? EndTime { get; set; } = default;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 产线,抛光,一次合格品质量报表看板
|
||||
///</summary>
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
@ -515,86 +516,276 @@ namespace ZR.Service.mes.qc
|
||||
|
||||
// 获取产线相关数据
|
||||
public QcProductAndPolishAndOneTimeFqcBoardDto GetProductTotal(
|
||||
QcProductAndPolishAndOneTimeFqcBoardDto boardData
|
||||
QcProductAndPolishAndOneTimeFqcBoardDto boardData,
|
||||
QcProductAndPolishAndOneTimeFqcBoardQuery query
|
||||
)
|
||||
{
|
||||
var predicate1 = Expressionable
|
||||
.Create<QcQualityStatisticsTotal>()
|
||||
.AndIF(
|
||||
!string.IsNullOrEmpty(query.Partnumber),
|
||||
it => it.FinishedPartNumber == query.Partnumber
|
||||
)
|
||||
.AndIF(
|
||||
query.StartTime != null,
|
||||
it => it.StartTime >= query.StartTime.Value.ToLocalTime()
|
||||
)
|
||||
.AndIF(
|
||||
query.EndTime != null,
|
||||
it => it.StartTime <= query.EndTime.Value.ToLocalTime()
|
||||
)
|
||||
.ToExpression();
|
||||
var predicate2 = Expressionable
|
||||
.Create<QcQualityStatisticsFirst>()
|
||||
.AndIF(
|
||||
!string.IsNullOrEmpty(query.Partnumber),
|
||||
it => it.FinishedPartNumber == query.Partnumber
|
||||
)
|
||||
.AndIF(
|
||||
query.StartTime != null,
|
||||
it => it.StartTime >= query.StartTime.Value.ToLocalTime()
|
||||
)
|
||||
.AndIF(
|
||||
query.EndTime != null,
|
||||
it => it.StartTime <= query.EndTime.Value.ToLocalTime()
|
||||
)
|
||||
.ToExpression();
|
||||
boardData.ProductRequireTotal =
|
||||
Context.Queryable<QcQualityStatisticsTotal>().Sum(it => it.RequireNumber) ?? 0;
|
||||
Context
|
||||
.Queryable<QcQualityStatisticsTotal>()
|
||||
.Where(predicate1)
|
||||
.Sum(it => it.RequireNumber) ?? 0;
|
||||
boardData.ProductQualifiedTotal =
|
||||
Context.Queryable<QcQualityStatisticsTotal>().Sum(it => it.QualifiedNumber) ?? 0;
|
||||
Context
|
||||
.Queryable<QcQualityStatisticsTotal>()
|
||||
.Where(predicate1)
|
||||
.Sum(it => it.QualifiedNumber) ?? 0;
|
||||
boardData.ProductPolishTotal =
|
||||
Context.Queryable<QcQualityStatisticsFirst>().Sum(it => it.PaoguangTotal) ?? 0;
|
||||
Context
|
||||
.Queryable<QcQualityStatisticsFirst>()
|
||||
.Where(predicate2)
|
||||
.Sum(it => it.PaoguangTotal) ?? 0;
|
||||
boardData.ProductSandingTotal =
|
||||
Context.Queryable<QcQualityStatisticsTotal>().Sum(it => it.DamoTotal) ?? 0;
|
||||
Context
|
||||
.Queryable<QcQualityStatisticsTotal>()
|
||||
.Where(predicate1)
|
||||
.Sum(it => it.DamoTotal) ?? 0;
|
||||
boardData.ProductDiscardTotal =
|
||||
Context.Queryable<QcQualityStatisticsTotal>().Sum(it => it.BaofeiTotal) ?? 0;
|
||||
Context
|
||||
.Queryable<QcQualityStatisticsTotal>()
|
||||
.Where(predicate1)
|
||||
.Sum(it => it.BaofeiTotal) ?? 0;
|
||||
return boardData;
|
||||
}
|
||||
|
||||
// 获取抛光相关数据
|
||||
public QcProductAndPolishAndOneTimeFqcBoardDto GetPolishTotal(
|
||||
QcProductAndPolishAndOneTimeFqcBoardDto boardData
|
||||
QcProductAndPolishAndOneTimeFqcBoardDto boardData,
|
||||
QcProductAndPolishAndOneTimeFqcBoardQuery query
|
||||
)
|
||||
{
|
||||
var predicateInventory = Expressionable
|
||||
.Create<WmPolishInventory>()
|
||||
.AndIF(
|
||||
!string.IsNullOrEmpty(query.Partnumber),
|
||||
it => it.Partnumber == query.Partnumber
|
||||
)
|
||||
.ToExpression();
|
||||
var predicate1 = Expressionable
|
||||
.Create<WmPolishWorkQualityStatistics>()
|
||||
.AndIF(
|
||||
!string.IsNullOrEmpty(query.Partnumber),
|
||||
it => it.Partnumber == query.Partnumber
|
||||
)
|
||||
.AndIF(
|
||||
query.StartTime != null,
|
||||
it => it.StartTime >= query.StartTime.Value.ToLocalTime()
|
||||
)
|
||||
.AndIF(
|
||||
query.EndTime != null,
|
||||
it => it.StartTime <= query.EndTime.Value.ToLocalTime()
|
||||
)
|
||||
.ToExpression();
|
||||
var predicate2 = Expressionable
|
||||
.Create<WmPolishQualityStatistics>()
|
||||
.AndIF(
|
||||
!string.IsNullOrEmpty(query.Partnumber),
|
||||
it => it.Partnumber == query.Partnumber
|
||||
)
|
||||
.AndIF(
|
||||
query.StartTime != null,
|
||||
it => it.StartTime >= query.StartTime.Value.ToLocalTime()
|
||||
)
|
||||
.AndIF(
|
||||
query.EndTime != null,
|
||||
it => it.StartTime <= query.EndTime.Value.ToLocalTime()
|
||||
)
|
||||
.ToExpression();
|
||||
boardData.PolishWarehouseTotal =
|
||||
Context.Queryable<WmPolishInventory>().Sum(it => it.Quantity) ?? 0;
|
||||
Context
|
||||
.Queryable<WmPolishInventory>()
|
||||
.Where(predicateInventory)
|
||||
.Sum(it => it.Quantity) ?? 0;
|
||||
|
||||
boardData.PolishRequireTotal =
|
||||
Context.Queryable<WmPolishWorkQualityStatistics>().Sum(it => it.RequireNumber) ?? 0;
|
||||
Context
|
||||
.Queryable<WmPolishWorkQualityStatistics>()
|
||||
.Where(predicate1)
|
||||
.Sum(it => it.RequireNumber) ?? 0;
|
||||
boardData.PolishQualifiedTotal =
|
||||
Context.Queryable<WmPolishWorkQualityStatistics>().Sum(it => it.QualifiedNumber)
|
||||
?? 0;
|
||||
Context
|
||||
.Queryable<WmPolishWorkQualityStatistics>()
|
||||
.Where(predicate1)
|
||||
.Sum(it => it.QualifiedNumber) ?? 0;
|
||||
boardData.PolishSandingTotal =
|
||||
Context.Queryable<WmPolishWorkQualityStatistics>().Sum(it => it.DamoTotal) ?? 0;
|
||||
Context
|
||||
.Queryable<WmPolishWorkQualityStatistics>()
|
||||
.Where(predicate1)
|
||||
.Sum(it => it.DamoTotal) ?? 0;
|
||||
boardData.PolishDiscardTotal =
|
||||
Context.Queryable<WmPolishWorkQualityStatistics>().Sum(it => it.BaofeiTotal) ?? 0;
|
||||
Context
|
||||
.Queryable<WmPolishWorkQualityStatistics>()
|
||||
.Where(predicate1)
|
||||
.Sum(it => it.BaofeiTotal) ?? 0;
|
||||
|
||||
boardData.AfterPolishRequireTotal =
|
||||
Context.Queryable<WmPolishQualityStatistics>().Sum(it => it.RequireNumber) ?? 0;
|
||||
Context
|
||||
.Queryable<WmPolishQualityStatistics>()
|
||||
.Where(predicate2)
|
||||
.Sum(it => it.RequireNumber) ?? 0;
|
||||
boardData.AfterPolishQualifiedTotal =
|
||||
Context.Queryable<WmPolishQualityStatistics>().Sum(it => it.QualifiedNumber) ?? 0;
|
||||
Context
|
||||
.Queryable<WmPolishQualityStatistics>()
|
||||
.Where(predicate2)
|
||||
.Sum(it => it.QualifiedNumber) ?? 0;
|
||||
boardData.AfterPolishPolishTotal =
|
||||
Context.Queryable<WmPolishQualityStatistics>().Sum(it => it.PaoguangTotal) ?? 0;
|
||||
Context
|
||||
.Queryable<WmPolishQualityStatistics>()
|
||||
.Where(predicate2)
|
||||
.Sum(it => it.PaoguangTotal) ?? 0;
|
||||
boardData.AfterPolishSandingTotal =
|
||||
Context.Queryable<WmPolishQualityStatistics>().Sum(it => it.DamoTotal) ?? 0;
|
||||
Context
|
||||
.Queryable<WmPolishQualityStatistics>()
|
||||
.Where(predicate2)
|
||||
.Sum(it => it.DamoTotal) ?? 0;
|
||||
boardData.AfterPolishDiscardTotal =
|
||||
Context.Queryable<WmPolishQualityStatistics>().Sum(it => it.BaofeiTotal) ?? 0;
|
||||
Context
|
||||
.Queryable<WmPolishQualityStatistics>()
|
||||
.Where(predicate2)
|
||||
.Sum(it => it.BaofeiTotal) ?? 0;
|
||||
return boardData;
|
||||
}
|
||||
|
||||
// 获取一次合格品相关数据
|
||||
public QcProductAndPolishAndOneTimeFqcBoardDto GetOneTimeTotal(
|
||||
QcProductAndPolishAndOneTimeFqcBoardDto boardData
|
||||
QcProductAndPolishAndOneTimeFqcBoardDto boardData,
|
||||
QcProductAndPolishAndOneTimeFqcBoardQuery query
|
||||
)
|
||||
{
|
||||
var predicate1 = Expressionable
|
||||
.Create<WmOneTimeInventory>()
|
||||
.AndIF(
|
||||
!string.IsNullOrEmpty(query.Partnumber),
|
||||
it => it.Partnumber == query.Partnumber
|
||||
)
|
||||
.ToExpression();
|
||||
var predicate2 = Expressionable
|
||||
.Create<WmGp12QualityStatistics>()
|
||||
.AndIF(
|
||||
!string.IsNullOrEmpty(query.Partnumber),
|
||||
it => it.Partnumber == query.Partnumber
|
||||
)
|
||||
.AndIF(
|
||||
query.StartTime != null,
|
||||
it => it.StartTime >= query.StartTime.Value.ToLocalTime()
|
||||
)
|
||||
.AndIF(
|
||||
query.EndTime != null,
|
||||
it => it.StartTime <= query.EndTime.Value.ToLocalTime()
|
||||
)
|
||||
.ToExpression();
|
||||
boardData.OneTimeWarehouseTotal =
|
||||
Context.Queryable<WmOneTimeInventory>().Sum(it => it.Quantity) ?? 0;
|
||||
Context.Queryable<WmOneTimeInventory>().Where(predicate1).Sum(it => it.Quantity)
|
||||
?? 0;
|
||||
|
||||
boardData.GP12RequireTotal =
|
||||
Context.Queryable<WmGp12QualityStatistics>().Sum(it => it.RequireNumber) ?? 0;
|
||||
Context
|
||||
.Queryable<WmGp12QualityStatistics>()
|
||||
.Where(predicate2)
|
||||
.Sum(it => it.RequireNumber) ?? 0;
|
||||
boardData.GP12QualifiedTotal =
|
||||
Context.Queryable<WmGp12QualityStatistics>().Sum(it => it.QualifiedNumber) ?? 0;
|
||||
Context
|
||||
.Queryable<WmGp12QualityStatistics>()
|
||||
.Where(predicate2)
|
||||
.Sum(it => it.QualifiedNumber) ?? 0;
|
||||
boardData.GP12PolishTotal =
|
||||
Context.Queryable<WmGp12QualityStatistics>().Sum(it => it.PaoguangTotal) ?? 0;
|
||||
Context
|
||||
.Queryable<WmGp12QualityStatistics>()
|
||||
.Where(predicate2)
|
||||
.Sum(it => it.PaoguangTotal) ?? 0;
|
||||
boardData.GP12SandingTotal =
|
||||
Context.Queryable<WmGp12QualityStatistics>().Sum(it => it.DamoTotal) ?? 0;
|
||||
Context
|
||||
.Queryable<WmGp12QualityStatistics>()
|
||||
.Where(predicate2)
|
||||
.Sum(it => it.DamoTotal) ?? 0;
|
||||
boardData.GP12DiscardTotal =
|
||||
Context.Queryable<WmGp12QualityStatistics>().Sum(it => it.BaofeiTotal) ?? 0;
|
||||
Context
|
||||
.Queryable<WmGp12QualityStatistics>()
|
||||
.Where(predicate2)
|
||||
.Sum(it => it.BaofeiTotal) ?? 0;
|
||||
return boardData;
|
||||
}
|
||||
|
||||
// 获取成品仓库相关数据
|
||||
public QcProductAndPolishAndOneTimeFqcBoardDto GetFinishProductTotal(
|
||||
QcProductAndPolishAndOneTimeFqcBoardDto boardData
|
||||
QcProductAndPolishAndOneTimeFqcBoardDto boardData,
|
||||
QcProductAndPolishAndOneTimeFqcBoardQuery query
|
||||
)
|
||||
{
|
||||
var predicate1 = Expressionable
|
||||
.Create<WmGoodsNowProduction>()
|
||||
.AndIF(
|
||||
!string.IsNullOrEmpty(query.Partnumber),
|
||||
it => it.Partnumber == query.Partnumber
|
||||
)
|
||||
.AndIF(
|
||||
query.StartTime != null,
|
||||
it => it.EntryWarehouseTime >= query.StartTime.Value.ToLocalTime()
|
||||
)
|
||||
.AndIF(
|
||||
query.EndTime != null,
|
||||
it => it.EntryWarehouseTime <= query.EndTime.Value.ToLocalTime()
|
||||
)
|
||||
.ToExpression();
|
||||
var predicate2 = Expressionable
|
||||
.Create<WmGoodsOutRecord>()
|
||||
.AndIF(
|
||||
!string.IsNullOrEmpty(query.Partnumber),
|
||||
it => it.Partnumber == query.Partnumber
|
||||
)
|
||||
.AndIF(
|
||||
query.StartTime != null,
|
||||
it => it.OutTime >= query.StartTime.Value.ToLocalTime()
|
||||
)
|
||||
.AndIF(query.EndTime != null, it => it.OutTime <= query.EndTime.Value.ToLocalTime())
|
||||
.ToExpression();
|
||||
boardData.FinishProductPartTotal =
|
||||
Context.Queryable<WmGoodsNowProduction>().Sum(it => it.GoodsNumAction) ?? 0;
|
||||
boardData.FinishProductPackageTotal = Context.Queryable<WmGoodsNowProduction>().Count();
|
||||
Context
|
||||
.Queryable<WmGoodsNowProduction>()
|
||||
.Where(predicate1)
|
||||
.Sum(it => it.GoodsNumAction) ?? 0;
|
||||
boardData.FinishProductPackageTotal = Context
|
||||
.Queryable<WmGoodsNowProduction>()
|
||||
.Where(predicate1)
|
||||
.Count();
|
||||
|
||||
boardData.FinishProductPartOutTotal =
|
||||
Context.Queryable<WmGoodsOutRecord>().Sum(it => it.GoodsNumAction) ?? 0;
|
||||
boardData.FinishProductPackageOutTotal = Context.Queryable<WmGoodsOutRecord>().Count();
|
||||
Context.Queryable<WmGoodsOutRecord>().Where(predicate2).Sum(it => it.GoodsNumAction)
|
||||
?? 0;
|
||||
boardData.FinishProductPackageOutTotal = Context
|
||||
.Queryable<WmGoodsOutRecord>()
|
||||
.Where(predicate2)
|
||||
.Count();
|
||||
return boardData;
|
||||
}
|
||||
|
||||
@ -602,15 +793,25 @@ namespace ZR.Service.mes.qc
|
||||
/// 获取产线,抛光,一次合格品质量报表看板数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public QcProductAndPolishAndOneTimeFqcBoardDto GetProductAndPolishAndOneTimeFqcBoardData()
|
||||
public QcProductAndPolishAndOneTimeFqcBoardDto GetProductAndPolishAndOneTimeFqcBoardData(
|
||||
QcProductAndPolishAndOneTimeFqcBoardQuery query
|
||||
)
|
||||
{
|
||||
QcProductAndPolishAndOneTimeFqcBoardDto result = new();
|
||||
result = GetProductTotal(result);
|
||||
result = GetPolishTotal(result);
|
||||
result = GetOneTimeTotal(result);
|
||||
result = GetFinishProductTotal(result);
|
||||
result.SandingTotal = result.ProductSandingTotal + result.PolishSandingTotal + result.AfterPolishSandingTotal + result.GP12SandingTotal;
|
||||
result.DiscardTotal = result.ProductDiscardTotal + result.PolishDiscardTotal + result.AfterPolishDiscardTotal + result.GP12DiscardTotal;
|
||||
result = GetProductTotal(result, query);
|
||||
result = GetPolishTotal(result, query);
|
||||
result = GetOneTimeTotal(result, query);
|
||||
result = GetFinishProductTotal(result, query);
|
||||
result.SandingTotal =
|
||||
result.ProductSandingTotal
|
||||
+ result.PolishSandingTotal
|
||||
+ result.AfterPolishSandingTotal
|
||||
+ result.GP12SandingTotal;
|
||||
result.DiscardTotal =
|
||||
result.ProductDiscardTotal
|
||||
+ result.PolishDiscardTotal
|
||||
+ result.AfterPolishDiscardTotal
|
||||
+ result.GP12DiscardTotal;
|
||||
result.UpdatedTime = DateTime.Now.ToLocalTime();
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -44,7 +44,7 @@ namespace ZR.Service.mes.qc.IService
|
||||
/// 获取产线,抛光,一次合格品质量报表看板数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public QcProductAndPolishAndOneTimeFqcBoardDto GetProductAndPolishAndOneTimeFqcBoardData();
|
||||
public QcProductAndPolishAndOneTimeFqcBoardDto GetProductAndPolishAndOneTimeFqcBoardData(QcProductAndPolishAndOneTimeFqcBoardQuery query);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user