optimize
wet 1 year ago
parent 6082bfaead
commit 80d406f729

@ -1243,7 +1243,7 @@ namespace Myshipping.Application
#region 插入货运动态
//配置中所有的货物状态
var config = _goodsStatusConfig.AsQueryable().Filter(null, true).Where(config => config.CreatedUserId == UserManager.UserId).ToList().DistinctBy(x => x.StatusName).Select(config => new GoodsStatusQuery
var config = _goodsStatusConfig.AsQueryable().Filter(null, true).Where(config => config.CreatedUserId == entity.CreatedUserId).ToList().DistinctBy(x => x.StatusName).Select(config => new GoodsStatusQuery
{
ConfigId = config.Id,
@ -1257,9 +1257,10 @@ namespace Myshipping.Application
Remark = null,
Sort = config.Sort
}).ToList();
if (config==null) {
_GoodsConfig.InitGoodsStatusConfig(UserManager.UserId, UserManager.Name);
config = _goodsStatusConfig.AsQueryable().Filter(null, true).Where(config => config.CreatedUserId == UserManager.UserId).ToList().DistinctBy(x => x.StatusName).Select(config => new GoodsStatusQuery
if (config == null)
{
_GoodsConfig.InitGoodsStatusConfig((long)entity.CreatedUserId, entity.CreatedUserName);
config = _goodsStatusConfig.AsQueryable().Filter(null, true).Where(config => config.CreatedUserId == entity.CreatedUserId).ToList().DistinctBy(x => x.StatusName).Select(config => new GoodsStatusQuery
{
ConfigId = config.Id,
@ -1273,47 +1274,89 @@ namespace Myshipping.Application
Remark = null,
Sort = config.Sort
}).ToList();
}
if (!string.IsNullOrEmpty(entity.MBLNO))
{
var ConfigId = config.Where(x => x.SystemCode == "YSDBC").Select(x => x.ConfigId).First();
var Status = _goodsStatus.FirstOrDefault(x => x.bookingId == Id && x.ConfigId == ConfigId);
if (Status == null)
if (!string.IsNullOrEmpty(entity.MBLNO))
{
await _goodsStatus.InsertAsync(new BookingGoodsStatus
var ConfigId = config.Where(x => x.SystemCode == "YSDBC").Select(x => x.ConfigId).First();
var Status = _goodsStatus.FirstOrDefault(x => x.bookingId == Id && x.ConfigId == ConfigId);
if (Status == null)
{
bookingId = Id,
ConfigId = ConfigId,
FinishTime = DateTime.Now,
FinishUser = UserManager.Name,
FinishUserId = UserManager.UserId,
IsPublic = false
});
await _goodsStatus.InsertAsync(new BookingGoodsStatus
{
bookingId = Id,
ConfigId = ConfigId,
FinishTime = DateTime.Now,
FinishUser = UserManager.Name,
FinishUserId = UserManager.UserId,
IsPublic = false
});
}
}
if (!string.IsNullOrEmpty(entity.CUSTNO))
{
var ConfigId = config.Where(x => x.SystemCode == "YDC").Select(x => x.ConfigId).First();
var Status = _goodsStatus.FirstOrDefault(x => x.bookingId == Id && x.ConfigId == ConfigId);
if (Status == null)
{
await _goodsStatus.InsertAsync(new BookingGoodsStatus
{
bookingId = Id,
ConfigId = ConfigId,
FinishTime = DateTime.Now,
FinishUser = UserManager.Name,
FinishUserId = UserManager.UserId,
IsPublic = false
});
}
}
}
if (!string.IsNullOrEmpty(entity.CUSTNO))
else
{
var ConfigId = config.Where(x => x.SystemCode == "YDC").Select(x => x.ConfigId).First();
var Status = _goodsStatus.FirstOrDefault(x => x.bookingId == Id && x.ConfigId == ConfigId);
if (Status == null)
if (!string.IsNullOrEmpty(entity.MBLNO))
{
await _goodsStatus.InsertAsync(new BookingGoodsStatus
var ConfigId = config.Where(x => x.SystemCode == "YSDBC").Select(x => x.ConfigId).First();
var Status = _goodsStatus.FirstOrDefault(x => x.bookingId == Id && x.ConfigId == ConfigId);
if (Status == null)
{
bookingId = Id,
ConfigId = ConfigId,
FinishTime = DateTime.Now,
FinishUser = UserManager.Name,
FinishUserId = UserManager.UserId,
IsPublic = false
});
await _goodsStatus.InsertAsync(new BookingGoodsStatus
{
bookingId = Id,
ConfigId = ConfigId,
FinishTime = DateTime.Now,
FinishUser = UserManager.Name,
FinishUserId = UserManager.UserId,
IsPublic = false
});
}
}
if (!string.IsNullOrEmpty(entity.CUSTNO))
{
var ConfigId = config.Where(x => x.SystemCode == "YDC").Select(x => x.ConfigId).First();
var Status = _goodsStatus.FirstOrDefault(x => x.bookingId == Id && x.ConfigId == ConfigId);
if (Status == null)
{
await _goodsStatus.InsertAsync(new BookingGoodsStatus
{
bookingId = Id,
ConfigId = ConfigId,
FinishTime = DateTime.Now,
FinishUser = UserManager.Name,
FinishUserId = UserManager.UserId,
IsPublic = false
});
}
}
}
#endregion

@ -139,22 +139,11 @@ namespace Myshipping.Application
throw Oops.Oh("请上传正确数据");
}
var Template= await _repPrintTemplateShare.AsQueryable().Filter(null, true).Where(x => x.IsDeleted == false && x.TenantId == UserManager.TENANT_ID).ToListAsync();
_repPrintTemplateShare.Delete(x => x.TemplateId == dto[0].TemplateId);
foreach (var item in dto)
{
var entity = item.Adapt<BookingTemplateShare>();
var t = Template.Where(x => x.TemplateId == item.TemplateId && x.ShareToId == item.ShareToId).FirstOrDefault();
if (t==null)
{
await _repPrintTemplateShare.InsertAsync(entity);
}
else {
entity.Id = t.Id;
await _repPrintTemplateShare.AsUpdateable(entity).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommandAsync();
}
await _repPrintTemplateShare.InsertAsync(entity);
}
}

Loading…
Cancel
Save