diff --git a/ZR.Admin.WebApi/Controllers/mes/qc/GP12/QcGp12Controller.cs b/ZR.Admin.WebApi/Controllers/mes/qc/GP12/QcGp12Controller.cs
index 9d24b3d9..828d34db 100644
--- a/ZR.Admin.WebApi/Controllers/mes/qc/GP12/QcGp12Controller.cs
+++ b/ZR.Admin.WebApi/Controllers/mes/qc/GP12/QcGp12Controller.cs
@@ -60,6 +60,18 @@ namespace ZR.Admin.WebApi.Controllers
return SUCCESS(response);
}
+ ///
+ /// 获取缺陷项列表初始数据
+ ///
+ ///
+ [HttpGet("GetDefectTableOptions")]
+ [AllowAnonymous]
+ public IActionResult GetDefectTableOptions()
+ {
+ var response = _QcGp12Service.GetDefectTableOptions();
+ return SUCCESS(response);
+ }
+
///
/// 解析标签
///
diff --git a/ZR.Admin.WebApi/Controllers/mes/qc/GP12/QcGp12ServiceStatisticsController.cs b/ZR.Admin.WebApi/Controllers/mes/qc/GP12/QcGp12ServiceStatisticsController.cs
index 1352b0c3..8eae502e 100644
--- a/ZR.Admin.WebApi/Controllers/mes/qc/GP12/QcGp12ServiceStatisticsController.cs
+++ b/ZR.Admin.WebApi/Controllers/mes/qc/GP12/QcGp12ServiceStatisticsController.cs
@@ -87,19 +87,29 @@ namespace ZR.Admin.WebApi.Controllers
return itemDict;
})
.ToList();
-
- // 计算合格率
- double qualifiedRate =
- totalRequireNumber > 0
- ? (double)totalQualifiedNumber / totalRequireNumber * 150
- : 0;
+ // 数据除三
+ totalRequireNumber = totalRequireNumber / 3;
+ totalQualifiedNumber = totalQualifiedNumber / 3;
+ totalPolishNumber = totalPolishNumber / 3;
+ totalDamoNumber = totalDamoNumber / 3;
+ totalBaofeiNumber = totalBaofeiNumber / 3;
totalListCount = totalListCount / 3;
+ // 计算合格率
+ double qualifiedRate = 0.0;
+ if (totalRequireNumber > 0)
+ {
+ qualifiedRate = (double)totalQualifiedNumber / totalRequireNumber * 100;
+ }
+ else
+ {
+ qualifiedRate = 0.0;
+ }
// 创建统计数据字典
var statistics = new Dictionary
{
{ "TotalRequireNumber", totalRequireNumber },
{ "TotalQualifiedNumber", totalQualifiedNumber },
- { "QualifiedRate", $"{qualifiedRate:F2}%" },
+ { "QualifiedRate", $"{qualifiedRate:F1}%" },
{ "TotalPolishNumber", totalPolishNumber },
{ "TotalDamoNumber", totalDamoNumber },
{ "TotalBaofeiNumber", totalBaofeiNumber },
diff --git a/ZR.Service/mes/qc/IService/IQcGp12Service.cs b/ZR.Service/mes/qc/IService/IQcGp12Service.cs
index c7b2516f..d7308b9c 100644
--- a/ZR.Service/mes/qc/IService/IQcGp12Service.cs
+++ b/ZR.Service/mes/qc/IService/IQcGp12Service.cs
@@ -29,6 +29,12 @@ namespace ZR.Service.Business.IBusinessService
///
List GetDefectInitOptions();
+ ///
+ /// 获取缺陷项菜单列表的渲染数据
+ ///
+ ///
+ List GetDefectTableOptions();
+
///
/// 解析标签
///
diff --git a/ZR.Service/mes/qc/QcGp12Service.cs b/ZR.Service/mes/qc/QcGp12Service.cs
index 18965b51..3bc30602 100644
--- a/ZR.Service/mes/qc/QcGp12Service.cs
+++ b/ZR.Service/mes/qc/QcGp12Service.cs
@@ -173,6 +173,48 @@ namespace ZR.Service.Business
return defectList;
}
+ public List GetDefectTableOptions()
+ {
+ List defectList = new();
+ var predicate = Expressionable
+ .Create()
+ .And(it => it.Type == "打磨")
+ .And(it => it.Status == "1");
+ List groupList = Context
+ .Queryable()
+ .Where(predicate.ToExpression())
+ .GroupBy(it => it.Group)
+ .Select(it => it.Group)
+ .ToList();
+ foreach (string group in groupList)
+ {
+ QcGp12AlterationDefectDto defectDto = new();
+ defectDto.GroupName = group;
+ List children = Context
+ .Queryable()
+ .Where(it => it.Group == group)
+ .Where(predicate.ToExpression())
+ .Select(it => new QcGp12ChildrenDefectDto
+ {
+ Name = it.Name,
+ Code = SqlFunc.IIF(
+ SqlFunc.Length(it.Code) >= 2,
+ SqlFunc.MergeString(
+ SqlFunc.Substring(it.Code, 0, 1), // 获取第一个字符(注意:SQL 中索引通常从1开始)
+ SqlFunc.Substring(it.Code, SqlFunc.Length(it.Code) - 1, 1) // 获取最后一个字符
+ ),
+ it.Code
+ ),
+ Type = it.Type,
+ Num = 0
+ })
+ .ToList();
+ defectDto.Children = children;
+ defectList.Add(defectDto);
+ }
+ return defectList;
+ }
+
public List GetGroupOptions()
{
var predicate = Expressionable.Create().And(it => it.Status == "1");
@@ -252,17 +294,18 @@ namespace ZR.Service.Business
Context.Ado.RollbackTran();
throw new Exception("插入标签记录异常");
}
- QcGp12LogWorkorder qcGp12Log = new()
- {
- Id = SnowFlakeSingle.Instance.NextId().ToString(),
- Name = "工单开始",
- Content = $"工单:{result.WorkOrder}开始,开始时间{nowTime:yyyy-MM-dd HH:mm:ss}",
- Type = "100",
- Status = "1",
- Remark = "触摸屏操作记录",
- CreatedBy = "系统",
- CreatedTime = nowTime
- };
+ QcGp12LogWorkorder qcGp12Log =
+ new()
+ {
+ Id = SnowFlakeSingle.Instance.NextId().ToString(),
+ Name = "工单开始",
+ Content = $"工单:{result.WorkOrder}开始,开始时间{nowTime:yyyy-MM-dd HH:mm:ss}",
+ Type = "100",
+ Status = "1",
+ Remark = "触摸屏操作记录",
+ CreatedBy = "系统",
+ CreatedTime = nowTime
+ };
Context.Insertable(qcGp12Log).ExecuteCommand();
Context.Ado.CommitTran();
return result;
@@ -552,11 +595,11 @@ namespace ZR.Service.Business
{
return "内标签零件号与外箱标签不一致!";
}
-/* int qt = DoAnalyzeQuantity(data.Label);
- if (qt >= 6)
- {
- return "该标签可能为外箱标签!";
- }*/
+ /* int qt = DoAnalyzeQuantity(data.Label);
+ if (qt >= 6)
+ {
+ return "该标签可能为外箱标签!";
+ }*/
bool hasAny = Context
.Queryable()
.Where(it => it.Label == data.Label)
@@ -635,17 +678,18 @@ namespace ZR.Service.Business
.ExecuteCommand();
Context.Insertable(addList).ExecuteCommand();
- QcGp12LogWorkorder qcGp12Log = new()
- {
- Id = SnowFlakeSingle.Instance.NextId().ToString(),
- Name = "工单结束",
- Content = $"工单:{workorder}结束,结束时间{nowTime:yyyy-MM-dd HH:mm:ss}",
- Type = "200",
- Status = "1",
- Remark = "触摸屏操作记录",
- CreatedBy = "系统",
- CreatedTime = nowTime
- };
+ QcGp12LogWorkorder qcGp12Log =
+ new()
+ {
+ Id = SnowFlakeSingle.Instance.NextId().ToString(),
+ Name = "工单结束",
+ Content = $"工单:{workorder}结束,结束时间{nowTime:yyyy-MM-dd HH:mm:ss}",
+ Type = "200",
+ Status = "1",
+ Remark = "触摸屏操作记录",
+ CreatedBy = "系统",
+ CreatedTime = nowTime
+ };
Context.Insertable(qcGp12Log).ExecuteCommand();
// 提交事务
Context.Ado.CommitTran();
diff --git a/ZR.Service/mes/qc/QcGp12ServiceStatisticsService.cs b/ZR.Service/mes/qc/QcGp12ServiceStatisticsService.cs
index 9c9e2127..2dc65cf3 100644
--- a/ZR.Service/mes/qc/QcGp12ServiceStatisticsService.cs
+++ b/ZR.Service/mes/qc/QcGp12ServiceStatisticsService.cs
@@ -197,7 +197,12 @@ namespace ZR.Service.Business
);
if (baseDefect != null)
{
- var propertyName = $"{defect.DefectCode}";
+ // 取得第一个和最后一个字符
+ string code = defect.DefectCode;
+ char firstChar = code[0];
+ char lastChar = code[code.Length - 1];
+ // 组合第一个和最后一个字符
+ string propertyName = $"{firstChar}{lastChar}";
dto.AddDynamicProperty(propertyName, defect.DefectNum);
}
}