fix: 更改保证金模板名称配置的取值 由admin-> 数据字典
This commit is contained in:
@@ -306,17 +306,13 @@ namespace YLErp.Modules.AppModule
|
||||
//-----------------------------------------------
|
||||
configService.AddDataIfNotExists("ProjectConfig", "Erp.IsAutoSealAfterGeneratedBook", "false", "bool", "确认书生成时是否自动用印(IsAutoSealAndUploadFiles勾选时生效)");
|
||||
configService.AddDataIfNotExists("ProjectConfig", "Erp.ReportFileBeginNumber", "0", "int", "报送文件开始编号");
|
||||
//-----------------------------------------------
|
||||
// 删除不再使用的
|
||||
//-----------------------------------------------
|
||||
configService.AddDataIfNotExists("ProjectConfig", YLErp.Modules.SwapModule.SwapMarginTemplateConfigService.ConfigName,
|
||||
YLErp.Modules.SwapModule.SwapMarginTemplateConfigService.DefaultConfigJson, "text", "互换保证金模板(JSON)");
|
||||
|
||||
RemoveUnUsed(configService);
|
||||
}
|
||||
|
||||
private static void RemoveUnUsed(InnerAppConfigService configService)
|
||||
{
|
||||
configService.RemoveData("ProjectConfig", "Trade.SwapMarginTemplateConfig");
|
||||
|
||||
if (AppManager.Version.Major < 3)
|
||||
{
|
||||
configService.RemoveData("ProjectConfig", "Erp.TradeConfirmBookEmailTPL");
|
||||
@@ -456,6 +452,38 @@ namespace YLErp.Modules.AppModule
|
||||
}
|
||||
|
||||
adminDb.SaveChanges();
|
||||
|
||||
var marginTemplateDictionary = adminDb.Dictionaries.FirstOrDefault(item => item.Name == YLErp.Modules.SwapModule.SwapMarginTemplateConfigService.DictionaryName);
|
||||
if (marginTemplateDictionary == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var existingNames = adminDb.DictionaryItems
|
||||
.Where(item => item.DictId == marginTemplateDictionary.Id)
|
||||
.Select(item => item.Name)
|
||||
.ToHashSet();
|
||||
var nextIndex = adminDb.DictionaryItems
|
||||
.Where(item => item.DictId == marginTemplateDictionary.Id)
|
||||
.Select(item => item.IndexNum)
|
||||
.DefaultIfEmpty(-1)
|
||||
.Max();
|
||||
foreach (var templateName in YLErp.Modules.SwapModule.SwapMarginTemplateConfigService.InitialTemplateNames)
|
||||
{
|
||||
if (existingNames.Contains(templateName))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
adminDb.DictionaryItems.Add(new BaseOUDAL.DictionaryItem
|
||||
{
|
||||
DictId = marginTemplateDictionary.Id,
|
||||
Name = templateName,
|
||||
ShortName = templateName,
|
||||
IndexNum = ++nextIndex
|
||||
});
|
||||
}
|
||||
adminDb.SaveChanges();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user