weaver-work-cli 0.1.73 → 0.1.76

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 (363) hide show
  1. package/README.md +37 -1
  2. package/dist/chunks/{archive-THZV4ND4.js → archive-ENBSUMHV.js} +14 -9
  3. package/dist/chunks/{archive-oa-PQ23OLEV.js → archive-oa-7BFPQ6M5.js} +10 -7
  4. package/dist/chunks/{asset-RGPROZYH.js → asset-V5SUD3PW.js} +10 -7
  5. package/dist/chunks/{asset-idle-Z2PDX7NA.js → asset-idle-3CEL7WFX.js} +7 -4
  6. package/dist/chunks/{attachment-content-R3RPVOYE.js → attachment-content-24RL44SE.js} +3 -3
  7. package/dist/chunks/{blog-7U3QZPIF.js → blog-FLI4SS3P.js} +10 -7
  8. package/dist/chunks/{caizhilian-3AB42GCV.js → caizhilian-7WCTKCCP.js} +10 -7
  9. package/dist/chunks/{calendar-KINM64E4.js → calendar-G726HUUH.js} +10 -7
  10. package/dist/chunks/chunk-257JXJGD.js +30 -0
  11. package/dist/chunks/chunk-2BZ7TY4M.js +49 -0
  12. package/dist/chunks/{chunk-4BXR6CNB.js → chunk-2KW7AI6P.js} +2 -2
  13. package/dist/chunks/{chunk-WM33BSIL.js → chunk-2QCCXPNU.js} +1 -1
  14. package/dist/chunks/chunk-2UV4IZIT.js +473 -0
  15. package/dist/chunks/{chunk-R3MK2RBN.js → chunk-5E2FDXBU.js} +1 -1
  16. package/dist/chunks/{chunk-DRUND2PJ.js → chunk-5QUTQHXF.js} +225 -152
  17. package/dist/chunks/chunk-7DE3VMZD.js +35 -0
  18. package/dist/chunks/{chunk-PAFOLIYQ.js → chunk-AZC53XSQ.js} +1 -1
  19. package/dist/chunks/{chunk-6HT73VOI.js → chunk-BWFCTE43.js} +2 -2
  20. package/dist/chunks/{chunk-4YXAK6OA.js → chunk-FEZK536Z.js} +12 -7
  21. package/dist/chunks/{chunk-IU6UB2TD.js → chunk-FPWCCRKT.js} +48 -6
  22. package/dist/chunks/{chunk-LLCMOZ5L.js → chunk-H6N6U2D6.js} +11 -11
  23. package/dist/chunks/{chunk-54ST55IJ.js → chunk-JJONWB5N.js} +11 -1
  24. package/dist/chunks/{chunk-GWJLAF6B.js → chunk-JWF2R6EQ.js} +0 -462
  25. package/dist/chunks/chunk-KINXYJXM.js +205 -0
  26. package/dist/chunks/{chunk-F4HM25K4.js → chunk-KJA7CRES.js} +1 -1
  27. package/dist/chunks/chunk-L5SCNJKX.js +1166 -0
  28. package/dist/chunks/{chunk-TV46Q4NY.js → chunk-MS7MKBGJ.js} +74 -68
  29. package/dist/chunks/{chunk-XZBYRYWX.js → chunk-NZQRW4KL.js} +2 -2
  30. package/dist/chunks/chunk-OJ4JPD25.js +428 -0
  31. package/dist/chunks/chunk-OVTCWLNQ.js +1346 -0
  32. package/dist/chunks/{chunk-NUP4RYZK.js → chunk-PMRNIGKZ.js} +2 -2
  33. package/dist/chunks/{chunk-2CHGUYMG.js → chunk-Q7RXCK2Y.js} +4 -4
  34. package/dist/chunks/{chunk-AMAPQVBT.js → chunk-QVKRNL7L.js} +286 -305
  35. package/dist/chunks/{chunk-7QFVXP2X.js → chunk-R4PN3OFK.js} +8 -7
  36. package/dist/chunks/{chunk-L7TYG5SN.js → chunk-RVEKGVZU.js} +2 -2
  37. package/dist/chunks/{chunk-2XED2FKY.js → chunk-SQFKBWTR.js} +38 -36
  38. package/dist/chunks/chunk-SU6IJD6D.js +49 -0
  39. package/dist/chunks/{chunk-IBSJJGXL.js → chunk-T7HVQ2WP.js} +2 -2
  40. package/dist/chunks/{chunk-ZWLWXHJC.js → chunk-TBCKK6LH.js} +2 -2
  41. package/dist/chunks/{chunk-JMJBPP4B.js → chunk-UDBQJLQF.js} +2 -2
  42. package/dist/chunks/chunk-UUJK76HV.js +209 -0
  43. package/dist/chunks/{chunk-4I26YMBY.js → chunk-WHI6YAUE.js} +7 -3
  44. package/dist/chunks/{chunk-BWYVS62Z.js → chunk-WJQJ7YEX.js} +4 -4
  45. package/dist/chunks/{chunk-GAMGDNTF.js → chunk-XNN5PZTI.js} +1 -1
  46. package/dist/chunks/chunk-Y3C6MDL7.js +28 -0
  47. package/dist/chunks/chunk-ZM7RN2IM.js +38 -0
  48. package/dist/chunks/cli-DFLV57LO.js +226 -0
  49. package/dist/chunks/commands-J52MJ6NF.js +70 -0
  50. package/dist/chunks/{conflict-VPAR7E6F.js → conflict-72Q6DM4I.js} +2 -2
  51. package/dist/chunks/{contract-DDXAO2DZ.js → contract-IRNRQ5FY.js} +12446 -5964
  52. package/dist/chunks/{cowork-34QCHMDD.js → cowork-GZDODGKF.js} +11 -8
  53. package/dist/chunks/{create-flow-52PU2OBI.js → create-flow-UGTDI7SP.js} +6 -6
  54. package/dist/chunks/{data-CLQ62QGD.js → data-HTQZRPPI.js} +6 -3
  55. package/dist/chunks/{ebuilder-form-W5R7Q22S.js → ebuilder-form-GHNIZ7ET.js} +9 -6
  56. package/dist/chunks/{ehr-LCNAVMK5.js → ehr-PHIBBUIG.js} +23 -16
  57. package/dist/chunks/{entry-mode-6Z3ZV3DE.js → entry-mode-5WOXFE67.js} +3 -3
  58. package/dist/chunks/{env-RDKWAARB.js → env-H4ALHESA.js} +2 -2
  59. package/dist/chunks/{esb-ANKPUU65.js → esb-ATRKVHCD.js} +10 -7
  60. package/dist/chunks/{factory-434B7RAT.js → factory-COX6AVK7.js} +1 -1
  61. package/dist/chunks/{fna-AKBSG5HI.js → fna-IKYI3SST.js} +13 -8
  62. package/dist/chunks/{group-chat-PROTW22R.js → group-chat-ZIWQQO4G.js} +3 -3
  63. package/dist/chunks/{host-5R2SNFWD.js → host-6UOXYOOY.js} +6 -3
  64. package/dist/chunks/{host-7FJW4E7R.js → host-EJSJSLVK.js} +6 -3
  65. package/dist/chunks/{host-WO4L5G5I.js → host-EYNLB6S4.js} +6 -3
  66. package/dist/chunks/{host-PDJAKCT7.js → host-OT4KNR3G.js} +6 -3
  67. package/dist/chunks/{host-CGXUFQO4.js → host-UY4LQPN4.js} +6 -3
  68. package/dist/chunks/{host-XIYG4F4B.js → host-XXGDQM7D.js} +6 -3
  69. package/dist/chunks/{hrm-WGODDTEH.js → hrm-5JQ7QZ6A.js} +8 -5
  70. package/dist/chunks/{im-YKTKAJU3.js → im-2YJW3EI5.js} +7 -4
  71. package/dist/chunks/{invoice-PVYCCCVM.js → invoice-37HR6L3W.js} +956 -566
  72. package/dist/chunks/{jiuchuanhui-RKOQW7BY.js → jiuchuanhui-KBWUZ7WT.js} +17 -10
  73. package/dist/chunks/{lazy-dispatch-DW45AFQ5.js → lazy-dispatch-MZ3EZYDL.js} +22 -8
  74. package/dist/chunks/{mail-BNB5S4NW.js → mail-YBKUM6HM.js} +11 -8
  75. package/dist/chunks/{meeting-O2KDJH66.js → meeting-XE6CTXYA.js} +22 -18
  76. package/dist/chunks/{minute-doc-JUCG56GY.js → minute-doc-4BA2R5EA.js} +4 -4
  77. package/dist/chunks/{okr-LWFGWOE7.js → okr-HW7IULIR.js} +10 -7
  78. package/dist/chunks/{operations-532PN5OB.js → operations-4P2UYVLH.js} +7 -4
  79. package/dist/chunks/{performance-7W5COCFU.js → performance-PM2G6L3E.js} +6 -3
  80. package/dist/chunks/{plan-ZVY3IYTL.js → plan-3YYGZ7ZM.js} +10 -7
  81. package/dist/chunks/{project-SA62B7MH.js → project-XREEXFU2.js} +10 -7
  82. package/dist/chunks/{reception-NGIONPQ3.js → reception-7G3J2MA6.js} +8 -4
  83. package/dist/chunks/{recruit-stage-WOSN6MGP.js → recruit-stage-TSQWOGQD.js} +199 -74
  84. package/dist/chunks/register-SQOPIR2G.js +16 -0
  85. package/dist/chunks/{registry-N7P3W2RD.js → registry-3VTB3KLV.js} +7 -4
  86. package/dist/chunks/registry-7UDUWYB5.js +30 -0
  87. package/dist/chunks/{registry-R72GWXOG.js → registry-F4YFZLOD.js} +7 -3
  88. package/dist/chunks/{room-recommend-KCGIVUFR.js → room-recommend-FO3HLPNB.js} +4 -4
  89. package/dist/chunks/root-YZG2TS5W.js +16 -0
  90. package/dist/chunks/{schedule-6UP27HQ4.js → schedule-DHNNOHVS.js} +4 -4
  91. package/dist/chunks/{smart-extract-DDOQSPRB.js → smart-extract-T5Z4AULN.js} +15 -7
  92. package/dist/chunks/update-AV5VOXGY.js +13 -0
  93. package/dist/chunks/{workflow-V5ALD6QZ.js → workflow-MAGCHWYZ.js} +15 -10
  94. package/dist/cli.js +40 -0
  95. package/dist/cmd/action.js +3 -1
  96. package/dist/cmd/doctor/index.js +1 -1
  97. package/dist/cmd/e10/index.js +1 -1
  98. package/dist/cmd/identity/index.js +5 -8
  99. package/dist/cmd/index.js +2 -0
  100. package/dist/cmd/setup/index.js +1 -1
  101. package/dist/cmd/update/index.js +38 -0
  102. package/dist/core/manifest-view.js +1 -1
  103. package/dist/core/output.js +8 -1
  104. package/dist/core/runtime-agent.js +13 -0
  105. package/dist/core/update-notice.js +23 -0
  106. package/dist/index.js +105 -198
  107. package/dist/internal/e10/auth/agent-host-key.js +16 -0
  108. package/dist/internal/e10/auth/agent-hosts.js +45 -9
  109. package/dist/internal/e10/auth/commands.js +66 -36
  110. package/dist/internal/e10/auth/session.js +30 -15
  111. package/dist/internal/e10/auth/xiaoe.js +4 -20
  112. package/dist/internal/e10/auth-recovery.js +44 -4
  113. package/dist/internal/e10/context.js +5 -2
  114. package/dist/internal/update/bootstrap.js +96 -0
  115. package/dist/internal/update/npm.js +78 -0
  116. package/dist/internal/update/service.js +252 -0
  117. package/dist/internal/update/store.js +135 -0
  118. package/dist/shortcuts/archive/index.js +2 -2
  119. package/dist/shortcuts/archive/manifest.js +1 -0
  120. package/dist/shortcuts/archive/operations/search.js +3 -1
  121. package/dist/shortcuts/archive-oa/index.js +1 -1
  122. package/dist/shortcuts/asset/index.js +1 -1
  123. package/dist/shortcuts/asset-idle/index.js +1 -1
  124. package/dist/shortcuts/blog/index.js +1 -1
  125. package/dist/shortcuts/caizhilian/index.js +1 -1
  126. package/dist/shortcuts/calendar/index.js +1 -1
  127. package/dist/shortcuts/contract/data/bi-config.js +156 -0
  128. package/dist/shortcuts/contract/data/collection-ledger-html.js +189 -0
  129. package/dist/shortcuts/contract/data/collection-node-catalog.js +226 -0
  130. package/dist/shortcuts/contract/data/metric-catalog.js +154 -20
  131. package/dist/shortcuts/contract/data/report-renderers.js +414 -0
  132. package/dist/shortcuts/contract/data/report-spec.js +132 -0
  133. package/dist/shortcuts/contract/error-actions.js +114 -0
  134. package/dist/shortcuts/contract/host.js +12 -3
  135. package/dist/shortcuts/contract/index.js +17 -1
  136. package/dist/shortcuts/contract/manifest.js +398 -3
  137. package/dist/shortcuts/contract/ooxml/docx-table.js +48 -0
  138. package/dist/shortcuts/contract/operations/bi-preview.js +131 -0
  139. package/dist/shortcuts/contract/operations/bizreview-report.js +496 -0
  140. package/dist/shortcuts/contract/operations/collection-node.js +229 -0
  141. package/dist/shortcuts/contract/operations/docx-slots.js +735 -16
  142. package/dist/shortcuts/contract/operations/draft-build.js +940 -0
  143. package/dist/shortcuts/contract/operations/draft-submit.js +229 -0
  144. package/dist/shortcuts/contract/operations/first-screen.js +3 -2
  145. package/dist/shortcuts/contract/operations/generated-submit.js +175 -0
  146. package/dist/shortcuts/contract/operations/ledger-report.js +233 -0
  147. package/dist/shortcuts/contract/operations/ledger-stat.js +1400 -0
  148. package/dist/shortcuts/contract/operations/ledger.js +4 -1
  149. package/dist/shortcuts/contract/operations/metrics.js +9 -3
  150. package/dist/shortcuts/contract/operations/ops-draft.js +527 -0
  151. package/dist/shortcuts/contract/operations/page.js +9 -0
  152. package/dist/shortcuts/contract/operations/quote-submit.js +55 -229
  153. package/dist/shortcuts/contract/operations/registry.js +20 -0
  154. package/dist/shortcuts/contract/operations/sign-launch.js +256 -0
  155. package/dist/shortcuts/contract/operations/viewlink.js +334 -0
  156. package/dist/shortcuts/cowork/index.js +2 -2
  157. package/dist/shortcuts/ebuilder-form/index.js +1 -1
  158. package/dist/shortcuts/ehr/index.js +2 -2
  159. package/dist/shortcuts/ehr/manifest.js +1 -1
  160. package/dist/shortcuts/ehr/operations/recruit-position.js +7 -2
  161. package/dist/shortcuts/ehr/operations/recruit-write.js +7 -6
  162. package/dist/shortcuts/ehr/operations/recruit.js +318 -248
  163. package/dist/shortcuts/ehr/operations/shared.js +22 -2
  164. package/dist/shortcuts/esb/index.js +1 -1
  165. package/dist/shortcuts/fna/index.js +1 -1
  166. package/dist/shortcuts/fna/manifest.js +1 -0
  167. package/dist/shortcuts/fna/operations/expense-chart.js +3 -1
  168. package/dist/shortcuts/hrm/index.js +1 -1
  169. package/dist/shortcuts/invoice/business-response.js +13 -0
  170. package/dist/shortcuts/invoice/calendar.js +24 -0
  171. package/dist/shortcuts/invoice/host.js +26 -15
  172. package/dist/shortcuts/invoice/index.js +3 -3
  173. package/dist/shortcuts/invoice/invoice-record.js +7 -2
  174. package/dist/shortcuts/invoice/manifest.js +179 -155
  175. package/dist/shortcuts/invoice/operations/get.js +9 -3
  176. package/dist/shortcuts/invoice/operations/issuing-red-requests.js +138 -0
  177. package/dist/shortcuts/invoice/operations/registry.js +4 -5
  178. package/dist/shortcuts/invoice/operations/reim-auto.js +40 -2
  179. package/dist/shortcuts/invoice/operations/reim-customer-projects.js +79 -0
  180. package/dist/shortcuts/invoice/operations/reim-customer.js +79 -30
  181. package/dist/shortcuts/invoice/operations/reim-relation.js +0 -146
  182. package/dist/shortcuts/invoice/operations/reim.js +2 -126
  183. package/dist/shortcuts/invoice/operations/shared.js +15 -17
  184. package/dist/shortcuts/invoice/preapproval-enrichment.js +180 -0
  185. package/dist/shortcuts/invoice/projection.js +14 -0
  186. package/dist/shortcuts/invoice/read-enrichment.js +123 -0
  187. package/dist/shortcuts/jiuchuanhui/index.js +2 -2
  188. package/dist/shortcuts/jiuchuanhui/manifest.js +3 -0
  189. package/dist/shortcuts/mail/index.js +2 -2
  190. package/dist/shortcuts/meeting/index.js +1 -1
  191. package/dist/shortcuts/meeting/manifest.js +1 -0
  192. package/dist/shortcuts/meeting/operations/eb/catalog.js +5 -3
  193. package/dist/shortcuts/meeting/operations/eb/conflict.js +3 -1
  194. package/dist/shortcuts/meeting/operations/eb/create-flow.js +10 -9
  195. package/dist/shortcuts/meeting/operations/eb/factory.js +2 -0
  196. package/dist/shortcuts/meeting/operations/eb/member-expand.js +3 -2
  197. package/dist/shortcuts/meeting/operations/invitation-publish.js +3 -3
  198. package/dist/shortcuts/meeting/operations/invitation.js +4 -4
  199. package/dist/shortcuts/meeting/operations/link.js +3 -1
  200. package/dist/shortcuts/okr/index.js +1 -1
  201. package/dist/shortcuts/performance/index.js +1 -1
  202. package/dist/shortcuts/plan/index.js +1 -1
  203. package/dist/shortcuts/project/index.js +1 -1
  204. package/dist/shortcuts/reception/manifest.js +2 -2
  205. package/dist/shortcuts/recruit-stage/context.js +10 -2
  206. package/dist/shortcuts/recruit-stage/index.js +16 -3
  207. package/dist/shortcuts/recruit-stage/operations/interview-arrange.js +1 -1
  208. package/dist/shortcuts/recruit-stage/operations/interview-feedback.js +1 -1
  209. package/dist/shortcuts/recruit-stage/operations/jd-create.js +17 -8
  210. package/dist/shortcuts/recruit-stage/operations/list.js +1 -1
  211. package/dist/shortcuts/recruit-stage/operations/resume-import.js +178 -35
  212. package/dist/shortcuts/recruit-stage/operations/search.js +2 -2
  213. package/dist/shortcuts/recruit-stage/operations/shortlist.js +4 -2
  214. package/dist/shortcuts/recruit-stage/shared.js +27 -53
  215. package/dist/shortcuts/smart-extract/manifest.js +1 -0
  216. package/dist/shortcuts/smart-extract/operations/fill.js +7 -2
  217. package/dist/shortcuts/smart-extract/operations/validate.js +4 -1
  218. package/dist/shortcuts/workflow/index.js +2 -2
  219. package/dist/shortcuts/workflow/manifest.js +1 -0
  220. package/dist/shortcuts/workflow/operations/aiDeepRead/render.js +4 -1
  221. package/dist/shortcuts/workflow/operations/deepRead.js +23 -2
  222. package/dist/shortcuts/workflow/operations/form.js +8 -2
  223. package/docs/agent-invoice.md +28 -2
  224. package/docs/contract.md +6 -1
  225. package/docs/e10-auth.md +25 -7
  226. package/docs/invoice.md +60 -9
  227. package/docs/operation-manual.md +15 -0
  228. package/package.json +2 -2
  229. package/skill-template/business-info.json +28 -0
  230. package/skill-template/domains/jinchengda.md +13 -1
  231. package/skill-template/domains/yepiaotong.md +36 -7
  232. package/skills/weaver-e10-archive-oa/references/source-manifest.json +3 -3
  233. package/skills/weaver-e10-caizhilian/references/auth-and-install.md +2 -1
  234. package/skills/weaver-e10-caizhilian/references/source-manifest.json +3 -3
  235. package/skills/weaver-e10-esb/references/source-manifest.json +3 -3
  236. package/skills/weaver-e10-jinchengda/SKILL.md +90 -32
  237. package/skills/weaver-e10-jinchengda/references/contract-ai-review.md +45 -0
  238. package/skills/weaver-e10-jinchengda/references/contract-bizreview-report-template.html +68 -0
  239. package/skills/weaver-e10-jinchengda/references/contract-bizreview.md +216 -0
  240. package/skills/weaver-e10-jinchengda/references/contract-clause-negotiate.md +215 -0
  241. package/skills/weaver-e10-jinchengda/references/contract-collection-node.md +113 -0
  242. package/skills/weaver-e10-jinchengda/references/contract-command-index.md +19 -3
  243. package/skills/weaver-e10-jinchengda/references/contract-decisions.md +114 -0
  244. package/skills/weaver-e10-jinchengda/references/contract-doc-triage.md +53 -44
  245. package/skills/weaver-e10-jinchengda/references/contract-element-extract.md +1 -1
  246. package/skills/weaver-e10-jinchengda/references/contract-field-extract-other-flows.md +1 -1
  247. package/skills/weaver-e10-jinchengda/references/contract-firstscreen-guide.md +200 -0
  248. package/skills/weaver-e10-jinchengda/references/contract-ledger-catalog.md +18 -1
  249. package/skills/weaver-e10-jinchengda/references/contract-ledger-query-playbook.md +138 -3
  250. package/skills/weaver-e10-jinchengda/references/contract-ledger-report.md +158 -0
  251. package/skills/weaver-e10-jinchengda/references/contract-ledger-rules.md +3 -1
  252. package/skills/weaver-e10-jinchengda/references/contract-material-gap.md +139 -0
  253. package/skills/weaver-e10-jinchengda/references/contract-object-detect.md +2 -2
  254. package/skills/weaver-e10-jinchengda/references/contract-open-web-pages.md +10 -3
  255. package/skills/weaver-e10-jinchengda/references/contract-ops-draft.md +106 -0
  256. package/skills/weaver-e10-jinchengda/references/contract-performance-query.md +1 -1
  257. package/skills/weaver-e10-jinchengda/references/contract-quote-to-contract.md +176 -56
  258. package/skills/weaver-e10-jinchengda/references/contract-sign-launch.md +123 -0
  259. package/skills/weaver-e10-jinchengda/references/contract-smart-draft.md +410 -0
  260. package/skills/weaver-e10-jinchengda/references/contract-template-recommend.md +1 -1
  261. package/skills/weaver-e10-jinchengda/references/contract-viewlink.md +110 -0
  262. package/skills/weaver-e10-jinchengda/references/orchestration.md +38 -24
  263. package/skills/weaver-e10-meeting/SKILL.md +13 -0
  264. package/skills/weaver-e10-okr/SKILL.md +11 -0
  265. package/skills/weaver-e10-okr/references/source-manifest.json +7 -6
  266. package/skills/weaver-e10-performance/SKILL.md +131 -39
  267. package/skills/weaver-e10-performance/agents/openai.yaml +48 -17
  268. package/skills/weaver-e10-performance/references/default-assembly.md +3 -0
  269. package/skills/weaver-e10-performance/references/extraction-guide.md +17 -3
  270. package/skills/weaver-e10-performance/references/flow-assess.md +38 -5
  271. package/skills/weaver-e10-performance/references/scheme-setting-page.md +20 -3
  272. package/skills/weaver-e10-performance/scripts/assemble_scheme.py +461 -0
  273. package/skills/weaver-e10-performance/scripts/parse_appraisal_doc.py +41 -0
  274. package/skills/weaver-e10-plan/SKILL.md +10 -0
  275. package/skills/weaver-e10-plan/references/source-manifest.json +13 -13
  276. package/skills/weaver-e10-qiyecheng/SKILL.md +2 -2
  277. package/skills/weaver-e10-qiyecheng/references/source-manifest.json +9 -9
  278. package/skills/weaver-e10-recruit-stage/SKILL.md +230 -202
  279. package/skills/weaver-e10-recruit-stage/agents/openai.yaml +74 -46
  280. package/skills/weaver-e10-recruit-stage/lib/interview-conflict.mjs +3 -0
  281. package/skills/weaver-e10-recruit-stage/lib/interview-summary.mjs +201 -36
  282. package/skills/weaver-e10-recruit-stage/lib/recruit-shortlist.mjs +336 -27
  283. package/skills/weaver-e10-recruit-stage/lib/recruit-write-helper.mjs +3 -0
  284. package/skills/weaver-e10-recruit-stage/lib/recruit-xiaoe-file.mjs +15 -1
  285. package/skills/weaver-e10-recruit-stage/lib/report-attachment.mjs +38 -0
  286. package/skills/weaver-e10-recruit-stage/lib/xiaoe-session.mjs +5 -1
  287. package/skills/weaver-e10-recruit-stage/references/env-fixed-values.md +4 -0
  288. package/skills/weaver-e10-recruit-stage/references/env-ziyong.md +4 -0
  289. package/skills/weaver-e10-recruit-stage/references/position-templates.md +12 -8
  290. package/skills/weaver-e10-recruit-stage/references/recruit-arrange-interview.md +20 -18
  291. package/skills/weaver-e10-recruit-stage/references/recruit-capability-check.md +11 -7
  292. package/skills/weaver-e10-recruit-stage/references/recruit-check-install.md +5 -1
  293. package/skills/weaver-e10-recruit-stage/references/recruit-detail-process.md +4 -0
  294. package/skills/weaver-e10-recruit-stage/references/recruit-edit-interview-feedback.md +8 -4
  295. package/skills/weaver-e10-recruit-stage/references/recruit-failure-fallback.md +6 -1
  296. package/skills/weaver-e10-recruit-stage/references/recruit-interview-not-attended.md +7 -3
  297. package/skills/weaver-e10-recruit-stage/references/recruit-jd-create.md +32 -25
  298. package/skills/weaver-e10-recruit-stage/references/recruit-jd-template.md +4 -0
  299. package/skills/weaver-e10-recruit-stage/references/recruit-list-candidate.md +4 -0
  300. package/skills/weaver-e10-recruit-stage/references/recruit-list-interview.md +5 -1
  301. package/skills/weaver-e10-recruit-stage/references/recruit-maint.md +4 -0
  302. package/skills/weaver-e10-recruit-stage/references/recruit-match-candidates.md +16 -10
  303. package/skills/weaver-e10-recruit-stage/references/recruit-my-positions.md +6 -2
  304. package/skills/weaver-e10-recruit-stage/references/recruit-output-links.md +148 -40
  305. package/skills/weaver-e10-recruit-stage/references/recruit-platform-compat.md +5 -1
  306. package/skills/weaver-e10-recruit-stage/references/recruit-report-templates.md +32 -8
  307. package/skills/weaver-e10-recruit-stage/references/recruit-resolve-creator.md +4 -0
  308. package/skills/weaver-e10-recruit-stage/references/recruit-resolve-metadata.md +8 -4
  309. package/skills/weaver-e10-recruit-stage/references/recruit-resume-import-batch.md +6 -2
  310. package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +41 -41
  311. package/skills/weaver-e10-recruit-stage/references/recruit-resume-parse.md +7 -3
  312. package/skills/weaver-e10-recruit-stage/references/recruit-search-by-tag.md +7 -3
  313. package/skills/weaver-e10-recruit-stage/references/recruit-search-candidate.md +8 -4
  314. package/skills/weaver-e10-recruit-stage/references/recruit-tag-recommend.md +5 -1
  315. package/skills/weaver-e10-recruit-stage/references/recruit-urge-feedback.md +5 -1
  316. package/skills/weaver-e10-recruit-stage/references/recruit-utterance-glossary.md +5 -1
  317. package/skills/weaver-e10-recruit-stage/templates/candidate-evidence.html +41 -28
  318. package/skills/weaver-e10-recruit-stage/templates/interview-summary.html +23 -26
  319. package/skills/weaver-e10-recruit-stage/templates/match-report.html +44 -36
  320. package/skills/weaver-e10-shared/SKILL.md +40 -5
  321. package/skills/weaver-e10-shared/references/e10-auth-and-session.md +11 -1
  322. package/skills/weaver-e10-shared/references/json-output-contract.md +144 -8
  323. package/skills/weaver-e10-shared/references/weaver-e10-installation.md +11 -0
  324. package/skills/weaver-e10-shijingran/references/source-manifest.json +3 -3
  325. package/skills/weaver-e10-wenshuding/references/source-manifest.json +3 -3
  326. package/skills/weaver-e10-workflow/references/source-manifest.json +3 -3
  327. package/skills/weaver-e10-yepiaotong/SKILL.md +133 -61
  328. package/skills/weaver-e10-yepiaotong/references/invoice-add.md +3 -1
  329. package/skills/weaver-e10-yepiaotong/references/invoice-detail.md +18 -2
  330. package/skills/weaver-e10-yepiaotong/references/invoice-disabled-capabilities.md +3 -3
  331. package/skills/weaver-e10-yepiaotong/references/invoice-download.md +1 -1
  332. package/skills/weaver-e10-yepiaotong/references/invoice-enterprise-list.md +13 -1
  333. package/skills/weaver-e10-yepiaotong/references/invoice-file-upload.md +3 -1
  334. package/skills/weaver-e10-yepiaotong/references/invoice-import.md +6 -4
  335. package/skills/weaver-e10-yepiaotong/references/invoice-issuing-workflow.md +42 -45
  336. package/skills/weaver-e10-yepiaotong/references/invoice-ocr-preview.md +1 -1
  337. package/skills/weaver-e10-yepiaotong/references/invoice-output-view.md +18 -2
  338. package/skills/weaver-e10-yepiaotong/references/invoice-personal-list.md +14 -1
  339. package/skills/weaver-e10-yepiaotong/references/invoice-red-workflow.md +96 -0
  340. package/skills/weaver-e10-yepiaotong/references/invoice-reim-relation.md +56 -369
  341. package/skills/weaver-e10-yepiaotong/references/invoice-upload-and-validate.md +16 -6
  342. package/skills/weaver-e10-yepiaotong/references/name-fuzzy-search.md +38 -0
  343. package/skills/weaver-e10-yepiaotong/references/reim-api-reference.md +163 -646
  344. package/skills/weaver-e10-yepiaotong/references/reim-customer-search.md +90 -44
  345. package/skills/weaver-e10-yepiaotong/references/reim-eligibility-rules.md +85 -0
  346. package/skills/weaver-e10-yepiaotong/references/reim-fill-validation.md +61 -0
  347. package/skills/weaver-e10-yepiaotong/references/reim-phone-subsidy-rules.md +91 -280
  348. package/skills/weaver-e10-yepiaotong/references/reim-preapproval-rules.md +98 -0
  349. package/skills/weaver-e10-yepiaotong/references/reim-travel-invoice-matching.md +48 -0
  350. package/skills/weaver-e10-yepiaotong/references/reim-workflow.md +234 -695
  351. package/skills/weaver-e10-yepiaotong/references/source-manifest.json +395 -204
  352. package/skills/weaver-e10-yepiaotong/references/travel-application-fill.md +84 -0
  353. package/skills/weaver-e10-yepiaotong/references/workflow-direct-fill.md +165 -0
  354. package/skills/weaver-e10-yepiaotong.zip +0 -0
  355. package/dist/chunks/chunk-ICP53R52.js +0 -2849
  356. package/dist/chunks/registry-RIQ67ZT7.js +0 -27
  357. package/scripts/pysite/__pycache__/sitecustomize.cpython-312.pyc +0 -0
  358. package/scripts/pysite/__pycache__/sitecustomize.cpython-313.pyc +0 -0
  359. package/skills/weaver-e10-yepiaotong/references/invoice-reim.md +0 -93
  360. package/skills/weaver-e10-yepiaotong/references/reim-examples.md +0 -774
  361. package/skills/weaver-e10-yepiaotong/references/reim-expense-subject-rules.md +0 -111
  362. package/skills/weaver-e10-yepiaotong/references/reim-form-fill-rules.md +0 -360
  363. package/skills/weaver-e10-yepiaotong/references/reim-matching-rules.md +0 -167
