仓库数据看板
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
using System;
|
||||
using Microsoft.AspNetCore.Http.HttpResults;
|
||||
using System;
|
||||
using System.Text.RegularExpressions;
|
||||
using ZR.Model.MES.wms;
|
||||
using ZR.Model.MES.wms.Dto;
|
||||
|
||||
@@ -7,6 +9,56 @@ namespace ZR.Service.Utils
|
||||
public class MaterialUtils : BaseService<WmMaterial>
|
||||
{
|
||||
private NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger();
|
||||
|
||||
/// <summary>
|
||||
/// 解析测试
|
||||
/// </summary>
|
||||
/// <param name="str">测试字符串</param>
|
||||
/// <returns></returns>
|
||||
public string ResolutionTestUtil(string str)
|
||||
{
|
||||
try
|
||||
{
|
||||
// 定义正则表达式模式
|
||||
string partnumberPattern = @"ERP(\w+)PQ"; // 产品零件号
|
||||
string quantityPattern = @"PQ(\d+)D"; // 产品数量
|
||||
string batchCodePattern = @"D(\d+)S"; // 产品生产批次
|
||||
|
||||
// 使用正则表达式进行匹配
|
||||
Match partnumberMatch = Regex.Match(str, partnumberPattern);
|
||||
Match quantityMatch = Regex.Match(str, quantityPattern);
|
||||
Match batchCodeMatch = Regex.Match(str, batchCodePattern);
|
||||
|
||||
// 创建接收
|
||||
string partnumber = "";
|
||||
string quantity = "";
|
||||
string batchCode = "";
|
||||
// 判断解析是否成功
|
||||
if (!partnumberMatch.Success) {
|
||||
throw new Exception("解析零件号失败");
|
||||
}
|
||||
if (!quantityMatch.Success)
|
||||
{
|
||||
throw new Exception("解析产品数量失败");
|
||||
}
|
||||
if (!batchCodeMatch.Success)
|
||||
{
|
||||
throw new Exception("解析产品生产批次失败");
|
||||
}
|
||||
partnumber = partnumberMatch.Groups[1].Value;
|
||||
quantity = quantityMatch.Groups[1].Value;
|
||||
batchCode = batchCodeMatch.Groups[1].Value;
|
||||
return batchCode;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
||||
throw new Exception("解析失败" + e.Message);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//解析外箱标签码
|
||||
public ResultionPackageCodeDto ResolutionPackage(string code)
|
||||
{
|
||||
@@ -138,5 +190,6 @@ namespace ZR.Service.Utils
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ using ZR.Model.MES.qc.DTO;
|
||||
using ZR.Model.MES.qu;
|
||||
using ZR.Model.MES.wms;
|
||||
using ZR.Service.mes.qc.IService;
|
||||
using ZR.Service.Utils;
|
||||
using static System.Runtime.InteropServices.JavaScript.JSType;
|
||||
|
||||
namespace ZR.Service.mes.qc
|
||||
@@ -511,5 +512,107 @@ namespace ZR.Service.mes.qc
|
||||
throw new Exception(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
// 获取产线相关数据
|
||||
public QcProductAndPolishAndOneTimeFqcBoardDto GetProductTotal(
|
||||
QcProductAndPolishAndOneTimeFqcBoardDto boardData
|
||||
)
|
||||
{
|
||||
boardData.ProductRequireTotal =
|
||||
Context.Queryable<QcQualityStatisticsTotal>().Sum(it => it.RequireNumber) ?? 0;
|
||||
boardData.ProductQualifiedTotal =
|
||||
Context.Queryable<QcQualityStatisticsTotal>().Sum(it => it.QualifiedNumber) ?? 0;
|
||||
boardData.ProductPolishTotal =
|
||||
Context.Queryable<QcQualityStatisticsFirst>().Sum(it => it.PaoguangTotal) ?? 0;
|
||||
boardData.ProductSandingTotal =
|
||||
Context.Queryable<QcQualityStatisticsTotal>().Sum(it => it.DamoTotal) ?? 0;
|
||||
boardData.ProductDiscardTotal =
|
||||
Context.Queryable<QcQualityStatisticsTotal>().Sum(it => it.BaofeiTotal) ?? 0;
|
||||
return boardData;
|
||||
}
|
||||
|
||||
// 获取抛光相关数据
|
||||
public QcProductAndPolishAndOneTimeFqcBoardDto GetPolishTotal(
|
||||
QcProductAndPolishAndOneTimeFqcBoardDto boardData
|
||||
)
|
||||
{
|
||||
boardData.PolishWarehouseTotal =
|
||||
Context.Queryable<WmPolishInventory>().Sum(it => it.Quantity) ?? 0;
|
||||
|
||||
boardData.PolishRequireTotal =
|
||||
Context.Queryable<WmPolishWorkQualityStatistics>().Sum(it => it.RequireNumber) ?? 0;
|
||||
boardData.PolishQualifiedTotal =
|
||||
Context.Queryable<WmPolishWorkQualityStatistics>().Sum(it => it.QualifiedNumber)
|
||||
?? 0;
|
||||
boardData.PolishSandingTotal =
|
||||
Context.Queryable<WmPolishWorkQualityStatistics>().Sum(it => it.DamoTotal) ?? 0;
|
||||
boardData.PolishDiscardTotal =
|
||||
Context.Queryable<WmPolishWorkQualityStatistics>().Sum(it => it.BaofeiTotal) ?? 0;
|
||||
|
||||
boardData.AfterPolishRequireTotal =
|
||||
Context.Queryable<WmPolishQualityStatistics>().Sum(it => it.RequireNumber) ?? 0;
|
||||
boardData.AfterPolishQualifiedTotal =
|
||||
Context.Queryable<WmPolishQualityStatistics>().Sum(it => it.QualifiedNumber) ?? 0;
|
||||
boardData.AfterPolishPolishTotal =
|
||||
Context.Queryable<WmPolishQualityStatistics>().Sum(it => it.PaoguangTotal) ?? 0;
|
||||
boardData.AfterPolishSandingTotal =
|
||||
Context.Queryable<WmPolishQualityStatistics>().Sum(it => it.DamoTotal) ?? 0;
|
||||
boardData.AfterPolishDiscardTotal =
|
||||
Context.Queryable<WmPolishQualityStatistics>().Sum(it => it.BaofeiTotal) ?? 0;
|
||||
return boardData;
|
||||
}
|
||||
|
||||
// 获取一次合格品相关数据
|
||||
public QcProductAndPolishAndOneTimeFqcBoardDto GetOneTimeTotal(
|
||||
QcProductAndPolishAndOneTimeFqcBoardDto boardData
|
||||
)
|
||||
{
|
||||
boardData.OneTimeWarehouseTotal =
|
||||
Context.Queryable<WmOneTimeInventory>().Sum(it => it.Quantity) ?? 0;
|
||||
|
||||
boardData.GP12RequireTotal =
|
||||
Context.Queryable<WmGp12QualityStatistics>().Sum(it => it.RequireNumber) ?? 0;
|
||||
boardData.GP12QualifiedTotal =
|
||||
Context.Queryable<WmGp12QualityStatistics>().Sum(it => it.QualifiedNumber) ?? 0;
|
||||
boardData.GP12PolishTotal =
|
||||
Context.Queryable<WmGp12QualityStatistics>().Sum(it => it.PaoguangTotal) ?? 0;
|
||||
boardData.GP12SandingTotal =
|
||||
Context.Queryable<WmGp12QualityStatistics>().Sum(it => it.DamoTotal) ?? 0;
|
||||
boardData.GP12DiscardTotal =
|
||||
Context.Queryable<WmGp12QualityStatistics>().Sum(it => it.BaofeiTotal) ?? 0;
|
||||
return boardData;
|
||||
}
|
||||
|
||||
// 获取成品仓库相关数据
|
||||
public QcProductAndPolishAndOneTimeFqcBoardDto GetFinishProductTotal(
|
||||
QcProductAndPolishAndOneTimeFqcBoardDto boardData
|
||||
)
|
||||
{
|
||||
boardData.FinishProductPartTotal =
|
||||
Context.Queryable<WmGoodsNowProduction>().Sum(it => it.GoodsNumAction) ?? 0;
|
||||
boardData.FinishProductPackageTotal = Context.Queryable<WmGoodsNowProduction>().Count();
|
||||
|
||||
boardData.FinishProductPartOutTotal =
|
||||
Context.Queryable<WmGoodsOutRecord>().Sum(it => it.GoodsNumAction) ?? 0;
|
||||
boardData.FinishProductPackageOutTotal = Context.Queryable<WmGoodsOutRecord>().Count();
|
||||
return boardData;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取产线,抛光,一次合格品质量报表看板数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public QcProductAndPolishAndOneTimeFqcBoardDto GetProductAndPolishAndOneTimeFqcBoardData()
|
||||
{
|
||||
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.UpdatedTime = DateTime.Now.ToLocalTime();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,5 +40,11 @@ namespace ZR.Service.mes.qc.IService
|
||||
/// <returns>QcCommonFqcWorkerOrderDataDto 质量检测工单,生产线数据</returns>
|
||||
public PagedInfo<QcCommonFqcWorkerOrderDataDto> GetWorkOrderFqcData(QcCommonFqcWorkerOrderDataQuery query);
|
||||
|
||||
/// <summary>
|
||||
/// 获取产线,抛光,一次合格品质量报表看板数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public QcProductAndPolishAndOneTimeFqcBoardDto GetProductAndPolishAndOneTimeFqcBoardData();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user