From 0756bf12d10cf1b7f78c571de0a9ad69cbaeb7ca Mon Sep 17 00:00:00 2001
From: curtis <curtis@i-mps.com>
Date: 星期一, 30 三月 2026 14:24:17 +0800
Subject: [PATCH] fix: 更新內部引用方法參照
---
doc/curtis/prompt/scanimpl_analysis/01/scanimpl_annalysis.md | 167 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 167 insertions(+), 0 deletions(-)
diff --git a/doc/curtis/prompt/scanimpl_analysis/01/scanimpl_annalysis.md b/doc/curtis/prompt/scanimpl_analysis/01/scanimpl_annalysis.md
new file mode 100644
index 0000000..f873c54
--- /dev/null
+++ b/doc/curtis/prompt/scanimpl_analysis/01/scanimpl_annalysis.md
@@ -0,0 +1,167 @@
+
+---
+base_path: "doc/curtis/prompt/scanimpl_analysis"
+script_path: "script"
+---
+
+
+## B1.1 分析方法集合:
+請依 @Delphi_套件相依.md 裡 「依功能拆分模組與第三方套件綁定分析」要項
+對 @CB_IMGPSScanImp.pas 檔案進行分析,將合於該分類的方法名集合找出來
+生成對應的 json 檔, 該生成的 json 檔可用來代表 @CB_IMGPSScanImp.pas.bk
+拆分前的每個方法,其分類是什麼,其所在區段是什麼,最後該 json 檔將餵入
+腳本,透過腳本執行,進行檔案拆分及測試,而不是透過 AI 拆分
+
+以下是詳細規格需求:
+### B1.1.1. **輸入檔案**:
+ * 程式需讀取同一目錄下的 `CB_IMGPSScanImp.pas.bk` 檔案。
+
+### B1.1.2. **方法擷取**:
+ * 尋找檔案中所有以 `procedure TCB_IMGPSScanX.` 或 `function TCB_IMGPSScanX.` 開頭的行。
+ * 紀錄每個方法的:
+ * `lIndex`:該方法在檔案中的起始行號(從 1 開始計算)。
+ * `methodName`:方法的完整簽名字串 (例如:`procedure TCB_IMGPSScanX.StatrTwainScan;`, `procedure TCB_IMGPSScanX.OnAcquire( const DibHandle : THandle;`)。
+
+### B1.1.3. **計算 `rIndex`**:
+ * 每個方法的結束行 (`rIndex`) 可以假設是下一個方法開始的前一行 (`lIndex - 1`)。
+ * 如果是最後一個方法,它的 `rIndex` 應該是檔案的總行數。
+
+### B1.1.4. **分類邏輯 (tags)**:
+ 我需要你將找到的每個方法,分配到對應的 `tags`。
+ 請根據以下關鍵字進行簡單的字串比對分類 (如果不在此列表內,則預設分類到 `"UIView"` / `"UIView.misc"`):
+
+ * **ScannerControl (硬體掃描控制模組)**
+ * `StatrTwainScan`, `OnAcquire`, `initkscan`, `CheckScannerConfig`, `PageEnd`, `PageDone`, `R_W_Scanini`, `GetDefScanIni` -> `ScannerControl.twainWrapper`
+
+ * **ImageProcessor (影像處理與轉換模組)**
+ * `DeskewImg`, `Rotate`, `CropImg`, `ImageReSize_FormID`, `ImageReSize_tmp`, `CheckNeedCrop` -> `ImageProcessor.transformer`
+ * `ConvertToBW`, `ConvertToGray`, `Image_Smooth`, `NegativeImg`, `CleanupBorder` -> `ImageProcessor.converter`
+ * `MpsGetBarcode`, `Get_OMR` -> `ImageProcessor.barcodeRecognizer`
+ * `FindPoint`, `CheckSize`, `GetSiteOMR` -> `ImageProcessor.anchorAnalyzer`
+
+ * **TransportManager (安全傳輸與 API 通訊模組)**
+ * `ProcessServlet`, `ProcessServlet_Get`, `ProcessServlet_FormData` -> `TransportManager.requestWrapper`
+ * `upFile`, `dnFile`, `dnFile_Get`, `GetftpInfo`, `SetFtpInfo`, `FtpCaseComplete` -> `TransportManager.fileTransfer`
+ * `En_DecryptionStr_Base64`, `LoadFileGetMD5`, `HTTPSClientCertificateValidate` -> `TransportManager.utilities`
+ * `ZipMainFile`, `ZipMaskFile`, `ExecuteUnZip` -> `TransportManager.payloadArchiver`
+
+ * **BusinessLogic (業務邏輯與資料解析模組)**
+ * `SetSQLData`, `GetSQLData`, `FindSQLData`, `GetSetInf1`, `GetSetInf2`, `GetSetInf3`, `GetSetInf4`, `GetSetInf5`, `GetSetInf6`, `GetSetInf7` -> `BusinessLogic.paramState`
+ * `BarCode2FormID`, `BarCode2CaseID`, `FormCode2DocNo`, `DocNo2DocName`, `DocNoNeedDiv`, `CreateDocNo_Info`, `CreateCustDocNo_Info` -> `BusinessLogic.entityMapping`
+ * `OMRCheckCase`, `OMRErr2ini`, `OMRErrini2List` -> `BusinessLogic.ormRuleEngine`
+ * `SetUseCase`, `GetUseCase`, `OldCasetoNewCase`, `ErrFormtoCurrentForm`, `DeleteDocNoFileForESCAN` -> `BusinessLogic.caseManager`
+
+ * **UIView (UI 視圖與介面呈現模組)**
+ * 包含 `TreeView` 的方法 (如 `TreeView1Click`, `DrawDocItem2` 等) -> `UIView.treeView`
+ * 包含 `ISB`, `ImageScrollBox`, `ScrollBox` 的方法 (如 `ISB1Click`, `CreatePreViewISB` 等) -> `UIView.scrollView`
+ * `InitialLanguage`, `DownLanguage` -> `UIView.i18n`
+ * `DisplayMode`, `GoViewMode` -> `UIView.misc`
+ * `DataLoading`, `Timer2Timer`, `StatusBar1DblClick` -> `UIView.statusMessenger`
+
+### B1.1.5. **方法分類 tags 說明**:
+
+#### ScannerController (掃描硬體控制模組)
+- ScannerController.twainWrapper (TWAIN 介面與硬體初始化)
+- ScannerController.acquisitionHandler (硬體取像非同步回呼與後處理)
+
+#### ImageProcessor
+- ImageProcessor.transformer (影像幾何與物理變換):如各種縮放 (ReSize)、裁切 (CheckNeedCrop)、旋轉 (Rotate)、去斜 (Deskew) 及所有 UI 比例變換等。
+- ImageProcessor.converter (影像色彩與品質轉換):包含黑白轉換 (ConvertToBW)、平滑化 (Smooth)、遮罩處理 (Mask)、浮水印列印 (PrintImg)。
+- ImageProcessor.anchorAnalyzer (特徵定位與 OMR 分析):包含了分析黑點密度的 GetSiteOMR。
+
+#### TransportManager (傳輸與網路管理模組),新增了:
+- TransportManager.apiClient (RESTful / Servlet 參數與組態拉取)
+- TransportManager.fileTransfer (大檔、影像、FTP 實體傳輸)
+- TransportManager.certificateManager (HTTPS 與 SSL 憑證驗證)
+- TransportManager.payloadArchiver (ZIP 壓縮、解壓縮與進匯出封裝)
+
+#### BusinessLogic
+- BusinessLogic.systemInternal': 系統參數與組態儲存庫 (Config & Parameter Repository),
+- BusinessLogic.configRepository: 系統參數與組態儲存庫 (Config & Parameter Repository),
+- BusinessLogic.ormRuleEngine': OMR 與業務規則檢核引擎 (OMR & Business Rule Engine),
+- BusinessLogic.entityMapping: 領域實體對映與結構管理器 (Entity Mapping & Structure Manager),
+- BusinessLogic.entityModel: 領域實體對映與結構管理器 (Entity Mapping & Structure Manager),
+- BusinessLogic.fileManager': 案件異動與舊案引用處理器 (Case Modification & Legacy Handler),
+- BusinessLogic.caseManager': 案件異動與舊案引用處理器 (Case Modification & Legacy Handler),
+- BusinessLogic.activeXWrapper': 處理 ActiveX 相關,
+
+#### UIView
+- UIView.treeView:樹狀結構呈現與操作 (如 TreeView 的節點刷新、拖曳、點擊)
+- UIView.listView:清單結構呈現 (如 PageLV, AttListBox)
+- UIView.imageScrollBox:影像預覽與捲動 (對應 EnImgScr / TImageScrollBox 相關的視覺控制與預覽)
+- UIView.toolBar:互動工具與面板按鈕 (如各類 BtnClick、FC 分類按鈕)
+- UIView.popupMenu:快顯選單控制 (各類 PMxxxClick 或是 PopupMenuPopup)
+- UIView.i18n:多國語言與翻譯載入
+- UIView.feedback:系統狀態與進度回饋 (包含 Timer、DataLoading、StatusBar)
+
+### B1.1.5. **輸出格式**:
+ * JSON 輸出的結構應該類似這樣:
+```json
+ [
+ {
+ "matcher": "procedure TCB_IMGPSScanX.OnAcquire( const DibHandle : THandle;",
+ "tags": [
+ "ScannerController",
+ "ScannerController.acquisitionHandler"
+ ],
+ "deps": [],
+ "lIndex": "4444",
+ "rIndex": "4476",
+ "description": ""
+ }
+ ]
+```
+ * 盡量將相同 `tags` 的 items 群組在一個 block 內。
+ * deps 保持空陣列
+
+
+## B1.2 分類結果生成:
+### B1.2.1 生成分類結果 json - tags 說明:
+透過 B1.1 取得的結果將各個方法名進行分類,分類時請合於 @Delphi_套件相依.md
+的分類方法,並依 "B1.1.5 方法分類 tags 說明" 判定其 tags 屬性
+
+**example:**
+```pascal
+// CB_IMGPSScanImp.pas, 假定該分類為 ImageProcessor.anchorAnalyzer
+function TCB_IMGPSScanX.GetSiteOMR(FileName,Site:String;bt: Integer): Integer;
+```
+
+```json
+{
+ "matcher": "function TCB_IMGPSScanX.GetSiteOMR(FileName,Site:String;bt: Integer): Integer;",
+ "tags": [
+ "ImageProcessor",
+ "ImageProcessor.anchorAnalyzer"
+ ],
+ "deps": [],
+ "lIndex": "5173",
+ "rIndex": "5226",
+ "description": ""
+}
+```
+
+### B1.2.2 生成分類結果 json - 輸出位置說明:
+- B1.2.2.1 - 若 tag 名其一綴包含 ScannerController:
+ > output: `{{base_path}}/scanimpl_annalysis.ScannerController.json`
+- B1.2.2.2 - 若 tag 名其一綴包含 BusinessLogic:
+ > output: `{{base_path}}/scanimpl_annalysis.BusinessLogic.json`
+- B1.2.2.3 - 若 tag 名其一綴包含 ImageProcessor:
+ > output: `{{base_path}}/scanimpl_annalysis.ImageProcessor.json`
+- B1.2.2.4 - 若 tag 名其一綴包含 TransportManager:
+ > output: `{{base_path}}/scanimpl_annalysis.TransportManager.json`
+- B1.2.2.5 - 若 tag 名其一綴包含 UIView:
+ > output: `{{base_path}}/scanimpl_annalysis.UIView.json`
+
+
+## B1.3 生成分類結果 json 驗證腳本
+生成腳本,以驗證 "B1.2 分類結果生成" 是否正確,該腳本檔針對 @CB_IMGPSScanImp.pas.bk
+與 '"B1.2 分類結果生成" 生成之 json'(以下簡程 [B1.2Jsons] ) 進行驗證
+
+### B1.3.1 驗證原則說明:
+- B1.3.1.1: [B1.2Jsons] 其方法名(matcher) 必須等於 @CB_IMGPSScanImp.pas 所對應的 lIndex
+- B1.3.1.2: [B1.2Jsons] 裡的 rIndex, lIndex 不可能為 -1, 因為該值必須正確映射 @CB_IMGPSScanImp.pas.bk 的行號
+- B1.3.1.3: 移除 @CB_IMGPSScanImp.pas 中於 [B1.2Jsons] 所標示之區段另存為文字檔,並於腳本結束時,顯其文字檔路徑,我想人工審核
+ > output: `{{base_path}}/scanimpl_annalysis.remainings.txt`
+
+### B1.3.2 驗證腳本路徑:
+> output: `{{script_path}}/scanimpl_annalysis_json.test.js`
--
Gitblit v1.8.0