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: 更新內部引用方法參照
---
scripts/scanimpl_annalysis_classify.js | 115 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 115 insertions(+), 0 deletions(-)
diff --git a/scripts/scanimpl_annalysis_classify.js b/scripts/scanimpl_annalysis_classify.js
new file mode 100644
index 0000000..2f9cb6c
--- /dev/null
+++ b/scripts/scanimpl_annalysis_classify.js
@@ -0,0 +1,115 @@
+const fs = require('fs');
+const path = require('path');
+
+const base_path = 'doc/curtis/prompt/scanimpl_analysis';
+const inputFile = path.join(base_path, 'step1_raw_methods.json');
+const outputFile = path.join(base_path, 'step2_classified_methods.json');
+
+const rules = [
+ {
+ tag: 'ScannerController',
+ subs: [
+ {
+ sub: 'twainWrapper',
+ keywords: ['StatrTwainScan', 'OnAcquire', 'initkscan', 'CheckScannerConfig', 'PageEnd', 'PageDone', 'R_W_Scanini', 'GetDefScanIni']
+ }
+ ]
+ },
+ {
+ tag: 'ImageProcessor',
+ subs: [
+ {
+ sub: 'transformer',
+ keywords: ['DeskewImg', 'Rotate', 'CropImg', 'ImageReSize_FormID', 'ImageReSize_tmp', 'CheckNeedCrop']
+ },
+ {sub: 'converter', keywords: ['ConvertToBW', 'ConvertToGray', 'Image_Smooth', 'NegativeImg', 'CleanupBorder']},
+ {sub: 'barcodeRecognizer', keywords: ['MpsGetBarcode', 'Get_OMR']},
+ {sub: 'anchorAnalyzer', keywords: ['FindPoint', 'CheckSize', 'GetSiteOMR']}
+ ]
+ },
+ {
+ tag: 'TransportManager',
+ subs: [
+ {sub: 'requestWrapper', keywords: ['ProcessServlet', 'ProcessServlet_Get', 'ProcessServlet_FormData']},
+ {
+ sub: 'fileTransfer',
+ keywords: ['upFile', 'dnFile', 'dnFile_Get', 'GetftpInfo', 'SetFtpInfo', 'FtpCaseComplete']
+ },
+ {sub: 'utilities', keywords: ['En_DecryptionStr_Base64', 'LoadFileGetMD5', 'HTTPSClientCertificateValidate']},
+ {sub: 'payloadArchiver', keywords: ['ZipMainFile', 'ZipMaskFile', 'ExecuteUnZip']}
+ ]
+ },
+ {
+ tag: 'BusinessLogic',
+ subs: [
+ {
+ sub: 'paramState',
+ keywords: ['SetSQLData', 'GetSQLData', 'FindSQLData', 'GetSetInf1', 'GetSetInf2', 'GetSetInf3', 'GetSetInf4', 'GetSetInf5', 'GetSetInf6', 'GetSetInf7']
+ },
+ {
+ sub: 'entityMapping',
+ keywords: ['BarCode2FormID', 'BarCode2CaseID', 'FormCode2DocNo', 'DocNo2DocName', 'DocNoNeedDiv', 'CreateDocNo_Info', 'CreateCustDocNo_Info']
+ },
+ {sub: 'ormRuleEngine', keywords: ['OMRCheckCase', 'OMRErr2ini', 'OMRErrini2List']},
+ {
+ sub: 'caseModification',
+ keywords: ['SetUseCase', 'GetUseCase', 'OldCasetoNewCase', 'ErrFormtoCurrentForm', 'DeleteDocNoFileForESCAN']
+ }
+ ]
+ },
+ {
+ tag: 'UIView',
+ subs: [
+ {sub: 'treeView', keywords: ['TreeView', 'DrawDocItem2']},
+ {sub: 'scrollView', keywords: ['ISB', 'ImageScrollBox', 'ScrollBox']},
+ {sub: 'i18n', keywords: ['InitialLanguage', 'DownLanguage']},
+ {sub: 'layouts', keywords: ['DisplayMode', 'GoViewMode']},
+ {sub: 'statusMessenger', keywords: ['DataLoading', 'Timer2Timer', 'StatusBar1DblClick', 'Timer', 'StatusBar']},
+ {sub: 'listView', keywords: ['PageLV', 'AttListBox', 'ListView', 'ListBox']},
+ {sub: 'toolBar', keywords: ['BtnClick', 'FC', 'BitBtn', 'SpeedButton']},
+ {sub: 'popupMenu', keywords: ['PM', 'PopupMenu', 'MenuItem']}
+ ]
+ }
+];
+
+function classify() {
+ const rawMethods = JSON.parse(fs.readFileSync(inputFile, 'utf8'));
+ const classified = rawMethods.map(method => {
+ const tags = new Set();
+ const lowerMatcher = method.matcher.toLowerCase();
+
+ for (const rule of rules) {
+ for (const subRule of rule.subs) {
+ const matched = subRule.keywords.some(k => {
+ if (k === 'PM') return method.matcher.includes('.PM');
+ if (k === 'FC') return method.matcher.includes('.FC');
+ return lowerMatcher.includes(k.toLowerCase());
+ });
+
+ if (matched) {
+ tags.add(rule.tag);
+ tags.add(`${rule.tag}.${subRule.sub}`);
+ }
+ }
+ }
+
+ if (tags.size === 0) {
+ tags.add('UIView');
+ tags.add('UIView.misc');
+ }
+
+ return {
+ matcher: method.matcher,
+ tags: Array.from(tags),
+ deps: [],
+ lIndex: method.lIndex.toString(),
+ rIndex: method.rIndex.toString(),
+ description: ""
+ };
+ });
+
+ fs.writeFileSync(outputFile, JSON.stringify(classified, null, 2), 'utf8');
+ console.log(`Classified ${classified.length} methods to ${outputFile}`);
+}
+
+classify();
--
Gitblit v1.8.0