GP12触摸屏优化

This commit is contained in:
2025-01-21 15:58:27 +08:00
parent 0e09b4a45c
commit 965f17eecd
5 changed files with 112 additions and 35 deletions

View File

@@ -29,6 +29,12 @@ namespace ZR.Service.Business.IBusinessService
/// <returns></returns>
List<QcGp12AlterationDefectDto> GetDefectInitOptions();
/// <summary>
/// 获取缺陷项菜单列表的渲染数据
/// </summary>
/// <returns></returns>
List<QcGp12AlterationDefectDto> GetDefectTableOptions();
/// <summary>
/// 解析标签
/// </summary>

View File

@@ -173,6 +173,48 @@ namespace ZR.Service.Business
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()
{
var predicate = Expressionable.Create<QcGp12BaseGroup>().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<QcGp12RecordLabelScan>()
.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();

View File

@@ -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);
}
}