完善 MCS 桌面代理与开炼机动作同步,修复原料相关菜单权限,桌面端新增上辅机 MES 菜单。
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -27,7 +27,37 @@ namespace YY.Admin.Services.Service.Config
|
||||
_sysCacheService.Set($"{CacheConst.KeyConfig}{code}", value);
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(value)) return default;
|
||||
return (T)Convert.ChangeType(value, typeof(T));
|
||||
|
||||
// bool:Convert.ChangeType 对 "1"/"Y" 等会抛异常,统一稳健解析
|
||||
var targetType = Nullable.GetUnderlyingType(typeof(T)) ?? typeof(T);
|
||||
if (targetType == typeof(bool))
|
||||
{
|
||||
var b = ParseConfigBool(value);
|
||||
return (T)(object)b;
|
||||
}
|
||||
|
||||
return (T)Convert.ChangeType(value, targetType);
|
||||
}
|
||||
|
||||
private static bool ParseConfigBool(string value)
|
||||
{
|
||||
if (bool.TryParse(value, out var b))
|
||||
return b;
|
||||
switch (value.Trim().ToLowerInvariant())
|
||||
{
|
||||
case "1":
|
||||
case "y":
|
||||
case "yes":
|
||||
case "on":
|
||||
return true;
|
||||
case "0":
|
||||
case "n":
|
||||
case "no":
|
||||
case "off":
|
||||
return false;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
Reference in New Issue
Block a user