|
|
|
@ -6,8 +6,10 @@ using DS.Module.UserModule;
|
|
|
|
|
using DS.WMS.Core.Code.Dtos;
|
|
|
|
|
using DS.WMS.Core.Code.Entity;
|
|
|
|
|
using DS.WMS.Core.Code.Interface;
|
|
|
|
|
using DS.WMS.Core.Sys.Interface;
|
|
|
|
|
using Mapster;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using SqlSugar;
|
|
|
|
|
|
|
|
|
|
namespace DS.WMS.Core.Code.Method;
|
|
|
|
@ -18,6 +20,8 @@ public class CodeIssueTypeService:ICodeIssueTypeService
|
|
|
|
|
private readonly ISqlSugarClient db;
|
|
|
|
|
private readonly IUser user;
|
|
|
|
|
private readonly ISaasDbService saasService;
|
|
|
|
|
private readonly ISysCacheService _sysCacheService;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
///
|
|
|
|
|
/// </summary>
|
|
|
|
@ -28,6 +32,7 @@ public class CodeIssueTypeService:ICodeIssueTypeService
|
|
|
|
|
db = _serviceProvider.GetRequiredService<ISqlSugarClient>();
|
|
|
|
|
user = _serviceProvider.GetRequiredService<IUser>();
|
|
|
|
|
saasService = _serviceProvider.GetRequiredService<ISaasDbService>();
|
|
|
|
|
_sysCacheService = _serviceProvider.GetRequiredService<ISysCacheService>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public DataResult<List<CodeIssueTypeRes>> GetListByPage(PageRequest request)
|
|
|
|
@ -53,7 +58,7 @@ public class CodeIssueTypeService:ICodeIssueTypeService
|
|
|
|
|
var data = req.Adapt<CodeIssueType>();
|
|
|
|
|
|
|
|
|
|
var entity = db.Insertable(data).ExecuteReturnEntity();
|
|
|
|
|
|
|
|
|
|
_sysCacheService.RemoveCache(Sys.Method.SysCacheCategoryEnum.CommonCodeIssueType, "DS8").GetAwaiter().GetResult();
|
|
|
|
|
return DataResult.Successed("添加成功!", entity.Id,MultiLanguageConst.DataCreateSuccess);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
@ -63,6 +68,7 @@ public class CodeIssueTypeService:ICodeIssueTypeService
|
|
|
|
|
info = req.Adapt(info);
|
|
|
|
|
|
|
|
|
|
db.Updateable(info).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand();
|
|
|
|
|
_sysCacheService.RemoveCache(Sys.Method.SysCacheCategoryEnum.CommonCodeIssueType, "DS8").GetAwaiter().GetResult();
|
|
|
|
|
return DataResult.Successed("更新成功!",MultiLanguageConst.DataUpdateSuccess);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -101,7 +107,7 @@ public class CodeIssueTypeService:ICodeIssueTypeService
|
|
|
|
|
var data = req.Adapt<CodeIssueType>();
|
|
|
|
|
|
|
|
|
|
var entity = tenantDb.Insertable(data).ExecuteReturnEntity();
|
|
|
|
|
|
|
|
|
|
_sysCacheService.RemoveCache(Sys.Method.SysCacheCategoryEnum.CommonCodeIssueType, "DS8").GetAwaiter().GetResult();
|
|
|
|
|
return DataResult.Successed("添加成功!", entity.Id,MultiLanguageConst.DataCreateSuccess);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
@ -111,6 +117,7 @@ public class CodeIssueTypeService:ICodeIssueTypeService
|
|
|
|
|
info = req.Adapt(info);
|
|
|
|
|
|
|
|
|
|
tenantDb.Updateable(info).IgnoreColumns(ignoreAllNullColumns: true).ExecuteCommand();
|
|
|
|
|
_sysCacheService.RemoveCache(Sys.Method.SysCacheCategoryEnum.CommonCodeIssueType, "DS8").GetAwaiter().GetResult();
|
|
|
|
|
return DataResult.Successed("更新成功!",MultiLanguageConst.DataUpdateSuccess);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -154,6 +161,8 @@ public class CodeIssueTypeService:ICodeIssueTypeService
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tenantDb.Insertable(list).ExecuteCommand();
|
|
|
|
|
|
|
|
|
|
_sysCacheService.RemoveCache(Sys.Method.SysCacheCategoryEnum.CommonCodeIssueType, "DS8").GetAwaiter().GetResult();
|
|
|
|
|
return DataResult.Successed("引入成功!",MultiLanguageConst.DataImportSuccess);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -177,6 +186,65 @@ public class CodeIssueTypeService:ICodeIssueTypeService
|
|
|
|
|
{
|
|
|
|
|
tenantDb.Deleteable(list).ExecuteCommand();
|
|
|
|
|
}
|
|
|
|
|
_sysCacheService.RemoveCache(Sys.Method.SysCacheCategoryEnum.CommonCodeIssueType, "DS8").GetAwaiter().GetResult();
|
|
|
|
|
return DataResult.Successed("删除成功!", MultiLanguageConst.DataDelSuccess);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取签单方式基础数据
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="isFromCache">是否从缓存提取 true-从缓存读取 false-从数据库读取</param>
|
|
|
|
|
/// <returns>返回签单方式基础数据列表</returns>
|
|
|
|
|
public async Task<DataResult<List<CodeIssueTypeRes>>> GetAllList(bool isFromCache = true)
|
|
|
|
|
{
|
|
|
|
|
List<CodeIssueTypeRes> list = new List<CodeIssueTypeRes>();
|
|
|
|
|
|
|
|
|
|
bool isLoad = false;
|
|
|
|
|
|
|
|
|
|
if (isFromCache)
|
|
|
|
|
{
|
|
|
|
|
var rlt = await _sysCacheService.GetAllCommonCodeFromCache<CodeIssueTypeRes>(Sys.Method.SysCacheCategoryEnum.CommonCodeIssueType, "DS8");
|
|
|
|
|
|
|
|
|
|
if (rlt.Succeeded)
|
|
|
|
|
return rlt;
|
|
|
|
|
|
|
|
|
|
isLoad = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var tenantDb = saasService.GetBizDbScopeById(user.TenantId);
|
|
|
|
|
|
|
|
|
|
list = tenantDb.Queryable<CodeIssueType>()
|
|
|
|
|
.Select<CodeIssueTypeRes>()
|
|
|
|
|
.Where(a => a.Status == StatusEnum.Enable).ToList();
|
|
|
|
|
|
|
|
|
|
if (list.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
if (isLoad)
|
|
|
|
|
{
|
|
|
|
|
await _sysCacheService.SetCommonCode(JsonConvert.SerializeObject(list), Sys.Method.SysCacheCategoryEnum.CommonCodeIssueType, "DS8");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return DataResult<List<CodeIssueTypeRes>>.Success(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return DataResult<List<CodeIssueTypeRes>>.FailedData(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 加载到缓存
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
public async Task<DataResult> LoadCache()
|
|
|
|
|
{
|
|
|
|
|
var rlt = await GetAllList(false);
|
|
|
|
|
|
|
|
|
|
if (rlt.Succeeded)
|
|
|
|
|
{
|
|
|
|
|
await _sysCacheService.SetCommonCode(JsonConvert.SerializeObject(rlt.Data), Sys.Method.SysCacheCategoryEnum.CommonCodeIssueType, "DS8");
|
|
|
|
|
|
|
|
|
|
return DataResult.Successed(MultiLanguageConst.LoadCacheSucc);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return DataResult.Failed(MultiLanguageConst.LoadCacheFailDataNull);
|
|
|
|
|
}
|
|
|
|
|
}
|