bool CX8DbOperate::UpdateResultTime(TagExpAction & tagExpAction, CString & strRsTime)
{
CString strSql = _T("update %s set ResultTime = \'%s\' where id = %d");
CString strDetailSql = _T("update %s set Cycle=%d, ResultTime = \'%s\' where id = %d");
CString strTmp;
if (tagExpAction.tagExpInfo.iCupType == CUPSTA_CALI)
{
strDetailSql = _T("update %s set Cycle=%d, ResultTime = \'%s\' where id = %d");
//定标
strTmp.Format(strDetailSql, _T("mgl_calirsdetail"), tagExpAction.tagExpInfo.iResultCycle, strRsTime, tagExpAction.tagExpInfo.iDetailRsDbid);
m_pDb->Query(strTmp);
strTmp.Format(strSql, _T("mgl_calirs"), strRsTime, tagExpAction.tagExpInfo.iNorRsDbid);
m_pDb->Query(strTmp);
}
else if (tagExpAction.tagExpInfo.iCupType == CUPSTA_SMP )
{
//样本
strTmp.Format(strDetailSql, _T("nor_smprsdetail"), tagExpAction.tagExpInfo.iResultCycle, strRsTime, tagExpAction.tagExpInfo.iDetailRsDbid);
m_pDb->Query(strTmp);
strTmp.Format(strSql, _T("nor_smprs"), strRsTime, tagExpAction.tagExpInfo.iNorRsDbid);
m_pDb->Query(strTmp);
}
else if (tagExpAction.tagExpInfo.iCupType == CUPSTA_QC)
{
CString strDetailSql = _T("update %s set MglCycle=%d, ResultTime = \'%s\' where id = %d");
//质控
strTmp.Format(strDetailSql, _T("nor_qcrsdetail"), tagExpAction.tagExpInfo.iResultCycle, strRsTime, tagExpAction.tagExpInfo.iDetailRsDbid);
m_pDb->Query(strTmp);
strTmp.Format(strSql, _T("nor_qcrs"), strRsTime, tagExpAction.tagExpInfo.iNorRsDbid);
m_pDb->Query(strTmp);
}
else if (tagExpAction.tagExpInfo.iCupType == CUPSTA_BGW
|| tagExpAction.tagExpInfo.iCupType == CUPSTA_LC_LE
|| tagExpAction.tagExpInfo.iCupType == CUPSTA_LC_LE2
|| tagExpAction.tagExpInfo.iCupType == CUPSTA_LC_RI
|| tagExpAction.tagExpInfo.iCupType == CUPSTA_LC_RI2
|| tagExpAction.tagExpInfo.iCupType == CUPSTA_LC_SMPARM)
{
//背景、左试剂针光检、右试剂针光检、样本针光检
strDetailSql = _T("update %s set Cycle=%d, ResultTime = \'%s\' where id = %d");
strTmp.Format(strDetailSql, _T("mgl_systestdetail"), tagExpAction.tagExpInfo.iResultCycle, strRsTime, tagExpAction.tagExpInfo.iDetailRsDbid);
m_pDb->Query(strTmp);
strTmp.Format(strSql, _T("mgl_systestinfo"), strRsTime, tagExpAction.tagExpInfo.iNorRsDbid);
m_pDb->Query(strTmp);
}
return true;
}
bool CX8DbOperate::SetDetailRsStatus(set<int> setDetailRsDbid, int iStatus, int iType)
{
if (setDetailRsDbid.size() <= 0)
return true;
CString strSql;
CString strDbid = CompactStr(setDetailRsDbid, _T(","));
if (iType == SMPTYPE_SMP)
{
strSql.Format(_T("update nor_smprsdetail set status = %d where id IN(%s)"),
iStatus, strDbid);
}
if (iType == SMPTYPE_QC)
{
strSql.Format(_T("update nor_qcrsdetail set status = %d where id IN(%s)"),
iStatus, strDbid);
}
else if (iType == SMPTYPE_CALI)
{
strSql.Format(_T("update mgl_calirsdetail set status = %d where id IN(%s)"),
iStatus, strDbid);
}
else if (iType == SMPTYPE_LC)
{
strSql.Format(_T("update mgl_systestdetail set status = %d where id IN(%s)"),
iStatus, strDbid);
}
return m_pDb->Query(strSql);
}
这两段怎么合并成一次执行 减少花费的时间