mrDarker
2025-04-03 48ab1f71c5a005e6f64109a9d9a3b3598a1b2f60
SourceCode/Bond/Servo/ProductionLogDlg.cpp
@@ -78,13 +78,6 @@
   m_listCtrl.MoveWindow(12, 58, rcClient.Width() - 24, rcClient.Height() - 64);
}
void CProductionLogDlg::LoadAlarms()
{
   // 刷新历史报警数据
   m_nCurPage = 1;
   UpdatePageData();
}
void CProductionLogDlg::UpdatePageData()
{
   // 根据过滤条件加载数据(支持分页、模糊查询、时间范围)
@@ -140,20 +133,28 @@
void CProductionLogDlg::InsertStepData(CListCtrl* pListCtrl, const ProductionStep& step)
{
   int nRow = pListCtrl->GetItemCount();
   CString str;
   if (pListCtrl == nullptr || pListCtrl->m_hWnd == nullptr) {
      return;
   }
   str.Format(_T("%d"), step.nStepId);        pListCtrl->InsertItem(nRow, str);
   pListCtrl->SetItemText(nRow, 1, step.strProductId.c_str());
   pListCtrl->SetItemText(nRow, 2, step.strBatchNo.c_str());
   str.Format(_T("%d"), step.nDeviceId);     pListCtrl->SetItemText(nRow, 3, str);
   pListCtrl->SetItemText(nRow, 4, step.strOperator.c_str());
   pListCtrl->SetItemText(nRow, 5, step.strStartTime.c_str());
   pListCtrl->SetItemText(nRow, 6, step.strEndTime.c_str());
   str.Format(_T("%d"), step.nYield);        pListCtrl->SetItemText(nRow, 7, str);
   str.Format(_T("%d"), step.nGoodCount);    pListCtrl->SetItemText(nRow, 8, str);
   str.Format(_T("%d"), step.nBadCount);     pListCtrl->SetItemText(nRow, 9, str);
   pListCtrl->SetItemText(nRow, 10, step.strStatus.c_str());
   int nRowCount = pListCtrl->GetItemCount();
   if (nRowCount >= PAGE_SIZE) {
      pListCtrl->DeleteItem(nRowCount - 1);
   }
   CString str;
   int nNewItem = pListCtrl->InsertItem(0, _T(""));
   str.Format(_T("%d"), step.nStepId);        pListCtrl->SetItemText(nNewItem, 1, str);
   pListCtrl->SetItemText(nNewItem, 2, step.strProductId.c_str());
   pListCtrl->SetItemText(nNewItem, 3, step.strBatchNo.c_str());
   str.Format(_T("%d"), step.nDeviceId);     pListCtrl->SetItemText(nNewItem, 4, str);
   pListCtrl->SetItemText(nNewItem, 5, step.strOperator.c_str());
   pListCtrl->SetItemText(nNewItem, 6, step.strStartTime.c_str());
   pListCtrl->SetItemText(nNewItem, 7, step.strEndTime.c_str());
   str.Format(_T("%d"), step.nYield);        pListCtrl->SetItemText(nNewItem, 8, str);
   str.Format(_T("%d"), step.nGoodCount);    pListCtrl->SetItemText(nNewItem, 9, str);
   str.Format(_T("%d"), step.nBadCount);     pListCtrl->SetItemText(nNewItem, 10, str);
   pListCtrl->SetItemText(nNewItem, 11, step.strStatus.c_str());
}
std::string CProductionLogDlg::getCurrentTimeString()
@@ -211,8 +212,8 @@
   // 读取列宽配置
   CString strIniFile, strItem;
   strIniFile.Format(_T("%s\\configuration.ini"), (LPCTSTR)theApp.m_strAppDir);
   int width[11] = { 60, 100, 100, 70, 100, 140, 140, 60, 60, 60, 80 };
   for (int i = 0; i < 11; ++i) {
   int width[12] = { 0, 60, 100, 100, 70, 100, 140, 140, 60, 60, 60, 80 };
   for (int i = 0; i < 12; ++i) {
      strItem.Format(_T("Col_%d_Width"), i);
      width[i] = GetPrivateProfileInt("ProductionListCtrl", strItem, width[i], strIniFile);
   }
@@ -226,17 +227,18 @@
   HIMAGELIST imageList = ImageList_Create(24, 24, ILC_COLOR24, 1, 1);
   ListView_SetImageList(pListCtrl->GetSafeHwnd(), imageList, LVSIL_SMALL);
   pListCtrl->InsertColumn(0, _T("步骤ID"), LVCFMT_LEFT, width[0]);
   pListCtrl->InsertColumn(1, _T("产品ID"), LVCFMT_LEFT, width[1]);
   pListCtrl->InsertColumn(2, _T("批次号"), LVCFMT_LEFT, width[2]);
   pListCtrl->InsertColumn(3, _T("设备ID"), LVCFMT_LEFT, width[3]);
   pListCtrl->InsertColumn(4, _T("操作员"), LVCFMT_LEFT, width[4]);
   pListCtrl->InsertColumn(5, _T("开始时间"), LVCFMT_LEFT, width[5]);
   pListCtrl->InsertColumn(6, _T("结束时间"), LVCFMT_LEFT, width[6]);
   pListCtrl->InsertColumn(7, _T("产量"), LVCFMT_LEFT, width[7]);
   pListCtrl->InsertColumn(8, _T("良品数"), LVCFMT_LEFT, width[8]);
   pListCtrl->InsertColumn(9, _T("不良品数"), LVCFMT_LEFT, width[9]);
   pListCtrl->InsertColumn(10, _T("状态"), LVCFMT_LEFT, width[10]);
   pListCtrl->InsertColumn(0, _T(""), LVCFMT_RIGHT, width[0]);
   pListCtrl->InsertColumn(1, _T("步骤ID"), LVCFMT_LEFT, width[1]);
   pListCtrl->InsertColumn(2, _T("产品ID"), LVCFMT_LEFT, width[2]);
   pListCtrl->InsertColumn(3, _T("批次号"), LVCFMT_LEFT, width[3]);
   pListCtrl->InsertColumn(4, _T("设备ID"), LVCFMT_LEFT, width[4]);
   pListCtrl->InsertColumn(5, _T("操作员"), LVCFMT_LEFT, width[5]);
   pListCtrl->InsertColumn(6, _T("开始时间"), LVCFMT_LEFT, width[6]);
   pListCtrl->InsertColumn(7, _T("结束时间"), LVCFMT_LEFT, width[7]);
   pListCtrl->InsertColumn(8, _T("产量"), LVCFMT_LEFT, width[8]);
   pListCtrl->InsertColumn(9, _T("良品数"), LVCFMT_LEFT, width[9]);
   pListCtrl->InsertColumn(10, _T("不良品数"), LVCFMT_LEFT, width[10]);
   pListCtrl->InsertColumn(11, _T("状态"), LVCFMT_LEFT, width[11]);
   // 初始化分页数据
   int totalRecords = ProductionLogManager::getInstance().getTotalStepCount(