This commit is contained in:
coco
2026-07-03 16:05:30 +08:00
commit df489d5640
1101 changed files with 779140 additions and 0 deletions
@@ -0,0 +1,486 @@
// DialListMeasuData.cpp : implementation file
//
#include "stdafx.h"
#include "GeoMative.h"
#include "DialListRealTimeMeasuData.h"
#include "FileOperTools.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDialListRealTimeMeasureData dialog
extern int g_UIOffset;
extern int g_iUILanguage;
extern CString g_strSaveTestingTaskID;
extern EN_TASK_TESTING_METHOD g_eTestingMethod;
CDialListRealTimeMeasureData::CDialListRealTimeMeasureData(CWnd* pParent /*=NULL*/)
: CDialog(CDialListRealTimeMeasureData::IDD, pParent)
{
//{{AFX_DATA_INIT(CDialListRealTimeMeasureData)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
// m_iMeasuType = 0;
m_iSptType = -1;
m_strMeasuStatus = _T("");
m_pMeasuStatus = NULL;
}
void CDialListRealTimeMeasureData::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDialListRealTimeMeasureData)
DDX_Control(pDX, IDC_LIST_MEASURE, m_listData);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDialListRealTimeMeasureData, CDialog)
//{{AFX_MSG_MAP(CDialListRealTimeMeasureData)
ON_WM_SHOWWINDOW()
//ON_BN_CLICKED(IDC_BTN_LIST_PRE, OnBtnListPre)
//ON_BN_CLICKED(IDC_BTN_LIST_NEXT, OnBtnListNext)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDialListRealTimeMeasureData message handlers
BOOL CDialListRealTimeMeasureData::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
CString strColTitle;
int iColIndex = 0;
m_listData.SetExtendedStyle(LVS_EX_FULLROWSELECT | LVS_EX_HEADERDRAGDROP
| LVS_EX_ONECLICKACTIVATE | LVS_EX_GRIDLINES);
m_listData.InsertColumn(iColIndex++, _T("ID"),LVCFMT_LEFT,50);
// strColTitle.Empty();
// strColTitle.LoadString(IDS_DB_SCRIPT_C1);
m_listData.InsertColumn(iColIndex++, _T("A"), LVCFMT_CENTER, 50);
// strColTitle.Empty();
// strColTitle.LoadString(IDS_DB_SCRIPT_C2);
m_listData.InsertColumn(iColIndex++, _T("B"), LVCFMT_CENTER, 50);
// strColTitle.Empty();
// strColTitle.LoadString(IDS_DB_SCRIPT_P1);
m_listData.InsertColumn(iColIndex++, _T("M"), LVCFMT_CENTER, 50);
// strColTitle.Empty();
// strColTitle.LoadString(IDS_DB_SCRIPT_P2);
m_listData.InsertColumn(iColIndex++, _T("N"), LVCFMT_CENTER, 50);
// strColTitle.Empty();
// strColTitle.LoadString(IDS_DB_SCRIPT_N);
m_listData.InsertColumn(iColIndex++, _T("Stack"), LVCFMT_CENTER, 70);
// strColTitle.Empty();
// strColTitle.LoadString(IDS_DB_SCRIPT_K);
m_listData.InsertColumn(iColIndex++, _T("K"), LVCFMT_CENTER, 80);
// strColTitle.Empty();
// strColTitle.LoadString(IDS_MEASU_TD_V);
m_listData.InsertColumn(iColIndex++, _T("V(mV)"), LVCFMT_CENTER, 80);
// strColTitle.Empty();
// strColTitle.LoadString(IDS_MEASU_TD_I);
m_listData.InsertColumn(iColIndex++, _T("I(mA)"), LVCFMT_CENTER, 80);
// strColTitle.Empty();
// strColTitle.LoadString(IDS_MEASU_TD_R0);
m_listData.InsertColumn(iColIndex++, _T("R0(Ohm*m)"), LVCFMT_CENTER, 110);
// strColTitle.Empty();
// strColTitle.LoadString(IDS_MEASU_TD_SP);
m_listData.InsertColumn(iColIndex++, _T("SP(mV)"), LVCFMT_CENTER, 80);
/*std::vector<STTaskDetailBasicData> vtData;
if (m_taskOper.QueryTdDataFromTsn(m_iTaskID, m_iSptType, 1, MAX_LIST_SHOW_NUM, vtData))
{
if (!vtData.empty())
OnShowTdData(vtData);
}*/
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CDialListRealTimeMeasureData::ShowMeasuStatus(CString strStatus)
{
m_strMeasuStatus = strStatus;
GetDlgItem(IDC_STATIC_MEASU_SHOW_STATUS)->ShowWindow(SW_SHOW);
GetDlgItem(IDC_STATIC_MEASU_SHOW_STATUS)->SetWindowText(m_strMeasuStatus);
}
/*void CDialListRealTimeMeasureData::EnablePreviewBtn(bool bIsEnable)
{
GetDlgItem(IDC_BTN_LIST_PRE)->EnableWindow(bIsEnable);
GetDlgItem(IDC_BTN_LIST_NEXT)->EnableWindow(bIsEnable);
}*/
void CDialListRealTimeMeasureData::OnShowWindow(BOOL bShow, UINT nStatus)
{
CDialog::OnShowWindow(bShow, nStatus);
if (TRUE == bShow)
{
CRect rect;
//CRect orgrect;
GetClientRect(&rect);
//orgrect = rect;
//rect.left += 5;
//rect.top += 5;
//rect.right -= 5;
//rect.bottom -= 5;
m_listData.MoveWindow(&rect);
/*GetDlgItem(IDC_STATIC_MEASU_SHOW_STATUS)->ShowWindow(SW_SHOW);
GetDlgItem(IDC_STATIC_MEASU_SHOW_STATUS)->SetWindowText(m_strMeasuStatus);
CRect ctrRect;
GetDlgItem(IDC_BTN_LIST_PRE)->GetClientRect(&ctrRect);
GetDlgItem(IDC_BTN_LIST_PRE)->MoveWindow(orgrect.Width()/2-2-ctrRect.Width(), orgrect.bottom-ctrRect.Height(), ctrRect.Width(),ctrRect.Height());
GetDlgItem(IDC_BTN_LIST_NEXT)->MoveWindow(orgrect.Width()/2+2, orgrect.bottom-ctrRect.Height(), ctrRect.Width(),ctrRect.Height());
CRect rectStatus;
rectStatus.left = rect.left;
rectStatus.top = orgrect.bottom-ctrRect.Height()+7;
rectStatus.right = orgrect.Width()/2-2-ctrRect.Width()-5;
rectStatus.bottom = orgrect.bottom;
GetDlgItem(IDC_STATIC_MEASU_SHOW_STATUS)->MoveWindow(&rectStatus);*/
}
// TODO: Add your message handler code here
}
void CDialListRealTimeMeasureData::OnShowTdData(const std::vector<STTaskDetailBasicData>& vtTdData)
{
if (vtTdData.empty())
{
return;
}
m_listData.DeleteAllItems();
CString strTxt;
for (int i = 0; i < vtTdData.size(); i++)
{
strTxt.Empty();
strTxt.Format(_T("%d"),vtTdData[i].iID);
m_listData.InsertItem(i, strTxt);
int iColIndex = 1;
if (0 == m_iSptType)
{
strTxt.Empty();
strTxt.Format(_T("%.2f"),vtTdData[i].fA);
m_listData.SetItemText(i, iColIndex++, strTxt);
strTxt.Empty();
strTxt.Format(_T("%.2f"),vtTdData[i].fB);
m_listData.SetItemText(i, iColIndex++, strTxt);
strTxt.Empty();
strTxt.Format(_T("%.2f"),vtTdData[i].fX);
m_listData.SetItemText(i, iColIndex++, strTxt);
strTxt.Empty();
strTxt.Format(_T("%.2f"),vtTdData[i].fY);
m_listData.SetItemText(i, iColIndex++, strTxt);
}
else
{
strTxt.Empty();
strTxt.Format(_T("%d"),vtTdData[i].iA);
m_listData.SetItemText(i, iColIndex++, strTxt);
strTxt.Empty();
strTxt.Format(_T("%d"),vtTdData[i].iB);
m_listData.SetItemText(i, iColIndex++, strTxt);
strTxt.Empty();
strTxt.Format(_T("%d"),vtTdData[i].iM);
m_listData.SetItemText(i, iColIndex++, strTxt);
strTxt.Empty();
strTxt.Format(_T("%d"),vtTdData[i].iN);
m_listData.SetItemText(i, iColIndex++, strTxt);
}
strTxt.Empty();
strTxt.Format(_T("%d"),vtTdData[i].ucStack);
m_listData.SetItemText(i, iColIndex++, strTxt);
strTxt.Empty();
strTxt.Format(_T("%.2f"),vtTdData[i].fK);
m_listData.SetItemText(i, iColIndex++, strTxt);
if (vtTdData[i].ucIsUse != 0)
{
strTxt.Empty();
strTxt.Format(_T("%.2f"),vtTdData[i].fV);
m_listData.SetItemText(i, iColIndex++, strTxt);
strTxt.Empty();
strTxt.Format(_T("%.2f"),vtTdData[i].fI);
m_listData.SetItemText(i, iColIndex++, strTxt);
strTxt.Empty();
strTxt.Format(_T("%.2f"),vtTdData[i].fR0);
m_listData.SetItemText(i, iColIndex++, strTxt);
strTxt.Empty();
strTxt.Format(_T("%.2f"),vtTdData[i].fSP);
m_listData.SetItemText(i, iColIndex++, strTxt);
}
m_listData.SetItemData(i,vtTdData[i].iID);
}
}
void CDialListRealTimeMeasureData::OnShowTdDataAppend(const std::vector<STTaskDetailBasicData>& vtTdData)
{
if (vtTdData.empty())
{
return;
}
//m_listData.DeleteAllItems();
int iItemIndex = m_listData.GetItemCount();
CString strTxt;
int iColIndex = 1;
int i = 0;
for (; i < vtTdData.size(); i++)
{
strTxt.Empty();
strTxt.Format(_T("%d"), vtTdData[i].iID);
m_listData.InsertItem(iItemIndex + i, strTxt);
iColIndex = 1;
if (0 == m_iSptType)
{
strTxt.Empty();
strTxt.Format(_T("%.2f"), vtTdData[i].fA);
m_listData.SetItemText(iItemIndex + i , iColIndex++, strTxt);
strTxt.Empty();
strTxt.Format(_T("%.2f"), vtTdData[i].fB);
m_listData.SetItemText(iItemIndex + i, iColIndex++, strTxt);
strTxt.Empty();
strTxt.Format(_T("%.2f"), vtTdData[i].fX);
m_listData.SetItemText(iItemIndex + i, iColIndex++, strTxt);
strTxt.Empty();
strTxt.Format(_T("%.2f"), vtTdData[i].fY);
m_listData.SetItemText(iItemIndex + i, iColIndex++, strTxt);
}
else
{
strTxt.Empty();
strTxt.Format(_T("%d"), vtTdData[i].iA);
m_listData.SetItemText(iItemIndex + i, iColIndex++, strTxt);
strTxt.Empty();
strTxt.Format(_T("%d"), vtTdData[i].iB);
m_listData.SetItemText(iItemIndex + i, iColIndex++, strTxt);
strTxt.Empty();
strTxt.Format(_T("%d"), vtTdData[i].iM);
m_listData.SetItemText(iItemIndex + i, iColIndex++, strTxt);
strTxt.Empty();
strTxt.Format(_T("%d"), vtTdData[i].iN);
m_listData.SetItemText(iItemIndex + i, iColIndex++, strTxt);
}
strTxt.Empty();
strTxt.Format(_T("%d"), vtTdData[i].ucStack);
m_listData.SetItemText(iItemIndex + i, iColIndex++, strTxt);
strTxt.Empty();
strTxt.Format(_T("%.2f"), vtTdData[i].fK);
m_listData.SetItemText(iItemIndex + i, iColIndex++, strTxt);
if (vtTdData[i].ucIsUse != 0)
{
strTxt.Empty();
strTxt.Format(_T("%.2f"), vtTdData[i].fV);
m_listData.SetItemText(iItemIndex + i, iColIndex++, strTxt);
strTxt.Empty();
strTxt.Format(_T("%.2f"), vtTdData[i].fI);
m_listData.SetItemText(iItemIndex + i, iColIndex++, strTxt);
strTxt.Empty();
strTxt.Format(_T("%.2f"), vtTdData[i].fR0);
m_listData.SetItemText(iItemIndex + i, iColIndex++, strTxt);
strTxt.Empty();
strTxt.Format(_T("%.2f"), vtTdData[i].fSP);
m_listData.SetItemText(iItemIndex + i, iColIndex++, strTxt);
}
m_listData.SetItemData(iItemIndex + i, vtTdData[i].iID);
m_listData.EnsureVisible(iItemIndex + i, TRUE);
}
//判断如果是最后一个点更新界面
if (vtTdData[i - 1].iID == m_stCurRealTimeTaskArg.uiTotalNum)
{
CString strLog;
strLog.Format(_T("zm: 0x06 recv data end, taskid=%s,total num=%u"), m_stCurRealTimeTaskArg.ucTaskID, m_stCurRealTimeTaskArg.uiTotalNum);
CFileOperTools::GetInstance()->WriteComLog(strLog);
g_strSaveTestingTaskID.Empty();//清空当前保存的值
::SendMessage(m_TaskManagerHwnd, WM_MSG_UPDATE_TASK_LIST, (WPARAM)0, 0);
}
}
void CDialListRealTimeMeasureData::OnShowTdDataUpdate(const std::vector<STTaskDetailBasicData>& vtTdData)
{
if (vtTdData.empty())
{
return;
}
//m_listData.DeleteAllItems();
int iItemIndex = m_listData.GetItemCount();
CString strTxt,strLog;
int iColIndex = 1;
int i = 0;
int j = 0;
int iIndex = 0;
BOOL bStopTraverList = FALSE;
for (; i < vtTdData.size(); i++)
{
strTxt.Empty();
strTxt.Format(_T("%d"), vtTdData[i].iID);
//先查找是否有这个数据,没有再插入
if (!bStopTraverList)
{
for (j = 0; j < iItemIndex; j++)
{
if (strTxt.Compare(m_listData.GetItemText(j, 0)) == 0)
{
m_listData.SetItemText(j, 0, strTxt);
break;
}
}
if (j == iItemIndex)
{
//追加
bStopTraverList = TRUE;
iIndex = m_listData.GetItemCount();
strLog.Format(_T("zm:----------m_eTestingMethod(%d)==1,from current point begin,list nonono ID=%s, stop loop,iIndex=%d,vector i=%d,list j=%diItemIndex=%d"), g_eTestingMethod, strTxt, iIndex, i, j, iItemIndex);
CFileOperTools::GetInstance()->WriteComLog(strLog);
m_listData.InsertItem(iIndex, strTxt);
}
else
{
strLog.Format(_T("zm:----------m_eTestingMethod(%d)==2,one point,ID=%s,list iIndex=%d,vector i=%d"), g_eTestingMethod, strTxt, iIndex, i);
CFileOperTools::GetInstance()->WriteComLog(strLog);
iIndex = j;
}
}
else
{
//已存在的点全部更新完了
strLog.Format(_T("zm:----------m_eTestingMethod(%d)==1,from current point begin,list nonono ID=%s, not need loop,list iIndex=%d, vector i=%d"), g_eTestingMethod, strTxt, iIndex, i);
CFileOperTools::GetInstance()->WriteComLog(strLog);
iIndex = m_listData.GetItemCount();
m_listData.InsertItem(iIndex, strTxt);
}
iColIndex = 1;
if (0 == m_iSptType)
{
strTxt.Empty();
strTxt.Format(_T("%.2f"), vtTdData[i].fA);
m_listData.SetItemText(iIndex, iColIndex++, strTxt);
strTxt.Empty();
strTxt.Format(_T("%.2f"), vtTdData[i].fB);
m_listData.SetItemText(iIndex, iColIndex++, strTxt);
strTxt.Empty();
strTxt.Format(_T("%.2f"), vtTdData[i].fX);
m_listData.SetItemText(iIndex, iColIndex++, strTxt);
strTxt.Empty();
strTxt.Format(_T("%.2f"), vtTdData[i].fY);
m_listData.SetItemText(iIndex, iColIndex++, strTxt);
}
else
{
strTxt.Empty();
strTxt.Format(_T("%d"), vtTdData[i].iA);
m_listData.SetItemText(iIndex, iColIndex++, strTxt);
strTxt.Empty();
strTxt.Format(_T("%d"), vtTdData[i].iB);
m_listData.SetItemText(iIndex, iColIndex++, strTxt);
strTxt.Empty();
strTxt.Format(_T("%d"), vtTdData[i].iM);
m_listData.SetItemText(iIndex, iColIndex++, strTxt);
strTxt.Empty();
strTxt.Format(_T("%d"), vtTdData[i].iN);
m_listData.SetItemText(iIndex, iColIndex++, strTxt);
}
strTxt.Empty();
strTxt.Format(_T("%d"), vtTdData[i].ucStack);
m_listData.SetItemText(iIndex, iColIndex++, strTxt);
strTxt.Empty();
strTxt.Format(_T("%.2f"), vtTdData[i].fK);
m_listData.SetItemText(iIndex, iColIndex++, strTxt);
if (vtTdData[i].ucIsUse != 0)
{
strTxt.Empty();
strTxt.Format(_T("%.2f"), vtTdData[i].fV);
m_listData.SetItemText(iIndex, iColIndex++, strTxt);
strTxt.Empty();
strTxt.Format(_T("%.2f"), vtTdData[i].fI);
m_listData.SetItemText(iIndex, iColIndex++, strTxt);
strTxt.Empty();
strTxt.Format(_T("%.2f"), vtTdData[i].fR0);
m_listData.SetItemText(iIndex, iColIndex++, strTxt);
strTxt.Empty();
strTxt.Format(_T("%.2f"), vtTdData[i].fSP);
m_listData.SetItemText(iIndex, iColIndex++, strTxt);
}
m_listData.SetItemData(iIndex, vtTdData[i].iID);
m_listData.EnsureVisible(iIndex, TRUE);
m_listData.SetItemState(iIndex, LVIS_FOCUSED, LVIS_FOCUSED);
}
//判断如果是最后一个点更新界面
if (EN_TASK_CURRENT_ONE_POINT_TEST == g_eTestingMethod)
{
g_strSaveTestingTaskID.Empty();//清空当前保存的值
::SendMessage(m_TaskManagerHwnd, WM_MSG_UPDATE_TASK_LIST, (WPARAM)0, 0);
}
else
{
if (vtTdData[i - 1].iID == m_stCurRealTimeTaskArg.uiTotalNum)
{
CString strLog;
strLog.Format(_T("zm: 0x06 recv data end taskid=%s,totalNum=%u"), m_stCurRealTimeTaskArg.ucTaskID, m_stCurRealTimeTaskArg.uiTotalNum);
CFileOperTools::GetInstance()->WriteComLog(strLog);
g_strSaveTestingTaskID.Empty();//清空当前保存的值
::SendMessage(m_TaskManagerHwnd, WM_MSG_UPDATE_TASK_LIST, (WPARAM)0, 0);
}
}
}