@@ -1,29 +1,34 @@
1
1
  import { createRequire as __esbuildCreateRequire } from 'node:module';
2
2
  const require = __esbuildCreateRequire(import.meta.url);
3
- import {
4
- InvoiceCliError,
5
- Option,
6
- createInvoiceHost,
7
- invoiceConfirmationError,
8
- invoicePartialError,
9
- invoiceValidationError,
10
- isInvoiceNetworkError
11
- } from "./chunk-GWJLAF6B.js";
12
3
  import {
13
4
  MANIFEST_LIST_COMPACT_PATHS,
14
5
  manifestView,
15
6
  schemaOptionsOf
16
- } from "./chunk-WM33BSIL.js";
17
- import {
18
- reportPlatformError
19
- } from "./chunk-MD5CW4B6.js";
7
+ } from "./chunk-2QCCXPNU.js";
20
8
  import {
21
9
  CONTINUATION_TTL_MS,
22
10
  CONTINUATION_TTL_SECONDS
23
11
  } from "./chunk-7BDPM5ST.js";
24
- import "./chunk-IU6UB2TD.js";
12
+ import {
13
+ Option
14
+ } from "./chunk-JWF2R6EQ.js";
15
+ import {
16
+ reportPlatformError
17
+ } from "./chunk-MD5CW4B6.js";
18
+ import {
19
+ InvoiceCliError,
20
+ createInvoiceHost,
21
+ invoiceConfirmationError,
22
+ invoicePartialError,
23
+ invoiceValidationError,
24
+ isInvoiceNetworkError
25
+ } from "./chunk-2UV4IZIT.js";
26
+ import "./chunk-FPWCCRKT.js";
25
27
  import "./chunk-IZCQU5D5.js";
