jianghaiqing 7 months ago
commit 57dfc85eb3

@ -4246,6 +4246,65 @@ namespace Myshipping.Application
{
throw Oops.Bah("当前模板未设置");
}
// 筛选出重复的行列
var groupList = entity.GroupBy(x => new { x.Row, x.Column }).Where(group => group.Count() > 1);
foreach (var group in groupList)
{
var orderbyGroup = group.OrderBy(x => x.Id);
foreach (var item in orderbyGroup)
{
string value = null;
var fieldType = item.Field.Split('.')[0].ToLower();
var fieldProperty = item.Field.Split('.')[1];
if (fieldType == "order")
{
if (order != null)
{
value = typeof(BookingOrder).GetProperty(fieldProperty).GetValue(order)?.ToString();
}
}
else if (fieldType == "edi")
{
if (edi != null)
{
value = typeof(BookingEDIExt).GetProperty(fieldProperty).GetValue(edi)?.ToString();
}
}
else if (fieldType == "userinfo")
{
var propertyLower = fieldProperty.ToLower();
switch (propertyLower)
{
case "username":
value = UserManager.Name; break;
case "usertel":
value = UserManager.TEl; break;
case "usermobile":
value = UserManager.Phone; break;
case "useremail":
value = UserManager.Email; break;
case "usertenant":
value = UserManager.TENANT_NAME; break;
default:
value = null; break;
};
}
if (!string.IsNullOrWhiteSpace(value))
{
foreach (var itemTemp in group)
{
if (itemTemp != item)
{
entity.Remove(itemTemp);
}
}
break;
}
}
}
for (int _row = 1; _row <= entity.Max(x => x.Row); _row++)
{

@ -434,7 +434,7 @@ namespace Myshipping.Application
UserName = "",
}).ToListAsync();
foreach (var item in list)
{
var username = userlist.Where(x => x.Id == item.SysUserId).Select(x => x.Name).FirstOrDefault();
@ -464,15 +464,16 @@ namespace Myshipping.Application
[HttpPost("/BookingTemplate/AddOrUpdateExcelTemplate")]
public async Task AddOrUpdateExcelTemplate(BookingExcelTemplateDto dto)
{
await _excelrep.DeleteAsync(x => x.PId == dto.Pid);
var list = new List<BookingExcelTemplate>();
foreach (var item in dto.children)
{
var entity = item.Adapt<BookingExcelTemplate>();
entity.PId = dto.Pid;
await _excelrep.InsertAsync(entity);
entity.Id = 0;
list.Add(entity);
}
await _excelrep.InsertAsync(list);
}
/// <summary>
/// 获取excel模板详情
@ -482,7 +483,7 @@ namespace Myshipping.Application
[HttpGet("/BookingTemplate/BookingExcelTemplateList")]
public async Task<dynamic> BookingExcelTemplateList(long Id)
{
return await _excelrep.AsQueryable().Where(x => x.PId == Id).ToListAsync();
return await _excelrep.AsQueryable().Where(x => x.PId == Id).OrderBy(x => x.Id).ToListAsync();
}
}

Loading…
Cancel
Save