批量绑定优化

This commit is contained in:
hehaibing-1996
2025-03-11 16:04:45 +08:00
parent 9b885235d5
commit d3b00f2222
2 changed files with 6 additions and 4 deletions

View File

@ -388,8 +388,8 @@ namespace WCS.BLL.Services.Service
//判断如果导入表中的物料编码数量与数据库中有效的编码数量不一致证明中间有无效的物料编码 //判断如果导入表中的物料编码数量与数据库中有效的编码数量不一致证明中间有无效的物料编码
if (matBaseInfoInDb != null && matBaseInfoInDb?.Count < matCodes.Count) if (matBaseInfoInDb != null && matBaseInfoInDb?.Count < matCodes.Count)
{ {
var matCodesInDb = matBaseInfoInDb.Select(t => t.MatName).ToList(); var matCodesInDb = matBaseInfoInDb.Select(t => t.MatCode.ToUpper()).ToList();
matCodes.RemoveAll(t => matCodesInDb.Contains(t)); matCodes.RemoveAll(t => matCodesInDb.Contains(t.ToUpper()));
if (matCodes.Count > 0) if (matCodes.Count > 0)
{ {
return new ResponseCommon<List<string>>() return new ResponseCommon<List<string>>()
@ -410,7 +410,7 @@ namespace WCS.BLL.Services.Service
await DbHelp.db.BeginTranAsync(); await DbHelp.db.BeginTranAsync();
foreach (var info in lists) foreach (var info in lists)
{ {
var matBaseInfo = matBaseInfoInDb?.Where(t => t.MatCode == info.).First(); var matBaseInfo = matBaseInfoInDb?.Where(t => t.MatCode.ToUpper() == info..ToUpper() || t.MatCode.ToLower() == info..ToLower()).First();
var shelfInfo = shelfInfosInDb?.Where(t => t.ShelfCode == info.).First(); var shelfInfo = shelfInfosInDb?.Where(t => t.ShelfCode == info.).First();
var orderType = orderTypesInDb?.Where(t => t.OrderTypeName == info.).FirstOrDefault(); var orderType = orderTypesInDb?.Where(t => t.OrderTypeName == info.).FirstOrDefault();
//应该是不能走进的分支 //应该是不能走进的分支

View File

@ -355,7 +355,9 @@ namespace 智慧物流软件系统.ViewModel
if (result.Data != null && result.Data.Count > 0) if (result.Data != null && result.Data.Count > 0)
HandyControl.Controls.MessageBox.Show(result.Message + "\t\n" + String.Join("\t\n", result.Data)); HandyControl.Controls.MessageBox.Show(result.Message + "\t\n" + String.Join("\t\n", result.Data));
else else
HandyControl.Controls.MessageBox.Show(result.Message); {
TipView.Show(result.Message);
}
} }
} }
catch (Exception ex) catch (Exception ex)