26
- import "./chunk-AMAPQVBT.js";
28
+ import "./chunk-QVKRNL7L.js";
29
+ import "./chunk-Y3C6MDL7.js";
30
+ import "./chunk-7DE3VMZD.js";
31
+ import "./chunk-2BZ7TY4M.js";
27
32
  import {
28
33
  isCliError,
29
34
  toErrorEnvelope
@@ -108,7 +113,9 @@ var EXT_INFO_FIELDS = [
108
113
  "from",
109
114
  "to",
110
115
  "stationGetOn",
111
- "stationGetOff"
116
+ "stationGetOff",
117
+ "userId",
118
+ "passengerName"
112
119
  ];
113
120
  function asRecord(value) {
114
121
  return value && typeof value === "object" && !Array.isArray(value) ? value : {};
@@ -119,16 +126,16 @@ function text(value) {
119
126
  }
120
127
  function firstText(...values) {
121
128
  for (const value of values) {
122
- const candidate = text(value);
123
- if (candidate) return candidate;
129
+ const candidate2 = text(value);
130
+ if (candidate2) return candidate2;
124
131
  }
125
132
  return "";
126
133
  }
127
134
  function invoiceRecordOf(item) {
128
- const record2 = asRecord(item);
129
- const inner = asRecord(record2.info);
130
- const hasOwnInvoiceFields = record2.comm_info !== void 0 || record2.fid !== void 0 || record2.number !== void 0;
131
- return !hasOwnInvoiceFields && Object.keys(inner).length ? inner : record2;
135
+ const record4 = asRecord(item);
136
+ const inner = asRecord(record4.info);
137
+ const hasOwnInvoiceFields = record4.comm_info !== void 0 || record4.fid !== void 0 || record4.number !== void 0;
138
+ return !hasOwnInvoiceFields && Object.keys(inner).length ? inner : record4;
132
139
  }
133
140
  function parseInvoiceExt(value) {
134
141
  if (value && typeof value === "object") return asRecord(value);
@@ -156,7 +163,10 @@ function invoiceExtInfo(invoice) {
156
163
  from: firstText(ext.from, invoice.from, passenger.from),
157
164
  to: firstText(ext.to, invoice.to, passenger.to),
158
165
  stationGetOn: firstText(ext.station_geton, invoice.station_geton, passenger.station_geton),
159
- stationGetOff: firstText(ext.station_getoff, invoice.station_getoff, passenger.station_getoff)
166
+ stationGetOff: firstText(ext.station_getoff, invoice.station_getoff, passenger.station_getoff),
167
+ // ext.userId 是乘车人身份证号,不是票夹用户 / 登录用户的 ID;保留字符串及末尾 X。
168
+ userId: text(ext.userId),
169
+ passengerName: text(ext.passengerName)
160
170
  };
161
171
  for (const [key, value] of Object.entries(info)) {
162
172
  if (!value) delete info[key];
@@ -174,6 +184,8 @@ var SUMMARY_ITEM_FIELDS = [
174
184
  "number",
175
185
  "code",
176
186
  "typeName",
187
+ "fyn",
188
+ "travel_ids",
177
189
  "date",
178
190
  "amount",
179
191
  "total",
@@ -216,6 +228,8 @@ function summarizeInvoiceItem(raw) {
216
228
  number: text2(item.number),
217
229
  code: text2(item.code),
218
230
  typeName: text2(pro.cname),
231
+ fyn: typeof item.fyn === "string" ? item.fyn : null,
232
+ travel_ids: Array.isArray(item.travel_ids) ? item.travel_ids : [],
219
233
  date: text2(pro.date),
220
234
  amount: text2(price.amount),
221
235
  total: text2(price.total),
@@ -233,6 +247,7 @@ function summarizeInvoiceItem(raw) {
233
247
  detailUrl: text2(item.detailUrl)
234
248
  };
235
249
  for (const [key, value] of Object.entries(summary)) {
250
+ if (key === "fyn" || key === "travel_ids") continue;
236
251
  if (value === "" || value === void 0 || value === null) delete summary[key];
237
252
  else if (Array.isArray(value) && value.length === 0) delete summary[key];
238
253
  }
@@ -241,6 +256,8 @@ function summarizeInvoiceItem(raw) {
241
256
  function summarizeListData(data) {
242
257
  const items = Array.isArray(data.items) ? data.items : [];
243
258
  const summary = {};
259
+ if (data.employeeInfo !== void 0) summary.employeeInfo = data.employeeInfo;
260
+ if (data.preApprovals !== void 0) summary.preApprovals = data.preApprovals;
244
261
  for (const key of ["total", "totalAmount", "totalAmountExcludingTax", "hasMore", "scope"]) {
245
262
  if (data[key] !== void 0 && data[key] !== null) summary[key] = data[key];
246
263
  }
@@ -251,11 +268,11 @@ function summarizeListData(data) {
251
268
  var DETAIL_EXTRA_FIELDS = ["issuer", "checkState", "attachments"];
252
269
  var DETAIL_ITEM_FIELDS = [...SUMMARY_ITEM_FIELDS, ...DETAIL_EXTRA_FIELDS];
253
270
  function attachmentOf(entry) {
254
- const record2 = asRecord2(entry);
271
+ const record4 = asRecord2(entry);
255
272
  return {
256
- id: text2(record2.fileId ?? record2.id),
257
- name: text2(record2.name),
258
- type: text2(record2.type)
273
+ id: text2(record4.fileId ?? record4.id),
274
+ name: text2(record4.name),
275
+ type: text2(record4.type)
259
276
  };
260
277
  }
261
278
  function summarizeInvoiceDetailItem(wrapper) {
@@ -277,6 +294,8 @@ function summarizeInvoiceDetailItem(wrapper) {
277
294
  function summarizeDetailData(data) {
278
295
  const infos = Array.isArray(data.infos) ? data.infos : [];
279
296
  const detail = {};
297
+ if (data.employeeInfo !== void 0) detail.employeeInfo = data.employeeInfo;
298
+ if (data.preApprovals !== void 0) detail.preApprovals = data.preApprovals;
280
299
  if (data.scope !== void 0 && data.scope !== null) detail.scope = data.scope;
281
300
  detail.items = infos.map((entry) => summarizeInvoiceDetailItem(asRecord2(entry)));
282
301
  detail.itemCount = detail.items.length;
@@ -427,7 +446,13 @@ function epochEndDateProperty(label) {
427
446
  description: `${label}\u3002\u53EF\u4F20 YYYY-MM-DD\uFF08\u6309\u4E1C\u516B\u533A\u5F53\u5929 23:59:59 \u6362\u7B97\uFF09\u6216\u79D2\u7EA7\u65F6\u95F4\u6233\u3002`
428
447
  };
429
448
  }
449
+ var includePreApprovalsProperty = {
450
+ type: "boolean",
451
+ default: true,
452
+ description: "\u540C\u65F6\u8BFB\u53D6\u6700\u8FD1\u4E00\u4E2A\u65E5\u5386\u6708\u7684\u666E\u901A\u4E8B\u524D\u7533\u8BF7\u5019\u9009\uFF0C\u4F9B AI \u6309\u7528\u9014\u5339\u914D\uFF1B\u8BDD\u8D39 / \u6CB9\u8D39\u4E13\u9879\u53CA\u5DF2\u53D6\u5F97\u5019\u9009\u6C60\u540E\u7684\u8865\u5145\u67E5\u7968\u4F20 false\u3002\u4EC5\u63A7\u5236\u672C\u5730\u805A\u5408\uFF0C\u4E0D\u900F\u4F20\u7ED9\u53D1\u7968\u63A5\u53E3\u3002"
453
+ };
430
454
  var listProperties = {
455
+ includePreApprovals: includePreApprovalsProperty,
431
456
  page_size: { type: "integer", minimum: 1, maximum: 200 },
432
457
  start_pos: { type: "integer", minimum: 0, description: "\u670D\u52A1\u7AEF\u5206\u9875\u504F\u79FB\u3002\u7FFB\u9875\u65F6\u6309 page_size \u9012\u589E\uFF0C\u4E0D\u8981\u6309\u8FD4\u56DE\u7684 items \u6761\u6570\u9012\u589E\uFF08items \u5DF2\u5254\u9664\u5168\u989D\u7EA2\u51B2\u7968\uFF0C\u53EF\u80FD\u4E0D\u6EE1\u4E00\u9875\uFF09\u3002" },
433
458
  req_type: { type: "integer", enum: [0, 1, 7, 8] },
@@ -512,6 +537,30 @@ var invoicePartySchema = objectSchema({
512
537
  company: { type: "string" },
513
538
  tcode: { type: "string" }
514
539
  }, [], true);
540
+ var invoiceTravelIdsSchema = arrayOf(objectSchema({
541
+ deleteType: { type: "integer" },
542
+ fid: { type: "string" },
543
+ fileId: { type: "string" },
544
+ fileName: { type: "string" },
545
+ fileType: { type: "string" },
546
+ name: { type: "string" },
547
+ total: { type: "string" },
548
+ date: { type: "string" },
549
+ type: { type: "integer" }
550
+ }, [], true), { description: "\u672C\u5F20\u53D1\u7968\u5DF2\u5173\u8054\u7684\u51ED\u8BC1\u5217\u8868\uFF0C\u539F\u6837\u4FDD\u7559 fid\u3001\u6587\u4EF6\u3001\u91D1\u989D\u3001\u65E5\u671F\u53CA\u72B6\u6001\uFF1B\u65E0\u5173\u8054\u4E3A []\uFF0C\u4E0D\u9010\u4E2A\u8865\u67E5\u51ED\u8BC1\u8BE6\u60C5\u3002" });
551
+ var extInfoSchema = objectSchema({
552
+ expenseNote: { type: "string", description: "\u8D39\u7528\u8BF4\u660E\uFF08ext.expenseDesc\uFF09\uFF0C\u5982\u300C\u4E0A\u6D77-\u6B66\u6C49\u300D" },
553
+ content: { type: "string", description: "\u6D88\u8D39\u5185\u5BB9\uFF08ext.content\uFF1B\u4E3A\u7A7A\u65F6\u53D6 ext.products[].name\uFF09" },
554
+ city: { type: "string", description: "\u57CE\u5E02\uFF08ext.city\uFF09" },
555
+ province: { type: "string", description: "\u7701\u4EFD\uFF08ext.province\uFF0C\u4E3A\u7A7A\u65F6\u53D6\u7968\u9762 province\uFF09" },
556
+ comment: { type: "string", description: "\u5907\u6CE8\uFF08ext.comment\uFF09\uFF0C\u5E38\u5199\u51FA\u5DEE\u5730\u3001\u8BA2\u5355\u53F7\u548C\u884C\u7A0B" },
557
+ from: { type: "string", description: "\u51FA\u53D1\u5730\uFF08ext.from \u2192 \u7968\u9762 from \u2192 ext.passengersService[0].from\uFF09" },
558
+ to: { type: "string", description: "\u5230\u8FBE\u5730\uFF08ext.to \u2192 \u7968\u9762 to \u2192 ext.passengersService[0].to\uFF09" },
559
+ stationGetOn: { type: "string", description: "\u4E0A\u8F66\u7AD9\uFF08ext.station_geton\uFF09" },
560
+ stationGetOff: { type: "string", description: "\u4E0B\u8F66\u7AD9\uFF08ext.station_getoff\uFF09" },
561
+ userId: { type: "string", description: "\u6EF4\u6EF4\u4E58\u8F66\u4EBA\u8EAB\u4EFD\u8BC1\u53F7\uFF08ext.userId\uFF09\uFF0C\u6309\u5B57\u7B26\u4E32\u4FDD\u7559\uFF1B\u4E0D\u662F\u767B\u5F55\u7528\u6237 ID\u3002" },
562
+ passengerName: { type: "string", description: "\u6EF4\u6EF4\u4E58\u8F66\u4EBA\u59D3\u540D\uFF08ext.passengerName\uFF09\u3002" }
563
+ });
515
564
  var invoiceInfoSchema = objectSchema({
516
565
  id: { type: "string", description: "\u53D1\u7968\u4E1A\u52A1 ID\uFF1B\u5217\u8868\u548C\u8BE6\u60C5\u8FD4\u56DE\u65F6\u4E0E fid \u4FDD\u6301\u4E00\u81F4\u3002" },
517
566
  fid: { type: "string" },
@@ -553,18 +602,53 @@ var invoiceInfoSchema = objectSchema({
553
602
  type: "string",
554
603
  description: "JSON \u5B57\u7B26\u4E32\u5F62\u5F0F\u7684\u7968\u79CD\u6269\u5C55\u4FE1\u606F\uFF1B\u89E3\u6790\u540E\u53EF\u5305\u542B ttax\u3001products \u7B49\u5B57\u6BB5\u3002"
555
604
  },
605
+ extInfo: { ...extInfoSchema, description: "\u5DF2\u89E3\u6790\u7684 ext \u8BED\u4E49\u5B57\u6BB5\uFF0C\u7A7A\u503C\u7701\u952E\uFF1B\u539F\u59CB ext \u5B57\u7B26\u4E32\u4ECD\u4FDD\u7559" },
556
606
  currency: { type: "string" },
557
607
  currencyName: { type: "string" },
558
- fylx: { type: "string" }
608
+ fylx: { type: "string", description: "\u539F\u59CB\u8D39\u7528\u7C7B\u578B ID\uFF0C\u4FDD\u7559\u517C\u5BB9\uFF1B\u8BFB\u53D6\u4E2D\u6587\u540D\u79F0\u4F7F\u7528 fyn\u3002" },
609
+ fyn: { type: ["string", "null"], description: "\u6309 /api/inc/syncFylx \u7684 fyid \u2192 fyn \u6620\u5C04\u5F97\u5230\u7684\u8D39\u7528\u7C7B\u578B\u4E2D\u6587\u540D\u79F0\uFF1B\u65E0\u6CD5\u6620\u5C04\u4E3A null \u5E76\u9644 warnings\uFF0C\u4E0D\u7528\u7968\u9762 kind \u731C\u6D4B\u3002" },
610
+ travel_ids: invoiceTravelIdsSchema
559
611
  }, [], true);
560
612
  var invoiceResultItemSchema = objectSchema({
561
613
  info: invoiceInfoSchema,
562
614
  ret: retSchema
563
615
  }, ["info", "ret"], true);
616
+ var employeeInfoSchema = {
617
+ ...objectSchema({
618
+ department: arrayOf(objectSchema({ id: { type: "string" }, name: { type: "string" } }, ["id", "name"])),
619
+ mobile: { type: ["string", "null"] },
620
+ location: arrayOf(objectSchema({ id: { type: "string" }, name: { type: "string" } }, ["id", "name"]))
621
+ }, ["department", "mobile", "location"]),
622
+ type: ["object", "null"],
623
+ description: "\u5F53\u524D\u767B\u5F55\u4EBA\u5458\u4FE1\u606F\uFF0C\u72EC\u7ACB\u4E8E\u53D1\u7968\u660E\u7EC6\uFF1Bdepartment=\u90E8\u95E8\uFF0Cmobile=\u624B\u673A\u53F7\uFF0Clocation=\u529E\u516C\u6240\u5728\u5730\u3002\u5B9E\u4F53\u4EC5\u4FDD\u7559 id/name\uFF1B\u63A5\u53E3\u4E0D\u53EF\u7528\u65F6\u4E3A null\uFF0C\u5E76\u9644 warnings\u3002\u6BCF\u6279\u53EA\u67E5\u8BE2\u4E00\u6B21\u4EBA\u5458\u5361\u7247\u3002"
624
+ };
625
+ var preApprovalCandidateSchema = objectSchema({
626
+ requestid: { type: "string" },
627
+ workflowid: { type: "string" },
628
+ requestname: { type: "string" },
629
+ flowStatus: { type: ["integer", "string", "null"], description: "\u670D\u52A1\u7AEF\u539F\u59CB\u72B6\u6001\u3002\u5DF2\u660E\u786E\u5BA1\u6279\u4E2D\u6216\u5BA1\u6279\u5B8C\u6210\u7684\u7533\u8BF7\u5747\u6EE1\u8DB3\u5DF2\u63D0\u4EA4\u72B6\u6001\u8981\u6C42\uFF0C\u65E0\u987B\u7B49\u5F85\u5BA1\u6279\u901A\u8FC7\uFF1B6 \u4EC5\u662F\u5DF2\u77E5\u5B8C\u6210\u4EE3\u7801\uFF0C\u4E0D\u662F\u552F\u4E00\u6709\u6548\u72B6\u6001\u3002\u8349\u7A3F/\u672A\u63D0\u4EA4\u4E0D\u53EF\u7528\uFF1B\u542B\u4E49\u4E0D\u660E\u6216\u7F3A\u5931\u7684\u72B6\u6001\u6309\u771F\u5B9E\u7533\u8BF7 ID \u5B9A\u5411\u6838\u9A8C\uFF0C\u4E0D\u81EA\u884C\u6620\u5C04\uFF0C\u4E5F\u4E0D\u76F4\u63A5\u5F53\u4F5C\u65E0\u6548\u7533\u8BF7\u3002\u72B6\u6001\u4ECD\u4E0D\u80FD\u66FF\u4EE3\u672C\u4EBA\u5F52\u5C5E\u3001\u6D41\u7A0B\u7C7B\u578B\u53CA\u7528\u9014\u6821\u9A8C\u3002" },
630
+ creatorId: { type: ["string", "integer", "null"] },
631
+ creatorName: { type: ["string", "null"] },
632
+ createTime: { type: ["string", "integer", "null"] }
633
+ }, ["requestid", "workflowid", "requestname"]);
634
+ var preApprovalsSchema = objectSchema({
635
+ status: { type: "string", enum: ["complete", "partial", "unavailable", "skipped"], description: "\u4EC5\u8868\u793A\u5019\u9009\u8BFB\u53D6\u5B8C\u6574\u6027\uFF0C\u4E0D\u8868\u793A\u7533\u8BF7\u5DF2\u901A\u8FC7\u4E1A\u52A1\u6821\u9A8C\u3002" },
636
+ items: { anyOf: [arrayOf(preApprovalCandidateSchema), { type: "null" }] },
637
+ query: objectSchema({
638
+ cusCreateDateStart: { type: "string" },
639
+ cusCreateDateEnd: { type: "string", description: "\u5317\u4EAC\u65F6\u95F4\u4E1A\u52A1\u7ED3\u675F\u65E5\uFF0C\u5BF9\u5916\u4E0D\u52A0\u4E00\u5929\u3002" },
640
+ workflowIds: arrayOf({ type: "string", enum: ["100003460000000746", "100003460000000046", "100003460000000418", "100003460000000045"] }),
641
+ currentUserId: { type: "string", description: "\u4EC5\u771F\u5B9E\u4F1A\u8BDD\u63D0\u4F9B\u4EBA\u5458 ID \u65F6\u8FD4\u56DE\uFF0C\u7528\u4E8E\u4E0E\u7533\u8BF7 creatorId \u6838\u9A8C\u5F52\u5C5E\uFF1B\u4E0D\u4F20\u7ED9\u7533\u8BF7\u63A5\u53E3\u3002" }
642
+ }, ["cusCreateDateStart", "cusCreateDateEnd", "workflowIds"]),
643
+ hasMore: { type: ["boolean", "null"] },
644
+ reason: { type: "string" }
645
+ }, ["status", "items", "hasMore"]);
564
646
  var invoiceDetailOutputSchema = objectSchema({
647
+ employeeInfo: employeeInfoSchema,
648
+ preApprovals: preApprovalsSchema,
565
649
  infos: arrayOf(invoiceResultItemSchema),
566
650
  res_base: responseBaseSchema
567
- }, ["infos", "res_base"], true);
651
+ }, ["employeeInfo", "preApprovals", "infos", "res_base"], true);
568
652
  var invoicePreviewSchema = objectSchema({
569
653
  fid: { type: "string" },
570
654
  code: { type: "string" },
@@ -605,40 +689,24 @@ var resultEnvelopeOutput = (dataSchema = rawValue) => objectSchema({
605
689
  data: dataSchema,
606
690
  workflow: workflowSchema
607
691
  }, ["result", "data", "workflow"]);
608
- var extInfoSchema = objectSchema({
609
- expenseNote: { type: "string", description: "\u8D39\u7528\u8BF4\u660E\uFF08ext.expenseDesc\uFF09\uFF0C\u5982\u300C\u4E0A\u6D77-\u6B66\u6C49\u300D" },
610
- content: { type: "string", description: "\u6D88\u8D39\u5185\u5BB9\uFF08ext.content\uFF1B\u4E3A\u7A7A\u65F6\u53D6 ext.products[].name\uFF09" },
611
- city: { type: "string", description: "\u57CE\u5E02\uFF08ext.city\uFF09" },
612
- province: { type: "string", description: "\u7701\u4EFD\uFF08ext.province\uFF0C\u4E3A\u7A7A\u65F6\u53D6\u7968\u9762 province\uFF09" },
613
- comment: { type: "string", description: "\u5907\u6CE8\uFF08ext.comment\uFF09\uFF0C\u5E38\u5199\u51FA\u5DEE\u5730\u3001\u8BA2\u5355\u53F7\u548C\u884C\u7A0B" },
614
- from: { type: "string", description: "\u51FA\u53D1\u5730\uFF08ext.from \u2192 \u7968\u9762 from \u2192 ext.passengersService[0].from\uFF09" },
615
- to: { type: "string", description: "\u5230\u8FBE\u5730\uFF08ext.to \u2192 \u7968\u9762 to \u2192 ext.passengersService[0].to\uFF09" },
616
- stationGetOn: { type: "string", description: "\u4E0A\u8F66\u7AD9\uFF08ext.station_geton\uFF09" },
617
- stationGetOff: { type: "string", description: "\u4E0B\u8F66\u7AD9\uFF08ext.station_getoff\uFF09" }
618
- });
619
- var listInvoiceItemSchema = {
620
- ...invoiceInfoSchema,
621
- properties: {
622
- ...invoiceInfoSchema.properties,
623
- extInfo: { ...extInfoSchema, description: "\u5DF2\u89E3\u6790\u7684 ext \u8BED\u4E49\u5B57\u6BB5\uFF0C\u7A7A\u503C\u7701\u952E\uFF1B\u539F\u59CB ext \u5B57\u7B26\u4E32\u4ECD\u4FDD\u7559" }
624
- }
625
- };
626
692
  var listOutputSchema = objectSchema({
627
- items: arrayOf(listInvoiceItemSchema, { description: "\u672C\u9875\u53D1\u7968\uFF0C\u5DF2\u5254\u9664\u5168\u989D\u7EA2\u51B2\u7968\uFF08comm_info.pro.status=8\uFF09\uFF0C\u6761\u6570\u53EF\u80FD\u5C11\u4E8E page_size\u3002" }),
693
+ employeeInfo: employeeInfoSchema,
694
+ preApprovals: preApprovalsSchema,
695
+ items: arrayOf(invoiceInfoSchema, { description: "\u672C\u9875\u53D1\u7968\uFF0C\u5DF2\u5254\u9664\u5168\u989D\u7EA2\u51B2\u7968\uFF08comm_info.pro.status=8\uFF09\uFF0C\u6761\u6570\u53EF\u80FD\u5C11\u4E8E page_size\u3002" }),
628
696
  total: { type: "integer", description: "\u670D\u52A1\u7AEF\u6C47\u603B\u7684\u603B\u5F20\u6570\uFF0C\u542B items \u91CC\u5DF2\u5254\u9664\u7684\u5168\u989D\u7EA2\u51B2\u7968\u3002" },
629
697
  totalAmount: { type: "string", description: "\u670D\u52A1\u7AEF\u6C47\u603B\u7684\u4EF7\u7A0E\u5408\u8BA1\uFF0C\u542B\u5DF2\u5254\u9664\u7684\u5168\u989D\u7EA2\u51B2\u7968\u3002" },
630
698
  totalAmountExcludingTax: { type: "string", description: "\u670D\u52A1\u7AEF\u6C47\u603B\u7684\u4E0D\u542B\u7A0E\u5408\u8BA1\uFF0C\u542B\u5DF2\u5254\u9664\u7684\u5168\u989D\u7EA2\u51B2\u7968\u3002" },
631
699
  hasMore: { type: "boolean", description: "\u662F\u5426\u8FD8\u6709\u4E0B\u4E00\u9875\u3002\u5224\u65AD\u662F\u5426\u7FFB\u9875\u53EA\u770B\u5B83\uFF0C\u4E0D\u8981\u7528 items \u6761\u6570\u662F\u5426\u7B49\u4E8E page_size \u63A8\u65AD\u3002" },
632
700
  scope: { type: "string", enum: ["personal", "enterprise"] }
633
- }, ["items", "total", "totalAmount", "totalAmountExcludingTax", "hasMore", "scope"]);
701
+ }, ["employeeInfo", "preApprovals", "items", "total", "totalAmount", "totalAmountExcludingTax", "hasMore", "scope"]);
634
702
  var summaryOutputView = {
635
703
  name: "summary",
636
- description: "\u8BED\u4E49\u5316\u5E73\u8868\uFF0C\u7701\u7565\u7A7A\u503C\u5B57\u6BB5\uFF1B\u5217\u8868\u7EA7\u6C47\u603B\u5728\u524D\u3001items \u5728\u540E\uFF0C\u5E76\u9644 itemCount\u3002\u542B ext \u91CC\u7684 expenseNote\uFF08\u8D39\u7528\u8BF4\u660E\uFF09\u3001content\u3001city\u3001province\u3001comment\uFF08\u5907\u6CE8\uFF09\u3001from / to\u3001stationGetOn / stationGetOff\u3002\u7528 CLI \u7684 --view summary \u542F\u7528\u3002",
704
+ description: "\u8BED\u4E49\u5316\u5E73\u8868\uFF0C\u7701\u7565\u5E38\u89C4\u7A7A\u503C\u5B57\u6BB5\uFF1B\u5217\u8868\u7EA7\u6C47\u603B\u5728\u524D\u3001items \u5728\u540E\uFF0C\u5E76\u9644 itemCount\u3002\u542B fyn\uFF08\u8D39\u7528\u7C7B\u578B\u4E2D\u6587\u540D\uFF09\u3001travel_ids\uFF08\u76F8\u5173\u51ED\u8BC1\uFF0C\u65E0\u5173\u8054\u4E3A []\uFF09\u53CA ext \u7684\u8D39\u7528\u8BF4\u660E\u3001\u57CE\u5E02\u3001\u5907\u6CE8\u3001\u8D77\u6B62\u5730\u3001\u4E58\u8F66\u4EBA userId / passengerName \u7B49\u3002\u8D39\u7528\u7C7B\u578B\u65E0\u6CD5\u6620\u5C04\u65F6\u4FDD\u7559 fyn:null\uFF0C\u8BF4\u660E\u89C1 warnings\u3002\u9876\u5C42\u4FDD\u7559 employeeInfo \u5F53\u524D\u4EBA\u5458\u4FE1\u606F\u53CA preApprovals \u666E\u901A\u4E8B\u524D\u7533\u8BF7\u5019\u9009\uFF0C\u4E0D\u653E\u5165\u660E\u7EC6\u3002\u7528 CLI \u7684 --view summary \u542F\u7528\u3002",
637
705
  itemFields: SUMMARY_ITEM_FIELDS
638
706
  };
639
707
  var detailOutputView = {
640
708
  name: "detail",
641
- description: "\u5355\u5F20\u53D1\u7968\u7684\u8BED\u4E49\u8BE6\u60C5\uFF1Asummary \u5B57\u6BB5\uFF08\u542B ext \u7684\u8D39\u7528\u8BF4\u660E\u3001\u57CE\u5E02\u3001\u5907\u6CE8\u3001\u8D77\u6B62\u5730\u7B49\uFF09\uFF0C\u5916\u52A0 attachments\uFF08\u9644\u4EF6\u6E05\u5355\uFF09\u3001issuer\uFF08\u5F00\u7968\u4EBA\uFF09\u3001checkState\uFF08\u67E5\u9A8C\u6807\u8BB0\uFF0C0=\u672A\u67E5\u9A8C\uFF0C\u4E0E\u7968\u9762 valid \u4E0D\u662F\u4E00\u4E2A\u53E3\u5F84\uFF09\u3002\u7528 CLI \u7684 --view detail \u542F\u7528\u3002",
709
+ description: "\u5355\u5F20\u53D1\u7968\u7684\u8BED\u4E49\u8BE6\u60C5\uFF1Asummary \u5B57\u6BB5\uFF08\u542B fyn \u4E2D\u6587\u8D39\u7528\u7C7B\u578B\u3001travel_ids \u76F8\u5173\u51ED\u8BC1\u3001ext \u8D39\u7528\u8BF4\u660E\u3001\u884C\u7A0B\u53CA\u4E58\u8F66\u4EBA userId / passengerName\uFF09\uFF0C\u5916\u52A0 attachments\uFF08\u53D1\u7968\u81EA\u8EAB\u9644\u4EF6\uFF09\u3001issuer\uFF08\u5F00\u7968\u4EBA\uFF09\u3001checkState\uFF08\u67E5\u9A8C\u6807\u8BB0\uFF0C0=\u672A\u67E5\u9A8C\uFF0C\u4E0E\u7968\u9762 valid \u4E0D\u662F\u4E00\u4E2A\u53E3\u5F84\uFF09\u3002\u9876\u5C42\u4FDD\u7559 employeeInfo \u5F53\u524D\u4EBA\u5458\u4FE1\u606F\u53CA preApprovals \u666E\u901A\u4E8B\u524D\u7533\u8BF7\u5019\u9009\u3002\u7528 CLI \u7684 --view detail \u542F\u7528\u3002",
642
710
  itemFields: DETAIL_ITEM_FIELDS
643
711
  };
644
712
  var uploadOutputSchema = objectSchema({
@@ -786,20 +854,6 @@ var workflowResolveDataSchema = objectSchema({
786
854
  workFlowName: { type: "string" }
787
855
  }, ["workFlowId", "workFlowName"]))
788
856
  }, [], true);
789
- var employeeSchema = objectSchema({
790
- id: { type: "string" },
791
- name: { type: "string" }
792
- }, ["id", "name"], true);
793
- var employeeSuperiorsDataSchema = objectSchema({
794
- currentEmployee: employeeSchema,
795
- allSuperiors: arrayOf(employeeSchema)
796
- }, ["currentEmployee", "allSuperiors"], true);
797
- var fieldSearchItemSchema = objectSchema({
798
- id: { type: "string" },
799
- name: { type: "string" },
800
- value: { type: "string" }
801
- }, ["id", "name"], true);
802
- var fieldSearchItemsSchema = arrayOf(fieldSearchItemSchema);
803
857
  var reimCandidateItemSchema = objectSchema({
804
858
  fid: { type: "string" },
805
859
  number: { type: "string" },
@@ -808,11 +862,17 @@ var reimCandidateItemSchema = objectSchema({
808
862
  buyer: { type: "string" },
809
863
  payer: { type: "string" },
810
864
  typeName: { type: "string" },
865
+ content: { type: "string", description: "\u6D88\u8D39\u5185\u5BB9\uFF0C\u53D6\u7968\u9762 pro.content\uFF0C\u7F3A\u5931\u65F6\u4ECE ext.content / ext.products \u63D0\u53D6\u3002" },
866
+ extInfo: { ...extInfoSchema, description: "\u5DF2\u89E3\u6790\u7684\u57CE\u5E02\u3001\u8D77\u6B62\u5730\u70B9\u3001\u7AD9\u70B9\u3001\u884C\u7A0B\u8BF4\u660E\u7B49\uFF1B\u4F9B\u51FA\u5DEE\u76EE\u7684\u5730\u53CA\u529E\u516C\u8D77\u70B9\u4EA4\u901A\u5019\u9009\u7B5B\u9009\u590D\u7528\uFF0C\u7A7A\u503C\u7701\u952E\u3002" },
867
+ consumptionTime: { type: ["number", "string"], description: "\u539F\u59CB\u6D88\u8D39\u65F6\u95F4 modify_info.cstm\uFF0C\u79D2\u7EA7\u65F6\u95F4\u6233\uFF1B\u4EC5\u771F\u5B9E\u503C\u5B58\u5728\u65F6\u8FD4\u56DE\uFF0C\u4E0D\u4EE5\u5F00\u7968\u65E5\u4EE3\u66FF\u3002" },
868
+ travel_ids: invoiceTravelIdsSchema,
811
869
  status: { type: "integer" },
812
870
  valid: { type: "integer" },
813
871
  reimRequests: arrayOf({ type: "string" })
814
872
  }, ["fid", "number", "total"], true);
815
873
  var reimCandidatesOutputSchema = objectSchema({
874
+ employeeInfo: employeeInfoSchema,
875
+ preApprovals: preApprovalsSchema,
816
876
  total: { type: "integer" },
817
877
  fetched: { type: "integer" },
818
878
  hasMore: { type: "boolean" },
@@ -826,7 +886,7 @@ var reimCandidatesOutputSchema = objectSchema({
826
886
  }, ["availableCount", "assignedCount", "availableAmount", "assignedAmount"]),
827
887
  warnings: arrayOf({ type: "string" }),
828
888
  workflow: workflowSchema
829
- }, ["total", "fetched", "hasMore", "available", "assigned", "summary", "warnings", "workflow"]);
889
+ }, ["employeeInfo", "preApprovals", "total", "fetched", "hasMore", "available", "assigned", "summary", "warnings", "workflow"]);
830
890
  var nullableText = { type: ["string", "null"] };
831
891
  var relationIdNameSchema = {
832
892
  type: ["object", "null"],
@@ -835,7 +895,7 @@ var relationIdNameSchema = {
835
895
  properties: {
836
896
  id: { type: "string" },
837
897
  name: { type: "string" },
838
- value: { type: "string", description: "\u540D\u79F0(ID)\uFF0C\u5199\u62A5\u9500\u5355\u6D4F\u89C8\u6309\u94AE\u65F6\u539F\u6837\u4F7F\u7528" }
898
+ value: { type: "string", description: "\u540D\u79F0(ID) \u5F62\u5F0F\u7684\u767B\u8BB0\u5C55\u793A\u503C\u3002AI \u62A5\u9500\u9875\u9762\u6D4F\u89C8\u5B57\u6BB5\u53EA\u53D6\u540C\u5BF9\u8C61\u7684\u771F\u5B9E id\uFF0C\u7F16\u7801\u4E3A ##ID\uFF1B\u4E0D\u539F\u6837\u586B\u5199 value\uFF0C\u4E0D\u62FC\u63A5\u540D\u79F0\u3002\u67E5\u8BE2\u8FD4\u56DE\u503C\u672C\u8EAB\u4FDD\u6301\u4E0D\u53D8\u3002" }
839
899
  }
840
900
  };
841
901
  var relationPreApprovalSchema = {
@@ -845,7 +905,7 @@ var relationPreApprovalSchema = {
845
905
  properties: {
846
906
  requestId: { type: "string", description: "\u4E8B\u524D\u7533\u8BF7\u6D41\u7A0B requestid" },
847
907
  requestName: { type: "string", description: "\u4E8B\u524D\u7533\u8BF7\u6D41\u7A0B\u6807\u9898\uFF08\u5DF2\u53BB\u6389\u6D4F\u89C8\u6309\u94AE\u672B\u5C3E\u7684\u300C (\u76F8\u5173\u5BA2\u6237:\u2026)\u300D\u6458\u8981\uFF09" },
848
- value: { type: "string", description: "{requestName}({requestId})\uFF0C\u5199\u660E\u7EC6\u300C\u76F8\u5173\u6D41\u7A0B\u300D\u65F6\u539F\u6837\u4F7F\u7528" },
908
+ value: { type: "string", description: "{requestName}({requestId}) \u5F62\u5F0F\u7684\u7533\u8BF7\u5C55\u793A\u503C\u3002AI \u62A5\u9500\u660E\u7EC6\u300C\u76F8\u5173\u6D41\u7A0B\u300D\u4EC5\u4EE5\u771F\u5B9E requestId \u7F16\u7801\u4E3A ##requestId\uFF0C\u6309\u5DF2\u6838\u9A8C\u7533\u8BF7\u9010\u53D1\u7968\u884C\u91CD\u590D\uFF1B\u4E0D\u76F4\u63A5\u586B\u5199 value \u6216\u9644\u5E26\u6807\u9898\u3002" },
849
909
  displayName: { type: "string", description: "\u6D4F\u89C8\u6309\u94AE\u539F\u59CB\u5C55\u793A\u540D" },
850
910
  createTime: nullableText
851
911
  }
@@ -854,21 +914,6 @@ var relationGroupsSchema = arrayOf(objectSchema({
854
914
  value: { type: "string" },
855
915
  fids: arrayOf({ type: "string" })
856
916
  }, ["value", "fids"]));
857
- var relationSearchItemSchema = objectSchema({
858
- id: { type: "string", description: "\u76F8\u5173\u5BA2\u6237 / \u76F8\u5173\u9879\u76EE ID\uFF0C\u767B\u8BB0\u65F6\u4F20 customerId / projectId" },
859
- name: { type: "string", description: "\u76F8\u5173\u5BA2\u6237 / \u76F8\u5173\u9879\u76EE\u540D\u79F0\uFF0C\u767B\u8BB0\u65F6\u4F20 customerName / projectName" }
860
- }, ["id", "name"]);
861
- var relationSearchOutputSchema = objectSchema({
862
- target: { type: "string", enum: ["customer", "project"] },
863
- keywords: { type: "string" },
864
- match: { type: "string", enum: ["unique", "multiple", "none"] },
865
- items: arrayOf(relationSearchItemSchema),
866
- selected: {
867
- anyOf: [relationSearchItemSchema, { type: "null" }],
868
- description: "\u53EA\u641C\u5230\u4E00\u6761\uFF0C\u6216\u6709\u4E00\u6761\u540D\u79F0\u4E0E keywords \u5B8C\u5168\u4E00\u81F4\u65F6\u7ED9\u51FA\uFF1B\u5426\u5219\u4E3A null\uFF0C\u8BA9\u7528\u6237\u4ECE items \u91CC\u9009"
869
- },
870
- workflow: workflowSchema
871
- }, ["target", "keywords", "match", "items", "selected", "workflow"]);
872
917
  var relationSaveOutputSchema = objectSchema({
873
918
  saved: { type: "boolean", description: "\u5168\u90E8\u53D1\u7968\u90FD\u8FD4\u56DE\u300C\u5173\u8054\u6210\u529F\u300D\u65F6\u4E3A true" },
874
919
  savedCount: { type: "integer" },
@@ -951,10 +996,32 @@ var issuingContractDetailOutputSchema = objectSchema({
951
996
  }, ["docId", "fileId", "name"])),
952
997
  contractDocIds: { ...nullableText, description: "\u5168\u90E8\u6587\u6863 id\uFF0C\u82F1\u6587\u9017\u53F7\u5206\u9694\u3002\u5F00\u7968\u7533\u8BF7\u300C\u5408\u540C\u6587\u672C\u300D\u4E0D\u8981\u586B\u8FD9\u4E2A\u5B57\u7B26\u4E32" }
953
998
  }, ["requestId", "requestName", "workflowName", "customer", "customerSource", "contractDocuments", "contractDocIds"]);
999
+ var issuingRedRequestsOutputSchema = objectSchema({
1000
+ items: arrayOf(objectSchema({
1001
+ requestId: { type: "string", description: "\u84DD\u5B57\u5F00\u7968\u7533\u8BF7\u6D41\u7A0B ID\uFF0C\u7528\u4E8E\u7EA2\u51B2\u8868\u5355\u300C\u84DD\u5B57\u53D1\u7968\u5F00\u7968\u6D41\u7A0B\u300D\uFF1B\u4E0D\u662F\u5408\u540C\u5BA1\u6279\u6D41\u7A0B ID" },
1002
+ requestName: nullableText,
1003
+ title: nullableText,
1004
+ name: nullableText,
1005
+ requestMark: nullableText,
1006
+ workflowId: nullableText,
1007
+ workflowName: nullableText,
1008
+ flowStatus: nullableText,
1009
+ flowStatusCode: nullableText,
1010
+ creator: nullableText,
1011
+ creatorId: nullableText,
1012
+ createTime: nullableText,
1013
+ finished: { type: ["boolean", "null"], description: "\u4EC5\u53D6\u63A5\u53E3\u660E\u786E\u7684\u5B8C\u6210\u6807\u8BC6\uFF0C\u4E0D\u636E\u6B64\u7B5B\u9664\u5019\u9009\u6216\u5224\u65AD\u53EF\u5426\u7EA2\u51B2" }
1014
+ }, ["requestId", "requestName", "title", "name", "requestMark", "workflowId", "workflowName", "flowStatus", "flowStatusCode", "creator", "creatorId", "createTime", "finished"])),
1015
+ count: { type: "integer", description: "\u672C\u9875\u5019\u9009\u6761\u6570" },
1016
+ current: { type: "integer" },
1017
+ pageSize: { type: "integer" },
1018
+ hasMore: { type: "boolean", description: "\u4F18\u5148\u6309\u660E\u786E\u5206\u9875\u5143\u6570\u636E\uFF1B\u63A5\u53E3\u672A\u8FD4\u56DE\u65F6\u6EE1\u9875\u89C6\u4E3A\u53EF\u80FD\u8FD8\u6709\u4E0B\u4E00\u9875" },
1019
+ total: { type: "integer", description: "\u4EC5\u5728\u63A5\u53E3\u660E\u786E\u8FD4\u56DE\u603B\u6570\u65F6\u63D0\u4F9B" }
1020
+ }, ["items", "count", "current", "pageSize", "hasMore"]);
954
1021
  var OPERATION_SUMMARIES = {
955
- "invoice.list": "\u5206\u9875\u67E5\u8BE2\u672C\u4EBA\u7968\u5939\u7684\u53D1\u7968\u5217\u8868\uFF1B\u53EF\u6309\u7C7B\u578B\u3001\u5F00\u7968/\u6D88\u8D39\u65E5\u671F\u533A\u95F4\u3001\u5173\u952E\u8BCD\u8FC7\u6EE4",
956
- "invoice.enterprise.list": "\u5206\u9875\u67E5\u8BE2\u4F01\u4E1A\u7968\u5939\u7684\u53D1\u7968\u5217\u8868\uFF08\u4F01\u4E1A\u62AC\u5934\u4E0B\u7684\u53D1\u7968\uFF09\uFF1B\u8FC7\u6EE4\u6761\u4EF6\u540C\u7968\u5939\u5217\u8868",
957
- "invoice.get": "\u6309 fid \u6216\u7968\u53F7\u53D6\u5355\u5F20\u53D1\u7968\u8BE6\u60C5",
1022
+ "invoice.list": "\u5206\u9875\u67E5\u8BE2\u672C\u4EBA\u7968\u5939\u53D1\u7968\uFF0C\u540C\u65F6\u8FD4\u56DE\u666E\u901A\u4E8B\u524D\u7533\u8BF7\u5019\u9009\u4F9B AI \u5339\u914D\uFF1B\u8BDD\u8D39/\u6CB9\u8D39\u4E13\u9879\u53EF\u5173\u95ED\u7533\u8BF7\u67E5\u8BE2",
1023
+ "invoice.enterprise.list": "\u5206\u9875\u67E5\u8BE2\u4F01\u4E1A\u7968\u5939\u53D1\u7968\uFF0C\u540C\u65F6\u8FD4\u56DE\u666E\u901A\u4E8B\u524D\u7533\u8BF7\u5019\u9009\u4F9B AI \u5339\u914D\uFF1B\u8FC7\u6EE4\u6761\u4EF6\u540C\u7968\u5939\u5217\u8868",
1024
+ "invoice.get": "\u6309 fid \u6216\u7968\u53F7\u53D6\u53D1\u7968\u8BE6\u60C5\uFF0C\u540C\u65F6\u8FD4\u56DE\u666E\u901A\u4E8B\u524D\u7533\u8BF7\u5019\u9009\u4F9B AI \u5339\u914D",
958
1025
  "invoice.upload": "\u4E0A\u4F20\u672C\u5730\u6587\u4EF6\u6216 URL \u5230\u53D1\u7968\u7CFB\u7EDF\uFF08\u4EA7\u51FA fileId\uFF0C\u5C1A\u4E0D\u5165\u7968\u5939\uFF09\uFF1B\u5165\u53C2 file/url",
959
1026
  "invoice.ocr.preview": "\u5BF9\u4E0A\u4F20\u7684\u6587\u4EF6\u505A OCR \u9884\u89C8\uFF08\u4E0D\u843D\u5E93\uFF09\uFF1B\u5165\u53C2 file/url\uFF0C\u53EF\u6307\u5B9A upload/is_save",
960
1027
  "invoice.upload-and-validate": "\u4E0A\u4F20\u5E76\u505A\u53D1\u7968\u67E5\u9A8C\uFF08\u771F\u5047\u6821\u9A8C\uFF09\uFF0C\u8FD4\u56DE\u67E5\u9A8C\u7ED3\u679C",
@@ -971,15 +1038,14 @@ var OPERATION_SUMMARIES = {
971
1038
  "invoice.reim.requests.list": "\u5206\u9875\u67E5\u8BE2\u53EF\u62A5\u9500\u7684\u6D41\u7A0B\u5355\uFF08\u62A5\u9500\u7533\u8BF7\u5217\u8868\uFF09\uFF1B\u53EF\u6309\u65F6\u95F4\u4E0E\u573A\u666F\u8FC7\u6EE4",
972
1039
  "invoice.reim.workflow.resolve": "\u6309\u6D41\u7A0B\u5355 ID \u6279\u91CF\u89E3\u6790\u5BF9\u5E94\u7684\u62A5\u9500\u6D41\u7A0B\u5B9A\u4E49",
973
1040
  "invoice.reim.employee-superiors": "\u53D6\u5F53\u524D\u5458\u5DE5\u7684\u4E0A\u7EA7\u94FE\uFF08\u62A5\u9500\u5BA1\u6279\u4EBA\u5019\u9009\uFF0C\u65E0\u5165\u53C2\uFF09",
974
- "invoice.reim.field.search": "\u6309\u5173\u952E\u8BCD\u68C0\u7D22\u62A5\u9500\u8868\u5355\u5B57\u6BB5\uFF08\u542B\u5B57\u6BB5 ID \u4E0E\u6240\u5C5E\u6D41\u7A0B/\u8282\u70B9\uFF09",
975
- "invoice.reim.customer.search": "\u6309\u5173\u952E\u8BCD\u68C0\u7D22\u5BA2\u6237\uFF08\u62A5\u9500\u5173\u8054\u5BA2\u6237\u5019\u9009\uFF09",
976
- "invoice.reim.relation.search": "\u6309\u76EE\u6807\u4E0E\u5173\u952E\u8BCD\u68C0\u7D22\u62A5\u9500\u5173\u8054\u5173\u7CFB\uFF08\u5BA2\u6237/\u9879\u76EE\uFF09",
1041
+ "invoice.reim.customer.search": "\u6309\u5BA2\u6237\u540D\u79F0\u6A21\u7CCA\u67E5\u8BE2\u5BA2\u6237\u3001\u627F\u62C5\u4E3B\u4F53\u53CA\u5404\u5BA2\u6237\u81EA\u5DF1\u7684\u76F8\u5173\u9879\u76EE\uFF0C\u7EDF\u4E00\u7528\u4E8E\u62A5\u9500\u3001\u8865\u8D34\u3001\u4E0A\u4F20\u767B\u8BB0\u548C\u72EC\u7ACB\u5BA2\u6237\u67E5\u8BE2",
977
1042
  "invoice.reim.relation.save": "\u4FDD\u5B58\u53D1\u7968\u4E0E\u5BA2\u6237/\u9879\u76EE\u7684\u5173\u8054\u5173\u7CFB\uFF08\u5199\u64CD\u4F5C\uFF0C\u7ECF\u52A8\u4F5C\u6D41\uFF09",
978
1043
  "invoice.reim.relation.list": "\u6309\u53D1\u7968 fid/fids \u67E5\u5DF2\u5EFA\u7ACB\u7684\u62A5\u9500\u5173\u8054\u5173\u7CFB",
979
- "invoice.reim.candidates.list": "\u6309\u6D88\u8D39\u65E5\u671F\u533A\u95F4\u67E5\u8BE2\u53EF\u53C2\u4E0E\u62A5\u9500\u7684\u53D1\u7968\u5019\u9009\uFF08\u6709\u6570\u91CF\u4E0A\u9650\uFF09",
1044
+ "invoice.reim.candidates.list": "\u6309\u6D88\u8D39\u65E5\u671F\u533A\u95F4\u67E5\u8BE2\u62A5\u9500\u53D1\u7968\u5019\u9009\uFF0C\u5E76\u6279\u91CF\u8FD4\u56DE\u666E\u901A\u4E8B\u524D\u7533\u8BF7\u4F9B AI \u5339\u914D",
980
1045
  "invoice.reim.subsidy.submit": "\u63D0\u4EA4\u62A5\u9500\u8865\u8D34\u7533\u8BF7\u5E76\u521B\u5EFA\u62A5\u9500\u6D41\u7A0B\uFF08\u9AD8\u98CE\u9669\u5199\u64CD\u4F5C\uFF0C\u4F1A\u843D\u5E93\u53D1\u8D77\u6D41\u7A0B\uFF09",
981
1046
  "invoice.issuing.contracts.list": "\u6309\u5408\u540C\u5361\u7247/\u6D41\u7A0B ID \u67E5\u53EF\u5F00\u7968\u7684\u5408\u540C\u5217\u8868",
982
- "invoice.issuing.contract.detail": "\u6309 requestId \u67E5\u5F00\u7968\u5BF9\u5E94\u5408\u540C\u7684\u6D41\u7A0B\u660E\u7EC6"
1047
+ "invoice.issuing.contract.detail": "\u6309 requestId \u67E5\u5F00\u7968\u5BF9\u5E94\u5408\u540C\u7684\u6D41\u7A0B\u660E\u7EC6",
1048
+ "invoice.issuing.red.requests.list": "\u6309\u5BA2\u6237\u540D\u79F0\u67E5\u8BE2\u7EA2\u51B2\u6240\u5173\u8054\u7684\u84DD\u5B57\u5F00\u7968\u7533\u8BF7\u6D41\u7A0B\u5019\u9009\uFF08\u53EA\u8BFB\u3001\u4E0D\u7B5B\u9664\u5BA1\u6279\u4E2D\u7533\u8BF7\uFF09"
983
1049
  };
984
1050
  function withSummaries(operations) {
985
1051
  return operations.map((item) => ({
@@ -1014,7 +1080,8 @@ var invoiceOperations = [
1014
1080
  additionalProperties: false,
1015
1081
  properties: {
1016
1082
  fid: { type: "string", pattern: "^[1-9]\\d*$" },
1017
- number: { type: "string", minLength: 1 }
1083
+ number: { type: "string", minLength: 1 },
1084
+ includePreApprovals: includePreApprovalsProperty
1018
1085
  },
1019
1086
  oneOf: [{ required: ["fid"] }, { required: ["number"] }]
1020
1087
  },
@@ -1317,42 +1384,6 @@ var invoiceOperations = [
1317
1384
  },
1318
1385
  outputSchema: resultEnvelopeOutput(workflowResolveDataSchema)
1319
1386
  },
1320
- {
1321
- name: "invoice.reim.employee-superiors",
1322
- risk: "read",
1323
- fixed: { path: "/api/inc/book/getEmployeeSuperiors" },
1324
- inputSchema: {
1325
- type: "object",
1326
- additionalProperties: false,
1327
- properties: {}
1328
- },
1329
- outputSchema: resultEnvelopeOutput(employeeSuperiorsDataSchema)
1330
- },
1331
- {
1332
- name: "invoice.reim.field.search",
1333
- risk: "read",
1334
- fixed: { path: "/api/government/formStructure/fieldRelateSearch", method: "GET", formModeType: "wf", defaultNodeId: "100004140000000271" },
1335
- inputSchema: {
1336
- type: "object",
1337
- additionalProperties: false,
1338
- properties: {
1339
- keywords: { type: "string", minLength: 1 },
1340
- fieldId: positiveId,
1341
- workflowId: positiveId,
1342
- nodeId: { type: "string", minLength: 1, default: "100004140000000271" }
1343
- },
1344
- required: ["keywords", "fieldId", "workflowId"]
1345
- },
1346
- outputSchema: objectSchema({
1347
- result: rawObject,
1348
- data: fieldSearchItemsSchema,
1349
- keywords: { type: "string" },
1350
- match: { type: "string", enum: ["unique", "multiple", "none"] },
1351
- items: fieldSearchItemsSchema,
1352
- selected: { anyOf: [fieldSearchItemSchema, { type: "null" }] },
1353
- workflow: workflowSchema
1354
- }, ["result", "data", "keywords", "match", "items", "workflow"])
1355
- },
1356
1387
  {
1357
1388
  name: "invoice.reim.customer.search",
1358
1389
  risk: "read",
@@ -1363,58 +1394,45 @@ var invoiceOperations = [
1363
1394
  compId: "c39b9e14c0034336adf9e9bc39aeed75",
1364
1395
  pageId: "1218181956452048911",
1365
1396
  pageNo: "1",
1366
- tableuid: "d26c94cc9c234d7da9bc2d399339a439",
1367
- filter: "\u5BA2\u6237\u8868\u300C\u540D\u79F0\u300D\u5B57\u6BB5 field_1173221220888062665 \u6A21\u7CCA\u5339\u914D keywords\uFF1B\u5176\u4ED6\u7B5B\u9009\u53C2\u6570\u56FA\u5B9A"
1397
+ pageSize: "10",
1398
+ maxPages: 20,
1399
+ filter: "\u4EC5\u5BA2\u6237\u8868\u300C\u540D\u79F0\u300D\u5B57\u6BB5 field_1173221220888062665 \u6A21\u7CCA\u5339\u914D keywords\uFF1B\u6EE1\u9875\u7EED\u67E5\uFF0C\u6309\u5BA2\u6237 ID \u53BB\u91CD\uFF0C\u4E0D\u4F9D\u8D56 count",
1400
+ projects: {
1401
+ path: "/api/ebuilder/form/eblist/getData",
1402
+ method: "POST",
1403
+ pageId: "1144658644836794483",
1404
+ appId: "1136121637129502949",
1405
+ compId: "f5b2b31aeb2e4e46956464bba7d2e52c",
1406
+ customerFieldId: "1149506138249011280",
1407
+ projectNameFieldId: "1020275734718578690",
1408
+ pageSize: 10,
1409
+ maxPagesPerCustomer: 20,
1410
+ customerConcurrency: 4,
1411
+ note: "\u6BCF\u4E2A\u53BB\u91CD\u5BA2\u6237\u7528\u81EA\u5DF1\u7684 customerId \u76F4\u63A5\u67E5\u9879\u76EE\uFF0C\u4E0D\u8BFB\u5386\u53F2\u62A5\u9500\uFF1B\u6BCF\u5BA2\u6237\u72EC\u7ACB\u5206\u9875\u5E76\u53BB\u91CD\uFF0C\u6302\u5230\u672C\u884C relatedProject\uFF0C\u4E0D\u6DF7\u5408\u5019\u9009\u3002\u5931\u8D25\u65F6 relatedProject=null \u5E76\u9644 projectsError\uFF0C\u4E0D\u4F2A\u88C5\u6210\u7A7A\u9879\u76EE\uFF1B\u8BA4\u8BC1\u9519\u8BEF\u4F20\u64AD\u3002"
1412
+ }
1368
1413
  },
1369
1414
  inputSchema: objectSchema({
1370
1415
  keywords: { type: "string", minLength: 1, description: "\u7528\u6237\u8F93\u5165\u7684\u5BA2\u6237\u540D\u79F0\uFF0C\u652F\u6301\u6A21\u7CCA\u540D\u79F0\uFF1B\u4E0D\u9700\u8981\u62A5\u9500\u8868\u5355\u6216\u5B57\u6BB5 ID" }
1371
1416
  }, ["keywords"]),
1372
1417
  outputSchema: objectSchema({
1373
1418
  list: arrayOf(objectSchema({
1374
- id: { type: "string", description: "\u76F8\u5173\u5BA2\u6237 ID" },
1375
- "1173221220888062665": { type: "string", description: "\u76F8\u5173\u5BA2\u6237\u540D\u79F0" },
1376
- "1173221220888062667": arrayOf(objectSchema({
1377
- name: { type: "string", description: "\u627F\u62C5\u4E3B\u4F53\u540D\u79F0" },
1378
- id: { type: "string", description: "\u627F\u62C5\u4E3B\u4F53 ID" },
1379
- type: { type: "string" }
1380
- }, ["name", "id", "type"]))
1381
- }, ["id", "1173221220888062665", "1173221220888062667"]))
1419
+ customerId: { type: "string", description: "\u5BA2\u6237\u4E1A\u52A1 ID\uFF0C\u6E90\u81EA form_data_id\uFF1B\u65E7\u63A5\u53E3\u54CD\u5E94\u7F3A\u5931\u8BE5\u952E\u65F6\u517C\u5BB9 id\uFF0C\u957F ID \u4FDD\u6301\u5B57\u7B26\u4E32" },
1420
+ customerName: { type: "string", description: "\u76F8\u5173\u5BA2\u6237\u540D\u79F0" },
1421
+ expenseBearer: arrayOf(objectSchema({
1422
+ expenseBearerName: { type: "string", description: "\u627F\u62C5\u4E3B\u4F53\u540D\u79F0" },
1423
+ expenseBearerId: { type: "string", description: "\u627F\u62C5\u4E3B\u4F53 ID" }
1424
+ }, ["expenseBearerName", "expenseBearerId"])),
1425
+ relatedProject: {
1426
+ anyOf: [arrayOf(objectSchema({
1427
+ relatedProjectName: { type: "string", description: "\u8BE5\u5BA2\u6237\u7684\u76F8\u5173\u9879\u76EE\u540D\u79F0" },
1428
+ relatedProjectId: { type: "string", description: "\u8BE5\u5BA2\u6237\u7684\u76F8\u5173\u9879\u76EE ID\uFF0C\u4FDD\u6301\u5B57\u7B26\u4E32" }
1429
+ }, ["relatedProjectName", "relatedProjectId"])), { type: "null" }],
1430
+ description: "\u53EA\u5C5E\u4E8E\u672C\u884C\u5BA2\u6237\u7684\u5B8C\u6574\u9879\u76EE\u5217\u8868\uFF1B[] \u4E3A\u786E\u8BA4\u65E0\u9879\u76EE\uFF0Cnull \u4E3A\u67E5\u8BE2\u5931\u8D25\u6216\u4E0D\u5B8C\u6574"
1431
+ },
1432
+ projectsError: { type: "string", description: "\u4EC5 relatedProject=null \u65F6\u63D0\u4F9B\u7684\u5931\u8D25\u539F\u56E0\uFF0C\u4E0D\u5F97\u5F53\u4F5C\u6CA1\u6709\u9879\u76EE" }
1433
+ }, ["customerId", "customerName", "expenseBearer", "relatedProject"]))
1382
1434
  }, ["list"])
1383
1435
  },
1384
- {
1385
- name: "invoice.reim.relation.search",
1386
- risk: "read",
1387
- fixed: {
1388
- customer: {
1389
- path: "/api/ebuilder/coms/nlist/getData",
1390
- headers: { ebbusinessid: "1218181956452048911" },
1391
- pageId: "1218181956452048911",
1392
- compId: "c39b9e14c0034336adf9e9bc39aeed75",
1393
- workflowId: "100003460000000060",
1394
- isCreate: "1",
1395
- filter: "\u5BA2\u6237\u8868\u300C\u540D\u79F0\u300D\u5B57\u6BB5 field_1173221220888062665 \u6A21\u7CCA\u5339\u914D keywords",
1396
- output: "data.list[]\uFF1Aid \u2192 id\uFF0C1173221220888062665 \u2192 name"
1397
- },
1398
- project: {
1399
- path: "/api/ebuilder/form/common/browser/data/ebuilder",
1400
- quickSearchDatas: "field_1020275734718578690\uFF08\u9879\u76EE\u540D\u79F0\uFF09= keywords",
1401
- formParam: { formId: "100003660000000007", layoutId: "925333107626672135", fieldId: "100003720000006720", module: "workflow" },
1402
- output: "data.data[]\uFF1Aid \u2192 id\uFF0Ccontent \u2192 name\uFF1Bdisabled=true \u7684\u4E0D\u8FD4\u56DE"
1403
- },
1404
- pageSize: 20,
1405
- note: "\u4E0A\u4F20\u53D1\u7968\u767B\u8BB0\u5173\u8054\u4FE1\u606F\u65F6\u7528\uFF0C\u4E0D\u9700\u8981\u62A5\u9500\u8868\u5355\uFF1B\u53EA\u4FDD\u7559\u6BCF\u6761\u7684 id \u548C\u540D\u79F0"
1406
- },
1407
- inputSchema: {
1408
- type: "object",
1409
- additionalProperties: false,
1410
- properties: {
1411
- target: { type: "string", enum: ["customer", "project"], description: "customer=\u76F8\u5173\u5BA2\u6237\uFF0Cproject=\u76F8\u5173\u9879\u76EE" },
1412
- keywords: { type: "string", minLength: 1, description: "\u7528\u6237\u8BF4\u7684\u5BA2\u6237 / \u9879\u76EE\u540D\u79F0\u539F\u8BDD\uFF0C\u53EF\u4EE5\u662F\u6A21\u7CCA\u540D\u79F0" }
1413
- },
1414
- required: ["target", "keywords"]
1415
- },
1416
- outputSchema: relationSearchOutputSchema
1417
- },
1418
1436
  {
1419
1437
  name: "invoice.reim.relation.save",
1420
1438
  risk: "write",
@@ -1431,10 +1449,10 @@ var invoiceOperations = [
1431
1449
  properties: {
1432
1450
  fid: { ...positiveId, description: "\u5355\u5F20\u53D1\u7968 fid\uFF1B\u4E0E fids \u4E8C\u9009\u4E00" },
1433
1451
  fids: { ...positiveIdArray, description: "\u540C\u4E00\u6279\u4E0A\u4F20\u6210\u529F\u7684\u53D1\u7968 fid\uFF1B\u4E0E fid \u4E8C\u9009\u4E00" },
1434
- customerId: { ...positiveId, description: "\u76F8\u5173\u5BA2\u6237 ID\uFF08invoice.reim.relation.search target=customer \u9009\u5B9A\u90A3\u6761\u7684 id\uFF09\uFF0C\u4E0E customerName \u540C\u65F6\u63D0\u4F9B" },
1452
+ customerId: { ...positiveId, description: "\u76F8\u5173\u5BA2\u6237 ID\uFF08invoice.reim.customer.search \u9009\u5B9A\u884C\u7684 customerId\uFF09\uFF0C\u4E0E customerName \u540C\u65F6\u63D0\u4F9B" },
1435
1453
  customerName: { type: "string", minLength: 1, description: "\u76F8\u5173\u5BA2\u6237\u540D\u79F0\uFF0C\u4E0E customerId \u540C\u65F6\u63D0\u4F9B" },
1436
- projectId: { ...positiveId, description: "\u76F8\u5173\u9879\u76EE ID\uFF08invoice.reim.relation.search target=project \u9009\u5B9A\u90A3\u6761\u7684 id\uFF09\uFF0C\u4E0E projectName \u540C\u65F6\u63D0\u4F9B" },
1437
- projectName: { type: "string", minLength: 1, description: "\u76F8\u5173\u9879\u76EE\u540D\u79F0\uFF0C\u4E0E projectId \u540C\u65F6\u63D0\u4F9B" },
1454
+ projectId: { ...positiveId, description: "\u76F8\u5173\u9879\u76EE ID\uFF08invoice.reim.customer.search \u9009\u5B9A\u5BA2\u6237\u672C\u884C relatedProject \u7684 relatedProjectId\uFF09\uFF0C\u4E0E projectName \u540C\u65F6\u63D0\u4F9B" },
1455
+ projectName: { type: "string", minLength: 1, description: "\u76F8\u5173\u9879\u76EE\u540D\u79F0\uFF08invoice.reim.customer.search \u9009\u5B9A\u5BA2\u6237\u672C\u884C relatedProject \u7684 relatedProjectName\uFF09\uFF0C\u4E0E projectId \u540C\u65F6\u63D0\u4F9B" },
1438
1456
  flowId: { ...positiveId, description: "\u4E8B\u524D\u7533\u8BF7\u6D41\u7A0B\u7684 requestid\uFF08invoice.reim.requests.list \u8FD4\u56DE\uFF09" }
1439
1457
  },
1440
1458
  oneOf: [{ required: ["fid"] }, { required: ["fids"] }]
@@ -1467,7 +1485,7 @@ var invoiceOperations = [
1467
1485
  {
1468
1486
  name: "invoice.reim.candidates.list",
1469
1487
  risk: "read",
1470
- fixed: { path: "/api/inc/sync", sreim: "3", billType: 0, excludeProStatus: 8 },
1488
+ fixed: { path: "/api/inc/sync", sreim: "3", billType: 0, mext: FULL_EXT_MASK, excludeProStatus: 8 },
1471
1489
  inputSchema: {
1472
1490
  type: "object",
1473
1491
  additionalProperties: false,
@@ -1477,7 +1495,8 @@ var invoiceOperations = [
1477
1495
  consumption_tm_begin: epochDateProperty("\u6D88\u8D39\u65E5\u671F\u8D77\uFF08\u542B\uFF09"),
1478
1496
  consumption_tm_end: epochEndDateProperty("\u6D88\u8D39\u65E5\u671F\u6B62\uFF08\u542B\uFF09"),
1479
1497
  page_size: { type: "integer", minimum: 10, maximum: 200, default: 50, description: "\u5355\u9875\u6761\u6570\u3002" },
1480
- max_items: { type: "integer", minimum: 1, maximum: 500, default: 200, description: "\u6700\u591A\u62C9\u53D6\u6761\u6570\uFF0C\u8D85\u51FA\u622A\u65AD\u5E76\u4EA7\u751F warning\u3002" }
1498
+ max_items: { type: "integer", minimum: 1, maximum: 500, default: 200, description: "\u6700\u591A\u62C9\u53D6\u6761\u6570\uFF0C\u8D85\u51FA\u622A\u65AD\u5E76\u4EA7\u751F warning\u3002" },
1499
+ includePreApprovals: includePreApprovalsProperty
1481
1500
  }
1482
1501
  },
1483
1502
  outputSchema: reimCandidatesOutputSchema
@@ -1590,35 +1609,65 @@ var invoiceOperations = [
1590
1609
  }
1591
1610
  },
1592
1611
  outputSchema: issuingContractDetailOutputSchema
1612
+ },
1613
+ {
1614
+ name: "invoice.issuing.red.requests.list",
1615
+ risk: "read",
1616
+ fixed: {
1617
+ path: "/api/workflow/core/common/browser/data/wfcRequest",
1618
+ workflowId: "100003460000000214",
1619
+ source: "\u84DD\u5B57\u5F00\u7968\u7533\u8BF7\u6D41\u7A0B\u6D4F\u89C8\u5668\uFF1B\u67E5\u8BE2\u7ED3\u679C\u7528\u4E8E\u7EA2\u51B2\u6D41\u7A0B\u300C\u84DD\u5B57\u53D1\u7968\u5F00\u7968\u6D41\u7A0B\u300D"
1620
+ },
1621
+ inputSchema: {
1622
+ type: "object",
1623
+ additionalProperties: false,
1624
+ required: ["customerName"],
1625
+ properties: {
1626
+ customerName: { type: "string", minLength: 1, description: "\u7528\u6237\u660E\u786E\u7684\u5BA2\u6237\u540D\u79F0\uFF0C\u540C\u65F6\u7528\u4E8E\u7533\u8BF7\u6807\u9898\u548C\u6D41\u7A0B\u7F16\u53F7\u5FEB\u6377\u641C\u7D22" },
1627
+ current: { type: "integer", minimum: 1, default: 1 },
1628
+ pageSize: { type: "integer", minimum: 1, maximum: 100, default: 10 }
1629
+ }
1630
+ },
1631
+ outputSchema: issuingRedRequestsOutputSchema
1593
1632
  }
1594
1633
  ];
1595
- var REIM_REFERENCE = "references/invoice-reim.md";
1634
+ var REIM_REFERENCE = "references/reim-workflow.md";
1596
1635
  var ISSUING_REFERENCE = "references/invoice-issuing-workflow.md";
1597
1636
  var UPLOAD_AND_VALIDATE_REFERENCE = "references/invoice-upload-and-validate.md";
1598
1637
  var invoiceRetiredOperations = [
1638
+ ...["invoice.reim.field.search", "invoice.reim.project.list", "invoice.reim.relation.search"].map((name) => ({
1639
+ name,
1640
+ replacement: "\u5BA2\u6237\u3001\u76F8\u5173\u9879\u76EE\u53CA\u627F\u62C5\u4E3B\u4F53\u7EDF\u4E00\u4F7F\u7528 invoice.reim.customer.search\uFF0C\u53EA\u4F20\u5BA2\u6237\u540D\u79F0 keywords\uFF1B\u5148\u9009\u5BA2\u6237\uFF0C\u518D\u4ECE\u8BE5\u5BA2\u6237\u672C\u884C relatedProject \u9009\u62E9\u9879\u76EE\u3002\u7F3A\u5C11\u5BA2\u6237\u540D\u79F0\u65F6\u5148\u8865\u5145\u5BA2\u6237\uFF0C\u4E0D\u518D\u6309\u9879\u76EE\u540D\u79F0\u67E5\u8BE2\u6216\u8BFB\u53D6\u5386\u53F2\u5F52\u6863\u5173\u8054",
1641
+ reference: "references/reim-customer-search.md"
1642
+ })),
1643
+ {
1644
+ name: "invoice.reim.employee-superiors",
1645
+ replacement: "\u4EBA\u5458\u53CA\u4E0A\u7EA7\u5B57\u6BB5\u4FDD\u7559\u9875\u9762\u9ED8\u8BA4\u503C\uFF1B\u62A5\u9500\u6807\u9898\u590D\u7528\u5DF2\u786E\u8BA4\u7684\u5F53\u524D\u7528\u6237\u59D3\u540D\u6216\u672C\u4EBA\u4E8B\u524D\u7533\u8BF7\u521B\u5EFA\u4EBA\uFF0C\u7F3A\u5C11\u59D3\u540D\u65F6\u4EC5\u5411\u7528\u6237\u8865\u95EE\uFF0C\u4E0D\u518D\u67E5\u8BE2\u4EBA\u5458\u6216\u4E0A\u7EA7\u63A5\u53E3",
1646
+ reference: REIM_REFERENCE
1647
+ },
1599
1648
  {
1600
1649
  name: "invoice.reim.form.structure",
1601
- replacement: "\u8F7D\u5165\u62A5\u9500\u8868\u5355\u6539\u7528 weaver-e10-workflow \u7684 workflow.createForm\uFF08workflow \u4F20 {workFlowName}({workFlowId})\uFF09",
1650
+ replacement: "\u8F7D\u5165\u62A5\u9500\u5B57\u6BB5\u6539\u7528 weaver-e10-workflow \u7684 workflow.createRequestDirect\uFF08\u53EA\u4F20 workflow \u5B57\u7B26\u4E32\u6570\u7EC4\uFF09\uFF0C\u7531\u9875\u9762\u9884\u586B\u540E\u7528\u6237\u6838\u5BF9\u4FDD\u5B58",
1602
1651
  reference: REIM_REFERENCE
1603
1652
  },
1604
1653
  {
1605
1654
  name: "invoice.reim.row-info",
1606
- replacement: "\u660E\u7EC6\u884C\u4E0D\u518D\u9884\u586B\uFF1A\u6BCF\u884C\u53EA\u5199\u300C\u76F8\u5173\u53D1\u7968\u300D\uFF08\u76F4\u63A5\u4F7F\u7528\u5DF2\u9009\u53D1\u7968\u7684 id/name \u5F15\u7528\u5BF9\u8C61\uFF09\uFF0C\u5176\u4F59\u5217\u7531\u8054\u52A8\u5E26\u51FA",
1655
+ replacement: "\u660E\u7EC6\u6BCF\u884C\u53EA\u5199\u5DF2\u9009\u53D1\u7968\u4E1A\u52A1 fid \u548C\u5DF2\u7ED1\u5B9A\u7684\u76F8\u5173\u6D41\u7A0B\uFF0C\u5176\u4F59\u5217\u7531\u9875\u9762\u8054\u52A8\u5E26\u51FA\uFF0C\u4E0D\u518D\u67E5\u8BE2\u6216\u8F6C\u6362\u53D1\u7968\u5BF9\u8C61",
1607
1656
  reference: REIM_REFERENCE
1608
1657
  },
1609
1658
  {
1610
1659
  name: "invoice.reim.row-info-batch",
1611
- replacement: "\u660E\u7EC6\u884C\u4E0D\u518D\u9884\u586B\uFF1A\u6BCF\u884C\u53EA\u5199\u300C\u76F8\u5173\u53D1\u7968\u300D\uFF08\u76F4\u63A5\u4F7F\u7528\u5DF2\u9009\u53D1\u7968\u7684 id/name \u5F15\u7528\u5BF9\u8C61\uFF09\uFF0C\u5176\u4F59\u5217\u7531\u8054\u52A8\u5E26\u51FA",
1660
+ replacement: "\u660E\u7EC6\u6BCF\u884C\u53EA\u5199\u5DF2\u9009\u53D1\u7968\u4E1A\u52A1 fid \u548C\u5DF2\u7ED1\u5B9A\u7684\u76F8\u5173\u6D41\u7A0B\uFF0C\u5176\u4F59\u5217\u7531\u9875\u9762\u8054\u52A8\u5E26\u51FA\uFF0C\u4E0D\u518D\u67E5\u8BE2\u6216\u8F6C\u6362\u53D1\u7968\u5BF9\u8C61",
1612
1661
  reference: REIM_REFERENCE
1613
1662
  },
1614
1663
  {
1615
1664
  name: "invoice.reim.flow.create.prepare",
1616
- replacement: "\u521B\u5EFA\u62A5\u9500\u5355\u6539\u7528 weaver-e10-workflow \u7684 workflow.createRequest\uFF08action \u56FA\u5B9A draft\uFF0C\u5B58\u8349\u7A3F\uFF09",
1665
+ replacement: "\u666E\u901A\u62A5\u9500\u6539\u7528 workflow.createRequestDirect \u53EA\u8BFB\u5B57\u6BB5\uFF0C\u518D\u6309 reim-workflow.md \u8F93\u51FA\u9875\u9762\u586B\u5355\u6307\u4EE4\uFF0C\u7531\u7528\u6237\u6838\u5BF9\u4FDD\u5B58\uFF0C\u4E0D\u81EA\u52A8\u4FDD\u5B58\u6216\u63D0\u4EA4",
1617
1666
  reference: REIM_REFERENCE
1618
1667
  },
1619
1668
  {
1620
1669
  name: "invoice.reim.flow.create.apply",
1621
- replacement: "\u521B\u5EFA\u62A5\u9500\u5355\u6539\u7528 weaver-e10-workflow \u7684 workflow.createRequest\uFF08action \u56FA\u5B9A draft\uFF0C\u5B58\u8349\u7A3F\uFF09",
1670
+ replacement: "\u666E\u901A\u62A5\u9500\u6539\u7528 workflow.createRequestDirect \u53EA\u8BFB\u5B57\u6BB5\uFF0C\u518D\u6309 reim-workflow.md \u8F93\u51FA\u9875\u9762\u586B\u5355\u6307\u4EE4\uFF0C\u7531\u7528\u6237\u6838\u5BF9\u4FDD\u5B58\uFF0C\u4E0D\u81EA\u52A8\u4FDD\u5B58\u6216\u63D0\u4EA4",
1622
1671
  reference: REIM_REFERENCE
1623
1672
  },
1624
1673
  {
@@ -1633,12 +1682,12 @@ var invoiceRetiredOperations = [
1633
1682
  },
1634
1683
  {
1635
1684
  name: "invoice.reim.template.build",
1636
- replacement: "\u6539\u4E3A invoice.reim.candidates.list \u53D6\u5019\u9009\u53D1\u7968 \u2192 workflow.createForm \u8F7D\u5165\u8868\u5355 \u2192 \u6309 reim-form-fill-rules.md \u7EC4\u88C5 data \u2192 workflow.createRequest \u5B58\u8349\u7A3F",
1685
+ replacement: "\u6539\u4E3A invoice.reim.candidates.list \u9009\u7968 \u2192 workflow.createRequestDirect \u53D6\u5B57\u6BB5 \u2192 \u6309 reim-workflow.md \u7684 Step 4\uFF5E5 \u7EC4\u88C5\u9875\u9762\u53C2\u6570\u5E76\u8F93\u51FA\u586B\u5355\u6307\u4EE4\uFF0C\u7531\u7528\u6237\u6838\u5BF9\u4FDD\u5B58",
1637
1686
  reference: REIM_REFERENCE
1638
1687
  },
1639
1688
  {
1640
1689
  name: "invoice.reim.flow.create.auto-prepare",
1641
- replacement: "\u6539\u4E3A invoice.reim.candidates.list \u53D6\u5019\u9009\u53D1\u7968 \u2192 workflow.createForm \u8F7D\u5165\u8868\u5355 \u2192 \u6309 reim-form-fill-rules.md \u7EC4\u88C5 data \u2192 workflow.createRequest \u5B58\u8349\u7A3F",
1690
+ replacement: "\u6539\u4E3A invoice.reim.candidates.list \u9009\u7968 \u2192 workflow.createRequestDirect \u53D6\u5B57\u6BB5 \u2192 \u6309 reim-workflow.md \u7684 Step 4\uFF5E5 \u7EC4\u88C5\u9875\u9762\u53C2\u6570\u5E76\u8F93\u51FA\u586B\u5355\u6307\u4EE4\uFF0C\u7531\u7528\u6237\u6838\u5BF9\u4FDD\u5B58",
1642
1691
  reference: REIM_REFERENCE
1643
1692
  },
1644
1693
  {
@@ -1698,6 +1747,302 @@ import { createHash } from "node:crypto";
1698
1747
  import { existsSync as existsSync2 } from "node:fs";
1699
1748
  import { readFile as readFile2, stat, writeFile as writeFile2 } from "node:fs/promises";
1700
1749
  import { dirname, extname, basename, resolve as resolve2 } from "node:path";
1750
+
1751
+ // src/shortcuts/invoice/business-response.ts
1752
+ function assertBusinessSuccess(value, subtype, fallbackMessage) {
1753
+ const result = value && typeof value === "object" ? value : {};
1754
+ const code = result.code ?? result.res_base?.ret;
1755
+ const failed = result.fail === true || result.status === false || code !== void 0 && code !== 0 && code !== 200;
1756
+ if (!failed) return;
1757
+ throw new InvoiceCliError("api", subtype, result.message || result.msg || result.res_base?.message || fallbackMessage, {
1758
+ code,
1759
+ details: { result },
1760
+ exitCode: 1
1761
+ });
1762
+ }
1763
+
1764
+ // src/shortcuts/invoice/calendar.ts
1765
+ function formatUtcDate(date) {
1766
+ const y = date.getUTCFullYear();
1767
+ const m = String(date.getUTCMonth() + 1).padStart(2, "0");
1768
+ const d = String(date.getUTCDate()).padStart(2, "0");
1769
+ return `${y}-${m}-${d}`;
1770
+ }
1771
+ function addCalendarDays(isoDate, offsetDays) {
1772
+ const [year, month, day] = isoDate.split("-").map(Number);
1773
+ return formatUtcDate(new Date(Date.UTC(year, (month ?? 1) - 1, (day ?? 1) + offsetDays)));
1774
+ }
1775
+ function addCalendarMonths(isoDate, offsetMonths) {
1776
+ const [year, month, day] = isoDate.split("-").map(Number);
1777
+ const target = new Date(Date.UTC(year, (month ?? 1) - 1 + offsetMonths, 1));
1778
+ const lastDay = new Date(Date.UTC(target.getUTCFullYear(), target.getUTCMonth() + 1, 0)).getUTCDate();
1779
+ target.setUTCDate(Math.min(day ?? 1, lastDay));
1780
+ return formatUtcDate(target);
1781
+ }
1782
+ function shanghaiCalendarDate(offsetDays = 0, now = /* @__PURE__ */ new Date()) {
1783
+ const today = new Intl.DateTimeFormat("en-CA", { timeZone: "Asia/Shanghai" }).format(now);
1784
+ return offsetDays === 0 ? today : addCalendarDays(today, offsetDays);
1785
+ }
1786
+
1787
+ // src/shortcuts/invoice/preapproval-enrichment.ts
1788
+ var REQUEST_PATH = "/api/inc/book/getRequestListByTabId";
1789
+ var PAGE_SIZE = 100;
1790
+ var MAX_PAGES = 20;
1791
+ var REQUEST_TIMEOUT_MS = 5e3;
1792
+ var WORKFLOW_IDS = [
1793
+ "100003460000000746",
1794
+ "100003460000000046",
1795
+ "100003460000000418",
1796
+ "100003460000000045"
1797
+ ];
1798
+ var ORDINARY_WORKFLOWS = new Set(WORKFLOW_IDS);
1799
+ var OPTIONAL_FIELDS = ["flowStatus", "creatorId", "creatorName", "createTime"];
1800
+ function record(value) {
1801
+ return value && typeof value === "object" && !Array.isArray(value) ? value : null;
1802
+ }
1803
+ function text3(value) {
1804
+ return typeof value === "string" ? value.trim() : "";
1805
+ }
1806
+ function phoneOrFuelOnly(invoice) {
1807
+ const info = invoiceRecordOf(invoice);
1808
+ const pro = record(info.comm_info?.pro) ?? {};
1809
+ const ext = parseInvoiceExt(info.ext);
1810
+ const primary = [info.fyn, pro.kind, pro.content, invoiceExtInfo(info).content, ext.service_name].map(text3).filter(Boolean);
1811
+ const evidence = primary.join(" ");
1812
+ const subsidy = /话费|电话费|手机账单|电信服务|通讯|通信|流量(?:费|套餐)|汽油|柴油|加油费|燃油|油费|成品油/u;
1813
+ const ordinary = /餐饮|餐费|吃饭|住宿|酒店|客运|运输|机票|火车|通行|过路|停车|办公|招待|团建|聚餐|借款|垫付|设备|维修|矿泉水|食品|食用油|粮油|润滑油/u;
1814
+ if (ordinary.test(evidence)) return false;
1815
+ if (Array.isArray(ext.products) && ext.products.some((product) => {
1816
+ const name = text3(record(product)?.name);
1817
+ return name !== "" && !subsidy.test(name);
1818
+ })) return false;
1819
+ if (subsidy.test(evidence)) return true;
1820
+ if (primary.some((value) => !/^(?:其他|其它|其他费用|其它费用|未分类|未知)$/u.test(value))) return false;
1821
+ const seller = [info.comm_info?.payer?.company, info.sellerName, info.payer].map(text3).join(" ");
1822
+ return /中国移动|中国联通|中国电信|中国广电|电信服务|通信服务|通讯服务|加油站|汽柴油销售/u.test(seller);
1823
+ }
1824
+ function assertRequestListSuccess(response) {
1825
+ const envelope = record(response);
1826
+ if (!envelope) throw new Error("\u4E8B\u524D\u7533\u8BF7\u63A5\u53E3\u54CD\u5E94\u7ED3\u6784\u5F02\u5E38");
1827
+ const code = envelope.code ?? record(envelope.res_base)?.ret;
1828
+ assertBusinessSuccess({ ...envelope, ...code !== void 0 ? { code: typeof code === "string" && code.trim() !== "" ? Number(code) : code } : {} }, "preapprovals_query_failed", "\u8BFB\u53D6\u666E\u901A\u4E8B\u524D\u7533\u8BF7\u5931\u8D25");
1829
+ const errcode = record(envelope.message)?.errcode;
1830
+ if (errcode !== void 0 && errcode !== null && errcode !== "") {
1831
+ if (!["string", "number"].includes(typeof errcode) || ![0, 200].includes(Number(errcode))) {
1832
+ throw new Error("\u4E8B\u524D\u7533\u8BF7\u63A5\u53E3\u8FD4\u56DE\u4E1A\u52A1\u5931\u8D25");
1833
+ }
1834
+ }
1835
+ }
1836
+ function skipped(reason) {
1837
+ return { preApprovals: { status: "skipped", items: null, hasMore: null, reason }, warnings: [] };
1838
+ }
1839
+ function requiredId(value) {
1840
+ const id = typeof value === "string" ? value : typeof value === "number" && Number.isSafeInteger(value) && value > 0 ? String(value) : "";
1841
+ if (!/^\d+$/u.test(id) || !/[1-9]/u.test(id)) throw new Error("\u4E8B\u524D\u7533\u8BF7\u8BB0\u5F55\u7F3A\u5C11\u53EF\u9760 ID");
1842
+ return id;
1843
+ }
1844
+ function candidate(row, requestid, workflowid) {
1845
+ const requestname = row.requestname ?? "";
1846
+ if (typeof requestname !== "string") throw new Error("\u4E8B\u524D\u7533\u8BF7\u540D\u79F0\u683C\u5F0F\u5F02\u5E38");
1847
+ const result = { requestid, workflowid, requestname };
1848
+ for (const key of OPTIONAL_FIELDS) {
1849
+ const value = row[key];
1850
+ if (value === void 0) continue;
1851
+ const valid = value === null || typeof value === "string" || key !== "creatorName" && typeof value === "number" && Number.isSafeInteger(value);
1852
+ if (!valid) throw new Error("\u4E8B\u524D\u7533\u8BF7\u5143\u6570\u636E\u683C\u5F0F\u5F02\u5E38");
1853
+ result[key] = value;
1854
+ }
1855
+ return result;
1856
+ }
1857
+ async function readInvoicePreApprovals(host, options) {
1858
+ if (options.includePreApprovals === false) return skipped("disabled");
1859
+ if (options.invoices.length === 0) return skipped("no_invoices");
1860
+ if (options.invoices.every(phoneOrFuelOnly)) return skipped("phone_fuel_only");
1861
+ const items = /* @__PURE__ */ new Map();
1862
+ const seenPages = /* @__PURE__ */ new Set();
1863
+ let query;
1864
+ let completedPages = 0;
1865
+ let received = 0;
1866
+ const partial = (reason) => ({
1867
+ preApprovals: { status: "partial", items: [...items.values()], query, hasMore: true, reason },
1868
+ warnings: ["\u666E\u901A\u4E8B\u524D\u7533\u8BF7\u5019\u9009\u5C1A\u672A\u5B8C\u6574\u8BFB\u53D6\uFF0C\u4E0D\u80FD\u636E\u6B64\u5224\u65AD\u552F\u4E00\u6216\u6CA1\u6709\u7533\u8BF7\uFF1B\u5DF2\u53D6\u5F97\u7684\u5019\u9009\u53CA\u53D1\u7968\u7ED3\u679C\u4FDD\u7559\u3002"]
1869
+ });
1870
+ try {
1871
+ const today = shanghaiCalendarDate(0, options.now ?? /* @__PURE__ */ new Date());
1872
+ query = {
1873
+ cusCreateDateStart: addCalendarMonths(today, -1),
1874
+ cusCreateDateEnd: today,
1875
+ workflowIds: [...WORKFLOW_IDS]
1876
+ };
1877
+ const session = await host.getSession();
1878
+ const currentUserId = typeof session.userId === "string" ? session.userId.trim() : typeof session.userId === "number" && Number.isSafeInteger(session.userId) ? String(session.userId) : "";
1879
+ if (currentUserId) query.currentUserId = currentUserId;
1880
+ for (let pageNo = 1; pageNo <= MAX_PAGES; pageNo += 1) {
1881
+ const response = await host.invoiceRequest({
1882
+ path: REQUEST_PATH,
1883
+ method: "POST",
1884
+ operation: options.operation,
1885
+ timeoutMs: REQUEST_TIMEOUT_MS,
1886
+ body: {
1887
+ pageNo,
1888
+ pageSize: PAGE_SIZE,
1889
+ cusCreateDateStart: query.cusCreateDateStart,
1890
+ cusCreateDateEnd: addCalendarDays(query.cusCreateDateEnd, 1)
1891
+ }
1892
+ });
1893
+ assertRequestListSuccess(response);
1894
+ const raw = record(response)?.data;
1895
+ if (!Array.isArray(raw)) throw new Error("\u4E8B\u524D\u7533\u8BF7\u63A5\u53E3\u672A\u8FD4\u56DE data \u6570\u7EC4");
1896
+ const pageRows = raw.map((value) => {
1897
+ const row = record(value);
1898
+ if (!row) throw new Error("\u4E8B\u524D\u7533\u8BF7\u8BB0\u5F55\u7ED3\u6784\u5F02\u5E38");
1899
+ return { row, requestid: requiredId(row.requestid), workflowid: requiredId(row.workflowid) };
1900
+ });
1901
+ const signature2 = JSON.stringify(pageRows.map((row) => row.requestid).sort());
1902
+ if (seenPages.has(signature2)) return partial("repeated_page");
1903
+ const pageItems = pageRows.filter((row) => ORDINARY_WORKFLOWS.has(row.workflowid)).map(({ row, requestid, workflowid }) => candidate(row, requestid, workflowid));
1904
+ seenPages.add(signature2);
1905
+ for (const item of pageItems) {
1906
+ if (!items.has(item.requestid)) items.set(item.requestid, item);
1907
+ }
1908
+ completedPages += 1;
1909
+ received += raw.length;
1910
+ const envelope = record(response);
1911
+ const explicitMore = envelope.hasMore;
1912
+ if (explicitMore !== void 0 && typeof explicitMore !== "boolean") return partial("pagination_inconsistent");
1913
+ const rawTotal = envelope.total;
1914
+ const total = typeof rawTotal === "string" && /^\d+$/u.test(rawTotal) ? Number(rawTotal) : rawTotal;
1915
+ if (total !== void 0 && (!Number.isSafeInteger(total) || total < received)) return partial("pagination_inconsistent");
1916
+ const totalHasMore = total !== void 0 && received < total;
1917
+ if (explicitMore === false && totalHasMore) return partial("pagination_inconsistent");
1918
+ if (explicitMore === true || totalHasMore) {
1919
+ if (raw.length === 0) return partial("pagination_inconsistent");
1920
+ continue;
1921
+ }
1922
+ if (explicitMore === false || total !== void 0 || raw.length < PAGE_SIZE) {
1923
+ return { preApprovals: { status: "complete", items: [...items.values()], query, hasMore: false }, warnings: [] };
1924
+ }
1925
+ }
1926
+ return partial("page_limit");
1927
+ } catch (error) {
1928
+ if (error && typeof error === "object" && "type" in error && error.type === "authentication") throw error;
1929
+ if (completedPages > 0) return partial("query_failed");
1930
+ return {
1931
+ preApprovals: { status: "unavailable", items: null, ...query ? { query } : {}, hasMore: null, reason: "query_failed" },
1932
+ warnings: ["\u666E\u901A\u4E8B\u524D\u7533\u8BF7\u5019\u9009\u6682\u4E0D\u53EF\u7528\uFF0C\u4E0D\u80FD\u89C6\u4E3A\u6CA1\u6709\u7533\u8BF7\uFF1B\u53D1\u7968\u7ED3\u679C\u4ECD\u6B63\u5E38\u8FD4\u56DE\u3002"]
1933
+ };
1934
+ }
1935
+ }
1936
+
1937
+ // src/shortcuts/invoice/read-enrichment.ts
1938
+ var EXPENSE_TYPE_TIMEOUT_MS = 5e3;
1939
+ var EMPLOYEE_INFO_TIMEOUT_MS = 5e3;
1940
+ function employeeEntities(value) {
1941
+ if (value === void 0 || value === null) return [];
1942
+ if (!Array.isArray(value)) throw new Error("\u4EBA\u5458\u5B9E\u4F53\u4E0D\u662F\u6570\u7EC4");
1943
+ return value.map((row) => {
1944
+ const id = typeof row?.id === "string" ? row.id : typeof row?.id === "number" && Number.isSafeInteger(row.id) ? String(row.id) : null;
1945
+ if (id === null || typeof row?.name !== "string") throw new Error("\u4EBA\u5458\u5B9E\u4F53\u7F3A\u5C11\u6709\u6548 id / name");
1946
+ return { id, name: row.name };
1947
+ });
1948
+ }
1949
+ async function readInvoiceEmployeeInfo(host, operation) {
1950
+ try {
1951
+ const session = await host.getSession();
1952
+ if (!session.userId) throw new Error("\u7F3A\u5C11\u5F53\u524D\u4EBA\u5458 ID");
1953
+ const result = await host.invoiceRequest({
1954
+ path: `/api/bs/hrm/card/get/${encodeURIComponent(session.userId)}`,
1955
+ method: "GET",
1956
+ query: { id: session.userId, readOnly: true },
1957
+ headers: { Referer: `${session.baseUrl.replace(/\/+$/u, "")}/sp/hrm/profileInfo/${encodeURIComponent(session.userId)}` },
1958
+ needsInvoiceToken: false,
1959
+ timeoutMs: EMPLOYEE_INFO_TIMEOUT_MS,
1960
+ operation
1961
+ });
1962
+ const succeeded = result?.code !== void 0 && result?.code !== null ? Number(result.code) === 200 : result?.status === true;
1963
+ if (!succeeded) throw new Error("\u4EBA\u5458\u5361\u7247\u8BF7\u6C42\u5931\u8D25");
1964
+ const card = result?.data?.data;
1965
+ if (!card || typeof card !== "object" || Array.isArray(card) || Object.keys(card).length === 0) {
1966
+ throw new Error("\u4EBA\u5458\u5361\u7247\u7F3A\u5C11\u4E1A\u52A1\u6570\u636E");
1967
+ }
1968
+ if (card.mobile !== void 0 && card.mobile !== null && typeof card.mobile !== "string") {
1969
+ throw new Error("\u4EBA\u5458\u624B\u673A\u53F7\u4E0D\u662F\u5B57\u7B26\u4E32");
1970
+ }
1971
+ return {
1972
+ info: {
1973
+ department: employeeEntities(card.department),
1974
+ mobile: card.mobile ?? null,
1975
+ location: employeeEntities(card.location)
1976
+ },
1977
+ warnings: []
1978
+ };
1979
+ } catch (error) {
1980
+ if (error && typeof error === "object" && "type" in error && error.type === "authentication") throw error;
1981
+ return { info: null, warnings: ["\u5F53\u524D\u4EBA\u5458\u4FE1\u606F\u6682\u4E0D\u53EF\u7528\uFF0CemployeeInfo \u8FD4\u56DE null\uFF1B\u53D1\u7968\u7ED3\u679C\u4ECD\u6B63\u5E38\u8FD4\u56DE\u3002"] };
1982
+ }
1983
+ }
1984
+ async function readExpenseTypes(host, operation) {
1985
+ try {
1986
+ const result = await host.invoiceRequest({
1987
+ path: "/api/inc/syncFylx",
1988
+ method: "POST",
1989
+ operation,
1990
+ timeoutMs: EXPENSE_TYPE_TIMEOUT_MS,
1991
+ body: {
1992
+ start_pos: 0,
1993
+ page_size: 200,
1994
+ uc: 0,
1995
+ mask: 1023,
1996
+ req_base: { trace: String(Date.now()), dev: 1 }
1997
+ }
1998
+ });
1999
+ if (!Array.isArray(result?.infos)) {
2000
+ throw new Error("\u8D39\u7528\u7C7B\u578B\u5B57\u5178\u7F3A\u5C11 infos \u6570\u7EC4");
2001
+ }
2002
+ const names = /* @__PURE__ */ new Map();
2003
+ for (const row of result.infos) {
2004
+ const id = row?.fyid;
2005
+ const name = row?.fyn;
2006
+ if ((typeof id === "string" || typeof id === "number") && typeof name === "string" && name.trim()) {
2007
+ names.set(String(id), name);
2008
+ }
2009
+ }
2010
+ return { names, warnings: [] };
2011
+ } catch (error) {
2012
+ if (error instanceof InvoiceCliError && error.type === "authentication") throw error;
2013
+ return { names: null, warnings: ["\u8D39\u7528\u7C7B\u578B\u5B57\u5178\u6682\u4E0D\u53EF\u7528\uFF0Cfyn \u8FD4\u56DE null\uFF1B\u53D1\u7968\u548C\u76F8\u5173\u51ED\u8BC1\u4ECD\u6B63\u5E38\u8FD4\u56DE\u3002"] };
2014
+ }
2015
+ }
2016
+ async function readInvoicesWithMetadata(host, request, options = {}) {
2017
+ if (options.includePreApprovals !== void 0 && typeof options.includePreApprovals !== "boolean") {
2018
+ throw new InvoiceCliError("validation", "input_invalid", "includePreApprovals \u5FC5\u987B\u662F\u5E03\u5C14\u503C");
2019
+ }
2020
+ const [response, types, employee] = await Promise.all([
2021
+ host.invoiceRequest(request),
2022
+ readExpenseTypes(host, request.operation),
2023
+ readInvoiceEmployeeInfo(host, request.operation)
2024
+ ]);
2025
+ const missing = /* @__PURE__ */ new Set();
2026
+ const infos = Array.isArray(response?.infos) ? response.infos : [];
2027
+ for (const wrapper of infos) {
2028
+ const record4 = invoiceRecordOf(wrapper);
2029
+ const id = record4.fylx === void 0 || record4.fylx === null ? "" : String(record4.fylx);
2030
+ record4.fyn = types.names?.get(id) ?? null;
2031
+ record4.travel_ids = Array.isArray(record4.travel_ids) ? record4.travel_ids : [];
2032
+ if (id && types.names && record4.fyn === null) missing.add(id);
2033
+ }
2034
+ if (missing.size) {
2035
+ types.warnings.push(`\u8D39\u7528\u7C7B\u578B\u5B57\u5178\u672A\u5339\u914D ${missing.size} \u4E2A ID\uFF1A${[...missing].slice(0, 10).join("\u3001")}\uFF1B\u5BF9\u5E94 fyn \u8FD4\u56DE null\u3002`);
2036
+ }
2037
+ const approval = await readInvoicePreApprovals(host, {
2038
+ operation: request.operation,
2039
+ invoices: infos,
2040
+ includePreApprovals: options.includePreApprovals
2041
+ });
2042
+ return { response, employeeInfo: employee.info, preApprovals: approval.preApprovals, warnings: [...types.warnings, ...employee.warnings, ...approval.warnings] };
2043
+ }
2044
+
2045
+ // src/shortcuts/invoice/operations/shared.ts
1701
2046
  var LIST_FIELDS = /* @__PURE__ */ new Set([
1702
2047
  "page_size",
1703
2048
  "start_pos",
@@ -1906,7 +2251,7 @@ function detailFingerprint(info) {
1906
2251
  })).digest("hex");
1907
2252
  }
1908
2253
  function detailInfo(value) {
1909
- const item = Array.isArray(value?.infos) ? value.infos.find((candidate) => candidate?.ret?.ret === 0 && candidate.info) : void 0;
2254
+ const item = Array.isArray(value?.infos) ? value.infos.find((candidate2) => candidate2?.ret?.ret === 0 && candidate2.info) : void 0;
1910
2255
  if (!item) {
1911
2256
  throw new InvoiceCliError("api", "invoice_not_found", "\u672A\u627E\u5230\u6709\u6743\u67E5\u770B\u7684\u53D1\u7968", {
1912
2257
  details: { result: value },
@@ -1915,7 +2260,7 @@ function detailInfo(value) {
1915
2260
  }
1916
2261
  return item.info;
1917
2262
  }
1918
- async function getDetail(input, host) {
2263
+ function invoiceDetailRequest(input) {
1919
2264
  const body = {};
1920
2265
  if (input.fid !== void 0) body.ids = [asPositiveString(input.fid, "fid")];
1921
2266
  if (body.ids === void 0 && input.number !== void 0) {
@@ -1925,11 +2270,14 @@ async function getDetail(input, host) {
1925
2270
  body.number = input.number.trim();
1926
2271
  }
1927
2272
  if (!body.ids && !body.number) throw invoiceValidationError("input_invalid", "\u5FC5\u987B\u63D0\u4F9B fid \u6216 number");
1928
- return host.invoiceRequest({
2273
+ return {
1929
2274
  path: "/api/inc/get",
1930
2275
  method: "POST",
1931
2276
  body: { ...body, userFlag: "1", isDelFlag: "1", req_base: reqBase() }
1932
- });
2277
+ };
2278
+ }
2279
+ async function getDetail(input, host) {
2280
+ return host.invoiceRequest(invoiceDetailRequest(input));
1933
2281
  }
1934
2282
  function invoiceDetailUrl(baseUrl, fid) {
1935
2283
  return `${baseUrl.replace(/\/+$/, "")}/sp/inc/incDetail?fid=${fid}`;
@@ -1960,17 +2308,6 @@ function numberOrZero(value) {
1960
2308
  const parsed = Number(value);
1961
2309
  return Number.isFinite(parsed) ? parsed : 0;
1962
2310
  }
1963
- function assertBusinessSuccess(value, subtype, fallbackMessage) {
1964
- const result = value && typeof value === "object" ? value : {};
1965
- const code = result.code ?? result.res_base?.ret;
1966
- const failed = result.fail === true || result.status === false || code !== void 0 && code !== 0 && code !== 200;
1967
- if (!failed) return;
1968
- throw new InvoiceCliError("api", subtype, result.message || result.msg || result.res_base?.message || fallbackMessage, {
1969
- code,
1970
- details: { result },
1971
- exitCode: 1
1972
- });
1973
- }
1974
2311
  function uploadSource(input) {
1975
2312
  const { file, url } = input;
1976
2313
  if (file !== void 0 && url !== void 0) throw invoiceValidationError("input_ambiguous", "file \u4E0E url \u53EA\u80FD\u63D0\u4F9B\u4E00\u4E2A");
@@ -2181,8 +2518,8 @@ async function previewOcr(upload, host) {
2181
2518
  }
2182
2519
  return { results, invoices };
2183
2520
  }
2184
- function isRedReversedInvoice(record2) {
2185
- const raw = record2?.comm_info?.pro?.status;
2521
+ function isRedReversedInvoice(record4) {
2522
+ const raw = record4?.comm_info?.pro?.status;
2186
2523
  return (typeof raw === "number" ? raw : Number(raw ?? 0)) === 8;
2187
2524
  }
2188
2525
  async function listInvoices(input, host, flag) {
@@ -2197,23 +2534,31 @@ async function listInvoices(input, host, flag) {
2197
2534
  req_base: reqBase()
2198
2535
  };
2199
2536
  for (const [key, value] of Object.entries(input)) {
2200
- if (key === "flag") continue;
2537
+ if (key === "flag" || key === "includePreApprovals") continue;
2201
2538
  if (!LIST_FIELDS.has(key)) throw invoiceValidationError("input_field_unsupported", `\u5217\u8868\u67E5\u8BE2\u4E0D\u652F\u6301\u5B57\u6BB5\uFF1A${key}`);
2202
2539
  body[key] = normalizeListField(key, value);
2203
2540
  }
2204
2541
  const session = await host.getSession();
2205
- const result = await host.invoiceRequest({ path: "/api/inc/sync", method: "POST", body });
2542
+ const { response: result, employeeInfo, preApprovals, warnings } = await readInvoicesWithMetadata(host, {
2543
+ path: "/api/inc/sync",
2544
+ method: "POST",
2545
+ body,
2546
+ operation: flag === 6 ? "invoice.enterprise.list" : "invoice.list"
2547
+ }, { includePreApprovals: input.includePreApprovals });
2206
2548
  const items = (result.infos || []).filter((item) => !isRedReversedInvoice(invoiceRecordOf(item))).map((item) => {
2207
- const record2 = invoiceRecordOf(item);
2208
- if (record2.fid !== void 0) record2.id = record2.fid;
2209
- const fid = record2.fid ?? record2.id;
2210
- if (fid) record2.detailUrl = invoiceDetailUrl(session.baseUrl, String(fid));
2211
- record2.extInfo = invoiceExtInfo(record2);
2549
+ const record4 = invoiceRecordOf(item);
2550
+ if (record4.fid !== void 0) record4.id = record4.fid;
2551
+ const fid = record4.fid ?? record4.id;
2552
+ if (fid) record4.detailUrl = invoiceDetailUrl(session.baseUrl, String(fid));
2553
+ record4.extInfo = invoiceExtInfo(record4);
2212
2554
  return item;
2213
2555
  });
2214
2556
  return {
2215
2557
  status: "COMPLETE",
2558
+ warnings,
2216
2559
  data: {
2560
+ employeeInfo,
2561
+ preApprovals,
2217
2562
  items,
2218
2563
  total: result.total ?? 0,
2219
2564
  totalAmount: result.totalTn ?? "0",
@@ -2231,15 +2576,15 @@ function epochSeconds(value, name, options = {}) {
2231
2576
  if (Number.isInteger(value) && value >= 0) return value;
2232
2577
  throw invoiceValidationError("input_invalid", `${name} \u5FC5\u987B\u662F YYYY-MM-DD \u6216\u79D2\u7EA7\u65F6\u95F4\u6233`);
2233
2578
  }
2234
- const text5 = typeof value === "string" ? value.trim() : "";
2235
- if (DATE_PATTERN.test(text5)) {
2579
+ const text6 = typeof value === "string" ? value.trim() : "";
2580
+ if (DATE_PATTERN.test(text6)) {
2236
2581
  const clock = options.endOfDay ? "T23:59:59+08:00" : "T00:00:00+08:00";
2237
- const seconds = Math.floor(Date.parse(`${text5}${clock}`) / 1e3);
2582
+ const seconds = Math.floor(Date.parse(`${text6}${clock}`) / 1e3);
2238
2583
  if (!Number.isFinite(seconds)) throw invoiceValidationError("input_invalid", `${name} \u4E0D\u662F\u6709\u6548\u65E5\u671F`);
2239
2584
  return seconds;
2240
2585
  }
2241
- if (/^\d+$/u.test(text5)) {
2242
- const seconds = Number(text5);
2586
+ if (/^\d+$/u.test(text6)) {
2587
+ const seconds = Number(text6);
2243
2588
  if (Number.isSafeInteger(seconds)) return seconds;
2244
2589
  }
2245
2590
  throw invoiceValidationError("input_invalid", `${name} \u5FC5\u987B\u662F YYYY-MM-DD \u6216\u79D2\u7EA7\u65F6\u95F4\u6233`);
@@ -2573,7 +2918,7 @@ var InvoiceDeleteApplyOperation = class {
2573
2918
  let verified = false;
2574
2919
  try {
2575
2920
  const after = await getDetail({ fid: lease.fid }, host);
2576
- verified = !after?.infos?.some((candidate) => candidate?.ret?.ret === 0 && candidate.info);
2921
+ verified = !after?.infos?.some((candidate2) => candidate2?.ret?.ret === 0 && candidate2.info);
2577
2922
  } catch (error) {
2578
2923
  if (error instanceof InvoiceCliError && error.type === "api") verified = true;
2579
2924
  else {
@@ -2612,15 +2957,19 @@ var InvoiceDownloadOperation = class {
2612
2957
  var InvoiceGetOperation = class {
2613
2958
  name = "invoice.get";
2614
2959
  async execute(input, { host }) {
2960
+ const request = invoiceDetailRequest(input);
2615
2961
  const session = await host.getSession();
2616
- const result = await getDetail(input, host);
2962
+ const { response: result, employeeInfo, preApprovals, warnings } = await readInvoicesWithMetadata(host, { ...request, operation: this.name }, { includePreApprovals: input.includePreApprovals });
2617
2963
  const infos = Array.isArray(result?.infos) ? result.infos : [];
2618
2964
  for (const item of infos) {
2965
+ if (item?.info && typeof item.info === "object" && !Array.isArray(item.info)) {
2966
+ item.info.extInfo = invoiceExtInfo(item.info);
2967
+ }
2619
2968
  if (item?.info?.fid !== void 0) item.info.id = item.info.fid;
2620
2969
  const fid = item?.info?.fid ?? item?.info?.id;
2621
2970
  if (fid) item.detailUrl = invoiceDetailUrl(session.baseUrl, String(fid));
2622
2971
  }
2623
- return { status: "COMPLETE", data: result };
2972
+ return { status: "COMPLETE", data: { ...result, employeeInfo, preApprovals }, warnings };
2624
2973
  }
2625
2974
  };
2626
2975
 
@@ -2739,7 +3088,7 @@ var InvoiceImportApplyOperation = class {
2739
3088
  verified.push({ fid, info });
2740
3089
  } catch {
2741
3090
  throw invoicePartialError("\u5BFC\u5165\u5DF2\u8FD4\u56DE\u6210\u529F\uFF0C\u4F46\u8BE6\u60C5\u56DE\u67E5\u5931\u8D25\uFF0C\u7ED3\u679C\u4E0D\u786E\u5B9A", {
2742
- fids: succeeded.map((candidate) => String(candidate.info?.fid || candidate.info?.id)),
3091
+ fids: succeeded.map((candidate2) => String(candidate2.info?.fid || candidate2.info?.id)),
2743
3092
  result,
2744
3093
  workflow: workflow("invoice.import", "VERIFYING")
2745
3094
  }, { stage: "readback" });
@@ -2774,8 +3123,8 @@ var CUSTOMER_FIELD_TITLES = ["\u5BA2\u6237\u540D\u79F0", "\u6700\u7EC8\u7528\u62
2774
3123
  var CONTRACT_FILE_FIELD_TITLE = "\u5408\u540C\u6B63\u6587\u53CA\u9644\u4EF6";
2775
3124
  function textValue(value) {
2776
3125
  if (value === void 0 || value === null) return null;
2777
- const text5 = String(value).trim();
2778
- return text5 === "" ? null : text5;
3126
+ const text6 = String(value).trim();
3127
+ return text6 === "" ? null : text6;
2779
3128
  }
2780
3129
  function mainFields(data) {
2781
3130
  const details = data?.formData?.dataDetails;
@@ -2903,8 +3252,8 @@ function contractFilter(requestId) {
2903
3252
  }
2904
3253
  function textValue2(value) {
2905
3254
  if (value === void 0 || value === null) return null;
2906
- const text5 = String(value).trim();
2907
- return text5 === "" ? null : text5;
3255
+ const text6 = String(value).trim();
3256
+ return text6 === "" ? null : text6;
2908
3257
  }
2909
3258
  function firstText2(rows, field) {
2910
3259
  for (const row of rows) {
@@ -2922,12 +3271,12 @@ function sellerName(rows) {
2922
3271
  return null;
2923
3272
  }
2924
3273
  function amountCents(value, requestId) {
2925
- const text5 = textValue2(value)?.replace(/,/g, "") ?? null;
2926
- if (text5 === null) return 0;
2927
- if (!/^-?\d+(?:\.\d+)?$/u.test(text5)) {
2928
- throw new InvoiceCliError("api", "issuing_amount_invalid", `\u5408\u540C\u6D41\u7A0B ${requestId} \u7684\u5F00\u7968\u91D1\u989D\u4E0D\u662F\u6570\u5B57\uFF1A${text5}`, { exitCode: 1 });
3274
+ const text6 = textValue2(value)?.replace(/,/g, "") ?? null;
3275
+ if (text6 === null) return 0;
3276
+ if (!/^-?\d+(?:\.\d+)?$/u.test(text6)) {
3277
+ throw new InvoiceCliError("api", "issuing_amount_invalid", `\u5408\u540C\u6D41\u7A0B ${requestId} \u7684\u5F00\u7968\u91D1\u989D\u4E0D\u662F\u6570\u5B57\uFF1A${text6}`, { exitCode: 1 });
2929
3278
  }
2930
- return Math.round(Number(text5) * 100);
3279
+ return Math.round(Number(text6) * 100);
2931
3280
  }
2932
3281
  function formatCents(cents) {
2933
3282
  return (cents / 100).toFixed(2);
@@ -3048,6 +3397,129 @@ var InvoiceIssuingContractsListOperation = class {
3048
3397
  }
3049
3398
  };
3050
3399
 
3400
+ // src/shortcuts/invoice/operations/issuing-red-requests.ts
3401
+ var REQUEST_BROWSER_PATH = "/api/workflow/core/common/browser/data/wfcRequest";
3402
+ var BLUE_INVOICE_WORKFLOW = {
3403
+ fixedVersionId: "100003460000000214",
3404
+ versionid: 1,
3405
+ relateFormTypes: [],
3406
+ // E10 IDs exceed Number.MAX_SAFE_INTEGER; keep the original decimal text.
3407
+ subCompanyId: "6998005497747218000",
3408
+ activeWfId: "100003460000000214",
3409
+ name: "\u5408\u540C\u6536\u6B3E\u53D1\u7968\u5F00\u5177\u53CA\u5FEB\u9012\u7533\u8BF7",
3410
+ moduleName: "workflow",
3411
+ formIds: ["100004030000000086"],
3412
+ id: "100003460000000214",
3413
+ workflowtype: "100501980000000032",
3414
+ workflowTypeName: "\u7C7B\u578B\uFF1A\u9879\u76EE\u7BA1\u7406",
3415
+ status: 1
3416
+ };
3417
+ function invalidResponse() {
3418
+ throw new InvoiceCliError("api", "issuing_red_requests_invalid", "\u67E5\u8BE2\u84DD\u5B57\u5F00\u7968\u7533\u8BF7\u8FD4\u56DE\u7684\u6570\u636E\u683C\u5F0F\u4E0D\u6B63\u786E\uFF0C\u65E0\u6CD5\u786E\u8BA4\u7EA2\u51B2\u5019\u9009", { exitCode: 1 });
3419
+ }
3420
+ function record2(value) {
3421
+ if (!value || typeof value !== "object" || Array.isArray(value)) return invalidResponse();
3422
+ return value;
3423
+ }
3424
+ function textValue3(row, ...keys) {
3425
+ for (const key of keys) {
3426
+ const value = row[key];
3427
+ if (typeof value === "string" && value.trim()) return value.trim();
3428
+ if (typeof value === "number" && Number.isSafeInteger(value)) return String(value);
3429
+ }
3430
+ return null;
3431
+ }
3432
+ function booleanValue(row, ...keys) {
3433
+ for (const key of keys) {
3434
+ if (typeof row[key] === "boolean") return row[key];
3435
+ }
3436
+ return null;
3437
+ }
3438
+ function requestIdOf2(row) {
3439
+ const raw = row.requestid ?? row.requestId ?? row.id;
3440
+ if (typeof raw === "number" && !Number.isSafeInteger(raw)) return invalidResponse();
3441
+ const id = typeof raw === "string" ? raw.trim() : typeof raw === "number" ? String(raw) : "";
3442
+ if (!/^[1-9]\d*$/u.test(id)) return invalidResponse();
3443
+ return id;
3444
+ }
3445
+ function normalizeRequest(value) {
3446
+ const row = record2(value);
3447
+ return {
3448
+ requestId: requestIdOf2(row),
3449
+ requestName: textValue3(row, "requestname", "requestName", "title", "name"),
3450
+ title: textValue3(row, "title"),
3451
+ name: textValue3(row, "name"),
3452
+ requestMark: textValue3(row, "requestmark", "requestMark"),
3453
+ workflowId: textValue3(row, "workflowid", "workflowId"),
3454
+ workflowName: textValue3(row, "workflowname", "workflowName"),
3455
+ flowStatus: textValue3(row, "flowstatus", "flowStatus"),
3456
+ flowStatusCode: textValue3(row, "flowstatuscode", "flowStatusCode"),
3457
+ creator: textValue3(row, "creater", "creator", "creatername", "creatorName"),
3458
+ creatorId: textValue3(row, "createrid", "creatorId"),
3459
+ createTime: textValue3(row, "createdatetime", "createTime", "createDateTime"),
3460
+ finished: booleanValue(row, "isComplete", "finished", "finish")
3461
+ };
3462
+ }
3463
+ function positiveInteger(value, name, defaultValue, maximum = Number.MAX_SAFE_INTEGER) {
3464
+ if (value === void 0) return defaultValue;
3465
+ if (typeof value !== "number" || !Number.isSafeInteger(value) || value < 1 || value > maximum) {
3466
+ throw invoiceValidationError("input_invalid", `${name} \u5FC5\u987B\u662F 1 \u5230 ${maximum} \u4E4B\u95F4\u7684\u6574\u6570`);
3467
+ }
3468
+ return value;
3469
+ }
3470
+ function pagination(root, data, current, pageSize, count) {
3471
+ const rawTotal = data.total ?? root.total;
3472
+ let total;
3473
+ if (rawTotal !== void 0 && rawTotal !== null) {
3474
+ if (typeof rawTotal !== "number" || !Number.isSafeInteger(rawTotal) || rawTotal < 0) return invalidResponse();
3475
+ total = rawTotal;
3476
+ }
3477
+ const explicitHasMore = data.hasMore ?? root.hasMore;
3478
+ if (explicitHasMore !== void 0 && explicitHasMore !== null && typeof explicitHasMore !== "boolean") return invalidResponse();
3479
+ return {
3480
+ current,
3481
+ pageSize,
3482
+ hasMore: typeof explicitHasMore === "boolean" ? explicitHasMore : total !== void 0 ? current < Math.ceil(total / pageSize) : count >= pageSize,
3483
+ ...total !== void 0 ? { total } : {}
3484
+ };
3485
+ }
3486
+ var InvoiceIssuingRedRequestsListOperation = class {
3487
+ name = "invoice.issuing.red.requests.list";
3488
+ async execute(input, { host }) {
3489
+ const customerName = asNonEmptyString(input.customerName, "customerName");
3490
+ const current = positiveInteger(input.current, "current", 1);
3491
+ const pageSize = positiveInteger(input.pageSize, "pageSize", 10, 100);
3492
+ const result = await host.invoiceRequest({
3493
+ path: REQUEST_BROWSER_PATH,
3494
+ method: "POST",
3495
+ body: {
3496
+ browserMultiple: true,
3497
+ currentTab: "all",
3498
+ current,
3499
+ pageSize,
3500
+ formDatas: {
3501
+ workflowid: [{ term: "in", browserDatas: [{ ...BLUE_INVOICE_WORKFLOW }] }]
3502
+ },
3503
+ quickSearchDatas: { requestname: customerName, requestmark: customerName }
3504
+ },
3505
+ operation: this.name
3506
+ });
3507
+ assertBusinessSuccess(result, "issuing_red_requests_query_failed", "\u67E5\u8BE2\u84DD\u5B57\u5F00\u7968\u7533\u8BF7\u5931\u8D25");
3508
+ const root = record2(result);
3509
+ const data = record2(root.data);
3510
+ if (!Array.isArray(data.data)) return invalidResponse();
3511
+ const items = data.data.map(normalizeRequest);
3512
+ return {
3513
+ status: "COMPLETE",
3514
+ data: {
3515
+ items,
3516
+ count: items.length,
3517
+ ...pagination(root, data, current, pageSize, items.length)
3518
+ }
3519
+ };
3520
+ }
3521
+ };
3522
+
3051
3523
  // src/shortcuts/invoice/operations/list.ts
3052
3524
  var InvoiceListOperation = class {
3053
3525
  constructor(name, flag) {
@@ -3118,33 +3590,12 @@ function optionalString(value, name) {
3118
3590
  return asNonEmptyString(value, name);
3119
3591
  }
3120
3592
  function optionalDate(value, name) {
3121
- const text5 = optionalString(value, name);
3122
- if (text5 === void 0) return void 0;
3123
- if (!/^\d{4}-\d{2}-\d{2}$/u.test(text5)) {
3593
+ const text6 = optionalString(value, name);
3594
+ if (text6 === void 0) return void 0;
3595
+ if (!/^\d{4}-\d{2}-\d{2}$/u.test(text6)) {
3124
3596
  throw invoiceValidationError("input_invalid", `${name} \u5FC5\u987B\u662F YYYY-MM-DD`);
3125
3597
  }
3126
- return text5;
3127
- }
3128
- function formatUtcDate(date) {
3129
- const y = date.getUTCFullYear();
3130
- const m = String(date.getUTCMonth() + 1).padStart(2, "0");
3131
- const d = String(date.getUTCDate()).padStart(2, "0");
3132
- return `${y}-${m}-${d}`;
3133
- }
3134
- function addCalendarDays(isoDate, offsetDays) {
3135
- const [year, month, day] = isoDate.split("-").map(Number);
3136
- return formatUtcDate(new Date(Date.UTC(year, (month ?? 1) - 1, (day ?? 1) + offsetDays)));
3137
- }
3138
- function addCalendarMonths(isoDate, offsetMonths) {
3139
- const [year, month, day] = isoDate.split("-").map(Number);
3140
- const target = new Date(Date.UTC(year, (month ?? 1) - 1 + offsetMonths, 1));
3141
- const lastDay = new Date(Date.UTC(target.getUTCFullYear(), target.getUTCMonth() + 1, 0)).getUTCDate();
3142
- target.setUTCDate(Math.min(day ?? 1, lastDay));
3143
- return formatUtcDate(target);
3144
- }
3145
- function shanghaiCalendarDate(offsetDays = 0, now = /* @__PURE__ */ new Date()) {
3146
- const today = new Intl.DateTimeFormat("en-CA", { timeZone: "Asia/Shanghai" }).format(now);
3147
- return offsetDays === 0 ? today : addCalendarDays(today, offsetDays);
3598
+ return text6;
3148
3599
  }
3149
3600
  var REQUEST_DEFAULT_LOOKBACK_DAYS = 7;
3150
3601
  var REQUEST_PHONE_LOOKBACK_DAYS = 90;
@@ -3189,45 +3640,9 @@ function projectRequestListItem(item) {
3189
3640
  }
3190
3641
  function projectRequestListResult(value) {
3191
3642
  if (!value || typeof value !== "object" || Array.isArray(value)) return value;
3192
- const record2 = value;
3193
- if (!Array.isArray(record2.data)) return value;
3194
- return { ...record2, data: record2.data.map(projectRequestListItem) };
3195
- }
3196
- var UNSAFE_JSON_INTEGER_ID = /("id"\s*:\s*)(-?\d{16,})(?=\s*[,}\]])/g;
3197
- function quoteEmployeeIdsInJsonText(text5) {
3198
- return text5.replace(UNSAFE_JSON_INTEGER_ID, '$1"$2"');
3199
- }
3200
- function employeeIdString(value) {
3201
- if (typeof value === "bigint") return value.toString();
3202
- if (typeof value === "number" && Number.isFinite(value)) return String(Math.trunc(value));
3203
- if (typeof value === "string") return value;
3204
- return value;
3205
- }
3206
- function stringifyEmployeeRecordId(employee) {
3207
- if (!employee || typeof employee !== "object" || Array.isArray(employee)) return employee;
3208
- const record2 = employee;
3209
- if (!("id" in record2)) return employee;
3210
- return { ...record2, id: employeeIdString(record2.id) };
3211
- }
3212
- function stringifyEmployeeSuperiorsPayload(payload) {
3213
- if ("currentEmployee" in payload) {
3214
- payload.currentEmployee = stringifyEmployeeRecordId(payload.currentEmployee);
3215
- }
3216
- if (Array.isArray(payload.allSuperiors)) {
3217
- payload.allSuperiors = payload.allSuperiors.map(stringifyEmployeeRecordId);
3218
- }
3219
- }
3220
- function stringifyEmployeeSuperiorsIds(value) {
3221
- if (!value || typeof value !== "object") return value;
3222
- const cloned = structuredClone(value);
3223
- stringifyEmployeeSuperiorsPayload(cloned);
3224
- if (cloned.data && typeof cloned.data === "object" && !Array.isArray(cloned.data)) {
3225
- stringifyEmployeeSuperiorsPayload(cloned.data);
3226
- }
3227
- return cloned;
3228
- }
3229
- function employeeSuperiorsEnvelope(value) {
3230
- return resultEnvelope(stringifyEmployeeSuperiorsIds(value), "invoice.reim.employee-superiors");
3643
+ const record4 = value;
3644
+ if (!Array.isArray(record4.data)) return value;
3645
+ return { ...record4, data: record4.data.map(projectRequestListItem) };
3231
3646
  }
3232
3647
  var InvoiceReimFileOcrPreviewOperation = class {
3233
3648
  name = "invoice.reim.file-ocr.preview";
@@ -3317,65 +3732,6 @@ var InvoiceReimWorkflowResolveOperation = class {
3317
3732
  return resultEnvelope(result, "invoice.reim.workflow.resolve");
3318
3733
  }
3319
3734
  };
3320
- var InvoiceReimEmployeeSuperiorsOperation = class {
3321
- name = "invoice.reim.employee-superiors";
3322
- async execute(_input, { host }) {
3323
- const result = await host.invoiceRequest({
3324
- path: "/api/inc/book/getEmployeeSuperiors",
3325
- method: "GET",
3326
- operation: this.name,
3327
- rewriteJsonText: quoteEmployeeIdsInJsonText
3328
- });
3329
- return employeeSuperiorsEnvelope(result);
3330
- }
3331
- };
3332
- function projectFieldSearchItems(value) {
3333
- const raw = Array.isArray(value) ? value : [];
3334
- const items = [];
3335
- const seen = /* @__PURE__ */ new Set();
3336
- for (const item of raw) {
3337
- const record2 = item && typeof item === "object" && !Array.isArray(item) ? item : {};
3338
- const id = String(record2.id ?? record2.value ?? "").trim();
3339
- const name = String(record2.name ?? "").trim();
3340
- if (!id || !name || seen.has(id)) continue;
3341
- seen.add(id);
3342
- items.push({ id, name, value: id });
3343
- }
3344
- return items;
3345
- }
3346
- var InvoiceReimFieldSearchOperation = class {
3347
- name = "invoice.reim.field.search";
3348
- async execute(input, { host }) {
3349
- const keywords = asNonEmptyString(input.keywords, "keywords");
3350
- const result = await host.invoiceRequest({
3351
- path: "/api/government/formStructure/fieldRelateSearch",
3352
- method: "GET",
3353
- query: {
3354
- keywords,
3355
- fieldId: asNonEmptyString(input.fieldId, "fieldId"),
3356
- formModeType: "wf",
3357
- workflowId: asNonEmptyString(input.workflowId, "workflowId"),
3358
- nodeId: optionalString(input.nodeId, "nodeId") || "100004140000000271"
3359
- },
3360
- operation: this.name
3361
- });
3362
- assertBusinessSuccess(result, "invoice.reim.field.search_failed", "\u641C\u7D22\u5173\u8054\u5B57\u6BB5\u5931\u8D25");
3363
- const items = projectFieldSearchItems(responseData(result));
3364
- const match = items.length === 0 ? "none" : items.length === 1 ? "unique" : "multiple";
3365
- return {
3366
- status: "COMPLETE",
3367
- data: {
3368
- result,
3369
- data: items,
3370
- keywords,
3371
- match,
3372
- items,
3373
- selected: match === "unique" ? items[0] : null,
3374
- workflow: workflow(this.name, "COMPLETE")
3375
- }
3376
- };
3377
- }
3378
- };
3379
3735
 
3380
3736
  // src/shortcuts/invoice/operations/reim-auto.ts
3381
3737
  var MONEY_PATTERN2 = /^-?\d+(?:\.\d{1,2})?$/u;
@@ -3426,6 +3782,9 @@ function reimRequestNames(info) {
3426
3782
  function candidateItem(info) {
3427
3783
  const pro = info?.comm_info?.pro || {};
3428
3784
  const price = info?.comm_info?.price || {};
3785
+ const extInfo = invoiceExtInfo(info);
3786
+ const consumptionTime = info?.modify_info?.cstm;
3787
+ const hasConsumptionTime = typeof consumptionTime === "number" || typeof consumptionTime === "string" && consumptionTime.trim().length > 0;
3429
3788
  return {
3430
3789
  fid: invoiceRecordId(info),
3431
3790
  number: String(info.number ?? ""),
@@ -3434,6 +3793,10 @@ function candidateItem(info) {
3434
3793
  buyer: String(info?.comm_info?.buyer?.company ?? ""),
3435
3794
  payer: String(info?.comm_info?.payer?.company ?? ""),
3436
3795
  typeName: String(pro.cname ?? ""),
3796
+ content: String(pro.content ?? "").trim() || extInfo.content || "",
3797
+ extInfo,
3798
+ ...hasConsumptionTime ? { consumptionTime } : {},
3799
+ travel_ids: Array.isArray(info.travel_ids) ? info.travel_ids : [],
3437
3800
  status: typeof pro.status === "number" ? pro.status : Number(pro.status ?? 0),
3438
3801
  valid: typeof pro.valid === "number" ? pro.valid : Number(pro.valid ?? 0),
3439
3802
  reimRequests: reimRequestNames(info)
@@ -3442,6 +3805,9 @@ function candidateItem(info) {
3442
3805
  var InvoiceReimCandidatesListOperation = class {
3443
3806
  name = "invoice.reim.candidates.list";
3444
3807
  async execute(input, { host }) {
3808
+ if (input.includePreApprovals !== void 0 && typeof input.includePreApprovals !== "boolean") {
3809
+ throw invoiceValidationError("input_invalid", "includePreApprovals \u5FC5\u987B\u662F\u5E03\u5C14\u503C");
3810
+ }
3445
3811
  const pageSize = boundedInteger(input.page_size, "page_size", { min: 10, max: 200, defaultValue: 50 });
3446
3812
  const maxItems = boundedInteger(input.max_items, "max_items", { min: 1, max: 500, defaultValue: 200 });
3447
3813
  const dateBegin = optionalEpochSeconds(input.date_begin, "date_begin");
@@ -3460,6 +3826,7 @@ var InvoiceReimCandidatesListOperation = class {
3460
3826
  let hasMore = false;
3461
3827
  let startPos = 0;
3462
3828
  let pulled = 0;
3829
+ let employee;
3463
3830
  do {
3464
3831
  const body = {
3465
3832
  flag: 0,
@@ -3468,17 +3835,31 @@ var InvoiceReimCandidatesListOperation = class {
3468
3835
  req_type: 1,
3469
3836
  sreim: "3",
3470
3837
  bill_type: 0,
3838
+ mext: FULL_EXT_MASK,
3471
3839
  req_base: reqBase()
3472
3840
  };
3473
3841
  if (dateBegin !== void 0) body.date_begin = dateBegin;
3474
3842
  if (dateEnd !== void 0) body.date_end = dateEnd;
3475
3843
  if (consumptionBegin !== void 0) body.consumption_tm_begin = consumptionBegin;
3476
3844
  if (consumptionEnd !== void 0) body.consumption_tm_end = consumptionEnd;
3477
- const result = await host.invoiceRequest({ path: "/api/inc/sync", method: "POST", body, operation: this.name });
3845
+ const request = { path: "/api/inc/sync", method: "POST", body, operation: this.name };
3846
+ let result;
3847
+ if (!employee) {
3848
+ const [response, employeeResult] = await Promise.all([
3849
+ host.invoiceRequest(request),
3850
+ readInvoiceEmployeeInfo(host, this.name)
3851
+ ]);
3852
+ result = response;
3853
+ employee = employeeResult;
3854
+ warnings.push(...employee.warnings);
3855
+ } else {
3856
+ result = await host.invoiceRequest(request);
3857
+ }
3478
3858
  total = Number(result?.total ?? 0);
3479
3859
  const infos = Array.isArray(result?.infos) ? result.infos : [];
3480
- for (const info of infos) {
3860
+ for (const raw of infos) {
3481
3861
  pulled += 1;
3862
+ const info = invoiceRecordOf(raw);
3482
3863
  if (isRedReversedInvoice(info)) continue;
3483
3864
  kept.push(info);
3484
3865
  }
@@ -3508,6 +3889,12 @@ var InvoiceReimCandidatesListOperation = class {
3508
3889
  availableAmount: summarize(available),
3509
3890
  assignedAmount: summarize(assigned)
3510
3891
  };
3892
+ const approval = await readInvoicePreApprovals(host, {
3893
+ operation: this.name,
3894
+ invoices: capped,
3895
+ includePreApprovals: input.includePreApprovals
3896
+ });
3897
+ warnings.push(...approval.warnings);
3511
3898
  return {
3512
3899
  status: "COMPLETE",
3513
3900
  data: {
@@ -3517,6 +3904,8 @@ var InvoiceReimCandidatesListOperation = class {
3517
3904
  available,
3518
3905
  assigned,
3519
3906
  summary,
3907
+ employeeInfo: employee?.info ?? null,
3908
+ preApprovals: approval.preApprovals,
3520
3909
  warnings,
3521
3910
  workflow: workflow(this.name, "COMPLETE")
3522
3911
  }
@@ -3524,25 +3913,117 @@ var InvoiceReimCandidatesListOperation = class {
3524
3913
  }
3525
3914
  };
3526
3915
 
3916
+ // src/shortcuts/invoice/operations/reim-customer-projects.ts
3917
+ var CUSTOMER_PROJECT_NAME_FIELD = "1020275734718578690";
3918
+ var PAGE_ID2 = "1144658644836794483";
3919
+ var APP_ID = "1136121637129502949";
3920
+ var COMP_ID2 = "f5b2b31aeb2e4e46956464bba7d2e52c";
3921
+ var PAGE_SIZE2 = 10;
3922
+ var MAX_PAGES2 = 20;
3923
+ function projectFilter(customerId) {
3924
+ return [{
3925
+ conditionType: "and",
3926
+ dataType: "field",
3927
+ value: customerId,
3928
+ filterFields: [{
3929
+ compType: "Ebuilder",
3930
+ dataset: {
3931
+ id: "1020275562853482532",
3932
+ text: "\u9879\u76EE\u57FA\u7840",
3933
+ type: "LOGIC",
3934
+ groupId: "weaver-ebuilder-form-service",
3935
+ isPhysical: true,
3936
+ usage: "all",
3937
+ detailTable: false,
3938
+ objType: "physical",
3939
+ module: "ebuilder",
3940
+ appId: "1020021532740116481",
3941
+ ebuilderDataConfig: { dataSetup: { dataSource: "ALL", dataPermission: "HAVE_PERMISSION_DATA", dataType: "ALL" }, type: "FORM" },
3942
+ isFormModuleSelected: true,
3943
+ hasChangeGroupFilter: false,
3944
+ hasChangePermissions: true,
3945
+ hasChangeExtConfig: false
3946
+ },
3947
+ fieldName: "field_1149506138249011280",
3948
+ id: "1149506138249011280",
3949
+ objId: "1020275562853482532",
3950
+ type: "Ebuilder",
3951
+ text: "\u5173\u8054\u5BA2\u6237"
3952
+ }]
3953
+ }];
3954
+ }
3955
+ function projectError(subtype, message) {
3956
+ return new InvoiceCliError("api", subtype, message, { exitCode: 1 });
3957
+ }
3958
+ function project(value) {
3959
+ const row = value && typeof value === "object" && !Array.isArray(value) ? value : null;
3960
+ if (!row || typeof row.form_data_id !== "string" || !/^[1-9]\d*$/u.test(row.form_data_id) || typeof row[CUSTOMER_PROJECT_NAME_FIELD] !== "string" || !row[CUSTOMER_PROJECT_NAME_FIELD].trim()) {
3961
+ throw projectError("reim_customer_projects_invalid", "\u5BA2\u6237\u9879\u76EE\u67E5\u8BE2\u8FD4\u56DE\u4E86\u65E0\u6548\u7684\u9879\u76EE ID \u6216\u9879\u76EE\u540D\u79F0");
3962
+ }
3963
+ return { relatedProjectName: row[CUSTOMER_PROJECT_NAME_FIELD], relatedProjectId: row.form_data_id };
3964
+ }
3965
+ async function readInvoiceCustomerProjects(host, customerId, operation, deadline, cancelled = () => false) {
3966
+ const projects = /* @__PURE__ */ new Map();
3967
+ const seenPages = /* @__PURE__ */ new Set();
3968
+ for (let pageNo = 1; pageNo <= MAX_PAGES2; pageNo += 1) {
3969
+ if (cancelled()) throw projectError("reim_customer_projects_incomplete", "\u5BA2\u6237\u9879\u76EE\u67E5\u8BE2\u5DF2\u505C\u6B62");
3970
+ const remaining = deadline - Date.now();
3971
+ if (remaining <= 0) throw projectError("reim_customer_projects_incomplete", "\u5BA2\u6237\u9879\u76EE\u67E5\u8BE2\u8FBE\u5230\u672C\u6B21\u67E5\u8BE2\u65F6\u95F4\u4E0A\u9650\uFF0C\u9879\u76EE\u5019\u9009\u672A\u8BFB\u5B8C\u6574");
3972
+ const result = await host.invoiceMultipartRequest({
3973
+ path: "/api/ebuilder/form/eblist/getData",
3974
+ method: "POST",
3975
+ operation,
3976
+ timeoutMs: Math.min(5e3, remaining),
3977
+ headers: {
3978
+ ebbusinessid: PAGE_ID2,
3979
+ langtype: "zh_CN",
3980
+ pragma: "no-cache",
3981
+ priority: "u=1, i",
3982
+ timezoneoffset: "-480",
3983
+ Accept: "*/*"
3984
+ },
3985
+ fields: {
3986
+ [`appId_${PAGE_ID2}`]: APP_ID,
3987
+ filter: projectFilter(customerId),
3988
+ pageAppId: APP_ID,
3989
+ compId: COMP_ID2,
3990
+ pageId: PAGE_ID2,
3991
+ pageNo: String(pageNo),
3992
+ pageSize: String(PAGE_SIZE2)
3993
+ }
3994
+ });
3995
+ assertBusinessSuccess(result, "reim_customer_projects_failed", "\u67E5\u8BE2\u5BA2\u6237\u76F8\u5173\u9879\u76EE\u5931\u8D25");
3996
+ const data = result?.data;
3997
+ if (!data || !Array.isArray(data.list)) throw projectError("reim_customer_projects_invalid", "\u5BA2\u6237\u9879\u76EE\u67E5\u8BE2\u672A\u8FD4\u56DE data.list \u6570\u7EC4");
3998
+ const page = data.list.map(project);
3999
+ const signature2 = JSON.stringify(page.map((item) => item.relatedProjectId).sort());
4000
+ if (seenPages.has(signature2)) throw projectError("reim_customer_projects_incomplete", "\u5BA2\u6237\u9879\u76EE\u67E5\u8BE2\u8FD4\u56DE\u91CD\u590D\u9875\uFF0C\u65E0\u6CD5\u786E\u8BA4\u5B8C\u6574\u9879\u76EE\u5019\u9009");
4001
+ seenPages.add(signature2);
4002
+ for (const item of page) {
4003
+ if (!projects.has(item.relatedProjectId)) projects.set(item.relatedProjectId, item);
4004
+ }
4005
+ if (data.list.length < PAGE_SIZE2) return [...projects.values()];
4006
+ }
4007
+ throw projectError("reim_customer_projects_incomplete", "\u5BA2\u6237\u9879\u76EE\u67E5\u8BE2\u8FBE\u5230 20 \u9875\u4E0A\u9650\uFF0C\u9879\u76EE\u5019\u9009\u672A\u8BFB\u5B8C\u6574");
4008
+ }
4009
+
3527
4010
  // src/shortcuts/invoice/operations/reim-customer.ts
3528
4011
  var CUSTOMER_PAGE_ID = "1218181956452048911";
3529
4012
  var CUSTOMER_COMP_ID = "c39b9e14c0034336adf9e9bc39aeed75";
3530
4013
  var CUSTOMER_OBJECT_ID = "1173221220888059964";
3531
4014
  var CUSTOMER_NAME_FIELD = "1173221220888062665";
3532
4015
  var CUSTOMER_BEARER_FIELD = "1173221220888062667";
4016
+ var CUSTOMER_PAGE_SIZE = 10;
4017
+ var CUSTOMER_MAX_PAGES = 20;
3533
4018
  function customerFilter(keywords) {
3534
4019
  return [
3535
4020
  {
3536
4021
  conditionType: "or",
3537
4022
  dataType: "field",
3538
- id: "f9bf956948e54ed58ac32988ff8a84c8",
3539
- conditionComId: `${CUSTOMER_COMP_ID}_quick_EXCLUDECACHE`,
3540
4023
  filterFields: [{
3541
- compId: CUSTOMER_COMP_ID,
3542
4024
  compType: "Text",
3543
4025
  dataset: {
3544
4026
  isPhysical: true,
3545
- ebuilderDataConfig: { dataSetup: {}, type: "FORM" },
3546
4027
  detailTable: false,
3547
4028
  groupId: "weaver-ebuilder-form-service",
3548
4029
  usage: "all",
@@ -3554,55 +4035,48 @@ function customerFilter(keywords) {
3554
4035
  },
3555
4036
  fieldName: `field_${CUSTOMER_NAME_FIELD}`,
3556
4037
  id: CUSTOMER_NAME_FIELD,
3557
- objId: CUSTOMER_OBJECT_ID,
3558
- type: "String",
3559
- text: "\u540D\u79F0"
4038
+ objId: CUSTOMER_OBJECT_ID
3560
4039
  }],
3561
4040
  value: keywords
3562
- },
3563
- {
3564
- conditionComId: `${CUSTOMER_COMP_ID}_filter_EXCLUDECACHE`,
3565
- conditionType: "and",
3566
- dataType: "classification",
3567
- useConfig: true
3568
4041
  }
3569
4042
  ];
3570
4043
  }
3571
- function invalidResponse() {
4044
+ function invalidResponse2() {
3572
4045
  throw new InvoiceCliError("api", "reim_customer_search_invalid", "\u5BA2\u6237\u67E5\u8BE2\u8FD4\u56DE\u7684\u6570\u636E\u683C\u5F0F\u4E0D\u6B63\u786E\uFF0C\u65E0\u6CD5\u786E\u8BA4\u76F8\u5173\u5BA2\u6237\u548C\u627F\u62C5\u4E3B\u4F53", { exitCode: 1 });
3573
4046
  }
3574
- function record(value) {
3575
- if (!value || typeof value !== "object" || Array.isArray(value)) return invalidResponse();
4047
+ function record3(value) {
4048
+ if (!value || typeof value !== "object" || Array.isArray(value)) return invalidResponse2();
3576
4049
  return value;
3577
4050
  }
3578
4051
  function responseString(value) {
3579
- if (typeof value !== "string" || !value.trim()) return invalidResponse();
4052
+ if (typeof value !== "string" || !value.trim()) return invalidResponse2();
3580
4053
  return value;
3581
4054
  }
4055
+ function responseId(value) {
4056
+ const id = responseString(value);
4057
+ if (!/^[1-9]\d*$/u.test(id)) return invalidResponse2();
4058
+ return id;
4059
+ }
3582
4060
  function projectCustomer(value) {
3583
- const row = record(value);
4061
+ const row = record3(value);
3584
4062
  const bearers = row[CUSTOMER_BEARER_FIELD] ?? [];
3585
- if (!Array.isArray(bearers)) return invalidResponse();
4063
+ if (!Array.isArray(bearers)) return invalidResponse2();
3586
4064
  return {
3587
- id: responseString(row.id),
3588
- [CUSTOMER_NAME_FIELD]: responseString(row[CUSTOMER_NAME_FIELD]),
3589
- [CUSTOMER_BEARER_FIELD]: bearers.map((value2) => {
3590
- const bearer = record(value2);
4065
+ customerId: responseId(row.form_data_id ?? row.id),
4066
+ customerName: responseString(row[CUSTOMER_NAME_FIELD]),
4067
+ expenseBearer: bearers.map((value2) => {
4068
+ const bearer = record3(value2);
3591
4069
  return {
3592
- name: responseString(bearer.name),
3593
- id: responseString(bearer.id),
3594
- type: responseString(bearer.type)
4070
+ expenseBearerName: responseString(bearer.name),
4071
+ expenseBearerId: responseId(bearer.id)
3595
4072
  };
3596
4073
  })
3597
4074
  };
3598
4075
  }
3599
- var InvoiceReimCustomerSearchOperation = class {
3600
- name = "invoice.reim.customer.search";
3601
- async execute(input, { host }) {
3602
- if (Object.keys(input).some((key) => key !== "keywords")) {
3603
- throw invoiceValidationError("input_invalid", "\u5BA2\u6237\u67E5\u8BE2\u53EA\u63A5\u53D7 keywords\uFF0C\u5176\u4ED6\u67E5\u8BE2\u53C2\u6570\u56FA\u5B9A");
3604
- }
3605
- const keywords = asNonEmptyString(input.keywords, "keywords");
4076
+ async function searchInvoiceCustomers(host, keywords, operation) {
4077
+ const customers = /* @__PURE__ */ new Map();
4078
+ const seenPages = /* @__PURE__ */ new Set();
4079
+ for (let pageNo = 1; pageNo <= CUSTOMER_MAX_PAGES; pageNo += 1) {
3606
4080
  const result = await host.invoiceMultipartRequest({
3607
4081
  path: "/api/ebuilder/coms/nlist/getData",
3608
4082
  method: "POST",
@@ -3618,15 +4092,65 @@ var InvoiceReimCustomerSearchOperation = class {
3618
4092
  filter: customerFilter(keywords),
3619
4093
  compId: CUSTOMER_COMP_ID,
3620
4094
  pageId: CUSTOMER_PAGE_ID,
3621
- pageNo: "1",
3622
- tableuid: "d26c94cc9c234d7da9bc2d399339a439"
4095
+ pageNo: String(pageNo),
4096
+ pageSize: String(CUSTOMER_PAGE_SIZE)
3623
4097
  },
3624
- operation: this.name
4098
+ timeoutMs: 5e3,
4099
+ operation
3625
4100
  });
3626
4101
  assertBusinessSuccess(result, "reim_customer_search_failed", "\u641C\u7D22\u76F8\u5173\u5BA2\u6237\u5931\u8D25");
3627
- const list = record(record(result).data).list;
3628
- if (!Array.isArray(list)) return invalidResponse();
3629
- return { status: "COMPLETE", data: { list: list.map(projectCustomer) } };
4102
+ const list = record3(record3(result).data).list;
4103
+ if (!Array.isArray(list)) return invalidResponse2();
4104
+ const page = list.map(projectCustomer);
4105
+ const signature2 = JSON.stringify(page.map((customer) => customer.customerId).sort());
4106
+ if (seenPages.has(signature2)) {
4107
+ throw new InvoiceCliError("api", "reim_customer_search_incomplete", "\u5BA2\u6237\u67E5\u8BE2\u8FD4\u56DE\u91CD\u590D\u9875\uFF0C\u65E0\u6CD5\u786E\u8BA4\u5B8C\u6574\u5019\u9009\uFF0C\u8BF7\u7F29\u5C0F\u5BA2\u6237\u540D\u79F0\u8303\u56F4", { exitCode: 1 });
4108
+ }
4109
+ seenPages.add(signature2);
4110
+ for (const customer of page) {
4111
+ if (!customers.has(customer.customerId)) customers.set(customer.customerId, customer);
4112
+ }
4113
+ if (list.length < CUSTOMER_PAGE_SIZE) return [...customers.values()];
4114
+ }
4115
+ throw new InvoiceCliError("api", "reim_customer_search_incomplete", "\u5BA2\u6237\u67E5\u8BE2\u8FBE\u5230 20 \u9875\u4E0A\u9650\uFF0C\u5019\u9009\u672A\u8BFB\u5B8C\u6574\uFF0C\u8BF7\u7F29\u5C0F\u5BA2\u6237\u540D\u79F0\u8303\u56F4", { exitCode: 1 });
4116
+ }
4117
+ async function attachCustomerProjects(host, customers, operation, deadline) {
4118
+ const results = new Array(customers.length);
4119
+ let next = 0;
4120
+ let authenticationError;
4121
+ await Promise.all(Array.from({ length: Math.min(4, customers.length) }, async () => {
4122
+ while (!authenticationError && next < customers.length) {
4123
+ const index = next++;
4124
+ const customer = customers[index];
4125
+ try {
4126
+ results[index] = { ...customer, relatedProject: await readInvoiceCustomerProjects(host, customer.customerId, operation, deadline, () => Boolean(authenticationError)) };
4127
+ } catch (error) {
4128
+ if (error instanceof InvoiceCliError && error.type === "authentication") {
4129
+ authenticationError = error;
4130
+ return;
4131
+ }
4132
+ results[index] = {
4133
+ ...customer,
4134
+ relatedProject: null,
4135
+ projectsError: error instanceof InvoiceCliError ? error.message : "\u5BA2\u6237\u9879\u76EE\u67E5\u8BE2\u5931\u8D25\uFF0C\u65E0\u6CD5\u786E\u8BA4\u5B8C\u6574\u9879\u76EE\u5019\u9009"
4136
+ };
4137
+ }
4138
+ }
4139
+ }));
4140
+ if (authenticationError) throw authenticationError;
4141
+ return results;
4142
+ }
4143
+ var InvoiceReimCustomerSearchOperation = class {
4144
+ name = "invoice.reim.customer.search";
4145
+ async execute(input, { host }) {
4146
+ if (Object.keys(input).some((key) => key !== "keywords")) {
4147
+ throw invoiceValidationError("input_invalid", "\u5BA2\u6237\u67E5\u8BE2\u53EA\u63A5\u53D7 keywords\uFF0C\u5176\u4ED6\u67E5\u8BE2\u53C2\u6570\u56FA\u5B9A");
4148
+ }
4149
+ const keywords = asNonEmptyString(input.keywords, "keywords");
4150
+ const deadline = Date.now() + 12e4;
4151
+ const customers = await searchInvoiceCustomers(host, keywords, this.name);
4152
+ const list = await attachCustomerProjects(host, customers, this.name, deadline);
4153
+ return { status: list.some((customer) => customer.relatedProject === null) ? "PARTIAL" : "COMPLETE", data: { list } };
3630
4154
  }
3631
4155
  };
3632
4156
 
@@ -3649,29 +4173,11 @@ var RELATION_FIELD = {
3649
4173
  projectName: "1336526894274510992",
3650
4174
  preApproval: "1336156560590790875"
3651
4175
  };
3652
- var RELATION_SEARCH_PAGE_SIZE = 20;
3653
- var CUSTOMER_SEARCH_PATH = "/api/ebuilder/coms/nlist/getData";
3654
- var CUSTOMER_SEARCH_PAGE_ID = "1218181956452048911";
3655
- var CUSTOMER_SEARCH_COMP_ID = "c39b9e14c0034336adf9e9bc39aeed75";
3656
- var CUSTOMER_SEARCH_WORKFLOW_ID = "100003460000000060";
3657
- var CUSTOMER_OBJ_ID = "1173221220888059964";
3658
- var CUSTOMER_NAME_FIELD2 = "1173221220888062665";
3659
- var PROJECT_SEARCH_PATH = "/api/ebuilder/form/common/browser/data/ebuilder";
3660
- var PROJECT_NAME_FIELD = "1020275734718578690";
3661
- var PROJECT_FORM_PARAM = JSON.stringify({
3662
- formId: "100003660000000007",
3663
- layoutId: "925333107626672135",
3664
- fieldId: "100003720000006720",
3665
- filterItems: [],
3666
- module: "workflow",
3667
- dataDetails: [],
3668
- templateId: ""
3669
- });
3670
4176
  var BROWSE_SUMMARY_SUFFIX = /\s+\([^()]*[::][^()]*\)\s*$/u;
3671
4177
  function asRecord3(value) {
3672
4178
  return value && typeof value === "object" && !Array.isArray(value) ? value : {};
3673
4179
  }
3674
- function text3(value) {
4180
+ function text4(value) {
3675
4181
  if (value === void 0 || value === null || typeof value === "object") return "";
3676
4182
  return String(value).trim();
3677
4183
  }
@@ -3720,12 +4226,12 @@ async function mapInOrder(items, fn) {
3720
4226
  return results;
3721
4227
  }
3722
4228
  function saveOutcome(value) {
3723
- const record2 = asRecord3(value);
3724
- const message = text3(asRecord3(asRecord3(asRecord3(asRecord3(record2.actionData).responseData).customData).mainTable).msg);
3725
- if (Number(record2.resultCode) === 200 && message.includes(RELATION_SAVED_MESSAGE)) return { saved: true, message };
4229
+ const record4 = asRecord3(value);
4230
+ const message = text4(asRecord3(asRecord3(asRecord3(asRecord3(record4.actionData).responseData).customData).mainTable).msg);
4231
+ if (Number(record4.resultCode) === 200 && message.includes(RELATION_SAVED_MESSAGE)) return { saved: true, message };
3726
4232
  return {
3727
4233
  saved: false,
3728
- message: message || text3(record2.resultMsg) || `\u52A8\u4F5C\u6D41\u6CA1\u6709\u8FD4\u56DE\u300C${RELATION_SAVED_MESSAGE}\u300D\uFF08resultCode=${text3(record2.resultCode) || "\u65E0"}\uFF09`
4234
+ message: message || text4(record4.resultMsg) || `\u52A8\u4F5C\u6D41\u6CA1\u6709\u8FD4\u56DE\u300C${RELATION_SAVED_MESSAGE}\u300D\uFF08resultCode=${text4(record4.resultCode) || "\u65E0"}\uFF09`
3729
4235
  };
3730
4236
  }
3731
4237
  var InvoiceReimRelationSaveOperation = class {
@@ -3816,9 +4322,9 @@ function relationFilter(fid) {
3816
4322
  ];
3817
4323
  }
3818
4324
  function idNameOf(row, idField, nameField) {
3819
- const id = text3(row[idField]);
4325
+ const id = text4(row[idField]);
3820
4326
  if (!/^\d+$/u.test(id)) return null;
3821
- const name = text3(row[nameField]);
4327
+ const name = text4(row[nameField]);
3822
4328
  return { id, name, value: name ? `${name}(${id})` : id };
3823
4329
  }
3824
4330
  function stripBrowseSummary(name) {
@@ -3826,20 +4332,20 @@ function stripBrowseSummary(name) {
3826
4332
  }
3827
4333
  function preApprovalOf(value) {
3828
4334
  const item = asRecord3(Array.isArray(value) ? value[0] : value);
3829
- const requestId = text3(item.id);
4335
+ const requestId = text4(item.id);
3830
4336
  if (!/^\d+$/u.test(requestId)) return null;
3831
- const displayName = text3(item.name);
4337
+ const displayName = text4(item.name);
3832
4338
  const requestName = stripBrowseSummary(displayName);
3833
4339
  return {
3834
4340
  requestId,
3835
4341
  requestName,
3836
4342
  value: requestName ? `${requestName}(${requestId})` : requestId,
3837
4343
  displayName,
3838
- createTime: text3(asRecord3(item.custom).createDateTime) || null
4344
+ createTime: text4(asRecord3(item.custom).createDateTime) || null
3839
4345
  };
3840
4346
  }
3841
4347
  function relationItemFromRows(fid, rows) {
3842
- const matched = rows.map(asRecord3).filter((row2) => text3(row2[RELATION_FIELD.fid]) === fid).sort((a, b) => text3(b.create_time).localeCompare(text3(a.create_time)));
4348
+ const matched = rows.map(asRecord3).filter((row2) => text4(row2[RELATION_FIELD.fid]) === fid).sort((a, b) => text4(b.create_time).localeCompare(text4(a.create_time)));
3843
4349
  const row = matched[0];
3844
4350
  if (!row) return { fid, found: false, customer: null, project: null, preApproval: null, recordedAt: null };
3845
4351
  return {
@@ -3848,7 +4354,7 @@ function relationItemFromRows(fid, rows) {
3848
4354
  customer: idNameOf(row, RELATION_FIELD.customerId, RELATION_FIELD.customerName),
3849
4355
  project: idNameOf(row, RELATION_FIELD.projectId, RELATION_FIELD.projectName),
3850
4356
  preApproval: preApprovalOf(row[RELATION_FIELD.preApproval]),
3851
- recordedAt: text3(row.create_time) || null
4357
+ recordedAt: text4(row.create_time) || null
3852
4358
  };
3853
4359
  }
3854
4360
  function groupByValue(items, pick) {
@@ -3880,120 +4386,6 @@ async function relationRows(host, fid, operation) {
3880
4386
  if (!Array.isArray(list)) throw new Error(`\u53D1\u7968 ${fid} \u7684\u5173\u8054\u4FE1\u606F\u8FD4\u56DE\u7F3A\u5C11 data.list`);
3881
4387
  return list;
3882
4388
  }
3883
- function relationSearchTarget(value) {
3884
- if (value === "customer" || value === "project") return value;
3885
- throw invoiceValidationError("input_invalid", "target \u53EA\u80FD\u662F customer\uFF08\u76F8\u5173\u5BA2\u6237\uFF09\u6216 project\uFF08\u76F8\u5173\u9879\u76EE\uFF09");
3886
- }
3887
- function customerFilter2(keywords) {
3888
- return [
3889
- {
3890
- conditionType: "or",
3891
- dataType: "field",
3892
- id: "d030a0a7b33e48e697277d30086126dc",
3893
- conditionComId: `${CUSTOMER_SEARCH_COMP_ID}_quick_EXCLUDECACHE`,
3894
- filterFields: [{
3895
- compId: CUSTOMER_SEARCH_COMP_ID,
3896
- compType: "Text",
3897
- dataset: {
3898
- isPhysical: true,
3899
- ebuilderDataConfig: { dataSetup: {}, type: "FORM" },
3900
- detailTable: false,
3901
- groupId: "weaver-ebuilder-form-service",
3902
- usage: "all",
3903
- appId: "980180677416657173",
3904
- id: CUSTOMER_OBJ_ID,
3905
- text: "\u5BA2\u6237",
3906
- type: "LOGIC",
3907
- objType: "physical"
3908
- },
3909
- fieldName: `field_${CUSTOMER_NAME_FIELD2}`,
3910
- id: CUSTOMER_NAME_FIELD2,
3911
- objId: CUSTOMER_OBJ_ID,
3912
- type: "String",
3913
- text: "\u540D\u79F0"
3914
- }],
3915
- value: keywords
3916
- },
3917
- {
3918
- conditionComId: `${CUSTOMER_SEARCH_COMP_ID}_filter_EXCLUDECACHE`,
3919
- conditionType: "and",
3920
- dataType: "classification",
3921
- id: "f27488c792f44756b7ef1065f7735fc1",
3922
- useConfig: true
3923
- }
3924
- ];
3925
- }
3926
- async function searchCustomers(host, keywords, operation) {
3927
- const result = await host.invoiceMultipartRequest({
3928
- path: CUSTOMER_SEARCH_PATH,
3929
- method: "POST",
3930
- headers: { ebbusinessid: CUSTOMER_SEARCH_PAGE_ID },
3931
- fields: {
3932
- workflowId: CUSTOMER_SEARCH_WORKFLOW_ID,
3933
- isCreate: "1",
3934
- filter: customerFilter2(keywords),
3935
- compId: CUSTOMER_SEARCH_COMP_ID,
3936
- pageId: CUSTOMER_SEARCH_PAGE_ID,
3937
- pageNo: "1",
3938
- pageSize: String(RELATION_SEARCH_PAGE_SIZE)
3939
- },
3940
- operation
3941
- });
3942
- assertBusinessSuccess(result, "reim_relation_search_failed", "\u641C\u7D22\u76F8\u5173\u5BA2\u6237\u5931\u8D25");
3943
- const list = asRecord3(asRecord3(result).data).list;
3944
- return (Array.isArray(list) ? list : []).map((row) => {
3945
- const record2 = asRecord3(row);
3946
- return { id: text3(record2.id), name: text3(record2[CUSTOMER_NAME_FIELD2]) };
3947
- });
3948
- }
3949
- async function searchProjects(host, keywords, operation) {
3950
- const result = await host.invoiceRequest({
3951
- path: PROJECT_SEARCH_PATH,
3952
- method: "POST",
3953
- body: {
3954
- browserMultiple: false,
3955
- current: 1,
3956
- pageSize: RELATION_SEARCH_PAGE_SIZE,
3957
- quickSearchDatas: { [`field_${PROJECT_NAME_FIELD}`]: keywords },
3958
- formParam: PROJECT_FORM_PARAM
3959
- },
3960
- operation
3961
- });
3962
- assertBusinessSuccess(result, "reim_relation_search_failed", "\u641C\u7D22\u76F8\u5173\u9879\u76EE\u5931\u8D25");
3963
- const rows = asRecord3(asRecord3(result).data).data;
3964
- return (Array.isArray(rows) ? rows : []).map(asRecord3).filter((row) => row.disabled !== true).map((row) => ({ id: text3(row.id), name: text3(row.content) || text3(row[PROJECT_NAME_FIELD]) }));
3965
- }
3966
- function uniqueValidItems(items) {
3967
- const seen = /* @__PURE__ */ new Set();
3968
- return items.filter((item) => {
3969
- if (!/^\d+$/u.test(item.id) || !item.name || seen.has(item.id)) return false;
3970
- seen.add(item.id);
3971
- return true;
3972
- });
3973
- }
3974
- var InvoiceReimRelationSearchOperation = class {
3975
- name = "invoice.reim.relation.search";
3976
- async execute(input, { host }) {
3977
- const target = relationSearchTarget(input.target);
3978
- const keywords = optionalText(input.keywords, "keywords");
3979
- if (!keywords) throw invoiceValidationError("input_invalid", "keywords \u5FC5\u987B\u662F\u975E\u7A7A\u5B57\u7B26\u4E32");
3980
- const found = target === "customer" ? await searchCustomers(host, keywords, this.name) : await searchProjects(host, keywords, this.name);
3981
- const items = uniqueValidItems(found);
3982
- const exact = items.filter((item) => item.name === keywords);
3983
- const match = items.length === 0 ? "none" : items.length === 1 ? "unique" : "multiple";
3984
- return {
3985
- status: "COMPLETE",
3986
- data: {
3987
- target,
3988
- keywords,
3989
- match,
3990
- items,
3991
- selected: items.length === 1 ? items[0] : exact.length === 1 ? exact[0] : null,
3992
- workflow: workflow(this.name, "COMPLETE")
3993
- }
3994
- };
3995
- }
3996
- };
3997
4389
  var InvoiceReimRelationListOperation = class {
3998
4390
  name = "invoice.reim.relation.list";
3999
4391
  async execute(input, { host }) {
@@ -4038,8 +4430,8 @@ function optionalId2(value, name) {
4038
4430
  }
4039
4431
  function amountCents2(value, name) {
4040
4432
  if (value === void 0 || value === null || value === "") return null;
4041
- const text5 = typeof value === "number" ? String(value) : value;
4042
- const match = typeof text5 === "string" ? /^(\d+)(?:\.(\d{1,2}))?$/u.exec(text5.trim()) : null;
4433
+ const text6 = typeof value === "number" ? String(value) : value;
4434
+ const match = typeof text6 === "string" ? /^(\d+)(?:\.(\d{1,2}))?$/u.exec(text6.trim()) : null;
4043
4435
  const cents = match ? Number(match[1]) * 100 + Number((match[2] ?? "").padEnd(2, "0")) : NaN;
4044
4436
  if (!Number.isSafeInteger(cents) || cents <= 0) {
4045
4437
  throw invoiceValidationError("input_invalid", `${name} \u5FC5\u987B\u662F\u5927\u4E8E 0\u3001\u6700\u591A\u4E24\u4F4D\u5C0F\u6570\u7684\u91D1\u989D`);
@@ -4086,7 +4478,7 @@ function workflowViewUrl(baseUrl, requestId) {
4086
4478
  return `${baseUrl.replace(/\/+$/, "")}/sp/workflow/flowpage/view/${requestId}`;
4087
4479
  }
4088
4480
  function subsidyReceipt(options) {
4089
- const { processTitle, reason, url, details, skipped, allowanceCents, reimbursedTotalCents } = options;
4481
+ const { processTitle, reason, url, details, skipped: skipped2, allowanceCents, reimbursedTotalCents } = options;
4090
4482
  const money = (cents) => `\xA5${(cents / 100).toFixed(2)}`;
4091
4483
  const includedTotalCents = details.reduce((sum, item) => sum + item.cents, 0);
4092
4484
  const partialAmountCents = includedTotalCents - reimbursedTotalCents;
@@ -4109,9 +4501,9 @@ function subsidyReceipt(options) {
4109
4501
  if (partialAmountCents > 0) {
4110
4502
  lines.push(`\u672C\u6B21\u6309\u6708\u8865\u8D34\u989D\u5EA6\u62A5\u9500\uFF0C\u5DF2\u4F7F\u7528\u53D1\u7968\u4E2D\u8D85\u51FA\u7684 ${money(partialAmountCents)} \u672A\u8BA1\u5165\u62A5\u9500\u91D1\u989D\u3002`, "");
4111
4503
  }
4112
- if (skipped.length > 0) {
4113
- const skippedTotalCents = skipped.reduce((sum, item) => sum + item.cents, 0);
4114
- lines.push(`\u6708\u8865\u8D34\u989D\u5EA6\u5DF2\u7528\u5B8C\uFF0C\u53E6\u6709 ${skipped.length} \u5F20\u53D1\u7968\uFF08\u5408\u8BA1 ${money(skippedTotalCents)}\uFF09\u672A\u7EB3\u5165\u672C\u6B21\u62A5\u9500\uFF0C\u4ECD\u5728\u7968\u5939\u3002\u540E\u7EED\u62A5\u9500\u4ECD\u987B\u6EE1\u8DB3\u6700\u8FD1 30 \u5929\u7684\u5F00\u7968\u65E5\u671F\u8981\u6C42\u3002`, "");
4504
+ if (skipped2.length > 0) {
4505
+ const skippedTotalCents = skipped2.reduce((sum, item) => sum + item.cents, 0);
4506
+ lines.push(`\u6708\u8865\u8D34\u989D\u5EA6\u5DF2\u7528\u5B8C\uFF0C\u53E6\u6709 ${skipped2.length} \u5F20\u53D1\u7968\uFF08\u5408\u8BA1 ${money(skippedTotalCents)}\uFF09\u672A\u7EB3\u5165\u672C\u6B21\u62A5\u9500\uFF0C\u4ECD\u5728\u7968\u5939\u3002\u540E\u7EED\u62A5\u9500\u4ECD\u987B\u6EE1\u8DB3\u6700\u8FD1 30 \u5929\u7684\u5F00\u7968\u65E5\u671F\u8981\u6C42\u3002`, "");
4115
4507
  }
4116
4508
  lines.push(`[\u67E5\u770B\u62A5\u9500\u6D41\u7A0B\uFF1A${processTitle}](${url})`);
4117
4509
  return lines.join("\n");
@@ -4128,10 +4520,10 @@ var InvoiceReimSubsidySubmitOperation = class {
4128
4520
  const allowanceCents = amountCents2(input.monthlyAllowance, "monthlyAllowance");
4129
4521
  let remainingCents = allowanceCents ?? Number.POSITIVE_INFINITY;
4130
4522
  const details = [];
4131
- const skipped = [];
4523
+ const skipped2 = [];
4132
4524
  for (const item of invoices) {
4133
4525
  if (remainingCents <= 0) {
4134
- skipped.push(item);
4526
+ skipped2.push(item);
4135
4527
  continue;
4136
4528
  }
4137
4529
  const reimbursedCents = Math.min(item.cents, remainingCents);
@@ -4211,11 +4603,11 @@ var InvoiceReimSubsidySubmitOperation = class {
4211
4603
  invoiceTotal: formatCents2(item.cents),
4212
4604
  reimbursedAmount: formatCents2(item.reimbursedCents)
4213
4605
  })),
4214
- skippedInvoices: skipped.map((item) => ({
4606
+ skippedInvoices: skipped2.map((item) => ({
4215
4607
  relatedInvoiceId: item.fid,
4216
4608
  invoiceTotal: formatCents2(item.cents)
4217
4609
  })),
4218
- finalMarkdown: subsidyReceipt({ processTitle, reason, url, details, skipped, allowanceCents, reimbursedTotalCents }),
4610
+ finalMarkdown: subsidyReceipt({ processTitle, reason, url, details, skipped: skipped2, allowanceCents, reimbursedTotalCents }),
4219
4611
  result,
4220
4612
  workflow: workflow(this.name, "COMPLETE")
4221
4613
  }
@@ -4349,7 +4741,7 @@ var EXT_NOISE_KEYS = /* @__PURE__ */ new Set([
4349
4741
  function asRecord4(value) {
4350
4742
  return value && typeof value === "object" && !Array.isArray(value) ? value : {};
4351
4743
  }
4352
- function text4(value) {
4744
+ function text5(value) {
4353
4745
  return value === void 0 || value === null ? "" : String(value).trim();
4354
4746
  }
4355
4747
  function compact(value) {
@@ -4369,13 +4761,13 @@ function usefulExt(rawExt, cname) {
4369
4761
  const ext = { ...parseInvoiceExt(rawExt) };
4370
4762
  for (const key of EXT_NOISE_KEYS) delete ext[key];
4371
4763
  for (const key of ["title", "category"]) {
4372
- if (text4(ext[key]) === cname) delete ext[key];
4764
+ if (text5(ext[key]) === cname) delete ext[key];
4373
4765
  }
4374
4766
  return asRecord4(compact(ext));
4375
4767
  }
4376
4768
  function party(value) {
4377
- const record2 = asRecord4(value);
4378
- return { company: text4(record2.company), tcode: text4(record2.tcode) };
4769
+ const record4 = asRecord4(value);
4770
+ return { company: text5(record4.company), tcode: text5(record4.tcode) };
4379
4771
  }
4380
4772
  function invoiceResult(item, baseUrl) {
4381
4773
  const entry = asRecord4(item);
@@ -4384,24 +4776,24 @@ function invoiceResult(item, baseUrl) {
4384
4776
  const pro = asRecord4(comm.pro);
4385
4777
  const price = asRecord4(comm.price);
4386
4778
  const ret = asRecord4(entry.ret);
4387
- const fid = text4(info.fid ?? info.id);
4388
- const cname = text4(pro.cname);
4389
- const kind = text4(pro.kind);
4779
+ const fid = text5(info.fid ?? info.id);
4780
+ const cname = text5(pro.cname);
4781
+ const kind = text5(pro.kind);
4390
4782
  return {
4391
4783
  fid,
4392
- code: text4(info.code),
4393
- number: text4(info.number),
4784
+ code: text5(info.code),
4785
+ number: text5(info.number),
4394
4786
  cname,
4395
4787
  type: numberOrZero(pro.type),
4396
4788
  ...kind ? { kind } : {},
4397
- date: text4(pro.date),
4398
- amount: text4(price.amount),
4399
- total: text4(price.total),
4400
- dtax: text4(price.dtax),
4789
+ date: text5(pro.date),
4790
+ amount: text5(price.amount),
4791
+ total: text5(price.total),
4792
+ dtax: text5(price.dtax),
4401
4793
  buyer: party(comm.buyer),
4402
4794
  payer: party(comm.payer),
4403
4795
  ext: usefulExt(info.ext, cname),
4404
- ret: { ret: ret.ret, message: text4(ret.message) },
4796
+ ret: { ret: ret.ret, message: text5(ret.message) },
4405
4797
  validated: ret.ret === 0,
4406
4798
  ...fid ? { detailUrl: invoiceDetailUrl(baseUrl, fid) } : {}
4407
4799
  };
@@ -4473,15 +4865,13 @@ function buildRegistry() {
4473
4865
  new InvoiceReimRequestsListOperation(),
4474
4866
  new InvoiceReimWorkflowResolveOperation(),
4475
4867
  new InvoiceReimCandidatesListOperation(),
4476
- new InvoiceReimEmployeeSuperiorsOperation(),
4477
- new InvoiceReimFieldSearchOperation(),
4478
4868
  new InvoiceReimCustomerSearchOperation(),
4479
- new InvoiceReimRelationSearchOperation(),
4480
4869
  new InvoiceReimRelationSaveOperation(),
4481
4870
  new InvoiceReimRelationListOperation(),
4482
4871
  new InvoiceReimSubsidySubmitOperation(),
4483
4872
  new InvoiceIssuingContractsListOperation(),
4484
- new InvoiceIssuingContractDetailOperation()
4873
+ new InvoiceIssuingContractDetailOperation(),
4874
+ new InvoiceIssuingRedRequestsListOperation()
4485
4875
  ];
4486
4876
  for (const handler of handlers) {
4487
4877
  if (registry.has(handler.name)) throw new Error(`duplicate invoice operation handler: ${handler.name}`);
@@ -4607,7 +4997,7 @@ function successEnvelope(operation, result, meta) {
4607
4997
  operation,
4608
4998
  data: result.data,
4609
4999
  meta: { status: result.status, ...meta ?? {} },
4610
- warnings: []
5000
+ warnings: result.warnings ?? []
4611
5001
  };
4612
5002
  }
4613
5003
  function failureEnvelope(error) {
@@ -4627,10 +5017,10 @@ async function executeAndPrint(ctx, operation, input, projection = {}) {
4627
5017
  continuation: createInvoiceContinuationSigner(ctx)
4628
5018
  });
4629
5019
  const projected = applyInvoiceProjection(operation, result.data, projection);
4630
- ctx.output.write(successEnvelope(operation, { status: result.status, data: projected.data }, projected.meta), { json: true });
5020
+ ctx.output.write(successEnvelope(operation, { status: result.status, data: projected.data, warnings: result.warnings }, projected.meta), { json: true });
4631
5021
  } catch (error) {
4632
5022
  reportPlatformError(error);
4633
- console.error(JSON.stringify(failureEnvelope(error), null, 2));
5023
+ ctx.output.error(failureEnvelope(error));
4634
5024
  process.exitCode = isCliError(error) ? error.exitCode : 1 /* GeneralError */;
4635
5025
  }
4636
5026
  }