diff --git a/ZR.Model/MES/qc/DTO/QcCommonFqcDto.cs b/ZR.Model/MES/qc/DTO/QcCommonFqcDto.cs
index daea6aa2..fea4f81e 100644
--- a/ZR.Model/MES/qc/DTO/QcCommonFqcDto.cs
+++ b/ZR.Model/MES/qc/DTO/QcCommonFqcDto.cs
@@ -424,6 +424,39 @@
public int StatisticsProductAndPolishQualifiedTotal { get; set; } = 0;
+
+ ///
+ /// 抛光盘点时间
+ ///
+ public DateTime? PolishStockTime { get; set; }
+
+ ///
+ /// 一次合格盘点时间
+ ///
+ public DateTime? OneTimeStockTime { get; set; }
+
+ ///
+ /// 抛光盘点库存数
+ ///
+ public int StockPolishWarehouseCount { get; set; } = 0;
+
+ ///
+ /// 一次合格盘点库存数
+ ///
+ public int StockOneTimeWarehouseCount { get; set; } = 0;
+
+
+ ///
+ /// 抛光计算盘点时间后报表实际库存数
+ ///
+ public int RealPolishWarehouseCount { get; set; } = 0;
+
+ ///
+ /// 一次合格计算盘点时间后报表库存数
+ ///
+ public int RealOneTimeWarehouseCount { get; set; } = 0;
+
+
///
/// 备注
///
diff --git a/ZR.Service/mes/qc/CommonFQCService.cs b/ZR.Service/mes/qc/CommonFQCService.cs
index 489b3a63..3add81be 100644
--- a/ZR.Service/mes/qc/CommonFQCService.cs
+++ b/ZR.Service/mes/qc/CommonFQCService.cs
@@ -1198,6 +1198,175 @@ namespace ZR.Service.mes.qc
boardData.StatisticsProductAndPolishQualifiedTotal =
boardData.StatisticsPolishQualifiedTotal + boardData.ProductQualifiedTotal;
+ // 盘点后库存计算值
+ // 抛光库盘点时间
+ boardData.PolishStockTime =
+ Context
+ .Queryable()
+ .Where(it => it.Status == 1)
+ .Select(it => it.CreatedTime)
+ .First() ?? new DateTime(2024, 10, 19, 0, 0, 0);
+
+ // 抛光盘点库存
+ int polishWarehouseTotal =
+ Context
+ .Queryable()
+ .WhereIF(
+ !string.IsNullOrEmpty(query.Partnumber),
+ it => it.Partnumber == query.Partnumber
+ )
+ .Sum(it => it.Quantity) ?? 0;
+ boardData.StockPolishWarehouseCount = polishWarehouseTotal;
+ // 产线抛光
+ int productPolishTotal =
+ (
+ Context
+ .Queryable()
+ .WhereIF(
+ !string.IsNullOrEmpty(query.Partnumber),
+ it => it.FinishedPartNumber == query.Partnumber
+ )
+ .Where(it => it.StartTime >= boardData.PolishStockTime)
+ .Sum(it => it.PaoguangTotal) ?? 0
+ ) / 3;
+
+ // 后道反抛
+ int afterPolishPolishTotal =
+ Context
+ .Queryable()
+ .WhereIF(
+ !string.IsNullOrEmpty(query.Partnumber),
+ it => it.Partnumber == query.Partnumber
+ )
+ .Where(it => it.StartTime >= boardData.PolishStockTime)
+ .Sum(it => it.PaoguangTotal) ?? 0;
+ // GP12反抛
+ int gP12PolishTotal =
+ Context
+ .Queryable()
+ .WhereIF(
+ !string.IsNullOrEmpty(query.Partnumber),
+ it => it.Partnumber == query.Partnumber
+ )
+ .Where(it => it.StartTime >= boardData.PolishStockTime)
+ .Sum(it => it.PaoguangTotal) ?? 0;
+ // 抛光总投入数
+ int polishRequireTotal =
+ Context
+ .Queryable()
+ .WhereIF(
+ !string.IsNullOrEmpty(query.Partnumber),
+ it => it.Partnumber == query.Partnumber
+ )
+ .Where(it => it.StartTime >= boardData.PolishStockTime)
+ .Sum(it => it.RequireNumber) ?? 0;
+
+ // 抛光实际库存
+ boardData.RealPolishWarehouseCount =
+ polishWarehouseTotal
+ + productPolishTotal
+ + afterPolishPolishTotal
+ + gP12PolishTotal
+ - polishRequireTotal;
+
+ // 一次合格库盘点时间
+ boardData.OneTimeStockTime =
+ Context
+ .Queryable()
+ .Where(it => it.Status == 1)
+ .Select(it => it.CreatedTime)
+ .First() ?? new DateTime(2024, 10, 19, 0, 0, 0);
+
+ // 一次合格盘点库存
+ int oneTimeWarehouseTotal =
+ Context
+ .Queryable()
+ .WhereIF(
+ !string.IsNullOrEmpty(query.Partnumber),
+ it => it.Partnumber == query.Partnumber
+ )
+ .Sum(it => it.Quantity) ?? 0;
+ boardData.StockOneTimeWarehouseCount = oneTimeWarehouseTotal;
+ // 产线合格
+ int productQualifiedTotal =
+ (
+ Context
+ .Queryable()
+ .WhereIF(
+ !string.IsNullOrEmpty(query.Partnumber),
+ it => it.FinishedPartNumber == query.Partnumber
+ )
+ .Where(it => it.StartTime >= boardData.OneTimeStockTime)
+ .Sum(it => it.QualifiedNumber) ?? 0
+ ) / 3;
+ // 倒车雷达
+ string[] checkStrArray2 = { "倒车雷达" };
+ var ParkingSensorPartNumberCheck = Expressionable.Create();
+ foreach (string checkStr in checkStrArray2)
+ {
+ ParkingSensorPartNumberCheck.Or(it => it.Description.Contains(checkStr));
+ }
+ ;
+ ParkingSensorPartNumberCheck.And(it => it.Type == 1).And(it => it.Status == 1);
+ List ParkingSensorPartNumberList = Context
+ .Queryable()
+ .Where(ParkingSensorPartNumberCheck.ToExpression())
+ .Select(it => it.Partnumber)
+ .ToList();
+ var predicateParkingSensor = Expressionable
+ .Create()
+ .And(it => ParkingSensorPartNumberList.Contains(it.FinishedPartNumber))
+ .And(it => it.FinishedPartNumber == query.Partnumber)
+ .And(it => it.StartTime >= boardData.OneTimeStockTime)
+ .ToExpression();
+ // 倒车雷达
+ int productParkingSensorbQualifiedTotal =
+ Context
+ .Queryable()
+ .Where(predicateParkingSensor)
+ .Sum(it => it.QualifiedNumber) ?? 0;
+ productParkingSensorbQualifiedTotal = productParkingSensorbQualifiedTotal / 3;
+ // 产线合格 - 倒车雷达
+ productQualifiedTotal -= productParkingSensorbQualifiedTotal;
+
+ // 抛光合格
+ int polishQualifiedTotal =
+ Context
+ .Queryable()
+ .WhereIF(
+ !string.IsNullOrEmpty(query.Partnumber),
+ it => it.Partnumber == query.Partnumber
+ )
+ .Where(it => it.StartTime >= boardData.OneTimeStockTime)
+ .Sum(it => it.QualifiedNumber) ?? 0;
+ // GP12总投入
+ int gP12RequireTotal =
+ Context
+ .Queryable()
+ .WhereIF(
+ !string.IsNullOrEmpty(query.Partnumber),
+ it => it.Partnumber == query.Partnumber
+ )
+ .Where(it => it.StartTime >= boardData.OneTimeStockTime)
+ .Sum(it => it.RequireNumber) ?? 0;
+ // 后道直接出库
+ int afterPolishOutTotal = Context
+ .Queryable()
+ .WhereIF(
+ !string.IsNullOrEmpty(query.Partnumber),
+ it => it.Partnumber == query.Partnumber
+ )
+ .Where(it =>it.Type == 1)
+ .Where(it => it.StartTime >= boardData.OneTimeStockTime)
+ .Sum(it => it.RequireNumber) ?? 0;
+
+ boardData.RealOneTimeWarehouseCount =
+ oneTimeWarehouseTotal
+ + productQualifiedTotal
+ + polishQualifiedTotal
+ - gP12RequireTotal
+ - afterPolishOutTotal;
+
return boardData;
}
@@ -1240,33 +1409,35 @@ namespace ZR.Service.mes.qc
{
foreach (var partNumber in partNumbers)
{
+ // 盘点数
int polishWarehouseTotal =
Context
.Queryable()
.Where(it => it.Partnumber == partNumber)
.Sum(it => it.Quantity) ?? 0;
-
+ // 产线抛光
int productPolishTotal =
Context
.Queryable()
.Where(it => it.FinishedPartNumber == partNumber)
.Where(it => it.StartTime >= startTime.ToLocalTime())
.Sum(it => it.PaoguangTotal) ?? 0;
-
+ productPolishTotal = productPolishTotal / 3;
+ // 后道反抛
int afterPolishPolishTotal =
Context
.Queryable()
.Where(it => it.Partnumber == partNumber)
.Where(it => it.StartTime >= startTime.ToLocalTime())
.Sum(it => it.PaoguangTotal) ?? 0;
-
+ // GP12 反抛
int gP12PolishTotal =
Context
.Queryable()
.Where(it => it.Partnumber == partNumber)
.Where(it => it.StartTime >= startTime.ToLocalTime())
.Sum(it => it.PaoguangTotal) ?? 0;
-
+ // 抛光出库
int polishRequireTotal =
Context
.Queryable()
@@ -1339,13 +1510,16 @@ namespace ZR.Service.mes.qc
.Queryable()
.Where(predicateParkingSensor)
.Sum(it => it.QualifiedNumber) ?? 0;
+ productParkingSensorbQualifiedTotal = productParkingSensorbQualifiedTotal / 3;
// 产线合格 - 倒车雷达
int productQualifiedTotal =
Context
.Queryable()
.Where(it => it.FinishedPartNumber == partNumber)
.Where(it => it.StartTime >= startTime.ToLocalTime())
- .Sum(it => it.QualifiedNumber) ?? 0 - productParkingSensorbQualifiedTotal;
+ .Sum(it => it.QualifiedNumber)
+ ?? 0 - productParkingSensorbQualifiedTotal;
+ productQualifiedTotal = productQualifiedTotal / 3;
// 抛光合格
int polishQualifiedTotal =
Context
@@ -1366,7 +1540,7 @@ namespace ZR.Service.mes.qc
.Queryable()
.Where(it => it.Partnumber == partNumber)
.Where(it => it.StartTime >= startTime.ToLocalTime())
- .Where(it => it.Type == 1)
+ .Where(it => it.Type == 1)
.Sum(it => it.RequireNumber) ?? 0;
int realStock =
diff --git a/ZR.Service/mes/wms/WmOneTimeInventoryService.cs b/ZR.Service/mes/wms/WmOneTimeInventoryService.cs
index ce6c7c9b..f72c704c 100644
--- a/ZR.Service/mes/wms/WmOneTimeInventoryService.cs
+++ b/ZR.Service/mes/wms/WmOneTimeInventoryService.cs
@@ -487,11 +487,16 @@ namespace ZR.Service.mes.wms
try
{
// 盘点时间
- DateTime checkTime = new(2024, 10, 20, 0, 0, 0);
+ DateTime? checkTime = Context
+ .Queryable()
+ .Where(it => it.Status == 1)
+ .Select(it => it.CreatedTime)
+ .First() ?? new DateTime(2024, 10, 19, 0, 0, 0);
+ // DateTime
CommonFQCService commonFQCService = new();
// 获取报表数据
// 一次合格计算后库存 = 盘点库存 + 产线合格 + 抛光合格 - gp12投入 - 后道直接出库
- return commonFQCService.GetBatchOneTimePartRealStock(partnumbers, checkTime);
+ return commonFQCService.GetBatchOneTimePartRealStock(partnumbers, checkTime.Value);
}
catch (Exception e)
{
diff --git a/ZR.Service/mes/wms/WmPolishInventoryService.cs b/ZR.Service/mes/wms/WmPolishInventoryService.cs
index 32d4f606..d6d81ba4 100644
--- a/ZR.Service/mes/wms/WmPolishInventoryService.cs
+++ b/ZR.Service/mes/wms/WmPolishInventoryService.cs
@@ -561,11 +561,15 @@ namespace ZR.Service.mes.wms
try
{
// 盘点时间
- DateTime checkTime = new(2024, 10, 20, 0, 0, 0);
+ DateTime? checkTime = Context
+ .Queryable()
+ .Where(it => it.Status == 1)
+ .Select(it => it.CreatedTime)
+ .First() ?? new DateTime(2024, 10, 19, 0, 0, 0);
CommonFQCService commonFQCService = new();
// 获取报表数据
// 抛光计算后库存 = 盘点库存 + 产线抛光 + 后道反抛 + GP12反抛 - 抛光投入
- return commonFQCService.GetBatchPolishPartRealStock(partnumbers, checkTime);
+ return commonFQCService.GetBatchPolishPartRealStock(partnumbers, checkTime.Value);
}
catch (Exception e)
{