|
@@ -1009,7 +1009,7 @@ namespace JLHHJSvr.Helper
|
|
AddKeyValue("折扣率", mattress.discount);
|
|
AddKeyValue("折扣率", mattress.discount);
|
|
}
|
|
}
|
|
|
|
|
|
- mattress.taxes = CalculateVarFormula("部门含税价").DecimalValue;
|
|
|
|
|
|
+ mattress.dept_cost = CalculateVarFormula("部门含税价").DecimalValue;
|
|
AddKeyValue("部门含税价", mattress.dept_cost);
|
|
AddKeyValue("部门含税价", mattress.dept_cost);
|
|
#endregion
|
|
#endregion
|
|
|
|
|
|
@@ -1397,8 +1397,28 @@ namespace JLHHJSvr.Helper
|
|
if (!formula_replacements.ContainsKey(varname)) return null;
|
|
if (!formula_replacements.ContainsKey(varname)) return null;
|
|
return Calculate(formula_replacements[varname], varname);
|
|
return Calculate(formula_replacements[varname], varname);
|
|
}
|
|
}
|
|
|
|
+ private void replaceFormulas(ref string expression)
|
|
|
|
+ {
|
|
|
|
+ bool hasReplace = false;
|
|
|
|
+
|
|
|
|
+ foreach (var replacement in formula_replacements)
|
|
|
|
+ {
|
|
|
|
+ if (expression.IndexOf(replacement.Key) > -1)
|
|
|
|
+ {
|
|
|
|
+ expression = expression.Replace(replacement.Key, "(" + replacement.Value + ")");
|
|
|
|
+ hasReplace = true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (hasReplace)
|
|
|
|
+ {
|
|
|
|
+ replaceFormulas(ref expression);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
private void FormatExpression(ref string expression)
|
|
private void FormatExpression(ref string expression)
|
|
{
|
|
{
|
|
|
|
+ // 替换相互嵌套的公式
|
|
|
|
+ replaceFormulas(ref expression);
|
|
|
|
+
|
|
expression = ConvertToEnglishSymbols(expression);
|
|
expression = ConvertToEnglishSymbols(expression);
|
|
|
|
|
|
// 定义正则表达式模式,匹配包含【】的内容
|
|
// 定义正则表达式模式,匹配包含【】的内容
|
|
@@ -1407,11 +1427,6 @@ namespace JLHHJSvr.Helper
|
|
// 创建正则表达式对象
|
|
// 创建正则表达式对象
|
|
Regex regex = new Regex(pattern);
|
|
Regex regex = new Regex(pattern);
|
|
|
|
|
|
- foreach (var replacement in formula_replacements)
|
|
|
|
- {
|
|
|
|
- expression = expression.Replace(replacement.Key, "(" + replacement.Value +")");
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
// 使用正则表达式匹配输入字符串
|
|
// 使用正则表达式匹配输入字符串
|
|
MatchCollection matches = regex.Matches(expression);
|
|
MatchCollection matches = regex.Matches(expression);
|
|
|
|
|