GP12触摸屏优化
This commit is contained in:
@@ -60,6 +60,18 @@ namespace ZR.Admin.WebApi.Controllers
|
|||||||
return SUCCESS(response);
|
return SUCCESS(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取缺陷项列表初始数据
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
[HttpGet("GetDefectTableOptions")]
|
||||||
|
[AllowAnonymous]
|
||||||
|
public IActionResult GetDefectTableOptions()
|
||||||
|
{
|
||||||
|
var response = _QcGp12Service.GetDefectTableOptions();
|
||||||
|
return SUCCESS(response);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 解析标签
|
/// 解析标签
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -87,19 +87,29 @@ namespace ZR.Admin.WebApi.Controllers
|
|||||||
return itemDict;
|
return itemDict;
|
||||||
})
|
})
|
||||||
.ToList();
|
.ToList();
|
||||||
|
// 数据除三
|
||||||
// 计算合格率
|
totalRequireNumber = totalRequireNumber / 3;
|
||||||
double qualifiedRate =
|
totalQualifiedNumber = totalQualifiedNumber / 3;
|
||||||
totalRequireNumber > 0
|
totalPolishNumber = totalPolishNumber / 3;
|
||||||
? (double)totalQualifiedNumber / totalRequireNumber * 150
|
totalDamoNumber = totalDamoNumber / 3;
|
||||||
: 0;
|
totalBaofeiNumber = totalBaofeiNumber / 3;
|
||||||
totalListCount = totalListCount / 3;
|
totalListCount = totalListCount / 3;
|
||||||
|
// 计算合格率
|
||||||
|
double qualifiedRate = 0.0;
|
||||||
|
if (totalRequireNumber > 0)
|
||||||
|
{
|
||||||
|
qualifiedRate = (double)totalQualifiedNumber / totalRequireNumber * 100;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qualifiedRate = 0.0;
|
||||||
|
}
|
||||||
// 创建统计数据字典
|
// 创建统计数据字典
|
||||||
var statistics = new Dictionary<string, object>
|
var statistics = new Dictionary<string, object>
|
||||||
{
|
{
|
||||||
{ "TotalRequireNumber", totalRequireNumber },
|
{ "TotalRequireNumber", totalRequireNumber },
|
||||||
{ "TotalQualifiedNumber", totalQualifiedNumber },
|
{ "TotalQualifiedNumber", totalQualifiedNumber },
|
||||||
{ "QualifiedRate", $"{qualifiedRate:F2}%" },
|
{ "QualifiedRate", $"{qualifiedRate:F1}%" },
|
||||||
{ "TotalPolishNumber", totalPolishNumber },
|
{ "TotalPolishNumber", totalPolishNumber },
|
||||||
{ "TotalDamoNumber", totalDamoNumber },
|
{ "TotalDamoNumber", totalDamoNumber },
|
||||||
{ "TotalBaofeiNumber", totalBaofeiNumber },
|
{ "TotalBaofeiNumber", totalBaofeiNumber },
|
||||||
|
|||||||
@@ -29,6 +29,12 @@ namespace ZR.Service.Business.IBusinessService
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
List<QcGp12AlterationDefectDto> GetDefectInitOptions();
|
List<QcGp12AlterationDefectDto> GetDefectInitOptions();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 获取缺陷项菜单列表的渲染数据
|
||||||
|
/// </summary>
|
||||||
|
/// <returns></returns>
|
||||||
|
List<QcGp12AlterationDefectDto> GetDefectTableOptions();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 解析标签
|
/// 解析标签
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -173,6 +173,48 @@ namespace ZR.Service.Business
|
|||||||
return defectList;
|
return defectList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<QcGp12AlterationDefectDto> GetDefectTableOptions()
|
||||||
|
{
|
||||||
|
List<QcGp12AlterationDefectDto> defectList = new();
|
||||||
|
var predicate = Expressionable
|
||||||
|
.Create<QcGp12BaseDefect>()
|
||||||
|
.And(it => it.Type == "打磨")
|
||||||
|
.And(it => it.Status == "1");
|
||||||
|
List<string> groupList = Context
|
||||||
|
.Queryable<QcGp12BaseDefect>()
|
||||||
|
.Where(predicate.ToExpression())
|
||||||
|
.GroupBy(it => it.Group)
|
||||||
|
.Select(it => it.Group)
|
||||||
|
.ToList();
|
||||||
|
foreach (string group in groupList)
|
||||||
|
{
|
||||||
|
QcGp12AlterationDefectDto defectDto = new();
|
||||||
|
defectDto.GroupName = group;
|
||||||
|
List<QcGp12ChildrenDefectDto> children = Context
|
||||||
|
.Queryable<QcGp12BaseDefect>()
|
||||||
|
.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<QcGp12BaseGroupDto> GetGroupOptions()
|
public List<QcGp12BaseGroupDto> GetGroupOptions()
|
||||||
{
|
{
|
||||||
var predicate = Expressionable.Create<QcGp12BaseGroup>().And(it => it.Status == "1");
|
var predicate = Expressionable.Create<QcGp12BaseGroup>().And(it => it.Status == "1");
|
||||||
@@ -252,17 +294,18 @@ namespace ZR.Service.Business
|
|||||||
Context.Ado.RollbackTran();
|
Context.Ado.RollbackTran();
|
||||||
throw new Exception("插入标签记录异常");
|
throw new Exception("插入标签记录异常");
|
||||||
}
|
}
|
||||||
QcGp12LogWorkorder qcGp12Log = new()
|
QcGp12LogWorkorder qcGp12Log =
|
||||||
{
|
new()
|
||||||
Id = SnowFlakeSingle.Instance.NextId().ToString(),
|
{
|
||||||
Name = "工单开始",
|
Id = SnowFlakeSingle.Instance.NextId().ToString(),
|
||||||
Content = $"工单:{result.WorkOrder}开始,开始时间{nowTime:yyyy-MM-dd HH:mm:ss}",
|
Name = "工单开始",
|
||||||
Type = "100",
|
Content = $"工单:{result.WorkOrder}开始,开始时间{nowTime:yyyy-MM-dd HH:mm:ss}",
|
||||||
Status = "1",
|
Type = "100",
|
||||||
Remark = "触摸屏操作记录",
|
Status = "1",
|
||||||
CreatedBy = "系统",
|
Remark = "触摸屏操作记录",
|
||||||
CreatedTime = nowTime
|
CreatedBy = "系统",
|
||||||
};
|
CreatedTime = nowTime
|
||||||
|
};
|
||||||
Context.Insertable(qcGp12Log).ExecuteCommand();
|
Context.Insertable(qcGp12Log).ExecuteCommand();
|
||||||
Context.Ado.CommitTran();
|
Context.Ado.CommitTran();
|
||||||
return result;
|
return result;
|
||||||
@@ -552,11 +595,11 @@ namespace ZR.Service.Business
|
|||||||
{
|
{
|
||||||
return "内标签零件号与外箱标签不一致!";
|
return "内标签零件号与外箱标签不一致!";
|
||||||
}
|
}
|
||||||
/* int qt = DoAnalyzeQuantity(data.Label);
|
/* int qt = DoAnalyzeQuantity(data.Label);
|
||||||
if (qt >= 6)
|
if (qt >= 6)
|
||||||
{
|
{
|
||||||
return "该标签可能为外箱标签!";
|
return "该标签可能为外箱标签!";
|
||||||
}*/
|
}*/
|
||||||
bool hasAny = Context
|
bool hasAny = Context
|
||||||
.Queryable<QcGp12RecordLabelScan>()
|
.Queryable<QcGp12RecordLabelScan>()
|
||||||
.Where(it => it.Label == data.Label)
|
.Where(it => it.Label == data.Label)
|
||||||
@@ -635,17 +678,18 @@ namespace ZR.Service.Business
|
|||||||
.ExecuteCommand();
|
.ExecuteCommand();
|
||||||
Context.Insertable(addList).ExecuteCommand();
|
Context.Insertable(addList).ExecuteCommand();
|
||||||
|
|
||||||
QcGp12LogWorkorder qcGp12Log = new()
|
QcGp12LogWorkorder qcGp12Log =
|
||||||
{
|
new()
|
||||||
Id = SnowFlakeSingle.Instance.NextId().ToString(),
|
{
|
||||||
Name = "工单结束",
|
Id = SnowFlakeSingle.Instance.NextId().ToString(),
|
||||||
Content = $"工单:{workorder}结束,结束时间{nowTime:yyyy-MM-dd HH:mm:ss}",
|
Name = "工单结束",
|
||||||
Type = "200",
|
Content = $"工单:{workorder}结束,结束时间{nowTime:yyyy-MM-dd HH:mm:ss}",
|
||||||
Status = "1",
|
Type = "200",
|
||||||
Remark = "触摸屏操作记录",
|
Status = "1",
|
||||||
CreatedBy = "系统",
|
Remark = "触摸屏操作记录",
|
||||||
CreatedTime = nowTime
|
CreatedBy = "系统",
|
||||||
};
|
CreatedTime = nowTime
|
||||||
|
};
|
||||||
Context.Insertable(qcGp12Log).ExecuteCommand();
|
Context.Insertable(qcGp12Log).ExecuteCommand();
|
||||||
// 提交事务
|
// 提交事务
|
||||||
Context.Ado.CommitTran();
|
Context.Ado.CommitTran();
|
||||||
|
|||||||
@@ -197,7 +197,12 @@ namespace ZR.Service.Business
|
|||||||
);
|
);
|
||||||
if (baseDefect != null)
|
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);
|
dto.AddDynamicProperty(propertyName, defect.DefectNum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user