货物状态非一次性初始化

推送东胜加申请箱使
optimize
wanghaomei 2 years ago
parent dca7c2e7c4
commit 18b2e58c90

@ -52,7 +52,7 @@ namespace Myshipping.Application
public async Task<dynamic> Page([FromQuery] QueryBookingGoodsStatusConfigInput input)
{
//初次使用没有数据,进行初始化
InitGoodsStatusConfig(UserManager.UserId,UserManager.Name);
InitGoodsStatusConfig(UserManager.UserId, UserManager.Name);
var entities = await _rep.AsQueryable()
.Where(m => m.CreatedUserId == UserManager.UserId)
@ -127,26 +127,33 @@ namespace Myshipping.Application
/// 初始化当前用户的货物状态配置
/// </summary>
[NonAction]
public async void InitGoodsStatusConfig(long userid,string username)
public async void InitGoodsStatusConfig(long userid, string username)
{
if (_rep.AsQueryable().Count(x => x.CreatedUserId == userid) == 0)
var list = _rep.AsQueryable().Where(x => x.CreatedUserId == userid).ToList();
//2023年6月1日修改为非一次性初始化每次都检查是否有新的统一配置的货物状态如果有给当前人增加上
//if (_rep.AsQueryable().Count(x => x.CreatedUserId == userid) == 0)
//{
var dicData = await _cache.GetAllDictData();
var listGoodsStatus = dicData.Where(x => x.TypeCode == "booking_goods_status").ToList();
listGoodsStatus.ForEach(async itm =>
{
var dicData = await _cache.GetAllDictData();
var listGoodsStatus = dicData.Where(x => x.TypeCode == "booking_goods_status").ToList();
listGoodsStatus.ForEach(async itm =>
if (list.Count(x => x.SystemCode == itm.Code) == 0) //找不到系统编码的,插入
{
await _rep.InsertAsync(new BookingGoodsStatusConfig()
{
StatusName = itm.Value,
Sort = itm.Sort,
SystemCode = itm.Code,
CreatedUserId=userid,
TenantId=UserManager.TENANT_ID,
CreatedUserName= username,
CreatedTime=DateTime.Now
CreatedUserId = userid,
TenantId = UserManager.TENANT_ID,
CreatedUserName = username,
CreatedTime = DateTime.Now
});
});
}
}
});
//}
}
}
}

@ -1548,6 +1548,11 @@ namespace Myshipping.Application.Service.DataSync.Dto
public DateTime? ATA { get; set; }
#endregion
/// <summary>
/// 申请箱使
/// </summary>
public string ShenQingXiangShi { get; set; }
}

Loading…
Cancel
Save