kcode-pi 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +358 -0
- package/dist/cli/kcode.d.ts +15 -0
- package/dist/cli/kcode.js +153 -0
- package/dist/cli/main.d.ts +2 -0
- package/dist/cli/main.js +7 -0
- package/docs/KCODE_DISTRIBUTION.md +91 -0
- package/extensions/kingdee-harness.ts +180 -0
- package/extensions/kingdee-header.ts +122 -0
- package/extensions/kingdee-tools.ts +379 -0
- package/knowledge/.backup/v1.0.0/version.json +10 -0
- package/knowledge/cangqiong/product-notes.md +15 -0
- package/knowledge/common/business-flows.md +115 -0
- package/knowledge/common/config-guides.md +110 -0
- package/knowledge/common/error-patterns.md +170 -0
- package/knowledge/common/implementation.md +144 -0
- package/knowledge/cosmic/hard-constraints.md +38 -0
- package/knowledge/cosmic/ksql-datafix.md +34 -0
- package/knowledge/cosmic/platform-baseline.md +32 -0
- package/knowledge/cosmic/plugin-decision-matrix.md +40 -0
- package/knowledge/cosmic/review-checklist.md +40 -0
- package/knowledge/cosmic/unittest.md +35 -0
- package/knowledge/enterprise/api-reference.md +186 -0
- package/knowledge/enterprise/code-patterns.md +217 -0
- package/knowledge/enterprise/plugin-lifecycle.md +188 -0
- package/knowledge/enterprise/tables.json +159 -0
- package/knowledge/flagship/api-reference.md +237 -0
- package/knowledge/flagship/code-patterns.md +246 -0
- package/knowledge/flagship/cosmic-platform-note.md +15 -0
- package/knowledge/flagship/plugin-lifecycle.md +248 -0
- package/knowledge/flagship/tables.json +159 -0
- package/knowledge/version.json +10 -0
- package/knowledge/xinghan/product-notes.md +15 -0
- package/package.json +71 -0
- package/prompts/kd-discuss.md +11 -0
- package/prompts/kd-execute.md +12 -0
- package/prompts/kd-plan.md +12 -0
- package/prompts/kd-ship.md +12 -0
- package/prompts/kd-spec.md +12 -0
- package/prompts/kd-verify.md +12 -0
- package/skills/kd-check/SKILL.md +26 -0
- package/skills/kd-cosmic-dev/SKILL.md +82 -0
- package/skills/kd-cosmic-review/SKILL.md +90 -0
- package/skills/kd-cosmic-unittest/SKILL.md +92 -0
- package/skills/kd-debug/SKILL.md +30 -0
- package/skills/kd-discuss/SKILL.md +24 -0
- package/skills/kd-execute/SKILL.md +22 -0
- package/skills/kd-gen/SKILL.md +34 -0
- package/skills/kd-ksql/SKILL.md +86 -0
- package/skills/kd-plan/SKILL.md +24 -0
- package/skills/kd-ship/SKILL.md +22 -0
- package/skills/kd-spec/SKILL.md +24 -0
- package/skills/kd-verify/SKILL.md +22 -0
- package/themes/kcode-dark.json +81 -0
- package/vendor/kingdee-skills/cosmic-unittest/SKILL.md +788 -0
- package/vendor/kingdee-skills/cosmic-unittest/author-cache.json +5 -0
- package/vendor/kingdee-skills/cosmic-unittest/cosmic-unittest-skill-overview.html +746 -0
- package/vendor/kingdee-skills/cosmic-unittest/examples/business-test.md +205 -0
- package/vendor/kingdee-skills/cosmic-unittest/examples/common-test.md +257 -0
- package/vendor/kingdee-skills/cosmic-unittest/examples/formplugin-test.md +560 -0
- package/vendor/kingdee-skills/cosmic-unittest/examples/op-plugin-test.md +231 -0
- package/vendor/kingdee-skills/cosmic-unittest/examples/validator-test.md +232 -0
- package/vendor/kingdee-skills/cosmic-unittest/patterns/business-helper.md +184 -0
- package/vendor/kingdee-skills/cosmic-unittest/patterns/common-module.md +355 -0
- package/vendor/kingdee-skills/cosmic-unittest/patterns/convert-plugin.md +130 -0
- package/vendor/kingdee-skills/cosmic-unittest/patterns/formplugin.md +235 -0
- package/vendor/kingdee-skills/cosmic-unittest/patterns/op-plugin.md +226 -0
- package/vendor/kingdee-skills/cosmic-unittest/patterns/validator.md +206 -0
- package/vendor/kingdee-skills/kingdee-cosmic-reviewer/SKILL.md +674 -0
- package/vendor/kingdee-skills/kingdee-cosmic-reviewer/references/advanced-scenario-checklist.md +307 -0
- package/vendor/kingdee-skills/kingdee-cosmic-reviewer/references/algox-performance-checklist.md +129 -0
- package/vendor/kingdee-skills/kingdee-cosmic-reviewer/references/coding-standard-checklist.md +491 -0
- package/vendor/kingdee-skills/kingdee-cosmic-reviewer/references/cosmic-api-checklist.md +285 -0
- package/vendor/kingdee-skills/kingdee-cosmic-reviewer/references/data-access-checklist.md +261 -0
- package/vendor/kingdee-skills/kingdee-cosmic-reviewer/references/data-transaction-checklist.md +390 -0
- package/vendor/kingdee-skills/kingdee-cosmic-reviewer/references/domain-logic-checklist.md +295 -0
- package/vendor/kingdee-skills/kingdee-cosmic-reviewer/references/form-plugin-checklist.md +508 -0
- package/vendor/kingdee-skills/kingdee-cosmic-reviewer/references/infra-checklist.md +254 -0
- package/vendor/kingdee-skills/kingdee-cosmic-reviewer/references/ksql-checklist.md +305 -0
- package/vendor/kingdee-skills/kingdee-cosmic-reviewer/references/lifecycle-checklist.md +298 -0
- package/vendor/kingdee-skills/kingdee-cosmic-reviewer/references/operation-plugin-checklist.md +442 -0
- package/vendor/kingdee-skills/kingdee-cosmic-reviewer/references/test-mock-checklist.md +120 -0
- package/vendor/kingdee-skills/kingdee-cosmic-reviewer/references/ui-performance-checklist.md +320 -0
- package/vendor/kingdee-skills/kingdee-cosmic-reviewer/scripts/pattern-matcher.py +336 -0
- package/vendor/kingdee-skills/kingdee-cosmic-reviewer/scripts/review-score-calculator.py +121 -0
- package/vendor/kingdee-skills/ok-cosmic/CHANGELOG.md +295 -0
- package/vendor/kingdee-skills/ok-cosmic/README.md +460 -0
- package/vendor/kingdee-skills/ok-cosmic/SKILL.md +287 -0
- package/vendor/kingdee-skills/ok-cosmic/agents/openai.yaml +17 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/BatchImportPluginTemplate.java +93 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/BillPlugInTemplate.java +156 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/ConvertPlugInTemplate.java +255 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/FormPluginTemplate.java +597 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/IWorkflowPluginTemplate.java +91 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/ListPluginTemplate.java +194 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/OpPluginTemplate.java +201 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/OpenApiControllerTemplate.java +103 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/PrintPluginTemplate.java +95 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/ReportFormPluginTemplate.java +257 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/ReportListDataPluginTemplate.java +70 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/StandardTreeListPluginTemplate.java +130 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/TaskTemplate.java +80 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/TreeListPluginTemplate.java +152 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/WriteBackPlugInTemplate.java +286 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/attachment/AttachmentUploadBindSample.java +93 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/botp/BotpTracePushSample.java +168 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/botp/SampleConvertPlugin.java +223 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/cache/SampleCacheUsage.java +218 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/concurrent/SampleThreadPoolBatch.java +156 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/data/DynamicObjectCrudSample.java +205 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/data/DynamicObjectOpsSample.java +100 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/form/BeforeOperationConfirmSample.java +217 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/form/ConfirmDialogSample.java +131 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/form/EntryRowCalculateSample.java +116 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/form/F7FilterSample.java +134 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/form/GetAndSetValueSample.java +176 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/form/HyperlinkJumpSample.java +124 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/form/OpenBillModalSample.java +253 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/form/ReturnParentDataSample.java +295 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/form/TreeControlSample.java +140 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/form/ViewControlOpsSample.java +132 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/list/ListPluginBasicSample.java +170 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/list/ListPreOpenFilterSample.java +68 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/message/MessageNotifySample.java +95 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/mq/SampleMQConsumer.java +198 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/mq/sample_mq.xml +15 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/operation/OpAddValidatorsSample.java +137 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/operation/OperationOptionBridgeSample.java +228 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/package-info.java +19 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/query/BaseDataQuerySample.java +194 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/query/BatchQuerySample.java +368 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/query/DataSetQueryStatSample.java +131 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/report/SampleReportFormPlugin.java +179 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/report/SampleReportListDataPlugin.java +616 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/snippets-guide.md +64 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/task/ScheduleTaskSample.java +160 -0
- package/vendor/kingdee-skills/ok-cosmic/assets/snippets/workflow/SampleWorkflowPlugin.java +302 -0
- package/vendor/kingdee-skills/ok-cosmic/manifest.json +78 -0
- package/vendor/kingdee-skills/ok-cosmic/ok-cosmic-intro.html +903 -0
- package/vendor/kingdee-skills/ok-cosmic/references/adv/attachment-api.md +114 -0
- package/vendor/kingdee-skills/ok-cosmic/references/adv/botp-convert.md +98 -0
- package/vendor/kingdee-skills/ok-cosmic/references/adv/dynamic-object.md +113 -0
- package/vendor/kingdee-skills/ok-cosmic/references/adv/entity-metadata.md +123 -0
- package/vendor/kingdee-skills/ok-cosmic/references/adv/event-lifecycle.md +184 -0
- package/vendor/kingdee-skills/ok-cosmic/references/adv/flex-prop.md +114 -0
- package/vendor/kingdee-skills/ok-cosmic/references/adv/form-utils.md +133 -0
- package/vendor/kingdee-skills/ok-cosmic/references/adv/operate-chain.md +159 -0
- package/vendor/kingdee-skills/ok-cosmic/references/adv/plugin-base.md +218 -0
- package/vendor/kingdee-skills/ok-cosmic/references/adv/query-dataset.md +149 -0
- package/vendor/kingdee-skills/ok-cosmic/references/adv/request-context.md +88 -0
- package/vendor/kingdee-skills/ok-cosmic/references/adv/view-handler.md +157 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/plugin/plugin-bill.md +76 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/plugin/plugin-botp.md +70 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/plugin/plugin-form.md +165 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/plugin/plugin-import.md +69 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/plugin/plugin-list.md +227 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/plugin/plugin-openapi.md +112 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/plugin/plugin-operation.md +135 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/plugin/plugin-print.md +65 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/plugin/plugin-report-data.md +64 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/plugin/plugin-report-form.md +90 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/plugin/plugin-task.md +62 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/plugin/plugin-tree-list.md +71 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/plugin/plugin-workflow.md +82 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/plugin/plugin-writeback.md +71 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/sdk/sdk-algo.md +67 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/sdk/sdk-cache.md +63 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/sdk/sdk-dynamic-model-svc.md +82 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/sdk/sdk-dynamic-object.md +70 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/sdk/sdk-entity-model.md +61 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/sdk/sdk-exception.md +64 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/sdk/sdk-file.md +63 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/sdk/sdk-id.md +47 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/sdk/sdk-lock.md +61 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/sdk/sdk-log.md +63 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/sdk/sdk-network-control.md +70 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/sdk/sdk-orm-access.md +78 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/sdk/sdk-request-context.md +62 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/sdk/sdk-threadpool.md +63 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/sdk/sdk-tx.md +64 -0
- package/vendor/kingdee-skills/ok-cosmic/references/base/sdk/sdk-utils.md +67 -0
- package/vendor/kingdee-skills/ok-cosmic/requirements.txt +2 -0
- package/vendor/kingdee-skills/ok-cosmic/rules/a-layer-rules.json +24 -0
- package/vendor/kingdee-skills/ok-cosmic/rules/anti-patterns.md +48 -0
- package/vendor/kingdee-skills/ok-cosmic/rules/cheat-sheet.md +256 -0
- package/vendor/kingdee-skills/ok-cosmic/rules/coding-preferences.md +140 -0
- package/vendor/kingdee-skills/ok-cosmic/rules/constraints.md +61 -0
- package/vendor/kingdee-skills/ok-cosmic/rules/decision-matrix.md +222 -0
- package/vendor/kingdee-skills/ok-cosmic/rules/intent-routing.md +94 -0
- package/vendor/kingdee-skills/ok-cosmic/rules/platform-baseline.md +69 -0
- package/vendor/kingdee-skills/ok-cosmic/rules/post-check.md +109 -0
- package/vendor/kingdee-skills/ok-cosmic/scripts/config_loader.py +204 -0
- package/vendor/kingdee-skills/ok-cosmic/scripts/cosmic-api-knowledge.py +910 -0
- package/vendor/kingdee-skills/ok-cosmic/scripts/cosmic-basedata-query.py +359 -0
- package/vendor/kingdee-skills/ok-cosmic/scripts/cosmic-config-check.py +181 -0
- package/vendor/kingdee-skills/ok-cosmic/scripts/cosmic-extpoints-query.py +389 -0
- package/vendor/kingdee-skills/ok-cosmic/scripts/cosmic-form-metadata.py +856 -0
- package/vendor/kingdee-skills/ok-cosmic/scripts/cosmic-post-check.py +262 -0
- package/vendor/kingdee-skills/ok-cosmic/scripts/cosmic-post-lint.py +293 -0
- package/vendor/kingdee-skills/ok-cosmic/scripts/lint/__init__.py +2 -0
- package/vendor/kingdee-skills/ok-cosmic/scripts/lint/base.py +393 -0
- package/vendor/kingdee-skills/ok-cosmic/scripts/lint/resource_check.py +176 -0
- package/vendor/kingdee-skills/ok-cosmic/scripts/lint/scene_check.py +375 -0
- package/vendor/kingdee-skills/ok-cosmic/scripts/lint/style_check.py +434 -0
- package/vendor/kingdee-skills/ok-cosmic/scripts/lint/verify_check.py +36 -0
- package/vendor/kingdee-skills/ok-cosmic/scripts/route_client.py +186 -0
- package/vendor/kingdee-skills/ok-cosmic/scripts/script_utils.py +40 -0
- package/vendor/kingdee-skills/ok-cosmic/scripts/sqlite_cache.py +142 -0
- package/vendor/kingdee-skills/ok-cosmic/setup/cuslib/kd-cd-cosmic-commons.jar +0 -0
- package/vendor/kingdee-skills/ok-cosmic/setup/cuslib/kd-cd-cosmic-features.jar +0 -0
- package/vendor/kingdee-skills/ok-cosmic/setup/ok-cosmic-docs.db +0 -0
- package/vendor/kingdee-skills/ok-cosmic/setup/ok-cosmic.json +13 -0
- package/vendor/kingdee-skills/ok-cosmic/setup/setup-mac.sh +18 -0
- package/vendor/kingdee-skills/ok-cosmic/setup/setup-windows.bat +53 -0
- package/vendor/kingdee-skills/ok-cosmic/setup/setup.jar +0 -0
- package/vendor/kingdee-skills/ok-ksql/SKILL.md +81 -0
- package/vendor/kingdee-skills/ok-ksql/agents/openai.yaml +7 -0
- package/vendor/kingdee-skills/ok-ksql/manifest.json +14 -0
- package/vendor/kingdee-skills/ok-ksql/references/ksql-datafix.md +452 -0
- package/vendor/kingdee-skills/ok-ksql/scripts/ksql_lint.py +363 -0
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
package kd.cd.common;
|
|
2
|
+
|
|
3
|
+
import kd.bos.dataentity.entity.DynamicObject;
|
|
4
|
+
import kd.bos.entity.ExtendedDataEntity;
|
|
5
|
+
import kd.bos.entity.botp.plugin.AbstractConvertPlugIn;
|
|
6
|
+
import kd.bos.entity.botp.plugin.args.AfterBizRuleEventArgs;
|
|
7
|
+
import kd.bos.entity.botp.plugin.args.AfterBuildDrawFilterEventArgs;
|
|
8
|
+
import kd.bos.entity.botp.plugin.args.AfterBuildQueryParemeterEventArgs;
|
|
9
|
+
import kd.bos.entity.botp.plugin.args.AfterBuildRowConditionEventArgs;
|
|
10
|
+
import kd.bos.entity.botp.plugin.args.AfterConvertEventArgs;
|
|
11
|
+
import kd.bos.entity.botp.plugin.args.AfterCreateLinkEventArgs;
|
|
12
|
+
import kd.bos.entity.botp.plugin.args.AfterCreateTargetEventArgs;
|
|
13
|
+
import kd.bos.entity.botp.plugin.args.AfterFieldMappingEventArgs;
|
|
14
|
+
import kd.bos.entity.botp.plugin.args.AfterGetSourceDataEventArgs;
|
|
15
|
+
import kd.bos.entity.botp.plugin.args.BeforeBuildGroupModeEventArgs;
|
|
16
|
+
import kd.bos.entity.botp.plugin.args.BeforeBuildRowConditionEventArgs;
|
|
17
|
+
import kd.bos.entity.botp.plugin.args.BeforeCreateLinkEventArgs;
|
|
18
|
+
import kd.bos.entity.botp.plugin.args.BeforeCreateTargetEventArgs;
|
|
19
|
+
import kd.bos.entity.botp.plugin.args.BeforeGetSourceDataEventArgs;
|
|
20
|
+
import kd.bos.entity.botp.plugin.args.InitVariableEventArgs;
|
|
21
|
+
import kd.bos.entity.botp.runtime.ConvertConst;
|
|
22
|
+
import kd.bos.orm.query.QCP;
|
|
23
|
+
import kd.bos.orm.query.QFilter;
|
|
24
|
+
|
|
25
|
+
import java.text.SimpleDateFormat;
|
|
26
|
+
import java.util.List;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* 单据转换插件骨架模板(原生 AbstractConvertPlugIn)。
|
|
30
|
+
* 该类仅用于示例写法,生成后请按实际业务删除无用事件并替换占位常量。
|
|
31
|
+
*/
|
|
32
|
+
public class ConvertPlugInTemplate extends AbstractConvertPlugIn {
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* 触发时机: 在需要了解当前插件可访问上下文能力时调用。
|
|
36
|
+
* 参数要点: 无入参;仅展示当前插件可通过 this. 访问的方法能力。
|
|
37
|
+
* 典型用途: 作为模板提示,指导在各事件内选择正确的上下文 API。
|
|
38
|
+
*/
|
|
39
|
+
private void getContextSample() {
|
|
40
|
+
// this.getSrcMainType();
|
|
41
|
+
// this.getTgtMainType();
|
|
42
|
+
// this.getRule();
|
|
43
|
+
// this.getOpType();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// 占位常量:复制模板后请统一替换为业务真实 key。
|
|
47
|
+
private static final String FIELD_SRC_REMARK = "remark";
|
|
48
|
+
private static final String FIELD_TGT_REMARK = "description";
|
|
49
|
+
private static final String FIELD_SRC_BILLNO = "billno";
|
|
50
|
+
private static final String FIELD_SRC_DATE = "date";
|
|
51
|
+
private static final String FIELD_SRC_AMOUNT = "amount";
|
|
52
|
+
private static final String FIELD_DRAW_FILTER_BILLNO = "billno";
|
|
53
|
+
// ===== 初始化与规则编译阶段 =====
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* 触发时机:转换规则启动后、读取源单前。
|
|
57
|
+
* 参数要点:e 提供源单/目标单/规则上下文,可用于阶段初始化。
|
|
58
|
+
* 典型用途:根据源单/目标单/规则初始化本地变量,决定后续分支处理。
|
|
59
|
+
*/
|
|
60
|
+
@Override
|
|
61
|
+
public void initVariable(InitVariableEventArgs e) {
|
|
62
|
+
super.initVariable(e);
|
|
63
|
+
// 最小示例:按上下文分流(选单/下推,源单/目标单类型)。
|
|
64
|
+
this.getSrcMainType();
|
|
65
|
+
this.getTgtMainType();
|
|
66
|
+
this.getRule();
|
|
67
|
+
this.getOpType();
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* 触发时机:系统编译源单筛选条件前。
|
|
72
|
+
* 参数要点:e 可调整条件编译上下文。
|
|
73
|
+
* 典型用途:忽略规则原生条件或追加插件定制条件。
|
|
74
|
+
*/
|
|
75
|
+
@Override
|
|
76
|
+
public void beforeBuildRowCondition(BeforeBuildRowConditionEventArgs e) {
|
|
77
|
+
super.beforeBuildRowCondition(e);
|
|
78
|
+
this.getRule();
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* 触发时机:系统编译源单筛选条件后。
|
|
83
|
+
* 参数要点:e 可读取已编译条件并做补充。
|
|
84
|
+
* 典型用途:对最终条件做补充说明或记录诊断信息。
|
|
85
|
+
*/
|
|
86
|
+
@Override
|
|
87
|
+
public void afterBuildRowCondition(AfterBuildRowConditionEventArgs e) {
|
|
88
|
+
super.afterBuildRowCondition(e);
|
|
89
|
+
this.getSrcMainType();
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* 触发时机:分单/合并策略构建前。
|
|
94
|
+
* 参数要点:e 包含分组策略上下文,可动态改写。
|
|
95
|
+
* 典型用途:动态调整分组字段、分单策略。
|
|
96
|
+
*/
|
|
97
|
+
@Override
|
|
98
|
+
public void beforeBuildGroupMode(BeforeBuildGroupModeEventArgs e) {
|
|
99
|
+
super.beforeBuildGroupMode(e);
|
|
100
|
+
this.getTgtMainType();
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// ===== 源单取数阶段 =====
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* 触发时机:系统确认字段映射并构建取数参数后。
|
|
107
|
+
* 参数要点:可通过 e.addSrcField(...) 补字段、e.getQFilters() 补过滤。
|
|
108
|
+
* 典型用途:补充插件要用到的源单字段,微调系统生成的 QFilter 条件。
|
|
109
|
+
*/
|
|
110
|
+
@Override
|
|
111
|
+
public void afterBuildQueryParemeter(AfterBuildQueryParemeterEventArgs e) {
|
|
112
|
+
super.afterBuildQueryParemeter(e);
|
|
113
|
+
// 最小示例:补充源单字段。
|
|
114
|
+
e.addSrcField(FIELD_SRC_BILLNO);
|
|
115
|
+
e.addSrcField(FIELD_SRC_DATE);
|
|
116
|
+
e.addSrcField(FIELD_SRC_AMOUNT);
|
|
117
|
+
// 若需要基础资料引用属性,可传类似 "currency.name"。
|
|
118
|
+
// e.addSrcField("currency.name");
|
|
119
|
+
|
|
120
|
+
// 最小示例:在既有条件基础上追加过滤。
|
|
121
|
+
// e.getQFilters().add(new QFilter("forbidstatus", QCP.not_equals, "B"));
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* 触发时机:执行源单查询前。
|
|
126
|
+
* 参数要点:e 提供最终查询上下文,可做最后一次拦截/补充。
|
|
127
|
+
* 典型用途:最后一次调整取数语句与条件。
|
|
128
|
+
*/
|
|
129
|
+
@Override
|
|
130
|
+
public void beforeGetSourceData(BeforeGetSourceDataEventArgs e) {
|
|
131
|
+
super.beforeGetSourceData(e);
|
|
132
|
+
this.getOpType();
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/**
|
|
136
|
+
* 触发时机:系统拿到源单数据后。
|
|
137
|
+
* 参数要点:e 可读取源数据并按需替换或补充。
|
|
138
|
+
* 典型用途:读取源数据并补充额外引用数据,必要时替换系统数据集。
|
|
139
|
+
*/
|
|
140
|
+
@Override
|
|
141
|
+
public void afterGetSourceData(AfterGetSourceDataEventArgs e) {
|
|
142
|
+
super.afterGetSourceData(e);
|
|
143
|
+
this.getSrcMainType();
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// ===== 目标单构建阶段 =====
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* 触发时机:创建目标单数据包前(常见于选单追加场景)。
|
|
150
|
+
* 参数要点:e 提供目标构建上下文,可设置默认参数。
|
|
151
|
+
* 典型用途:对现有目标单做预处理。
|
|
152
|
+
*/
|
|
153
|
+
@Override
|
|
154
|
+
public void beforeCreateTarget(BeforeCreateTargetEventArgs e) {
|
|
155
|
+
super.beforeCreateTarget(e);
|
|
156
|
+
this.getTgtMainType();
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* 触发时机:创建目标单数据包后(常见于下推场景)。
|
|
161
|
+
* 参数要点:e 可访问目标单数据包并填充默认值。
|
|
162
|
+
* 典型用途:为目标单设置默认值。
|
|
163
|
+
*/
|
|
164
|
+
@Override
|
|
165
|
+
public void afterCreateTarget(AfterCreateTargetEventArgs e) {
|
|
166
|
+
super.afterCreateTarget(e);
|
|
167
|
+
this.getRule();
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* 触发时机:系统字段映射完成后。
|
|
172
|
+
* 参数要点:e.getSourceDataEntity()/e.getTargetDataEntity() 分别为源/目标对象。
|
|
173
|
+
* 典型用途:在系统映射结果上补值或覆盖字段。
|
|
174
|
+
*/
|
|
175
|
+
@Override
|
|
176
|
+
public void afterFieldMapping(AfterFieldMappingEventArgs e) {
|
|
177
|
+
super.afterFieldMapping(e);
|
|
178
|
+
// 取目标单,单据头数据包 (可能会生成多张单,是个数组)
|
|
179
|
+
String targetEntityNumber = this.getTgtMainType().getName();
|
|
180
|
+
ExtendedDataEntity[] billDataEntitys = e.getTargetExtDataEntitySet().FindByEntityKey(targetEntityNumber);
|
|
181
|
+
SimpleDateFormat timesdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
182
|
+
// 逐单处理
|
|
183
|
+
for(ExtendedDataEntity billDataEntity : billDataEntitys){
|
|
184
|
+
// 取当前目标单,对应的源单行
|
|
185
|
+
List<DynamicObject> srcRows = (List<DynamicObject>)billDataEntity.getValue(ConvertConst.ConvExtDataKey_SourceRows);
|
|
186
|
+
// 取源单第一行上的字段值,忽略其他行
|
|
187
|
+
DynamicObject srcRow = srcRows.get(0);
|
|
188
|
+
String billno = (String)e.getFldProperties().get("billno").getValue(srcRow);
|
|
189
|
+
// 给目标单字段赋值
|
|
190
|
+
billDataEntity.setValue("fieldKey", billno);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* 触发时机:业务规则执行后。
|
|
196
|
+
* 参数要点:e 提供规则执行结果上下文。
|
|
197
|
+
* 典型用途:做规则后字段修正。
|
|
198
|
+
*/
|
|
199
|
+
@Override
|
|
200
|
+
public void afterBizRule(AfterBizRuleEventArgs e) {
|
|
201
|
+
super.afterBizRule(e);
|
|
202
|
+
this.getOpType();
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
// ===== 关联关系与收尾阶段 =====
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* 触发时机:记录来源/去向关联关系前。
|
|
209
|
+
* 参数要点:可通过 e.setCancel(true) 取消关系写入。
|
|
210
|
+
* 典型用途:按条件取消关联关系写入。
|
|
211
|
+
*/
|
|
212
|
+
@Override
|
|
213
|
+
public void beforeCreateLink(BeforeCreateLinkEventArgs e) {
|
|
214
|
+
super.beforeCreateLink(e);
|
|
215
|
+
// 最小示例:按业务需要取消关联关系。
|
|
216
|
+
// e.setCancel(true);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* 触发时机:记录关联关系后。
|
|
221
|
+
* 参数要点:e 提供关联链路上下文,可追加同步逻辑。
|
|
222
|
+
* 典型用途:基于已生成关联关系做数据同步携带。
|
|
223
|
+
*/
|
|
224
|
+
@Override
|
|
225
|
+
public void afterCreateLink(AfterCreateLinkEventArgs e) {
|
|
226
|
+
super.afterCreateLink(e);
|
|
227
|
+
this.getRule();
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* 触发时机:整个转换流程末尾。
|
|
232
|
+
* 参数要点:e 汇总了本次转换结果,可做统一收尾。
|
|
233
|
+
* 典型用途:对生成目标单做最终收尾处理。
|
|
234
|
+
*/
|
|
235
|
+
@Override
|
|
236
|
+
public void afterConvert(AfterConvertEventArgs e) {
|
|
237
|
+
super.afterConvert(e);
|
|
238
|
+
this.getOpType();
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
// ===== 选单场景补充事件 =====
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* 触发时机:系统生成选单条件后。
|
|
245
|
+
* 参数要点:可通过 e.setPlugFilter(...) 注入插件过滤条件。
|
|
246
|
+
* 典型用途:叠加插件自定义选单过滤。
|
|
247
|
+
*/
|
|
248
|
+
@Override
|
|
249
|
+
public void afterBuildDrawFilter(AfterBuildDrawFilterEventArgs e) {
|
|
250
|
+
super.afterBuildDrawFilter(e);
|
|
251
|
+
// 最小示例:限制选单只显示单据编号包含 1 的数据。
|
|
252
|
+
QFilter filter = new QFilter(FIELD_DRAW_FILTER_BILLNO, QCP.like, "1");
|
|
253
|
+
e.setPlugFilter(filter);
|
|
254
|
+
}
|
|
255
|
+
}
|