381 lines
10 KiB
C++
381 lines
10 KiB
C++
// DialNew1DTask.cpp : implementation file
|
|
//
|
|
|
|
#include "stdafx.h"
|
|
#include "GeoMative.h"
|
|
#include "DialNew1DTask.h"
|
|
#include "DialNew2DTask.h"
|
|
#include "DialNew3DTask.h"
|
|
#ifdef _DEBUG
|
|
#define new DEBUG_NEW
|
|
#undef THIS_FILE
|
|
static char THIS_FILE[] = __FILE__;
|
|
#endif
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CDialNew1DTask dialog
|
|
extern int g_iUILanguage;
|
|
extern int g_iOnLineVersion;
|
|
CDialNew1DTask::CDialNew1DTask(CTaskDataOper* pTaskOper,CWnd* pParent /*=NULL*/)
|
|
: CDialog(CDialNew1DTask::IDD, pParent)
|
|
{
|
|
//{{AFX_DATA_INIT(CDialNew1DTask)
|
|
// NOTE: the ClassWizard will add member initialization here
|
|
//}}AFX_DATA_INIT
|
|
m_strTaskName = _T("");
|
|
m_strTestPlace = _T("");
|
|
m_strSptName = _T("");
|
|
m_strArray = _T("");
|
|
m_strTestType = _T("");
|
|
m_iTestType = -1;
|
|
m_iAR = -1;
|
|
m_iSptID = -1;
|
|
m_iStacking = -1;
|
|
m_iTxWave = -1;
|
|
m_iTxPeriod = -1;
|
|
m_iSAInterval = -1;
|
|
m_strArray = _T("");
|
|
m_pTaskOper = pTaskOper;
|
|
m_iNewTaskID = -1;
|
|
}
|
|
|
|
|
|
void CDialNew1DTask::DoDataExchange(CDataExchange* pDX)
|
|
{
|
|
CDialog::DoDataExchange(pDX);
|
|
//{{AFX_DATA_MAP(CDialNew1DTask)
|
|
DDX_Control(pDX, IDC_COMBO_1D_TEST_TYPE, m_cmbTestType);
|
|
DDX_Control(pDX, IDC_COMBO_1D_TX_PERIOD, m_cmbTxPeriod);
|
|
DDX_Control(pDX, IDC_COMBO_1D_SCRIPT, m_cmbSpt);
|
|
DDX_Control(pDX, IDC_COMBO_1D_ARRAY, m_cmbArray);
|
|
//}}AFX_DATA_MAP
|
|
}
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CDialNew1DTask, CDialog)
|
|
//{{AFX_MSG_MAP(CDialNew1DTask)
|
|
ON_CBN_SELCHANGE(IDC_COMBO_1D_ARRAY, OnSelchangeCombo1dArray)
|
|
ON_CBN_SELCHANGE(IDC_COMBO_1D_TEST_TYPE, OnSelchangeCombo1dTestType)
|
|
ON_CBN_SELCHANGE(IDC_COMBO_1D_SCRIPT, OnSelchangeCombo1dScript)
|
|
//}}AFX_MSG_MAP
|
|
END_MESSAGE_MAP()
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
// CDialNew1DTask message handlers
|
|
|
|
BOOL CDialNew1DTask::OnInitDialog()
|
|
{
|
|
CDialog::OnInitDialog();
|
|
|
|
((CEdit*)(GetDlgItem(IDC_1D_TASK_NAME)))->SetLimitText(50);
|
|
((CEdit*)(GetDlgItem(IDC_1D_TEST_PLACE)))->SetLimitText(50);
|
|
if (LANG_ENUS == g_iUILanguage)
|
|
{
|
|
m_cmbTestType.AddString(_T("RES"));
|
|
m_cmbTestType.AddString(_T("IP"));
|
|
m_cmbTestType.AddString(_T("SP"));
|
|
}
|
|
else
|
|
{
|
|
m_cmbTestType.AddString(_T("电阻率"));
|
|
m_cmbTestType.AddString(_T("激电"));
|
|
m_cmbTestType.AddString(_T("自电"));
|
|
}
|
|
|
|
m_cmbTestType.SetCurSel(0);
|
|
|
|
std::vector<STQueryMediumInfo> vtMediumInfo;
|
|
vtMediumInfo.clear();
|
|
m_pTaskOper->QueryMediumInfo(0, vtMediumInfo);
|
|
|
|
int i = 0;
|
|
for (i = 0; i < vtMediumInfo.size(); i++)
|
|
{
|
|
m_cmbArray.AddString(vtMediumInfo[i].strMediumName);
|
|
m_cmbArray.SetItemData(i, vtMediumInfo[i].iMediumID);
|
|
}
|
|
GetDlgItem(IDC_1D_STACKING)->SetWindowText("1");
|
|
GetDlgItem(IDC_1D_TX_WAVE)->SetWindowText(_T("0+0-"));
|
|
GetDlgItem(IDC_1D_TX_WAVE)->EnableWindow(FALSE);
|
|
m_iTxWave = 6; //表示0+0-
|
|
|
|
// //
|
|
// m_cmbTxPeriod.ResetContent();
|
|
// m_cmbTxPeriod.AddString(_T("64 S"));
|
|
// m_cmbTxPeriod.SetItemData(0, 0);
|
|
// m_cmbTxPeriod.AddString(_T("32 S"));
|
|
// m_cmbTxPeriod.SetItemData(1, 9);
|
|
// i = 16;
|
|
// int iIndex = 1;
|
|
// CString strTxPeriod = _T("");
|
|
// while(i > 0)
|
|
// {
|
|
// strTxPeriod.Empty();
|
|
// strTxPeriod.Format(_T("%d S"), i);
|
|
// m_cmbTxPeriod.AddString(strTxPeriod);
|
|
// m_cmbTxPeriod.SetItemData(i+1, i);
|
|
// i = i/2;
|
|
// }
|
|
CString strTxPeriod = _T("");
|
|
for (i = 1; i < 8; i++)
|
|
{
|
|
strTxPeriod.Empty();
|
|
if (i == 1)
|
|
{
|
|
if (LANG_ZHCN == g_iUILanguage)
|
|
strTxPeriod.Format(_T("自动"));
|
|
else
|
|
strTxPeriod.Format(_T("Auto"));
|
|
}
|
|
else
|
|
{
|
|
strTxPeriod.Format(_T("%.0f S"), pow(2, i - 1));
|
|
}
|
|
|
|
m_cmbTxPeriod.AddString(strTxPeriod);
|
|
m_cmbTxPeriod.SetItemData(i - 1, i);
|
|
}
|
|
//m_cmbTxPeriod.SetCurSel(-1);
|
|
//m_cmbTxPeriod.EnableWindow(FALSE);
|
|
m_cmbTxPeriod.EnableWindow(TRUE);
|
|
m_cmbTxPeriod.SetCurSel(0);
|
|
|
|
//((CEdit*)(GetDlgItem(IDC_1D_SA_INTERVAL)))->SetLimitText(7);
|
|
//GetDlgItem(IDC_1D_SA_INTERVAL)->SetWindowText(_T("0"));
|
|
|
|
if (LANG_ENUS == g_iUILanguage)
|
|
{
|
|
GetDlgItem(IDC_STATIC_TASK_NAME)->SetWindowText("Task Name:");
|
|
GetDlgItem(IDC_STATIC_TEST_PLACE)->SetWindowText("Location:");
|
|
GetDlgItem(IDC_STATIC_TEST_TYPE)->SetWindowText("Test Type:");
|
|
|
|
GetDlgItem(IDC_STATIC_ARRAY_TYPE)->SetWindowText("Array:");
|
|
GetDlgItem(IDC_STATIC_SCRIPT)->SetWindowText("Script:");
|
|
GetDlgItem(IDC_STATIC_STACKING)->SetWindowText("Stacking:");
|
|
|
|
GetDlgItem(IDC_STATIC_TX_WAVEFORM)->SetWindowText("Tx Wave:");
|
|
GetDlgItem(IDC_STATIC_TX_PERIOD)->SetWindowText("Tx Period:");
|
|
//GetDlgItem(IDC_STATIC_SA_INTERVAL)->SetWindowText("Sample:");
|
|
GetDlgItem(IDOK)->SetWindowText("Create");
|
|
GetDlgItem(IDCANCEL)->SetWindowText("Cancel");
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
void CDialNew1DTask::OnSelchangeCombo1dArray()
|
|
{
|
|
// TODO: Add your control notification handler code here
|
|
int iSel = m_cmbArray.GetCurSel();
|
|
if (-1 != iSel)
|
|
{
|
|
m_cmbSpt.ResetContent();
|
|
std::vector<STQuerySptInfo> vtSptInfo;
|
|
vtSptInfo.clear();
|
|
m_pTaskOper->QuerySptByAR(m_cmbArray.GetItemData(iSel), vtSptInfo, 0);
|
|
for (int i = 0; i < vtSptInfo.size(); i++)
|
|
{
|
|
m_cmbSpt.AddString(vtSptInfo[i].strSptName);
|
|
m_cmbSpt.SetItemData(i, vtSptInfo[i].iSptID);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
void CDialNew1DTask::OnSelchangeCombo1dTestType()
|
|
{
|
|
// TODO: Add your control notification handler code here
|
|
if (1 == m_cmbTestType.GetCurSel())
|
|
{
|
|
GetDlgItem(IDC_1D_TX_WAVE)->SetWindowText(_T("+0-0"));
|
|
m_iTxWave = 1;
|
|
CString strTxPeriod = _T("");
|
|
m_cmbTxPeriod.ResetContent();
|
|
for (int i = 1; i < 8; i++)
|
|
{
|
|
strTxPeriod.Empty();
|
|
strTxPeriod.Format(_T("%.0f S"), pow(2, i - 1));
|
|
|
|
m_cmbTxPeriod.AddString(strTxPeriod);
|
|
m_cmbTxPeriod.SetItemData(i - 1, i);
|
|
}
|
|
m_cmbTxPeriod.EnableWindow(TRUE);
|
|
m_cmbTxPeriod.SetCurSel(0);
|
|
}
|
|
else if (0 == m_cmbTestType.GetCurSel())
|
|
{
|
|
m_iTxWave = 6;
|
|
GetDlgItem(IDC_1D_TX_WAVE)->SetWindowText(_T("0+0-"));
|
|
CString strTxPeriod = _T("");
|
|
m_cmbTxPeriod.ResetContent();
|
|
for (int i = 1; i < 8; i++)
|
|
{
|
|
strTxPeriod.Empty();
|
|
if (i == 1)
|
|
{
|
|
strTxPeriod.Format(_T("自动"));
|
|
}
|
|
else
|
|
{
|
|
strTxPeriod.Format(_T("%.0f S"), pow(2, i - 1));
|
|
}
|
|
|
|
m_cmbTxPeriod.AddString(strTxPeriod);
|
|
m_cmbTxPeriod.SetItemData(i - 1, i);
|
|
}
|
|
m_cmbTxPeriod.EnableWindow(TRUE);
|
|
m_cmbTxPeriod.SetCurSel(0);
|
|
}
|
|
else
|
|
{
|
|
m_iTxWave = 2;
|
|
GetDlgItem(IDC_1D_TX_WAVE)->SetWindowText(_T("0"));
|
|
m_cmbTxPeriod.SetCurSel(-1);
|
|
m_cmbTxPeriod.EnableWindow(FALSE);
|
|
}
|
|
}
|
|
|
|
void CDialNew1DTask::OnOK()
|
|
{
|
|
// TODO: Add extra validation here
|
|
m_strTaskName.Empty();
|
|
GetDlgItem(IDC_1D_TASK_NAME)->GetWindowText(m_strTaskName);
|
|
if (m_strTaskName.IsEmpty())
|
|
{
|
|
if (LANG_ZHCN == g_iUILanguage)
|
|
AfxMessageBox(_T("任务名不能为空"));
|
|
else
|
|
MessageBoxEx(NULL, _T("Please input the name of task"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return;
|
|
}
|
|
m_strTestPlace.Empty();
|
|
GetDlgItem(IDC_1D_TEST_PLACE)->GetWindowText(m_strTestPlace);
|
|
m_iTestType = m_cmbTestType.GetCurSel();
|
|
if (-1 == m_iTestType)
|
|
{
|
|
if (LANG_ZHCN ==g_iUILanguage)
|
|
AfxMessageBox(_T("请选择测试方式"));
|
|
else
|
|
MessageBoxEx(NULL, _T("Please select test method"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return;
|
|
}
|
|
m_cmbTestType.GetLBText(m_iTestType, m_strTestPlace);
|
|
|
|
int iSel = m_cmbArray.GetCurSel();
|
|
if (-1 == iSel)
|
|
{
|
|
if (LANG_ZHCN ==g_iUILanguage)
|
|
AfxMessageBox(_T("请选择装置类型"));
|
|
else
|
|
MessageBoxEx(NULL, _T("Please select array type"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return;
|
|
}
|
|
m_iAR = m_cmbArray.GetItemData(iSel);
|
|
m_cmbArray.GetLBText(iSel, m_strArray);
|
|
|
|
iSel = m_cmbSpt.GetCurSel();
|
|
if (-1 == iSel)
|
|
{
|
|
if (LANG_ZHCN ==g_iUILanguage)
|
|
AfxMessageBox(_T("请选择测试脚本"));
|
|
else
|
|
MessageBoxEx(NULL, _T("Please select test script"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return;
|
|
}
|
|
m_iSptID = m_cmbSpt.GetItemData(iSel);
|
|
m_cmbSpt.GetLBText(iSel, m_strSptName);
|
|
|
|
CString strTmp = _T("");
|
|
GetDlgItem(IDC_1D_STACKING)->GetWindowText(strTmp);
|
|
if (strTmp.IsEmpty())
|
|
{
|
|
if (LANG_ZHCN == g_iUILanguage)
|
|
AfxMessageBox(_T("迭代次数的取值范围为1到255"));
|
|
else
|
|
MessageBoxEx(NULL, _T("Number of stacking must between 1 and 255"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return;
|
|
}
|
|
m_iStacking = atoi(strTmp);
|
|
if (m_iStacking < 1 || m_iStacking > 255)
|
|
{
|
|
if (LANG_ZHCN == g_iUILanguage)
|
|
AfxMessageBox(_T("迭代次数的取值范围为1到255"));
|
|
else
|
|
MessageBoxEx(NULL, _T("Number of stacking must between 1 and 255"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return;
|
|
}
|
|
m_iTxPeriod = 0;
|
|
//电阻率和激电
|
|
if (1 == m_iTestType || 0 == m_iTestType)
|
|
{
|
|
iSel = m_cmbTxPeriod.GetCurSel();
|
|
if (-1 == iSel)
|
|
{
|
|
if (LANG_ZHCN == g_iUILanguage)
|
|
AfxMessageBox(_T("请选择发射周期"));
|
|
else
|
|
MessageBoxEx(NULL, _T("Please select the launch cycle"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return;
|
|
}
|
|
m_iTxPeriod = m_cmbTxPeriod.GetItemData(iSel);
|
|
}
|
|
|
|
|
|
// strTmp.Empty();
|
|
// GetDlgItem(IDC_1D_SA_INTERVAL)->GetWindowText(strTmp);
|
|
// if (strTmp.IsEmpty())
|
|
// {
|
|
// if (LANG_ZHCN == g_iUILanguage)
|
|
// AfxMessageBox(_T("采样间隔的值须在0到30000之间"));
|
|
// else
|
|
// AfxMessageBox("Sample value must be between 0 and 30000");
|
|
// return;
|
|
// }
|
|
m_iSAInterval = 0;//atoi(strTmp);
|
|
if (m_iSAInterval< 0 || m_iSAInterval > 30000)
|
|
{
|
|
if (LANG_ZHCN == g_iUILanguage)
|
|
AfxMessageBox(_T("采样间隔的值须在0到30000之间"));
|
|
else
|
|
MessageBoxEx(NULL, _T("Sample value must be between 0 and 30000"), STRING_MESSAGEBOXEX_TITLE, MB_OK, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US));
|
|
return;
|
|
}
|
|
|
|
m_stTaskParam.strTDName = m_strTaskName;
|
|
m_stTaskParam.strSptName = m_strSptName;
|
|
m_stTaskParam.strTestPlace = m_strTestPlace;
|
|
m_stTaskParam.iAR = m_iAR;
|
|
m_stTaskParam.iSAInterval = m_iSAInterval;
|
|
m_stTaskParam.iSptID = m_iSptID;
|
|
m_stTaskParam.iSptType = 0;
|
|
m_stTaskParam.iStacking = m_iStacking;
|
|
m_stTaskParam.iTestType = m_iTestType;
|
|
m_stTaskParam.iTxPeriod = m_iTxPeriod;
|
|
m_stTaskParam.iTxWave = m_iTxWave;
|
|
m_strTaskCN = m_pTaskOper->CreateTaskCN(m_iTestType);
|
|
//if (EN_ON_LIEN_VERSION_1 == g_iOnLineVersion)
|
|
{
|
|
m_iNewTaskID = m_pTaskOper->Create1DTask(m_stTaskParam, m_strTaskCN);
|
|
if (m_iNewTaskID < 1)
|
|
{
|
|
return;
|
|
}
|
|
}
|
|
CDialog::OnOK();
|
|
}
|
|
|
|
void CDialNew1DTask::OnSelchangeCombo1dScript()
|
|
{
|
|
// TODO: Add your control notification handler code here
|
|
// int iSel = m_cmbSpt.GetCurSel();
|
|
// if (-1 != iSel)
|
|
// {
|
|
// int iSptID = m_cmbSpt.GetItemData(iSel);
|
|
// if ()
|
|
// {
|
|
// }
|
|
// }
|
|
|
|
}
|