一个用户执行很快,可几百个用户就非常的慢,要花十几分钟的时间。高手们帮偶看看下面为计算代码
代码中如:strGSXM ={[GWSJ]岗位薪金}
strGSNL ={[GWSJ]岗位薪金}+{[TSJT]特殊津贴}+{[ZCSBT]注册师补贴}+{[TZBT]提租补贴}+{[RSQT]人事其他}+{[JCSJ]基础薪金}
即{[GWSJ]岗位薪金}={[GWSJ]岗位薪金}+{[TSJT]特殊津贴}+{[ZCSBT]注册师补贴}+{[TZBT]提租补贴}+{[RSQT]人事其他}+{[JCSJ]基础薪金},公式样式。
public bool calc(string pStr_PU_ID, string pStr_Date)
{
GZXT.BusinessLogic.GS objGS = new GZXT.BusinessLogic.GS(this.DBProcess);
GZXT.BusinessLogic.XMGL objXMGL = new GZXT.BusinessLogic.XMGL(this.DBProcess);
Regex Obj_Regex                      = new Regex("{(?<1>[^}]*)}", RegexOptions.Multiline | RegexOptions.IgnoreCase|RegexOptions.Compiled);
Match Obj_Match                      = null;
string Str_XMName                    = "";
string Str_XMID                      = "";
string Str_XMValue                   = "";
string Str_PrevDate                  = WSL2Function.FormatDate(System.DateTime.Parse(pStr_Date).AddMonths(-1), "yyyy-MM-dd");
WSL2DBOptions objXMList              = new WSL2DBOptions();//读取所有项目
DataTable DT_XM                      = objXMGL.SearchData();
objXMList.Clear();
foreach(DataRow Row_Data in DT_XM.Rows)
{
string strXID = Row_Data["XID"].ToString().Trim();
string strCNMC = Row_Data["XM_ALLNAME"].ToString().Trim();objXMList.Add(strCNMC, strXID);
}
DT_XM.Clear();//读取类别
string strKX = this.GetKX(pStr_PU_ID);//读取公式
DataTable DT_Data = objGS.SearchData(
new WSL2DBParameter[]{
 new WSL2DBParameter(objGS.TableStructure_Self.Column_GSSTATUS, "1")
 ,new WSL2DBParameter(objGS.TableStructure_Self.Column_GSKX, strKX)
 });
foreach(DataRow Row_Data in DT_Data.Rows)
{
string strGSXM = Row_Data["GSXM"].ToString();
string strGSNL = Row_Data["GSNL"].ToString().Replace("\n", "");for (Obj_Match = Obj_Regex.Match(strGSNL); Obj_Match.Success; Obj_Match = Obj_Match.NextMatch()) 
{
Str_XMName = Obj_Match.Groups[1].Value;
Str_XMID = "";
Str_XMValue = "0";
//公式分解
if (Str_XMName.IndexOf("上月") == 0)
{
string Str_Temp = Str_XMName.Substring(2);
try
{
Str_XMID = objXMList[Str_Temp].Text;
}
catch{}
if (!WSL2Function.IsEmpty(Str_XMID))
{
Str_XMValue = this.getMoney(pStr_PU_ID, Str_PrevDate, Str_XMID).ToString();
}
}
else
{
try
{
Str_XMID = objXMList[Str_XMName].Text;
}
catch{}
if (!WSL2Function.IsEmpty(Str_XMID))
{
Str_XMValue = this.getMoney(pStr_PU_ID, pStr_Date, Str_XMID).ToString();
}
}
strGSNL = strGSNL.Replace("{" + Str_XMName + "}", Str_XMValue);
}
this.updateMoney(pStr_PU_ID, pStr_Date, strGSXM, strGSNL);
}return true;}写成存储过程试也超慢,怎么解决啊,帮帮忙