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