Files
geomative/GeomativeStudio/cpp/Views/DialMeasureDetailInfo.cpp
T
coco df489d5640 a
2026-07-03 16:05:30 +08:00

186 lines
5.4 KiB
C++

// DialMeasureData.cpp : implementation file
//
#include "stdafx.h"
#include "GeoMative.h"
#include "DialMeasureDetailInfo.h"
#include "CtrlProtocolDef.h"
#include "FileOperTools.h"
#include "DialMeasuLoopTest.h"
#include <math.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDialMeasureDetailInfo dialog
#define MODULE_NAME "CDialMeasureDetailInfo"
extern SYSTEMTIME g_sysCurTime;
extern int g_UIOffset;
extern int g_iUILanguage;
extern CGeoMativeApp theApp;
extern CString GetGRStatus(int iStatus);
extern int GetSigTxPeriod(int iTestType, int iTestPeriod);
extern float tcp_htonf(float f);
extern float tcp_ntohf(float f);
extern CString GetGrCodeText(int iCode);
CDialMeasureDetailInfo::CDialMeasureDetailInfo(STRemTaskArg stTaskArg, CWnd* pParent /*=NULL*/)
: CDialog(CDialMeasureDetailInfo::IDD, pParent)
{
m_stTaskArg = stTaskArg;
}
void CDialMeasureDetailInfo::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDialMeasureDetailInfo)
DDX_Control(pDX, IDC_TAB_CHG, m_tabChange);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDialMeasureDetailInfo, CDialog)
//{{AFX_MSG_MAP(CDialMeasureDetailInfo)
ON_NOTIFY(TCN_SELCHANGE, IDC_TAB_CHG, OnSelchangeTabChg)
ON_WM_CLOSE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDialMeasureDetailInfo message handlers
BOOL CDialMeasureDetailInfo::OnInitDialog()
{
CDialog::OnInitDialog();
if (LANG_ZHCN == g_iUILanguage)
{
SetWindowText(_T("数据明细"));
}
// TODO: Add extra initialization here
if (LANG_ZHCN == g_iUILanguage)
{
m_tabChange.InsertItem(0, _T("数据"));
m_tabChange.InsertItem(1, _T("接地电阻"));
}
else
{
m_tabChange.InsertItem(0, _T("DATA"));
m_tabChange.InsertItem(1, _T("GR"));
}
m_tabChange.SetCurSel(0);
CTaskDataOper taskOper;
STQueryTaskBasicInfo stQueryTdInfo;
//从数据库获取DATA
// if (!taskOper.QueryTdBasicInfo(0, &stQueryTdInfo, m_strTaskCN))
// {
// AfxMessageBox(_T("查询任务信息失败"));
// }
CRect rect;
m_tabChange.GetClientRect(&rect);
m_dialListMeasuTask.SetSptType(stQueryTdInfo.iSptType);
m_dialListMeasuTask.SetTaskID(stQueryTdInfo.iTaskID);
m_dialListMeasuTask.Create(IDD_DIALOG_LIST_DETAIL_INFO_DATA, &m_tabChange);
rect.top = rect.top + 25;
rect.left = rect.left + 2;
rect.right = rect.right -2;
rect.bottom = rect.bottom -8;
m_dialListMeasuTask.MoveWindow(&rect);
m_dialListMeasuGR.SetSptType(stQueryTdInfo.iSptType);
m_dialListMeasuGR.Create(IDD_DIALOG_LIST_DETAIL_INFO_GR, &m_tabChange);
m_dialListMeasuGR.MoveWindow(&rect);
m_dialListMeasuTask.ShowWindow(SW_SHOW);
m_dialListMeasuGR.ShowWindow(SW_HIDE);
//下载测试完成的任务后,从数据获取GR
//InitGrList(m_dialListMeasuGR.m_listData, m_strTaskCN);
m_dialListMeasuTask.SetSptType(m_iSptType);
m_dialListMeasuTask.SetCurrTaskArg(m_stTaskArg);
//从云端获取任务DATA
m_dialListMeasuTask.ShowPage(1);
//从云端获取任务GR
m_dialListMeasuGR.GetGRRequest(m_stTaskArg);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CDialMeasureDetailInfo::OnSelchangeTabChg(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here
//need trans
int iMeasuType = m_tabChange.GetCurSel();
if (EN_MEASURE_DATA == iMeasuType)
{
m_dialListMeasuTask.ShowWindow(SW_SHOW);
m_dialListMeasuGR.ShowWindow(SW_HIDE);
}
else
{
m_dialListMeasuTask.ShowWindow(SW_HIDE);
m_dialListMeasuGR.ShowWindow(SW_SHOW);
}
*pResult = 0;
}
bool CDialMeasureDetailInfo::InitGrList(CListCtrl &tdGrList, CString strTaskCN)
{
_RecordsetPtr pRecGrList = NULL;
CString szSql = _T("");
CString szLabel = _T("");
int iIndex = (int)VAL_ZERO;
pRecGrList.CreateInstance(_uuidof(Recordset));
if ((int)VAL_ZERO != tdGrList.GetItemCount())
{
tdGrList.DeleteAllItems();
}
szSql.Format(_T("select Ecode,OMvalue,StatusCode,OM1value,StatusCode1 from gr where TDID = (select ID from td where TDCN='%s') order by Val(Ecode)"), strTaskCN);
pRecGrList->Open(szSql.AllocSysString(), _variant_t((IDispatch*)theApp.m_pConnection, true), adOpenStatic, adLockOptimistic, adCmdText);
int iOMVal = -1, iOMVal1 = -1;
CString strECode,strOMVal, strOMVal1,strStatus, strStatus1;
while ((short)VAL_ZERO == pRecGrList->adoEOF)
{
strOMVal.Empty();
strStatus.Empty();
strOMVal1.Empty();
strStatus1.Empty();
strECode = pRecGrList->GetCollect(_T("Ecode"));
tdGrList.InsertItem(iIndex, strECode);
iOMVal = (int)pRecGrList->GetCollect(_T("OMvalue")).lVal;
iOMVal1 = (int)pRecGrList->GetCollect(_T("OM1value")).lVal;
if (-1 != iOMVal)
{
strOMVal.Format(_T("%d"), iOMVal);
strStatus = GetGrCodeText((int)pRecGrList->GetCollect(_T("StatusCode")).lVal);
}
if (-1 != iOMVal1)
{
strOMVal1.Format(_T("%d"), iOMVal1);
strStatus1 = GetGrCodeText((int)pRecGrList->GetCollect(_T("StatusCode1")).lVal);
}
tdGrList.SetItemText(iIndex, 0, strECode);
tdGrList.SetItemText(iIndex, 1, strOMVal);
tdGrList.SetItemText(iIndex, 2, strStatus);
tdGrList.SetItemText(iIndex, 3, strOMVal1);
tdGrList.SetItemText(iIndex, 4, strStatus1);
iIndex++;
pRecGrList->MoveNext();
}
pRecGrList->Close();
return true;
}
void CDialMeasureDetailInfo::OnClose()
{
// TODO: Add your message handler code here and/or call default
CDialog::OnCancel();
}