From 334b16b4abb4cbe3d1d4e4f211efd6f4468ae09f Mon Sep 17 00:00:00 2001
From: LAPTOP-SNT8I5JK\Boounion <Chenluhua@qq.com>
Date: 星期五, 19 九月 2025 15:12:52 +0800
Subject: [PATCH] 1.ControlJob和ProcessJob的中断操作,强制结批增加字符串描述原因,方便生产跟踪。
---
SourceCode/Bond/Servo/CPageGlassList.cpp | 97 +++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 86 insertions(+), 11 deletions(-)
diff --git a/SourceCode/Bond/Servo/CPageGlassList.cpp b/SourceCode/Bond/Servo/CPageGlassList.cpp
index fdbdcd4..4291a7e 100644
--- a/SourceCode/Bond/Servo/CPageGlassList.cpp
+++ b/SourceCode/Bond/Servo/CPageGlassList.cpp
@@ -8,12 +8,12 @@
#include "GlassJson.h"
#include "CServoUtilsTool.h"
#include "ToolUnits.h"
-
#include <optional>
#include <unordered_set>
#include <unordered_map>
#include <vector>
#include <string>
+#include "CProcessDataListDlg.h"
#define PAGE_SIZE 50
#define PAGE_BACKGROUND_COLOR RGB(252, 252, 255)
@@ -340,6 +340,39 @@
}
}
+bool CopyUtf8ToClipboard(const std::string& utf8)
+{
+ // 1) UTF-8 -> UTF-16 闀垮害锛堝惈缁撳熬 '\0'锛�
+ int wlen = MultiByteToWideChar(CP_UTF8, 0, utf8.c_str(), -1, nullptr, 0);
+ if (wlen <= 0) return false;
+
+ // 2) 涓哄壀璐存澘鍒嗛厤鍏ㄥ眬鍙Щ鍔ㄥ唴瀛橈紙蹇呴』 GMEM_MOVEABLE锛�
+ SIZE_T bytes = static_cast<SIZE_T>(wlen) * sizeof(wchar_t);
+ HGLOBAL hMem = GlobalAlloc(GMEM_MOVEABLE, bytes);
+ if (!hMem) return false;
+
+ // 3) 濉厖 UTF-16 鏂囨湰
+ wchar_t* wbuf = static_cast<wchar_t*>(GlobalLock(hMem));
+ if (!wbuf) { GlobalFree(hMem); return false; }
+ MultiByteToWideChar(CP_UTF8, 0, utf8.c_str(), -1, wbuf, wlen);
+ GlobalUnlock(hMem);
+
+ // 4) 鎵撳紑鍓创鏉垮苟璁剧疆鏁版嵁锛圕F_UNICODETEXT锛�
+ if (!OpenClipboard(nullptr)) { GlobalFree(hMem); return false; }
+ if (!EmptyClipboard()) { CloseClipboard(); GlobalFree(hMem); return false; }
+
+ // 鎴愬姛鍚庯紝鍐呭瓨鎵�鏈夋潈浜ょ粰鍓创鏉匡紝涓嶈兘鍐� GlobalFree
+ if (!SetClipboardData(CF_UNICODETEXT, hMem)) {
+ CloseClipboard();
+ GlobalFree(hMem);
+ return false;
+ }
+
+ CloseClipboard();
+ return true;
+}
+
+
// CPageGlassList 瀵硅瘽妗�
IMPLEMENT_DYNAMIC(CPageGlassList, CDialogEx)
@@ -403,7 +436,7 @@
}
// ===== CPageGlassList 娑堟伅澶勭悊绋嬪簭 =====
-void CPageGlassList::InitRxWindow()
+void CPageGlassList::InitRxWindows()
{
// 璁㈤槄鏁版嵁
IRxWindows* pRxWindows = RX_GetRxWindows();
@@ -619,12 +652,42 @@
}
// ==================== 2) DB 褰撳墠椤碉紙涓ら樁娈垫瀯寤猴紝澶勭悊鍗曞悜 buddy锛� ====================
+ const int rawLimit = PAGE_SIZE + 1;
+ const int rawOffset = PAGE_SIZE * (m_nCurPage - 1);
#if USE_FAKE_DB_DEMO
- auto page = _make_page_fake(m_filters, PAGE_SIZE, PAGE_SIZE * (m_nCurPage - 1));
+ auto page = _make_page_fake(m_filters, rawLimit, rawOffset);
#else
auto& db = GlassLogDb::Instance();
- auto page = db.queryPaged(m_filters, PAGE_SIZE, PAGE_SIZE * (m_nCurPage - 1));
+ auto pageFull = db.queryPaged(m_filters, rawLimit, rawOffset);
#endif
+
+ // 濡傛灉澶氬嚭涓�鏉★紝鐪嬬湅瀹冩槸鍚︽槸鈥滄湰椤垫渶鍚庝竴鏉♀�濈殑 buddy
+ std::optional<decltype(pageFull.items)::value_type> lookahead; // 棰勮璁板綍锛堣嫢涓庢渶鍚庝竴鏉¢厤瀵癸級
+ auto iEquals = [](const std::string& a, const std::string& b) {
+#ifdef _WIN32
+ return _stricmp(a.c_str(), b.c_str()) == 0;
+#else
+ return strcasecmp(a.c_str(), b.c_str()) == 0;
+#endif
+ };
+
+ if (pageFull.items.size() == rawLimit) {
+ const auto& last = pageFull.items[PAGE_SIZE - 1];
+ const auto& extra = pageFull.items[PAGE_SIZE];
+
+ bool pair =
+ (!last.buddyId.empty() && iEquals(last.buddyId, extra.classId)) ||
+ (!extra.buddyId.empty() && iEquals(extra.buddyId, last.classId));
+
+ if (pair) {
+ lookahead = extra; // 鎶婇璇讳繚瀛樹笅鏉ワ紝绋嶅悗琛ユ垚瀛愯
+ }
+ // 鏃犺鏄惁閰嶅锛屽垪琛ㄩ兘缂╁洖 PAGE_SIZE 鏉★紙棰勮涓嶇畻鍏ユ湰椤垫暟鎹泦锛�
+ pageFull.items.pop_back();
+ }
+
+ // 涔嬪悗姝e父鎸� page 鏋勫缓
+ auto& page = pageFull; // 涓轰簡澶嶇敤浣犲師鏈夊彉閲忓悕
// 寤虹储寮曪細classId -> index
std::unordered_map<std::string, size_t> idxById;
@@ -643,6 +706,8 @@
// -------- Phase 1: 鍏堝鐞嗏�滄湁 buddyId 鐨勮褰曗�濓紙鑳介厤灏遍厤锛涘崟鍚戜篃閰嶏級 ----------
for (size_t i = 0; i < page.items.size(); ++i) {
const auto& r = page.items[i];
+ // CopyUtf8ToClipboard(r.pretty);
+
if (consumed.count(r.classId)) continue;
if (r.buddyId.empty()) continue;
@@ -801,8 +866,8 @@
CString headers[] = {
_T(""),
_T("id"),
- _T("Cassette Sequence No"),
- _T("Job Sequence No"),
+ _T("Cassette SN"),
+ _T("Job SN"),
_T("Class ID"),
_T("鐗╂枡绫诲瀷"),
_T("鐘舵��"),
@@ -881,7 +946,7 @@
{
if (nIDEvent == 1) {
KillTimer(1);
- InitRxWindow();
+ InitRxWindows();
}
else if (nIDEvent == 2) {
UpdateWipData(); // 鍙仛澧為噺锛屼笉閲嶅缓
@@ -1000,10 +1065,11 @@
{
auto* p = reinterpret_cast<NMC_ELC_SHOWFULLTEXT*>(pNMHDR);
- // 杩欓噷鏆傛椂鐢ㄦ秷鎭鏄剧ず锛涘悗缁彲鎹㈡垚浣犵殑璇︽儏椤�
- CString strNewMsg = p->text;
- strNewMsg.Replace(_T(","), _T("\n"));
- MessageBox(strNewMsg, _T("璇︾粏淇℃伅"), MB_OK | MB_ICONINFORMATION);
+ // 瀵硅瘽妗嗘樉绀哄伐鑹哄弬鏁�
+ CProcessDataListDlg dlg;
+ dlg.setRawText(p->text);
+ dlg.DoModal();
+
*pResult = 0;
}
@@ -1330,3 +1396,12 @@
return true;
}
+
+BOOL CPageGlassList::PreTranslateMessage(MSG* pMsg)
+{
+ if (pMsg->wParam == VK_RETURN || pMsg->wParam == VK_ESCAPE) {
+ return TRUE;
+ }
+
+ return CDialogEx::PreTranslateMessage(pMsg);
+}
--
Gitblit v1.9.3