仓库数据看板
This commit is contained in:
@@ -128,5 +128,24 @@ namespace ZR.Admin.WebApi.Controllers.mes.qc.IQC
|
||||
return ToResponse(new ApiResult(500, ex.Message, ex.Message));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取产线,抛光,一次合格品质量报表看板数据
|
||||
/// </summary>
|
||||
/// <param name="query">查询值</param>
|
||||
/// <returns>QcCommonFqcBoardDto 看板数据</returns>
|
||||
[HttpPost("getProductAndPolishAndOneTimeFqcBoardData")]
|
||||
public IActionResult GetProductAndPolishAndOneTimeFqcBoardData()
|
||||
{
|
||||
try
|
||||
{
|
||||
var result = _commonFQCService.GetProductAndPolishAndOneTimeFqcBoardData();
|
||||
return ToResponse(new ApiResult(200, "ok", result));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return ToResponse(new ApiResult(500, ex.Message, ex.Message));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -95,8 +95,11 @@ namespace ZR.Admin.WebApi.Extensions
|
||||
/// <returns></returns>
|
||||
public static bool IsAdmin(this HttpContext context)
|
||||
{
|
||||
List<string> roles = new();
|
||||
roles.Add($"{GlobalConstant.AdminRole}");
|
||||
roles.Add("杨琳磊");
|
||||
var userName = context.GetName();
|
||||
return userName == GlobalConstant.AdminRole;
|
||||
return roles.Contains(userName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -172,6 +172,157 @@
|
||||
///</summary>
|
||||
public string Remark { get; set; } = default;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 产线,抛光,一次合格品质量报表看板
|
||||
///</summary>
|
||||
public class QcProductAndPolishAndOneTimeFqcBoardDto
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
/// 打磨总数
|
||||
///</summary>
|
||||
public int SandingTotal { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 报废总数
|
||||
///</summary>
|
||||
public int DiscardTotal { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// ====== 产线上件投入零件总数 ======
|
||||
///</summary>
|
||||
public int ProductRequireTotal { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 产线合格总数
|
||||
///</summary>
|
||||
public int ProductQualifiedTotal { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 产线抛光总数
|
||||
///</summary>
|
||||
public int ProductPolishTotal { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 产线打磨总数
|
||||
///</summary>
|
||||
public int ProductSandingTotal { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 产线报废总数
|
||||
///</summary>
|
||||
public int ProductDiscardTotal { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// ======抛光仓库零件总数======
|
||||
///</summary>
|
||||
public int PolishWarehouseTotal { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 抛光投入总数
|
||||
///</summary>
|
||||
public int PolishRequireTotal { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 抛光合格总数
|
||||
///</summary>
|
||||
public int PolishQualifiedTotal { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 抛光打磨总数
|
||||
///</summary>
|
||||
public int PolishSandingTotal { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 抛光报废总数
|
||||
///</summary>
|
||||
public int PolishDiscardTotal { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// ====== 后道检验零件投入总数 ======
|
||||
///</summary>
|
||||
public int AfterPolishRequireTotal { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 后道检验合格总数
|
||||
///</summary>
|
||||
public int AfterPolishQualifiedTotal { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 后道检验抛光总数
|
||||
///</summary>
|
||||
public int AfterPolishPolishTotal { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 后道检验打磨总数
|
||||
///</summary>
|
||||
public int AfterPolishSandingTotal { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 后道检验报废总数
|
||||
///</summary>
|
||||
public int AfterPolishDiscardTotal { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// ====== 一次合格品仓库零件总数 ======
|
||||
///</summary>
|
||||
public int OneTimeWarehouseTotal { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 一次合格品GP12投入总数
|
||||
///</summary>
|
||||
public int GP12RequireTotal { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 一次合格品GP12检验合格总数
|
||||
///</summary>
|
||||
public int GP12QualifiedTotal { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 一次合格品GP12检验抛光总数
|
||||
///</summary>
|
||||
public int GP12PolishTotal { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 一次合格品GP12检打磨总数
|
||||
///</summary>
|
||||
public int GP12SandingTotal { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 一次合格品GP12检验报废总数
|
||||
///</summary>
|
||||
public int GP12DiscardTotal { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// ====== 成品仓库零件总数 ======
|
||||
///</summary>
|
||||
public int FinishProductPartTotal { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 成品仓库总箱数
|
||||
///</summary>
|
||||
public int FinishProductPackageTotal { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 成品仓库出库零件总数
|
||||
///</summary>
|
||||
public int FinishProductPartOutTotal { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// 成品仓库出库总箱数
|
||||
///</summary>
|
||||
public int FinishProductPackageOutTotal { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// 备注
|
||||
/// </summary>
|
||||
public string Remark { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// 更新时间
|
||||
///</summary>
|
||||
public DateTime? UpdatedTime { get; set; } = default;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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