ava-data-models 0.1.0__tar.gz

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.
Files changed (98) hide show
  1. ava_data_models-0.1.0/LICENSE +190 -0
  2. ava_data_models-0.1.0/PKG-INFO +300 -0
  3. ava_data_models-0.1.0/README.md +266 -0
  4. ava_data_models-0.1.0/pyproject.toml +89 -0
  5. ava_data_models-0.1.0/setup.cfg +4 -0
  6. ava_data_models-0.1.0/src/ava_data_models/__init__.py +45 -0
  7. ava_data_models-0.1.0/src/ava_data_models/accounting/__init__.py +59 -0
  8. ava_data_models-0.1.0/src/ava_data_models/accounting/models.py +670 -0
  9. ava_data_models-0.1.0/src/ava_data_models/achievementmanagement/__init__.py +27 -0
  10. ava_data_models-0.1.0/src/ava_data_models/achievementmanagement/models.py +269 -0
  11. ava_data_models-0.1.0/src/ava_data_models/apparelindustry/__init__.py +83 -0
  12. ava_data_models-0.1.0/src/ava_data_models/apparelindustry/models.py +1196 -0
  13. ava_data_models-0.1.0/src/ava_data_models/approvalprocess/__init__.py +23 -0
  14. ava_data_models-0.1.0/src/ava_data_models/approvalprocess/models.py +175 -0
  15. ava_data_models-0.1.0/src/ava_data_models/budget/__init__.py +15 -0
  16. ava_data_models-0.1.0/src/ava_data_models/budget/models.py +84 -0
  17. ava_data_models-0.1.0/src/ava_data_models/businesspartner/__init__.py +37 -0
  18. ava_data_models-0.1.0/src/ava_data_models/businesspartner/models.py +467 -0
  19. ava_data_models-0.1.0/src/ava_data_models/cargos/__init__.py +117 -0
  20. ava_data_models-0.1.0/src/ava_data_models/cargos/models.py +2476 -0
  21. ava_data_models-0.1.0/src/ava_data_models/channels/__init__.py +29 -0
  22. ava_data_models-0.1.0/src/ava_data_models/channels/models.py +322 -0
  23. ava_data_models-0.1.0/src/ava_data_models/common/__init__.py +28 -0
  24. ava_data_models-0.1.0/src/ava_data_models/common/base.py +78 -0
  25. ava_data_models-0.1.0/src/ava_data_models/dealer/__init__.py +13 -0
  26. ava_data_models-0.1.0/src/ava_data_models/dealer/models.py +54 -0
  27. ava_data_models-0.1.0/src/ava_data_models/documents/__init__.py +13 -0
  28. ava_data_models-0.1.0/src/ava_data_models/documents/models.py +44 -0
  29. ava_data_models-0.1.0/src/ava_data_models/equipment/__init__.py +41 -0
  30. ava_data_models-0.1.0/src/ava_data_models/equipment/models.py +489 -0
  31. ava_data_models-0.1.0/src/ava_data_models/groupfinancemanagement/__init__.py +19 -0
  32. ava_data_models-0.1.0/src/ava_data_models/groupfinancemanagement/models.py +176 -0
  33. ava_data_models-0.1.0/src/ava_data_models/humanresources/__init__.py +83 -0
  34. ava_data_models-0.1.0/src/ava_data_models/humanresources/models.py +970 -0
  35. ava_data_models-0.1.0/src/ava_data_models/importexport/__init__.py +19 -0
  36. ava_data_models-0.1.0/src/ava_data_models/importexport/models.py +192 -0
  37. ava_data_models-0.1.0/src/ava_data_models/initialfantasy/__init__.py +57 -0
  38. ava_data_models-0.1.0/src/ava_data_models/initialfantasy/models.py +493 -0
  39. ava_data_models-0.1.0/src/ava_data_models/integration/__init__.py +17 -0
  40. ava_data_models-0.1.0/src/ava_data_models/integration/models.py +86 -0
  41. ava_data_models-0.1.0/src/ava_data_models/invoice/__init__.py +31 -0
  42. ava_data_models-0.1.0/src/ava_data_models/invoice/models.py +290 -0
  43. ava_data_models-0.1.0/src/ava_data_models/manufacturing/__init__.py +117 -0
  44. ava_data_models-0.1.0/src/ava_data_models/manufacturing/models.py +1902 -0
  45. ava_data_models-0.1.0/src/ava_data_models/manufacturingcost/__init__.py +69 -0
  46. ava_data_models-0.1.0/src/ava_data_models/manufacturingcost/models.py +1160 -0
  47. ava_data_models-0.1.0/src/ava_data_models/manufacturingoutsourcing/__init__.py +23 -0
  48. ava_data_models-0.1.0/src/ava_data_models/manufacturingoutsourcing/models.py +262 -0
  49. ava_data_models-0.1.0/src/ava_data_models/manufacturingscheduling/__init__.py +29 -0
  50. ava_data_models-0.1.0/src/ava_data_models/manufacturingscheduling/models.py +390 -0
  51. ava_data_models-0.1.0/src/ava_data_models/marketingpromotion/__init__.py +23 -0
  52. ava_data_models-0.1.0/src/ava_data_models/marketingpromotion/models.py +191 -0
  53. ava_data_models-0.1.0/src/ava_data_models/masterdata/__init__.py +39 -0
  54. ava_data_models-0.1.0/src/ava_data_models/masterdata/models.py +350 -0
  55. ava_data_models-0.1.0/src/ava_data_models/materials/__init__.py +107 -0
  56. ava_data_models-0.1.0/src/ava_data_models/materials/models.py +1560 -0
  57. ava_data_models-0.1.0/src/ava_data_models/membercenter/__init__.py +29 -0
  58. ava_data_models-0.1.0/src/ava_data_models/membercenter/models.py +276 -0
  59. ava_data_models-0.1.0/src/ava_data_models/message/__init__.py +23 -0
  60. ava_data_models-0.1.0/src/ava_data_models/message/models.py +171 -0
  61. ava_data_models-0.1.0/src/ava_data_models/product/__init__.py +21 -0
  62. ava_data_models-0.1.0/src/ava_data_models/product/models.py +158 -0
  63. ava_data_models-0.1.0/src/ava_data_models/projectsystem/__init__.py +45 -0
  64. ava_data_models-0.1.0/src/ava_data_models/projectsystem/models.py +579 -0
  65. ava_data_models-0.1.0/src/ava_data_models/purchase/__init__.py +65 -0
  66. ava_data_models-0.1.0/src/ava_data_models/purchase/models.py +1491 -0
  67. ava_data_models-0.1.0/src/ava_data_models/py.typed +0 -0
  68. ava_data_models-0.1.0/src/ava_data_models/qualitycontrol/__init__.py +37 -0
  69. ava_data_models-0.1.0/src/ava_data_models/qualitycontrol/models.py +457 -0
  70. ava_data_models-0.1.0/src/ava_data_models/receiptpayment/__init__.py +23 -0
  71. ava_data_models-0.1.0/src/ava_data_models/receiptpayment/models.py +262 -0
  72. ava_data_models-0.1.0/src/ava_data_models/reimbursement/__init__.py +25 -0
  73. ava_data_models-0.1.0/src/ava_data_models/reimbursement/models.py +261 -0
  74. ava_data_models-0.1.0/src/ava_data_models/reportanalysis/__init__.py +21 -0
  75. ava_data_models-0.1.0/src/ava_data_models/reportanalysis/models.py +141 -0
  76. ava_data_models-0.1.0/src/ava_data_models/sales/__init__.py +63 -0
  77. ava_data_models-0.1.0/src/ava_data_models/sales/models.py +1472 -0
  78. ava_data_models-0.1.0/src/ava_data_models/salesopportunity/__init__.py +35 -0
  79. ava_data_models-0.1.0/src/ava_data_models/salesopportunity/models.py +381 -0
  80. ava_data_models-0.1.0/src/ava_data_models/servicecenter/__init__.py +31 -0
  81. ava_data_models-0.1.0/src/ava_data_models/servicecenter/models.py +374 -0
  82. ava_data_models-0.1.0/src/ava_data_models/shopping/__init__.py +17 -0
  83. ava_data_models-0.1.0/src/ava_data_models/shopping/models.py +100 -0
  84. ava_data_models-0.1.0/src/ava_data_models/store/__init__.py +25 -0
  85. ava_data_models-0.1.0/src/ava_data_models/store/models.py +264 -0
  86. ava_data_models-0.1.0/src/ava_data_models/supplier/__init__.py +31 -0
  87. ava_data_models-0.1.0/src/ava_data_models/supplier/models.py +434 -0
  88. ava_data_models-0.1.0/src/ava_data_models/taxation/__init__.py +39 -0
  89. ava_data_models-0.1.0/src/ava_data_models/taxation/models.py +506 -0
  90. ava_data_models-0.1.0/src/ava_data_models/thirdpartyapp/__init__.py +19 -0
  91. ava_data_models-0.1.0/src/ava_data_models/thirdpartyapp/models.py +104 -0
  92. ava_data_models-0.1.0/src/ava_data_models.egg-info/PKG-INFO +300 -0
  93. ava_data_models-0.1.0/src/ava_data_models.egg-info/SOURCES.txt +96 -0
  94. ava_data_models-0.1.0/src/ava_data_models.egg-info/dependency_links.txt +1 -0
  95. ava_data_models-0.1.0/src/ava_data_models.egg-info/requires.txt +10 -0
  96. ava_data_models-0.1.0/src/ava_data_models.egg-info/top_level.txt +1 -0
  97. ava_data_models-0.1.0/tests/test_common.py +40 -0
  98. ava_data_models-0.1.0/tests/test_modules.py +62 -0
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to the Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2026 AVACloud Team
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
@@ -0,0 +1,300 @@
1
+ Metadata-Version: 2.4
2
+ Name: ava-data-models
3
+ Version: 0.1.0
4
+ Summary: AVACloud 业务领域公共 Pydantic v2 数据模型包
5
+ Author: AVACloud Team
6
+ License: Apache-2.0
7
+ Project-URL: Homepage, https://gitea.avacloud.com.cn/AVA-AIA/ava-data-models
8
+ Project-URL: Repository, https://gitea.avacloud.com.cn/AVA-AIA/ava-data-models
9
+ Project-URL: Issues, https://gitea.avacloud.com.cn/AVA-AIA/ava-data-models/issues
10
+ Keywords: ava,avacloud,pydantic,models,ibas,business-objects
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: Apache Software License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
20
+ Classifier: Typing :: Typed
21
+ Requires-Python: >=3.10
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Requires-Dist: pydantic<3.0,>=2.0
25
+ Requires-Dist: pydantic-settings<3.0,>=2.0
26
+ Requires-Dist: typing-extensions>=4.0
27
+ Provides-Extra: dev
28
+ Requires-Dist: pytest>=7.0; extra == "dev"
29
+ Requires-Dist: pytest-cov>=4.0; extra == "dev"
30
+ Requires-Dist: ruff>=0.4.0; extra == "dev"
31
+ Requires-Dist: mypy>=1.0; extra == "dev"
32
+ Requires-Dist: black>=24.0; extra == "dev"
33
+ Dynamic: license-file
34
+
35
+ # ava-data-models
36
+
37
+ AVACloud 业务领域公共 Pydantic v2 数据模型包。
38
+
39
+ ## 项目定位
40
+
41
+ `ava-data-models` 是 AVACloud 生态下的**公共业务对象模型层**,仅存放:
42
+
43
+ - Pydantic v2 业务对象数据模型
44
+ - 业务对象公共基类
45
+
46
+ **不包含**业务枚举、查询条件、分页、批量操作、通用请求/响应包装,也不包含任何业务查询、校验逻辑、持久化或外部服务调用,作为各智能体项目的公共依赖被引用。
47
+
48
+ ## 技术栈
49
+
50
+ - Python >= 3.10
51
+ - Pydantic v2
52
+ - pydantic-settings
53
+ - typing-extensions
54
+
55
+ ## 安装
56
+
57
+ ```bash
58
+ # 作为依赖安装(发布到 PyPI 后)
59
+ pip install ava-data-models
60
+
61
+ # 本地开发安装
62
+ pip install -e ".[dev]"
63
+ ```
64
+
65
+ ## 目录结构
66
+
67
+ ```text
68
+ ava-data-models/
69
+ ├── pyproject.toml
70
+ ├── README.md
71
+ ├── scripts/
72
+ │ ├── generate_from_dts.py # 从 ibas index.d.ts 自动生成模型
73
+ │ └── generate_inits.py # 生成业务模块 __init__.py
74
+ ├── src/
75
+ │ └── ava_data_models/
76
+ │ ├── __init__.py # 根包导出:公共业务对象基类
77
+ │ ├── common/ # 公共基础
78
+ │ │ └── base.py # BusinessObject / Document / DocumentLine / MasterData / ...
79
+ │ ├── accounting/
80
+ │ ├── apparelindustry/
81
+ │ ├── approvalprocess/
82
+ │ ├── budget/
83
+ │ ├── businesspartner/
84
+ │ ├── cargos/
85
+ │ ├── channels/
86
+ │ ├── dealer/
87
+ │ ├── documents/
88
+ │ ├── equipment/
89
+ │ ├── groupfinancemanagement/
90
+ │ ├── humanresources/
91
+ │ ├── importexport/
92
+ │ ├── initialfantasy/
93
+ │ ├── integration/
94
+ │ ├── invoice/
95
+ │ ├── manufacturing/
96
+ │ ├── manufacturingcost/
97
+ │ ├── manufacturingoutsourcing/
98
+ │ ├── manufacturingscheduling/
99
+ │ ├── marketingpromotion/
100
+ │ ├── masterdata/
101
+ │ ├── materials/
102
+ │ ├── membercenter/
103
+ │ ├── message/
104
+ │ ├── product/
105
+ │ ├── projectsystem/
106
+ │ ├── purchase/
107
+ │ ├── qualitycontrol/
108
+ │ ├── receiptpayment/
109
+ │ ├── reimbursement/
110
+ │ ├── reportanalysis/
111
+ │ ├── sales/
112
+ │ ├── salesopportunity/
113
+ │ ├── servicecenter/
114
+ │ ├── shopping/
115
+ │ ├── store/
116
+ │ ├── supplier/
117
+ │ ├── taxation/
118
+ │ ├── thirdpartyapp/
119
+ │ └── ... # 每个业务模块独立分包
120
+ └── tests/
121
+ └── test_common.py
122
+ ```
123
+
124
+ ## 命名规范
125
+
126
+ - 类名:大驼峰(CamelCase),例如 `SalesOrder`、`PurchaseRequestItem`。
127
+ - 属性名:下划线命名(snake_case),例如 `doc_entry`、`customer_code`。
128
+ - 通过 `Field(..., alias="camelCase")` 保留原始 ibas API 字段名,支持直接反序列化来自 ibas 的 camelCase JSON。
129
+
130
+ ## 业务对象基类层次
131
+
132
+ 模型基类与 ibas 业务对象体系对齐:
133
+
134
+ ```text
135
+ BusinessObject
136
+ ├── MasterData # 对应 ibas.IBOMasterData
137
+ ├── MasterDataLine # 对应 ibas.IBOMasterDataLine
138
+ ├── Document # 对应 ibas.IBODocument
139
+ ├── DocumentLine # 对应 ibas.IBODocumentLine
140
+ ├── Simple # 对应 ibas.IBOSimple
141
+ └── SimpleLine # 对应 ibas.IBOSimpleLine
142
+ ```
143
+
144
+ - `BusinessObject` 携带 `source_system` / `fetched_at` 跨系统溯源元信息。
145
+ - 生成器**仅对直接继承上述 `ibas.IBO*` 接口的类生成模型**。
146
+ - 集合壳类(如 `ISalesOrderItems`)不再保留,字段统一用 `list[T]` 表示。
147
+
148
+ ## 使用示例
149
+
150
+ ### 1. 导入公共基础模型
151
+
152
+ ```python
153
+ from ava_data_models import BusinessObject, Document
154
+ ```
155
+
156
+ ### 2. 导入业务模块模型
157
+
158
+ ```python
159
+ from ava_data_models.sales import SalesOrder, SalesOrderItem
160
+ from ava_data_models.purchase import PurchaseOrder, PurchaseRequest
161
+ from ava_data_models.materials import Material, Warehouse
162
+ from ava_data_models.manufacturing import ProductionOrder
163
+ ```
164
+
165
+ ### 3. 直接解析 ibas API 返回的 camelCase JSON
166
+
167
+ ```python
168
+ import json
169
+ from ava_data_models.sales import SalesOrder
170
+
171
+ payload = {
172
+ "docEntry": 10001,
173
+ "docNum": "SO-2024-0001",
174
+ "customerCode": "C001",
175
+ "customerName": "示例客户",
176
+ "documentTotal": 1250.00,
177
+ "salesOrderItems": [
178
+ {"itemCode": "P001", "quantity": 10.0, "price": 125.0},
179
+ ],
180
+ }
181
+
182
+ order = SalesOrder.model_validate(payload)
183
+ print(order.doc_entry) # 10001
184
+ print(order.customer_code) # C001
185
+ print(order.document_total) # 1250.0
186
+ print(len(order.sales_order_items)) # 1
187
+ ```
188
+
189
+ ### 4. 序列化为 snake_case 或 camelCase
190
+
191
+ ```python
192
+ # 默认输出 snake_case
193
+ order.model_dump()
194
+
195
+ # 输出 camelCase(使用 alias)
196
+ order.model_dump(by_alias=True)
197
+
198
+ # JSON 字符串
199
+ order.model_dump_json(by_alias=True)
200
+ ```
201
+
202
+ ## 模型生成脚本
203
+
204
+ 本项目提供 `scripts/generate_from_dts.py`,可基于本地 `ibas-typescript/test/apps/{module}/index.d.ts` 中的 `bo` 命名空间自动生成对应业务模块的 Pydantic 模型。
205
+
206
+ ### 生成范围
207
+
208
+ 仅对 `bo` 命名空间中**直接继承 `ibas.IBO*` 业务对象接口**的类生成模型:
209
+
210
+ | ibas 接口 | Python 基类 |
211
+ |---|---|
212
+ | `ibas.IBusinessObject` | `BusinessObject` |
213
+ | `ibas.IBODocument` | `Document` |
214
+ | `ibas.IBODocumentLine` | `DocumentLine` |
215
+ | `ibas.IBOMasterData` | `MasterData` |
216
+ | `ibas.IBOMasterDataLine` | `MasterDataLine` |
217
+ | `ibas.IBOSimple` | `Simple` |
218
+ | `ibas.IBOSimpleLine` | `SimpleLine` |
219
+
220
+ 集合壳类(如 `ISalesOrderItems`)不生成独立模型,相关字段统一用 `list[T]` 表示。
221
+
222
+ ### 前提
223
+
224
+ - 本地存在 ibas TypeScript 测试应用目录,默认路径:
225
+ `/Users/Niuren.Zhu/Codes/ColorCoding/ibas-typescript/test/apps`
226
+ - 可通过环境变量覆盖:
227
+ `export IBAS_TEST_APPS=/path/to/ibas-typescript/test/apps`
228
+
229
+ ### 生成全部模块
230
+
231
+ ```bash
232
+ python scripts/generate_from_dts.py
233
+ python scripts/generate_inits.py
234
+ ```
235
+
236
+ ### 生成单个模块
237
+
238
+ ```bash
239
+ # 修改 generate_from_dts.py 中的 MODULES 列表,仅保留目标模块后执行
240
+ python scripts/generate_from_dts.py
241
+ python scripts/generate_inits.py
242
+ ```
243
+
244
+ ### 生成后注意事项
245
+
246
+ - 生成器为**尽力解析**,复杂的泛型、方法、跨模块引用会降级为 `Any`。
247
+ - 集合类(如 `ISalesOrderItems`)会启发式转换为 `list[SalesOrderItem]`。
248
+ - 生成后建议人工复核关键字段类型与注释,必要时手工补充或修正。
249
+
250
+ ## 开发
251
+
252
+ ```bash
253
+ # 创建虚拟环境
254
+ python -m venv .venv
255
+ source .venv/bin/activate # Windows: .venv\Scripts\activate
256
+
257
+ # 安装开发依赖
258
+ pip install -e ".[dev]"
259
+
260
+ # 运行测试
261
+ pytest tests/ -v
262
+
263
+ # 代码格式化(可选)
264
+ black src tests
265
+ ruff check src tests --fix
266
+ ```
267
+
268
+ ## 发布到 PyPI
269
+
270
+ ```bash
271
+ # 1. 安装构建与上传工具
272
+ pip install build twine
273
+
274
+ # 2. 清理历史构建产物
275
+ rm -rf dist/ build/ *.egg-info
276
+
277
+ # 3. 构建源码分发包与 Wheel
278
+ python -m build
279
+
280
+ # 4. 先上传到 TestPyPI 验证(可选)
281
+ python -m twine upload --repository testpypi dist/*
282
+
283
+ # 5. 上传到正式 PyPI
284
+ python -m twine upload dist/*
285
+ ```
286
+
287
+ 上传前请确认:
288
+
289
+ - `pyproject.toml` 中的 `version` 已更新。
290
+ - 已配置 PyPI API token(`~/.pypirc` 或通过 `twine login`)。
291
+
292
+ ## 贡献与维护
293
+
294
+ - 新增业务模块:在 `src/ava_data_models/` 下新增分包,参照现有模块结构编写 `models.py` 与 `__init__.py`。
295
+ - 修改公共模型:优先在 `common/` 中定义,并在 `common/__init__.py` 与根包 `__init__.py` 中导出。
296
+ - 保持**只存放业务对象模型**,不引入枚举、查询条件、分页、批量操作、业务逻辑、数据库查询或外部 HTTP 调用。
297
+
298
+ ## 许可证
299
+
300
+ [Apache License 2.0](LICENSE)