4814 lines
144 KiB
C++
4814 lines
144 KiB
C++
// DataOperator.cpp: implementation of the CDataOperator class.
|
||
//
|
||
//////////////////////////////////////////////////////////////////////
|
||
#include <stdafx.h>
|
||
#include "geomative.h"
|
||
#include "DataOperator.h"
|
||
#include "navdataview.h"
|
||
#include "Constant.h"
|
||
#include "SaveInRes.h"
|
||
|
||
#include "appdataproview.h"
|
||
#include "appdatatzview.h"
|
||
#include "appdatadevview.h"
|
||
#include "appdatarsp2dtdview.h"
|
||
#include "appdataipsp2dtdview.h"
|
||
|
||
#include "appdatatdlistview.h"
|
||
#include "appdatatzlistview.h"
|
||
#include "appdataprolistview.h"
|
||
#include "appdataprodetaillistview.h"
|
||
#include "appdatatzdetaillistview.h"
|
||
#include "appdatadevdetaillistview.h"
|
||
#include "appdatatddetaillistview.h"
|
||
|
||
#include "appdatarsp2dtdconlistview.h"
|
||
#include "appdataipsp2dtdconlistview.h"
|
||
|
||
#include "appdatatdgrlistview.h"
|
||
|
||
#include "appdatarspcetdview.h"
|
||
#include "appdatarspcetdconlistview.h"
|
||
|
||
#include "AppDataIpsp3DTdConListView.h"
|
||
#include "AppDataIpsp3DTdView.h"
|
||
|
||
#include "AppDataRsp3DTdConListView.h"
|
||
#include "AppDataRsp3DTdView.h"
|
||
|
||
#include "AppDataIpspCETdConListView.h"
|
||
#include "AppDataIpspCETdView.h"
|
||
|
||
#include "AppDataSP2DTdConListView.h"
|
||
#include "AppDataSP2DTdView.h"
|
||
|
||
#include "AppDataSPCETdConListView_.h"
|
||
#include "AppDataSPCETdView.h"
|
||
|
||
#include "AppDataSP3DTdConListView.h"
|
||
#include "AppDataSP3DTdView.h"
|
||
#include "AppDataCESTdGrListView.h"
|
||
#include "TdChannel.h"
|
||
#include "DialCombine3DTask.h"
|
||
#include "DetcGD10Dev.h"
|
||
#include "FileOperTools.h"
|
||
|
||
#ifdef _DEBUG
|
||
#undef THIS_FILE
|
||
static char THIS_FILE[]=__FILE__;
|
||
#define new DEBUG_NEW
|
||
#endif
|
||
|
||
extern CGeoMativeApp theApp;
|
||
//////////////////////////////////////////////////////////////////////
|
||
// Construction/Destruction
|
||
//////////////////////////////////////////////////////////////////////
|
||
extern HHOOK hHook;
|
||
extern LRESULT __stdcall CBTHookProc(long nCode, WPARAM wParam, LPARAM lParam);
|
||
extern int g_iUILanguage;
|
||
CDataOperator::CDataOperator(_ConnectionPtr& pConnection)
|
||
{
|
||
ASSERT(NULL != pConnection);
|
||
m_pConnection = pConnection;
|
||
}
|
||
|
||
CDataOperator::~CDataOperator()
|
||
{
|
||
|
||
}
|
||
|
||
//DEL bool CDataOperator::InitialNavDataProDlg(CNavDataProDlg& navDataProDlg)
|
||
//DEL {
|
||
//DEL _RecordsetPtr pRecPro = NULL;
|
||
//DEL _RecordsetPtr pRecTz = NULL;
|
||
//DEL _RecordsetPtr pRecTd = NULL;
|
||
//DEL
|
||
//DEL HTREEITEM hProItem = NULL;
|
||
//DEL HTREEITEM hTzItem = NULL;
|
||
//DEL HTREEITEM hTdItem = NULL;
|
||
//DEL HTREEITEM hParentItem = NULL;
|
||
//DEL
|
||
//DEL DWORD dwHandle = (DWORD)VAL_ZERO;
|
||
//DEL UINT uImageState = (UINT)VAL_ZERO;
|
||
//DEL UINT uTdImageState = (UINT)VAL_ZERO;
|
||
//DEL CString szSql = _T("");
|
||
//DEL
|
||
//DEL CTreeCtrl& proTree = navDataProDlg.m_proTree;
|
||
//DEL
|
||
//DEL proTree.DeleteAllItems();
|
||
//DEL
|
||
//DEL uImageState = m_stateProcessor.ChangeToImageState(PZ_STATE_DB);
|
||
//DEL uTdImageState = m_stateProcessor.ChangeToImageState(PZ_STATE_LOC);
|
||
//DEL
|
||
//DEL pRecPro.CreateInstance(_uuidof(Recordset));
|
||
//DEL pRecTz.CreateInstance(_uuidof(Recordset));
|
||
//DEL pRecTd.CreateInstance(_uuidof(Recordset));
|
||
//DEL
|
||
//DEL
|
||
//DEL pRecPro->Open(_T("select ID,PRname,CN from project order by ID"), _variant_t((IDispatch*)m_pConnection, true),
|
||
//DEL adOpenStatic, adLockOptimistic, adCmdText);
|
||
//DEL
|
||
//DEL while ((short)VAL_ZERO == pRecPro->adoEOF)
|
||
//DEL {
|
||
//DEL
|
||
//DEL hProItem = proTree.InsertItem((LPCTSTR)(_bstr_t)pRecPro->GetCollect(_T("PRname")));
|
||
//DEL
|
||
//DEL dwHandle = m_handleProcessor.GenerateHandle((DWORD)pRecPro->GetCollect(_T("ID")).ulVal, PZ_STYLE_PRO);
|
||
//DEL proTree.SetItemData(hProItem, dwHandle);
|
||
//DEL proTree.SetItemState(hProItem, uImageState, TVIS_STATEIMAGEMASK);
|
||
//DEL
|
||
//DEL szSql.Empty();
|
||
//DEL szSql.Format(_T("select ID,TZname from tz where PRID = %s order by ID" ),
|
||
//DEL pRecPro->GetCollect(_T("ID")).vt == VT_NULL ? _T("-1") : (LPCTSTR)(_bstr_t)pRecPro->GetCollect(_T("ID")));
|
||
//DEL pRecTz->Open(szSql.AllocSysString(), _variant_t((IDispatch*)m_pConnection, true),
|
||
//DEL adOpenStatic, adLockOptimistic, adCmdText);
|
||
//DEL
|
||
//DEL while ((short)VAL_ZERO == pRecTz->adoEOF)
|
||
//DEL {
|
||
//DEL hTzItem = proTree.InsertItem((pRecTz->GetCollect(_T("TZname")).vt == VT_NULL) ? _T("") : (LPCTSTR)(_bstr_t)pRecTz->GetCollect(_T("TZname")), hProItem);
|
||
//DEL dwHandle = m_handleProcessor.GenerateHandle((DWORD)pRecTz->GetCollect(_T("ID")).ulVal, PZ_STYLE_TZ);
|
||
//DEL proTree.SetItemData(hTzItem, dwHandle);
|
||
//DEL proTree.SetItemState(hTzItem, uImageState, TVIS_STATEIMAGEMASK);
|
||
//DEL
|
||
//DEL szSql.Empty();
|
||
//DEL szSql.Format(_T("select ID,TDname,Ttype from td where TZID = %s order by ID"),
|
||
//DEL pRecTz->GetCollect(_T("ID")).vt == VT_NULL ? _T("-1") : (LPCTSTR)(_bstr_t)pRecTz->GetCollect(_T("ID")));
|
||
//DEL pRecTd->Open(szSql.AllocSysString(), _variant_t((IDispatch*)m_pConnection, true),
|
||
//DEL adOpenStatic, adLockOptimistic, adCmdText);
|
||
//DEL
|
||
//DEL while ((short)VAL_ZERO == pRecTd->adoEOF)
|
||
//DEL {
|
||
//DEL hTdItem = proTree.InsertItem(pRecTd->GetCollect(_T("TDname")).vt == VT_NULL ? _T("") : (LPCTSTR)(_bstr_t)pRecTd->GetCollect(_T("TDname")), hTzItem);
|
||
//DEL
|
||
//DEL switch (pRecTd->GetCollect(_T("Ttype")).iVal)
|
||
//DEL {
|
||
//DEL case 0:
|
||
//DEL switch (pRecTd->GetCollect(_T("Stype")).iVal)
|
||
//DEL {
|
||
//DEL case 0:
|
||
//DEL dwHandle = m_handleProcessor.GenerateHandle((DWORD)pRecTd->GetCollect(_T("ID")).ulVal, PZ_STYLE_TD_CERSP);
|
||
//DEL break;
|
||
//DEL case 1:
|
||
//DEL dwHandle = m_handleProcessor.GenerateHandle((DWORD)pRecTd->GetCollect(_T("ID")).ulVal, PZ_STYLE_TD_2DRSP);
|
||
//DEL break;
|
||
//DEL case 2:
|
||
//DEL dwHandle = m_handleProcessor.GenerateHandle((DWORD)pRecTd->GetCollect(_T("ID")).ulVal, PZ_STYLE_TD_3DRSP);
|
||
//DEL break;
|
||
//DEL default:
|
||
//DEL break;
|
||
//DEL
|
||
//DEL }
|
||
//DEL break;
|
||
//DEL case 1:
|
||
//DEL switch (pRecTd->GetCollect(_T("Stype")).iVal)
|
||
//DEL {
|
||
//DEL case 0:
|
||
//DEL dwHandle = m_handleProcessor.GenerateHandle((DWORD)pRecTd->GetCollect(_T("ID")).ulVal, PZ_STYLE_TD_CEIPSP);
|
||
//DEL break;
|
||
//DEL case 1:
|
||
//DEL dwHandle = m_handleProcessor.GenerateHandle((DWORD)pRecTd->GetCollect(_T("ID")).ulVal, PZ_STYLE_TD_2DIPSP);
|
||
//DEL break;
|
||
//DEL case 2:
|
||
//DEL dwHandle = m_handleProcessor.GenerateHandle((DWORD)pRecTd->GetCollect(_T("ID")).ulVal, PZ_STYLE_TD_3DIPSP);
|
||
//DEL break;
|
||
//DEL default:
|
||
//DEL break;
|
||
//DEL }
|
||
//DEL break;
|
||
//DEL default:
|
||
//DEL break;
|
||
//DEL }
|
||
//DEL proTree.SetItemData(hTdItem, dwHandle);
|
||
//DEL proTree.SetItemState(hTdItem, uTdImageState, TVIS_STATEIMAGEMASK);
|
||
//DEL
|
||
//DEL pRecTd->MoveNext();
|
||
//DEL } //while (VAL_ZERO == pRecTd->adoEOF)
|
||
//DEL pRecTd->Close();
|
||
//DEL hParentItem = proTree.GetParentItem(hTdItem);
|
||
//DEL if (hParentItem != NULL)
|
||
//DEL {
|
||
//DEL proTree.Expand(hParentItem, TVE_EXPAND);
|
||
//DEL hParentItem = NULL;
|
||
//DEL } //if (hParentItem != NULL)
|
||
//DEL
|
||
//DEL pRecTz->MoveNext();
|
||
//DEL } //while (VAL_ZERO == pRecTz->adoEOF)
|
||
//DEL pRecTz->Close();
|
||
//DEL
|
||
//DEL hParentItem = proTree.GetParentItem(hTzItem);
|
||
//DEL // ASSERT(hParentItem != NULL);
|
||
//DEL if (hParentItem != NULL)
|
||
//DEL {
|
||
//DEL proTree.Expand(hParentItem, TVE_EXPAND);
|
||
//DEL hParentItem = NULL;
|
||
//DEL } //if (hParentItem != NULL)
|
||
//DEL
|
||
//DEL pRecPro->MoveNext();
|
||
//DEL } //while (VAL_ZERO == pRecPro->adoEOF)
|
||
//DEL pRecPro->Close();
|
||
//DEL
|
||
//DEL proTree.SelectSetFirstVisible(proTree.GetRootItem());
|
||
//DEL
|
||
//DEL return true;
|
||
//DEL }
|
||
|
||
//DEL bool CDataOperator::InitialNavDataDevDlg(CNavDataDevDlg& navDataDevDlg)
|
||
//DEL {
|
||
//DEL _RecordsetPtr pRecDev = NULL;
|
||
//DEL
|
||
//DEL CString szSql;
|
||
//DEL
|
||
//DEL CTreeCtrl& devTree = navDataDevDlg.m_devTree;
|
||
//DEL
|
||
//DEL devTree.DeleteAllItems();
|
||
//DEL
|
||
//DEL pRecDev.CreateInstance(_uuidof(Recordset));
|
||
//DEL
|
||
//DEL pRecDev->Open(_T("select ID,DEname,SN from device order by ID"), _variant_t((IDispatch*)m_pConnection, true),
|
||
//DEL adOpenStatic, adLockOptimistic, adCmdText);
|
||
//DEL
|
||
//DEL while ((short)VAL_ZERO == pRecDev->adoEOF)
|
||
//DEL {
|
||
//DEL InitialNavDataDevTree((DWORD)pRecDev->GetCollect(_T("ID")).ulVal, (LPCTSTR)(_bstr_t)pRecDev->GetCollect(_T("SN")), devTree);
|
||
//DEL
|
||
//DEL pRecDev->MoveNext();
|
||
//DEL } //while (VAL_ZERO == pRecDev->adoEOF)
|
||
//DEL pRecDev->Close();
|
||
//DEL
|
||
//DEL return true;
|
||
//DEL }
|
||
|
||
bool CDataOperator::InitialNavDataView(CNavDataView* pNavDataView)
|
||
{
|
||
_RecordsetPtr pRecPro = NULL;
|
||
_RecordsetPtr pRecTz = NULL;
|
||
_RecordsetPtr pRecTd = NULL;
|
||
|
||
HTREEITEM hProItem = NULL;
|
||
HTREEITEM hTzItem = NULL;
|
||
HTREEITEM hTdItem = NULL;
|
||
HTREEITEM hParentItem = NULL;
|
||
|
||
DWORD dwHandle = (DWORD)VAL_ZERO;
|
||
UINT uImageState = (UINT)VAL_ZERO;
|
||
|
||
// UINT uTdImageState = (UINT)VAL_ZERO;
|
||
|
||
CString szSql = _T("");
|
||
|
||
CTreeCtrl& dataTree = pNavDataView->m_dataTree;
|
||
|
||
if (NULL != pNavDataView)
|
||
{
|
||
dataTree.DeleteAllItems();
|
||
|
||
uImageState = m_stateProcessor.ChangeToImageState(PZ_STATE_DB);
|
||
// uTdImageState = m_stateProcessor.ChangeToImageState(PZ_STATE_DB);
|
||
|
||
pRecPro.CreateInstance(_uuidof(Recordset));
|
||
pRecTz.CreateInstance(_uuidof(Recordset));
|
||
pRecTd.CreateInstance(_uuidof(Recordset));
|
||
|
||
pRecPro->Open(_T("select ID,PRname,CN from project order by ID"), _variant_t((IDispatch*)m_pConnection, true),
|
||
adOpenStatic, adLockOptimistic, adCmdText);
|
||
|
||
while ((short)VAL_ZERO == pRecPro->adoEOF)
|
||
{
|
||
hProItem = dataTree.InsertItem((LPCTSTR)(_bstr_t)pRecPro->GetCollect(_T("PRname")));
|
||
|
||
dwHandle = m_handleProcessor.GenerateHandle((DWORD)pRecPro->GetCollect(_T("ID")).ulVal, PZ_STYLE_PRO);
|
||
dataTree.SetItemData(hProItem, dwHandle);
|
||
dataTree.SetItemState(hProItem, uImageState, TVIS_STATEIMAGEMASK);
|
||
|
||
szSql.Empty();
|
||
szSql.Format(_T("select ID,TZname from tz where PRID = %s order by ID" ),
|
||
pRecPro->GetCollect(_T("ID")).vt == VT_NULL ? _T("-1") : (LPCTSTR)(_bstr_t)pRecPro->GetCollect(_T("ID")));
|
||
pRecTz->Open(szSql.AllocSysString(), _variant_t((IDispatch*)m_pConnection, true),
|
||
adOpenStatic, adLockOptimistic, adCmdText);
|
||
//如果查询不到默认测区,则报错,并进行下一个工程的显示
|
||
if ((long)VAL_ZERO == pRecTz->GetRecordCount())
|
||
{
|
||
CString strPrName = (LPCTSTR)(_bstr_t)pRecPro->GetCollect(_T("PRname"));
|
||
AfxMessageBox(_T("data missing in") + strPrName);
|
||
pRecTz->Close();
|
||
pRecPro->MoveNext();
|
||
continue;
|
||
}
|
||
//默认取第一个测区的ID
|
||
int iTzID = (VT_NULL == pRecTz->GetCollect(_T("ID")).vt) ? -1 : pRecTz->GetCollect(_T("ID")).lVal;
|
||
pRecTz->Close();
|
||
|
||
szSql.Empty();
|
||
szSql.Format(_T("select ID,TDname,Ttype,Stype from td where TZID = %d order by ID"), iTzID);
|
||
pRecTd->Open(szSql.AllocSysString(), _variant_t((IDispatch*)m_pConnection, true),
|
||
adOpenStatic, adLockOptimistic, adCmdText);
|
||
while ((short)VAL_ZERO == pRecTd->adoEOF)
|
||
{
|
||
hTdItem = dataTree.InsertItem(pRecTd->GetCollect(_T("TDname")).vt == VT_NULL ? _T("") : (LPCTSTR)(_bstr_t)pRecTd->GetCollect(_T("TDname")), hProItem);
|
||
switch (pRecTd->GetCollect(_T("Ttype")).iVal)
|
||
{
|
||
case 0:
|
||
switch (pRecTd->GetCollect(_T("Stype")).iVal)
|
||
{
|
||
case 0:
|
||
dwHandle = m_handleProcessor.GenerateHandle((DWORD)pRecTd->GetCollect(_T("ID")).ulVal, PZ_STYLE_TD_CERSP);
|
||
break;
|
||
case 1:
|
||
dwHandle = m_handleProcessor.GenerateHandle((DWORD)pRecTd->GetCollect(_T("ID")).ulVal, PZ_STYLE_TD_2DRSP);
|
||
break;
|
||
case 2:
|
||
dwHandle = m_handleProcessor.GenerateHandle((DWORD)pRecTd->GetCollect(_T("ID")).ulVal, PZ_STYLE_TD_3DRSP);
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
break;
|
||
case 1:
|
||
switch (pRecTd->GetCollect(_T("Stype")).iVal)
|
||
{
|
||
case 0:
|
||
dwHandle = m_handleProcessor.GenerateHandle((DWORD)pRecTd->GetCollect(_T("ID")).ulVal, PZ_STYLE_TD_CEIPSP);
|
||
break;
|
||
case 1:
|
||
dwHandle = m_handleProcessor.GenerateHandle((DWORD)pRecTd->GetCollect(_T("ID")).ulVal, PZ_STYLE_TD_2DIPSP);
|
||
break;
|
||
case 2:
|
||
dwHandle = m_handleProcessor.GenerateHandle((DWORD)pRecTd->GetCollect(_T("ID")).ulVal, PZ_STYLE_TD_3DIPSP);
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
break;
|
||
case 2://自电
|
||
switch (pRecTd->GetCollect(_T("Stype")).iVal)
|
||
{
|
||
case 0:
|
||
dwHandle = m_handleProcessor.GenerateHandle((DWORD)pRecTd->GetCollect(_T("ID")).ulVal, PZ_STYLE_TD_CESP);
|
||
break;
|
||
case 1:
|
||
dwHandle = m_handleProcessor.GenerateHandle((DWORD)pRecTd->GetCollect(_T("ID")).ulVal, PZ_STYLE_TD_2DSP);
|
||
break;
|
||
case 2:
|
||
dwHandle = m_handleProcessor.GenerateHandle((DWORD)pRecTd->GetCollect(_T("ID")).ulVal, PZ_STYLE_TD_3DSP);
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
dataTree.SetItemData(hTdItem, dwHandle);
|
||
dataTree.SetItemState(hTdItem, uImageState, TVIS_STATEIMAGEMASK);
|
||
pRecTd->MoveNext();
|
||
|
||
}
|
||
pRecTd->Close();
|
||
hParentItem = dataTree.GetParentItem(hTdItem);
|
||
if (hParentItem != NULL)
|
||
{
|
||
dataTree.Expand(hParentItem, TVE_EXPAND);
|
||
hParentItem = NULL;
|
||
}
|
||
|
||
|
||
|
||
//////////////////////////////////////////////////////////////////////////
|
||
/*删除中间的测区这一层
|
||
while ((short)VAL_ZERO == pRecTz->adoEOF)
|
||
{
|
||
hTzItem = dataTree.InsertItem((pRecTz->GetCollect(_T("TZname")).vt == VT_NULL) ? _T("") : (LPCTSTR)(_bstr_t)pRecTz->GetCollect(_T("TZname")), hProItem);
|
||
dwHandle = m_handleProcessor.GenerateHandle((DWORD)pRecTz->GetCollect(_T("ID")).ulVal, PZ_STYLE_TZ);
|
||
dataTree.SetItemData(hTzItem, dwHandle);
|
||
dataTree.SetItemState(hTzItem, uImageState, TVIS_STATEIMAGEMASK);
|
||
|
||
szSql.Empty();
|
||
szSql.Format(_T("select ID,TDname,Ttype,Stype from td where TZID = %s order by ID"),
|
||
pRecTz->GetCollect(_T("ID")).vt == VT_NULL ? _T("-1") : (LPCTSTR)(_bstr_t)pRecTz->GetCollect(_T("ID")));
|
||
pRecTd->Open(szSql.AllocSysString(), _variant_t((IDispatch*)m_pConnection, true),
|
||
adOpenStatic, adLockOptimistic, adCmdText);
|
||
|
||
while ((short)VAL_ZERO == pRecTd->adoEOF)
|
||
{
|
||
hTdItem = dataTree.InsertItem(pRecTd->GetCollect(_T("TDname")).vt == VT_NULL ? _T("") : (LPCTSTR)(_bstr_t)pRecTd->GetCollect(_T("TDname")), hTzItem);
|
||
switch (pRecTd->GetCollect(_T("Ttype")).iVal)
|
||
{
|
||
case 0:
|
||
switch (pRecTd->GetCollect(_T("Stype")).iVal)
|
||
{
|
||
case 0:
|
||
dwHandle = m_handleProcessor.GenerateHandle((DWORD)pRecTd->GetCollect(_T("ID")).ulVal, PZ_STYLE_TD_CERSP);
|
||
break;
|
||
case 1:
|
||
dwHandle = m_handleProcessor.GenerateHandle((DWORD)pRecTd->GetCollect(_T("ID")).ulVal, PZ_STYLE_TD_2DRSP);
|
||
break;
|
||
case 2:
|
||
dwHandle = m_handleProcessor.GenerateHandle((DWORD)pRecTd->GetCollect(_T("ID")).ulVal, PZ_STYLE_TD_3DRSP);
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
break;
|
||
case 1:
|
||
switch (pRecTd->GetCollect(_T("Stype")).iVal)
|
||
{
|
||
case 0:
|
||
dwHandle = m_handleProcessor.GenerateHandle((DWORD)pRecTd->GetCollect(_T("ID")).ulVal, PZ_STYLE_TD_CEIPSP);
|
||
break;
|
||
case 1:
|
||
dwHandle = m_handleProcessor.GenerateHandle((DWORD)pRecTd->GetCollect(_T("ID")).ulVal, PZ_STYLE_TD_2DIPSP);
|
||
break;
|
||
case 2:
|
||
dwHandle = m_handleProcessor.GenerateHandle((DWORD)pRecTd->GetCollect(_T("ID")).ulVal, PZ_STYLE_TD_3DIPSP);
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
break;
|
||
case 2://自电
|
||
switch (pRecTd->GetCollect(_T("Stype")).iVal)
|
||
{
|
||
case 0:
|
||
dwHandle = m_handleProcessor.GenerateHandle((DWORD)pRecTd->GetCollect(_T("ID")).ulVal, PZ_STYLE_TD_CESP);
|
||
break;
|
||
case 1:
|
||
dwHandle = m_handleProcessor.GenerateHandle((DWORD)pRecTd->GetCollect(_T("ID")).ulVal, PZ_STYLE_TD_2DSP);
|
||
break;
|
||
case 2:
|
||
dwHandle = m_handleProcessor.GenerateHandle((DWORD)pRecTd->GetCollect(_T("ID")).ulVal, PZ_STYLE_TD_3DSP);
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
break;
|
||
|
||
default:
|
||
break;
|
||
}
|
||
|
||
dataTree.SetItemData(hTdItem, dwHandle);
|
||
dataTree.SetItemState(hTdItem, uImageState, TVIS_STATEIMAGEMASK);
|
||
|
||
pRecTd->MoveNext();
|
||
}
|
||
pRecTd->Close();
|
||
hParentItem = dataTree.GetParentItem(hTdItem);
|
||
if (hParentItem != NULL)
|
||
{
|
||
dataTree.Expand(hParentItem, TVE_EXPAND);
|
||
hParentItem = NULL;
|
||
}
|
||
|
||
pRecTz->MoveNext();
|
||
}
|
||
pRecTz->Close();
|
||
|
||
hParentItem = dataTree.GetParentItem(hTzItem);
|
||
|
||
if (hParentItem != NULL)
|
||
{
|
||
dataTree.Expand(hParentItem, TVE_EXPAND);
|
||
hParentItem = NULL;
|
||
}
|
||
*/
|
||
|
||
pRecPro->MoveNext();
|
||
}
|
||
pRecPro->Close();
|
||
|
||
dataTree.SelectSetFirstVisible(dataTree.GetRootItem());
|
||
}
|
||
else
|
||
{
|
||
return false;
|
||
}
|
||
return true;
|
||
}
|
||
|
||
void CDataOperator::ShowProjectInfo(DWORD dwProHandle, CView *pAppDataView)
|
||
{
|
||
theApp.m_pProManager->GetDMS(dwProHandle)->ShowDetailInfo(((CAppDataProDetailListView*)(((CAppDataProView*)pAppDataView)->m_pDetailListView))->GetListCtrl());
|
||
theApp.m_pTdManager->ShowTdListByProject(dwProHandle, ((CAppDataTdListView*)(((CAppDataProView*)pAppDataView)->m_pContentListView))->GetListCtrl());
|
||
// theApp.m_pProManager->ShowTzList(dwProHandle, ((CAppDataTzListView*)(((CAppDataProView*)pAppDataView)->m_pContentListView))->GetListCtrl());
|
||
}
|
||
|
||
void CDataOperator::ShowTzInfo(DWORD dwTzHandle, CView *pAppDataView)
|
||
{
|
||
theApp.m_pProManager->GetDMS(dwTzHandle)->ShowDetailInfo(((CAppDataTzDetailListView*)(((CAppDataTzView*)pAppDataView)->m_pDetailListView))->GetListCtrl());
|
||
theApp.m_pTdManager->ShowTdListByTz(dwTzHandle, ((CAppDataTdListView*)(((CAppDataTzView*)pAppDataView)->m_pContentListView))->GetListCtrl());
|
||
}
|
||
|
||
//DEL void CDataOperator::ShowProjectInfoByDevTab(DWORD dwProHandle, DWORD dwDevHandle, CView *pAppDataView)
|
||
//DEL {
|
||
//DEL theApp.m_pProManager->GetDMS(dwProHandle)->ShowDetailInfo(((CAppDataProDetailListView*)(((CAppDataProView*)pAppDataView)->m_pDetailListView))->GetListCtrl());
|
||
//DEL theApp.m_pProManager->ShowTzList(dwProHandle, ((CAppDataTzListView*)(((CAppDataProView*)pAppDataView)->m_pContentListView))->GetListCtrl());
|
||
//DEL }
|
||
|
||
void CDataOperator::ShowRsp3DTdInfo(DWORD dwTdHandle, CView *pAppDataView)
|
||
{
|
||
theApp.m_pTdManager->GetTestingData(dwTdHandle)->ShowDetailInfo(((CAppDataTdDetailListView*)(((CAppDataRsp3DTdView*)pAppDataView)->m_pDetailListView))->GetListCtrl());
|
||
theApp.m_pTdManager->GetTestingData(dwTdHandle)->ShowConList(((CAppDataRsp3DTdConListView*)(((CAppDataRsp3DTdView*)pAppDataView)->m_pContentListView))->GetListCtrl());
|
||
theApp.m_pTdManager->GetTestingData(dwTdHandle)->ShowGrList(((CAppDataTdGrListView*)(((CAppDataRsp3DTdView*)pAppDataView)->m_pGrListView))->GetListCtrl());
|
||
}
|
||
|
||
void CDataOperator::ShowRsp2DTdInfo(DWORD dwTdHandle, CView *pAppDataView)
|
||
{
|
||
theApp.m_pTdManager->GetTestingData(dwTdHandle)->ShowDetailInfo(((CAppDataTdDetailListView*)(((CAppDataRsp2DTdView*)pAppDataView)->m_pDetailListView))->GetListCtrl());
|
||
theApp.m_pTdManager->GetTestingData(dwTdHandle)->ShowConList(((CAppDataRsp2DTdConListView*)(((CAppDataRsp2DTdView*)pAppDataView)->m_pContentListView))->GetListCtrl());
|
||
theApp.m_pTdManager->GetTestingData(dwTdHandle)->ShowGrList(((CAppDataTdGrListView*)(((CAppDataRsp2DTdView*)pAppDataView)->m_pGrListView))->GetListCtrl());
|
||
}
|
||
|
||
void CDataOperator::ShowRspCETdInfo(DWORD dwTdHandle, CView* pAppDataView)
|
||
{
|
||
theApp.m_pTdManager->GetTestingData(dwTdHandle)->ShowDetailInfo(((CListView*)(((CAppDataRspCETdView*)pAppDataView)->m_pDetailListView))->GetListCtrl());
|
||
// theApp.m_pTdManager->GetTestingData(dwTdHandle)->ShowDetailInfo(((CAppDataRspCETdView*)pAppDataView)->m_pDetailListView->GetListCtrl());
|
||
theApp.m_pTdManager->GetTestingData(dwTdHandle)->ShowConList(((CAppDataRspCETdConListView*)(((CAppDataRspCETdView*)pAppDataView)->m_pContentListView))->GetListCtrl());
|
||
theApp.m_pTdManager->GetTestingData(dwTdHandle)->ShowGrList(((CAppDataCESTdGrListView*)(((CAppDataRspCETdView*)pAppDataView)->m_pGrListView))->GetListCtrl());
|
||
}
|
||
|
||
void CDataOperator::LoadRspCERecordbyPage(DWORD dwTdHandle, CView *pAppDataView, int iSType)
|
||
{
|
||
theApp.m_pTdManager->GetTestingData(dwTdHandle)->ShowConListByPage(((CAppDataRspCETdConListView*)(((CAppDataRspCETdView*)pAppDataView)->m_pContentListView))->GetListCtrl(), iSType);
|
||
}
|
||
|
||
void CDataOperator::LoadRsp2dRecordbyPage(DWORD dwTdHandle, CView *pAppDataView, int iSType)
|
||
{
|
||
theApp.m_pTdManager->GetTestingData(dwTdHandle)->ShowConListByPage(((CAppDataRsp2DTdConListView*)(((CAppDataRsp2DTdView*)pAppDataView)->m_pContentListView))->GetListCtrl(), iSType);
|
||
}
|
||
|
||
void CDataOperator::LoadRsp3dRecordbyPage(DWORD dwTdHandle, CView *pAppDataView, int iSType)
|
||
{
|
||
theApp.m_pTdManager->GetTestingData(dwTdHandle)->ShowConListByPage(((CAppDataRsp3DTdConListView*)(((CAppDataRsp3DTdView*)pAppDataView)->m_pContentListView))->GetListCtrl(), iSType);
|
||
}
|
||
|
||
void CDataOperator::ShowIps2DpTdInfo(DWORD dwTdHandle, CView *pAppDataView)
|
||
{
|
||
CTestingData* pTestingData = theApp.m_pTdManager->GetTestingData(dwTdHandle);
|
||
if (pTestingData == NULL)
|
||
{
|
||
ASSERT(pTestingData != NULL);
|
||
return;
|
||
}
|
||
CAppDataIpsp2DTdView* pDataView = (CAppDataIpsp2DTdView*)pAppDataView;
|
||
if (pDataView == NULL)
|
||
{
|
||
ASSERT(pDataView != NULL);
|
||
return;
|
||
}
|
||
CAppDataTdDetailListView* pDetailListView = (CAppDataTdDetailListView*)pDataView->m_pDetailListView;
|
||
if (pDetailListView == NULL)
|
||
{
|
||
ASSERT(pDetailListView != NULL);
|
||
return;
|
||
}
|
||
pTestingData->ShowDetailInfo(pDetailListView->GetListCtrl());
|
||
|
||
CAppDataIpsp2DTdConListView* pContentListView = (CAppDataIpsp2DTdConListView*)pDataView->m_pContentListView;
|
||
if (pContentListView == NULL)
|
||
{
|
||
ASSERT(pContentListView != NULL);
|
||
return;
|
||
}
|
||
pTestingData->ShowConList(pContentListView->GetListCtrl());
|
||
|
||
CAppDataTdGrListView* pGrListView = (CAppDataTdGrListView*)pDataView->m_pGrListView;
|
||
if (pGrListView == NULL)
|
||
{
|
||
ASSERT(pGrListView != NULL);
|
||
return;
|
||
}
|
||
pTestingData->ShowGrList(pGrListView->GetListCtrl());
|
||
}
|
||
|
||
void CDataOperator::ShowIps3DpTdInfo(DWORD dwTdHandle, CView *pAppDataView)
|
||
{
|
||
theApp.m_pTdManager->GetTestingData(dwTdHandle)->ShowDetailInfo(((CAppDataTdDetailListView*)(((CAppDataIpsp3DTdView*)pAppDataView)->m_pDetailListView))->GetListCtrl());
|
||
theApp.m_pTdManager->GetTestingData(dwTdHandle)->ShowConList(((CAppDataIpsp3DTdConListView*)(((CAppDataIpsp3DTdView*)pAppDataView)->m_pContentListView))->GetListCtrl());
|
||
theApp.m_pTdManager->GetTestingData(dwTdHandle)->ShowGrList(((CAppDataTdGrListView*)(((CAppDataIpsp3DTdView*)pAppDataView)->m_pGrListView))->GetListCtrl());
|
||
}
|
||
|
||
void CDataOperator::ShowIpsCEpTdInfo(DWORD dwTdHandle, CView *pAppDataView)
|
||
{
|
||
theApp.m_pTdManager->GetTestingData(dwTdHandle)->ShowDetailInfo(((CAppDataTdDetailListView*)(((CAppDataIpspCETdView*)pAppDataView)->m_pDetailListView))->GetListCtrl());
|
||
// theApp.m_pTdManager->GetTestingData(dwTdHandle)->ShowConList(((CAppDataRspCETdConListView*)(((CAppDataIpspCETdView*)pAppDataView)->m_pContentListView))->GetListCtrl());
|
||
theApp.m_pTdManager->GetTestingData(dwTdHandle)->ShowConList(((CAppDataIpspCETdConListView*)(((CAppDataIpspCETdView*)pAppDataView)->m_pContentListView))->GetListCtrl());
|
||
theApp.m_pTdManager->GetTestingData(dwTdHandle)->ShowGrList(((CAppDataCESTdGrListView*)(((CAppDataIpspCETdView*)pAppDataView)->m_pGrListView))->GetListCtrl());
|
||
}
|
||
|
||
void CDataOperator::LoadIpspCERecordbyPage(DWORD dwTdHandle, CView *pAppDataView, int iSType/* = 1*/)
|
||
{
|
||
theApp.m_pTdManager->GetTestingData(dwTdHandle)->ShowConListByPage(((CAppDataIpspCETdConListView*)(((CAppDataIpspCETdView*)pAppDataView)->m_pContentListView))->GetListCtrl(), iSType);
|
||
}
|
||
void CDataOperator::LoadIpsp2dRecordbyPage(DWORD dwTdHandle, CView *pAppDataView, int iSType/* = 2*/)
|
||
{
|
||
theApp.m_pTdManager->GetTestingData(dwTdHandle)->ShowConListByPage(((CAppDataIpsp2DTdConListView*)(((CAppDataIpsp2DTdView*)pAppDataView)->m_pContentListView))->GetListCtrl(), iSType);
|
||
}
|
||
void CDataOperator::LoadIpsp3dRecordbyPage(DWORD dwTdHandle, CView *pAppDataView, int iSType/* = 3*/)
|
||
{
|
||
theApp.m_pTdManager->GetTestingData(dwTdHandle)->ShowConListByPage(((CAppDataIpsp3DTdConListView*)(((CAppDataIpsp3DTdView*)pAppDataView)->m_pContentListView))->GetListCtrl(), iSType);
|
||
}
|
||
//DEL void CDataOperator::ShowDevInfoInDataMng(DWORD dwDevHandle, CView *pAppDataView)
|
||
//DEL {
|
||
//DEL DWORD dwDevID = (DWORD)VAL_ZERO;
|
||
//DEL dwDevID = this->m_handleProcessor.GetIDFromHandle(dwDevHandle);
|
||
//DEL theApp.m_pDevManager->GetDeviceByID(dwDevID)->ShowDetailInfo(((CAppDataDevDetailListView*)(((CAppDataDevView*)pAppDataView)->m_pDetailListView))->GetListCtrl());
|
||
//DEL theApp.m_pProManager->ShowProList(dwDevHandle, ((CAppDataProListView*)(((CAppDataDevView*)pAppDataView)->m_pContentListView))->GetListCtrl());
|
||
//DEL }
|
||
|
||
UINT CDataOperator::CreateProjectInDB(CNavDataView* pNavDataView)
|
||
{
|
||
HTREEITEM hProItem = NULL;
|
||
_RecordsetPtr pRecPro = NULL;
|
||
DWORD dwHandle = (DWORD)VAL_ZERO;
|
||
DWORD dwID = (DWORD)VAL_ZERO;
|
||
UINT uImageState = (UINT)VAL_ZERO;
|
||
UINT uExecCode = (UINT)VAL_ZERO;
|
||
|
||
CString szSql = _T("");
|
||
|
||
pRecPro.CreateInstance(_uuidof(Recordset));
|
||
|
||
try
|
||
{
|
||
m_pConnection->BeginTrans();
|
||
uExecCode = theApp.m_pProManager->CreateProjectInDB(dwID);
|
||
if (APP_SUCCESS == uExecCode)
|
||
{
|
||
szSql.Empty();
|
||
szSql.Format(_T("select PRname from project where ID = %u"), dwID);
|
||
pRecPro->Open(szSql.AllocSysString(), _variant_t((IDispatch*)m_pConnection, true), adOpenStatic, adLockOptimistic, adCmdText);
|
||
|
||
if ((long)VAL_ZERO != pRecPro->GetRecordCount())
|
||
{
|
||
hProItem = pNavDataView->m_dataTree.InsertItem((LPCTSTR)(_bstr_t)pRecPro->GetCollect(_T("PRname")));
|
||
|
||
dwHandle = m_handleProcessor.GenerateHandle(dwID, PZ_STYLE_PRO);
|
||
pNavDataView->m_dataTree.SetItemData(hProItem, dwHandle);
|
||
|
||
uImageState = m_stateProcessor.ChangeToImageState(PZ_STATE_DB);
|
||
pNavDataView->m_dataTree.SetItemState(hProItem, uImageState, TVIS_STATEIMAGEMASK);
|
||
pNavDataView->m_dataTree.SelectItem(hProItem);
|
||
|
||
}
|
||
pRecPro->Close();
|
||
m_pConnection->CommitTrans();
|
||
}
|
||
else
|
||
{
|
||
m_pConnection->RollbackTrans();
|
||
}
|
||
}
|
||
catch (_com_error e)
|
||
{
|
||
m_pConnection->RollbackTrans();
|
||
return APP_ERR_DB;
|
||
}
|
||
|
||
return uExecCode;
|
||
}
|
||
|
||
//DEL UINT CDataOperator::CreateProjectInLoc(CNavDataView* pNavDataView)
|
||
//DEL {
|
||
//DEL HTREEITEM hProItem = NULL;
|
||
//DEL HTREEITEM hPreItem = NULL;
|
||
//DEL HTREEITEM hCurItem = NULL;
|
||
//DEL
|
||
//DEL _RecordsetPtr pRecPro = NULL;
|
||
//DEL DWORD dwHandle = (DWORD)VAL_ZERO;
|
||
//DEL DWORD dwDevHandle = (DWORD)VAL_ZERO;
|
||
//DEL DWORD dwID = (DWORD)VAL_ZERO;
|
||
//DEL DWORD dwDevID = (DWORD)VAL_ZERO;
|
||
//DEL UINT uImageState = (UINT)VAL_ZERO;
|
||
//DEL UINT uExecCode = (UINT)VAL_ZERO;
|
||
//DEL
|
||
//DEL CString szSql = _T("");
|
||
//DEL /*
|
||
//DEL pRecPro.CreateInstance(_uuidof(Recordset));
|
||
//DEL
|
||
//DEL m_pConnection->BeginTrans();
|
||
//DEL
|
||
//DEL try
|
||
//DEL {
|
||
//DEL uExecCode = theApp.m_pProManager->CreateProjectInDB(dwID);
|
||
//DEL if ((APP_SUCCESS == uExecCode) || (APP_DUPLICATE == uExecCode))
|
||
//DEL {
|
||
//DEL hCurItem = pNavDataView->m_navDevDlg.m_devTree.GetSelectedItem();
|
||
//DEL
|
||
//DEL while (NULL != hCurItem)
|
||
//DEL {
|
||
//DEL hPreItem = hCurItem;
|
||
//DEL hCurItem = pNavDataView->m_navDevDlg.m_devTree.GetParentItem(hCurItem);
|
||
//DEL }
|
||
//DEL
|
||
//DEL dwDevHandle = pNavDataView->m_navDevDlg.m_devTree.GetItemData(hPreItem);
|
||
//DEL dwDevID = m_handleProcessor.GetIDFromHandle(dwDevHandle);
|
||
//DEL uExecCode = theApp.m_pProManager->CreateProjectInLoc(dwID, dwDevID);
|
||
//DEL
|
||
//DEL if (APP_SUCCESS == uExecCode)
|
||
//DEL {
|
||
//DEL szSql.Empty();
|
||
//DEL szSql.Format(_T("select PRname,CN from project where ID = %u"), dwID);
|
||
//DEL pRecPro->Open(szSql.AllocSysString(), _variant_t((IDispatch*)m_pConnection, true),
|
||
//DEL adOpenStatic, adLockOptimistic, adCmdText);
|
||
//DEL
|
||
//DEL if ((long)VAL_ZERO != pRecPro->GetRecordCount())
|
||
//DEL {
|
||
//DEL hProItem = pNavDataView->m_navDevDlg.m_devTree.InsertItem((LPCTSTR)(_bstr_t)pRecPro->GetCollect(_T("PRname")), hPreItem);
|
||
//DEL
|
||
//DEL dwHandle = m_handleProcessor.GenerateHandle(dwID, PZ_STYLE_PRO);
|
||
//DEL pNavDataView->m_navDevDlg.m_devTree.SetItemData(hProItem, dwHandle);
|
||
//DEL
|
||
//DEL uImageState = m_stateProcessor.ChangeToImageState(PZ_STATE_LOC);
|
||
//DEL pNavDataView->m_navDevDlg.m_devTree.SetItemState(hProItem, uImageState, TVIS_STATEIMAGEMASK);
|
||
//DEL pNavDataView->m_navDevDlg.m_devTree.SelectItem(hProItem);
|
||
//DEL }
|
||
//DEL pRecPro->Close();
|
||
//DEL }
|
||
//DEL else
|
||
//DEL {
|
||
//DEL m_pConnection->RollbackTrans();
|
||
//DEL return uExecCode;
|
||
//DEL }
|
||
//DEL }
|
||
//DEL else
|
||
//DEL {
|
||
//DEL m_pConnection->RollbackTrans();
|
||
//DEL return uExecCode;
|
||
//DEL }
|
||
//DEL }
|
||
//DEL catch (_com_error e)
|
||
//DEL {
|
||
//DEL m_pConnection->RollbackTrans();
|
||
//DEL return APP_ERR_DB;
|
||
//DEL }
|
||
//DEL
|
||
//DEL m_pConnection->CommitTrans();
|
||
//DEL InitialNavDataProDlg(pNavDataView->m_navProDlg);
|
||
//DEL */
|
||
//DEL return uExecCode;
|
||
//DEL }
|
||
|
||
DWORD CDataOperator::GetTdIdFromNavDataView(CNavDataView *pNavDataView)
|
||
{
|
||
HTREEITEM hTdItem = NULL;
|
||
HTREEITEM hTzItem = NULL;
|
||
|
||
DWORD dwTdHandle = (DWORD)VAL_ZERO;
|
||
DWORD dwTdID = (DWORD)VAL_ZERO;
|
||
|
||
hTdItem = pNavDataView->m_dataTree.GetSelectedItem();
|
||
hTzItem = pNavDataView->m_dataTree.GetParentItem(hTdItem);
|
||
dwTdHandle = pNavDataView->m_dataTree.GetItemData(hTdItem);
|
||
|
||
return m_handleProcessor.GetIDFromHandle(dwTdHandle);
|
||
}
|
||
|
||
void CDataOperator::UpdateNavDataViewAfterDel(CNavDataView *pNavDataView)
|
||
{
|
||
HTREEITEM hTdItem = pNavDataView->m_dataTree.GetSelectedItem();
|
||
HTREEITEM hTzItem = pNavDataView->m_dataTree.GetParentItem(hTdItem);
|
||
|
||
pNavDataView->m_dataTree.DeleteItem(hTdItem);
|
||
pNavDataView->m_dataTree.SelectItem(NULL);
|
||
pNavDataView->m_dataTree.SelectItem(hTzItem);
|
||
}
|
||
UINT CDataOperator::DeleteProjectInDB(CNavDataView* pNavDataView)
|
||
{
|
||
_RecordsetPtr pRecProID = NULL;
|
||
_RecordsetPtr pRecTzList = NULL;
|
||
_RecordsetPtr pRecTdList = NULL;
|
||
|
||
DWORD dwHandle = (DWORD)VAL_ZERO;
|
||
DWORD dwID = (DWORD)VAL_ZERO;
|
||
|
||
DWORD dwTzID = (DWORD)VAL_ZERO;
|
||
DWORD dwTdID = (DWORD)VAL_ZERO;
|
||
|
||
CString szSql = _T("");
|
||
|
||
dwHandle = pNavDataView->m_dataTree.GetItemData(pNavDataView->m_dataTree.GetSelectedItem());
|
||
dwID = m_handleProcessor.GetIDFromHandle(dwHandle);
|
||
|
||
pRecProID.CreateInstance(_uuidof(Recordset));
|
||
pRecTzList.CreateInstance(_uuidof(Recordset));
|
||
pRecTdList.CreateInstance(_uuidof(Recordset));
|
||
|
||
m_pConnection->BeginTrans();
|
||
|
||
try
|
||
{
|
||
szSql.Empty();
|
||
szSql.Format(_T("select ID from tz where PRID = %u"), dwID);
|
||
pRecTzList->Open(szSql.AllocSysString(), _variant_t((IDispatch*)m_pConnection, true), adOpenStatic, adLockOptimistic, adCmdText);
|
||
while ((short)VAL_ZERO == pRecTzList->adoEOF)
|
||
{
|
||
dwTzID = pRecTzList->GetCollect(_T("ID")).ulVal;
|
||
szSql.Empty();
|
||
szSql.Format(_T("select ID,Ttype,Stype from td where TZID = %u"), dwTzID);
|
||
pRecTdList->Open(szSql.AllocSysString(), _variant_t((IDispatch*)m_pConnection, true),
|
||
adOpenStatic, adLockOptimistic, adCmdText);
|
||
/*
|
||
while ((short)VAL_ZERO == pRecTdList->adoEOF)
|
||
{
|
||
dwTdID = pRecTdList->GetCollect(_T("ID")).ulVal;
|
||
switch (pRecTdList->GetCollect(_T("Ttype")).iVal)
|
||
{
|
||
case 0:
|
||
theApp.m_pTdManager->DeleteRspTd(dwTdID);
|
||
theApp.m_pTdManager->DeleteObjInMem(m_handleProcessor.GenerateHandle(dwTdID, PZ_STYLE_TD_RSP));
|
||
break;
|
||
case 1:
|
||
theApp.m_pTdManager->DeleteIpspTd(dwTdID);
|
||
theApp.m_pTdManager->DeleteObjInMem(m_handleProcessor.GenerateHandle(dwTdID, PZ_STYLE_TD_IPSP));
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
pRecTdList->MoveNext();
|
||
}
|
||
pRecTdList->Close();
|
||
*/
|
||
//Ttype,0:电阻率 1:激电 2:自电
|
||
//Stype,0:一维 1:二维 2:三维
|
||
while ((short)VAL_ZERO == pRecTdList->adoEOF)
|
||
{
|
||
dwTdID = pRecTdList->GetCollect(_T("ID")).ulVal;
|
||
switch (pRecTdList->GetCollect(_T("Ttype")).iVal)
|
||
{
|
||
case 0:
|
||
switch (pRecTdList->GetCollect(_T("Stype")).iVal)
|
||
{
|
||
case 0:
|
||
theApp.m_pTdManager->DeleteRspCETd(dwTdID);
|
||
theApp.m_pTdManager->DeleteObjInMem(m_handleProcessor.GenerateHandle(dwTdID, PZ_STYLE_TD_CERSP));
|
||
break;
|
||
case 1:
|
||
theApp.m_pTdManager->DeleteRsp2DTd(dwTdID);
|
||
theApp.m_pTdManager->DeleteObjInMem(m_handleProcessor.GenerateHandle(dwTdID, PZ_STYLE_TD_2DRSP));
|
||
break;
|
||
case 2:
|
||
theApp.m_pTdManager->DeleteRsp3DTd(dwTdID);
|
||
theApp.m_pTdManager->DeleteObjInMem(m_handleProcessor.GenerateHandle(dwTdID, PZ_STYLE_TD_3DRSP));
|
||
break;
|
||
default:
|
||
break;
|
||
|
||
}
|
||
break;
|
||
case 1:
|
||
switch (pRecTdList->GetCollect(_T("Stype")).iVal)
|
||
{
|
||
case 0:
|
||
theApp.m_pTdManager->DeleteIpspCETd(dwTdID);
|
||
theApp.m_pTdManager->DeleteObjInMem(m_handleProcessor.GenerateHandle(dwTdID, PZ_STYLE_TD_CEIPSP));
|
||
break;
|
||
case 1:
|
||
theApp.m_pTdManager->DeleteIpsp2DTd(dwTdID);
|
||
theApp.m_pTdManager->DeleteObjInMem(m_handleProcessor.GenerateHandle(dwTdID, PZ_STYLE_TD_2DIPSP));
|
||
break;
|
||
case 2:
|
||
theApp.m_pTdManager->DeleteIpsp3DTd(dwTdID);
|
||
theApp.m_pTdManager->DeleteObjInMem(m_handleProcessor.GenerateHandle(dwTdID, PZ_STYLE_TD_3DIPSP));
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
break;
|
||
case 2:
|
||
switch (pRecTdList->GetCollect(_T("Stype")).iVal)
|
||
{
|
||
case 0:
|
||
theApp.m_pTdManager->DeleteSPCETd(dwTdID);
|
||
theApp.m_pTdManager->DeleteObjInMem(m_handleProcessor.GenerateHandle(dwTdID, PZ_STYLE_TD_CESP));
|
||
break;
|
||
case 1:
|
||
theApp.m_pTdManager->DeleteSP2DTd(dwTdID);
|
||
theApp.m_pTdManager->DeleteObjInMem(m_handleProcessor.GenerateHandle(dwTdID, PZ_STYLE_TD_2DSP));
|
||
break;
|
||
case 2:
|
||
theApp.m_pTdManager->DeleteSP3DTd(dwTdID);
|
||
theApp.m_pTdManager->DeleteObjInMem(m_handleProcessor.GenerateHandle(dwTdID, PZ_STYLE_TD_3DSP));
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
pRecTdList->MoveNext();
|
||
}
|
||
|
||
pRecTdList->Close();
|
||
|
||
theApp.m_pProManager->DeleteTzInDB(dwTzID);
|
||
theApp.m_pProManager->DeleteObjInMem(m_handleProcessor.GenerateHandle(dwTzID, PZ_STYLE_TZ));
|
||
|
||
pRecTzList->MoveNext();
|
||
}
|
||
pRecTzList->Close();
|
||
|
||
theApp.m_pProManager->DeleteProjectInDB(dwID);
|
||
theApp.m_pProManager->DeleteObjInMem(dwHandle);
|
||
}
|
||
catch (_com_error e)
|
||
{
|
||
m_pConnection->RollbackTrans();
|
||
return APP_ERR_DB;
|
||
}
|
||
|
||
m_pConnection->CommitTrans();
|
||
|
||
// InitialNavDataView(pNavDataView);
|
||
|
||
pNavDataView->m_dataTree.DeleteItem(pNavDataView->m_dataTree.GetSelectedItem());
|
||
pNavDataView->m_dataTree.SelectItem(NULL);
|
||
|
||
return APP_SUCCESS;
|
||
}
|
||
|
||
//DEL UINT CDataOperator::DeleteProjectInLoc(CNavDataView* pNavDataView)
|
||
//DEL {
|
||
//DEL UINT uExecCode = (UINT)VAL_ZERO;
|
||
//DEL bool bIsDelTd = false;
|
||
//DEL
|
||
//DEL HTREEITEM hProItem = NULL;
|
||
//DEL HTREEITEM hPreItem = NULL;
|
||
//DEL HTREEITEM hCurItem = NULL;
|
||
//DEL
|
||
//DEL _RecordsetPtr pRecPro = NULL;
|
||
//DEL _RecordsetPtr pRecTz = NULL;
|
||
//DEL
|
||
//DEL _RecordsetPtr pRecTzList = NULL;
|
||
//DEL _RecordsetPtr pRecTdList = NULL;
|
||
//DEL
|
||
//DEL DWORD dwHandle = (DWORD)VAL_ZERO;
|
||
//DEL DWORD dwID = (DWORD)VAL_ZERO;
|
||
//DEL
|
||
//DEL DWORD dwDevHandle = (DWORD)VAL_ZERO;
|
||
//DEL DWORD dwDevID = (DWORD)VAL_ZERO;
|
||
//DEL
|
||
//DEL DWORD dwTdID = (DWORD)VAL_ZERO;
|
||
//DEL CString szSql = _T("");
|
||
//DEL CString szCaption = _T("");
|
||
//DEL /*
|
||
//DEL dwHandle = pNavDataView->m_navDevDlg.m_devTree.GetItemData(pNavDataView->m_navDevDlg.m_devTree.GetSelectedItem());
|
||
//DEL dwID = m_handleProcessor.GetIDFromHandle(dwHandle);
|
||
//DEL
|
||
//DEL hProItem = pNavDataView->m_navDevDlg.m_devTree.GetSelectedItem();
|
||
//DEL hCurItem = hProItem;
|
||
//DEL
|
||
//DEL while (NULL != hCurItem)
|
||
//DEL {
|
||
//DEL hPreItem = hCurItem;
|
||
//DEL hCurItem = pNavDataView->m_navDevDlg.m_devTree.GetParentItem(hCurItem);
|
||
//DEL }
|
||
//DEL
|
||
//DEL dwDevHandle = pNavDataView->m_navDevDlg.m_devTree.GetItemData(hPreItem);
|
||
//DEL dwDevID = m_handleProcessor.GetIDFromHandle(dwDevHandle);
|
||
//DEL
|
||
//DEL pRecPro.CreateInstance(_uuidof(Recordset));
|
||
//DEL pRecTz.CreateInstance(_uuidof(Recordset));
|
||
//DEL pRecTzList.CreateInstance(_uuidof(Recordset));
|
||
//DEL pRecTdList.CreateInstance(_uuidof(Recordset));
|
||
//DEL
|
||
//DEL m_pConnection->BeginTrans();
|
||
//DEL
|
||
//DEL try
|
||
//DEL {
|
||
//DEL szSql.Empty();
|
||
//DEL szSql.Format(_T("select * from td where DEID = %u and TZID in (select ID from tz where PRID =%u)"), dwDevID, dwID);
|
||
//DEL pRecTdList->Open(szSql.AllocSysString(), _variant_t((IDispatch*)m_pConnection, true),
|
||
//DEL adOpenStatic, adLockOptimistic, adCmdText);
|
||
//DEL
|
||
//DEL if (VAL_ZERO != pRecTdList->GetRecordCount())
|
||
//DEL {
|
||
//DEL szCaption.Empty();
|
||
//DEL szCaption.LoadString(IDS_OP_LD_PRO_TD);
|
||
//DEL if (IDYES == AfxMessageBox(szCaption, MB_YESNO, MB_ICONQUESTION))
|
||
//DEL {
|
||
//DEL bIsDelTd = true;
|
||
//DEL }
|
||
//DEL }
|
||
//DEL
|
||
//DEL pRecTdList->Close();
|
||
//DEL
|
||
//DEL szSql.Empty();
|
||
//DEL szSql.Format(_T("select TZID from dptt where DEID = %u and PRID = %u and TZID is not NULL"), dwDevID ,dwID);
|
||
//DEL pRecTzList->Open(szSql.AllocSysString(), _variant_t((IDispatch*)m_pConnection, true),
|
||
//DEL adOpenStatic, adLockOptimistic, adCmdText);
|
||
//DEL
|
||
//DEL while ((short)VAL_ZERO == pRecTzList->adoEOF)
|
||
//DEL {
|
||
//DEL if (bIsDelTd)
|
||
//DEL {
|
||
//DEL szSql.Empty();
|
||
//DEL szSql.Format(_T("select ID,TDtype from td where DEID = %u and TZID = %u"), dwDevID, pRecTzList->GetCollect(_T("TZID")).ulVal);
|
||
//DEL pRecTdList->Open(szSql.AllocSysString(), _variant_t((IDispatch*)m_pConnection, true),
|
||
//DEL adOpenStatic, adLockOptimistic, adCmdText);
|
||
//DEL
|
||
//DEL while ((short)VAL_ZERO == pRecTdList->adoEOF)
|
||
//DEL {
|
||
//DEL dwTdID = (DWORD)pRecTdList->GetCollect(_T("ID")).ulVal;
|
||
//DEL switch (pRecTdList->GetCollect(_T("TDtype")).iVal)
|
||
//DEL {
|
||
//DEL case 0:
|
||
//DEL theApp.m_pTdManager->DeleteRspTd(dwTdID);
|
||
//DEL theApp.m_pTdManager->DeleteObjInMem(m_handleProcessor.GenerateHandle(dwTdID, PZ_STYLE_TD_RSP));
|
||
//DEL break;
|
||
//DEL case 1:
|
||
//DEL theApp.m_pTdManager->DeleteIpspTd(dwTdID);
|
||
//DEL theApp.m_pTdManager->DeleteObjInMem(m_handleProcessor.GenerateHandle(dwTdID, PZ_STYLE_TD_IPSP));
|
||
//DEL break;
|
||
//DEL default:
|
||
//DEL break;
|
||
//DEL }
|
||
//DEL pRecTdList->MoveNext();
|
||
//DEL }
|
||
//DEL
|
||
//DEL pRecTdList->Close();
|
||
//DEL }
|
||
//DEL theApp.m_pProManager->DeleteTzInLoc(pRecTzList->GetCollect(_T("TZID")).ulVal, dwDevID);
|
||
//DEL pRecTzList->MoveNext();
|
||
//DEL }
|
||
//DEL
|
||
//DEL pRecTzList->Close();
|
||
//DEL theApp.m_pProManager->DeleteProjectInLoc(dwID, dwDevID);
|
||
//DEL }
|
||
//DEL catch (_com_error e)
|
||
//DEL {
|
||
//DEL m_pConnection->RollbackTrans();
|
||
//DEL return APP_ERR_DB;
|
||
//DEL }
|
||
//DEL
|
||
//DEL m_pConnection->CommitTrans();
|
||
//DEL
|
||
//DEL InitialNavDataProDlg(pNavDataView->m_navProDlg);
|
||
//DEL
|
||
//DEL pNavDataView->m_navDevDlg.m_devTree.SelectItem(pNavDataView->m_navDevDlg.m_devTree.GetParentItem(hProItem));
|
||
//DEL pNavDataView->m_navDevDlg.m_devTree.DeleteItem(hProItem);
|
||
//DEL */
|
||
//DEL return uExecCode;
|
||
//DEL }
|
||
|
||
UINT CDataOperator::CreateTzInDB(CNavDataView* pNavDataView)
|
||
{
|
||
HTREEITEM hProItem = NULL;
|
||
HTREEITEM hTzItem = NULL;
|
||
_RecordsetPtr pRecTz = NULL;
|
||
DWORD dwHandle = (DWORD)VAL_ZERO;
|
||
DWORD dwID = (DWORD)VAL_ZERO;
|
||
|
||
DWORD dwProHandle = (DWORD)VAL_ZERO;
|
||
DWORD dwProID = (DWORD)VAL_ZERO;
|
||
|
||
UINT uImageState = (UINT)VAL_ZERO;
|
||
UINT uExecCode = (UINT)VAL_ZERO;
|
||
|
||
CString szSql = _T("");
|
||
|
||
pRecTz.CreateInstance(_uuidof(Recordset));
|
||
|
||
m_pConnection->BeginTrans();
|
||
|
||
try
|
||
{
|
||
hProItem = pNavDataView->m_dataTree.GetSelectedItem();
|
||
dwProHandle = pNavDataView->m_dataTree.GetItemData(hProItem);
|
||
dwProID = m_handleProcessor.GetIDFromHandle(dwProHandle);
|
||
|
||
uExecCode = theApp.m_pProManager->CreateTzInDB(dwID, dwProID);
|
||
if (uExecCode == APP_SUCCESS)
|
||
{
|
||
szSql.Empty();
|
||
szSql.Format(_T("select TZname from tz where ID = %u"), dwID);
|
||
pRecTz->Open(szSql.AllocSysString(), _variant_t((IDispatch*)m_pConnection, true),
|
||
adOpenStatic, adLockOptimistic, adCmdText);
|
||
|
||
if ((long)VAL_ZERO != pRecTz->GetRecordCount())
|
||
{
|
||
hTzItem = pNavDataView->m_dataTree.InsertItem((pRecTz->GetCollect(_T("TZname")).vt == VT_NULL) ? _T("") : (LPCTSTR)(_bstr_t)pRecTz->GetCollect(_T("TZname")),
|
||
hProItem);
|
||
|
||
dwHandle = m_handleProcessor.GenerateHandle(dwID, PZ_STYLE_TZ);
|
||
pNavDataView->m_dataTree.SetItemData(hTzItem, dwHandle);
|
||
|
||
uImageState = m_stateProcessor.ChangeToImageState(PZ_STATE_DB);
|
||
pNavDataView->m_dataTree.SetItemState(hTzItem, uImageState, TVIS_STATEIMAGEMASK);
|
||
pNavDataView->m_dataTree.SelectItem(hTzItem);
|
||
|
||
}
|
||
pRecTz->Close();
|
||
m_pConnection->CommitTrans();
|
||
}
|
||
else
|
||
{
|
||
m_pConnection->RollbackTrans();
|
||
}
|
||
}
|
||
catch (_com_error e)
|
||
{
|
||
hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL);
|
||
AfxMessageBox((LPCTSTR)e.Description(), MB_ICONINFORMATION);
|
||
m_pConnection->RollbackTrans();
|
||
return APP_ERR_DB;
|
||
}
|
||
|
||
return uExecCode;
|
||
}
|
||
|
||
UINT CDataOperator::DeleteTzInDB(CNavDataView *pNavDataView)
|
||
{
|
||
HTREEITEM hTzItem = NULL;
|
||
|
||
_RecordsetPtr pRecTzID = NULL;
|
||
_RecordsetPtr pRecTdList = NULL;
|
||
|
||
DWORD dwHandle = (DWORD)VAL_ZERO;
|
||
DWORD dwID = (DWORD)VAL_ZERO;
|
||
|
||
DWORD dwTdID = (DWORD)VAL_ZERO;
|
||
|
||
CString szSql = _T("");
|
||
|
||
hTzItem = pNavDataView->m_dataTree.GetSelectedItem();
|
||
dwHandle = pNavDataView->m_dataTree.GetItemData(hTzItem);
|
||
dwID = m_handleProcessor.GetIDFromHandle(dwHandle);
|
||
|
||
pRecTzID.CreateInstance(_uuidof(Recordset));
|
||
pRecTdList.CreateInstance(_uuidof(Recordset));
|
||
|
||
m_pConnection->BeginTrans();
|
||
|
||
try
|
||
{
|
||
szSql.Empty();
|
||
szSql.Format(_T("select ID,Ttype,Stype from td where TZID = %u"), dwID);
|
||
pRecTdList->Open(szSql.AllocSysString(), _variant_t((IDispatch*)m_pConnection, true), adOpenStatic, adLockOptimistic, adCmdText);
|
||
|
||
while ((short)VAL_ZERO == pRecTdList->adoEOF)
|
||
{
|
||
dwTdID = pRecTdList->GetCollect(_T("ID")).ulVal;
|
||
switch (pRecTdList->GetCollect(_T("Ttype")).iVal)
|
||
{
|
||
case 0:
|
||
switch (pRecTdList->GetCollect(_T("Stype")).iVal)
|
||
{
|
||
case 0:
|
||
break;
|
||
case 1:
|
||
theApp.m_pTdManager->DeleteRsp2DTd(dwTdID);
|
||
theApp.m_pTdManager->DeleteObjInMem(m_handleProcessor.GenerateHandle(dwTdID, PZ_STYLE_TD_2DRSP));
|
||
break;
|
||
case 2:
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
break;
|
||
case 1:
|
||
switch (pRecTdList->GetCollect(_T("Stype")).iVal)
|
||
{
|
||
case 0:
|
||
break;
|
||
case 1:
|
||
theApp.m_pTdManager->DeleteRsp2DTd(dwTdID);
|
||
theApp.m_pTdManager->DeleteObjInMem(m_handleProcessor.GenerateHandle(dwTdID, PZ_STYLE_TD_2DRSP));
|
||
break;
|
||
case 2:
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
pRecTdList->MoveNext();
|
||
}
|
||
|
||
pRecTdList->Close();
|
||
|
||
theApp.m_pProManager->DeleteTzInDB(dwID);
|
||
theApp.m_pProManager->DeleteObjInMem(m_handleProcessor.GenerateHandle(dwID, PZ_STYLE_TZ));
|
||
|
||
}
|
||
catch (_com_error e)
|
||
{
|
||
hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL);
|
||
AfxMessageBox((LPCTSTR)e.Description(), MB_ICONINFORMATION);
|
||
m_pConnection->RollbackTrans();
|
||
return APP_ERR_DB;
|
||
}
|
||
|
||
m_pConnection->CommitTrans();
|
||
|
||
// InitialNavDataDevDlg(pNavDataView->m_navDevDlg);
|
||
|
||
pNavDataView->m_dataTree.SelectItem(pNavDataView->m_dataTree.GetParentItem(hTzItem));
|
||
pNavDataView->m_dataTree.DeleteItem(hTzItem);
|
||
|
||
return APP_SUCCESS;
|
||
}
|
||
|
||
UINT CDataOperator::Convert2DTo3D(CNavDataView* pNavDataView)
|
||
{
|
||
UINT uExecCode = (UINT)APP_SUCCESS;
|
||
|
||
HTREEITEM hTzItem = NULL;
|
||
DWORD dwTzHandle = (DWORD)VAL_ZERO;
|
||
|
||
hTzItem = pNavDataView->m_dataTree.GetSelectedItem();
|
||
dwTzHandle = pNavDataView->m_dataTree.GetItemData(hTzItem);
|
||
|
||
if (TRUE == theApp.m_pTdManager->Convert2DTo3D(dwTzHandle))
|
||
{
|
||
uExecCode = (UINT)APP_SUCCESS;
|
||
}
|
||
else
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
|
||
return uExecCode;
|
||
}
|
||
|
||
UINT CDataOperator::DeleteRspCETdInDB(DWORD dwTdID)
|
||
{
|
||
UINT uExecCode = (UINT)APP_SUCCESS;
|
||
_RecordsetPtr pRecTd = NULL;
|
||
pRecTd.CreateInstance(_uuidof(Recordset));
|
||
|
||
try
|
||
{
|
||
m_pConnection->BeginTrans();
|
||
|
||
theApp.m_pTdManager->DeleteRspCETd(dwTdID);
|
||
theApp.m_pTdManager->DeleteObjInMem(m_handleProcessor.GenerateHandle(dwTdID, PZ_STYLE_TD_CERSP));
|
||
}
|
||
catch (_com_error e)
|
||
{
|
||
m_pConnection->RollbackTrans();
|
||
hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL);
|
||
AfxMessageBox((LPCTSTR)e.Description());
|
||
return APP_ERR_DB;
|
||
}
|
||
|
||
m_pConnection->CommitTrans();
|
||
|
||
return uExecCode;
|
||
}
|
||
|
||
UINT CDataOperator::DeleteIpspCETdInDB(DWORD dwTdID)
|
||
{
|
||
UINT uExecCode = (UINT)APP_SUCCESS;
|
||
_RecordsetPtr pRecTd = NULL;
|
||
pRecTd.CreateInstance(_uuidof(Recordset));
|
||
|
||
try
|
||
{
|
||
m_pConnection->BeginTrans();
|
||
|
||
theApp.m_pTdManager->DeleteIpspCETd(dwTdID);
|
||
theApp.m_pTdManager->DeleteObjInMem(m_handleProcessor.GenerateHandle(dwTdID, PZ_STYLE_TD_CEIPSP));
|
||
}
|
||
catch (_com_error e)
|
||
{
|
||
hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL);
|
||
AfxMessageBox((LPCTSTR)e.Description());
|
||
m_pConnection->RollbackTrans();
|
||
return APP_ERR_DB;
|
||
}
|
||
|
||
m_pConnection->CommitTrans();
|
||
|
||
return uExecCode;
|
||
}
|
||
|
||
UINT CDataOperator::DeleteRsp3DTdInDB(DWORD dwTdID)
|
||
{
|
||
UINT uExecCode = (UINT)APP_SUCCESS;
|
||
_RecordsetPtr pRecTd = NULL;
|
||
pRecTd.CreateInstance(_uuidof(Recordset));
|
||
|
||
try
|
||
{
|
||
m_pConnection->BeginTrans();
|
||
|
||
theApp.m_pTdManager->DeleteRsp3DTd(dwTdID);
|
||
theApp.m_pTdManager->DeleteObjInMem(m_handleProcessor.GenerateHandle(dwTdID, PZ_STYLE_TD_3DRSP));
|
||
}
|
||
catch (_com_error e)
|
||
{
|
||
hHook = SetWindowsHookEx(WH_CBT,(HOOKPROC)CBTHookProc,AfxGetInstanceHandle(),NULL);
|
||
AfxMessageBox((LPCTSTR)e.Description());
|
||
m_pConnection->RollbackTrans();
|
||
return APP_ERR_DB;
|
||
}
|
||
|
||
m_pConnection->CommitTrans();
|
||
|
||
return uExecCode;
|
||
}
|
||
UINT CDataOperator::DeleteRsp2DTdInDB(DWORD dwTdID)
|
||
{
|
||
UINT uExecCode = (UINT)APP_SUCCESS;
|
||
_RecordsetPtr pRecTd = NULL;
|
||
pRecTd.CreateInstance(_uuidof(Recordset));
|
||
|
||
try
|
||
{
|
||
m_pConnection->BeginTrans();
|
||
|
||
theApp.m_pTdManager->DeleteRsp2DTd(dwTdID);
|
||
theApp.m_pTdManager->DeleteObjInMem(m_handleProcessor.GenerateHandle(dwTdID, PZ_STYLE_TD_2DRSP));
|
||
}
|
||
catch (_com_error e)
|
||
{
|
||
m_pConnection->RollbackTrans();
|
||
return APP_ERR_DB;
|
||
}
|
||
|
||
m_pConnection->CommitTrans();
|
||
|
||
return uExecCode;
|
||
}
|
||
|
||
UINT CDataOperator::DeleteIpsp2DTdInDB(DWORD dwTdID)
|
||
{
|
||
UINT uExecCode = (UINT)APP_SUCCESS;
|
||
_RecordsetPtr pRecTd = NULL;
|
||
pRecTd.CreateInstance(_uuidof(Recordset));
|
||
|
||
try
|
||
{
|
||
m_pConnection->BeginTrans();
|
||
|
||
theApp.m_pTdManager->DeleteIpsp2DTd(dwTdID);
|
||
theApp.m_pTdManager->DeleteObjInMem(m_handleProcessor.GenerateHandle(dwTdID, PZ_STYLE_TD_2DIPSP));
|
||
}
|
||
catch (_com_error e)
|
||
{
|
||
m_pConnection->RollbackTrans();
|
||
return APP_ERR_DB;
|
||
}
|
||
|
||
m_pConnection->CommitTrans();
|
||
|
||
return uExecCode;
|
||
}
|
||
|
||
int CDataOperator::QueryTaskARInDB(DWORD dwTdHandle)
|
||
{
|
||
DWORD dwTdID = m_handleProcessor.GetIDFromHandle(dwTdHandle);
|
||
|
||
_RecordsetPtr pRecTd = NULL;
|
||
dwTdID = m_handleProcessor.GetIDFromHandle(dwTdHandle);
|
||
|
||
pRecTd.CreateInstance(_uuidof(Recordset));
|
||
CString strSql =_T("");
|
||
strSql.Format(_T("select AR from tdchannel where TDID = %u and CHnumber = 1"), dwTdID);
|
||
CString strErr = _T("");
|
||
try
|
||
{
|
||
pRecTd->Open(strSql.AllocSysString(), _variant_t((IDispatch*)m_pConnection, true),
|
||
adOpenStatic, adLockOptimistic, adCmdText);
|
||
if (pRecTd->GetRecordCount() > 0)
|
||
{
|
||
int iAR = pRecTd->GetCollect(_T("AR")).iVal;
|
||
return iAR;
|
||
}
|
||
else
|
||
{
|
||
strErr.Format(_T("Query AR failed, tdid = %u"),dwTdID);
|
||
AfxMessageBox(strErr);
|
||
}
|
||
}
|
||
catch (_com_error e)
|
||
{
|
||
AfxMessageBox(e.Description());
|
||
}
|
||
return 0;
|
||
|
||
|
||
}
|
||
|
||
UINT CDataOperator::DeleteIpsp3DTdInDB(DWORD dwTdID)
|
||
{
|
||
UINT uExecCode = (UINT)APP_SUCCESS;
|
||
_RecordsetPtr pRecTd = NULL;
|
||
pRecTd.CreateInstance(_uuidof(Recordset));
|
||
|
||
try
|
||
{
|
||
m_pConnection->BeginTrans();
|
||
|
||
theApp.m_pTdManager->DeleteIpsp3DTd(dwTdID);
|
||
theApp.m_pTdManager->DeleteObjInMem(m_handleProcessor.GenerateHandle(dwTdID, PZ_STYLE_TD_3DIPSP));
|
||
}
|
||
catch (_com_error e)
|
||
{
|
||
m_pConnection->RollbackTrans();
|
||
return APP_ERR_DB;
|
||
}
|
||
|
||
m_pConnection->CommitTrans();
|
||
|
||
return uExecCode;
|
||
}
|
||
|
||
UINT CDataOperator::DeleteSP2DTdInDB(DWORD dwTdID)
|
||
{
|
||
UINT uExecCode = (UINT)APP_SUCCESS;
|
||
_RecordsetPtr pRecTd = NULL;
|
||
pRecTd.CreateInstance(_uuidof(Recordset));
|
||
|
||
try
|
||
{
|
||
m_pConnection->BeginTrans();
|
||
|
||
theApp.m_pTdManager->DeleteSP2DTd(dwTdID);
|
||
theApp.m_pTdManager->DeleteObjInMem(m_handleProcessor.GenerateHandle(dwTdID, PZ_STYLE_TD_2DSP));
|
||
}
|
||
catch (_com_error e)
|
||
{
|
||
m_pConnection->RollbackTrans();
|
||
return APP_ERR_DB;
|
||
}
|
||
|
||
m_pConnection->CommitTrans();
|
||
|
||
return uExecCode;
|
||
}
|
||
|
||
UINT CDataOperator::DeleteSP3DTdInDB(DWORD dwTdID)
|
||
{
|
||
UINT uExecCode = (UINT)APP_SUCCESS;
|
||
_RecordsetPtr pRecTd = NULL;
|
||
pRecTd.CreateInstance(_uuidof(Recordset));
|
||
|
||
try
|
||
{
|
||
m_pConnection->BeginTrans();
|
||
|
||
theApp.m_pTdManager->DeleteSP3DTd(dwTdID);
|
||
theApp.m_pTdManager->DeleteObjInMem(m_handleProcessor.GenerateHandle(dwTdID, PZ_STYLE_TD_3DIPSP));
|
||
}
|
||
catch (_com_error e)
|
||
{
|
||
m_pConnection->RollbackTrans();
|
||
return APP_ERR_DB;
|
||
}
|
||
|
||
m_pConnection->CommitTrans();
|
||
|
||
return uExecCode;
|
||
}
|
||
|
||
UINT CDataOperator::DeleteSPCETdInDB(DWORD dwTdID)
|
||
{
|
||
UINT uExecCode = (UINT)APP_SUCCESS;
|
||
_RecordsetPtr pRecTd = NULL;
|
||
pRecTd.CreateInstance(_uuidof(Recordset));
|
||
|
||
try
|
||
{
|
||
m_pConnection->BeginTrans();
|
||
|
||
theApp.m_pTdManager->DeleteSPCETd(dwTdID);
|
||
theApp.m_pTdManager->DeleteObjInMem(m_handleProcessor.GenerateHandle(dwTdID, PZ_STYLE_TD_CESP));
|
||
}
|
||
catch (_com_error e)
|
||
{
|
||
m_pConnection->RollbackTrans();
|
||
return APP_ERR_DB;
|
||
}
|
||
|
||
m_pConnection->CommitTrans();
|
||
|
||
return uExecCode;
|
||
}
|
||
|
||
|
||
UINT CDataOperator::ExportIP2DToDAT(CNavDataView *pNavDataView, CString f_szFileName)
|
||
{
|
||
UINT uExecCode = (UINT)APP_SUCCESS;
|
||
DWORD dwTdHandle = (DWORD)VAL_ZERO;
|
||
HTREEITEM hTdItem = NULL;
|
||
|
||
CTreeCtrl& dataTree = pNavDataView->m_dataTree;
|
||
|
||
hTdItem = dataTree.GetSelectedItem();
|
||
|
||
dwTdHandle = dataTree.GetItemData(hTdItem);
|
||
if (TRUE == m_BatchExportFlag)
|
||
{
|
||
dwTdHandle = m_dwItemHandle;
|
||
}
|
||
|
||
try
|
||
{
|
||
if (true != theApp.m_pTdManager->GetTestingData(dwTdHandle)->ExportIP2DDataToDat(f_szFileName))
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
}
|
||
catch (...)
|
||
{
|
||
uExecCode = (UINT)APP_SUCCESS;
|
||
}
|
||
return uExecCode;
|
||
|
||
}
|
||
|
||
|
||
UINT CDataOperator::ExportIP2DToTxt(CNavDataView *pNavDataView, CString f_szFileName)
|
||
{
|
||
UINT uExecCode = (UINT)APP_SUCCESS;
|
||
DWORD dwTdHandle = (DWORD)VAL_ZERO;
|
||
HTREEITEM hTdItem = NULL;
|
||
|
||
CTreeCtrl& dataTree = pNavDataView->m_dataTree;
|
||
|
||
hTdItem = dataTree.GetSelectedItem();
|
||
|
||
dwTdHandle = dataTree.GetItemData(hTdItem);
|
||
if (TRUE == m_BatchExportFlag)
|
||
{
|
||
dwTdHandle = m_dwItemHandle;
|
||
}
|
||
|
||
try
|
||
{
|
||
if (true != theApp.m_pTdManager->GetTestingData(dwTdHandle)->ExportIPDataToTxt(f_szFileName))
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
}
|
||
catch (...)
|
||
{
|
||
uExecCode = (UINT)APP_SUCCESS;
|
||
}
|
||
return uExecCode;
|
||
|
||
}
|
||
|
||
UINT CDataOperator::ExportIP3DToTxt(CNavDataView *pNavDataView, CString f_szFileName)
|
||
{
|
||
UINT uExecCode = (UINT)APP_SUCCESS;
|
||
DWORD dwTdHandle = (DWORD)VAL_ZERO;
|
||
HTREEITEM hTdItem = NULL;
|
||
|
||
CTreeCtrl& dataTree = pNavDataView->m_dataTree;
|
||
|
||
hTdItem = dataTree.GetSelectedItem();
|
||
|
||
dwTdHandle = dataTree.GetItemData(hTdItem);
|
||
if (TRUE == m_BatchExportFlag)
|
||
{
|
||
dwTdHandle = m_dwItemHandle;
|
||
}
|
||
|
||
try
|
||
{
|
||
if (true != theApp.m_pTdManager->GetTestingData(dwTdHandle)->ExportIPDataToTxt(f_szFileName))
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
}
|
||
catch (_com_error e)
|
||
{
|
||
AfxMessageBox(e.Description());
|
||
uExecCode = (UINT)APP_SUCCESS;
|
||
}
|
||
return uExecCode;
|
||
|
||
}
|
||
|
||
UINT CDataOperator::ExportIP1DToTxt(CNavDataView *pNavDataView, CString f_szFileName)
|
||
{
|
||
UINT uExecCode = (UINT)APP_SUCCESS;
|
||
DWORD dwTdHandle = (DWORD)VAL_ZERO;
|
||
HTREEITEM hTdItem = NULL;
|
||
|
||
CTreeCtrl& dataTree = pNavDataView->m_dataTree;
|
||
|
||
hTdItem = dataTree.GetSelectedItem();
|
||
|
||
dwTdHandle = dataTree.GetItemData(hTdItem);
|
||
if (TRUE == m_BatchExportFlag)
|
||
{
|
||
dwTdHandle = m_dwItemHandle;
|
||
}
|
||
try
|
||
{
|
||
if (true != theApp.m_pTdManager->GetTestingData(dwTdHandle)->ExportIPDataToTxt(f_szFileName))
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
}
|
||
catch (_com_error e)
|
||
{
|
||
AfxMessageBox(e.Description());
|
||
uExecCode = (UINT)APP_SUCCESS;
|
||
}
|
||
return uExecCode;
|
||
|
||
}
|
||
|
||
UINT CDataOperator::ExportIP3DToDAT(CNavDataView *pNavDataView, CString f_szFileName)
|
||
{
|
||
|
||
UINT uExecCode = (UINT)APP_SUCCESS;
|
||
DWORD dwTdHandle = (DWORD)VAL_ZERO;
|
||
HTREEITEM hTdItem = NULL;
|
||
|
||
CTreeCtrl& dataTree = pNavDataView->m_dataTree;
|
||
|
||
hTdItem = dataTree.GetSelectedItem();
|
||
|
||
dwTdHandle = dataTree.GetItemData(hTdItem);
|
||
|
||
if (TRUE == m_BatchExportFlag)
|
||
{
|
||
dwTdHandle = m_dwItemHandle;
|
||
}
|
||
|
||
try
|
||
{
|
||
if (true != theApp.m_pTdManager->GetTestingData(dwTdHandle)->ExportIP3DToDatFile(f_szFileName))
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
}
|
||
catch (_com_error e)
|
||
{
|
||
AfxMessageBox(e.Description());
|
||
uExecCode = (UINT)APP_SUCCESS;
|
||
}
|
||
return uExecCode;
|
||
|
||
}
|
||
UINT CDataOperator::ExportRsp2DTdToDAT(CNavDataView *pNavDataView, CString f_szFileName)
|
||
{
|
||
|
||
UINT uExecCode = (UINT)APP_SUCCESS;
|
||
DWORD dwTdHandle = (DWORD)VAL_ZERO;
|
||
HTREEITEM hTdItem = NULL;
|
||
|
||
CTreeCtrl& dataTree = pNavDataView->m_dataTree;
|
||
|
||
|
||
hTdItem = dataTree.GetSelectedItem();
|
||
|
||
dwTdHandle = dataTree.GetItemData(hTdItem);
|
||
|
||
if (TRUE == m_BatchExportFlag)
|
||
{
|
||
dwTdHandle = m_dwItemHandle;
|
||
}
|
||
|
||
try
|
||
{
|
||
if (TRUE != theApp.m_pTdManager->GetTestingData(dwTdHandle)->SaveTdToRes2DFile(f_szFileName))
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
}
|
||
catch (...)
|
||
{
|
||
uExecCode = (UINT)APP_SUCCESS;
|
||
}
|
||
return uExecCode;
|
||
|
||
|
||
}
|
||
|
||
UINT CDataOperator::ExportRsp2DTdToExcel(CNavDataView *pNavDataView, CString f_szFileName)
|
||
{
|
||
UINT uExecCode = (UINT)APP_SUCCESS;
|
||
DWORD dwTdHandle = (DWORD)VAL_ZERO;
|
||
HTREEITEM hTdItem = NULL;
|
||
|
||
CTreeCtrl& dataTree = pNavDataView->m_dataTree;
|
||
|
||
hTdItem = dataTree.GetSelectedItem();
|
||
|
||
dwTdHandle = dataTree.GetItemData(hTdItem);
|
||
if (TRUE == m_BatchExportFlag)
|
||
{
|
||
dwTdHandle = m_dwItemHandle;
|
||
}
|
||
|
||
try
|
||
{
|
||
if (TRUE != theApp.m_pTdManager->GetTestingData(dwTdHandle)->SaveTdToExcelFile(f_szFileName))
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
}
|
||
catch (...)
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
return uExecCode;
|
||
}
|
||
|
||
UINT CDataOperator::ExportRsp2DTdToCSV(CNavDataView *pNavDataView, CString f_szFileName)
|
||
{
|
||
UINT uExecCode = (UINT)APP_SUCCESS;
|
||
DWORD dwTdHandle = (DWORD)VAL_ZERO;
|
||
HTREEITEM hTdItem = NULL;
|
||
|
||
CTreeCtrl& dataTree = pNavDataView->m_dataTree;
|
||
|
||
hTdItem = dataTree.GetSelectedItem();
|
||
|
||
dwTdHandle = dataTree.GetItemData(hTdItem);
|
||
if (TRUE == m_BatchExportFlag)
|
||
{
|
||
dwTdHandle = m_dwItemHandle;
|
||
}
|
||
|
||
try
|
||
{
|
||
if (TRUE != theApp.m_pTdManager->GetTestingData(dwTdHandle)->SaveTdToCsvFile(f_szFileName))
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
}
|
||
catch (...)
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
return uExecCode;
|
||
}
|
||
|
||
UINT CDataOperator::ExportRsp2DTdToUrf(CNavDataView *pNavDataView, CString f_szFileName)
|
||
{
|
||
UINT uExecCode = (UINT)APP_SUCCESS;
|
||
DWORD dwTdHandle = (DWORD)VAL_ZERO;
|
||
HTREEITEM hTdItem = NULL;
|
||
|
||
CTreeCtrl& dataTree = pNavDataView->m_dataTree;
|
||
|
||
hTdItem = dataTree.GetSelectedItem();
|
||
|
||
dwTdHandle = dataTree.GetItemData(hTdItem);
|
||
if (TRUE == m_BatchExportFlag)
|
||
{
|
||
dwTdHandle = m_dwItemHandle;
|
||
}
|
||
try
|
||
{
|
||
if (TRUE != theApp.m_pTdManager->GetTestingData(dwTdHandle)->ExportDataToUrf(f_szFileName))
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
}
|
||
catch (...)
|
||
{
|
||
uExecCode = (UINT)APP_SUCCESS;
|
||
}
|
||
return uExecCode;
|
||
}
|
||
|
||
|
||
UINT CDataOperator::ExportRsp2DTdToTxt(CNavDataView *pNavDataView, CString f_szFileName)
|
||
{
|
||
UINT uExecCode = (UINT)APP_SUCCESS;
|
||
DWORD dwTdHandle = (DWORD)VAL_ZERO;
|
||
HTREEITEM hTdItem = NULL;
|
||
|
||
CTreeCtrl& dataTree = pNavDataView->m_dataTree;
|
||
|
||
hTdItem = dataTree.GetSelectedItem();
|
||
|
||
dwTdHandle = dataTree.GetItemData(hTdItem);
|
||
if (TRUE == m_BatchExportFlag)
|
||
{
|
||
dwTdHandle = m_dwItemHandle;
|
||
}
|
||
try
|
||
{
|
||
if (TRUE != theApp.m_pTdManager->GetTestingData(dwTdHandle)->ExportResDataToTxt(f_szFileName))
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
}
|
||
catch (...)
|
||
{
|
||
uExecCode = (UINT)APP_SUCCESS;
|
||
}
|
||
return uExecCode;
|
||
}
|
||
|
||
|
||
UINT CDataOperator::ExportRspCETdToExcel(CNavDataView *pNavDataView, CString f_szFileName)
|
||
{
|
||
UINT uExecCode = (UINT)APP_SUCCESS;
|
||
DWORD dwTdHandle = (DWORD)VAL_ZERO;
|
||
HTREEITEM hTdItem = NULL;
|
||
|
||
CTreeCtrl& dataTree = pNavDataView->m_dataTree;
|
||
|
||
hTdItem = dataTree.GetSelectedItem();
|
||
|
||
dwTdHandle = dataTree.GetItemData(hTdItem);
|
||
if (TRUE == m_BatchExportFlag)
|
||
{
|
||
dwTdHandle = m_dwItemHandle;
|
||
}
|
||
try
|
||
{
|
||
if (TRUE != theApp.m_pTdManager->GetTestingData(dwTdHandle)->SaveTdToExcelFile(f_szFileName))
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
}
|
||
catch (...)
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
|
||
return uExecCode;
|
||
}
|
||
UINT CDataOperator::ExportRspCETdToCSV(CNavDataView *pNavDataView, CString f_szFileName)
|
||
{
|
||
UINT uExecCode = (UINT)APP_SUCCESS;
|
||
DWORD dwTdHandle = (DWORD)VAL_ZERO;
|
||
HTREEITEM hTdItem = NULL;
|
||
|
||
CTreeCtrl& dataTree = pNavDataView->m_dataTree;
|
||
|
||
hTdItem = dataTree.GetSelectedItem();
|
||
|
||
dwTdHandle = dataTree.GetItemData(hTdItem);
|
||
if (TRUE == m_BatchExportFlag)
|
||
{
|
||
dwTdHandle = m_dwItemHandle;
|
||
}
|
||
try
|
||
{
|
||
if (TRUE != theApp.m_pTdManager->GetTestingData(dwTdHandle)->SaveTdToCsvFile(f_szFileName))
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
}
|
||
catch (...)
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
|
||
return uExecCode;
|
||
}
|
||
UINT CDataOperator::ExportRsp1DTdToTxt(CNavDataView *pNavDataView, CString f_szFileName)
|
||
{
|
||
UINT uExecCode = (UINT)APP_SUCCESS;
|
||
DWORD dwTdHandle = (DWORD)VAL_ZERO;
|
||
HTREEITEM hTdItem = NULL;
|
||
|
||
CTreeCtrl& dataTree = pNavDataView->m_dataTree;
|
||
|
||
hTdItem = dataTree.GetSelectedItem();
|
||
|
||
dwTdHandle = dataTree.GetItemData(hTdItem);
|
||
if (TRUE == m_BatchExportFlag)
|
||
{
|
||
dwTdHandle = m_dwItemHandle;
|
||
}
|
||
try
|
||
{
|
||
if (TRUE != theApp.m_pTdManager->GetTestingData(dwTdHandle)->ExportResDataToTxt(f_szFileName))
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
}
|
||
catch (...)
|
||
{
|
||
uExecCode = (UINT)APP_SUCCESS;
|
||
}
|
||
|
||
return uExecCode;
|
||
}
|
||
|
||
UINT CDataOperator::DisplayRsp3DTdGraph(CNavDataView *pNavDataView)
|
||
{
|
||
return 0;
|
||
}
|
||
|
||
UINT CDataOperator::DisplayRsp2DTdGraph(CNavDataView *pNavDataView)
|
||
{
|
||
UINT uExecCode = (UINT)APP_SUCCESS;
|
||
DWORD dwTdHandle = (DWORD)VAL_ZERO;
|
||
HTREEITEM hTdItem = NULL;
|
||
|
||
CTreeCtrl& dataTree = pNavDataView->m_dataTree;
|
||
|
||
hTdItem = dataTree.GetSelectedItem();
|
||
|
||
dwTdHandle = dataTree.GetItemData(hTdItem);
|
||
|
||
try
|
||
{
|
||
theApp.m_pTdManager->GetTestingData(dwTdHandle)->LoadData(theApp.m_pSptManager->m_medLinkList);
|
||
if (TRUE != theApp.m_pTdManager->GetTestingData(dwTdHandle)->DisplayGraph())
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
}
|
||
catch (...)
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
return uExecCode;
|
||
}
|
||
|
||
UINT CDataOperator::DisplayRspCETdGraph(CNavDataView *pNavDataView)
|
||
{
|
||
UINT uExecCode = (UINT)APP_SUCCESS;
|
||
DWORD dwTdHandle = (DWORD)VAL_ZERO;
|
||
HTREEITEM hTdItem = NULL;
|
||
|
||
CTreeCtrl& dataTree = pNavDataView->m_dataTree;
|
||
|
||
hTdItem = dataTree.GetSelectedItem();
|
||
|
||
dwTdHandle = dataTree.GetItemData(hTdItem);
|
||
|
||
try
|
||
{
|
||
theApp.m_pTdManager->GetTestingData(dwTdHandle)->LoadData(theApp.m_pSptManager->m_medLinkList);
|
||
if (TRUE != theApp.m_pTdManager->GetTestingData(dwTdHandle)->DisplayGraph())
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
}
|
||
catch (...)
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
return uExecCode;
|
||
}
|
||
|
||
UINT CDataOperator::DisplayTPSplinesGraph(CNavDataView *pNavDataView, int iTSN)
|
||
{
|
||
CTdChannel* pTdChannel = NULL;
|
||
|
||
UINT uExecCode = (UINT)APP_SUCCESS;
|
||
DWORD dwTdHandle = (DWORD)VAL_ZERO;
|
||
HTREEITEM hTdItem = NULL;
|
||
|
||
CTreeCtrl& dataTree = pNavDataView->m_dataTree;
|
||
|
||
hTdItem = dataTree.GetSelectedItem();
|
||
|
||
dwTdHandle = dataTree.GetItemData(hTdItem);
|
||
|
||
try
|
||
{
|
||
theApp.m_pTdManager->GetTestingData(dwTdHandle)->LoadData(theApp.m_pSptManager->m_medLinkList);
|
||
// pTdChannel = (CTdChannel*)theApp.m_pTdManager->GetTestingData(dwTdHandle)->m_tdChaList.GetAt(theApp.m_pTdManager->GetTestingData(dwTdHandle)->m_tdChaList.FindIndex(0));
|
||
|
||
// pTdChannel->GetTdRecord(iTSN)->LoadOrgData();
|
||
|
||
if (TRUE != theApp.m_pTdManager->GetTestingData(dwTdHandle)->DisplayTPSplinesGraph(iTSN))
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
}
|
||
catch (...)
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
return uExecCode;
|
||
}
|
||
|
||
|
||
//DEL UINT CDataOperator::DeleteTzInLoc(CNavDataView* pNavDataView)
|
||
//DEL {
|
||
//DEL UINT uExecCode = (UINT)VAL_ZERO;
|
||
//DEL
|
||
//DEL CString szCaption;
|
||
//DEL
|
||
//DEL HTREEITEM hTzItem = NULL;
|
||
//DEL HTREEITEM hPreItem = NULL;
|
||
//DEL HTREEITEM hCurItem = NULL;
|
||
//DEL
|
||
//DEL _RecordsetPtr pRecTz = NULL;
|
||
//DEL
|
||
//DEL _RecordsetPtr pRecTdList = NULL;
|
||
//DEL
|
||
//DEL DWORD dwHandle = (DWORD)VAL_ZERO;
|
||
//DEL DWORD dwID = (DWORD)VAL_ZERO;
|
||
//DEL
|
||
//DEL DWORD dwDevHandle = (DWORD)VAL_ZERO;
|
||
//DEL DWORD dwDevID = (DWORD)VAL_ZERO;
|
||
//DEL
|
||
//DEL DWORD dwTdID = (DWORD)VAL_ZERO;
|
||
//DEL CString szSql = _T("");
|
||
//DEL
|
||
//DEL /*
|
||
//DEL dwHandle = pNavDataView->m_navDevDlg.m_devTree.GetItemData(pNavDataView->m_navDevDlg.m_devTree.GetSelectedItem());
|
||
//DEL dwID = m_handleProcessor.GetIDFromHandle(dwHandle);
|
||
//DEL
|
||
//DEL hTzItem = pNavDataView->m_navDevDlg.m_devTree.GetSelectedItem();
|
||
//DEL hCurItem = hTzItem;
|
||
//DEL
|
||
//DEL while (NULL != hCurItem)
|
||
//DEL {
|
||
//DEL hPreItem = hCurItem;
|
||
//DEL hCurItem = pNavDataView->m_navDevDlg.m_devTree.GetParentItem(hCurItem);
|
||
//DEL }
|
||
//DEL
|
||
//DEL dwDevHandle = pNavDataView->m_navDevDlg.m_devTree.GetItemData(hPreItem);
|
||
//DEL dwDevID = m_handleProcessor.GetIDFromHandle(dwDevHandle);
|
||
//DEL
|
||
//DEL pRecTz.CreateInstance(_uuidof(Recordset));
|
||
//DEL pRecTdList.CreateInstance(_uuidof(Recordset));
|
||
//DEL
|
||
//DEL m_pConnection->BeginTrans();
|
||
//DEL
|
||
//DEL try
|
||
//DEL {
|
||
//DEL
|
||
//DEL szSql.Empty();
|
||
//DEL szSql.Format(_T("select ID,TDtype from td where DEID = %u and TZID = %u"), dwDevID, dwID);
|
||
//DEL pRecTdList->Open(szSql.AllocSysString(), _variant_t((IDispatch*)m_pConnection, true),
|
||
//DEL adOpenStatic, adLockOptimistic, adCmdText);
|
||
//DEL
|
||
//DEL if (VAL_ZERO != pRecTdList->GetRecordCount())
|
||
//DEL {
|
||
//DEL szCaption.Empty();
|
||
//DEL szCaption.LoadString(IDS_OP_LD_TZ_TD);
|
||
//DEL if (IDYES == AfxMessageBox(szCaption, MB_YESNO, MB_ICONQUESTION))
|
||
//DEL {
|
||
//DEL while ((short)VAL_ZERO == pRecTdList->adoEOF)
|
||
//DEL {
|
||
//DEL dwTdID = (DWORD)pRecTdList->GetCollect(_T("ID")).ulVal;
|
||
//DEL switch (pRecTdList->GetCollect(_T("TDtype")).iVal)
|
||
//DEL {
|
||
//DEL case 0:
|
||
//DEL theApp.m_pTdManager->DeleteRspTd(dwTdID);
|
||
//DEL theApp.m_pTdManager->DeleteObjInMem(m_handleProcessor.GenerateHandle(dwTdID, PZ_STYLE_TD_RSP));
|
||
//DEL break;
|
||
//DEL case 1:
|
||
//DEL theApp.m_pTdManager->DeleteIpspTd(dwTdID);
|
||
//DEL theApp.m_pTdManager->DeleteObjInMem(m_handleProcessor.GenerateHandle(dwTdID, PZ_STYLE_TD_IPSP));
|
||
//DEL break;
|
||
//DEL default:
|
||
//DEL break;
|
||
//DEL }
|
||
//DEL pRecTdList->MoveNext();
|
||
//DEL }
|
||
//DEL }
|
||
//DEL }
|
||
//DEL pRecTdList->Close();
|
||
//DEL
|
||
//DEL theApp.m_pProManager->DeleteTzInLoc(dwID, dwDevID);
|
||
//DEL }
|
||
//DEL catch (_com_error e)
|
||
//DEL {
|
||
//DEL AfxMessageBox((LPCTSTR)e.Description(), MB_ICONINFORMATION);
|
||
//DEL m_pConnection->RollbackTrans();
|
||
//DEL return APP_ERR_DB;
|
||
//DEL }
|
||
//DEL
|
||
//DEL m_pConnection->CommitTrans();
|
||
//DEL
|
||
//DEL InitialNavDataProDlg(pNavDataView->m_navProDlg);
|
||
//DEL
|
||
//DEL pNavDataView->m_navDevDlg.m_devTree.SelectItem(pNavDataView->m_navDevDlg.m_devTree.GetParentItem(hTzItem));
|
||
//DEL pNavDataView->m_navDevDlg.m_devTree.DeleteItem(hTzItem);
|
||
//DEL */
|
||
//DEL return uExecCode;
|
||
//DEL }
|
||
|
||
//DEL UINT CDataOperator::CreateDmsInOffline(CNavDataView *pNavDataView)
|
||
//DEL {
|
||
//DEL HTREEITEM hDevItem = NULL;
|
||
//DEL HTREEITEM hProItem = NULL;
|
||
//DEL _RecordsetPtr pRecPro = NULL;
|
||
//DEL _RecordsetPtr pRecTz = NULL;
|
||
//DEL DWORD dwDevHandle = (DWORD)VAL_ZERO;
|
||
//DEL DWORD dwDevID = (DWORD)VAL_ZERO;
|
||
//DEL
|
||
//DEL UINT uImageState = (UINT)VAL_ZERO;
|
||
//DEL UINT uExecCode = (UINT)VAL_ZERO;
|
||
//DEL
|
||
//DEL CString szSql = _T("");
|
||
//DEL /*
|
||
//DEL pRecPro.CreateInstance(_uuidof(Recordset));
|
||
//DEL pRecTz.CreateInstance(_uuidof(Recordset));
|
||
//DEL
|
||
//DEL m_pConnection->BeginTrans();
|
||
//DEL
|
||
//DEL try
|
||
//DEL {
|
||
//DEL hDevItem = pNavDataView->m_navDevDlg.m_devTree.GetSelectedItem();
|
||
//DEL dwDevHandle = pNavDataView->m_navDevDlg.m_devTree.GetItemData(hDevItem);
|
||
//DEL dwDevID = m_handleProcessor.GetIDFromHandle(dwDevHandle);
|
||
//DEL
|
||
//DEL uExecCode = theApp.m_pProManager->CreateDMSInOffline(dwDevID);
|
||
//DEL m_pConnection->CommitTrans();
|
||
//DEL }
|
||
//DEL catch (_com_error e)
|
||
//DEL {
|
||
//DEL m_pConnection->RollbackTrans();
|
||
//DEL return APP_ERR_DB;
|
||
//DEL }
|
||
//DEL
|
||
//DEL if (APP_SUCCESS == uExecCode)
|
||
//DEL {
|
||
//DEL AddDmsInDevTreeByLoc(pNavDataView->m_navDevDlg);
|
||
//DEL
|
||
//DEL pNavDataView->m_navDevDlg.m_devTree.Expand(hDevItem, TVE_EXPAND);
|
||
//DEL
|
||
//DEL pNavDataView->m_navDevDlg.m_devTree.SelectItem(NULL);
|
||
//DEL pNavDataView->m_navDevDlg.m_devTree.SelectItem(hDevItem);
|
||
//DEL
|
||
//DEL }
|
||
//DEL */
|
||
//DEL return uExecCode;
|
||
//DEL }
|
||
|
||
//DEL HTREEITEM CDataOperator::FindProItemInNavDevTree(DWORD dwDevID, CString szProCn, CTreeCtrl& devTree)
|
||
//DEL {
|
||
//DEL HTREEITEM hDevItem = NULL;
|
||
//DEL HTREEITEM hProItem = NULL;
|
||
//DEL _RecordsetPtr pRecProID = NULL;
|
||
//DEL
|
||
//DEL DWORD dwDevHandle = (DWORD)VAL_ZERO;
|
||
//DEL DWORD dwProHandle = (DWORD)VAL_ZERO;
|
||
//DEL DWORD dwProID = (DWORD)VAL_ZERO;
|
||
//DEL
|
||
//DEL CString szSql;
|
||
//DEL pRecProID.CreateInstance(_uuidof(Recordset));
|
||
//DEL
|
||
//DEL szSql.Empty();
|
||
//DEL szSql.Format(_T("select ID from project where CN = '%s'"), szProCn);
|
||
//DEL
|
||
//DEL pRecProID->Open(szSql.AllocSysString(), _variant_t((IDispatch*)m_pConnection, true),
|
||
//DEL adOpenStatic, adLockOptimistic, adCmdText);
|
||
//DEL
|
||
//DEL if ((long)VAL_ZERO != pRecProID->GetRecordCount())
|
||
//DEL {
|
||
//DEL dwProID = pRecProID->GetCollect(_T("ID")).ulVal;
|
||
//DEL
|
||
//DEL dwProHandle = m_handleProcessor.GenerateHandle(dwProID, PZ_STYLE_PRO);
|
||
//DEL dwDevHandle = m_handleProcessor.GenerateHandle(dwDevID, PZ_STYLE_DEV_DATA);
|
||
//DEL
|
||
//DEL hDevItem = devTree.GetRootItem();
|
||
//DEL
|
||
//DEL while (NULL != hDevItem)
|
||
//DEL {
|
||
//DEL if ((devTree.GetItemData(hDevItem) == dwDevHandle) && (devTree.ItemHasChildren(hDevItem)))
|
||
//DEL {
|
||
//DEL hProItem = devTree.GetChildItem(hDevItem);
|
||
//DEL while (NULL != hProItem)
|
||
//DEL {
|
||
//DEL if (devTree.GetItemData(hProItem) == dwProHandle)
|
||
//DEL {
|
||
//DEL return hProItem;
|
||
//DEL }
|
||
//DEL hProItem = devTree.GetNextSiblingItem(hProItem);
|
||
//DEL }
|
||
//DEL }
|
||
//DEL hDevItem = devTree.GetNextSiblingItem(hDevItem);
|
||
//DEL }
|
||
//DEL }
|
||
//DEL
|
||
//DEL pRecProID->Close();
|
||
//DEL return NULL;
|
||
//DEL }
|
||
|
||
//DEL HTREEITEM CDataOperator::FindTzItemInNavDevTree(DWORD dwDevID, DWORD dwProID, CString szTzName, CTreeCtrl& devTree)
|
||
//DEL {
|
||
//DEL HTREEITEM hDevItem = NULL;
|
||
//DEL HTREEITEM hProItem = NULL;
|
||
//DEL HTREEITEM hTzItem = NULL;
|
||
//DEL
|
||
//DEL DWORD dwDevHandle = (DWORD)VAL_ZERO;
|
||
//DEL DWORD dwProHandle = (DWORD)VAL_ZERO;
|
||
//DEL
|
||
//DEL CString szSql;
|
||
//DEL
|
||
//DEL dwProHandle = m_handleProcessor.GenerateHandle(dwProID, PZ_STYLE_PRO);
|
||
//DEL dwDevHandle = m_handleProcessor.GenerateHandle(dwDevID, PZ_STYLE_DEV_DATA);
|
||
//DEL
|
||
//DEL hDevItem = devTree.GetRootItem();
|
||
//DEL
|
||
//DEL while (NULL != hDevItem)
|
||
//DEL {
|
||
//DEL if ((devTree.GetItemData(hDevItem) == dwDevHandle) && (devTree.ItemHasChildren(hDevItem)))
|
||
//DEL {
|
||
//DEL hProItem = devTree.GetChildItem(hDevItem);
|
||
//DEL while (NULL != hProItem)
|
||
//DEL {
|
||
//DEL if ((devTree.GetItemData(hProItem) == dwProHandle) && (devTree.ItemHasChildren(hProItem)))
|
||
//DEL {
|
||
//DEL hTzItem = devTree.GetChildItem(hProItem);
|
||
//DEL while (NULL != hTzItem)
|
||
//DEL {
|
||
//DEL if (devTree.GetItemText(hTzItem) == szTzName)
|
||
//DEL {
|
||
//DEL return hTzItem;
|
||
//DEL }
|
||
//DEL hTzItem = devTree.GetNextSiblingItem(hTzItem);
|
||
//DEL }
|
||
//DEL }
|
||
//DEL hProItem = devTree.GetNextSiblingItem(hProItem);
|
||
//DEL }
|
||
//DEL }
|
||
//DEL hDevItem = devTree.GetNextSiblingItem(hDevItem);
|
||
//DEL }
|
||
//DEL return NULL;
|
||
//DEL }
|
||
|
||
//DEL HTREEITEM CDataOperator::FindProItemInNavDevTree(DWORD dwDevID, DWORD dwProID, CTreeCtrl &devTree)
|
||
//DEL {
|
||
//DEL HTREEITEM hDevItem = NULL;
|
||
//DEL HTREEITEM hProItem = NULL;
|
||
//DEL
|
||
//DEL DWORD dwDevHandle = (DWORD)VAL_ZERO;
|
||
//DEL DWORD dwProHandle = (DWORD)VAL_ZERO;
|
||
//DEL
|
||
//DEL CString szSql;
|
||
//DEL
|
||
//DEL dwProHandle = m_handleProcessor.GenerateHandle(dwProID, PZ_STYLE_PRO);
|
||
//DEL dwDevHandle = m_handleProcessor.GenerateHandle(dwDevID, PZ_STYLE_DEV_DATA);
|
||
//DEL
|
||
//DEL hDevItem = devTree.GetRootItem();
|
||
//DEL
|
||
//DEL while (NULL != hDevItem)
|
||
//DEL {
|
||
//DEL if ((devTree.GetItemData(hDevItem) == dwDevHandle) && (devTree.ItemHasChildren(hDevItem)))
|
||
//DEL {
|
||
//DEL hProItem = devTree.GetChildItem(hDevItem);
|
||
//DEL while (NULL != hProItem)
|
||
//DEL {
|
||
//DEL if (devTree.GetItemData(hProItem) == dwProHandle)
|
||
//DEL {
|
||
//DEL return hProItem;
|
||
//DEL }
|
||
//DEL hProItem = devTree.GetNextSiblingItem(hProItem);
|
||
//DEL }
|
||
//DEL }
|
||
//DEL hDevItem = devTree.GetNextSiblingItem(hDevItem);
|
||
//DEL }
|
||
//DEL
|
||
//DEL return NULL;
|
||
//DEL }
|
||
|
||
//DEL HTREEITEM CDataOperator::FindTzItemInNavDevTree(DWORD dwDevID, DWORD dwProID, DWORD dwTzID, CTreeCtrl& devTree)
|
||
//DEL {
|
||
//DEL HTREEITEM hDevItem = NULL;
|
||
//DEL HTREEITEM hProItem = NULL;
|
||
//DEL HTREEITEM hTzItem = NULL;
|
||
//DEL
|
||
//DEL _RecordsetPtr pRecTz = NULL;
|
||
//DEL
|
||
//DEL DWORD dwDevHandle = (DWORD)VAL_ZERO;
|
||
//DEL DWORD dwProHandle = (DWORD)VAL_ZERO;
|
||
//DEL DWORD dwTzHandle = (DWORD)VAL_ZERO;
|
||
//DEL
|
||
//DEL CString szTzName;
|
||
//DEL CString szSql;
|
||
//DEL
|
||
//DEL pRecTz.CreateInstance(_uuidof(Recordset));
|
||
//DEL
|
||
//DEL szSql.Empty();
|
||
//DEL szSql.Format(_T("select TZname from tz where ID = %u"), dwTzID);
|
||
//DEL pRecTz->Open(szSql.AllocSysString(), _variant_t((IDispatch*)m_pConnection, true), adOpenStatic, adLockOptimistic, adCmdText);
|
||
//DEL
|
||
//DEL if ((long)VAL_ZERO != pRecTz->GetRecordCount())
|
||
//DEL {
|
||
//DEL szTzName.Empty();
|
||
//DEL szTzName = (LPCTSTR)(_bstr_t)pRecTz->GetCollect(_T("TZname"));
|
||
//DEL pRecTz->Close();
|
||
//DEL }
|
||
//DEL else
|
||
//DEL {
|
||
//DEL pRecTz->Close();
|
||
//DEL return NULL;
|
||
//DEL }
|
||
//DEL
|
||
//DEL dwProHandle = m_handleProcessor.GenerateHandle(dwProID, PZ_STYLE_PRO);
|
||
//DEL dwDevHandle = m_handleProcessor.GenerateHandle(dwDevID, PZ_STYLE_DEV_DATA);
|
||
//DEL
|
||
//DEL hDevItem = devTree.GetRootItem();
|
||
//DEL
|
||
//DEL while (NULL != hDevItem)
|
||
//DEL {
|
||
//DEL if ((devTree.GetItemData(hDevItem) == dwDevHandle) && (devTree.ItemHasChildren(hDevItem)))
|
||
//DEL {
|
||
//DEL hProItem = devTree.GetChildItem(hDevItem);
|
||
//DEL while (NULL != hProItem)
|
||
//DEL {
|
||
//DEL if ((devTree.GetItemData(hProItem) == dwProHandle) && (devTree.ItemHasChildren(hProItem)))
|
||
//DEL {
|
||
//DEL hTzItem = devTree.GetChildItem(hProItem);
|
||
//DEL while (NULL != hTzItem)
|
||
//DEL {
|
||
//DEL if (devTree.GetItemText(hTzItem) == szTzName)
|
||
//DEL {
|
||
//DEL return hTzItem;
|
||
//DEL }
|
||
//DEL hTzItem = devTree.GetNextSiblingItem(hTzItem);
|
||
//DEL }
|
||
//DEL }
|
||
//DEL hProItem = devTree.GetNextSiblingItem(hProItem);
|
||
//DEL }
|
||
//DEL }
|
||
//DEL hDevItem = devTree.GetNextSiblingItem(hDevItem);
|
||
//DEL }
|
||
//DEL return NULL;
|
||
//DEL }
|
||
|
||
//DEL bool CDataOperator::AddDmsInDevTreeByLoc(CNavDataDevDlg& navDataDevDlg)
|
||
//DEL {
|
||
//DEL HTREEITEM hDevItem = NULL;
|
||
//DEL HTREEITEM hProItem = NULL;
|
||
//DEL HTREEITEM hTzItem = NULL;
|
||
//DEL
|
||
//DEL _RecordsetPtr pRecPro = NULL;
|
||
//DEL _RecordsetPtr pRecTz = NULL;
|
||
//DEL
|
||
//DEL _RecordsetPtr pRecProID = NULL;
|
||
//DEL _RecordsetPtr pRecTzID = NULL;
|
||
//DEL
|
||
//DEL DWORD dwProHandle = (DWORD)VAL_ZERO;
|
||
//DEL DWORD dwDevHandle = (DWORD)VAL_ZERO;
|
||
//DEL DWORD dwTzHandle = (DWORD)VAL_ZERO;
|
||
//DEL
|
||
//DEL DWORD dwDevID = (DWORD)VAL_ZERO;
|
||
//DEL DWORD dwProID = (DWORD)VAL_ZERO;
|
||
//DEL DWORD dwTzID = (DWORD)VAL_ZERO;
|
||
//DEL
|
||
//DEL UINT uImageState = (UINT)VAL_ZERO;
|
||
//DEL CString szSql;
|
||
//DEL
|
||
//DEL pRecPro.CreateInstance(_uuidof(Recordset));
|
||
//DEL pRecTz.CreateInstance(_uuidof(Recordset));
|
||
//DEL pRecProID.CreateInstance(_uuidof(Recordset));
|
||
//DEL pRecTzID.CreateInstance(_uuidof(Recordset));
|
||
//DEL
|
||
//DEL hDevItem = navDataDevDlg.m_devTree.GetSelectedItem();
|
||
//DEL dwDevID = this->m_handleProcessor.GetIDFromHandle(navDataDevDlg.m_devTree.GetItemData(hDevItem));
|
||
//DEL
|
||
//DEL szSql.Empty();
|
||
//DEL szSql.Format(_T("select PRID from dptt where DEID = %u and TZID is null"), dwDevID);
|
||
//DEL pRecProID->Open(szSql.AllocSysString(), _variant_t((IDispatch*)m_pConnection, true), adOpenStatic, adLockOptimistic, adCmdText);
|
||
//DEL
|
||
//DEL while ((short)VAL_ZERO == pRecProID->adoEOF)
|
||
//DEL {
|
||
//DEL dwProID = (DWORD)pRecProID->GetCollect(_T("PRID")).ulVal;
|
||
//DEL
|
||
//DEL szSql.Empty();
|
||
//DEL szSql.Format(_T("select TZID from dptt where DEID = %u and PRID = %u and TZID is not null"), dwDevID, dwProID);
|
||
//DEL
|
||
//DEL pRecTzID->Open(szSql.AllocSysString(), _variant_t((IDispatch*)m_pConnection, true), adOpenStatic, adLockOptimistic, adCmdText);
|
||
//DEL
|
||
//DEL hProItem = FindProItemInNavDevTree(dwDevID, dwProID, navDataDevDlg.m_devTree);
|
||
//DEL
|
||
//DEL if (NULL != hProItem)
|
||
//DEL {
|
||
//DEL while ((short)VAL_ZERO == pRecTzID->adoEOF)
|
||
//DEL {
|
||
//DEL
|
||
//DEL dwTzID = (DWORD)pRecTzID->GetCollect(_T("TZID")).ulVal;
|
||
//DEL hTzItem = FindTzItemInNavDevTree(dwDevID, dwProID, dwTzID, navDataDevDlg.m_devTree);
|
||
//DEL
|
||
//DEL if (NULL == hTzItem)
|
||
//DEL {
|
||
//DEL AddTzInDevTreeByLoc(navDataDevDlg, dwDevID, dwTzID, hProItem);
|
||
//DEL //可在此处添加代码,将测区建立至设备
|
||
//DEL }
|
||
//DEL pRecTzID->MoveNext();
|
||
//DEL }
|
||
//DEL
|
||
//DEL }
|
||
//DEL else
|
||
//DEL {
|
||
//DEL szSql.Empty();
|
||
//DEL szSql.Format(_T("select PRname,CN from project where ID = %u"), dwProID);
|
||
//DEL pRecPro->Open(szSql.AllocSysString(), _variant_t((IDispatch*)m_pConnection, true), adOpenStatic, adLockOptimistic, adCmdText);
|
||
//DEL
|
||
//DEL hProItem = navDataDevDlg.m_devTree.InsertItem((LPCTSTR)(_bstr_t)pRecPro->GetCollect(_T("PRname")), hDevItem);
|
||
//DEL
|
||
//DEL dwProHandle = m_handleProcessor.GenerateHandle(dwProID, PZ_STYLE_PRO);
|
||
//DEL navDataDevDlg.m_devTree.SetItemData(hProItem, dwProHandle);
|
||
//DEL uImageState = m_stateProcessor.ChangeToImageState(PZ_STATE_LOC);
|
||
//DEL navDataDevDlg.m_devTree.SetItemState(hProItem, uImageState, TVIS_STATEIMAGEMASK);
|
||
//DEL
|
||
//DEL pRecPro->Close();
|
||
//DEL
|
||
//DEL //可在此处添加代码,将工程建立至设备,如CNS的值为true,则不可建立
|
||
//DEL
|
||
//DEL while ((short)VAL_ZERO == pRecTzID->adoEOF)
|
||
//DEL {
|
||
//DEL dwTzID = (DWORD)pRecTzID->GetCollect(_T("TZID")).ulVal;
|
||
//DEL
|
||
//DEL AddTzInDevTreeByLoc(navDataDevDlg, dwDevID, dwTzID, hProItem);
|
||
//DEL pRecTzID->MoveNext();
|
||
//DEL
|
||
//DEL //可在此处添加代码,将测区建立至设备
|
||
//DEL }
|
||
//DEL }
|
||
//DEL pRecTzID->Close();
|
||
//DEL
|
||
//DEL navDataDevDlg.m_devTree.Expand(hProItem, TVE_EXPAND);
|
||
//DEL pRecProID->MoveNext();
|
||
//DEL }
|
||
//DEL pRecProID->Close();
|
||
//DEL
|
||
//DEL return true;
|
||
//DEL }
|
||
|
||
//DEL UINT CDataOperator::DeleteAllProjectInLocByDev(CNavDataView* pNavDataView)
|
||
//DEL {
|
||
//DEL UINT uExecCode = (UINT)VAL_ZERO;
|
||
//DEL bool bIsDelTd = false;
|
||
//DEL
|
||
//DEL HTREEITEM hDevItem = NULL;
|
||
//DEL HTREEITEM hProItem = NULL;
|
||
//DEL
|
||
//DEL _RecordsetPtr pRecPro = NULL;
|
||
//DEL _RecordsetPtr pRecTz = NULL;
|
||
//DEL
|
||
//DEL _RecordsetPtr pRecProList = NULL;
|
||
//DEL _RecordsetPtr pRecTzList = NULL;
|
||
//DEL _RecordsetPtr pRecTdList = NULL;
|
||
//DEL
|
||
//DEL DWORD dwProHandle = (DWORD)VAL_ZERO;
|
||
//DEL DWORD dwProID = (DWORD)VAL_ZERO;
|
||
//DEL
|
||
//DEL DWORD dwDevHandle = (DWORD)VAL_ZERO;
|
||
//DEL DWORD dwDevID = (DWORD)VAL_ZERO;
|
||
//DEL
|
||
//DEL DWORD dwTdID = (DWORD)VAL_ZERO;
|
||
//DEL CString szSql = _T("");
|
||
//DEL CString szCaption = _T("");
|
||
//DEL /*
|
||
//DEL hDevItem = pNavDataView->m_navDevDlg.m_devTree.GetSelectedItem();
|
||
//DEL dwDevHandle = pNavDataView->m_navDevDlg.m_devTree.GetItemData(hDevItem);
|
||
//DEL dwDevID = m_handleProcessor.GetIDFromHandle(dwDevHandle);
|
||
//DEL
|
||
//DEL pRecPro.CreateInstance(_uuidof(Recordset));
|
||
//DEL pRecTz.CreateInstance(_uuidof(Recordset));
|
||
//DEL pRecProList.CreateInstance(_uuidof(Recordset));
|
||
//DEL pRecTzList.CreateInstance(_uuidof(Recordset));
|
||
//DEL pRecTdList.CreateInstance(_uuidof(Recordset));
|
||
//DEL
|
||
//DEL m_pConnection->BeginTrans();
|
||
//DEL
|
||
//DEL try
|
||
//DEL {
|
||
//DEL szSql.Empty();
|
||
//DEL szSql.Format(_T("select PRID from dptt where DEID = %u and TZID is null"), dwDevID);
|
||
//DEL pRecProList->Open(szSql.AllocSysString(), _variant_t((IDispatch*)m_pConnection, true), adOpenStatic, adLockOptimistic, adCmdText);
|
||
//DEL
|
||
//DEL szSql.Empty();
|
||
//DEL szSql.Format(_T("select * from td where DEID = %u"), dwDevID);
|
||
//DEL pRecTdList->Open(szSql.AllocSysString(), _variant_t((IDispatch*)m_pConnection, true),
|
||
//DEL adOpenStatic, adLockOptimistic, adCmdText);
|
||
//DEL
|
||
//DEL if (VAL_ZERO != pRecTdList->GetRecordCount())
|
||
//DEL {
|
||
//DEL szCaption.Empty();
|
||
//DEL szCaption.LoadString(IDS_OP_LD_DEV_TD);
|
||
//DEL if (IDYES == AfxMessageBox(szCaption, MB_YESNO, MB_ICONQUESTION))
|
||
//DEL {
|
||
//DEL bIsDelTd = true;
|
||
//DEL }
|
||
//DEL }
|
||
//DEL
|
||
//DEL pRecTdList->Close();
|
||
//DEL
|
||
//DEL while ((short)VAL_ZERO == pRecProList->adoEOF)
|
||
//DEL {
|
||
//DEL
|
||
//DEL dwProID = (DWORD)pRecProList->GetCollect(_T("PRID")).ulVal;
|
||
//DEL
|
||
//DEL szSql.Empty();
|
||
//DEL szSql.Format(_T("select TZID from dptt where DEID = %u and PRID = %u and TZID is not null"), dwDevID ,dwProID);
|
||
//DEL pRecTzList->Open(szSql.AllocSysString(), _variant_t((IDispatch*)m_pConnection, true),
|
||
//DEL adOpenStatic, adLockOptimistic, adCmdText);
|
||
//DEL
|
||
//DEL while ((short)VAL_ZERO == pRecTzList->adoEOF)
|
||
//DEL {
|
||
//DEL if (bIsDelTd)
|
||
//DEL {
|
||
//DEL szSql.Empty();
|
||
//DEL szSql.Format(_T("select ID,TDtype from td where DEID = %u and TZID = %u"), dwDevID, pRecTzList->GetCollect(_T("TZID")).ulVal);
|
||
//DEL pRecTdList->Open(szSql.AllocSysString(), _variant_t((IDispatch*)m_pConnection, true),
|
||
//DEL adOpenStatic, adLockOptimistic, adCmdText);
|
||
//DEL
|
||
//DEL while ((short)VAL_ZERO == pRecTdList->adoEOF)
|
||
//DEL {
|
||
//DEL dwTdID = (DWORD)pRecTdList->GetCollect(_T("ID")).ulVal;
|
||
//DEL switch (pRecTdList->GetCollect(_T("TDtype")).iVal)
|
||
//DEL {
|
||
//DEL case 0:
|
||
//DEL theApp.m_pTdManager->DeleteRspTd(dwTdID);
|
||
//DEL theApp.m_pTdManager->DeleteObjInMem(m_handleProcessor.GenerateHandle(dwTdID, PZ_STYLE_TD_RSP));
|
||
//DEL break;
|
||
//DEL case 1:
|
||
//DEL theApp.m_pTdManager->DeleteIpspTd(dwTdID);
|
||
//DEL theApp.m_pTdManager->DeleteObjInMem(m_handleProcessor.GenerateHandle(dwTdID, PZ_STYLE_TD_IPSP));
|
||
//DEL break;
|
||
//DEL default:
|
||
//DEL break;
|
||
//DEL }
|
||
//DEL pRecTdList->MoveNext();
|
||
//DEL }
|
||
//DEL pRecTdList->Close();
|
||
//DEL }
|
||
//DEL
|
||
//DEL theApp.m_pProManager->DeleteTzInLoc(pRecTzList->GetCollect(_T("TZID")).ulVal, dwDevID);
|
||
//DEL pRecTzList->MoveNext();
|
||
//DEL }
|
||
//DEL pRecTzList->Close();
|
||
//DEL theApp.m_pProManager->DeleteProjectInLoc(dwProID, dwDevID);
|
||
//DEL pRecProList->MoveNext();
|
||
//DEL }
|
||
//DEL pRecProList->Close();
|
||
//DEL }
|
||
//DEL catch (_com_error e)
|
||
//DEL {
|
||
//DEL m_pConnection->RollbackTrans();
|
||
//DEL return APP_ERR_DB;
|
||
//DEL }
|
||
//DEL
|
||
//DEL m_pConnection->CommitTrans();
|
||
//DEL
|
||
//DEL hProItem = pNavDataView->m_navDevDlg.m_devTree.GetChildItem(hDevItem);
|
||
//DEL while (NULL != hProItem)
|
||
//DEL {
|
||
//DEL pNavDataView->m_navDevDlg.m_devTree.DeleteItem(hProItem);
|
||
//DEL hProItem = pNavDataView->m_navDevDlg.m_devTree.GetChildItem(hDevItem);
|
||
//DEL }
|
||
//DEL
|
||
//DEL pNavDataView->m_navDevDlg.m_devTree.SelectItem(NULL);
|
||
//DEL pNavDataView->m_navDevDlg.m_devTree.SelectItem(hDevItem);
|
||
//DEL
|
||
//DEL InitialNavDataProDlg(pNavDataView->m_navProDlg);
|
||
//DEL */
|
||
//DEL return uExecCode;
|
||
//DEL }
|
||
|
||
//DEL UINT CDataOperator::DeleteTdRspInLoc(CNavDataView *pNavDataView)
|
||
//DEL {
|
||
//DEL UINT uExecCode = (UINT)APP_SUCCESS;
|
||
//DEL
|
||
//DEL HTREEITEM hTdItem = NULL;
|
||
//DEL HTREEITEM hTzItem = NULL;
|
||
//DEL
|
||
//DEL DWORD dwTdHandle = (DWORD)VAL_ZERO;
|
||
//DEL DWORD dwTdID = (DWORD)VAL_ZERO;
|
||
//DEL
|
||
//DEL _RecordsetPtr pRecTd = NULL;
|
||
//DEL /*
|
||
//DEL switch (pNavDataView->m_navTab.GetCurSel())
|
||
//DEL {
|
||
//DEL case TAB_INDEX_PRO:
|
||
//DEL hTdItem = pNavDataView->m_navProDlg.m_proTree.GetSelectedItem();
|
||
//DEL hTzItem = pNavDataView->m_navProDlg.m_proTree.GetParentItem(hTdItem);
|
||
//DEL dwTdHandle = pNavDataView->m_navProDlg.m_proTree.GetItemData(hTdItem);
|
||
//DEL break;
|
||
//DEL
|
||
//DEL case TAB_INDEX_DEV:
|
||
//DEL hTdItem = pNavDataView->m_navDevDlg.m_devTree.GetSelectedItem();
|
||
//DEL hTzItem = pNavDataView->m_navProDlg.m_proTree.GetParentItem(hTdItem);
|
||
//DEL dwTdHandle = pNavDataView->m_navDevDlg.m_devTree.GetItemData(hTdItem);
|
||
//DEL break;
|
||
//DEL
|
||
//DEL default:
|
||
//DEL break;
|
||
//DEL }
|
||
//DEL
|
||
//DEL dwTdID = m_handleProcessor.GetIDFromHandle(dwTdHandle);
|
||
//DEL
|
||
//DEL pRecTd.CreateInstance(_uuidof(Recordset));
|
||
//DEL
|
||
//DEL try
|
||
//DEL {
|
||
//DEL m_pConnection->BeginTrans();
|
||
//DEL
|
||
//DEL theApp.m_pTdManager->DeleteRspTd(dwTdID);
|
||
//DEL theApp.m_pTdManager->DeleteObjInMem(m_handleProcessor.GenerateHandle(dwTdID, PZ_STYLE_TD_RSP));
|
||
//DEL }
|
||
//DEL catch (_com_error e)
|
||
//DEL {
|
||
//DEL m_pConnection->RollbackTrans();
|
||
//DEL return APP_ERR_DB;
|
||
//DEL }
|
||
//DEL
|
||
//DEL m_pConnection->CommitTrans();
|
||
//DEL
|
||
//DEL switch (pNavDataView->m_navTab.GetCurSel())
|
||
//DEL {
|
||
//DEL case TAB_INDEX_PRO:
|
||
//DEL pNavDataView->m_navProDlg.m_proTree.DeleteItem(hTdItem);
|
||
//DEL pNavDataView->m_navProDlg.m_proTree.SelectItem(NULL);
|
||
//DEL pNavDataView->m_navProDlg.m_proTree.SelectItem(hTzItem);
|
||
//DEL InitialNavDataDevDlg(pNavDataView->m_navDevDlg);
|
||
//DEL break;
|
||
//DEL
|
||
//DEL case TAB_INDEX_DEV:
|
||
//DEL pNavDataView->m_navDevDlg.m_devTree.DeleteItem(hTdItem);
|
||
//DEL pNavDataView->m_navDevDlg.m_devTree.SelectItem(NULL);
|
||
//DEL pNavDataView->m_navDevDlg.m_devTree.SelectItem(hTzItem);
|
||
//DEL InitialNavDataProDlg(pNavDataView->m_navProDlg);
|
||
//DEL break;
|
||
//DEL
|
||
//DEL default:
|
||
//DEL break;
|
||
//DEL }
|
||
//DEL */
|
||
//DEL return uExecCode;
|
||
//DEL }
|
||
|
||
//DEL UINT CDataOperator::DeleteTdIpspInLoc(CNavDataView *pNavDataView)
|
||
//DEL {
|
||
//DEL UINT uExecCode = (UINT)APP_SUCCESS;
|
||
//DEL
|
||
//DEL HTREEITEM hTdItem = NULL;
|
||
//DEL HTREEITEM hTzItem = NULL;
|
||
//DEL
|
||
//DEL DWORD dwTdHandle = (DWORD)VAL_ZERO;
|
||
//DEL DWORD dwTdID = (DWORD)VAL_ZERO;
|
||
//DEL
|
||
//DEL _RecordsetPtr pRecTd = NULL;
|
||
//DEL /*
|
||
//DEL switch (pNavDataView->m_navTab.GetCurSel())
|
||
//DEL {
|
||
//DEL case TAB_INDEX_PRO:
|
||
//DEL hTdItem = pNavDataView->m_navProDlg.m_proTree.GetSelectedItem();
|
||
//DEL hTzItem = pNavDataView->m_navProDlg.m_proTree.GetParentItem(hTdItem);
|
||
//DEL dwTdHandle = pNavDataView->m_navProDlg.m_proTree.GetItemData(hTdItem);
|
||
//DEL break;
|
||
//DEL
|
||
//DEL case TAB_INDEX_DEV:
|
||
//DEL hTdItem = pNavDataView->m_navDevDlg.m_devTree.GetSelectedItem();
|
||
//DEL hTzItem = pNavDataView->m_navProDlg.m_proTree.GetParentItem(hTdItem);
|
||
//DEL dwTdHandle = pNavDataView->m_navDevDlg.m_devTree.GetItemData(hTdItem);
|
||
//DEL break;
|
||
//DEL
|
||
//DEL default:
|
||
//DEL break;
|
||
//DEL }
|
||
//DEL
|
||
//DEL dwTdID = m_handleProcessor.GetIDFromHandle(dwTdHandle);
|
||
//DEL
|
||
//DEL pRecTd.CreateInstance(_uuidof(Recordset));
|
||
//DEL
|
||
//DEL try
|
||
//DEL {
|
||
//DEL m_pConnection->BeginTrans();
|
||
//DEL
|
||
//DEL theApp.m_pTdManager->DeleteRspTd(dwTdID);
|
||
//DEL theApp.m_pTdManager->DeleteObjInMem(m_handleProcessor.GenerateHandle(dwTdID, PZ_STYLE_TD_IPSP));
|
||
//DEL }
|
||
//DEL catch (_com_error e)
|
||
//DEL {
|
||
//DEL m_pConnection->RollbackTrans();
|
||
//DEL return APP_ERR_DB;
|
||
//DEL }
|
||
//DEL
|
||
//DEL m_pConnection->CommitTrans();
|
||
//DEL switch (pNavDataView->m_navTab.GetCurSel())
|
||
//DEL {
|
||
//DEL case TAB_INDEX_PRO:
|
||
//DEL pNavDataView->m_navProDlg.m_proTree.DeleteItem(hTdItem);
|
||
//DEL pNavDataView->m_navProDlg.m_proTree.SelectItem(NULL);
|
||
//DEL pNavDataView->m_navProDlg.m_proTree.SelectItem(hTzItem);
|
||
//DEL InitialNavDataDevDlg(pNavDataView->m_navDevDlg);
|
||
//DEL break;
|
||
//DEL
|
||
//DEL case TAB_INDEX_DEV:
|
||
//DEL pNavDataView->m_navDevDlg.m_devTree.DeleteItem(hTdItem);
|
||
//DEL pNavDataView->m_navDevDlg.m_devTree.SelectItem(NULL);
|
||
//DEL pNavDataView->m_navDevDlg.m_devTree.SelectItem(hTzItem);
|
||
//DEL InitialNavDataProDlg(pNavDataView->m_navProDlg);
|
||
//DEL break;
|
||
//DEL
|
||
//DEL default:
|
||
//DEL break;
|
||
//DEL }
|
||
//DEL */
|
||
//DEL return uExecCode;
|
||
//DEL }
|
||
|
||
//DEL HTREEITEM CDataOperator::InitialNavDataDevTree(DWORD dwDevID, CString szDevSN, CTreeCtrl &devTree)
|
||
//DEL {
|
||
//DEL _RecordsetPtr pRecDev = NULL;
|
||
//DEL _RecordsetPtr pRecPro = NULL;
|
||
//DEL _RecordsetPtr pRecTz = NULL;
|
||
//DEL _RecordsetPtr pRecTd = NULL;
|
||
//DEL
|
||
//DEL _RecordsetPtr pRecProID = NULL;
|
||
//DEL _RecordsetPtr pRecTzID = NULL;
|
||
//DEL _RecordsetPtr pRecTdID = NULL;
|
||
//DEL
|
||
//DEL HTREEITEM hDevItem = NULL;
|
||
//DEL HTREEITEM hProItem = NULL;
|
||
//DEL HTREEITEM hTzItem = NULL;
|
||
//DEL HTREEITEM hTdItem = NULL;
|
||
//DEL HTREEITEM hParentItem = NULL;
|
||
//DEL
|
||
//DEL DWORD dwHandle = (DWORD)VAL_ZERO;
|
||
//DEL UINT uImageState = (UINT)VAL_ZERO;
|
||
//DEL
|
||
//DEL CString szSql;
|
||
//DEL
|
||
//DEL pRecPro.CreateInstance(_uuidof(Recordset));
|
||
//DEL pRecTz.CreateInstance(_uuidof(Recordset));
|
||
//DEL pRecTd.CreateInstance(_uuidof(Recordset));
|
||
//DEL
|
||
//DEL pRecProID.CreateInstance(_uuidof(Recordset));
|
||
//DEL pRecTzID.CreateInstance(_uuidof(Recordset));
|
||
//DEL pRecTdID.CreateInstance(_uuidof(Recordset));
|
||
//DEL
|
||
//DEL uImageState = m_stateProcessor.ChangeToImageState(PZ_STATE_LOC);
|
||
//DEL
|
||
//DEL hDevItem = devTree.InsertItem(szDevSN);
|
||
//DEL dwHandle = m_handleProcessor.GenerateHandle(dwDevID, PZ_STYLE_DEV_DATA);
|
||
//DEL devTree.SetItemData(hDevItem, dwHandle);
|
||
//DEL devTree.SetItemState(hDevItem, (UINT)m_stateProcessor.ChangeToImageState(PZ_STATE_OFFLINE), TVIS_STATEIMAGEMASK);
|
||
//DEL
|
||
//DEL szSql.Empty();
|
||
//DEL szSql.Format(_T("select distinct PRID from dptt where DEID = %u"), dwDevID);
|
||
//DEL pRecProID->Open(szSql.AllocSysString(), _variant_t((IDispatch*)m_pConnection, true), adOpenStatic, adLockOptimistic, adCmdText);
|
||
//DEL
|
||
//DEL while ((short)VAL_ZERO == pRecProID->adoEOF)
|
||
//DEL {
|
||
//DEL szSql.Empty();
|
||
//DEL szSql.Format(_T("select PRname,CN from project where ID = %u order by ID"), (DWORD)pRecProID->GetCollect(_T("PRID")).ulVal);
|
||
//DEL pRecPro->Open(szSql.AllocSysString(), _variant_t((IDispatch*)m_pConnection, true), adOpenStatic, adLockOptimistic, adCmdText);
|
||
//DEL
|
||
//DEL if ((long)VAL_ZERO != pRecPro->GetRecordCount())
|
||
//DEL {
|
||
//DEL hProItem = devTree.InsertItem((LPCTSTR)(_bstr_t)pRecPro->GetCollect(_T("PRname")), hDevItem);
|
||
//DEL
|
||
//DEL dwHandle = m_handleProcessor.GenerateHandle((DWORD)pRecProID->GetCollect(_T("PRID")).ulVal, PZ_STYLE_PRO);
|
||
//DEL devTree.SetItemData(hProItem, dwHandle);
|
||
//DEL devTree.SetItemState(hProItem, uImageState, TVIS_STATEIMAGEMASK);
|
||
//DEL }
|
||
//DEL pRecPro->Close();
|
||
//DEL
|
||
//DEL szSql.Empty();
|
||
//DEL szSql.Format(_T("select ID from tz where PRID = %u"), dwDevID, (DWORD)pRecProID->GetCollect(_T("PRID")).ulVal);
|
||
//DEL pRecTzID->Open(szSql.AllocSysString(),_variant_t((IDispatch*)m_pConnection, true),
|
||
//DEL adOpenStatic, adLockOptimistic, adCmdText);
|
||
//DEL
|
||
//DEL while ((short)VAL_ZERO == pRecTzID->adoEOF)
|
||
//DEL {
|
||
//DEL if (VT_NULL != pRecTzID->GetCollect(_T("ID")).vt)
|
||
//DEL {
|
||
//DEL szSql.Empty();
|
||
//DEL szSql.Format(_T("select TZname from tz where ID = %u"), (DWORD)pRecTzID->GetCollect(_T("ID")).ulVal);
|
||
//DEL pRecTz->Open(szSql.AllocSysString(), _variant_t((IDispatch*)m_pConnection, true),
|
||
//DEL adOpenStatic, adLockOptimistic, adCmdText);
|
||
//DEL
|
||
//DEL hTzItem = devTree.InsertItem(pRecTz->GetCollect(_T("TZname")).vt == VT_NULL ? _T("") : (LPCTSTR)(_bstr_t)pRecTz->GetCollect(_T("TZname")), hProItem);
|
||
//DEL dwHandle = m_handleProcessor.GenerateHandle((DWORD)pRecTzID->GetCollect(_T("ID")).ulVal, PZ_STYLE_TZ);
|
||
//DEL devTree.SetItemData(hTzItem, dwHandle);
|
||
//DEL devTree.SetItemState(hTzItem, uImageState, TVIS_STATEIMAGEMASK);
|
||
//DEL
|
||
//DEL pRecTz->Close();
|
||
//DEL
|
||
//DEL szSql.Empty();
|
||
//DEL szSql.Format(_T("select ID,TDname,Ttype from td where DEID = %u and TZID = %u order by ID"), dwDevID, (DWORD)pRecTzID->GetCollect(_T("ID")).ulVal);
|
||
//DEL pRecTd->Open(szSql.AllocSysString(),_variant_t((IDispatch*)m_pConnection, true),
|
||
//DEL adOpenStatic, adLockOptimistic, adCmdText);
|
||
//DEL
|
||
//DEL while ((short)VAL_ZERO == pRecTd->adoEOF)
|
||
//DEL {
|
||
//DEL hTdItem = devTree.InsertItem(pRecTd->GetCollect(_T("TDname")).vt == VT_NULL ? _T("") : (LPCTSTR)(_bstr_t)pRecTd->GetCollect(_T("TDname")), hTzItem);
|
||
//DEL
|
||
//DEL switch (pRecTd->GetCollect(_T("TDtype")).iVal)
|
||
//DEL {
|
||
//DEL case 0:
|
||
//DEL dwHandle = m_handleProcessor.GenerateHandle((DWORD)pRecTd->GetCollect(_T("ID")).ulVal, PZ_STYLE_TD_RSP);
|
||
//DEL break;
|
||
//DEL case 1:
|
||
//DEL dwHandle = m_handleProcessor.GenerateHandle((DWORD)pRecTd->GetCollect(_T("ID")).ulVal, PZ_STYLE_TD_IPSP);
|
||
//DEL break;
|
||
//DEL default:
|
||
//DEL break;
|
||
//DEL }
|
||
//DEL
|
||
//DEL devTree.SetItemData(hTdItem, dwHandle);
|
||
//DEL devTree.SetItemState(hTdItem, uImageState, TVIS_STATEIMAGEMASK);
|
||
//DEL
|
||
//DEL pRecTd->MoveNext();
|
||
//DEL } //while (VAL_ZERO == pRecTd->adoEOF)
|
||
//DEL pRecTd->Close();
|
||
//DEL
|
||
//DEL hParentItem = devTree.GetParentItem(hTdItem);
|
||
//DEL // ASSERT(hParentItem != NULL);
|
||
//DEL if (hParentItem != NULL)
|
||
//DEL {
|
||
//DEL devTree.Expand(hParentItem, TVE_EXPAND);
|
||
//DEL hParentItem = NULL;
|
||
//DEL } //if (hParentItem != NULL)
|
||
//DEL } //if (VT_NULL != pRecTzID->GetCollect(_T("TZID")).vt)
|
||
//DEL
|
||
//DEL pRecTzID->MoveNext();
|
||
//DEL } //while (VAL_ZERO == pRecTzID->adoEOF)
|
||
//DEL pRecTzID->Close();
|
||
//DEL
|
||
//DEL hParentItem = devTree.GetParentItem(hTzItem);
|
||
//DEL // ASSERT(hParentItem != NULL);
|
||
//DEL if (hParentItem != NULL)
|
||
//DEL {
|
||
//DEL devTree.Expand(hParentItem, TVE_EXPAND);
|
||
//DEL hParentItem = NULL;
|
||
//DEL } //if (hParentItem != NULL)
|
||
//DEL
|
||
//DEL pRecProID->MoveNext();
|
||
//DEL
|
||
//DEL } //while (VAL_ZERO == pRecProID->adoEOF)
|
||
//DEL pRecProID->Close();
|
||
//DEL
|
||
//DEL hParentItem = devTree.GetParentItem(hProItem);
|
||
//DEL // ASSERT(hParentItem != NULL);
|
||
//DEL if (hParentItem != NULL)
|
||
//DEL {
|
||
//DEL devTree.Expand(hParentItem, TVE_EXPAND);
|
||
//DEL hParentItem = NULL;
|
||
//DEL } //if (hParentItem != NULL)
|
||
//DEL
|
||
//DEL devTree.SelectSetFirstVisible(devTree.GetRootItem());
|
||
//DEL return hDevItem;
|
||
//DEL }
|
||
|
||
//DEL bool CDataOperator::AddTzInDevTreeByLoc(CNavDataDevDlg &navDataDevDlg, DWORD dwDevID, DWORD dwTzID, HTREEITEM hProItem)
|
||
//DEL {
|
||
//DEL _RecordsetPtr pRecTz = NULL;
|
||
//DEL HTREEITEM hTzItem = NULL;
|
||
//DEL
|
||
//DEL DWORD dwTzHandle = (DWORD)VAL_ZERO;
|
||
//DEL UINT uImageState = (UINT)VAL_ZERO;
|
||
//DEL CString szSql;
|
||
//DEL
|
||
//DEL pRecTz.CreateInstance(_uuidof(Recordset));
|
||
//DEL
|
||
//DEL szSql.Empty();
|
||
//DEL szSql.Format(_T("select TZname from tz where ID = %u"), dwTzID);
|
||
//DEL pRecTz->Open(szSql.AllocSysString(), _variant_t((IDispatch*)m_pConnection, true), adOpenStatic, adLockOptimistic, adCmdText);
|
||
//DEL
|
||
//DEL hTzItem = navDataDevDlg.m_devTree.InsertItem((pRecTz->GetCollect(_T("TZname")).vt == VT_NULL) ? _T("") : (LPCTSTR)(_bstr_t)pRecTz->GetCollect(_T("TZname")), hProItem);
|
||
//DEL dwTzHandle = m_handleProcessor.GenerateHandle(dwTzID, PZ_STYLE_TZ);
|
||
//DEL navDataDevDlg.m_devTree.SetItemData(hTzItem, dwTzHandle);
|
||
//DEL
|
||
//DEL uImageState = m_stateProcessor.ChangeToImageState(PZ_STATE_LOC);
|
||
//DEL navDataDevDlg.m_devTree.SetItemState(hTzItem, uImageState, TVIS_STATEIMAGEMASK);
|
||
//DEL
|
||
//DEL pRecTz->Close();
|
||
//DEL
|
||
//DEL AddTdInDevTreeByLoc(navDataDevDlg, dwDevID, dwTzID, hTzItem);
|
||
//DEL
|
||
//DEL navDataDevDlg.m_devTree.Expand(hTzItem, TVE_EXPAND);
|
||
//DEL return true;
|
||
//DEL }
|
||
|
||
//DEL bool CDataOperator::AddTdInDevTreeByLoc(CNavDataDevDlg &navDataDevDlg, DWORD dwDevID, DWORD dwTzID, HTREEITEM hTzItem)
|
||
//DEL {
|
||
//DEL _RecordsetPtr pRecTdList = NULL;
|
||
//DEL HTREEITEM hTdItem = NULL;
|
||
//DEL
|
||
//DEL DWORD dwTdHandle = (DWORD)VAL_ZERO;
|
||
//DEL UINT uImageState = (UINT)VAL_ZERO;
|
||
//DEL CString szSql = _T("");
|
||
//DEL
|
||
//DEL uImageState = m_stateProcessor.ChangeToImageState(PZ_STATE_LOC);
|
||
//DEL
|
||
//DEL pRecTdList.CreateInstance(_uuidof(Recordset));
|
||
//DEL szSql.Empty();
|
||
//DEL szSql.Format(_T("select ID,TDname,TDtype from td where DEID = %u and TZID = %u order by ID"), dwDevID, dwTzID);
|
||
//DEL pRecTdList->Open(szSql.AllocSysString(),_variant_t((IDispatch*)m_pConnection, true),
|
||
//DEL adOpenStatic, adLockOptimistic, adCmdText);
|
||
//DEL
|
||
//DEL while ((short)VAL_ZERO == pRecTdList->adoEOF)
|
||
//DEL {
|
||
//DEL hTdItem = navDataDevDlg.m_devTree.InsertItem(pRecTdList->GetCollect(_T("TDname")).vt == VT_NULL ? _T("") : (LPCTSTR)(_bstr_t)pRecTdList->GetCollect(_T("TDname")), hTzItem);
|
||
//DEL
|
||
//DEL switch (pRecTdList->GetCollect(_T("TDtype")).iVal)
|
||
//DEL {
|
||
//DEL case 0:
|
||
//DEL dwTdHandle = m_handleProcessor.GenerateHandle((DWORD)pRecTdList->GetCollect(_T("ID")).ulVal, PZ_STYLE_TD_RSP);
|
||
//DEL break;
|
||
//DEL case 1:
|
||
//DEL dwTdHandle = m_handleProcessor.GenerateHandle((DWORD)pRecTdList->GetCollect(_T("ID")).ulVal, PZ_STYLE_TD_IPSP);
|
||
//DEL break;
|
||
//DEL default:
|
||
//DEL break;
|
||
//DEL }
|
||
//DEL
|
||
//DEL navDataDevDlg.m_devTree.SetItemData(hTdItem, dwTdHandle);
|
||
//DEL navDataDevDlg.m_devTree.SetItemState(hTdItem, uImageState, TVIS_STATEIMAGEMASK);
|
||
//DEL
|
||
//DEL pRecTdList->MoveNext();
|
||
//DEL } //while (VAL_ZERO == pRecTd->adoEOF)
|
||
//DEL pRecTdList->Close();
|
||
//DEL
|
||
//DEL return true;
|
||
//DEL }
|
||
UINT CDataOperator::ExportRsp3DTdToDAT(CNavDataView *pNavDataView, CString f_szFileName)
|
||
{
|
||
UINT uExecCode = (UINT)APP_SUCCESS;
|
||
DWORD dwTdHandle = (DWORD)VAL_ZERO;
|
||
HTREEITEM hTdItem = NULL;
|
||
|
||
CTreeCtrl& dataTree = pNavDataView->m_dataTree;
|
||
|
||
hTdItem = dataTree.GetSelectedItem();
|
||
|
||
dwTdHandle = dataTree.GetItemData(hTdItem);
|
||
if (TRUE == m_BatchExportFlag)
|
||
{
|
||
dwTdHandle = m_dwItemHandle;
|
||
}
|
||
try
|
||
{
|
||
if (TRUE != theApp.m_pTdManager->GetTestingData(dwTdHandle)->SaveTdToRes3DFile(f_szFileName))
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
}
|
||
catch (...)
|
||
{
|
||
uExecCode = (UINT)APP_SUCCESS;
|
||
}
|
||
return uExecCode;
|
||
}
|
||
|
||
UINT CDataOperator::ExportRsp3DTdToExcel(CNavDataView *pNavDataView, CString f_szFileName)
|
||
{
|
||
UINT uExecCode = (UINT)APP_SUCCESS;
|
||
DWORD dwTdHandle = (DWORD)VAL_ZERO;
|
||
HTREEITEM hTdItem = NULL;
|
||
|
||
CTreeCtrl& dataTree = pNavDataView->m_dataTree;
|
||
|
||
hTdItem = dataTree.GetSelectedItem();
|
||
|
||
dwTdHandle = dataTree.GetItemData(hTdItem);
|
||
if (TRUE == m_BatchExportFlag)
|
||
{
|
||
dwTdHandle = m_dwItemHandle;
|
||
}
|
||
try
|
||
{
|
||
if (TRUE != theApp.m_pTdManager->GetTestingData(dwTdHandle)->SaveTdToExcelFile(f_szFileName))
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
}
|
||
catch (...)
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
return uExecCode;
|
||
}
|
||
|
||
UINT CDataOperator::ExportRsp3DTdToCSV(CNavDataView *pNavDataView, CString f_szFileName)
|
||
{
|
||
UINT uExecCode = (UINT)APP_SUCCESS;
|
||
DWORD dwTdHandle = (DWORD)VAL_ZERO;
|
||
HTREEITEM hTdItem = NULL;
|
||
|
||
CTreeCtrl& dataTree = pNavDataView->m_dataTree;
|
||
|
||
hTdItem = dataTree.GetSelectedItem();
|
||
|
||
dwTdHandle = dataTree.GetItemData(hTdItem);
|
||
if (TRUE == m_BatchExportFlag)
|
||
{
|
||
dwTdHandle = m_dwItemHandle;
|
||
}
|
||
try
|
||
{
|
||
if (TRUE != theApp.m_pTdManager->GetTestingData(dwTdHandle)->SaveTdToCsvFile(f_szFileName))
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
}
|
||
catch (...)
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
return uExecCode;
|
||
}
|
||
|
||
UINT CDataOperator::ExportRsp3DTdToTxt(CNavDataView *pNavDataView, CString f_szFileName)
|
||
{
|
||
UINT uExecCode = (UINT)APP_SUCCESS;
|
||
DWORD dwTdHandle = (DWORD)VAL_ZERO;
|
||
HTREEITEM hTdItem = NULL;
|
||
|
||
CTreeCtrl& dataTree = pNavDataView->m_dataTree;
|
||
|
||
hTdItem = dataTree.GetSelectedItem();
|
||
|
||
dwTdHandle = dataTree.GetItemData(hTdItem);
|
||
if (TRUE == m_BatchExportFlag)
|
||
{
|
||
dwTdHandle = m_dwItemHandle;
|
||
}
|
||
try
|
||
{
|
||
if (TRUE != theApp.m_pTdManager->GetTestingData(dwTdHandle)->ExportResDataToTxt(f_szFileName))
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
}
|
||
catch (...)
|
||
{
|
||
uExecCode = (UINT)APP_SUCCESS;
|
||
}
|
||
return uExecCode;
|
||
}
|
||
|
||
UINT CDataOperator::ExportRsp3DTdToUrf(CNavDataView *pNavDataView, CString f_szFileName)
|
||
{
|
||
UINT uExecCode = (UINT)APP_SUCCESS;
|
||
DWORD dwTdHandle = (DWORD)VAL_ZERO;
|
||
HTREEITEM hTdItem = NULL;
|
||
|
||
CTreeCtrl& dataTree = pNavDataView->m_dataTree;
|
||
|
||
hTdItem = dataTree.GetSelectedItem();
|
||
|
||
dwTdHandle = dataTree.GetItemData(hTdItem);
|
||
if (TRUE == m_BatchExportFlag)
|
||
{
|
||
dwTdHandle = m_dwItemHandle;
|
||
}
|
||
try
|
||
{
|
||
if (TRUE != theApp.m_pTdManager->GetTestingData(dwTdHandle)->ExportDataToUrf(f_szFileName))
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
}
|
||
catch (...)
|
||
{
|
||
uExecCode = (UINT)APP_SUCCESS;
|
||
}
|
||
return uExecCode;
|
||
}
|
||
|
||
UINT CDataOperator::DisplayIspCETdGraph(CNavDataView *pNavDataView)
|
||
{
|
||
// AfxMessageBox("comming soon");
|
||
return 0;
|
||
}
|
||
|
||
UINT CDataOperator::DisplayIsp2DTdGraph(CNavDataView *pNavDataView)
|
||
{
|
||
// AfxMessageBox("comming soon");
|
||
return 0;
|
||
}
|
||
|
||
UINT CDataOperator::DisplayIsp3DTdGraph(CNavDataView *pNavDataView)
|
||
{
|
||
// AfxMessageBox("comming soon");
|
||
return 0;
|
||
}
|
||
|
||
|
||
|
||
UINT CDataOperator::DisplayIsp3DTdIpCurve(CNavDataView *pNavDataView)
|
||
{
|
||
UINT uExecCode = (UINT)APP_SUCCESS;
|
||
DWORD dwTdHandle = (DWORD)VAL_ZERO;
|
||
HTREEITEM hTdItem = NULL;
|
||
|
||
CTreeCtrl& dataTree = pNavDataView->m_dataTree;
|
||
|
||
hTdItem = dataTree.GetSelectedItem();
|
||
|
||
dwTdHandle = dataTree.GetItemData(hTdItem);
|
||
|
||
try
|
||
{
|
||
theApp.m_pTdManager->GetTestingData(dwTdHandle)->LoadData(theApp.m_pSptManager->m_medLinkList);
|
||
if (TRUE != theApp.m_pTdManager->GetTestingData(dwTdHandle)->DisplayIpCurveGraph())//1D 2D 3D调用同样的接口
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
}
|
||
catch (...)
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
return uExecCode;
|
||
}
|
||
|
||
UINT CDataOperator::DisplayIspCETdIpCurve(CNavDataView *pNavDataView)
|
||
{
|
||
//AfxMessageBox("comming soon CE");
|
||
UINT uExecCode = (UINT)APP_SUCCESS;
|
||
DWORD dwTdHandle = (DWORD)VAL_ZERO;
|
||
HTREEITEM hTdItem = NULL;
|
||
|
||
CTreeCtrl& dataTree = pNavDataView->m_dataTree;
|
||
|
||
hTdItem = dataTree.GetSelectedItem();
|
||
|
||
dwTdHandle = dataTree.GetItemData(hTdItem);
|
||
|
||
try
|
||
{
|
||
theApp.m_pTdManager->GetTestingData(dwTdHandle)->LoadData(theApp.m_pSptManager->m_medLinkList);
|
||
if (TRUE != theApp.m_pTdManager->GetTestingData(dwTdHandle)->DisplayIpCurveGraph())
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
}
|
||
catch (...)
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
return uExecCode;
|
||
|
||
}
|
||
|
||
UINT CDataOperator::DisplayIsp2DTdIpCurve(CNavDataView *pNavDataView)
|
||
{
|
||
UINT uExecCode = (UINT)APP_SUCCESS;
|
||
DWORD dwTdHandle = (DWORD)VAL_ZERO;
|
||
HTREEITEM hTdItem = NULL;
|
||
|
||
CTreeCtrl& dataTree = pNavDataView->m_dataTree;
|
||
|
||
hTdItem = dataTree.GetSelectedItem();
|
||
|
||
dwTdHandle = dataTree.GetItemData(hTdItem);
|
||
|
||
try
|
||
{
|
||
theApp.m_pTdManager->GetTestingData(dwTdHandle)->LoadData(theApp.m_pSptManager->m_medLinkList);
|
||
if (TRUE != theApp.m_pTdManager->GetTestingData(dwTdHandle)->DisplayIpCurveGraph())//1D、2D、3D调用同样的界面
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
}
|
||
catch (...)
|
||
{
|
||
if (LANG_ZHCN == g_iUILanguage)
|
||
AfxMessageBox(_T("发生异常"));
|
||
else
|
||
MessageBoxEx(NULL, _T("Exception is occuried!!!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
return uExecCode;
|
||
}
|
||
|
||
UINT CDataOperator::ExportRspCETdToDAT(CNavDataView *pNavDataView, CString f_szFileName)
|
||
{
|
||
UINT uExecCode = (UINT)APP_SUCCESS;
|
||
DWORD dwTdHandle = (DWORD)VAL_ZERO;
|
||
HTREEITEM hTdItem = NULL;
|
||
|
||
CTreeCtrl& dataTree = pNavDataView->m_dataTree;
|
||
|
||
hTdItem = dataTree.GetSelectedItem();
|
||
|
||
dwTdHandle = dataTree.GetItemData(hTdItem);
|
||
if (TRUE == m_BatchExportFlag)
|
||
{
|
||
dwTdHandle = m_dwItemHandle;
|
||
}
|
||
try
|
||
{
|
||
if (TRUE != theApp.m_pTdManager->GetTestingData(dwTdHandle)->SaveTdToResCEFile(f_szFileName))
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
}
|
||
catch (...)
|
||
{
|
||
uExecCode = (UINT)APP_SUCCESS;
|
||
}
|
||
return uExecCode;
|
||
|
||
}
|
||
|
||
|
||
UINT CDataOperator::ExportIpSpCETdToDAT(CNavDataView *pNavDataView, CString f_szFileName)
|
||
{
|
||
|
||
UINT uExecCode = (UINT)APP_SUCCESS;
|
||
DWORD dwTdHandle = (DWORD)VAL_ZERO;
|
||
HTREEITEM hTdItem = NULL;
|
||
|
||
CTreeCtrl& dataTree = pNavDataView->m_dataTree;
|
||
|
||
hTdItem = dataTree.GetSelectedItem();
|
||
|
||
dwTdHandle = dataTree.GetItemData(hTdItem);
|
||
if (TRUE == m_BatchExportFlag)
|
||
{
|
||
dwTdHandle = m_dwItemHandle;
|
||
}
|
||
try
|
||
{
|
||
if (TRUE != theApp.m_pTdManager->GetTestingData(dwTdHandle)->SaveTdToResCEFile(f_szFileName))
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
}
|
||
catch (...)
|
||
{
|
||
uExecCode = (UINT)APP_SUCCESS;
|
||
}
|
||
return uExecCode;
|
||
}
|
||
|
||
void CDataOperator::ShowSPCETdInfo(DWORD dwTdHandle, CView *pAppDataView)
|
||
{
|
||
theApp.m_pTdManager->GetTestingData(dwTdHandle)->ShowDetailInfo(((CAppDataTdDetailListView*)(((CAppDataSPCETdView*)pAppDataView)->m_pDetailListView))->GetListCtrl());
|
||
theApp.m_pTdManager->GetTestingData(dwTdHandle)->ShowConList(((CAppDataSPCETdConListView_*)(((CAppDataSPCETdView*)pAppDataView)->m_pContentListView))->GetListCtrl());
|
||
theApp.m_pTdManager->GetTestingData(dwTdHandle)->ShowGrList(((CAppDataCESTdGrListView*)(((CAppDataSPCETdView*)pAppDataView)->m_pGrListView))->GetListCtrl());
|
||
}
|
||
|
||
void CDataOperator::ShowSP2DTdInfo(DWORD dwTdHandle, CView *pAppDataView)
|
||
{
|
||
theApp.m_pTdManager->GetTestingData(dwTdHandle)->ShowDetailInfo(((CAppDataTdDetailListView*)(((CAppDataSP2DTdView*)pAppDataView)->m_pDetailListView))->GetListCtrl());
|
||
theApp.m_pTdManager->GetTestingData(dwTdHandle)->ShowConList(((CAppDataSP2DTdConListView*)(((CAppDataSP2DTdView*)pAppDataView)->m_pContentListView))->GetListCtrl());
|
||
theApp.m_pTdManager->GetTestingData(dwTdHandle)->ShowGrList(((CAppDataTdGrListView*)(((CAppDataSP2DTdView*)pAppDataView)->m_pGrListView))->GetListCtrl());
|
||
}
|
||
|
||
void CDataOperator::ShowSP3DTdInfo(DWORD dwTdHandle, CView *pAppDataView)
|
||
{
|
||
theApp.m_pTdManager->GetTestingData(dwTdHandle)->ShowDetailInfo(((CAppDataTdDetailListView*)(((CAppDataSP3DTdView*)pAppDataView)->m_pDetailListView))->GetListCtrl());
|
||
theApp.m_pTdManager->GetTestingData(dwTdHandle)->ShowConList(((CAppDataSP3DTdConListView*)(((CAppDataSP3DTdView*)pAppDataView)->m_pContentListView))->GetListCtrl());
|
||
theApp.m_pTdManager->GetTestingData(dwTdHandle)->ShowGrList(((CAppDataTdGrListView*)(((CAppDataSP3DTdView*)pAppDataView)->m_pGrListView))->GetListCtrl());
|
||
}
|
||
|
||
void CDataOperator::LoadSPCERecordbyPage(DWORD dwTdHandle, CView *pAppDataView, int iSType/* = 1*/)
|
||
{
|
||
theApp.m_pTdManager->GetTestingData(dwTdHandle)->ShowConListByPage(((CAppDataSPCETdConListView_*)(((CAppDataSPCETdView*)pAppDataView)->m_pContentListView))->GetListCtrl(), iSType);
|
||
}
|
||
void CDataOperator::LoadSP2dRecordbyPage(DWORD dwTdHandle, CView *pAppDataView, int iSType/* = 2*/)
|
||
{
|
||
theApp.m_pTdManager->GetTestingData(dwTdHandle)->ShowConListByPage(((CAppDataSP2DTdConListView*)(((CAppDataSP2DTdView*)pAppDataView)->m_pContentListView))->GetListCtrl(), iSType);
|
||
}
|
||
void CDataOperator::LoadSP3dRecordbyPage(DWORD dwTdHandle, CView *pAppDataView, int iSType/* = 3*/)
|
||
{
|
||
theApp.m_pTdManager->GetTestingData(dwTdHandle)->ShowConListByPage(((CAppDataSP3DTdConListView*)(((CAppDataSP3DTdView*)pAppDataView)->m_pContentListView))->GetListCtrl(), iSType);
|
||
}
|
||
|
||
|
||
UINT CDataOperator::ExportSP3DTdToExcel(CNavDataView *pNavDataView, CString f_szFileName)
|
||
{
|
||
UINT uExecCode = (UINT)APP_SUCCESS;
|
||
DWORD dwTdHandle = (DWORD)VAL_ZERO;
|
||
HTREEITEM hTdItem = NULL;
|
||
|
||
CTreeCtrl& dataTree = pNavDataView->m_dataTree;
|
||
|
||
hTdItem = dataTree.GetSelectedItem();
|
||
|
||
dwTdHandle = dataTree.GetItemData(hTdItem);
|
||
if (TRUE == m_BatchExportFlag)
|
||
{
|
||
dwTdHandle = m_dwItemHandle;
|
||
}
|
||
try
|
||
{
|
||
if (TRUE != theApp.m_pTdManager->GetTestingData(dwTdHandle)->SaveTdToExcelFile(f_szFileName))
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
}
|
||
catch (...)
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
return uExecCode;
|
||
}
|
||
|
||
|
||
UINT CDataOperator::ExportSP3DTdToCSV(CNavDataView *pNavDataView, CString f_szFileName)
|
||
{
|
||
UINT uExecCode = (UINT)APP_SUCCESS;
|
||
DWORD dwTdHandle = (DWORD)VAL_ZERO;
|
||
HTREEITEM hTdItem = NULL;
|
||
|
||
CTreeCtrl& dataTree = pNavDataView->m_dataTree;
|
||
|
||
hTdItem = dataTree.GetSelectedItem();
|
||
|
||
dwTdHandle = dataTree.GetItemData(hTdItem);
|
||
if (TRUE == m_BatchExportFlag)
|
||
{
|
||
dwTdHandle = m_dwItemHandle;
|
||
}
|
||
try
|
||
{
|
||
if (TRUE != theApp.m_pTdManager->GetTestingData(dwTdHandle)->SaveTdToCsvFile(f_szFileName))
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
}
|
||
catch (...)
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
return uExecCode;
|
||
}
|
||
UINT CDataOperator::ExportSP3DTdToTxt(CNavDataView *pNavDataView, CString f_szFileName)
|
||
{
|
||
UINT uExecCode = (UINT)APP_SUCCESS;
|
||
DWORD dwTdHandle = (DWORD)VAL_ZERO;
|
||
HTREEITEM hTdItem = NULL;
|
||
|
||
CTreeCtrl& dataTree = pNavDataView->m_dataTree;
|
||
|
||
hTdItem = dataTree.GetSelectedItem();
|
||
|
||
dwTdHandle = dataTree.GetItemData(hTdItem);
|
||
if (TRUE == m_BatchExportFlag)
|
||
{
|
||
dwTdHandle = m_dwItemHandle;
|
||
}
|
||
try
|
||
{
|
||
if (TRUE != theApp.m_pTdManager->GetTestingData(dwTdHandle)->ExportSpDataToTxt(f_szFileName))
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
}
|
||
catch (...)
|
||
{
|
||
uExecCode = (UINT)APP_SUCCESS;
|
||
}
|
||
return uExecCode;
|
||
}
|
||
|
||
UINT CDataOperator::ExportSP2DTdToExcel(CNavDataView *pNavDataView, CString f_szFileName)
|
||
{
|
||
UINT uExecCode = (UINT)APP_SUCCESS;
|
||
DWORD dwTdHandle = (DWORD)VAL_ZERO;
|
||
HTREEITEM hTdItem = NULL;
|
||
|
||
CTreeCtrl& dataTree = pNavDataView->m_dataTree;
|
||
|
||
hTdItem = dataTree.GetSelectedItem();
|
||
|
||
dwTdHandle = dataTree.GetItemData(hTdItem);
|
||
if (TRUE == m_BatchExportFlag)
|
||
{
|
||
dwTdHandle = m_dwItemHandle;
|
||
}
|
||
try
|
||
{
|
||
if (TRUE != theApp.m_pTdManager->GetTestingData(dwTdHandle)->SaveTdToExcelFile(f_szFileName))
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
}
|
||
catch (...)
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
|
||
return uExecCode;
|
||
}
|
||
|
||
UINT CDataOperator::ExportSP2DTdToCSV(CNavDataView *pNavDataView, CString f_szFileName)
|
||
{
|
||
UINT uExecCode = (UINT)APP_SUCCESS;
|
||
DWORD dwTdHandle = (DWORD)VAL_ZERO;
|
||
HTREEITEM hTdItem = NULL;
|
||
|
||
CTreeCtrl& dataTree = pNavDataView->m_dataTree;
|
||
|
||
hTdItem = dataTree.GetSelectedItem();
|
||
|
||
dwTdHandle = dataTree.GetItemData(hTdItem);
|
||
if (TRUE == m_BatchExportFlag)
|
||
{
|
||
dwTdHandle = m_dwItemHandle;
|
||
}
|
||
try
|
||
{
|
||
if (TRUE != theApp.m_pTdManager->GetTestingData(dwTdHandle)->SaveTdToCsvFile(f_szFileName))
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
}
|
||
catch (...)
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
|
||
return uExecCode;
|
||
}
|
||
UINT CDataOperator::ExportSP2DTdToTxt(CNavDataView *pNavDataView, CString f_szFileName)
|
||
{
|
||
UINT uExecCode = (UINT)APP_SUCCESS;
|
||
DWORD dwTdHandle = (DWORD)VAL_ZERO;
|
||
HTREEITEM hTdItem = NULL;
|
||
|
||
CTreeCtrl& dataTree = pNavDataView->m_dataTree;
|
||
|
||
hTdItem = dataTree.GetSelectedItem();
|
||
|
||
dwTdHandle = dataTree.GetItemData(hTdItem);
|
||
if (TRUE == m_BatchExportFlag)
|
||
{
|
||
dwTdHandle = m_dwItemHandle;
|
||
}
|
||
try
|
||
{
|
||
if (TRUE != theApp.m_pTdManager->GetTestingData(dwTdHandle)->ExportSpDataToTxt(f_szFileName))
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
}
|
||
catch (...)
|
||
{
|
||
uExecCode = (UINT)APP_SUCCESS;
|
||
}
|
||
|
||
return uExecCode;
|
||
}
|
||
|
||
UINT CDataOperator::ExportSPCETdToExcel(CNavDataView *pNavDataView, CString f_szFileName)
|
||
{
|
||
UINT uExecCode = (UINT)APP_SUCCESS;
|
||
DWORD dwTdHandle = (DWORD)VAL_ZERO;
|
||
HTREEITEM hTdItem = NULL;
|
||
|
||
CTreeCtrl& dataTree = pNavDataView->m_dataTree;
|
||
|
||
hTdItem = dataTree.GetSelectedItem();
|
||
|
||
dwTdHandle = dataTree.GetItemData(hTdItem);
|
||
if (TRUE == m_BatchExportFlag)
|
||
{
|
||
dwTdHandle = m_dwItemHandle;
|
||
}
|
||
try
|
||
{
|
||
if (TRUE != theApp.m_pTdManager->GetTestingData(dwTdHandle)->SaveTdToExcelFile(f_szFileName))
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
}
|
||
catch (...)
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
return uExecCode;
|
||
}
|
||
|
||
UINT CDataOperator::ExportSPCETdToCSV(CNavDataView *pNavDataView, CString f_szFileName)
|
||
{
|
||
UINT uExecCode = (UINT)APP_SUCCESS;
|
||
DWORD dwTdHandle = (DWORD)VAL_ZERO;
|
||
HTREEITEM hTdItem = NULL;
|
||
|
||
CTreeCtrl& dataTree = pNavDataView->m_dataTree;
|
||
|
||
hTdItem = dataTree.GetSelectedItem();
|
||
|
||
dwTdHandle = dataTree.GetItemData(hTdItem);
|
||
if (TRUE == m_BatchExportFlag)
|
||
{
|
||
dwTdHandle = m_dwItemHandle;
|
||
}
|
||
try
|
||
{
|
||
if (TRUE != theApp.m_pTdManager->GetTestingData(dwTdHandle)->SaveTdToCsvFile(f_szFileName))
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
}
|
||
catch (...)
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
return uExecCode;
|
||
}
|
||
UINT CDataOperator::ExportSPCETdToTxt(CNavDataView *pNavDataView, CString f_szFileName)
|
||
{
|
||
UINT uExecCode = (UINT)APP_SUCCESS;
|
||
DWORD dwTdHandle = (DWORD)VAL_ZERO;
|
||
HTREEITEM hTdItem = NULL;
|
||
|
||
CTreeCtrl& dataTree = pNavDataView->m_dataTree;
|
||
|
||
hTdItem = dataTree.GetSelectedItem();
|
||
|
||
dwTdHandle = dataTree.GetItemData(hTdItem);
|
||
if (TRUE == m_BatchExportFlag)
|
||
{
|
||
dwTdHandle = m_dwItemHandle;
|
||
}
|
||
try
|
||
{
|
||
if (TRUE != theApp.m_pTdManager->GetTestingData(dwTdHandle)->ExportSpDataToTxt(f_szFileName))
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
}
|
||
catch (...)
|
||
{
|
||
uExecCode = (UINT)APP_SUCCESS;
|
||
}
|
||
return uExecCode;
|
||
}
|
||
|
||
UINT CDataOperator::ExportIpCETdToExcel(CNavDataView *pNavDataView, CString f_szFileName)
|
||
{
|
||
UINT uExecCode = (UINT)APP_SUCCESS;
|
||
DWORD dwTdHandle = (DWORD)VAL_ZERO;
|
||
HTREEITEM hTdItem = NULL;
|
||
|
||
CTreeCtrl& dataTree = pNavDataView->m_dataTree;
|
||
|
||
hTdItem = dataTree.GetSelectedItem();
|
||
|
||
dwTdHandle = dataTree.GetItemData(hTdItem);
|
||
if (TRUE == m_BatchExportFlag)
|
||
{
|
||
dwTdHandle = m_dwItemHandle;
|
||
}
|
||
try
|
||
{
|
||
if (TRUE != theApp.m_pTdManager->GetTestingData(dwTdHandle)->SaveTdToExcelFile(f_szFileName))
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
}
|
||
catch (...)
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
|
||
return uExecCode;
|
||
}
|
||
|
||
UINT CDataOperator::ExportIpCETdToCSV(CNavDataView *pNavDataView, CString f_szFileName)
|
||
{
|
||
UINT uExecCode = (UINT)APP_SUCCESS;
|
||
DWORD dwTdHandle = (DWORD)VAL_ZERO;
|
||
HTREEITEM hTdItem = NULL;
|
||
|
||
CTreeCtrl& dataTree = pNavDataView->m_dataTree;
|
||
|
||
hTdItem = dataTree.GetSelectedItem();
|
||
|
||
dwTdHandle = dataTree.GetItemData(hTdItem);
|
||
if (TRUE == m_BatchExportFlag)
|
||
{
|
||
dwTdHandle = m_dwItemHandle;
|
||
}
|
||
try
|
||
{
|
||
if (TRUE != theApp.m_pTdManager->GetTestingData(dwTdHandle)->SaveTdToCsvFile(f_szFileName))
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
}
|
||
catch (...)
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
|
||
return uExecCode;
|
||
}
|
||
|
||
|
||
UINT CDataOperator::ExportIp2DTdToExcel(CNavDataView *pNavDataView, CString f_szFileName)
|
||
{
|
||
UINT uExecCode = (UINT)APP_SUCCESS;
|
||
DWORD dwTdHandle = (DWORD)VAL_ZERO;
|
||
HTREEITEM hTdItem = NULL;
|
||
if (NULL == pNavDataView)
|
||
{
|
||
ASSERT(pNavDataView != NULL);
|
||
uExecCode = (UINT)APP_FAIL;
|
||
return uExecCode;
|
||
}
|
||
CTreeCtrl& dataTree = pNavDataView->m_dataTree;
|
||
|
||
hTdItem = dataTree.GetSelectedItem();
|
||
|
||
dwTdHandle = dataTree.GetItemData(hTdItem);
|
||
if (TRUE == m_BatchExportFlag)
|
||
{
|
||
dwTdHandle = m_dwItemHandle;
|
||
}
|
||
try
|
||
{
|
||
if (NULL == theApp.m_pTdManager)
|
||
{
|
||
ASSERT(theApp.m_pTdManager != NULL);
|
||
uExecCode = (UINT)APP_FAIL;
|
||
return uExecCode;
|
||
}
|
||
|
||
CTestingData* pTestingData = theApp.m_pTdManager->GetTestingData(dwTdHandle);
|
||
if (NULL == pTestingData)
|
||
{
|
||
ASSERT(pTestingData != NULL);
|
||
uExecCode = (UINT)APP_FAIL;
|
||
return uExecCode;
|
||
}
|
||
|
||
if (TRUE != pTestingData->SaveTdToExcelFile(f_szFileName))
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
}
|
||
//catch (...)
|
||
catch (...)
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
|
||
return uExecCode;
|
||
}
|
||
UINT CDataOperator::ExportIp3DTdToExcel(CNavDataView *pNavDataView, CString f_szFileName)
|
||
{
|
||
UINT uExecCode = (UINT)APP_SUCCESS;
|
||
DWORD dwTdHandle = (DWORD)VAL_ZERO;
|
||
HTREEITEM hTdItem = NULL;
|
||
|
||
CTreeCtrl& dataTree = pNavDataView->m_dataTree;
|
||
|
||
hTdItem = dataTree.GetSelectedItem();
|
||
|
||
dwTdHandle = dataTree.GetItemData(hTdItem);
|
||
if (TRUE == m_BatchExportFlag)
|
||
{
|
||
dwTdHandle = m_dwItemHandle;
|
||
}
|
||
try
|
||
{
|
||
if (TRUE != theApp.m_pTdManager->GetTestingData(dwTdHandle)->SaveTdToExcelFile(f_szFileName))
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
}
|
||
catch (...)
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
return uExecCode;
|
||
}
|
||
|
||
UINT CDataOperator::ExportIp2DTdToCSV(CNavDataView *pNavDataView, CString f_szFileName)
|
||
{
|
||
UINT uExecCode = (UINT)APP_SUCCESS;
|
||
DWORD dwTdHandle = (DWORD)VAL_ZERO;
|
||
HTREEITEM hTdItem = NULL;
|
||
if (NULL == pNavDataView)
|
||
{
|
||
ASSERT(pNavDataView != NULL);
|
||
uExecCode = (UINT)APP_FAIL;
|
||
return uExecCode;
|
||
}
|
||
CTreeCtrl& dataTree = pNavDataView->m_dataTree;
|
||
|
||
hTdItem = dataTree.GetSelectedItem();
|
||
|
||
dwTdHandle = dataTree.GetItemData(hTdItem);
|
||
if (TRUE == m_BatchExportFlag)
|
||
{
|
||
dwTdHandle = m_dwItemHandle;
|
||
}
|
||
try
|
||
{
|
||
if (NULL == theApp.m_pTdManager)
|
||
{
|
||
ASSERT(theApp.m_pTdManager != NULL);
|
||
uExecCode = (UINT)APP_FAIL;
|
||
return uExecCode;
|
||
}
|
||
|
||
CTestingData* pTestingData = theApp.m_pTdManager->GetTestingData(dwTdHandle);
|
||
if (NULL == pTestingData)
|
||
{
|
||
ASSERT(pTestingData != NULL);
|
||
uExecCode = (UINT)APP_FAIL;
|
||
return uExecCode;
|
||
}
|
||
|
||
if (TRUE != pTestingData->SaveTdToCsvFile(f_szFileName))
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
}
|
||
//catch (...)
|
||
catch (...)
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
|
||
return uExecCode;
|
||
}
|
||
UINT CDataOperator::ExportIp3DTdToCSV(CNavDataView *pNavDataView, CString f_szFileName)
|
||
{
|
||
UINT uExecCode = (UINT)APP_SUCCESS;
|
||
DWORD dwTdHandle = (DWORD)VAL_ZERO;
|
||
HTREEITEM hTdItem = NULL;
|
||
|
||
CTreeCtrl& dataTree = pNavDataView->m_dataTree;
|
||
|
||
hTdItem = dataTree.GetSelectedItem();
|
||
|
||
dwTdHandle = dataTree.GetItemData(hTdItem);
|
||
if (TRUE == m_BatchExportFlag)
|
||
{
|
||
dwTdHandle = m_dwItemHandle;
|
||
}
|
||
try
|
||
{
|
||
if (TRUE != theApp.m_pTdManager->GetTestingData(dwTdHandle)->SaveTdToCsvFile(f_szFileName))
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
}
|
||
catch (...)
|
||
{
|
||
uExecCode = (UINT)APP_FAIL;
|
||
}
|
||
return uExecCode;
|
||
}
|
||
|
||
UINT CDataOperator::Delete2DRecord(CNavDataView *pNavDataView, int iTSN)
|
||
{
|
||
UINT uExecCode = (UINT)APP_SUCCESS;
|
||
|
||
HTREEITEM hTdItem = NULL;
|
||
HTREEITEM hTzItem = NULL;
|
||
|
||
DWORD dwTdHandle = (DWORD)VAL_ZERO;
|
||
DWORD dwTdID = (DWORD)VAL_ZERO;
|
||
|
||
hTdItem = pNavDataView->m_dataTree.GetSelectedItem();
|
||
|
||
hTzItem = pNavDataView->m_dataTree.GetParentItem(hTdItem);
|
||
dwTdHandle = pNavDataView->m_dataTree.GetItemData(hTdItem);
|
||
|
||
dwTdID = m_handleProcessor.GetIDFromHandle(dwTdHandle);
|
||
|
||
CString szSql = _T("");
|
||
|
||
try
|
||
{
|
||
_CommandPtr pCmdDelRspTd = NULL;
|
||
pCmdDelRspTd.CreateInstance(_uuidof(Command));
|
||
pCmdDelRspTd->ActiveConnection = m_pConnection;
|
||
|
||
szSql.Empty();
|
||
szSql.Format(_T("update td2dcon set bUse = false where TCHID in (select ID from tdchannel where TDID = %u) and TSN = %d"), dwTdID,iTSN);
|
||
|
||
pCmdDelRspTd->CommandText = szSql.AllocSysString();
|
||
pCmdDelRspTd->Execute(NULL, NULL, adCmdText);
|
||
|
||
//更新测点数量减1
|
||
szSql.Empty();
|
||
szSql.Format(_T("update td set TPamount = TPamount - 1 where ID = %d "), dwTdID);
|
||
|
||
pCmdDelRspTd->CommandText = szSql.AllocSysString();
|
||
pCmdDelRspTd->Execute(NULL, NULL, adCmdText);
|
||
}
|
||
catch (_com_error e)
|
||
{
|
||
AfxMessageBox(e.Description());
|
||
return APP_ERR_DB;
|
||
}
|
||
|
||
|
||
return uExecCode;
|
||
}
|
||
|
||
UINT CDataOperator::Delete1DRecord(CNavDataView *pNavDataView, int iTSN)
|
||
{
|
||
UINT uExecCode = (UINT)APP_SUCCESS;
|
||
|
||
HTREEITEM hTdItem = NULL;
|
||
HTREEITEM hTzItem = NULL;
|
||
|
||
DWORD dwTdHandle = (DWORD)VAL_ZERO;
|
||
DWORD dwTdID = (DWORD)VAL_ZERO;
|
||
|
||
hTdItem = pNavDataView->m_dataTree.GetSelectedItem();
|
||
|
||
hTzItem = pNavDataView->m_dataTree.GetParentItem(hTdItem);
|
||
dwTdHandle = pNavDataView->m_dataTree.GetItemData(hTdItem);
|
||
|
||
dwTdID = m_handleProcessor.GetIDFromHandle(dwTdHandle);
|
||
|
||
CString szSql = _T("");
|
||
|
||
try
|
||
{
|
||
_CommandPtr pCmdDelRspTd = NULL;
|
||
pCmdDelRspTd.CreateInstance(_uuidof(Command));
|
||
pCmdDelRspTd->ActiveConnection = m_pConnection;
|
||
|
||
szSql.Empty();
|
||
szSql.Format(_T("update td1dcon set bUse = false where TCHID in (select ID from tdchannel where TDID = %u) and TSN = %d"), dwTdID,iTSN);
|
||
|
||
pCmdDelRspTd->CommandText = szSql.AllocSysString();
|
||
pCmdDelRspTd->Execute(NULL, NULL, adCmdText);
|
||
|
||
//更新测点数量减1
|
||
szSql.Empty();
|
||
szSql.Format(_T("update td set TPamount = TPamount - 1 where ID = %d "), dwTdID);
|
||
|
||
pCmdDelRspTd->CommandText = szSql.AllocSysString();
|
||
pCmdDelRspTd->Execute(NULL, NULL, adCmdText);
|
||
}
|
||
catch (_com_error e)
|
||
{
|
||
AfxMessageBox(e.Description());
|
||
return APP_ERR_DB;
|
||
}
|
||
|
||
|
||
return uExecCode;
|
||
}
|
||
|
||
UINT CDataOperator::Delete3DRecord(CNavDataView *pNavDataView, int iTSN)
|
||
{
|
||
UINT uExecCode = (UINT)APP_SUCCESS;
|
||
|
||
HTREEITEM hTdItem = NULL;
|
||
HTREEITEM hTzItem = NULL;
|
||
|
||
DWORD dwTdHandle = (DWORD)VAL_ZERO;
|
||
DWORD dwTdID = (DWORD)VAL_ZERO;
|
||
|
||
hTdItem = pNavDataView->m_dataTree.GetSelectedItem();
|
||
|
||
hTzItem = pNavDataView->m_dataTree.GetParentItem(hTdItem);
|
||
dwTdHandle = pNavDataView->m_dataTree.GetItemData(hTdItem);
|
||
|
||
dwTdID = m_handleProcessor.GetIDFromHandle(dwTdHandle);
|
||
|
||
CString szSql = _T("");
|
||
|
||
try
|
||
{
|
||
_CommandPtr pCmdDelRspTd = NULL;
|
||
pCmdDelRspTd.CreateInstance(_uuidof(Command));
|
||
pCmdDelRspTd->ActiveConnection = m_pConnection;
|
||
|
||
szSql.Empty();
|
||
szSql.Format(_T("update td3dcon set bUse = false where TCHID in (select ID from tdchannel where TDID = %u) and TSN = %d"), dwTdID,iTSN);
|
||
|
||
pCmdDelRspTd->CommandText = szSql.AllocSysString();
|
||
pCmdDelRspTd->Execute(NULL, NULL, adCmdText);
|
||
|
||
//更新测点数量减1
|
||
szSql.Empty();
|
||
szSql.Format(_T("update td set TPamount = TPamount - 1 where ID = %d "), dwTdID);
|
||
|
||
pCmdDelRspTd->CommandText = szSql.AllocSysString();
|
||
pCmdDelRspTd->Execute(NULL, NULL, adCmdText);
|
||
}
|
||
catch (_com_error e)
|
||
{
|
||
AfxMessageBox(e.Description());
|
||
return APP_ERR_DB;
|
||
}
|
||
|
||
|
||
return uExecCode;
|
||
}
|
||
|
||
void CDataOperator::CombineTask(CNavDataView *pNavData)
|
||
{
|
||
HTREEITEM hProItem = NULL;
|
||
HTREEITEM hTdItem = NULL;
|
||
DWORD dwHandle;
|
||
DWORD dwProHandle = (DWORD)VAL_ZERO;
|
||
DWORD dwProID = (DWORD)VAL_ZERO;
|
||
UINT uImageState = (UINT)VAL_ZERO;
|
||
uImageState = m_stateProcessor.ChangeToImageState(PZ_STATE_DB);
|
||
hProItem = pNavData->m_dataTree.GetSelectedItem();
|
||
dwProHandle = pNavData->m_dataTree.GetItemData(hProItem);
|
||
dwProID = m_handleProcessor.GetIDFromHandle(dwProHandle);
|
||
CDialCombine3DTask dialCmb3DTask(m_pConnection, dwProID);
|
||
if (IDOK == dialCmb3DTask.DoModal())
|
||
{
|
||
hTdItem = pNavData->m_dataTree.InsertItem(dialCmb3DTask.m_strTaskName,hProItem);
|
||
dwHandle = m_handleProcessor.GenerateHandle(dialCmb3DTask.m_dwTdID,GetTestType(dialCmb3DTask.m_iSptType, dialCmb3DTask.m_iTestType));
|
||
pNavData->m_dataTree.SetItemData(hTdItem, dwHandle);
|
||
pNavData->m_dataTree.SetItemState(hTdItem, uImageState, TVIS_STATEIMAGEMASK);
|
||
pNavData->m_dataTree.SelectItem(hTdItem);
|
||
}
|
||
|
||
//旧的三维合并方案
|
||
/*
|
||
HTREEITEM hTzItem = NULL;
|
||
HTREEITEM hTdItem = NULL;
|
||
DWORD dwHandle;
|
||
|
||
//////////////////////////////////////////////////////////////////////////
|
||
DWORD dwTzHandle = (DWORD)VAL_ZERO;
|
||
DWORD dwTzID = (DWORD)VAL_ZERO;
|
||
hTzItem = pNavData->m_dataTree.GetSelectedItem();
|
||
dwTzHandle = pNavData->m_dataTree.GetItemData(hTzItem);
|
||
dwTzID = m_handleProcessor.GetIDFromHandle(dwTzHandle);
|
||
|
||
_RecordsetPtr pRecTz = NULL;
|
||
pRecTz.CreateInstance(_uuidof(Recordset));
|
||
CString strQuery = _T("");
|
||
//在这里TZtype应该选3,但是现在由于此函数不可用,所以暂时不改
|
||
strQuery.Format(_T("select * from tz where TZtype =2 and ID = %d"), dwTzID);
|
||
|
||
pRecTz->Open(strQuery.AllocSysString(), _variant_t((IDispatch*)m_pConnection, true),
|
||
adOpenStatic, adLockOptimistic, adCmdText);
|
||
//如果没有记录,则表明此测区不是三维的测区,则不支持进行任务的合并
|
||
if ((long)VAL_ZERO == pRecTz->GetRecordCount())
|
||
{
|
||
AfxMessageBox(_T("Not support combine task in this testzone's type!"));
|
||
pRecTz->Close();
|
||
return;
|
||
}
|
||
pRecTz->Close();
|
||
|
||
//////////////////////////////////////////////////////////////////////////
|
||
hTzItem = NULL;
|
||
UINT uImageState = (UINT)VAL_ZERO;
|
||
uImageState = m_stateProcessor.ChangeToImageState(PZ_STATE_DB);
|
||
|
||
CCombineDlg CombineDlg(pNavData, m_handleProcessor, m_pConnection);
|
||
|
||
if (CombineDlg.DoModal() == IDOK)
|
||
{
|
||
hTzItem = pNavData->m_dataTree.GetSelectedItem();
|
||
hTdItem = pNavData->m_dataTree.InsertItem(CombineDlg.m_szTaskName,hTzItem);
|
||
|
||
dwHandle = CombineDlg.m_handleProcessor.GenerateHandle(CombineDlg.m_TdID, GetTestType(CombineDlg.m_scriptType, CombineDlg.m_testType));
|
||
|
||
pNavData->m_dataTree.SetItemData(hTdItem, dwHandle);
|
||
pNavData->m_dataTree.SetItemState(hTdItem, uImageState, TVIS_STATEIMAGEMASK);
|
||
|
||
pNavData->m_dataTree.SelectItem(hTdItem);
|
||
}
|
||
*/
|
||
}
|
||
|
||
|
||
void CDataOperator::ExportTdOrgFile(CNavDataView *pNavData)
|
||
{
|
||
//这个函数还没有实现完成
|
||
|
||
if (NULL == pNavData)
|
||
{
|
||
return;
|
||
}
|
||
|
||
HTREEITEM hProItem = NULL;
|
||
HTREEITEM hTdItem = NULL;
|
||
DWORD dwProHandle = (DWORD)VAL_ZERO;
|
||
DWORD dwProID = (DWORD)VAL_ZERO;
|
||
DWORD dwTdHandle = (DWORD)VAL_ZERO;
|
||
DWORD dwTdID = (DWORD)VAL_ZERO;
|
||
hTdItem = pNavData->m_dataTree.GetSelectedItem();
|
||
hProItem = pNavData->m_dataTree.GetParentItem(hTdItem);
|
||
if (NULL == hProItem || NULL == hTdItem)
|
||
{
|
||
if (LANG_ZHCN == g_iUILanguage)
|
||
AfxMessageBox(_T("获取树节点失败"));
|
||
else
|
||
MessageBoxEx(NULL, _T("Get tree item failed."), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
||
return;
|
||
}
|
||
CString strTdName = pNavData->m_dataTree.GetItemText(hTdItem);
|
||
dwProHandle = pNavData->m_dataTree.GetItemData(hProItem);
|
||
dwProID = m_handleProcessor.GetIDFromHandle(dwProHandle);
|
||
dwTdHandle = pNavData->m_dataTree.GetItemData(hTdItem);
|
||
dwTdID = m_handleProcessor.GetIDFromHandle(dwTdHandle);
|
||
|
||
_RecordsetPtr pRecProID = NULL;
|
||
_RecordsetPtr pRecTdID = NULL;
|
||
_RecordsetPtr pRecTzID = NULL;
|
||
|
||
CString szSql = _T("");
|
||
CString szFileName = _T("");
|
||
CString szDstFile = _T("");
|
||
CString strProCN = _T("");
|
||
CString strTzCN = _T("");
|
||
CString strTdCN = _T("");
|
||
CString szLocFilePath = _T("");
|
||
|
||
pRecProID.CreateInstance(_uuidof(Recordset));
|
||
pRecTdID.CreateInstance(_uuidof(Recordset));
|
||
pRecTzID.CreateInstance(_uuidof(Recordset));
|
||
|
||
//查询工程的CN
|
||
szSql.Empty();
|
||
szSql.Format(_T("select CN from project where ID = %d"), dwProID);
|
||
pRecProID->Open(szSql.AllocSysString(), _variant_t((IDispatch*)m_pConnection, true), adOpenStatic, adLockOptimistic, adCmdText);
|
||
if ((long)VAL_ZERO == pRecProID->GetRecordCount())
|
||
{
|
||
if (LANG_ZHCN == g_iUILanguage)
|
||
AfxMessageBox(_T("无法查询项目的CN信息"));
|
||
else
|
||
MessageBoxEx(NULL, _T("Can not query project's CN information."), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
||
pRecProID->Close();
|
||
return;
|
||
}
|
||
strProCN = pRecProID->GetCollect(_T("CN")).vt == VT_NULL ? _T("") : (LPCTSTR)(_bstr_t)pRecProID->GetCollect(_T("CN"));
|
||
pRecProID->Close();
|
||
if (strProCN.IsEmpty())
|
||
{
|
||
if (LANG_ZHCN == g_iUILanguage)
|
||
AfxMessageBox(_T("项目的CN信息为空"));
|
||
else
|
||
MessageBoxEx(NULL, _T("Project's CN information is empty."), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
||
return;
|
||
}
|
||
//查询测区的CN
|
||
szSql.Empty();
|
||
szSql.Format(_T("select CN from tz where PRID = %d"), dwProID);
|
||
pRecTzID->Open(szSql.AllocSysString(), _variant_t((IDispatch*)m_pConnection, true), adOpenStatic, adLockOptimistic, adCmdText);
|
||
if ((long)VAL_ZERO == pRecTzID->GetRecordCount())
|
||
{
|
||
if (LANG_ZHCN == g_iUILanguage)
|
||
AfxMessageBox(_T("无法查询测试区域的CN信息"));
|
||
else
|
||
MessageBoxEx(NULL, _T("Can not query testzone's CN information."), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
||
pRecTzID->Close();
|
||
return;
|
||
}
|
||
strTzCN = pRecTzID->GetCollect(_T("CN")).vt == VT_NULL ? _T("") : (LPCTSTR)(_bstr_t)pRecTzID->GetCollect(_T("CN"));
|
||
pRecTzID->Close();
|
||
if (strTzCN.IsEmpty())
|
||
{
|
||
if (LANG_ZHCN == g_iUILanguage)
|
||
AfxMessageBox(_T("测试区域的CN信息是空"));
|
||
else
|
||
MessageBoxEx(NULL, _T("Testzone's CN information is empty."), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
||
return;
|
||
}
|
||
//查询任务的CN
|
||
int iTdType = 0;
|
||
szSql.Empty();
|
||
szSql.Format(_T("select TDCN, Ttype from td where ID = %d"), dwTdID);
|
||
pRecTdID->Open(szSql.AllocSysString(), _variant_t((IDispatch*)m_pConnection, true), adOpenStatic, adLockOptimistic, adCmdText);
|
||
if ((long)VAL_ZERO == pRecTdID->GetRecordCount())
|
||
{
|
||
if (LANG_ZHCN == g_iUILanguage)
|
||
AfxMessageBox(_T("无法查询td的CN信息"));
|
||
else
|
||
MessageBoxEx(NULL, _T("Can not query td's CN information."), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
||
pRecTdID->Close();
|
||
return;
|
||
}
|
||
strTdCN = pRecTdID->GetCollect(_T("TDCN")).vt == VT_NULL ? _T("") : (LPCTSTR)(_bstr_t)pRecTdID->GetCollect(_T("TDCN"));
|
||
iTdType = pRecTdID->GetCollect(_T("Ttype")).iVal;
|
||
pRecTdID->Close();
|
||
if (strTdCN.IsEmpty())
|
||
{
|
||
if (LANG_ZHCN == g_iUILanguage)
|
||
AfxMessageBox(_T("任务的CN信息是空"));
|
||
else
|
||
MessageBoxEx(NULL, _T("Task's CN information is empty."), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
||
return;
|
||
}
|
||
//获取REC文件的源地址
|
||
szLocFilePath.Empty();
|
||
szLocFilePath.GetBufferSetLength(256);
|
||
::GetCurrentDirectory(szLocFilePath.GetLength(), szLocFilePath.GetBuffer(szLocFilePath.GetLength()));
|
||
szLocFilePath.ReleaseBuffer();
|
||
|
||
szLocFilePath = szLocFilePath + _T("\\CACHE\\projects\\");
|
||
szFileName.Empty();
|
||
szFileName.Format(_T("%s%s\\%s\\%s.org"), szLocFilePath, strProCN, strTzCN, strTdCN);
|
||
if (PathFileExistsA(szFileName) == FALSE)
|
||
{
|
||
if (LANG_ZHCN == g_iUILanguage)
|
||
AfxMessageBox(_T("原始org文件不存在!"));
|
||
else
|
||
MessageBoxEx(NULL, _T("Original org File not Existed."), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
||
return;
|
||
}
|
||
|
||
}
|
||
|
||
void CDataOperator::ExportTdRecFile(CNavDataView *pNavData)
|
||
{
|
||
|
||
if (NULL == pNavData)
|
||
{
|
||
return;
|
||
}
|
||
|
||
HTREEITEM hProItem = NULL;
|
||
HTREEITEM hTdItem = NULL;
|
||
DWORD dwProHandle = (DWORD)VAL_ZERO;
|
||
DWORD dwProID = (DWORD)VAL_ZERO;
|
||
DWORD dwTdHandle = (DWORD)VAL_ZERO;
|
||
DWORD dwTdID = (DWORD)VAL_ZERO;
|
||
hTdItem = pNavData->m_dataTree.GetSelectedItem();
|
||
hProItem = pNavData->m_dataTree.GetParentItem(hTdItem);
|
||
if (NULL == hProItem || NULL == hTdItem)
|
||
{
|
||
if (LANG_ZHCN == g_iUILanguage)
|
||
AfxMessageBox(_T("获取树节点失败"));
|
||
else
|
||
MessageBoxEx(NULL, _T("Get tree item failed."), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
||
return;
|
||
}
|
||
CString strTdName = pNavData->m_dataTree.GetItemText(hTdItem);
|
||
dwProHandle = pNavData->m_dataTree.GetItemData(hProItem);
|
||
dwProID = m_handleProcessor.GetIDFromHandle(dwProHandle);
|
||
dwTdHandle = pNavData->m_dataTree.GetItemData(hTdItem);
|
||
dwTdID = m_handleProcessor.GetIDFromHandle(dwTdHandle);
|
||
|
||
_RecordsetPtr pRecProID = NULL;
|
||
_RecordsetPtr pRecTdID = NULL;
|
||
_RecordsetPtr pRecTzID = NULL;
|
||
|
||
CString szSql = _T("");
|
||
CString szFileName = _T("");
|
||
CString szDstFile = _T("");
|
||
CString strProCN = _T("");
|
||
CString strTzCN = _T("");
|
||
CString strTdCN = _T("");
|
||
CString szLocFilePath = _T("");
|
||
|
||
pRecProID.CreateInstance(_uuidof(Recordset));
|
||
pRecTdID.CreateInstance(_uuidof(Recordset));
|
||
pRecTzID.CreateInstance(_uuidof(Recordset));
|
||
|
||
//查询工程的CN
|
||
szSql.Empty();
|
||
szSql.Format(_T("select CN from project where ID = %d"), dwProID);
|
||
pRecProID->Open(szSql.AllocSysString(), _variant_t((IDispatch*)m_pConnection, true), adOpenStatic, adLockOptimistic, adCmdText);
|
||
if ((long)VAL_ZERO == pRecProID->GetRecordCount())
|
||
{
|
||
if (LANG_ZHCN == g_iUILanguage)
|
||
AfxMessageBox(_T("无法查询项目的CN信息"));
|
||
else
|
||
MessageBoxEx(NULL, _T("Can not query project's CN information."), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
||
pRecProID->Close();
|
||
return;
|
||
}
|
||
strProCN = pRecProID->GetCollect(_T("CN")).vt == VT_NULL ? _T("") : (LPCTSTR)(_bstr_t)pRecProID->GetCollect(_T("CN"));
|
||
pRecProID->Close();
|
||
if (strProCN.IsEmpty())
|
||
{
|
||
if (LANG_ZHCN == g_iUILanguage)
|
||
AfxMessageBox(_T("项目的CN信息为空"));
|
||
else
|
||
MessageBoxEx(NULL, _T("Project's CN information is empty."), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
||
return;
|
||
}
|
||
//查询测区的CN
|
||
szSql.Empty();
|
||
szSql.Format(_T("select CN from tz where PRID = %d"), dwProID);
|
||
pRecTzID->Open(szSql.AllocSysString(), _variant_t((IDispatch*)m_pConnection, true), adOpenStatic, adLockOptimistic, adCmdText);
|
||
if ((long)VAL_ZERO == pRecTzID->GetRecordCount())
|
||
{
|
||
if (LANG_ZHCN == g_iUILanguage)
|
||
AfxMessageBox(_T("无法查询测试区域的CN信息"));
|
||
else
|
||
MessageBoxEx(NULL, _T("Can not query testzone's CN information."), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
||
pRecTzID->Close();
|
||
return;
|
||
}
|
||
strTzCN = pRecTzID->GetCollect(_T("CN")).vt == VT_NULL ? _T("") : (LPCTSTR)(_bstr_t)pRecTzID->GetCollect(_T("CN"));
|
||
pRecTzID->Close();
|
||
if (strTzCN.IsEmpty())
|
||
{
|
||
if (LANG_ZHCN == g_iUILanguage)
|
||
AfxMessageBox(_T("测试区域的CN信息是空"));
|
||
else
|
||
MessageBoxEx(NULL, _T("Testzone's CN information is empty."), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
||
return;
|
||
}
|
||
//查询任务的CN
|
||
int iTdType = 0;
|
||
szSql.Empty();
|
||
szSql.Format(_T("select TDCN, Ttype from td where ID = %d"), dwTdID);
|
||
pRecTdID->Open(szSql.AllocSysString(), _variant_t((IDispatch*)m_pConnection, true), adOpenStatic, adLockOptimistic, adCmdText);
|
||
if ((long)VAL_ZERO == pRecTdID->GetRecordCount())
|
||
{
|
||
if (LANG_ZHCN == g_iUILanguage)
|
||
AfxMessageBox(_T("无法查询td的CN信息"));
|
||
else
|
||
MessageBoxEx(NULL, _T("Can not query td's CN information."), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
||
pRecTdID->Close();
|
||
return;
|
||
}
|
||
strTdCN = pRecTdID->GetCollect(_T("TDCN")).vt == VT_NULL ? _T("") : (LPCTSTR)(_bstr_t)pRecTdID->GetCollect(_T("TDCN"));
|
||
iTdType = pRecTdID->GetCollect(_T("Ttype")).iVal;
|
||
pRecTdID->Close();
|
||
if (strTdCN.IsEmpty())
|
||
{
|
||
if (LANG_ZHCN == g_iUILanguage)
|
||
AfxMessageBox(_T("任务的CN信息是空"));
|
||
else
|
||
MessageBoxEx(NULL, _T("Task's CN information is empty."), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
||
return;
|
||
}
|
||
//获取REC文件的源地址
|
||
szLocFilePath.Empty();
|
||
szLocFilePath.GetBufferSetLength(256);
|
||
::GetCurrentDirectory(szLocFilePath.GetLength(), szLocFilePath.GetBuffer(szLocFilePath.GetLength()));
|
||
szLocFilePath.ReleaseBuffer();
|
||
|
||
szLocFilePath = szLocFilePath + _T("\\CACHE\\projects\\");
|
||
szFileName.Empty();
|
||
szFileName.Format(_T("%s%s\\%s\\%s.rec"), szLocFilePath, strProCN, strTzCN, strTdCN);
|
||
if (PathFileExistsA(szFileName) == FALSE)
|
||
{
|
||
if (LANG_ZHCN == g_iUILanguage)
|
||
AfxMessageBox(_T("原始Rec文件不存在!"));
|
||
else
|
||
MessageBoxEx(NULL, _T("Original Rec File not Existed."), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
||
return;
|
||
}
|
||
//szFileName.Format(_T("%s\\SD\\projects\\%s\\%s\\%s.rec"),CDetcGD10Dev::GetInstance()->GetGD10DevAddr(), strProCN, strTzCN, strTdCN);
|
||
//获取目的地址
|
||
//OFN_NOCHANGEDIR:Restores the current directory to its original value if the user changed the directory while searching for files
|
||
//也就是说如果用FileDialog中间改变了目录的路径之后,调用GetCurrentDirectory函数也能够返回原始目录,原始目录并不改变
|
||
//如果没有次熟悉,则原始目录会改变
|
||
//由于GetBuffer(MAX_PATH)可能会改变其内容,所以在这里先用备份的来当做文件名的保存
|
||
CString strBackTdName = strTdName;
|
||
CFileDialog *pFileDial = new CFileDialog(FALSE, _T("xml"), _T(""), OFN_OVERWRITEPROMPT|OFN_HIDEREADONLY|OFN_NOCHANGEDIR,
|
||
_T("xml files(*.xml)|*.xml|All Files (*.*)|*.*||"), NULL);
|
||
pFileDial->m_ofn.lpstrTitle = _T("Open files");
|
||
pFileDial->m_ofn.lpstrFile = strBackTdName.GetBuffer(MAX_PATH);
|
||
pFileDial->m_ofn.nMaxFile = MAX_PATH;
|
||
if (IDOK != pFileDial->DoModal())
|
||
{
|
||
strBackTdName.ReleaseBuffer();
|
||
return;
|
||
}
|
||
szDstFile = pFileDial->GetPathName();
|
||
strBackTdName.ReleaseBuffer();
|
||
if (SaveRecFileToLocal(szFileName, szDstFile, iTdType))
|
||
{
|
||
if (LANG_ZHCN == g_iUILanguage)
|
||
AfxMessageBox(_T("导出成功."));
|
||
else
|
||
MessageBoxEx(NULL, _T("Save file success."), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
||
}
|
||
else
|
||
{
|
||
if (LANG_ZHCN == g_iUILanguage)
|
||
AfxMessageBox(_T("导出失败."));
|
||
else
|
||
MessageBoxEx(NULL, _T("Save file failed."), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
||
}
|
||
|
||
}
|
||
|
||
bool CDataOperator::SaveRecFileToLocal(CString strRecFile, CString strDstFile, int iTaskType)
|
||
{
|
||
CString strLog = _T("");
|
||
CString strTdType = _T("");
|
||
if (!CFileOperTools::GetInstance()->IsFileExist(strRecFile))
|
||
{
|
||
if (LANG_ZHCN == g_iUILanguage)
|
||
AfxMessageBox(_T("原始文件不存在."));
|
||
else
|
||
MessageBoxEx(NULL, _T("Orginial file is not exist."), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
||
|
||
strLog.Empty();
|
||
strLog.Format(_T("[DataOperator][%d]Orginial file is not exist, file_path = %s"), __LINE__, strRecFile);
|
||
CFileOperTools::GetInstance()->WriteComLog(strLog);
|
||
return false;
|
||
}
|
||
switch (iTaskType)
|
||
{
|
||
case 0:
|
||
strTdType = _T("RES");
|
||
break;
|
||
case 1:
|
||
strTdType = _T("IP");
|
||
break;
|
||
case 2:
|
||
strTdType = _T("SP");
|
||
break;
|
||
default:
|
||
if (LANG_ZHCN == g_iUILanguage)
|
||
{
|
||
strLog.Format(_T("解析任务类型错误 %d"), iTaskType);
|
||
AfxMessageBox(strLog);
|
||
}
|
||
else
|
||
{
|
||
strLog.Format(_T("Parser task type error.type = %d"), iTaskType);
|
||
MessageBoxEx(NULL, strLog, STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
||
}
|
||
|
||
return false;
|
||
}
|
||
CMarkup markup;
|
||
CMarkup markupLocal;
|
||
if (!markup.Load(strRecFile))
|
||
{
|
||
if (LANG_ZHCN == g_iUILanguage)
|
||
AfxMessageBox(_T("打开原始文件失败."));
|
||
else
|
||
MessageBoxEx(NULL, _T("Open orginial file failed."), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
||
strLog.Empty();
|
||
strLog.Format(_T("[DataOperator][%d]Orginial file is not exist, file_path = %s,error_code = %d"),
|
||
__LINE__, strRecFile, GetLastError());
|
||
CFileOperTools::GetInstance()->WriteComLog(strLog);
|
||
return false;
|
||
}
|
||
if (!markup.FindElem(_T("Points")))
|
||
{
|
||
if (LANG_ZHCN == g_iUILanguage)
|
||
AfxMessageBox(_T("查找根节点失败"));
|
||
else
|
||
MessageBoxEx(NULL, _T("Find root element(Points)f fialed."), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
||
return false;
|
||
}
|
||
markup.IntoElem();
|
||
bool bIsHaveData = false;
|
||
markupLocal.SetDoc(_T("<?xml version=\"1.0\" encoding=\"ansi\"?>\r\n"));
|
||
if (!markupLocal.AddElem(_T("Points")))
|
||
{
|
||
if (LANG_ZHCN == g_iUILanguage)
|
||
AfxMessageBox(_T("根节点写入文件失败"));
|
||
else
|
||
MessageBoxEx(NULL, _T("Write root element(Points) to file failed."), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
||
return false;
|
||
}
|
||
markupLocal.IntoElem();
|
||
CString strID = _T("");
|
||
CString strWidth = _T("");
|
||
while(markup.FindElem(_T("Point")))
|
||
{
|
||
bIsHaveData = true;
|
||
strID = markup.GetAttrib(_T("ID"));
|
||
//写入元素Point
|
||
markupLocal.AddElem(_T("Point"));
|
||
markupLocal.AddAttrib(_T("ID"), strID);
|
||
|
||
markup.IntoElem();
|
||
int iStackTsn = 0;
|
||
CString strStackTsn = _T("");
|
||
while(markup.FindElem(strTdType))
|
||
{
|
||
strStackTsn.Empty();
|
||
strStackTsn.Format(_T("%d"),++iStackTsn);
|
||
//写入元素V
|
||
if (!markup.FindChildElem(_T("V")))
|
||
{
|
||
if (LANG_ZHCN == g_iUILanguage)
|
||
AfxMessageBox(_T("解析元素V错误"));
|
||
else
|
||
MessageBoxEx(NULL, _T("Parser element V error."), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
||
strLog.Empty();
|
||
strLog.Format(_T("[DataOperator][%d]Can not found element v in ID = %s"), __LINE__, strID);
|
||
CFileOperTools::GetInstance()->WriteComLog(strLog);
|
||
return false;
|
||
}
|
||
strWidth = markup.GetChildAttrib(_T("width"));
|
||
//将元素V的值写入到新文件当中
|
||
bool bIsAddSucc = false;
|
||
if (markupLocal.AddChildElem(_T("V")))
|
||
{
|
||
if (markupLocal.AddChildAttrib(_T("width"), strWidth))
|
||
{
|
||
markupLocal.AddChildAttrib(_T("stack"), strStackTsn);
|
||
if (markupLocal.SetChildData(markup.GetChildData()))
|
||
bIsAddSucc = true;
|
||
else
|
||
{
|
||
strLog.Empty();
|
||
strLog.Format(_T("[DataOperator][%d]set element V data failed in ID = %s, error_code = %d"), __LINE__, strID, GetLastError());
|
||
}
|
||
}
|
||
else
|
||
{
|
||
strLog.Empty();
|
||
strLog.Format(_T("[DataOperator][%d]Add Attribute width(V) failed in ID = %s, error_code = %d"), __LINE__, strID, GetLastError());
|
||
}
|
||
}
|
||
else
|
||
{
|
||
strLog.Empty();
|
||
strLog.Format(_T("[DataOperator][%d]Add Element v failed in ID = %s, error_code = %d"), __LINE__, strID, GetLastError());
|
||
}
|
||
if (!bIsAddSucc)
|
||
{
|
||
CFileOperTools::GetInstance()->WriteComLog(strLog);
|
||
if (LANG_ZHCN == g_iUILanguage)
|
||
AfxMessageBox(_T("写入元素V错误"));
|
||
else
|
||
MessageBoxEx(NULL, _T("Write element v error."), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
||
return false;
|
||
}
|
||
if (!markup.FindChildElem(_T("I")))
|
||
{
|
||
if (LANG_ZHCN == g_iUILanguage)
|
||
AfxMessageBox(_T("解析元素I错误"));
|
||
else
|
||
MessageBoxEx(NULL, _T("Parser element I error."), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
||
strLog.Empty();
|
||
strLog.Format(_T("[DataOperator][%d]Can not found element I in ID = %s"), __LINE__, strID);
|
||
CFileOperTools::GetInstance()->WriteComLog(strLog);
|
||
return false;
|
||
}
|
||
//将元素I的值写入到新文件当中
|
||
bIsAddSucc = false;
|
||
strWidth = markup.GetChildAttrib(_T("width"));
|
||
if (markupLocal.AddChildElem(_T("I")))
|
||
{
|
||
if (markupLocal.AddChildAttrib(_T("width"), strWidth))
|
||
{
|
||
markupLocal.AddChildAttrib(_T("stack"), strStackTsn);
|
||
if (markupLocal.SetChildData(markup.GetChildData()))
|
||
bIsAddSucc = true;
|
||
else
|
||
{
|
||
strLog.Empty();
|
||
strLog.Format(_T("[DataOperator][%d]set element I data failed in ID = %s, error_code = %d"), __LINE__, strID, GetLastError());
|
||
}
|
||
|
||
}
|
||
else
|
||
{
|
||
strLog.Empty();
|
||
strLog.Format(_T("[DataOperator][%d]Add Attribute width(I) failed in ID = %s, error_code = %d"), __LINE__, strID, GetLastError());
|
||
}
|
||
}
|
||
else
|
||
{
|
||
strLog.Empty();
|
||
strLog.Format(_T("[DataOperator][%d]Add Element I failed in ID = %s, error_code = %d"), __LINE__, strID, GetLastError());
|
||
}
|
||
if (!bIsAddSucc)
|
||
{
|
||
CFileOperTools::GetInstance()->WriteComLog(strLog);
|
||
if (LANG_ZHCN == g_iUILanguage)
|
||
AfxMessageBox(_T("写入元素I错误."));
|
||
else
|
||
MessageBoxEx(NULL, _T("Write element I error."), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
||
return false;
|
||
}
|
||
|
||
}
|
||
|
||
markup.OutOfElem();
|
||
}
|
||
|
||
if (bIsHaveData)
|
||
{
|
||
if (markupLocal.Save(strDstFile))
|
||
{
|
||
return true;
|
||
}
|
||
else
|
||
{
|
||
strLog.Empty();
|
||
strLog.Format(_T("[DataOperator][%d]Save file failed. dst_file_path = %s, error_code = %d"), __LINE__, strDstFile, GetLastError());
|
||
CFileOperTools::GetInstance()->WriteComLog(strLog);
|
||
return false;
|
||
}
|
||
|
||
}
|
||
else
|
||
{
|
||
if (LANG_ZHCN == g_iUILanguage)
|
||
AfxMessageBox(_T("原始文件中缺乏有效数据."));
|
||
else
|
||
MessageBoxEx(NULL, _T("Can not found valid data in rec file."), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
||
strLog.Empty();
|
||
strLog.Format(_T("Can not found valid data in rec file. file_path = %s"), strRecFile);
|
||
CFileOperTools::GetInstance()->WriteComLog(strLog);
|
||
return false;
|
||
}
|
||
|
||
}
|
||
|
||
int CDataOperator::GetTestType(int ScriptType, int TestType)
|
||
{
|
||
switch (TestType)
|
||
{
|
||
case 0:
|
||
switch (ScriptType)
|
||
{
|
||
case 0:
|
||
return PZ_STYLE_TD_CERSP;
|
||
case 1:
|
||
return PZ_STYLE_TD_2DRSP;
|
||
case 2:
|
||
return PZ_STYLE_TD_3DRSP;
|
||
default:
|
||
break;
|
||
}
|
||
break;
|
||
case 1:
|
||
switch (ScriptType)
|
||
{
|
||
case 0:
|
||
return PZ_STYLE_TD_CEIPSP;
|
||
case 1:
|
||
return PZ_STYLE_TD_2DIPSP;
|
||
case 2:
|
||
return PZ_STYLE_TD_3DIPSP;
|
||
default:
|
||
break;
|
||
}
|
||
break;
|
||
case 2://自电
|
||
switch (ScriptType)
|
||
{
|
||
case 0:
|
||
return PZ_STYLE_TD_CESP;
|
||
case 1:
|
||
return PZ_STYLE_TD_2DSP;
|
||
case 2:
|
||
return PZ_STYLE_TD_3DSP;
|
||
default:
|
||
break;
|
||
}
|
||
break;
|
||
|
||
default:
|
||
break;
|
||
}
|
||
}
|
||
|
||
|
||
UINT CDataOperator::Delete1DElectrodeRecord(CNavDataView *pNavDataView, const std::vector<float>* pvtDelElecID)
|
||
{
|
||
UINT uExecCode = (UINT)APP_SUCCESS;
|
||
|
||
HTREEITEM hTdItem = NULL;
|
||
HTREEITEM hTzItem = NULL;
|
||
_RecordsetPtr pRecPro = NULL;
|
||
|
||
DWORD dwTdHandle = (DWORD)VAL_ZERO;
|
||
DWORD dwTdID = (DWORD)VAL_ZERO;
|
||
|
||
hTdItem = pNavDataView->m_dataTree.GetSelectedItem();
|
||
|
||
hTzItem = pNavDataView->m_dataTree.GetParentItem(hTdItem);
|
||
dwTdHandle = pNavDataView->m_dataTree.GetItemData(hTdItem);
|
||
|
||
dwTdID = m_handleProcessor.GetIDFromHandle(dwTdHandle);
|
||
|
||
CString szSql = _T("");
|
||
CString strElecInfo = _T("");
|
||
CString strTmp = _T("");
|
||
for (int i = 0; i < pvtDelElecID->size(); i++)
|
||
{
|
||
if (0 == i)
|
||
{
|
||
strElecInfo.Format(_T("%.1f"),(*pvtDelElecID)[i]);
|
||
}
|
||
else
|
||
{
|
||
strTmp.Empty();
|
||
strTmp.Format(_T(",%.1f"),(*pvtDelElecID)[i]);
|
||
strElecInfo += strTmp;
|
||
}
|
||
}
|
||
|
||
try
|
||
{
|
||
_CommandPtr pCmdDelRspTd = NULL;
|
||
pCmdDelRspTd.CreateInstance(_uuidof(Command));
|
||
pRecPro.CreateInstance(_uuidof(Recordset));
|
||
pCmdDelRspTd->ActiveConnection = m_pConnection;
|
||
m_pConnection->BeginTrans();
|
||
|
||
szSql.Empty();
|
||
szSql.Format(_T("update td1dcon set bUse = false where TCHID in (select ID from tdchannel where TDID = %u) and (a in (%s) or b in (%s) or x in (%s) or y in (%s))"),
|
||
dwTdID,strElecInfo,strElecInfo,strElecInfo,strElecInfo);
|
||
|
||
pCmdDelRspTd->CommandText = szSql.AllocSysString();
|
||
pCmdDelRspTd->Execute(NULL, NULL, adCmdText);
|
||
|
||
szSql.Empty();
|
||
szSql.Format(_T("select count(*) as cnt from td1dcon where TCHID in (select ID from tdchannel where TDID = %u) and bUse = true"), dwTdID);
|
||
pRecPro->Open(szSql.AllocSysString(), _variant_t((IDispatch*)m_pConnection, true), adOpenStatic, adLockOptimistic, adCmdText);
|
||
|
||
int nCnt = 0;
|
||
if ((long)VAL_ZERO != pRecPro->GetRecordCount())
|
||
nCnt = pRecPro->GetCollect(_T("cnt")).lVal;
|
||
else
|
||
{
|
||
if (LANG_ZHCN == g_iUILanguage)
|
||
AfxMessageBox(_T("获取任务失败的统计信息"));
|
||
else
|
||
MessageBoxEx(NULL, _T("Get statistical information of task failed!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
||
pRecPro->Close();
|
||
m_pConnection->RollbackTrans();
|
||
return APP_ERR_DB;
|
||
}
|
||
|
||
pRecPro->Close();
|
||
|
||
szSql.Empty();
|
||
szSql.Format(_T("update td set TPamount = %d where ID = %d "), nCnt, dwTdID);
|
||
|
||
pCmdDelRspTd->CommandText = szSql.AllocSysString();
|
||
pCmdDelRspTd->Execute(NULL, NULL, adCmdText);
|
||
|
||
}
|
||
catch (_com_error e)
|
||
{
|
||
AfxMessageBox(e.Description());
|
||
m_pConnection->RollbackTrans();
|
||
return APP_ERR_DB;
|
||
}
|
||
|
||
m_pConnection->CommitTrans();
|
||
return uExecCode;
|
||
}
|
||
|
||
|
||
UINT CDataOperator::Delete2DElectrodeRecord(CNavDataView *pNavDataView, const std::vector<float>* pvtDelElecID)
|
||
{
|
||
UINT uExecCode = (UINT)APP_SUCCESS;
|
||
|
||
HTREEITEM hTdItem = NULL;
|
||
HTREEITEM hTzItem = NULL;
|
||
|
||
_RecordsetPtr pRecPro = NULL;
|
||
DWORD dwTdHandle = (DWORD)VAL_ZERO;
|
||
DWORD dwTdID = (DWORD)VAL_ZERO;
|
||
|
||
hTdItem = pNavDataView->m_dataTree.GetSelectedItem();
|
||
|
||
hTzItem = pNavDataView->m_dataTree.GetParentItem(hTdItem);
|
||
dwTdHandle = pNavDataView->m_dataTree.GetItemData(hTdItem);
|
||
|
||
dwTdID = m_handleProcessor.GetIDFromHandle(dwTdHandle);
|
||
|
||
CString szSql = _T("");
|
||
CString strElecInfo = _T("");
|
||
CString strTmp = _T("");
|
||
for (int i = 0; i < pvtDelElecID->size(); i++)
|
||
{
|
||
if (0 == i)
|
||
{
|
||
strElecInfo.Format(_T("%d"),(int)((*pvtDelElecID)[i]));
|
||
}
|
||
else
|
||
{
|
||
strTmp.Empty();
|
||
strTmp.Format(_T(",%d"),(int)((*pvtDelElecID)[i]));
|
||
strElecInfo += strTmp;
|
||
}
|
||
}
|
||
|
||
try
|
||
{
|
||
_CommandPtr pCmdDelRspTd = NULL;
|
||
pCmdDelRspTd.CreateInstance(_uuidof(Command));
|
||
pRecPro.CreateInstance(_uuidof(Recordset));
|
||
|
||
pCmdDelRspTd->ActiveConnection = m_pConnection;
|
||
m_pConnection->BeginTrans();
|
||
|
||
szSql.Empty();
|
||
szSql.Format(_T("update td2dcon set bUse = false where TCHID in (select ID from tdchannel where TDID = %u) and (C1 in (%s) or C2 in (%s) or P1 in (%s) or P2 in (%s))"),
|
||
dwTdID,strElecInfo,strElecInfo,strElecInfo,strElecInfo);
|
||
|
||
pCmdDelRspTd->CommandText = szSql.AllocSysString();
|
||
pCmdDelRspTd->Execute(NULL, NULL, adCmdText);
|
||
|
||
//更新测点数量,由于在acess中不支持这样的嵌套语句(但是在sql的其它数据库中支持),所以此时需要分开写
|
||
//update td set TPamount = (select count(*) from td2dcon
|
||
//where TCHID in (select ID from tdchannel where TDID = %u) and bUse = true) where ID = %d
|
||
|
||
szSql.Empty();
|
||
szSql.Format(_T("select count(*) as cnt from td2dcon where TCHID in (select ID from tdchannel where TDID = %u) and bUse = true"), dwTdID);
|
||
pRecPro->Open(szSql.AllocSysString(), _variant_t((IDispatch*)m_pConnection, true), adOpenStatic, adLockOptimistic, adCmdText);
|
||
|
||
int nCnt = 0;
|
||
if ((long)VAL_ZERO != pRecPro->GetRecordCount())
|
||
nCnt = pRecPro->GetCollect(_T("cnt")).lVal;
|
||
else
|
||
{
|
||
if (LANG_ZHCN == g_iUILanguage)
|
||
AfxMessageBox(_T("获取任务的统计信息失败!"));
|
||
else
|
||
MessageBoxEx(NULL, _T("Get statistical information of task failed!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
||
pRecPro->Close();
|
||
m_pConnection->RollbackTrans();
|
||
return APP_ERR_DB;
|
||
}
|
||
|
||
pRecPro->Close();
|
||
szSql.Empty();
|
||
szSql.Format(_T("update td set TPamount = %d where ID = %d "), nCnt, dwTdID);
|
||
|
||
pCmdDelRspTd->CommandText = szSql.AllocSysString();
|
||
pCmdDelRspTd->Execute(NULL, NULL, adCmdText);
|
||
}
|
||
catch (_com_error e)
|
||
{
|
||
AfxMessageBox(e.Description());
|
||
m_pConnection->RollbackTrans();
|
||
pRecPro->Close();
|
||
return APP_ERR_DB;
|
||
}
|
||
|
||
m_pConnection->CommitTrans();
|
||
return uExecCode;
|
||
}
|
||
|
||
UINT CDataOperator::Delete3DElectrodeRecord(CNavDataView *pNavDataView, const std::vector<float>* pvtDelElecID)
|
||
{
|
||
UINT uExecCode = (UINT)APP_SUCCESS;
|
||
|
||
HTREEITEM hTdItem = NULL;
|
||
HTREEITEM hTzItem = NULL;
|
||
|
||
DWORD dwTdHandle = (DWORD)VAL_ZERO;
|
||
DWORD dwTdID = (DWORD)VAL_ZERO;
|
||
_RecordsetPtr pRecPro = NULL;
|
||
|
||
hTdItem = pNavDataView->m_dataTree.GetSelectedItem();
|
||
|
||
hTzItem = pNavDataView->m_dataTree.GetParentItem(hTdItem);
|
||
dwTdHandle = pNavDataView->m_dataTree.GetItemData(hTdItem);
|
||
|
||
dwTdID = m_handleProcessor.GetIDFromHandle(dwTdHandle);
|
||
|
||
CString szSql = _T("");
|
||
CString strElecInfo = _T("");
|
||
CString strTmp = _T("");
|
||
for (int i = 0; i < pvtDelElecID->size(); i++)
|
||
{
|
||
if (0 == i)
|
||
{
|
||
strElecInfo.Format(_T("%d"),(int)((*pvtDelElecID)[i]));
|
||
}
|
||
else
|
||
{
|
||
strTmp.Empty();
|
||
strTmp.Format(_T(",%d"),(int)((*pvtDelElecID)[i]));
|
||
strElecInfo += strTmp;
|
||
}
|
||
}
|
||
|
||
try
|
||
{
|
||
_CommandPtr pCmdDelRspTd = NULL;
|
||
pCmdDelRspTd.CreateInstance(_uuidof(Command));
|
||
pRecPro.CreateInstance(_uuidof(Recordset));
|
||
pCmdDelRspTd->ActiveConnection = m_pConnection;
|
||
m_pConnection->BeginTrans();
|
||
szSql.Empty();
|
||
szSql.Format(_T("update td3dcon set bUse = false where TCHID in (select ID from tdchannel where TDID = %u) and (C1 in (%s) or C2 in (%s) or P1 in (%s) or P2 in (%s))"),
|
||
dwTdID,strElecInfo,strElecInfo,strElecInfo,strElecInfo);
|
||
|
||
pCmdDelRspTd->CommandText = szSql.AllocSysString();
|
||
pCmdDelRspTd->Execute(NULL, NULL, adCmdText);
|
||
|
||
|
||
szSql.Empty();
|
||
szSql.Format(_T("select count(*) as cnt from td3dcon where TCHID in (select ID from tdchannel where TDID = %u) and bUse = true"), dwTdID);
|
||
pRecPro->Open(szSql.AllocSysString(), _variant_t((IDispatch*)m_pConnection, true), adOpenStatic, adLockOptimistic, adCmdText);
|
||
|
||
int nCnt = 0;
|
||
if ((long)VAL_ZERO != pRecPro->GetRecordCount())
|
||
nCnt = pRecPro->GetCollect(_T("cnt")).lVal;
|
||
else
|
||
{
|
||
if (LANG_ZHCN == g_iUILanguage)
|
||
AfxMessageBox(_T("获取任务的统计信息失败!"));
|
||
else
|
||
MessageBoxEx(NULL, _T("Get statistical information of task failed!"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
||
pRecPro->Close();
|
||
m_pConnection->RollbackTrans();
|
||
return APP_ERR_DB;
|
||
}
|
||
|
||
pRecPro->Close();
|
||
|
||
szSql.Empty();
|
||
szSql.Format(_T("update td set TPamount = %d where ID = %d "), nCnt, dwTdID);
|
||
|
||
pCmdDelRspTd->CommandText = szSql.AllocSysString();
|
||
pCmdDelRspTd->Execute(NULL, NULL, adCmdText);
|
||
}
|
||
catch (_com_error e)
|
||
{
|
||
AfxMessageBox(e.Description());
|
||
m_pConnection->RollbackTrans();
|
||
return APP_ERR_DB;
|
||
}
|
||
|
||
m_pConnection->CommitTrans();
|
||
return uExecCode;
|
||
} |