📄 dlgviewsoe.cpp
字号:
// dlgViewSoe.cpp : implementation file
//
#include "stdafx.h"
#include "vqcwin.h"
#include "dlgViewSoe.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// dlgViewSoe dialog
dlgViewSoe::dlgViewSoe(CWnd* pParent /*=NULL*/)
: CDialog(dlgViewSoe::IDD, pParent)
{
//{{AFX_DATA_INIT(dlgViewSoe)
m_Time = _T("");
m_Day = 0;
m_DownLimitQ = 0.0f;
m_DownLimitU = 0.0f;
m_Dw = 0;
m_MeanQ = 0.0f;
m_MeanU = 0.0f;
m_Month = 0;
m_MxNo = 0;
m_Q = 0.0f;
m_U = 0.0f;
m_UpLimitQ = 0.0f;
m_UpLimitU = 0.0f;
m_ZbNo = 0;
m_Year = 0;
//}}AFX_DATA_INIT
}
void dlgViewSoe::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(dlgViewSoe)
DDX_Control(pDX, IDC_DataSelect, m_Select);
DDX_Text(pDX, IDC_ActTime, m_Time);
DDV_MaxChars(pDX, m_Time, 24);
DDX_Text(pDX, IDC_Day, m_Day);
DDX_Text(pDX, IDC_DownLimitQ, m_DownLimitQ);
DDX_Text(pDX, IDC_DownLimitU, m_DownLimitU);
DDX_Text(pDX, IDC_Dw, m_Dw);
DDX_Text(pDX, IDC_MeanQ, m_MeanQ);
DDX_Text(pDX, IDC_MeanU, m_MeanU);
DDX_Text(pDX, IDC_Month, m_Month);
DDX_Text(pDX, IDC_MxNo, m_MxNo);
DDX_Text(pDX, IDC_Q, m_Q);
DDX_Text(pDX, IDC_U, m_U);
DDX_Text(pDX, IDC_UpLimitQ, m_UpLimitQ);
DDX_Text(pDX, IDC_UpLimitU, m_UpLimitU);
DDX_Text(pDX, IDC_ZbNo, m_ZbNo);
DDX_Text(pDX, IDC_Year, m_Year);
DDV_MinMaxInt(pDX, m_Year, 2000, 2099);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(dlgViewSoe, CDialog)
//{{AFX_MSG_MAP(dlgViewSoe)
ON_BN_CLICKED(IDC_ReSelect, OnReSelect)
ON_CBN_SELCHANGE(IDC_DataSelect, OnSelchangeDataSelect)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// dlgViewSoe message handlers
void dlgViewSoe::DispSelectList()
{
BYTE hour,minute;
CFileFind ff;
CString strs(VQC_SOE_PATH);
char ss[128];
CString fileName;
BOOL bs;
int idx;
DWORD ww;
wsprintf(ss, "RTU%02d\\%02d%02d*.Y%02d",pApp->currVqcRtuNo%100,m_Month,m_Day,m_Year%100);
strs += ss;
bs = ff.FindFile(strs, 0);
if (!bs) return;
idx = 0;
while(bs)
{
bs = ff.FindNextFile();
fileName = ff.GetFileName();
hour = (fileName[4]-'0')*10;
hour += fileName[5]-'0';
minute = (fileName[6]-'0')*10;
minute += fileName[7]-'0';
wsprintf(ss, "RTU%02d\\", pApp->currVqcRtuNo%100);
strcat(ss, fileName);
actRecord.ReadVQCSoeProc(ss);
wsprintf(ss, "%02d时%02d分 ",hour,minute);
strs = ss;
if (actRecord.isFjt){
if (actRecord.operType) strs += "升档:";
else strs += "降档:";
}
else{
if (actRecord.operType) strs += "合上:";
else strs += "分开:";
}
strs += actRecord.operDevName;
ww = hour;
ww <<= 8;
ww += minute;
m_Select.AddString(strs);
m_Select.SetItemData(idx,ww);
idx ++;
}
ff.Close();
m_Select.SetCurSel(0);
OnSelchangeDataSelect();
}
void dlgViewSoe::OnReSelect()
{
// TODO: Add your control notification handler code here
m_Select.ResetContent();
UpdateData(TRUE);
DispSelectList();
}
BOOL dlgViewSoe::OnInitDialog()
{
pApp = (CVqcwinApp *) AfxGetApp();
ct = CTime::GetCurrentTime();
m_Year = ct.GetYear();
m_Day = ct.GetDay();
m_Month = ct.GetMonth();
CDialog::OnInitDialog();
((CSpinButtonCtrl *)GetDlgItem(IDC_MonthAdjust))->SetRange(1,12);
((CSpinButtonCtrl *)GetDlgItem(IDC_DayAdjust))->SetRange(1,31);
DispSelectList();
// TODO: Add extra initialization here
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void dlgViewSoe::OnSelchangeDataSelect()
{
// TODO: Add your control notification handler code here
int idx;
DWORD ww;
WORD minute,hour;
char ss[128];
idx = m_Select.GetCurSel();
if (idx == CB_ERR) return;
ww = m_Select.GetItemData(idx);
minute = (WORD)(ww&0xff);
ww >>= 8;
hour = (WORD)(ww&0xff);
wsprintf(ss,"RTU%02d\\%02d%02d%02d%02d.Y%02d",pApp->currVqcRtuNo%100,m_Month,m_Day,hour,minute,m_Year%100);
actRecord.ReadVQCSoeProc(ss);
m_ZbNo = actRecord.zbNo;
m_MxNo = actRecord.mxNo;
m_Dw = actRecord.zbDw;
m_U = actRecord.U;
m_MeanU = actRecord.uMeanValue;
m_UpLimitU = actRecord.uUpLimit;
m_DownLimitU= actRecord.uDownLimit;
m_Q = actRecord.Q;
m_MeanQ = actRecord.qMeanValue;
m_UpLimitQ = actRecord.qUpLimit;
m_DownLimitQ= actRecord.qDownLimit;
wsprintf(ss, "%02d-%02d-%02d %02d:%02d:%02d",
actRecord.HappenTime.GetYear()%100,
actRecord.HappenTime.GetMonth(),
actRecord.HappenTime.GetDay(),
actRecord.HappenTime.GetHour(),
actRecord.HappenTime.GetMinute(),
actRecord.HappenTime.GetSecond());
m_Time = ss;
UpdateData(FALSE);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -