weaver-work-cli 0.1.42 → 0.1.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -0
- package/dist/chunks/{archive-J4I6MCKF.js → archive-P6TBQGKL.js} +13 -5
- package/dist/chunks/{archive-oa-BRZKKTO4.js → archive-oa-7TQ2NXOH.js} +12 -5
- package/dist/chunks/{asset-L7D4FAOZ.js → asset-3ELRG37G.js} +11 -4
- package/dist/chunks/{asset-idle-DADLLV75.js → asset-idle-WIGMUFMD.js} +7 -3
- package/dist/chunks/{attachment-content-K4C7VLWQ.js → attachment-content-E3276UOV.js} +5 -4
- package/dist/chunks/{blog-BVGQ7NZL.js → blog-C5NMZAAC.js} +11 -4
- package/dist/chunks/{caizhilian-SAADNFD6.js → caizhilian-5XSM2DFP.js} +13 -6
- package/dist/chunks/{calendar-Q7NQY5Z2.js → calendar-FI2WNSBO.js} +12 -5
- package/dist/chunks/{chunk-YRSZQUD2.js → chunk-3YBDYOC4.js} +3 -3
- package/dist/chunks/{chunk-OOUTBLZ4.js → chunk-56EZERK4.js} +1 -1
- package/dist/chunks/chunk-6N4JPNFL.js +76 -0
- package/dist/chunks/{chunk-ZUX3P6BQ.js → chunk-727FH2NI.js} +1 -1
- package/dist/chunks/chunk-7BDPM5ST.js +11 -0
- package/dist/chunks/{chunk-EKWAQSLU.js → chunk-BCVYBYYT.js} +432 -2248
- package/dist/chunks/{chunk-W7BEHOSR.js → chunk-CWYGFU5B.js} +2 -2
- package/dist/chunks/{chunk-NOODWMCL.js → chunk-D4ADSZ7H.js} +1 -1
- package/dist/chunks/{chunk-SA6VBIHY.js → chunk-ETNJSKMM.js} +214 -16
- package/dist/chunks/{chunk-BBKDXQEC.js → chunk-F4E4EM35.js} +3 -3
- package/dist/chunks/{chunk-IZ7S7QUS.js → chunk-FAZTGX7S.js} +6 -6
- package/dist/chunks/{chunk-NKZRQXST.js → chunk-FRZKBMSW.js} +52 -36
- package/dist/chunks/{chunk-BYBSCN4X.js → chunk-G7PQWD4L.js} +6 -3
- package/dist/chunks/{chunk-GEWYMQME.js → chunk-GAMZLAG2.js} +1 -1
- package/dist/chunks/{chunk-R4CHUSKC.js → chunk-GM6J7Q4B.js} +4 -4
- package/dist/chunks/{chunk-APVFJUQH.js → chunk-GRDRG6HP.js} +3 -3
- package/dist/chunks/{chunk-LDZQPUIA.js → chunk-HIT4Y6OI.js} +1 -1
- package/dist/chunks/{chunk-EZALDOQH.js → chunk-HP7JIYMT.js} +5 -2
- package/dist/chunks/{chunk-LADPYOWC.js → chunk-IAZ3UPY6.js} +3 -3
- package/dist/chunks/{chunk-ZEDWSH32.js → chunk-IC62NFM5.js} +1 -1
- package/dist/chunks/{chunk-P26ZWSKU.js → chunk-KIHNAS25.js} +5 -2
- package/dist/chunks/{chunk-BIPYLLVS.js → chunk-N4M2DDFE.js} +15 -15
- package/dist/chunks/{chunk-QKNKR4RH.js → chunk-OF4S23UB.js} +4 -4
- package/dist/chunks/{chunk-JPRO6ER2.js → chunk-PC7VKEB5.js} +57 -60
- package/dist/chunks/{chunk-4PD5NWAX.js → chunk-PUQS5MWL.js} +2 -2
- package/dist/chunks/{chunk-2LV74IWP.js → chunk-Q4OYAQYH.js} +1 -1
- package/dist/chunks/{chunk-72CKAUAG.js → chunk-QVSWRLLU.js} +7 -5
- package/dist/chunks/{chunk-4RAE6JXP.js → chunk-TA7FXXJD.js} +6 -3
- package/dist/chunks/{chunk-GPMFD4RD.js → chunk-TXUG266F.js} +1 -1
- package/dist/chunks/{chunk-FOAA27U5.js → chunk-UFIT2UU3.js} +16 -4
- package/dist/chunks/{chunk-LUSPKZKY.js → chunk-UG5G54VL.js} +1 -0
- package/dist/chunks/{chunk-NIAJ5ZCG.js → chunk-UL5XUQ25.js} +5 -2
- package/dist/chunks/{chunk-FMPJJYYI.js → chunk-WRXSAVKO.js} +1 -1
- package/dist/chunks/{chunk-G4UR6NXN.js → chunk-WSF4NNMR.js} +3 -3
- package/dist/chunks/chunk-XHK4MDR5.js +2497 -0
- package/dist/chunks/{chunk-3KTFS4IA.js → chunk-XNIK66I4.js} +19 -9
- package/dist/chunks/{chunk-3SO6QL6U.js → chunk-YWX377BY.js} +5 -2
- package/dist/chunks/{chunk-BYATLLEF.js → chunk-Z3GDFVJR.js} +1 -1
- package/dist/chunks/{chunk-GHXCDPTM.js → chunk-Z7VYWPZV.js} +1 -1
- package/dist/chunks/{conflict-F2OMZRTO.js → conflict-ARLSZJ6V.js} +4 -3
- package/dist/chunks/{continuation-2CKSBLA6.js → continuation-3S37AUSH.js} +4 -3
- package/dist/chunks/{continuation-RN6PZN2M.js → continuation-3XLYYTKV.js} +4 -3
- package/dist/chunks/{continuation-HZIZRZBX.js → continuation-HFW2YT5S.js} +4 -3
- package/dist/chunks/{continuation-NLECEJPX.js → continuation-KI7DRRZN.js} +4 -3
- package/dist/chunks/{contract-5BETHRSG.js → contract-DNIIW5VJ.js} +13 -5
- package/dist/chunks/{cowork-3MN6EQQO.js → cowork-GMLRGVIW.js} +11 -4
- package/dist/chunks/{create-flow-5FQNNMVO.js → create-flow-J22BO65E.js} +8 -7
- package/dist/chunks/{ebuilder-form-SBHOYBUD.js → ebuilder-form-ANV2FHYV.js} +12 -7
- package/dist/chunks/{ehr-KMOJULKG.js → ehr-GSTGAIY3.js} +266 -24
- package/dist/chunks/{employee-SAK2QYXX.js → employee-22BGJ3QS.js} +3 -3
- package/dist/chunks/{env-LB7NBL2O.js → env-BX3VRFS7.js} +4 -3
- package/dist/chunks/{esb-W2PJCFCX.js → esb-ATAIASX2.js} +12 -7
- package/dist/chunks/{factory-6ZFQXQ46.js → factory-PETTFME6.js} +3 -2
- package/dist/chunks/{fna-ZQPCUV4R.js → fna-YEKBSFSX.js} +14 -8
- package/dist/chunks/{group-chat-2HHAJN46.js → group-chat-BFVXAYFX.js} +5 -4
- package/dist/chunks/{host-ATKVNZAT.js → host-HRBXEPDQ.js} +5 -5
- package/dist/chunks/{host-BQH22NTQ.js → host-LR55CTHP.js} +5 -5
- package/dist/chunks/{host-X2CSLFM6.js → host-SUOY6VYQ.js} +5 -5
- package/dist/chunks/{host-4CBHGOHT.js → host-SZGV4UNT.js} +5 -5
- package/dist/chunks/{host-YTODKMSL.js → host-WIKN2EJ5.js} +5 -5
- package/dist/chunks/{hrm-FFM4UJFS.js → hrm-NRDO4W5G.js} +11 -7
- package/dist/chunks/{im-VEHKDQPB.js → im-IQ2HN23S.js} +8 -7
- package/dist/chunks/{invoice-LVIKSIIF.js → invoice-MNRW76PP.js} +636 -1768
- package/dist/chunks/{jiuchuanhui-X6DINO5P.js → jiuchuanhui-DTRBAX4N.js} +14 -6
- package/dist/chunks/{lazy-dispatch-KSWTN5L6.js → lazy-dispatch-ZVWAI25B.js} +7 -6
- package/dist/chunks/{mail-VDKRGUD3.js → mail-ZVAUXOJA.js} +16 -14
- package/dist/chunks/{meeting-CLC6HP3Z.js → meeting-FEVPZ67S.js} +21 -14
- package/dist/chunks/{okr-CHG4OO3U.js → okr-SDH3E5RA.js} +12 -5
- package/dist/chunks/{operations-5QL3AECO.js → operations-62N6EP3C.js} +4 -3
- package/dist/chunks/{plan-XWR75667.js → plan-E35JFDI7.js} +12 -5
- package/dist/chunks/{project-5BXOOKMG.js → project-73QXBAB2.js} +11 -4
- package/dist/chunks/reception-UWZVACBN.js +1899 -0
- package/dist/chunks/{recruit-stage-DGMFNNDE.js → recruit-stage-4MAOCKFY.js} +320 -57
- package/dist/chunks/registry-IM5G23LS.js +24 -0
- package/dist/chunks/{registry-RHMW6ANW.js → registry-JDUS4E7D.js} +7 -6
- package/dist/chunks/{registry-7FFOXIAW.js → registry-KNKSCJNT.js} +7 -6
- package/dist/chunks/{registry-Z43434VG.js → registry-PO7SI256.js} +4 -4
- package/dist/chunks/{registry-OZSMDVPP.js → registry-PVUZQDDQ.js} +3 -3
- package/dist/chunks/{room-recommend-62H7ZQQ6.js → room-recommend-H7KLXA5R.js} +6 -5
- package/dist/chunks/{schedule-FNXKH3DQ.js → schedule-ESZIBAUO.js} +6 -5
- package/dist/chunks/{workflow-ADHKCAJK.js → workflow-CWJFJLQU.js} +13 -8
- package/dist/cmd/action.js +6 -0
- package/dist/cmd/identity/index.js +45 -0
- package/dist/cmd/index.js +2 -0
- package/dist/core/continuation-ttl.js +18 -0
- package/dist/core/error-codes.js +85 -0
- package/dist/core/logger.js +11 -0
- package/dist/index.js +37 -31
- package/dist/internal/e10/auth/commands.js +163 -8
- package/dist/internal/e10/auth/error-log.js +182 -0
- package/dist/internal/e10/auth/session.js +17 -3
- package/dist/internal/e10/auth-recovery.js +39 -12
- package/dist/internal/e10/context.js +17 -2
- package/dist/internal/skills/install.js +9 -1
- package/dist/shortcuts/archive/continuation.js +2 -1
- package/dist/shortcuts/archive/index.js +3 -0
- package/dist/shortcuts/archive/operations/confirm.js +2 -1
- package/dist/shortcuts/archive-oa/continuation.js +2 -1
- package/dist/shortcuts/archive-oa/index.js +2 -0
- package/dist/shortcuts/archive-oa/operations/confirm.js +2 -1
- package/dist/shortcuts/asset/continuation.js +2 -1
- package/dist/shortcuts/asset/index.js +2 -0
- package/dist/shortcuts/asset-idle/index.js +2 -0
- package/dist/shortcuts/blog/continuation.js +2 -1
- package/dist/shortcuts/blog/index.js +2 -0
- package/dist/shortcuts/caizhilian/continuation.js +2 -1
- package/dist/shortcuts/caizhilian/index.js +2 -0
- package/dist/shortcuts/caizhilian/operations/confirm.js +3 -2
- package/dist/shortcuts/calendar/continuation.js +2 -1
- package/dist/shortcuts/calendar/index.js +2 -0
- package/dist/shortcuts/calendar/operations/write.js +1 -1
- package/dist/shortcuts/contract/continuation.js +2 -1
- package/dist/shortcuts/contract/index.js +2 -0
- package/dist/shortcuts/contract/operations/write.js +2 -1
- package/dist/shortcuts/cowork/continuation.js +2 -1
- package/dist/shortcuts/cowork/index.js +2 -0
- package/dist/shortcuts/ebuilder-form/continuation.js +2 -1
- package/dist/shortcuts/ebuilder-form/index.js +2 -0
- package/dist/shortcuts/ebuilder-form/operations/write.js +3 -2
- package/dist/shortcuts/ehr/continuation.js +2 -1
- package/dist/shortcuts/ehr/index.js +2 -0
- package/dist/shortcuts/ehr/operations/attend-write.js +1 -1
- package/dist/shortcuts/ehr/operations/recruit-candidate-import.js +182 -3
- package/dist/shortcuts/ehr/operations/recruit-position.js +134 -2
- package/dist/shortcuts/ehr/operations/recruit-write.js +1 -1
- package/dist/shortcuts/esb/continuation.js +2 -1
- package/dist/shortcuts/esb/index.js +2 -0
- package/dist/shortcuts/esb/operations/trigger.js +2 -1
- package/dist/shortcuts/fna/continuation.js +2 -1
- package/dist/shortcuts/fna/index.js +2 -0
- package/dist/shortcuts/fna/operations/invoice-writeoff.js +1 -1
- package/dist/shortcuts/fna/operations/loan.js +1 -1
- package/dist/shortcuts/hrm/index.js +2 -0
- package/dist/shortcuts/im/continuation.js +2 -1
- package/dist/shortcuts/index.js +5 -0
- package/dist/shortcuts/invoice/continuation.js +2 -1
- package/dist/shortcuts/invoice/index.js +14 -15
- package/dist/shortcuts/invoice/invoice-record.js +93 -0
- package/dist/shortcuts/invoice/manifest.js +190 -393
- package/dist/shortcuts/invoice/operations/add.js +2 -1
- package/dist/shortcuts/invoice/operations/delete.js +2 -1
- package/dist/shortcuts/invoice/operations/import.js +2 -1
- package/dist/shortcuts/invoice/operations/issuing-contract-detail.js +86 -0
- package/dist/shortcuts/invoice/operations/issuing-contracts.js +210 -0
- package/dist/shortcuts/invoice/operations/registry.js +17 -17
- package/dist/shortcuts/invoice/operations/reim-auto.js +4 -569
- package/dist/shortcuts/invoice/operations/reim.js +52 -341
- package/dist/shortcuts/invoice/operations/shared.js +21 -4
- package/dist/shortcuts/invoice/operations/update.js +2 -1
- package/dist/shortcuts/invoice/projection.js +10 -62
- package/dist/shortcuts/jiuchuanhui/continuation.js +2 -1
- package/dist/shortcuts/jiuchuanhui/index.js +2 -0
- package/dist/shortcuts/jiuchuanhui/operations/datajson.js +2 -1
- package/dist/shortcuts/jiuchuanhui/operations/esb.js +2 -1
- package/dist/shortcuts/mail/continuation.js +2 -1
- package/dist/shortcuts/mail/index.js +2 -0
- package/dist/shortcuts/mail/operations/mail-blacklist.js +1 -1
- package/dist/shortcuts/mail/operations/mail-contacts.js +1 -1
- package/dist/shortcuts/mail/operations/mail-send.js +1 -1
- package/dist/shortcuts/mail/operations/mail-sign.js +1 -1
- package/dist/shortcuts/mail/operations/mail-template.js +1 -1
- package/dist/shortcuts/meeting/continuation.js +2 -1
- package/dist/shortcuts/meeting/index.js +2 -0
- package/dist/shortcuts/meeting/operations/change.js +1 -1
- package/dist/shortcuts/meeting/operations/create.js +1 -1
- package/dist/shortcuts/meeting/operations/eb/create-flow.js +16 -7
- package/dist/shortcuts/meeting/operations/eb/decision.js +1 -1
- package/dist/shortcuts/meeting/operations/eb/factory.js +1 -1
- package/dist/shortcuts/meeting/operations/lifecycle.js +1 -1
- package/dist/shortcuts/meeting/operations/receipts.js +1 -1
- package/dist/shortcuts/meeting/operations/signs.js +1 -1
- package/dist/shortcuts/okr/continuation.js +2 -1
- package/dist/shortcuts/okr/index.js +2 -0
- package/dist/shortcuts/okr/operations/write.js +1 -1
- package/dist/shortcuts/plan/continuation.js +2 -1
- package/dist/shortcuts/plan/index.js +2 -0
- package/dist/shortcuts/plan/operations/write.js +1 -1
- package/dist/shortcuts/project/continuation.js +2 -1
- package/dist/shortcuts/project/index.js +2 -0
- package/dist/shortcuts/reception/constants.js +53 -0
- package/dist/shortcuts/reception/errors.js +54 -0
- package/dist/shortcuts/reception/host.js +125 -0
- package/dist/shortcuts/reception/index.js +198 -0
- package/dist/shortcuts/reception/manifest.js +177 -0
- package/dist/shortcuts/reception/operations/ask.js +71 -0
- package/dist/shortcuts/reception/operations/browsertool.js +58 -0
- package/dist/shortcuts/reception/operations/compose.js +129 -0
- package/dist/shortcuts/reception/operations/customparams.js +74 -0
- package/dist/shortcuts/reception/operations/doc.js +238 -0
- package/dist/shortcuts/reception/operations/docrender.js +36 -0
- package/dist/shortcuts/reception/operations/panels.js +179 -0
- package/dist/shortcuts/reception/operations/registry.js +26 -0
- package/dist/shortcuts/reception/operations/render-assets.js +184 -0
- package/dist/shortcuts/reception/operations/render.js +123 -0
- package/dist/shortcuts/reception/operations/runs.js +38 -0
- package/dist/shortcuts/reception/operations/schedule.js +127 -0
- package/dist/shortcuts/reception/operations/shared.js +196 -0
- package/dist/shortcuts/reception/operations/snapshot.js +68 -0
- package/dist/shortcuts/reception/operations/types.js +1 -0
- package/dist/shortcuts/reception/operations.js +33 -0
- package/dist/shortcuts/reception/upload.js +218 -0
- package/dist/shortcuts/recruit-stage/context.js +145 -33
- package/dist/shortcuts/recruit-stage/continuation.js +2 -1
- package/dist/shortcuts/recruit-stage/operations/jd-create.js +106 -17
- package/dist/shortcuts/recruit-stage/operations/resume-import.js +166 -10
- package/dist/shortcuts/workflow/continuation.js +2 -1
- package/dist/shortcuts/workflow/index.js +2 -0
- package/dist/shortcuts/workflow/operations/form.js +32 -8
- package/dist/shortcuts/workflow/operations/write.js +1 -1
- package/docs/_catalog.md +3 -0
- package/docs/agent-invoice.md +1 -1
- package/docs/archive-oa.md +1 -1
- package/docs/caizhilian.md +1 -1
- package/docs/calendar.md +1 -1
- package/docs/contract.md +1 -1
- package/docs/e10-auth.md +16 -0
- package/docs/ehr.md +2 -2
- package/docs/esb.md +1 -1
- package/docs/im.md +1 -1
- package/docs/invoice.md +8 -12
- package/docs/okr.md +1 -1
- package/docs/reception.md +119 -0
- package/package.json +1 -1
- package/scripts/clean.mjs +43 -2
- package/skill-template/business-info.json +18 -2
- package/skill-template/domains/caizhilian.md +1 -1
- package/skill-template/domains/reception-flow.md +18 -0
- package/skill-template/domains/yepiaotong.md +4 -7
- package/skills/weaver-e10-archive-oa/references/source-manifest.json +14 -14
- package/skills/weaver-e10-blog/references/blog-publish.md +1 -1
- package/skills/weaver-e10-blog/references/source-manifest.json +7 -7
- package/skills/weaver-e10-caizhilian/references/source-manifest.json +21 -21
- package/skills/weaver-e10-caizhilian/references/write-protocol.md +2 -2
- package/skills/weaver-e10-calendar/references/calendar-write.md +1 -1
- package/skills/weaver-e10-cowork/SKILL.md +1 -1
- package/skills/weaver-e10-ebuilder-form/SKILL.md +1 -1
- package/skills/weaver-e10-ebuilder-form/references/custom-api.md +1 -1
- package/skills/weaver-e10-ebuilder-form/references/openapi-write.md +1 -1
- package/skills/weaver-e10-esb/SKILL.md +2 -2
- package/skills/weaver-e10-esb/references/source-manifest.json +22 -22
- package/skills/weaver-e10-esb/references/trigger.md +2 -2
- package/skills/weaver-e10-jinchengda/references/contract-clause-library-crud.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-clause-reference-save.md +1 -1
- package/skills/weaver-e10-jinchengda/references/contract-request-write.md +1 -1
- package/skills/weaver-e10-jinchengda/references/source-manifest.json +29 -29
- package/skills/weaver-e10-jucailin/SKILL.md +1 -1
- package/skills/weaver-e10-jucailin/references/attend-write.md +2 -2
- package/skills/weaver-e10-jucailin/references/recruit-create.md +12 -3
- package/skills/weaver-e10-jucailin/references/recruit-write.md +1 -1
- package/skills/weaver-e10-meeting/SKILL.md +8 -6
- package/skills/weaver-e10-meeting/references/meeting-change.md +1 -1
- package/skills/weaver-e10-meeting/references/meeting-create.md +1 -1
- package/skills/weaver-e10-meeting/references/meeting-lifecycle.md +1 -1
- package/skills/weaver-e10-meeting/references/meeting-verification.md +1 -1
- package/skills/weaver-e10-okr/references/okr-align.md +1 -1
- package/skills/weaver-e10-okr/references/okr-keyresult.md +1 -1
- package/skills/weaver-e10-okr/references/okr-write.md +1 -1
- package/skills/weaver-e10-okr/references/source-manifest.json +8 -8
- package/skills/weaver-e10-plan/references/plan-report-write.md +1 -1
- package/skills/weaver-e10-plan/references/source-manifest.json +20 -20
- package/skills/weaver-e10-qiyecheng/references/loan-management.md +1 -1
- package/skills/weaver-e10-qiyecheng/references/source-manifest.json +18 -18
- package/skills/weaver-e10-reception-flow/SKILL.md +173 -0
- package/skills/weaver-e10-reception-flow/assets//350/241/214/347/250/213/345/215/225/346/250/241/346/235/277-/346/263/233/345/276/256.docx +0 -0
- package/skills/weaver-e10-reception-flow/data/fields-snapshot.json +213 -0
- package/skills/weaver-e10-reception-flow/references/browsertool.md +68 -0
- package/skills/weaver-e10-reception-flow/references/env-pitfalls.md +51 -0
- package/skills/weaver-e10-reception-flow/references/fields-snapshot.md +227 -0
- package/skills/weaver-e10-reception-flow/references/guide.md +179 -0
- package/skills/weaver-e10-reception-flow/scripts/locate.sh +14 -0
- package/skills/weaver-e10-reception-flow/scripts/render.py +724 -0
- package/skills/weaver-e10-recruit-stage/SKILL.md +9 -5
- package/skills/weaver-e10-recruit-stage/lib/recruit-xiaoe-file.mjs +1 -1
- package/skills/weaver-e10-recruit-stage/lib/xiaoe-session.mjs +66 -0
- package/skills/weaver-e10-recruit-stage/references/position-templates.md +202 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-jd-create.md +22 -0
- package/skills/weaver-e10-recruit-stage/references/recruit-resume-import.md +14 -1
- package/skills/weaver-e10-shared/references/e10-auth-and-session.md +6 -0
- package/skills/weaver-e10-shijingran/SKILL.md +5 -5
- package/skills/weaver-e10-shijingran/references/source-manifest.json +37 -36
- package/skills/weaver-e10-skill-maker/references/module-cli-generation.md +2 -0
- package/skills/weaver-e10-wenshuding/references/source-manifest.json +3 -3
- package/skills/weaver-e10-workflow/references/source-manifest.json +32 -32
- package/skills/weaver-e10-yepiaotong/SKILL.md +19 -26
- package/skills/weaver-e10-yepiaotong/references/invoice-detail.md +13 -10
- package/skills/weaver-e10-yepiaotong/references/invoice-enterprise-list.md +2 -0
- package/skills/weaver-e10-yepiaotong/references/invoice-issuing-workflow.md +194 -155
- package/skills/weaver-e10-yepiaotong/references/invoice-output-view.md +28 -32
- package/skills/weaver-e10-yepiaotong/references/invoice-personal-list.md +5 -1
- package/skills/weaver-e10-yepiaotong/references/invoice-reim.md +8 -10
- package/skills/weaver-e10-yepiaotong/references/reim-api-reference.md +211 -616
- package/skills/weaver-e10-yepiaotong/references/reim-examples.md +149 -117
- package/skills/weaver-e10-yepiaotong/references/reim-expense-subject-rules.md +17 -20
- package/skills/weaver-e10-yepiaotong/references/reim-form-fill-rules.md +20 -39
- package/skills/weaver-e10-yepiaotong/references/reim-matching-rules.md +55 -22
- package/skills/weaver-e10-yepiaotong/references/reim-phone-subsidy-rules.md +7 -17
- package/skills/weaver-e10-yepiaotong/references/reim-workflow.md +88 -92
- package/skills/weaver-e10-yepiaotong/references/source-manifest.json +144 -354
- package/skills/weaver-e10-yimiaoban/SKILL.md +1 -1
- package/skills/weaver-e10-yimiaoban/references/msg-write.md +1 -1
- package/skills/weaver-e10-yimiaoban/references/safety-boundaries.md +1 -1
- package/skills/weaver-e10-yimiaoban/references/source-manifest.json +7 -7
- package/dist/chunks/chunk-TTPJJJC4.js +0 -465
- package/dist/chunks/registry-BKBZPBAJ.js +0 -23
- package/dist/shortcuts/invoice/markdown.js +0 -172
- package/dist/shortcuts/invoice/operations/issuing-qys.js +0 -424
- package/skills/weaver-e10-meeting.zip +0 -0
- package/skills/weaver-e10-yepiaotong/references/invoice-issuing-examples.md +0 -131
- package/skills/weaver-e10-yepiaotong/references/invoice-issuing-form-fill-rules.md +0 -179
|
@@ -2,18 +2,26 @@ import { createRequire as __esbuildCreateRequire } from 'node:module';
|
|
|
2
2
|
const require = __esbuildCreateRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
InvoiceCliError,
|
|
5
|
+
Option,
|
|
5
6
|
createInvoiceHost,
|
|
6
7
|
invoiceConfirmationError,
|
|
7
8
|
invoicePartialError,
|
|
8
9
|
invoiceValidationError,
|
|
9
10
|
isInvoiceNetworkError
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import
|
|
12
|
-
|
|
11
|
+
} from "./chunk-BCVYBYYT.js";
|
|
12
|
+
import {
|
|
13
|
+
reportPlatformError
|
|
14
|
+
} from "./chunk-6N4JPNFL.js";
|
|
15
|
+
import {
|
|
16
|
+
CONTINUATION_TTL_MS,
|
|
17
|
+
CONTINUATION_TTL_SECONDS
|
|
18
|
+
} from "./chunk-7BDPM5ST.js";
|
|
19
|
+
import "./chunk-ETNJSKMM.js";
|
|
20
|
+
import "./chunk-UFIT2UU3.js";
|
|
13
21
|
import {
|
|
14
22
|
isCliError,
|
|
15
23
|
toErrorEnvelope
|
|
16
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-UG5G54VL.js";
|
|
17
25
|
import "./chunk-BUSC6UAE.js";
|
|
18
26
|
|
|
19
27
|
// src/shortcuts/invoice/index.ts
|
|
@@ -52,7 +60,7 @@ function signature(payload, key) {
|
|
|
52
60
|
}
|
|
53
61
|
function createInvoiceContinuationSigner(ctx) {
|
|
54
62
|
return {
|
|
55
|
-
async issue(payload, ttlMs =
|
|
63
|
+
async issue(payload, ttlMs = CONTINUATION_TTL_MS) {
|
|
56
64
|
const issuedAt = Date.now();
|
|
57
65
|
const body = encode({ ...payload, issuedAt, expiresAt: issuedAt + ttlMs });
|
|
58
66
|
const sig = signature(body, await loadKey(ctx));
|
|
@@ -83,157 +91,71 @@ function createInvoiceContinuationSigner(ctx) {
|
|
|
83
91
|
};
|
|
84
92
|
}
|
|
85
93
|
|
|
86
|
-
// src/shortcuts/invoice/
|
|
87
|
-
var
|
|
88
|
-
var
|
|
89
|
-
"
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
return
|
|
101
|
-
}
|
|
102
|
-
function markdownViewFor(operation) {
|
|
103
|
-
const view = MARKDOWN_VIEWS[operation];
|
|
104
|
-
if (!view) {
|
|
105
|
-
throw invoiceValidationError(
|
|
106
|
-
"format_unsupported",
|
|
107
|
-
`${operation} \u4E0D\u652F\u6301 --format markdown\uFF08\u4EC5 ${[...MARKDOWN_OPERATIONS].join("\u3001")}\uFF09`
|
|
108
|
-
);
|
|
109
|
-
}
|
|
110
|
-
return view;
|
|
111
|
-
}
|
|
112
|
-
function assertMarkdownSupported(operation, format) {
|
|
113
|
-
if (format === "markdown") markdownViewFor(operation);
|
|
94
|
+
// src/shortcuts/invoice/invoice-record.ts
|
|
95
|
+
var FULL_EXT_MASK = 2147483647;
|
|
96
|
+
var EXT_INFO_FIELDS = [
|
|
97
|
+
"expenseNote",
|
|
98
|
+
"content",
|
|
99
|
+
"city",
|
|
100
|
+
"province",
|
|
101
|
+
"comment",
|
|
102
|
+
"from",
|
|
103
|
+
"to",
|
|
104
|
+
"stationGetOn",
|
|
105
|
+
"stationGetOff"
|
|
106
|
+
];
|
|
107
|
+
function asRecord(value) {
|
|
108
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
114
109
|
}
|
|
115
110
|
function text(value) {
|
|
116
111
|
if (value === void 0 || value === null) return "";
|
|
117
112
|
return String(value).replace(/^\uFEFF/u, "").trim();
|
|
118
113
|
}
|
|
119
|
-
function
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
|
|
114
|
+
function firstText(...values) {
|
|
115
|
+
for (const value of values) {
|
|
116
|
+
const candidate = text(value);
|
|
117
|
+
if (candidate) return candidate;
|
|
118
|
+
}
|
|
119
|
+
return "";
|
|
123
120
|
}
|
|
124
|
-
function
|
|
125
|
-
const
|
|
126
|
-
|
|
127
|
-
const
|
|
128
|
-
|
|
129
|
-
const [int, frac = ""] = Math.abs(num).toFixed(2).split(".");
|
|
130
|
-
return `${num < 0 ? "-" : ""}\xA5${int.replace(/\B(?=(\d{3})+(?!\d))/gu, ",")}.${frac}`;
|
|
121
|
+
function invoiceRecordOf(item) {
|
|
122
|
+
const record = asRecord(item);
|
|
123
|
+
const inner = asRecord(record.info);
|
|
124
|
+
const hasOwnInvoiceFields = record.comm_info !== void 0 || record.fid !== void 0 || record.number !== void 0;
|
|
125
|
+
return !hasOwnInvoiceFields && Object.keys(inner).length ? inner : record;
|
|
131
126
|
}
|
|
132
|
-
function
|
|
127
|
+
function parseInvoiceExt(value) {
|
|
128
|
+
if (value && typeof value === "object") return asRecord(value);
|
|
133
129
|
const raw = text(value);
|
|
134
|
-
if (!raw) return
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
if (scope === "enterprise") return "\u4F01\u4E1A\u7968\u5939";
|
|
141
|
-
if (scope === "personal") return "\u4E2A\u4EBA\u7968\u5939";
|
|
142
|
-
return "\u7968\u5939";
|
|
143
|
-
}
|
|
144
|
-
function reimCell(item) {
|
|
145
|
-
const requests = Array.isArray(item.reimRequests) ? item.reimRequests.filter(Boolean) : [];
|
|
146
|
-
if (!requests.length) return "\u672A\u6302\u5355";
|
|
147
|
-
return `\u5DF2\u6302\u5355\u2192${requests.map((name) => text(name)).join("\u3001")}`;
|
|
148
|
-
}
|
|
149
|
-
function linkCell(record) {
|
|
150
|
-
const number = text(record.number);
|
|
151
|
-
const url = text(record.detailUrl);
|
|
152
|
-
if (!number) return "\u2014";
|
|
153
|
-
return url ? `[${number}](${url})` : number;
|
|
154
|
-
}
|
|
155
|
-
function renderList(operation, data) {
|
|
156
|
-
const items = Array.isArray(data.items) ? data.items : [];
|
|
157
|
-
const lines = [];
|
|
158
|
-
const scope = operation === "invoice.enterprise.list" ? "enterprise" : data.scope;
|
|
159
|
-
const head = [`**${scopeLabel(scope)} \xB7 \u5171 ${text(data.total) || items.length} \u5F20 \xB7 \u5408\u8BA1 ${money(data.totalAmount)}**`];
|
|
160
|
-
const pageNote = `\u672C\u9875 ${items.length} \u6761${data.hasMore ? "\uFF0C\u8FD8\u6709\u66F4\u591A" : ""}`;
|
|
161
|
-
lines.push(`${head[0]}\uFF08${pageNote}\uFF09`);
|
|
162
|
-
if (data.totalAmountExcludingTax !== void 0) {
|
|
163
|
-
lines.push(`\u4E0D\u542B\u7A0E\u5408\u8BA1 ${money(data.totalAmountExcludingTax)}`);
|
|
164
|
-
}
|
|
165
|
-
lines.push("");
|
|
166
|
-
lines.push("| # | \u53D1\u7968\u53F7\u7801 | \u5F00\u7968\u65E5\u671F | \u7968\u79CD | \u4EF7\u7A0E\u5408\u8BA1 | \u8D2D\u65B9 | \u9500\u65B9 | \u62A5\u9500 |");
|
|
167
|
-
lines.push("| --- | --- | --- | --- | --- | --- | --- | --- |");
|
|
168
|
-
if (!items.length) {
|
|
169
|
-
lines.push("| \u2014 | \u2014 | \u2014 | \u2014 | \u2014 | \u2014 | \u2014 | \u2014 |");
|
|
170
|
-
return lines.join("\n");
|
|
171
|
-
}
|
|
172
|
-
items.forEach((item, index) => {
|
|
173
|
-
const record = item && typeof item === "object" ? item : {};
|
|
174
|
-
lines.push([
|
|
175
|
-
"",
|
|
176
|
-
index + 1,
|
|
177
|
-
linkCell(record),
|
|
178
|
-
cell(record.date),
|
|
179
|
-
shortType(record.typeName),
|
|
180
|
-
money(record.total),
|
|
181
|
-
cell(record.buyer),
|
|
182
|
-
cell(record.payer),
|
|
183
|
-
cell(reimCell(record), "\u672A\u6302\u5355"),
|
|
184
|
-
""
|
|
185
|
-
].join(" | ").trim());
|
|
186
|
-
});
|
|
187
|
-
return lines.join("\n");
|
|
130
|
+
if (!raw) return {};
|
|
131
|
+
try {
|
|
132
|
+
return asRecord(JSON.parse(raw));
|
|
133
|
+
} catch {
|
|
134
|
+
return {};
|
|
135
|
+
}
|
|
188
136
|
}
|
|
189
|
-
function
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
["\u9500\u65B9", cell(record.payer)],
|
|
212
|
-
["\u8D2D\u65B9", cell(record.buyer)],
|
|
213
|
-
["\u8D39\u7528\u8BF4\u660E", cell(record.expenseNote)],
|
|
214
|
-
["\u5F00\u7968\u4EBA", cell(record.issuer)],
|
|
215
|
-
["\u67E5\u9A8C\u6807\u8BB0", checkStateText(record.checkState)],
|
|
216
|
-
["\u62A5\u9500", reimCell(record)],
|
|
217
|
-
["\u9644\u4EF6", attachmentText(record.attachments)]
|
|
218
|
-
];
|
|
219
|
-
for (const [label, value] of rows) lines.push(`| ${label} | ${value} |`);
|
|
220
|
-
return lines.join("\n");
|
|
221
|
-
}).join("\n\n---\n\n");
|
|
222
|
-
}
|
|
223
|
-
function checkStateText(value) {
|
|
224
|
-
if (value === void 0 || value === null) return "\u2014";
|
|
225
|
-
return Number(value) === 0 ? "\u672A\u67E5\u9A8C(0)" : `\u5DF2\u67E5\u9A8C(${text(value)})`;
|
|
226
|
-
}
|
|
227
|
-
function attachmentText(attachments) {
|
|
228
|
-
const list = Array.isArray(attachments) ? attachments : [];
|
|
229
|
-
if (!list.length) return "\u65E0";
|
|
230
|
-
return `${list.length} \u4E2A\uFF1A${list.map((entry) => text(entry?.name) || text(entry?.id) || "\u672A\u547D\u540D").join("\u3001")}`;
|
|
231
|
-
}
|
|
232
|
-
function renderInvoiceMarkdown(operation, data) {
|
|
233
|
-
const view = markdownViewFor(operation);
|
|
234
|
-
const body = view === "detail" ? renderDetail(data) : renderList(operation, data);
|
|
235
|
-
return `${body}
|
|
236
|
-
`;
|
|
137
|
+
function productNames(products) {
|
|
138
|
+
if (!Array.isArray(products)) return "";
|
|
139
|
+
return products.map((product) => text(asRecord(product).name)).filter(Boolean).join("\u3001");
|
|
140
|
+
}
|
|
141
|
+
function invoiceExtInfo(invoice) {
|
|
142
|
+
const ext = parseInvoiceExt(invoice.ext);
|
|
143
|
+
const passenger = asRecord(Array.isArray(ext.passengersService) ? ext.passengersService[0] : void 0);
|
|
144
|
+
const info = {
|
|
145
|
+
expenseNote: text(ext.expenseDesc),
|
|
146
|
+
content: firstText(ext.content, productNames(ext.products)),
|
|
147
|
+
city: text(ext.city),
|
|
148
|
+
province: firstText(ext.province, invoice.province),
|
|
149
|
+
comment: text(ext.comment),
|
|
150
|
+
from: firstText(ext.from, invoice.from, passenger.from),
|
|
151
|
+
to: firstText(ext.to, invoice.to, passenger.to),
|
|
152
|
+
stationGetOn: firstText(ext.station_geton, invoice.station_geton, passenger.station_geton),
|
|
153
|
+
stationGetOff: firstText(ext.station_getoff, invoice.station_getoff, passenger.station_getoff)
|
|
154
|
+
};
|
|
155
|
+
for (const [key, value] of Object.entries(info)) {
|
|
156
|
+
if (!value) delete info[key];
|
|
157
|
+
}
|
|
158
|
+
return info;
|
|
237
159
|
}
|
|
238
160
|
|
|
239
161
|
// src/shortcuts/invoice/projection.ts
|
|
@@ -253,6 +175,7 @@ var SUMMARY_ITEM_FIELDS = [
|
|
|
253
175
|
"buyerTaxNo",
|
|
254
176
|
"payer",
|
|
255
177
|
"payerTaxNo",
|
|
178
|
+
...EXT_INFO_FIELDS,
|
|
256
179
|
"valid",
|
|
257
180
|
"status",
|
|
258
181
|
"reimState",
|
|
@@ -260,7 +183,7 @@ var SUMMARY_ITEM_FIELDS = [
|
|
|
260
183
|
"fileName",
|
|
261
184
|
"detailUrl"
|
|
262
185
|
];
|
|
263
|
-
function
|
|
186
|
+
function asRecord2(value) {
|
|
264
187
|
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
265
188
|
}
|
|
266
189
|
function text2(value) {
|
|
@@ -270,14 +193,15 @@ function text2(value) {
|
|
|
270
193
|
function numberOrUndefined(value) {
|
|
271
194
|
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
272
195
|
}
|
|
273
|
-
function summarizeInvoiceItem(
|
|
274
|
-
const
|
|
275
|
-
const
|
|
276
|
-
const
|
|
277
|
-
const
|
|
278
|
-
const
|
|
279
|
-
const
|
|
280
|
-
const
|
|
196
|
+
function summarizeInvoiceItem(raw) {
|
|
197
|
+
const item = invoiceRecordOf(raw);
|
|
198
|
+
const comm = asRecord2(item.comm_info);
|
|
199
|
+
const pro = asRecord2(comm.pro);
|
|
200
|
+
const price = asRecord2(comm.price);
|
|
201
|
+
const buyer = asRecord2(comm.buyer);
|
|
202
|
+
const payer = asRecord2(comm.payer);
|
|
203
|
+
const modify = asRecord2(item.modify_info);
|
|
204
|
+
const reimList = Array.isArray(asRecord2(item.oreim).list_reim) ? asRecord2(item.oreim).list_reim : [];
|
|
281
205
|
const summary = {
|
|
282
206
|
fid: text2(item.fid ?? item.id),
|
|
283
207
|
number: text2(item.number),
|
|
@@ -291,10 +215,11 @@ function summarizeInvoiceItem(item) {
|
|
|
291
215
|
buyerTaxNo: text2(buyer.tcode),
|
|
292
216
|
payer: text2(payer.company),
|
|
293
217
|
payerTaxNo: text2(payer.tcode),
|
|
218
|
+
...invoiceExtInfo(item),
|
|
294
219
|
valid: numberOrUndefined(pro.valid),
|
|
295
220
|
status: numberOrUndefined(pro.status),
|
|
296
221
|
reimState: numberOrUndefined(pro.sreim),
|
|
297
|
-
reimRequests: reimList.map((entry) => text2(
|
|
222
|
+
reimRequests: reimList.map((entry) => text2(asRecord2(entry).name)).filter(Boolean),
|
|
298
223
|
fileName: text2(modify.fname),
|
|
299
224
|
detailUrl: text2(item.detailUrl)
|
|
300
225
|
};
|
|
@@ -310,24 +235,14 @@ function summarizeListData(data) {
|
|
|
310
235
|
for (const key of ["total", "totalAmount", "totalAmountExcludingTax", "hasMore", "scope"]) {
|
|
311
236
|
if (data[key] !== void 0 && data[key] !== null) summary[key] = data[key];
|
|
312
237
|
}
|
|
313
|
-
summary.items = items.map((item) => summarizeInvoiceItem(
|
|
238
|
+
summary.items = items.map((item) => summarizeInvoiceItem(asRecord2(item)));
|
|
314
239
|
summary.itemCount = summary.items.length;
|
|
315
240
|
return summary;
|
|
316
241
|
}
|
|
317
|
-
var DETAIL_EXTRA_FIELDS = ["
|
|
242
|
+
var DETAIL_EXTRA_FIELDS = ["issuer", "checkState", "attachments"];
|
|
318
243
|
var DETAIL_ITEM_FIELDS = [...SUMMARY_ITEM_FIELDS, ...DETAIL_EXTRA_FIELDS];
|
|
319
|
-
function parseExt(value) {
|
|
320
|
-
if (value && typeof value === "object") return asRecord(value);
|
|
321
|
-
const raw = text2(value);
|
|
322
|
-
if (!raw) return {};
|
|
323
|
-
try {
|
|
324
|
-
return asRecord(JSON.parse(raw));
|
|
325
|
-
} catch {
|
|
326
|
-
return {};
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
244
|
function attachmentOf(entry) {
|
|
330
|
-
const record =
|
|
245
|
+
const record = asRecord2(entry);
|
|
331
246
|
return {
|
|
332
247
|
id: text2(record.fileId ?? record.id),
|
|
333
248
|
name: text2(record.name),
|
|
@@ -335,16 +250,14 @@ function attachmentOf(entry) {
|
|
|
335
250
|
};
|
|
336
251
|
}
|
|
337
252
|
function summarizeInvoiceDetailItem(wrapper) {
|
|
338
|
-
const info =
|
|
253
|
+
const info = asRecord2(wrapper.info);
|
|
339
254
|
const detail = {
|
|
340
255
|
...summarizeInvoiceItem({
|
|
341
256
|
...info,
|
|
342
257
|
detailUrl: info.detailUrl ?? wrapper.detailUrl
|
|
343
258
|
})
|
|
344
259
|
};
|
|
345
|
-
const ext =
|
|
346
|
-
const expenseNote = text2(ext.expenseDesc);
|
|
347
|
-
if (expenseNote) detail.expenseNote = expenseNote;
|
|
260
|
+
const ext = parseInvoiceExt(info.ext);
|
|
348
261
|
const issuer = text2(ext.issuer);
|
|
349
262
|
if (issuer) detail.issuer = issuer;
|
|
350
263
|
if (typeof wrapper.is_valid === "number") detail.checkState = wrapper.is_valid;
|
|
@@ -356,7 +269,7 @@ function summarizeDetailData(data) {
|
|
|
356
269
|
const infos = Array.isArray(data.infos) ? data.infos : [];
|
|
357
270
|
const detail = {};
|
|
358
271
|
if (data.scope !== void 0 && data.scope !== null) detail.scope = data.scope;
|
|
359
|
-
detail.items = infos.map((entry) => summarizeInvoiceDetailItem(
|
|
272
|
+
detail.items = infos.map((entry) => summarizeInvoiceDetailItem(asRecord2(entry)));
|
|
360
273
|
detail.itemCount = detail.items.length;
|
|
361
274
|
return detail;
|
|
362
275
|
}
|
|
@@ -408,28 +321,6 @@ function normalizeView(value) {
|
|
|
408
321
|
}
|
|
409
322
|
return view;
|
|
410
323
|
}
|
|
411
|
-
function resolveView(operation, projection) {
|
|
412
|
-
const { view, fields, format } = projection;
|
|
413
|
-
if (format !== "markdown") return view ?? "full";
|
|
414
|
-
assertMarkdownSupported(operation, format);
|
|
415
|
-
const expected = markdownViewFor(operation);
|
|
416
|
-
if (fields?.length) {
|
|
417
|
-
throw invoiceValidationError(
|
|
418
|
-
"input_conflict",
|
|
419
|
-
"--format markdown \u81EA\u5E26\u5B57\u6BB5\u53E3\u5F84\uFF0C\u4E0D\u63A5\u53D7 --fields\uFF1B\u8981\u81EA\u5B9A\u4E49\u5B57\u6BB5\u8BF7\u7528 --fields \u8F93\u51FA JSON"
|
|
420
|
-
);
|
|
421
|
-
}
|
|
422
|
-
if (view && view !== expected) {
|
|
423
|
-
throw invoiceValidationError(
|
|
424
|
-
"input_conflict",
|
|
425
|
-
`--format markdown \u56FA\u5B9A\u4F7F\u7528 ${expected} \u89C6\u56FE\uFF0C\u4E0E --view ${view} \u51B2\u7A81`
|
|
426
|
-
);
|
|
427
|
-
}
|
|
428
|
-
return expected;
|
|
429
|
-
}
|
|
430
|
-
function formatFrom(value) {
|
|
431
|
-
return normalizeFormat(value);
|
|
432
|
-
}
|
|
433
324
|
function assertProjectionSupported(operation, projection) {
|
|
434
325
|
const { view, fields } = projection;
|
|
435
326
|
if (view && fields?.length) {
|
|
@@ -447,12 +338,11 @@ function assertProjectionSupported(operation, projection) {
|
|
|
447
338
|
`${operation} \u4E0D\u652F\u6301 --view detail\uFF08\u4EC5 ${[...DETAIL_OPERATIONS].join("\u3001")}\uFF09`
|
|
448
339
|
);
|
|
449
340
|
}
|
|
450
|
-
resolveView(operation, projection);
|
|
451
341
|
}
|
|
452
342
|
function applyInvoiceProjection(operation, data, projection) {
|
|
453
343
|
assertProjectionSupported(operation, projection);
|
|
454
344
|
const { fields } = projection;
|
|
455
|
-
const view =
|
|
345
|
+
const view = projection.view ?? "full";
|
|
456
346
|
const activeMeta = (base) => ({
|
|
457
347
|
projection: { view, ...base }
|
|
458
348
|
});
|
|
@@ -472,7 +362,7 @@ function applyInvoiceProjection(operation, data, projection) {
|
|
|
472
362
|
const targets = Array.isArray(data.items) ? data.items : [data];
|
|
473
363
|
const missingSet = new Set(fields);
|
|
474
364
|
const projected = targets.map((target) => {
|
|
475
|
-
const { picked, missing } = pickPaths(
|
|
365
|
+
const { picked, missing } = pickPaths(asRecord2(target), fields);
|
|
476
366
|
for (const field of fields) {
|
|
477
367
|
if (!missing.includes(field)) missingSet.delete(field);
|
|
478
368
|
}
|
|
@@ -530,10 +420,15 @@ function epochEndDateProperty(label) {
|
|
|
530
420
|
}
|
|
531
421
|
var listProperties = {
|
|
532
422
|
page_size: { type: "integer", minimum: 1, maximum: 200 },
|
|
533
|
-
start_pos: { type: "integer", minimum: 0 },
|
|
423
|
+
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" },
|
|
534
424
|
req_type: { type: "integer", enum: [0, 1, 7, 8] },
|
|
535
425
|
mask: { type: "integer", minimum: 0 },
|
|
536
|
-
mext: {
|
|
426
|
+
mext: {
|
|
427
|
+
type: "integer",
|
|
428
|
+
minimum: 0,
|
|
429
|
+
default: FULL_EXT_MASK,
|
|
430
|
+
description: `\u6309\u4F4D\u9009\u62E9\u8FD4\u56DE\u54EA\u4E9B ext \u5B57\u6BB5\uFF081=trate\u30012=ttax \u2026\uFF09\uFF1B\u4E0D\u4F20\u6309 ${FULL_EXT_MASK} \u8FD4\u56DE\u5B8C\u6574 ext\uFF08\u8D39\u7528\u8BF4\u660E\u3001\u57CE\u5E02\u3001\u5907\u6CE8\u3001\u8D77\u6B62\u5730\u7B49\uFF09\uFF0C\u4F20 0 \u4E0D\u8FD4\u56DE ext\u3002`
|
|
431
|
+
},
|
|
537
432
|
content: { type: "string" },
|
|
538
433
|
types: { type: "array", items: { type: "integer" } },
|
|
539
434
|
date_begin: epochDateProperty("\u5F00\u7968\u65E5\u671F\u8D77\uFF08\u542B\uFF09"),
|
|
@@ -585,94 +480,6 @@ var listProperties = {
|
|
|
585
480
|
var positiveId = { type: "string", pattern: "^[1-9]\\d*$" };
|
|
586
481
|
var positiveIdArray = { type: "array", minItems: 1, maxItems: 100, items: positiveId };
|
|
587
482
|
var jsonObject = { type: "object", additionalProperties: true };
|
|
588
|
-
var reimFieldValue = {
|
|
589
|
-
type: "object",
|
|
590
|
-
additionalProperties: false,
|
|
591
|
-
properties: {
|
|
592
|
-
fieldId: { type: "string", minLength: 1 },
|
|
593
|
-
fieldName: { type: "string" },
|
|
594
|
-
value: {},
|
|
595
|
-
optionValue: {},
|
|
596
|
-
unable_to_fill: { type: "boolean" },
|
|
597
|
-
need_search: { type: "boolean" }
|
|
598
|
-
},
|
|
599
|
-
required: ["fieldId"]
|
|
600
|
-
};
|
|
601
|
-
var reimNeedUserConfirm = {
|
|
602
|
-
type: "object",
|
|
603
|
-
additionalProperties: false,
|
|
604
|
-
properties: {
|
|
605
|
-
fieldId: { type: "string", minLength: 1 },
|
|
606
|
-
fieldName: { type: "string" },
|
|
607
|
-
dataIndex: { type: ["integer", "null"], minimum: 1 },
|
|
608
|
-
reason: { type: "string", minLength: 1 },
|
|
609
|
-
candidates: {
|
|
610
|
-
type: "array",
|
|
611
|
-
items: {
|
|
612
|
-
type: "object",
|
|
613
|
-
additionalProperties: true,
|
|
614
|
-
properties: {
|
|
615
|
-
id: { type: "string", minLength: 1 },
|
|
616
|
-
name: { type: "string" }
|
|
617
|
-
}
|
|
618
|
-
}
|
|
619
|
-
}
|
|
620
|
-
},
|
|
621
|
-
required: ["fieldId", "reason"]
|
|
622
|
-
};
|
|
623
|
-
var reimUnableToFill = {
|
|
624
|
-
type: "object",
|
|
625
|
-
additionalProperties: false,
|
|
626
|
-
properties: {
|
|
627
|
-
fieldId: { type: "string", minLength: 1 },
|
|
628
|
-
fieldName: { type: "string" },
|
|
629
|
-
dataIndex: { type: ["integer", "null"], minimum: 1 },
|
|
630
|
-
reason: { type: "string", minLength: 1 }
|
|
631
|
-
},
|
|
632
|
-
required: ["fieldId", "reason"]
|
|
633
|
-
};
|
|
634
|
-
var reimDetailRow = {
|
|
635
|
-
type: "object",
|
|
636
|
-
additionalProperties: false,
|
|
637
|
-
properties: {
|
|
638
|
-
dataIndex: { type: "integer", minimum: 1 },
|
|
639
|
-
subFormId: { type: "string", minLength: 1 },
|
|
640
|
-
invoiceId: { type: "string", minLength: 1 },
|
|
641
|
-
fields: { type: "array", items: reimFieldValue }
|
|
642
|
-
},
|
|
643
|
-
required: ["dataIndex", "subFormId", "invoiceId", "fields"]
|
|
644
|
-
};
|
|
645
|
-
var reimFlowCreateProperties = {
|
|
646
|
-
work_flow_id: { type: "string", minLength: 1, description: "\u76EE\u6807\u62A5\u9500\u6D41\u7A0B\u7684\u5DE5\u4F5C\u6D41 ID\u3002" },
|
|
647
|
-
mainFormId: { type: "string", minLength: 1, description: "\u62A5\u9500\u5355\u4E3B\u8868 formId\uFF0C\u6765\u81EA invoice.reim.form.structure\u3002" },
|
|
648
|
-
request_name: { type: "string", minLength: 1, description: "\u6D41\u7A0B\u6807\u9898\u3002" },
|
|
649
|
-
main_fields: { type: "array", items: reimFieldValue, description: "\u4E3B\u8868\u5B57\u6BB5\u503C\u5217\u8868\u3002" },
|
|
650
|
-
detail_rows: { type: "array", minItems: 1, items: reimDetailRow, description: "\u660E\u7EC6\u8868\u884C\u6570\u636E\u3002" },
|
|
651
|
-
need_user_confirm: { type: "array", items: reimNeedUserConfirm, description: "\u9700\u7528\u6237\u786E\u8BA4\u7684\u5B57\u6BB5\u3002" },
|
|
652
|
-
unable_to_fill: { type: "array", items: reimUnableToFill, description: "\u65E0\u6CD5\u81EA\u52A8\u586B\u5199\u7684\u5B57\u6BB5\u3002" }
|
|
653
|
-
};
|
|
654
|
-
var reimFlowCreateRequired = ["work_flow_id", "mainFormId", "request_name", "main_fields", "detail_rows"];
|
|
655
|
-
var reimFlowUpdateProperties = {
|
|
656
|
-
requestId: { type: "string", minLength: 1, description: "\u8981\u66F4\u65B0\u7684\u6D41\u7A0B requestId\u3002" },
|
|
657
|
-
mainFormId: { type: "string", minLength: 1, description: "\u62A5\u9500\u5355\u4E3B\u8868 formId\u3002" },
|
|
658
|
-
main_fields: { type: "array", minItems: 1, items: reimFieldValue, description: "\u9700\u8981\u66F4\u65B0\u7684\u4E3B\u8868\u5B57\u6BB5\u5217\u8868\u3002" },
|
|
659
|
-
detail_rows: { type: "array", minItems: 1, items: reimDetailRow, description: "\u9700\u8981\u66F4\u65B0\u6216\u65B0\u589E\u7684\u660E\u7EC6\u884C\u6570\u636E\u3002" },
|
|
660
|
-
deleteDetailRows: {
|
|
661
|
-
type: "array",
|
|
662
|
-
minItems: 1,
|
|
663
|
-
items: {
|
|
664
|
-
type: "object",
|
|
665
|
-
additionalProperties: true,
|
|
666
|
-
properties: {
|
|
667
|
-
detailId: { type: "string", minLength: 1 },
|
|
668
|
-
dataIndex: { type: "integer", minimum: 1 }
|
|
669
|
-
}
|
|
670
|
-
},
|
|
671
|
-
description: "\u9700\u8981\u5220\u9664\u7684\u660E\u7EC6\u884C\u3002"
|
|
672
|
-
},
|
|
673
|
-
need_user_confirm: { type: "array", items: reimNeedUserConfirm, description: "\u9700\u7528\u6237\u786E\u8BA4\u7684\u5B57\u6BB5\u3002" },
|
|
674
|
-
unable_to_fill: { type: "array", items: reimUnableToFill, description: "\u65E0\u6CD5\u81EA\u52A8\u586B\u5199\u7684\u5B57\u6BB5\u3002" }
|
|
675
|
-
};
|
|
676
483
|
var rawValue = { description: "\u670D\u52A1\u7AEF\u539F\u59CB\u5B57\u6BB5\uFF0C\u7C7B\u578B\u968F\u63A5\u53E3\u8FD4\u56DE\u800C\u5B9A\u3002" };
|
|
677
484
|
var rawObject = objectSchema({}, [], true);
|
|
678
485
|
var rawArray = arrayOf(rawObject);
|
|
@@ -829,22 +636,40 @@ var resultEnvelopeOutput = (dataSchema = rawValue) => objectSchema({
|
|
|
829
636
|
data: dataSchema,
|
|
830
637
|
workflow: workflowSchema
|
|
831
638
|
}, ["result", "data", "workflow"]);
|
|
639
|
+
var extInfoSchema = objectSchema({
|
|
640
|
+
expenseNote: { type: "string", description: "\u8D39\u7528\u8BF4\u660E\uFF08ext.expenseDesc\uFF09\uFF0C\u5982\u300C\u4E0A\u6D77-\u6B66\u6C49\u300D" },
|
|
641
|
+
content: { type: "string", description: "\u6D88\u8D39\u5185\u5BB9\uFF08ext.content\uFF1B\u4E3A\u7A7A\u65F6\u53D6 ext.products[].name\uFF09" },
|
|
642
|
+
city: { type: "string", description: "\u57CE\u5E02\uFF08ext.city\uFF09" },
|
|
643
|
+
province: { type: "string", description: "\u7701\u4EFD\uFF08ext.province\uFF0C\u4E3A\u7A7A\u65F6\u53D6\u7968\u9762 province\uFF09" },
|
|
644
|
+
comment: { type: "string", description: "\u5907\u6CE8\uFF08ext.comment\uFF09\uFF0C\u5E38\u5199\u51FA\u5DEE\u5730\u3001\u8BA2\u5355\u53F7\u548C\u884C\u7A0B" },
|
|
645
|
+
from: { type: "string", description: "\u51FA\u53D1\u5730\uFF08ext.from \u2192 \u7968\u9762 from \u2192 ext.passengersService[0].from\uFF09" },
|
|
646
|
+
to: { type: "string", description: "\u5230\u8FBE\u5730\uFF08ext.to \u2192 \u7968\u9762 to \u2192 ext.passengersService[0].to\uFF09" },
|
|
647
|
+
stationGetOn: { type: "string", description: "\u4E0A\u8F66\u7AD9\uFF08ext.station_geton\uFF09" },
|
|
648
|
+
stationGetOff: { type: "string", description: "\u4E0B\u8F66\u7AD9\uFF08ext.station_getoff\uFF09" }
|
|
649
|
+
});
|
|
650
|
+
var listInvoiceItemSchema = {
|
|
651
|
+
...invoiceInfoSchema,
|
|
652
|
+
properties: {
|
|
653
|
+
...invoiceInfoSchema.properties,
|
|
654
|
+
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" }
|
|
655
|
+
}
|
|
656
|
+
};
|
|
832
657
|
var listOutputSchema = objectSchema({
|
|
833
|
-
items: arrayOf(
|
|
834
|
-
total: { type: "integer" },
|
|
835
|
-
totalAmount: { type: "string" },
|
|
836
|
-
totalAmountExcludingTax: { type: "string" },
|
|
837
|
-
hasMore: { type: "boolean" },
|
|
658
|
+
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" }),
|
|
659
|
+
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" },
|
|
660
|
+
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" },
|
|
661
|
+
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" },
|
|
662
|
+
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" },
|
|
838
663
|
scope: { type: "string", enum: ["personal", "enterprise"] }
|
|
839
664
|
}, ["items", "total", "totalAmount", "totalAmountExcludingTax", "hasMore", "scope"]);
|
|
840
665
|
var summaryOutputView = {
|
|
841
666
|
name: "summary",
|
|
842
|
-
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\u7528 CLI \u7684 --view summary \u542F\u7528\u3002",
|
|
667
|
+
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",
|
|
843
668
|
itemFields: SUMMARY_ITEM_FIELDS
|
|
844
669
|
};
|
|
845
670
|
var detailOutputView = {
|
|
846
671
|
name: "detail",
|
|
847
|
-
description: "\u5355\u5F20\u53D1\u7968\u7684\u8BED\u4E49\u8BE6\u60C5\uFF1Asummary \u5B57\u6BB5\uFF0C\u5916\u52A0 attachments\uFF08\u9644\u4EF6\u6E05\u5355\uFF09\
|
|
672
|
+
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",
|
|
848
673
|
itemFields: DETAIL_ITEM_FIELDS
|
|
849
674
|
};
|
|
850
675
|
var uploadOutputSchema = objectSchema({
|
|
@@ -994,34 +819,6 @@ var workflowResolveDataSchema = objectSchema({
|
|
|
994
819
|
workFlowName: { type: "string" }
|
|
995
820
|
}, ["workFlowId", "workFlowName"]))
|
|
996
821
|
}, [], true);
|
|
997
|
-
var reimFieldOptionSchema = objectSchema({
|
|
998
|
-
optionId: { type: "string" },
|
|
999
|
-
optionName: { type: "string" },
|
|
1000
|
-
optionValue: { type: "string" }
|
|
1001
|
-
}, [], true);
|
|
1002
|
-
var reimFormFieldSchema = objectSchema({
|
|
1003
|
-
fieldId: { type: "string" },
|
|
1004
|
-
fieldName: { type: "string" },
|
|
1005
|
-
fieldType: { type: "string" },
|
|
1006
|
-
single: { type: "boolean" },
|
|
1007
|
-
marked: { type: "boolean" },
|
|
1008
|
-
options: arrayOf(reimFieldOptionSchema)
|
|
1009
|
-
}, ["fieldId", "fieldName", "fieldType"], true);
|
|
1010
|
-
var formStructureDataSchema = objectSchema({
|
|
1011
|
-
mainFormId: { type: "string" },
|
|
1012
|
-
mainFields: arrayOf(reimFormFieldSchema),
|
|
1013
|
-
subTables: arrayOf(objectSchema({
|
|
1014
|
-
subFormId: { type: "string" },
|
|
1015
|
-
subFormName: { type: "string" },
|
|
1016
|
-
subFields: arrayOf(reimFormFieldSchema)
|
|
1017
|
-
}, ["subFormId", "subFields"], true))
|
|
1018
|
-
}, ["mainFormId", "mainFields", "subTables"], true);
|
|
1019
|
-
var rowInfoDataSchema = objectSchema({
|
|
1020
|
-
date: { type: "string" },
|
|
1021
|
-
fysm: { type: "string" },
|
|
1022
|
-
itinerary: { type: "string" },
|
|
1023
|
-
subjectId: { type: "string" }
|
|
1024
|
-
}, [], true);
|
|
1025
822
|
var employeeSchema = objectSchema({
|
|
1026
823
|
id: { type: "string" },
|
|
1027
824
|
name: { type: "string" }
|
|
@@ -1036,32 +833,6 @@ var fieldSearchItemSchema = objectSchema({
|
|
|
1036
833
|
value: { type: "string" }
|
|
1037
834
|
}, ["id", "name"], true);
|
|
1038
835
|
var fieldSearchItemsSchema = arrayOf(fieldSearchItemSchema);
|
|
1039
|
-
var flowPreviewOutputSchema = objectSchema({
|
|
1040
|
-
requestName: { type: "string" },
|
|
1041
|
-
workflowId: { type: "string" },
|
|
1042
|
-
mainFormId: { type: "string" },
|
|
1043
|
-
mainFieldCount: { type: "integer" },
|
|
1044
|
-
detailRowCount: { type: "integer" }
|
|
1045
|
-
}, ["requestName", "workflowId", "mainFormId", "mainFieldCount", "detailRowCount"]);
|
|
1046
|
-
var flowUpdatePreviewOutputSchema = objectSchema({
|
|
1047
|
-
requestId: { type: "string" },
|
|
1048
|
-
mainFormId: { type: "string" },
|
|
1049
|
-
mainFieldCount: { type: "integer" },
|
|
1050
|
-
detailRowCount: { type: "integer" },
|
|
1051
|
-
deleteDetailRowCount: { type: "integer" }
|
|
1052
|
-
}, ["requestId", "mainFormId", "mainFieldCount", "detailRowCount", "deleteDetailRowCount"]);
|
|
1053
|
-
var flowCreateApplyOutputSchema = objectSchema({
|
|
1054
|
-
requestId: { type: "string" },
|
|
1055
|
-
requestName: { type: "string" },
|
|
1056
|
-
viewUrl: { type: "string", format: "uri" },
|
|
1057
|
-
result: rawObject,
|
|
1058
|
-
workflow: workflowSchema
|
|
1059
|
-
}, ["requestId", "requestName", "viewUrl", "result", "workflow"]);
|
|
1060
|
-
var flowUpdateApplyOutputSchema = objectSchema({
|
|
1061
|
-
requestId: { type: "string" },
|
|
1062
|
-
result: rawObject,
|
|
1063
|
-
workflow: workflowSchema
|
|
1064
|
-
}, ["requestId", "result", "workflow"]);
|
|
1065
836
|
var reimCandidateItemSchema = objectSchema({
|
|
1066
837
|
fid: { type: "string" },
|
|
1067
838
|
number: { type: "string" },
|
|
@@ -1080,113 +851,63 @@ var reimCandidatesOutputSchema = objectSchema({
|
|
|
1080
851
|
hasMore: { type: "boolean" },
|
|
1081
852
|
available: arrayOf(reimCandidateItemSchema),
|
|
1082
853
|
assigned: arrayOf(reimCandidateItemSchema),
|
|
1083
|
-
redReversed: arrayOf(reimCandidateItemSchema),
|
|
1084
854
|
summary: objectSchema({
|
|
1085
855
|
availableCount: { type: "integer" },
|
|
1086
856
|
assignedCount: { type: "integer" },
|
|
1087
|
-
redReversedCount: { type: "integer" },
|
|
1088
857
|
availableAmount: { type: "string" },
|
|
1089
|
-
assignedAmount: { type: "string" }
|
|
1090
|
-
|
|
1091
|
-
filteredRedReversedCount: { type: "integer" }
|
|
1092
|
-
}, ["availableCount", "assignedCount", "redReversedCount", "availableAmount", "assignedAmount", "redReversedAmount", "filteredRedReversedCount"]),
|
|
1093
|
-
warnings: arrayOf({ type: "string" }),
|
|
1094
|
-
workflow: workflowSchema
|
|
1095
|
-
}, ["total", "fetched", "hasMore", "available", "assigned", "redReversed", "summary", "warnings", "workflow"]);
|
|
1096
|
-
var reimTemplateInputProperties = {
|
|
1097
|
-
invoiceIds: { type: "array", minItems: 1, maxItems: 100, items: positiveId, description: "\u7528\u4E8E\u62A5\u9500\u7684\u53D1\u7968 fid \u5217\u8868\uFF0C\u5C06\u4F5C\u4E3A\u660E\u7EC6\u884C\u987A\u5E8F\u3002" },
|
|
1098
|
-
requestName: { type: "string", minLength: 1, maxLength: 100, description: "\u62A5\u9500\u5355\u6807\u9898\u3002" },
|
|
1099
|
-
workflowId: { ...positiveId, description: `\u76EE\u6807\u62A5\u9500\u6D41\u7A0B\u5DE5\u4F5C\u6D41 ID\u3002\u4E0D\u4F20\u65F6\u81EA\u52A8\u89E3\u6790\u552F\u4E00\u5019\u9009\uFF1B\u5F53\u524D\u6A21\u677F\u56FA\u5316\u6620\u5C04\u5BF9\u5E94\u7684\u6D41\u7A0B\u4E3A ${"100003460000000060"}\uFF08\u603B\u90E8\u8D39\u7528\u62A5\u9500\uFF09\u3002` },
|
|
1100
|
-
reason: { type: "string", maxLength: 500, description: "\u62A5\u9500\u4E8B\u7531\uFF0C\u7F3A\u7701\u4F7F\u7528 requestName\u3002" },
|
|
1101
|
-
relatedCustomerId: { ...positiveId, description: "\u76F8\u5173\u5BA2\u6237 ID\uFF08\u975E\u51FA\u5DEE\u573A\u666F\uFF09\u3002\u7F3A\u7701\u7559\u7A7A\u5E76\u4EA7\u751F warning\u3002" },
|
|
1102
|
-
relatedCustomerName: { type: "string", minLength: 1, maxLength: 200, description: "\u76F8\u5173\u5BA2\u6237\u540D\u79F0\u3002\u53EA\u4F20\u540D\u79F0\u65F6\u4F1A\u53CD\u67E5 ID\uFF1B\u4E0E relatedCustomerId \u540C\u65F6\u4F20\u65F6\u53EA\u7528\u4E8E\u6E32\u67D3\u9884\u89C8\u4E2D\u6587\u540D\uFF0C\u4E0D\u989D\u5916\u8BF7\u6C42\u3002" },
|
|
1103
|
-
contractNo: { type: "string", minLength: 1, maxLength: 100, description: '\u5408\u540C\u53F7\u3002\u672A\u4F20\u5165\u65F6\u9ED8\u8BA4\u4F7F\u7528 "20260999"\uFF0C\u4E0D\u518D\u7559\u7A7A\u3002' }
|
|
1104
|
-
};
|
|
1105
|
-
var reimPreviewLabeledFieldSchema = objectSchema({
|
|
1106
|
-
fieldId: { type: "string" },
|
|
1107
|
-
fieldName: { type: "string" },
|
|
1108
|
-
value: { type: "string" },
|
|
1109
|
-
optionValue: { type: "string" },
|
|
1110
|
-
text: { type: "string", description: "\u5DF2\u6E32\u67D3\u7684\u300C\u4E2D\u6587(id)\u300D\u6587\u672C\uFF0C\u53EF\u76F4\u63A5\u5C55\u793A\u3002" }
|
|
1111
|
-
});
|
|
1112
|
-
var reimPreviewLabeledRowSchema = objectSchema({
|
|
1113
|
-
dataIndex: { type: "integer" },
|
|
1114
|
-
invoiceId: { type: "string" },
|
|
1115
|
-
invoiceNumber: { type: "string" },
|
|
1116
|
-
amount: { type: "string" },
|
|
1117
|
-
expenseNote: { type: "string" },
|
|
1118
|
-
subject: { type: "string", description: "\u8D39\u7528\u79D1\u76EE\uFF0C\u5DF2\u6E32\u67D3\u6210\u300C\u4E2D\u6587(id)\u300D\u3002" },
|
|
1119
|
-
currency: { type: "string", description: "\u5E01\u79CD\uFF0C\u5DF2\u6E32\u67D3\u6210\u300C\u4E2D\u6587(id)\u300D\u3002" }
|
|
1120
|
-
});
|
|
1121
|
-
var reimTemplatePreviewSchema = objectSchema({
|
|
1122
|
-
...flowPreviewOutputSchema.properties,
|
|
1123
|
-
totalAmount: { type: "string" },
|
|
1124
|
-
invoiceCount: { type: "integer" },
|
|
1125
|
-
mainFields: arrayOf(reimPreviewLabeledFieldSchema, { description: "\u4E3B\u8868\u5B57\u6BB5\u7684\u53EF\u8BFB\u6E32\u67D3\uFF0C\u5B57\u5178\u7C7B ID \u5DF2\u5E26\u4E2D\u6587\u540D\u3002" }),
|
|
1126
|
-
detailRows: arrayOf(reimPreviewLabeledRowSchema, { description: "\u660E\u7EC6\u884C\u7684\u53EF\u8BFB\u6E32\u67D3\uFF0C\u79D1\u76EE/\u5E01\u79CD\u5DF2\u5E26\u4E2D\u6587\u540D\u3002" }),
|
|
1127
|
-
unresolvedLabels: arrayOf({ type: "string" }, { description: "\u672A\u80FD\u53D6\u5230\u4E2D\u6587\u540D\u7684 ID \u6E05\u5355\u3002" })
|
|
1128
|
-
}, ["requestName", "workflowId", "mainFormId", "mainFieldCount", "detailRowCount", "totalAmount", "invoiceCount", "mainFields", "detailRows", "unresolvedLabels"]);
|
|
1129
|
-
var reimTemplatePayloadSchema = objectSchema(reimFlowCreateProperties, [...reimFlowCreateRequired]);
|
|
1130
|
-
var reimLabelsSchema = objectSchema({
|
|
1131
|
-
workflow: objectSchema({ id: { type: "string" }, name: { type: "string" } }),
|
|
1132
|
-
mainFormId: { type: "string" },
|
|
1133
|
-
detailSubForm: objectSchema({ id: { type: "string" }, name: { type: "string" } }),
|
|
1134
|
-
employees: { type: "object", additionalProperties: { type: "string" } },
|
|
1135
|
-
subjects: { type: "object", additionalProperties: { type: "string" } },
|
|
1136
|
-
currencies: { type: "object", additionalProperties: { type: "string" } },
|
|
1137
|
-
customers: { type: "object", additionalProperties: { type: "string" } },
|
|
1138
|
-
selectOptions: { type: "object", additionalProperties: { type: "object", additionalProperties: { type: "string" } } },
|
|
1139
|
-
customer: { type: ["object", "null"], additionalProperties: true },
|
|
1140
|
-
unresolved: arrayOf({ type: "string" })
|
|
1141
|
-
}, ["workflow", "employees", "subjects", "currencies", "customers", "selectOptions", "unresolved"]);
|
|
1142
|
-
var reimTemplateBuildOutputSchema = objectSchema({
|
|
1143
|
-
payload: reimTemplatePayloadSchema,
|
|
1144
|
-
preview: reimTemplatePreviewSchema,
|
|
1145
|
-
labels: reimLabelsSchema,
|
|
858
|
+
assignedAmount: { type: "string" }
|
|
859
|
+
}, ["availableCount", "assignedCount", "availableAmount", "assignedAmount"]),
|
|
1146
860
|
warnings: arrayOf({ type: "string" }),
|
|
1147
861
|
workflow: workflowSchema
|
|
1148
|
-
}, ["
|
|
1149
|
-
var
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
}
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
862
|
+
}, ["total", "fetched", "hasMore", "available", "assigned", "summary", "warnings", "workflow"]);
|
|
863
|
+
var nullableText = { type: ["string", "null"] };
|
|
864
|
+
var issuingContractsOutputSchema = objectSchema({
|
|
865
|
+
cards: arrayOf(objectSchema({
|
|
866
|
+
requestId: { type: "string", description: "\u5408\u540C\u5BA1\u6279\u6D41\u7A0B\u7684 requestId" },
|
|
867
|
+
invoiced: { type: "boolean", description: "\u5408\u540C\u865A\u62DF\u8868\u67E5\u4E0D\u5230\u5F00\u7968\u660E\u7EC6\u65F6\u4E3A true\uFF08\u5DF2\u5F00\u7968\uFF09\uFF1B\u6709\u660E\u7EC6\u4E3A false\uFF08\u5F85\u5F00\u7968\uFF09" },
|
|
868
|
+
contractNo: { ...nullableText, description: "\u5408\u540C\u53F7\uFF1B\u5DF2\u5F00\u7968\u65F6\u4E3A null" },
|
|
869
|
+
customerName: { ...nullableText, description: "\u5BA2\u6237\uFF08\u8D2D\u65B9\uFF09\u540D\u79F0\uFF1B\u5DF2\u5F00\u7968\u65F6\u4E3A null" },
|
|
870
|
+
buyerTaxNo: { ...nullableText, description: "\u8D2D\u65B9\u7A0E\u53F7" },
|
|
871
|
+
sellerName: { ...nullableText, description: "\u9500\u552E\u65B9\u540D\u79F0" },
|
|
872
|
+
invoiceAmount: { ...nullableText, description: "\u5F00\u7968\u91D1\u989D\uFF1A\u5168\u90E8\u660E\u7EC6\u91D1\u989D\u4E4B\u548C\uFF0C\u4E24\u4F4D\u5C0F\u6570\uFF1B\u5DF2\u5F00\u7968\u65F6\u4E3A null" },
|
|
873
|
+
invoiceGroups: arrayOf(objectSchema({
|
|
874
|
+
group: { ...nullableText, description: "\u5206\u7EC4\u6807\u8BC6" },
|
|
875
|
+
amount: { type: "string", description: "\u8BE5\u5206\u7EC4\u660E\u7EC6\u91D1\u989D\u4E4B\u548C\uFF0C\u4E24\u4F4D\u5C0F\u6570" },
|
|
876
|
+
items: arrayOf(objectSchema({
|
|
877
|
+
name: { ...nullableText, description: "\u5F00\u7968\u9879\u76EE\uFF0C\u5982 \u6280\u672F\u670D\u52A1\u8D39" },
|
|
878
|
+
amount: { type: "string" }
|
|
879
|
+
}, ["name", "amount"]))
|
|
880
|
+
}, ["group", "amount", "items"]))
|
|
881
|
+
}, ["requestId", "invoiced", "contractNo", "customerName", "invoiceAmount", "invoiceGroups"], true)),
|
|
882
|
+
count: { type: "integer" },
|
|
883
|
+
pendingCount: { type: "integer", description: "\u5F85\u5F00\u7968\uFF08invoiced=false\uFF09\u6761\u6570" },
|
|
884
|
+
invoicedCount: { type: "integer", description: "\u5DF2\u5F00\u7968\uFF08invoiced=true\uFF09\u6761\u6570" }
|
|
885
|
+
}, ["cards", "count", "pendingCount", "invoicedCount"]);
|
|
886
|
+
var issuingContractDetailOutputSchema = objectSchema({
|
|
887
|
+
requestId: { type: "string", description: "\u5408\u540C\u5BA1\u6279\u6D41\u7A0B requestId" },
|
|
888
|
+
requestName: { ...nullableText, description: "\u5408\u540C\u5BA1\u6279\u6D41\u7A0B\u6807\u9898" },
|
|
889
|
+
workflowName: { ...nullableText, description: "\u5408\u540C\u5BA1\u6279\u6D41\u7A0B\u6240\u5C5E\u5DE5\u4F5C\u6D41" },
|
|
890
|
+
customer: {
|
|
891
|
+
type: ["object", "null"],
|
|
892
|
+
additionalProperties: false,
|
|
893
|
+
required: ["id", "name"],
|
|
894
|
+
properties: { id: { type: "string" }, name: { type: "string" } },
|
|
895
|
+
description: "\u5BA2\u6237\uFF1A\u53D6\u300C\u5BA2\u6237\u540D\u79F0\u300D\uFF0C\u6CA1\u6709\u65F6\u53D6\u300C\u6700\u7EC8\u7528\u6237\u5361\u7247\u300D\uFF1B\u5F00\u7968\u7533\u8BF7\u300C\u5408\u540C\u5BA2\u6237\u300D\u586B\u8FD9\u4E2A {id, name}"
|
|
896
|
+
},
|
|
897
|
+
customerSource: { ...nullableText, description: "customer \u53D6\u81EA\u54EA\u4E2A\u5B57\u6BB5\uFF1A\u5BA2\u6237\u540D\u79F0 / \u6700\u7EC8\u7528\u6237\u5361\u7247" },
|
|
898
|
+
contractDocuments: arrayOf(objectSchema({
|
|
899
|
+
docId: { ...nullableText, description: "\u6587\u6863 id\u3002\u5F00\u7968\u7533\u8BF7\u300C\u5408\u540C\u6587\u672C\u300D\u4E0E\u5408\u540C\u6D41\u7A0B\u4E00\u6837\u4F20 {id, name}\uFF0Cid \u7528\u8FD9\u4E2A\u503C" },
|
|
900
|
+
fileId: nullableText,
|
|
901
|
+
name: { ...nullableText, description: "\u6587\u4EF6\u540D\u3002\u5F00\u7968\u7533\u8BF7\u300C\u5408\u540C\u6587\u672C\u300D\u7684 name \u7528\u8FD9\u4E2A\u503C" }
|
|
902
|
+
}, ["docId", "fileId", "name"])),
|
|
903
|
+
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" }
|
|
904
|
+
}, ["requestId", "requestName", "workflowName", "customer", "customerSource", "contractDocuments", "contractDocIds"]);
|
|
1184
905
|
var invoiceOperations = [
|
|
1185
906
|
{
|
|
1186
907
|
name: "invoice.list",
|
|
1187
908
|
risk: "read",
|
|
1188
909
|
scope: "personal",
|
|
1189
|
-
fixed: { flag: 0, defaultSreim: "3", defaultBillType: 0 },
|
|
910
|
+
fixed: { flag: 0, defaultSreim: "3", defaultBillType: 0, excludeProStatus: 8 },
|
|
1190
911
|
inputSchema: { type: "object", additionalProperties: false, properties: listProperties },
|
|
1191
912
|
outputSchema: listOutputSchema,
|
|
1192
913
|
outputViews: [summaryOutputView]
|
|
@@ -1195,7 +916,7 @@ var invoiceOperations = [
|
|
|
1195
916
|
name: "invoice.enterprise.list",
|
|
1196
917
|
risk: "read",
|
|
1197
918
|
scope: "enterprise",
|
|
1198
|
-
fixed: { flag: 6, defaultSreim: "3", defaultBillType: 0 },
|
|
919
|
+
fixed: { flag: 6, defaultSreim: "3", defaultBillType: 0, excludeProStatus: 8 },
|
|
1199
920
|
inputSchema: { type: "object", additionalProperties: false, properties: listProperties },
|
|
1200
921
|
outputSchema: listOutputSchema,
|
|
1201
922
|
outputViews: [summaryOutputView]
|
|
@@ -1485,7 +1206,13 @@ var invoiceOperations = [
|
|
|
1485
1206
|
{
|
|
1486
1207
|
name: "invoice.reim.requests.list",
|
|
1487
1208
|
risk: "read",
|
|
1488
|
-
fixed: {
|
|
1209
|
+
fixed: {
|
|
1210
|
+
path: "/api/inc/book/getRequestListByTabId",
|
|
1211
|
+
defaultPageNo: 1,
|
|
1212
|
+
defaultPageSize: 100,
|
|
1213
|
+
defaultCusCreateDateEnd: "passedOrShanghaiToday+1",
|
|
1214
|
+
defaultCusCreateDateStart: "end-7d, page1Empty\u2192end-1month; scene=phone\u2192end-90d"
|
|
1215
|
+
},
|
|
1489
1216
|
inputSchema: {
|
|
1490
1217
|
type: "object",
|
|
1491
1218
|
additionalProperties: false,
|
|
@@ -1493,15 +1220,29 @@ var invoiceOperations = [
|
|
|
1493
1220
|
pageNo: { type: "integer", minimum: 1, maximum: 1e4, default: 1 },
|
|
1494
1221
|
pageSize: { type: "integer", minimum: 1, maximum: 200, default: 100, description: "\u6BCF\u9875\u6761\u6570\u3002\u4E0D\u4F20\u65F6\u9ED8\u8BA4 100\u3002" },
|
|
1495
1222
|
requestname: { type: "string", minLength: 1 },
|
|
1496
|
-
cusCreateDateStart: {
|
|
1223
|
+
cusCreateDateStart: {
|
|
1224
|
+
type: "string",
|
|
1225
|
+
pattern: "^\\d{4}-\\d{2}-\\d{2}$",
|
|
1226
|
+
description: "\u53D1\u8D77\u65E5\u671F\u5F00\u59CB\uFF08YYYY-MM-DD\uFF09\u3002\u7528\u6237\u6CA1\u6307\u5B9A\u65F6\u4E0D\u8981\u4F20\uFF1ACLI \u53D6\u7ED3\u675F\u65E5\u524D 7 \u5929\uFF0C\u7B2C 1 \u9875\u67E5\u4E0D\u5230\u518D\u653E\u5BBD\u5230\u7ED3\u675F\u65E5\u524D 1 \u4E2A\u6708\uFF1Bscene=phone \u65F6\u53D6\u7ED3\u675F\u65E5\u524D 90 \u5929\u3002"
|
|
1227
|
+
},
|
|
1497
1228
|
cusCreateDateEnd: {
|
|
1498
1229
|
type: "string",
|
|
1499
1230
|
pattern: "^\\d{4}-\\d{2}-\\d{2}$",
|
|
1500
1231
|
description: "\u53D1\u8D77\u65E5\u671F\u7ED3\u675F\uFF08YYYY-MM-DD\uFF09\u3002\u4E0D\u4F20\u65F6\u6309\u4E1C\u516B\u533A\u5F53\u5929 + 1 \u5929\u586B\u5165\uFF1B\u4F20\u5165\u65F6\u6309\u8BE5\u65E5\u671F\u518D + 1 \u5929\u540E\u53D1\u7ED9\u63A5\u53E3\u3002\u8C03\u7528\u65B9\u4F20\u4E1A\u52A1\u7ED3\u675F\u65E5\u672C\u8EAB\uFF0C\u4E0D\u8981\u81EA\u5DF1\u518D\u52A0 1 \u5929\u3002"
|
|
1501
|
-
}
|
|
1232
|
+
},
|
|
1233
|
+
scene: { type: "string", enum: ["phone"], description: '\u8BDD\u8D39\u62A5\u9500\u4F20 "phone"\uFF0C\u9ED8\u8BA4\u5F00\u59CB\u65E5\u6539\u4E3A\u7ED3\u675F\u65E5\u524D 90 \u5929\u3002' }
|
|
1502
1234
|
}
|
|
1503
1235
|
},
|
|
1504
|
-
outputSchema:
|
|
1236
|
+
outputSchema: objectSchema({
|
|
1237
|
+
result: rawObject,
|
|
1238
|
+
data: requestListDataSchema,
|
|
1239
|
+
workflow: workflowSchema,
|
|
1240
|
+
query: objectSchema({
|
|
1241
|
+
cusCreateDateStart: { type: "string", description: "\u672C\u6B21\u5B9E\u9645\u4F7F\u7528\u7684\u53D1\u8D77\u65E5\u671F\u5F00\u59CB" },
|
|
1242
|
+
cusCreateDateEnd: { type: "string", description: "\u672C\u6B21\u7684\u4E1A\u52A1\u7ED3\u675F\u65E5\uFF08\u53D1\u7ED9\u63A5\u53E3\u65F6\u5DF2\u518D + 1 \u5929\uFF09" },
|
|
1243
|
+
widened: { type: "boolean", description: "\u662F\u5426\u56E0 7 \u5929\u5185\u67E5\u4E0D\u5230\u800C\u653E\u5BBD\u5230 1 \u4E2A\u6708" }
|
|
1244
|
+
}, ["cusCreateDateStart", "cusCreateDateEnd", "widened"])
|
|
1245
|
+
}, ["result", "data", "workflow", "query"])
|
|
1505
1246
|
},
|
|
1506
1247
|
{
|
|
1507
1248
|
name: "invoice.reim.workflow.resolve",
|
|
@@ -1516,64 +1257,6 @@ var invoiceOperations = [
|
|
|
1516
1257
|
},
|
|
1517
1258
|
outputSchema: resultEnvelopeOutput(workflowResolveDataSchema)
|
|
1518
1259
|
},
|
|
1519
|
-
{
|
|
1520
|
-
name: "invoice.reim.form.structure",
|
|
1521
|
-
risk: "read",
|
|
1522
|
-
fixed: { path: "/api/inc/book/getFormStructure", defaultNodeId: "1" },
|
|
1523
|
-
inputSchema: {
|
|
1524
|
-
type: "object",
|
|
1525
|
-
additionalProperties: false,
|
|
1526
|
-
properties: {
|
|
1527
|
-
workflowId: positiveId,
|
|
1528
|
-
nodeId: { type: "string", minLength: 1, default: "1" }
|
|
1529
|
-
},
|
|
1530
|
-
required: ["workflowId"]
|
|
1531
|
-
},
|
|
1532
|
-
outputSchema: resultEnvelopeOutput(formStructureDataSchema)
|
|
1533
|
-
},
|
|
1534
|
-
{
|
|
1535
|
-
name: "invoice.reim.row-info",
|
|
1536
|
-
risk: "read",
|
|
1537
|
-
fixed: { path: "/api/secondev/fna/expense/dataInfo/getRowInfo", sf_request_type: "fetch" },
|
|
1538
|
-
inputSchema: {
|
|
1539
|
-
type: "object",
|
|
1540
|
-
additionalProperties: false,
|
|
1541
|
-
properties: {
|
|
1542
|
-
invoiceId: positiveId,
|
|
1543
|
-
requestid: { type: "string" },
|
|
1544
|
-
cdzt: positiveId
|
|
1545
|
-
},
|
|
1546
|
-
required: ["invoiceId"]
|
|
1547
|
-
},
|
|
1548
|
-
outputSchema: resultEnvelopeOutput(rowInfoDataSchema)
|
|
1549
|
-
},
|
|
1550
|
-
{
|
|
1551
|
-
name: "invoice.reim.row-info-batch",
|
|
1552
|
-
risk: "read",
|
|
1553
|
-
fixed: { path: "/api/secondev/fna/expense/dataInfo/getRowInfo", sf_request_type: "fetch", concurrency: 4 },
|
|
1554
|
-
inputSchema: {
|
|
1555
|
-
type: "object",
|
|
1556
|
-
additionalProperties: false,
|
|
1557
|
-
properties: {
|
|
1558
|
-
invoiceIds: positiveIdArray,
|
|
1559
|
-
requestid: { type: "string" },
|
|
1560
|
-
cdzt: positiveId
|
|
1561
|
-
},
|
|
1562
|
-
required: ["invoiceIds"]
|
|
1563
|
-
},
|
|
1564
|
-
outputSchema: objectSchema({
|
|
1565
|
-
results: arrayOf(objectSchema({
|
|
1566
|
-
invoiceId: { type: "string" },
|
|
1567
|
-
status: { type: "string", enum: ["success", "fail"] },
|
|
1568
|
-
data: rowInfoDataSchema,
|
|
1569
|
-
error: { type: "string" }
|
|
1570
|
-
}, ["invoiceId", "status"])),
|
|
1571
|
-
succeeded: { type: "integer" },
|
|
1572
|
-
failed: { type: "integer" },
|
|
1573
|
-
total: { type: "integer" },
|
|
1574
|
-
workflow: workflowSchema
|
|
1575
|
-
}, ["results", "succeeded", "failed", "total", "workflow"])
|
|
1576
|
-
},
|
|
1577
1260
|
{
|
|
1578
1261
|
name: "invoice.reim.employee-superiors",
|
|
1579
1262
|
risk: "read",
|
|
@@ -1610,66 +1293,10 @@ var invoiceOperations = [
|
|
|
1610
1293
|
workflow: workflowSchema
|
|
1611
1294
|
}, ["result", "data", "keywords", "match", "items", "workflow"])
|
|
1612
1295
|
},
|
|
1613
|
-
{
|
|
1614
|
-
name: "invoice.reim.flow.create.prepare",
|
|
1615
|
-
risk: "read-before-write",
|
|
1616
|
-
fixed: { path: "/api/inc/book/createFlowNew" },
|
|
1617
|
-
inputSchema: {
|
|
1618
|
-
type: "object",
|
|
1619
|
-
additionalProperties: false,
|
|
1620
|
-
properties: reimFlowCreateProperties,
|
|
1621
|
-
required: reimFlowCreateRequired
|
|
1622
|
-
},
|
|
1623
|
-
outputSchema: continuationPreviewOutput(flowPreviewOutputSchema)
|
|
1624
|
-
},
|
|
1625
|
-
{
|
|
1626
|
-
name: "invoice.reim.flow.create.apply",
|
|
1627
|
-
risk: "high-risk-write",
|
|
1628
|
-
inputSchema: {
|
|
1629
|
-
type: "object",
|
|
1630
|
-
additionalProperties: false,
|
|
1631
|
-
properties: {
|
|
1632
|
-
...reimFlowCreateProperties,
|
|
1633
|
-
continuation: { type: "string", minLength: 1 },
|
|
1634
|
-
confirm: { const: true }
|
|
1635
|
-
},
|
|
1636
|
-
required: [...reimFlowCreateRequired, "continuation", "confirm"]
|
|
1637
|
-
},
|
|
1638
|
-
outputSchema: flowCreateApplyOutputSchema
|
|
1639
|
-
},
|
|
1640
|
-
{
|
|
1641
|
-
name: "invoice.reim.flow.update.prepare",
|
|
1642
|
-
risk: "read-before-write",
|
|
1643
|
-
fixed: { path: "/api/inc/book/updateFlow" },
|
|
1644
|
-
inputSchema: {
|
|
1645
|
-
type: "object",
|
|
1646
|
-
additionalProperties: false,
|
|
1647
|
-
properties: reimFlowUpdateProperties,
|
|
1648
|
-
required: ["requestId", "mainFormId"],
|
|
1649
|
-
anyOf: [{ required: ["main_fields"] }, { required: ["detail_rows"] }, { required: ["deleteDetailRows"] }]
|
|
1650
|
-
},
|
|
1651
|
-
outputSchema: continuationPreviewOutput(flowUpdatePreviewOutputSchema)
|
|
1652
|
-
},
|
|
1653
|
-
{
|
|
1654
|
-
name: "invoice.reim.flow.update.apply",
|
|
1655
|
-
risk: "high-risk-write",
|
|
1656
|
-
inputSchema: {
|
|
1657
|
-
type: "object",
|
|
1658
|
-
additionalProperties: false,
|
|
1659
|
-
properties: {
|
|
1660
|
-
...reimFlowUpdateProperties,
|
|
1661
|
-
continuation: { type: "string", minLength: 1 },
|
|
1662
|
-
confirm: { const: true }
|
|
1663
|
-
},
|
|
1664
|
-
required: ["requestId", "mainFormId", "continuation", "confirm"],
|
|
1665
|
-
anyOf: [{ required: ["main_fields"] }, { required: ["detail_rows"] }, { required: ["deleteDetailRows"] }]
|
|
1666
|
-
},
|
|
1667
|
-
outputSchema: flowUpdateApplyOutputSchema
|
|
1668
|
-
},
|
|
1669
1296
|
{
|
|
1670
1297
|
name: "invoice.reim.candidates.list",
|
|
1671
1298
|
risk: "read",
|
|
1672
|
-
fixed: { path: "/api/inc/sync", sreim: "3", billType: 0 },
|
|
1299
|
+
fixed: { path: "/api/inc/sync", sreim: "3", billType: 0, excludeProStatus: 8 },
|
|
1673
1300
|
inputSchema: {
|
|
1674
1301
|
type: "object",
|
|
1675
1302
|
additionalProperties: false,
|
|
@@ -1679,49 +1306,110 @@ var invoiceOperations = [
|
|
|
1679
1306
|
consumption_tm_begin: epochDateProperty("\u6D88\u8D39\u65E5\u671F\u8D77\uFF08\u542B\uFF09"),
|
|
1680
1307
|
consumption_tm_end: epochEndDateProperty("\u6D88\u8D39\u65E5\u671F\u6B62\uFF08\u542B\uFF09"),
|
|
1681
1308
|
page_size: { type: "integer", minimum: 10, maximum: 200, default: 50, description: "\u5355\u9875\u6761\u6570\u3002" },
|
|
1682
|
-
max_items: { type: "integer", minimum: 1, maximum: 500, default: 200, description: "\u6700\u591A\u62C9\u53D6\u6761\u6570\
|
|
1683
|
-
include_red_reversed: { type: "boolean", default: false, description: "\u662F\u5426\u5728\u7ED3\u679C\u4E2D\u4FDD\u7559\u5168\u989D\u7EA2\u51B2\uFF08status=8\uFF09\u53D1\u7968\u3002\u9ED8\u8BA4 false \u2014\u2014 \u62A5\u9500\u573A\u666F\u76F4\u63A5\u8FC7\u6EE4\u6389\uFF0C\u8FC7\u6EE4\u5F20\u6570\u7531 summary.filteredRedReversedCount \u544A\u77E5\uFF0C\u4E0D\u4F1A\u9759\u9ED8\u4E22\u5931\u3002" }
|
|
1309
|
+
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" }
|
|
1684
1310
|
}
|
|
1685
1311
|
},
|
|
1686
1312
|
outputSchema: reimCandidatesOutputSchema
|
|
1687
1313
|
},
|
|
1688
1314
|
{
|
|
1689
|
-
name: "invoice.
|
|
1315
|
+
name: "invoice.issuing.contracts.list",
|
|
1690
1316
|
risk: "read",
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
required: ["invoiceIds", "requestName"]
|
|
1317
|
+
fixed: {
|
|
1318
|
+
path: "/api/ebuilder/form/eblist/getData",
|
|
1319
|
+
source: "\u5408\u540C\u865A\u62DF\u8868\uFF08\u6309\u300C\u5408\u540C\u5BA1\u6279\u6D41\u7A0B\u300DrequestId \u8FC7\u6EE4\uFF09",
|
|
1320
|
+
note: "\u6BCF\u4E2A requestId \u5355\u72EC\u67E5\u8BE2\u4E00\u6B21\uFF0C\u7ED3\u679C\u6309 requestId \u62FC\u56DE cards"
|
|
1696
1321
|
},
|
|
1697
|
-
outputSchema: reimTemplateBuildOutputSchema
|
|
1698
|
-
},
|
|
1699
|
-
{
|
|
1700
|
-
name: "invoice.reim.flow.create.auto-prepare",
|
|
1701
|
-
risk: "read-before-write",
|
|
1702
1322
|
inputSchema: {
|
|
1703
1323
|
type: "object",
|
|
1704
1324
|
additionalProperties: false,
|
|
1705
|
-
properties:
|
|
1706
|
-
|
|
1325
|
+
properties: {
|
|
1326
|
+
cards: {
|
|
1327
|
+
type: "array",
|
|
1328
|
+
maxItems: 50,
|
|
1329
|
+
items: { type: "object", required: ["requestId"], additionalProperties: true },
|
|
1330
|
+
description: "workflow.search \u8FD4\u56DE\u7684 data.cards\uFF0C\u539F\u6837\u4F20\u5165\uFF1B\u4E0E requestIds \u4E8C\u9009\u4E00"
|
|
1331
|
+
},
|
|
1332
|
+
requestIds: {
|
|
1333
|
+
type: "array",
|
|
1334
|
+
maxItems: 50,
|
|
1335
|
+
items: { type: "string", pattern: "^\\d+$" },
|
|
1336
|
+
description: "\u5408\u540C\u5BA1\u6279\u6D41\u7A0B requestId \u5217\u8868\uFF1B\u4E0E cards \u4E8C\u9009\u4E00"
|
|
1337
|
+
}
|
|
1338
|
+
}
|
|
1707
1339
|
},
|
|
1708
|
-
outputSchema:
|
|
1340
|
+
outputSchema: issuingContractsOutputSchema
|
|
1709
1341
|
},
|
|
1710
1342
|
{
|
|
1711
|
-
name: "invoice.issuing.
|
|
1343
|
+
name: "invoice.issuing.contract.detail",
|
|
1712
1344
|
risk: "read",
|
|
1713
|
-
fixed: {
|
|
1345
|
+
fixed: {
|
|
1346
|
+
path: "/api/workflow/core/paService/v1/getWorkflowRequest",
|
|
1347
|
+
source: "\u5408\u540C\u5BA1\u6279\u6D41\u7A0B\u8BE6\u60C5\uFF08isReadRequest=false\uFF0C\u4E0D\u6807\u8BB0\u5DF2\u8BFB\uFF09",
|
|
1348
|
+
note: "\u53EA\u53D6\u4E3B\u8868\u300C\u5BA2\u6237\u540D\u79F0\u300D/\u300C\u6700\u7EC8\u7528\u6237\u5361\u7247\u300D\u4E0E\u300C\u5408\u540C\u6B63\u6587\u53CA\u9644\u4EF6\u300D"
|
|
1349
|
+
},
|
|
1714
1350
|
inputSchema: {
|
|
1715
1351
|
type: "object",
|
|
1716
1352
|
additionalProperties: false,
|
|
1353
|
+
required: ["requestId"],
|
|
1717
1354
|
properties: {
|
|
1718
|
-
|
|
1719
|
-
contractNo: { type: "string", description: "\u6309\u5408\u540C\u53F7\u7CBE\u786E\u7B5B\u9009" },
|
|
1720
|
-
includeIssued: { type: "boolean", default: false, description: "\u662F\u5426\u5305\u542B\u5DF2\u5F00\u7968\u3001\u5F00\u7968\u4E2D\u6216\u5DF2\u5E9F\u5F03\u7684\u884C\u3002\u9ED8\u8BA4 false \u53EA\u8FD4\u56DE\u53EF\u5F00\u7968\u884C\uFF1Bgroups \u59CB\u7EC8\u6309\u5408\u540C\u53F7+\u8D2D\u65B9\u6C47\u603B\uFF0CblockedRows \u8BA1\u4E0D\u53EF\u5F00\u7968\u884C\u6570\u3002" },
|
|
1721
|
-
limit: { type: "integer", minimum: 1, maximum: 100, default: 20 }
|
|
1355
|
+
requestId: { type: "string", pattern: "^\\d+$", description: "\u7528\u6237\u9009\u5B9A\u7684\u5408\u540C\u5BA1\u6279\u6D41\u7A0B requestId" }
|
|
1722
1356
|
}
|
|
1723
1357
|
},
|
|
1724
|
-
outputSchema:
|
|
1358
|
+
outputSchema: issuingContractDetailOutputSchema
|
|
1359
|
+
}
|
|
1360
|
+
];
|
|
1361
|
+
var REIM_REFERENCE = "references/invoice-reim.md";
|
|
1362
|
+
var ISSUING_REFERENCE = "references/invoice-issuing-workflow.md";
|
|
1363
|
+
var invoiceRetiredOperations = [
|
|
1364
|
+
{
|
|
1365
|
+
name: "invoice.reim.form.structure",
|
|
1366
|
+
replacement: "\u8F7D\u5165\u62A5\u9500\u8868\u5355\u6539\u7528 weaver-e10-workflow \u7684 workflow.createForm\uFF08workflow \u4F20 {workFlowName}({workFlowId})\uFF09",
|
|
1367
|
+
reference: REIM_REFERENCE
|
|
1368
|
+
},
|
|
1369
|
+
{
|
|
1370
|
+
name: "invoice.reim.row-info",
|
|
1371
|
+
replacement: "\u660E\u7EC6\u884C\u4E0D\u518D\u9884\u586B\uFF1A\u6BCF\u884C\u53EA\u5199\u300C\u76F8\u5173\u53D1\u7968\u300D\uFF08\u7528 invoice.browse-field.data \u751F\u6210\uFF09\uFF0C\u5176\u4F59\u5217\u7531\u8054\u52A8\u5E26\u51FA",
|
|
1372
|
+
reference: REIM_REFERENCE
|
|
1373
|
+
},
|
|
1374
|
+
{
|
|
1375
|
+
name: "invoice.reim.row-info-batch",
|
|
1376
|
+
replacement: "\u660E\u7EC6\u884C\u4E0D\u518D\u9884\u586B\uFF1A\u6BCF\u884C\u53EA\u5199\u300C\u76F8\u5173\u53D1\u7968\u300D\uFF08\u7528 invoice.browse-field.data \u751F\u6210\uFF09\uFF0C\u5176\u4F59\u5217\u7531\u8054\u52A8\u5E26\u51FA",
|
|
1377
|
+
reference: REIM_REFERENCE
|
|
1378
|
+
},
|
|
1379
|
+
{
|
|
1380
|
+
name: "invoice.reim.flow.create.prepare",
|
|
1381
|
+
replacement: "\u521B\u5EFA\u62A5\u9500\u5355\u6539\u7528 weaver-e10-workflow \u7684 workflow.createRequest\uFF08action \u56FA\u5B9A draft\uFF0C\u5B58\u8349\u7A3F\uFF09",
|
|
1382
|
+
reference: REIM_REFERENCE
|
|
1383
|
+
},
|
|
1384
|
+
{
|
|
1385
|
+
name: "invoice.reim.flow.create.apply",
|
|
1386
|
+
replacement: "\u521B\u5EFA\u62A5\u9500\u5355\u6539\u7528 weaver-e10-workflow \u7684 workflow.createRequest\uFF08action \u56FA\u5B9A draft\uFF0C\u5B58\u8349\u7A3F\uFF09",
|
|
1387
|
+
reference: REIM_REFERENCE
|
|
1388
|
+
},
|
|
1389
|
+
{
|
|
1390
|
+
name: "invoice.reim.flow.update.prepare",
|
|
1391
|
+
replacement: "\u4FEE\u6539\u62A5\u9500\u5355\u6539\u7528 weaver-e10-workflow \u7684 workflow.editLoad \u2192 workflow.editPrepare \u2192 workflow.editApply",
|
|
1392
|
+
reference: REIM_REFERENCE
|
|
1393
|
+
},
|
|
1394
|
+
{
|
|
1395
|
+
name: "invoice.reim.flow.update.apply",
|
|
1396
|
+
replacement: "\u4FEE\u6539\u62A5\u9500\u5355\u6539\u7528 weaver-e10-workflow \u7684 workflow.editLoad \u2192 workflow.editPrepare \u2192 workflow.editApply",
|
|
1397
|
+
reference: REIM_REFERENCE
|
|
1398
|
+
},
|
|
1399
|
+
{
|
|
1400
|
+
name: "invoice.reim.template.build",
|
|
1401
|
+
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",
|
|
1402
|
+
reference: REIM_REFERENCE
|
|
1403
|
+
},
|
|
1404
|
+
{
|
|
1405
|
+
name: "invoice.reim.flow.create.auto-prepare",
|
|
1406
|
+
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",
|
|
1407
|
+
reference: REIM_REFERENCE
|
|
1408
|
+
},
|
|
1409
|
+
{
|
|
1410
|
+
name: "invoice.issuing.qys.list",
|
|
1411
|
+
replacement: "\u6539\u4E3A workflow.search \u67E5\u5408\u540C\u5BA1\u6279\u6D41\u7A0B \u2192 \u628A data.cards \u4F20\u7ED9 invoice.issuing.contracts.list \u5217\u51FA\u5F85\u5F00\u7968\u5408\u540C \u2192 \u9009\u5B9A\u540E\u7528 invoice.issuing.contract.detail \u53D6\u5BA2\u6237\u548C\u5408\u540C\u6587\u6863",
|
|
1412
|
+
reference: ISSUING_REFERENCE
|
|
1725
1413
|
}
|
|
1726
1414
|
];
|
|
1727
1415
|
var invoiceManifest = {
|
|
@@ -1742,15 +1430,10 @@ var invoiceManifest = {
|
|
|
1742
1430
|
default: "full",
|
|
1743
1431
|
description: `\u8F93\u51FA\u89C6\u56FE\u3002full=\u5B8C\u6574\u5305\u7EDC\uFF1Bsummary=${SUMMARY_ITEM_FIELDS.length} \u4E2A\u8BED\u4E49\u5B57\u6BB5\u7684\u5E73\u8868\uFF0C\u4EC5 invoice.list / invoice.enterprise.list \u652F\u6301\uFF1Bdetail=${DETAIL_ITEM_FIELDS.length} \u4E2A\u5B57\u6BB5\u7684\u5355\u5F20\u53D1\u7968\u8BE6\u60C5\uFF08\u542B\u9644\u4EF6\u3001\u8D39\u7528\u8BF4\u660E\u3001\u67E5\u9A8C\u6807\u8BB0\uFF09\uFF0C\u4EC5 invoice.get \u652F\u6301\u3002`
|
|
1744
1432
|
},
|
|
1745
|
-
"--format": {
|
|
1746
|
-
values: OUTPUT_FORMATS,
|
|
1747
|
-
default: "json",
|
|
1748
|
-
description: "\u8F93\u51FA\u683C\u5F0F\u3002json=\u6807\u51C6 envelope\uFF08\u9ED8\u8BA4\uFF0C\u4F9B\u7A0B\u5E8F\u6D88\u8D39\uFF09\uFF1Bmarkdown=\u4EBA\u8BFB\u6E32\u67D3\uFF08\u7968\u5939\u5217\u8868/\u53D1\u7968\u8BE6\u60C5\u4E24\u7C7B\u6A21\u677F\uFF0C\u5185\u7F6E\u5217\u987A\u5E8F\u4E0E\u5355\u4F4D\uFF09\uFF0C\u4EC5 invoice.list / invoice.enterprise.list / invoice.get \u652F\u6301\uFF0C\u4E14\u4E0E --json\u3001--fields \u4E92\u65A5\u3002markdown \u6863\u81EA\u5E26\u5B57\u6BB5\u53E3\u5F84\uFF08list\u2192summary\u3001get\u2192detail\uFF09\uFF0C\u4E0D\u5FC5\u518D\u4F20 --view\u3002"
|
|
1749
|
-
},
|
|
1750
1433
|
"--fields": {
|
|
1751
1434
|
description: "\u9017\u53F7\u5206\u9694\u7684\u70B9\u8DEF\u5F84\u5217\u8868\uFF0C\u6309\u539F\u7ED3\u6784\u6295\u5F71\uFF0C\u4F8B\u5982 --fields number,detailUrl\u3002\u6240\u6709 operation \u53EF\u7528\uFF1B\u672A\u547D\u4E2D\u7684\u8DEF\u5F84\u4F1A\u51FA\u73B0\u5728 meta.projection.missingFields \u91CC\u3002\u26A0\uFE0F \u4E0D\u8981\u7528\u88F8 total \u53D6\u91D1\u989D\uFF1A\u53D1\u7968\u9876\u5C42 total \u662F E10 \u7684\u72EC\u7ACB\u5B57\u6BB5\uFF08\u5B9E\u6D4B\u6052\u4E3A 0\uFF09\uFF0C\u4EF7\u7A0E\u5408\u8BA1\u5728 comm_info.price.total\uFF0C\u4E0D\u542B\u7A0E\u91D1\u989D\u5728 comm_info.price.amount\u3002"
|
|
1752
1435
|
},
|
|
1753
|
-
note: "--view \u4E0E --fields \u4E92\u65A5\
|
|
1436
|
+
note: "--view \u4E0E --fields \u4E92\u65A5\u3002\u6295\u5F71\u53EA\u5F71\u54CD\u8F93\u51FA\uFF0C\u4E0D\u6539\u53D8\u4EFB\u4F55\u8BF7\u6C42\u53C2\u6570\uFF1Bmeta.projection \u4F1A\u8BF4\u660E\u672C\u6B21\u88C1\u526A\u7ED3\u679C\u3002"
|
|
1754
1437
|
},
|
|
1755
1438
|
operations: invoiceOperations,
|
|
1756
1439
|
withheldOperations: [
|
|
@@ -1766,7 +1449,8 @@ var invoiceManifest = {
|
|
|
1766
1449
|
name: "invoice.tag",
|
|
1767
1450
|
reason: "\u65B0\u589E\u6E90\u8D44\u6599\u7ED9\u51FA /api/my/tag/common/batchAddEntityTag \u8BF7\u6C42\u4F53\uFF0C\u4F46\u4ECD\u7F3A\u5C11\u6807\u7B7E\u5B9A\u4E49\u67E5\u8BE2\u3001\u5F53\u524D\u6807\u7B7E\u5173\u7CFB\u56DE\u67E5\u548C\u79FB\u9664/\u66FF\u6362\u8BED\u4E49\u3002"
|
|
1768
1451
|
}
|
|
1769
|
-
]
|
|
1452
|
+
],
|
|
1453
|
+
retiredOperations: invoiceRetiredOperations
|
|
1770
1454
|
};
|
|
1771
1455
|
|
|
1772
1456
|
// src/shortcuts/invoice/operations/shared.ts
|
|
@@ -2118,7 +1802,7 @@ function enumName(names, value) {
|
|
|
2118
1802
|
if (value === void 0 || value === null || value === "") return "";
|
|
2119
1803
|
return names.get(numberOrZero(value)) || "";
|
|
2120
1804
|
}
|
|
2121
|
-
function
|
|
1805
|
+
function parseExt(extRaw) {
|
|
2122
1806
|
if (typeof extRaw !== "string" || !extRaw.trim()) return {};
|
|
2123
1807
|
try {
|
|
2124
1808
|
const parsed = JSON.parse(extRaw);
|
|
@@ -2171,7 +1855,7 @@ function browseFieldItem(info) {
|
|
|
2171
1855
|
const buyer = comm.buyer || {};
|
|
2172
1856
|
const payer = comm.payer || {};
|
|
2173
1857
|
const modify = info.modify_info || {};
|
|
2174
|
-
const ext =
|
|
1858
|
+
const ext = parseExt(info.ext);
|
|
2175
1859
|
const products = Array.isArray(ext.products) ? ext.products : [];
|
|
2176
1860
|
const fid = stringOrEmpty(info.fid || info.id);
|
|
2177
1861
|
const type = numberOrZero(pro.type);
|
|
@@ -2464,8 +2148,21 @@ async function previewOcr(upload, host) {
|
|
|
2464
2148
|
}
|
|
2465
2149
|
return { results, invoices };
|
|
2466
2150
|
}
|
|
2151
|
+
function isRedReversedInvoice(record) {
|
|
2152
|
+
const raw = record?.comm_info?.pro?.status;
|
|
2153
|
+
return (typeof raw === "number" ? raw : Number(raw ?? 0)) === 8;
|
|
2154
|
+
}
|
|
2467
2155
|
async function listInvoices(input, host, flag) {
|
|
2468
|
-
const body = {
|
|
2156
|
+
const body = {
|
|
2157
|
+
flag,
|
|
2158
|
+
page_size: 10,
|
|
2159
|
+
start_pos: 0,
|
|
2160
|
+
req_type: 1,
|
|
2161
|
+
sreim: "3",
|
|
2162
|
+
bill_type: 0,
|
|
2163
|
+
mext: FULL_EXT_MASK,
|
|
2164
|
+
req_base: reqBase()
|
|
2165
|
+
};
|
|
2469
2166
|
for (const [key, value] of Object.entries(input)) {
|
|
2470
2167
|
if (key === "flag") continue;
|
|
2471
2168
|
if (!LIST_FIELDS.has(key)) throw invoiceValidationError("input_field_unsupported", `\u5217\u8868\u67E5\u8BE2\u4E0D\u652F\u6301\u5B57\u6BB5\uFF1A${key}`);
|
|
@@ -2473,9 +2170,11 @@ async function listInvoices(input, host, flag) {
|
|
|
2473
2170
|
}
|
|
2474
2171
|
const session = await host.getSession();
|
|
2475
2172
|
const result = await host.invoiceRequest({ path: "/api/inc/sync", method: "POST", body });
|
|
2476
|
-
const items = (result.infos || []).map((item) => {
|
|
2477
|
-
const
|
|
2478
|
-
|
|
2173
|
+
const items = (result.infos || []).filter((item) => !isRedReversedInvoice(invoiceRecordOf(item))).map((item) => {
|
|
2174
|
+
const record = invoiceRecordOf(item);
|
|
2175
|
+
const fid = record.fid ?? record.id;
|
|
2176
|
+
if (fid) record.detailUrl = invoiceDetailUrl(session.baseUrl, String(fid));
|
|
2177
|
+
record.extInfo = invoiceExtInfo(record);
|
|
2479
2178
|
return item;
|
|
2480
2179
|
});
|
|
2481
2180
|
return {
|
|
@@ -2698,7 +2397,7 @@ var InvoiceAddPrepareOperation = class {
|
|
|
2698
2397
|
preview: addPreview(info, scope, session.baseUrl),
|
|
2699
2398
|
normalizedInfo: info,
|
|
2700
2399
|
continuation: continuationToken,
|
|
2701
|
-
expiresInSeconds:
|
|
2400
|
+
expiresInSeconds: CONTINUATION_TTL_SECONDS,
|
|
2702
2401
|
workflow: workflow("invoice.add", "AWAITING_CONFIRMATION")
|
|
2703
2402
|
}
|
|
2704
2403
|
};
|
|
@@ -2810,7 +2509,7 @@ var InvoiceDeletePrepareOperation = class {
|
|
|
2810
2509
|
fingerprint: detailFingerprint(info),
|
|
2811
2510
|
preview: item
|
|
2812
2511
|
});
|
|
2813
|
-
return { status: "AWAITING_CONFIRMATION", data: { preview: item, continuation: continuationToken, expiresInSeconds:
|
|
2512
|
+
return { status: "AWAITING_CONFIRMATION", data: { preview: item, continuation: continuationToken, expiresInSeconds: CONTINUATION_TTL_SECONDS, workflow: workflow("invoice.delete", "AWAITING_CONFIRMATION") } };
|
|
2814
2513
|
}
|
|
2815
2514
|
};
|
|
2816
2515
|
var InvoiceDeleteApplyOperation = class {
|
|
@@ -2939,7 +2638,7 @@ var InvoiceImportPrepareOperation = class {
|
|
|
2939
2638
|
data: {
|
|
2940
2639
|
preview: filePreview,
|
|
2941
2640
|
continuation: continuationToken,
|
|
2942
|
-
expiresInSeconds:
|
|
2641
|
+
expiresInSeconds: CONTINUATION_TTL_SECONDS,
|
|
2943
2642
|
workflow: workflow("invoice.import", "AWAITING_CONFIRMATION")
|
|
2944
2643
|
}
|
|
2945
2644
|
};
|
|
@@ -3050,329 +2749,284 @@ var InvoiceImportApplyOperation = class {
|
|
|
3050
2749
|
}
|
|
3051
2750
|
};
|
|
3052
2751
|
|
|
3053
|
-
// src/shortcuts/invoice/operations/issuing-
|
|
3054
|
-
|
|
3055
|
-
var
|
|
3056
|
-
var
|
|
3057
|
-
var LEDGER_PASS_ID = "1201416959744065575";
|
|
3058
|
-
var LEDGER_APP_ID = "846297243998732291";
|
|
3059
|
-
var LEDGER_MENU_ID = "5416292802968839298";
|
|
3060
|
-
var LEDGER_PAGE_TITLE = "5ZCI5ZCM5ZWG5ZOB5L+h5oGv";
|
|
3061
|
-
var LEDGER_PAGE_SIZE = 50;
|
|
3062
|
-
var LEDGER_MAX_PAGES = 40;
|
|
2752
|
+
// src/shortcuts/invoice/operations/issuing-contract-detail.ts
|
|
2753
|
+
var REQUEST_DETAIL_PATH = "/api/workflow/core/paService/v1/getWorkflowRequest";
|
|
2754
|
+
var CUSTOMER_FIELD_TITLES = ["\u5BA2\u6237\u540D\u79F0", "\u6700\u7EC8\u7528\u6237\u5361\u7247"];
|
|
2755
|
+
var CONTRACT_FILE_FIELD_TITLE = "\u5408\u540C\u6B63\u6587\u53CA\u9644\u4EF6";
|
|
3063
2756
|
function textValue(value) {
|
|
3064
2757
|
if (value === void 0 || value === null) return null;
|
|
3065
|
-
const text3 = String(value);
|
|
3066
|
-
return text3
|
|
2758
|
+
const text3 = String(value).trim();
|
|
2759
|
+
return text3 === "" ? null : text3;
|
|
2760
|
+
}
|
|
2761
|
+
function mainFields(data) {
|
|
2762
|
+
const details = data?.formData?.dataDetails;
|
|
2763
|
+
return Array.isArray(details) ? details.filter((item) => item?.formField && typeof item.formField === "object") : [];
|
|
2764
|
+
}
|
|
2765
|
+
function fieldByTitle(fields, title, componentKey) {
|
|
2766
|
+
return fields.find((field) => textValue(field.formField.title) === title && textValue(field.formField.componentKey) === componentKey);
|
|
2767
|
+
}
|
|
2768
|
+
function customerOf(fields) {
|
|
2769
|
+
for (const title of CUSTOMER_FIELD_TITLES) {
|
|
2770
|
+
const option = fieldByTitle(fields, title, "Ebuilder")?.dataOptions?.[0];
|
|
2771
|
+
const id = textValue(option?.optionId);
|
|
2772
|
+
const name = textValue(option?.content);
|
|
2773
|
+
if (id && name) return { customer: { id, name }, customerSource: title };
|
|
2774
|
+
}
|
|
2775
|
+
return { customer: null, customerSource: null };
|
|
2776
|
+
}
|
|
2777
|
+
function contractDocumentsOf(fields) {
|
|
2778
|
+
const options = fieldByTitle(fields, CONTRACT_FILE_FIELD_TITLE, "FileComponent")?.dataOptions;
|
|
2779
|
+
if (!Array.isArray(options)) return [];
|
|
2780
|
+
return options.map((option) => ({
|
|
2781
|
+
docId: textValue(option?.optionObj?.docId),
|
|
2782
|
+
fileId: textValue(option?.optionObj?.fileid) ?? textValue(option?.optionId),
|
|
2783
|
+
name: textValue(option?.content) ?? textValue(option?.optionObj?.name)
|
|
2784
|
+
}));
|
|
3067
2785
|
}
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
2786
|
+
var InvoiceIssuingContractDetailOperation = class {
|
|
2787
|
+
name = "invoice.issuing.contract.detail";
|
|
2788
|
+
async execute(input, { host }) {
|
|
2789
|
+
const requestId = textValue(input.requestId);
|
|
2790
|
+
if (!requestId || !/^\d+$/u.test(requestId)) {
|
|
2791
|
+
throw invoiceValidationError("input_invalid", "requestId \u5FC5\u987B\u662F\u5408\u540C\u5BA1\u6279\u6D41\u7A0B\u7684\u6570\u5B57 requestId");
|
|
2792
|
+
}
|
|
2793
|
+
const session = await host.getSession();
|
|
2794
|
+
const result = await host.invoiceRequest({
|
|
2795
|
+
path: REQUEST_DETAIL_PATH,
|
|
2796
|
+
method: "POST",
|
|
2797
|
+
body: {
|
|
2798
|
+
requestId,
|
|
2799
|
+
isGetRequestBaseInfo: true,
|
|
2800
|
+
isGetRequestLog: false,
|
|
2801
|
+
isGetFormData: true,
|
|
2802
|
+
isReadRequest: false,
|
|
2803
|
+
...session.userId ? { userId: session.userId } : {}
|
|
2804
|
+
},
|
|
2805
|
+
operation: this.name
|
|
2806
|
+
});
|
|
2807
|
+
const errcode = textValue(result?.message?.errcode);
|
|
2808
|
+
if (errcode !== null && errcode !== "0") {
|
|
2809
|
+
throw new InvoiceCliError("api", "issuing_contract_detail_failed", textValue(result?.message?.errmsg) ?? `\u8BFB\u53D6\u5408\u540C\u6D41\u7A0B ${requestId} \u5931\u8D25`, {
|
|
2810
|
+
code: errcode,
|
|
2811
|
+
exitCode: 1
|
|
2812
|
+
});
|
|
2813
|
+
}
|
|
2814
|
+
const data = result?.data;
|
|
2815
|
+
if (!Array.isArray(data?.formData?.dataDetails)) {
|
|
2816
|
+
throw new InvoiceCliError("api", "issuing_contract_detail_failed", `\u5408\u540C\u6D41\u7A0B ${requestId} \u7684\u8BE6\u60C5\u7F3A\u5C11\u8868\u5355\u6570\u636E\uFF0C\u53EF\u80FD\u6CA1\u6709\u67E5\u770B\u6743\u9650`, { exitCode: 1 });
|
|
2817
|
+
}
|
|
2818
|
+
const fields = mainFields(data);
|
|
2819
|
+
const contractDocuments = contractDocumentsOf(fields);
|
|
2820
|
+
const docIds = contractDocuments.map((document) => document.docId).filter((docId) => Boolean(docId));
|
|
2821
|
+
return {
|
|
2822
|
+
status: "COMPLETE",
|
|
2823
|
+
data: {
|
|
2824
|
+
requestId,
|
|
2825
|
+
requestName: textValue(data.workflowBaseInfo?.requestName),
|
|
2826
|
+
workflowName: textValue(data.workflowBaseInfo?.workflowName),
|
|
2827
|
+
...customerOf(fields),
|
|
2828
|
+
contractDocuments,
|
|
2829
|
+
contractDocIds: docIds.length ? docIds.join(",") : null
|
|
2830
|
+
}
|
|
2831
|
+
};
|
|
2832
|
+
}
|
|
2833
|
+
};
|
|
2834
|
+
|
|
2835
|
+
// src/shortcuts/invoice/operations/issuing-contracts.ts
|
|
2836
|
+
var CONTRACT_DATA_PATH = "/api/ebuilder/form/eblist/getData";
|
|
2837
|
+
var PAGE_APP_ID = "846297243998732291";
|
|
2838
|
+
var PAGE_ID = "1332949650257698904";
|
|
2839
|
+
var COMP_ID = "d9393fc65f7f49cc870600a78d71bc0e";
|
|
2840
|
+
var DETAIL_PAGE_SIZE = 100;
|
|
2841
|
+
var MAX_DETAIL_PAGES = 20;
|
|
2842
|
+
var MAX_REQUESTS = 50;
|
|
2843
|
+
var FIELD = {
|
|
2844
|
+
contractNo: "1201427014149029927",
|
|
2845
|
+
seller: "1214704660726972419",
|
|
2846
|
+
itemName: "1204384271089598493",
|
|
2847
|
+
amount: "1201418617613795454",
|
|
2848
|
+
customerName: "1201418170947821738",
|
|
2849
|
+
buyerTaxNo: "1201418170947821739",
|
|
2850
|
+
group: "1201417526769836172"
|
|
2851
|
+
};
|
|
2852
|
+
function contractFilter(requestId) {
|
|
2853
|
+
return [{
|
|
2854
|
+
conditionType: "and",
|
|
2855
|
+
dataType: "field",
|
|
2856
|
+
id: "d65b6602cd2e4c119beda5f5721e6035",
|
|
2857
|
+
conditionComId: `${COMP_ID}_advance_EXCLUDECACHE`,
|
|
2858
|
+
filterFields: [{
|
|
2859
|
+
compId: COMP_ID,
|
|
2860
|
+
compType: "Workflow",
|
|
2861
|
+
dataset: {
|
|
2862
|
+
isPhysical: true,
|
|
2863
|
+
relationDataset: { groupId: "weaver-ebuilder-form-service", id: "1201416959744065575", type: "LOGIC" },
|
|
2864
|
+
ebuilderDataConfig: { dataSetup: {}, type: "FORM" },
|
|
2865
|
+
detailTable: false,
|
|
2866
|
+
groupId: "weaver-ebuilder-form-service",
|
|
2867
|
+
usage: "all",
|
|
2868
|
+
appId: PAGE_APP_ID,
|
|
2869
|
+
id: "1332949650257698828",
|
|
2870
|
+
text: "\u5408\u540C\u865A\u62DF\u8868",
|
|
2871
|
+
type: "LOGIC",
|
|
2872
|
+
objType: "vform"
|
|
2873
|
+
},
|
|
2874
|
+
fieldName: "field_1208799170921791564",
|
|
2875
|
+
id: "1208799170921791564",
|
|
2876
|
+
objId: "1332949650257698828",
|
|
2877
|
+
type: "Workflow",
|
|
2878
|
+
text: "\u5408\u540C\u5BA1\u6279\u6D41\u7A0B"
|
|
2879
|
+
}],
|
|
2880
|
+
funcType: "inC",
|
|
2881
|
+
value: requestId,
|
|
2882
|
+
customSelect: null
|
|
2883
|
+
}];
|
|
2884
|
+
}
|
|
2885
|
+
function textValue2(value) {
|
|
2886
|
+
if (value === void 0 || value === null) return null;
|
|
2887
|
+
const text3 = String(value).trim();
|
|
2888
|
+
return text3 === "" ? null : text3;
|
|
3076
2889
|
}
|
|
3077
|
-
function
|
|
3078
|
-
|
|
3079
|
-
|
|
2890
|
+
function firstText2(rows, field) {
|
|
2891
|
+
for (const row of rows) {
|
|
2892
|
+
const value = textValue2(row[field]);
|
|
2893
|
+
if (value) return value;
|
|
3080
2894
|
}
|
|
3081
|
-
|
|
3082
|
-
return Number(whole) * 100 + Number(fraction.padEnd(2, "0"));
|
|
2895
|
+
return null;
|
|
3083
2896
|
}
|
|
3084
|
-
function
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
}
|
|
3090
|
-
function qysRowBlockers(row) {
|
|
3091
|
-
const blockers = [];
|
|
3092
|
-
if (row.invoiceNo) blockers.push(`\u5DF2\u6709\u53D1\u7968\u53F7\u7801 ${row.invoiceNo}`);
|
|
3093
|
-
if (row.invoiceFlow) blockers.push(`\u5DF2\u5173\u8054\u5F00\u7968\u6D41\u7A0B ${row.invoiceFlow.name || row.invoiceFlow.id}`);
|
|
3094
|
-
if (isPositiveCents(row.invoicingAmount)) blockers.push(`\u5F00\u7968\u4E2D\u91D1\u989D ${row.invoicingAmount}`);
|
|
3095
|
-
if (row.discarded?.name === "\u662F" || row.discardedDate) blockers.push("\u5DF2\u5E9F\u5F03");
|
|
3096
|
-
return blockers;
|
|
3097
|
-
}
|
|
3098
|
-
function parseSpan(value) {
|
|
3099
|
-
if (typeof value === "string" && value.trim().startsWith("[")) {
|
|
3100
|
-
try {
|
|
3101
|
-
return optionValue(JSON.parse(value));
|
|
3102
|
-
} catch {
|
|
3103
|
-
return null;
|
|
3104
|
-
}
|
|
2897
|
+
function sellerName(rows) {
|
|
2898
|
+
for (const row of rows) {
|
|
2899
|
+
const sellers = Array.isArray(row[FIELD.seller]) ? row[FIELD.seller] : [];
|
|
2900
|
+
const names = sellers.map((seller) => textValue2(seller?.name)).filter(Boolean);
|
|
2901
|
+
if (names.length) return names.join("\u3001");
|
|
3105
2902
|
}
|
|
3106
|
-
return
|
|
2903
|
+
return null;
|
|
3107
2904
|
}
|
|
3108
|
-
function
|
|
3109
|
-
const
|
|
3110
|
-
|
|
2905
|
+
function amountCents(value, requestId) {
|
|
2906
|
+
const text3 = textValue2(value)?.replace(/,/g, "") ?? null;
|
|
2907
|
+
if (text3 === null) return 0;
|
|
2908
|
+
if (!/^-?\d+(?:\.\d+)?$/u.test(text3)) {
|
|
2909
|
+
throw new InvoiceCliError("api", "issuing_amount_invalid", `\u5408\u540C\u6D41\u7A0B ${requestId} \u7684\u5F00\u7968\u91D1\u989D\u4E0D\u662F\u6570\u5B57\uFF1A${text3}`, { exitCode: 1 });
|
|
2910
|
+
}
|
|
2911
|
+
return Math.round(Number(text3) * 100);
|
|
3111
2912
|
}
|
|
3112
|
-
function
|
|
3113
|
-
|
|
3114
|
-
return text3 === null ? null : text3.replace(/,/g, "");
|
|
2913
|
+
function formatCents(cents2) {
|
|
2914
|
+
return (cents2 / 100).toFixed(2);
|
|
3115
2915
|
}
|
|
3116
|
-
function
|
|
3117
|
-
|
|
3118
|
-
|
|
3119
|
-
|
|
2916
|
+
function summarizeContractRows(requestId, rows) {
|
|
2917
|
+
if (rows.length === 0) {
|
|
2918
|
+
return {
|
|
2919
|
+
invoiced: true,
|
|
2920
|
+
contractNo: null,
|
|
2921
|
+
customerName: null,
|
|
2922
|
+
buyerTaxNo: null,
|
|
2923
|
+
sellerName: null,
|
|
2924
|
+
invoiceAmount: null,
|
|
2925
|
+
invoiceGroups: []
|
|
2926
|
+
};
|
|
2927
|
+
}
|
|
2928
|
+
const groups = /* @__PURE__ */ new Map();
|
|
2929
|
+
let totalCents = 0;
|
|
2930
|
+
for (const row of rows) {
|
|
2931
|
+
const group = textValue2(row[FIELD.group]);
|
|
2932
|
+
const cents2 = amountCents(row[FIELD.amount], requestId);
|
|
2933
|
+
totalCents += cents2;
|
|
2934
|
+
const key = group ?? "";
|
|
2935
|
+
const entry = groups.get(key) ?? { group, cents: 0, items: [] };
|
|
2936
|
+
entry.cents += cents2;
|
|
2937
|
+
entry.items.push({ name: textValue2(row[FIELD.itemName]), amount: formatCents(cents2) });
|
|
2938
|
+
groups.set(key, entry);
|
|
2939
|
+
}
|
|
3120
2940
|
return {
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
productTypeDetail: cellText(data, display, "cplxmx"),
|
|
3129
|
-
accountingCompany: parseSpan(display.hsgs_idSpan),
|
|
3130
|
-
invoiceGroupFlag: cellText(data, display, "kpfzbs"),
|
|
3131
|
-
sourceFlag: cellText(data, display, "lybs"),
|
|
3132
|
-
flowDetailId: cellText(data, display, "lcmxid"),
|
|
3133
|
-
invoiceType: parseSpan(display.fplxSpan),
|
|
3134
|
-
purchaserName: cellText(data, display, "gmfmc"),
|
|
3135
|
-
purchaserTaxNo: cellText(data, display, "gmfsh"),
|
|
3136
|
-
purchaserAddress: cellText(data, display, "gmfdz"),
|
|
3137
|
-
purchaserTel: cellText(data, display, "gmfdh"),
|
|
3138
|
-
purchaserBankName: cellText(data, display, "gmfkhx"),
|
|
3139
|
-
purchaserBankAccount: cellText(data, display, "gmfkhxzh"),
|
|
3140
|
-
invoiceItemName: cellText(data, display, "kpmc"),
|
|
3141
|
-
goodsName: cellText(data, display, "spmc"),
|
|
3142
|
-
revenueCode: cellText(data, display, "spshflbm"),
|
|
3143
|
-
taxRate: parseSpan(display.spslSpan),
|
|
3144
|
-
specification: cellText(data, display, "ggxh"),
|
|
3145
|
-
unit: cellText(data, display, "dw"),
|
|
3146
|
-
quantity: cellText(data, display, "spslkwk"),
|
|
3147
|
-
unitPrice: moneyText(data, display, "spdjkwk"),
|
|
3148
|
-
amount: moneyText(data, display, "kpje"),
|
|
3149
|
-
uninvoicedAmount: moneyText(data, display, "wkpje"),
|
|
3150
|
-
invoicedAmount: moneyText(data, display, "ykpje"),
|
|
3151
|
-
invoicingAmount: moneyText(data, display, "kpzje"),
|
|
3152
|
-
amountDiffers: parseSpan(display.kpjeczcySpan),
|
|
3153
|
-
thirdPartyPurchase: parseSpan(display.sfsfcgSpan),
|
|
3154
|
-
invoiceNo: cellText(data, display, "fphm"),
|
|
3155
|
-
invoiceFlow: parseSpan(display.kplcidSpan),
|
|
3156
|
-
invoiceDate: cellText(data, display, "kpsj"),
|
|
3157
|
-
discarded: parseSpan(display.sfzfSpan),
|
|
3158
|
-
discardedDate: cellText(data, display, "zfsj"),
|
|
3159
|
-
contactName: cellText(data, display, "khlxr"),
|
|
3160
|
-
contactPhone: cellText(data, display, "khlxdh"),
|
|
3161
|
-
contactEmail: cellText(data, display, "khlxyx")
|
|
2941
|
+
invoiced: false,
|
|
2942
|
+
contractNo: firstText2(rows, FIELD.contractNo),
|
|
2943
|
+
customerName: firstText2(rows, FIELD.customerName),
|
|
2944
|
+
buyerTaxNo: firstText2(rows, FIELD.buyerTaxNo),
|
|
2945
|
+
sellerName: sellerName(rows),
|
|
2946
|
+
invoiceAmount: formatCents(totalCents),
|
|
2947
|
+
invoiceGroups: [...groups.values()].map(({ group, cents: cents2, items }) => ({ group, amount: formatCents(cents2), items }))
|
|
3162
2948
|
};
|
|
3163
2949
|
}
|
|
3164
|
-
|
|
3165
|
-
const
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
body: {
|
|
3171
|
-
current: pageNo,
|
|
3172
|
-
pageSize: LEDGER_PAGE_SIZE,
|
|
3173
|
-
requiredMatch: 1,
|
|
3174
|
-
tableuid,
|
|
3175
|
-
mapResult: "1",
|
|
3176
|
-
recheckQuery: "1",
|
|
3177
|
-
cusMenuId: LEDGER_MENU_ID,
|
|
3178
|
-
urlPageTitle: LEDGER_PAGE_TITLE,
|
|
3179
|
-
[`appId_${LEDGER_LIST_ID}`]: LEDGER_APP_ID,
|
|
3180
|
-
searchParamData: {
|
|
3181
|
-
searchType: "3",
|
|
3182
|
-
quickSearchFields: {},
|
|
3183
|
-
commonSearchFields: {},
|
|
3184
|
-
type: "and",
|
|
3185
|
-
groupFields: {}
|
|
3186
|
-
},
|
|
3187
|
-
listId: LEDGER_LIST_ID,
|
|
3188
|
-
isFollow: 0,
|
|
3189
|
-
isShareToMe: 0,
|
|
3190
|
-
filterCondition: {},
|
|
3191
|
-
browser: "Chrome"
|
|
3192
|
-
}
|
|
3193
|
-
});
|
|
3194
|
-
assertBusinessSuccess(result, "qys_ledger_query_failed", "\u83B7\u53D6\u5F85\u5F00\u7968\u5408\u540C\u6570\u636E\u5931\u8D25");
|
|
3195
|
-
const payload = result?.data;
|
|
3196
|
-
const dataRows = payload?.data;
|
|
3197
|
-
const displayRows = payload?.displayData;
|
|
3198
|
-
if (!Array.isArray(dataRows) || !Array.isArray(displayRows)) {
|
|
3199
|
-
throw new InvoiceCliError("api", "qys_ledger_query_failed", "\u83B7\u53D6\u5F85\u5F00\u7968\u5408\u540C\u6570\u636E\u7684\u8FD4\u56DE\u7F3A\u5C11 data.data \u6216 data.displayData", { exitCode: 1 });
|
|
3200
|
-
}
|
|
3201
|
-
return dataRows.map((data, index) => ({
|
|
3202
|
-
data,
|
|
3203
|
-
display: displayRows[index] && typeof displayRows[index] === "object" ? displayRows[index] : {}
|
|
3204
|
-
}));
|
|
2950
|
+
function requestIdOf(value, location) {
|
|
2951
|
+
const requestId = textValue2(value);
|
|
2952
|
+
if (!requestId || !/^\d+$/u.test(requestId)) {
|
|
2953
|
+
throw invoiceValidationError("input_invalid", `${location} \u5FC5\u987B\u662F\u6570\u5B57 requestId`);
|
|
2954
|
+
}
|
|
2955
|
+
return requestId;
|
|
3205
2956
|
}
|
|
3206
|
-
|
|
3207
|
-
const
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
for (let pageNo = 1; pageNo <= LEDGER_MAX_PAGES; pageNo += 1) {
|
|
3211
|
-
const page = await fetchLedgerPage(host, pageNo, tableuid, operation);
|
|
3212
|
-
let fresh = 0;
|
|
3213
|
-
for (const pair of page) {
|
|
3214
|
-
const row = convertPendingLedgerRow(pair.data, pair.display);
|
|
3215
|
-
if (seen.has(row.formDataId)) continue;
|
|
3216
|
-
seen.add(row.formDataId);
|
|
3217
|
-
fresh += 1;
|
|
3218
|
-
scanned += 1;
|
|
3219
|
-
if (visit(row)) return { scanned, complete: true };
|
|
3220
|
-
}
|
|
3221
|
-
if (page.length < LEDGER_PAGE_SIZE || fresh === 0) return { scanned, complete: true };
|
|
3222
|
-
}
|
|
3223
|
-
return { scanned, complete: false };
|
|
3224
|
-
}
|
|
3225
|
-
function matchesKeyword(row, keyword) {
|
|
3226
|
-
const haystack = [row.contractNo, row.purchaserName, row.contractFlow?.name, row.goodsName, row.invoiceItemName, row.formDataId];
|
|
3227
|
-
return haystack.some((value) => typeof value === "string" && value.includes(keyword));
|
|
3228
|
-
}
|
|
3229
|
-
function splitBankNameAndAccount(bankName, bankAccount) {
|
|
3230
|
-
const name = (bankName ?? "").trim();
|
|
3231
|
-
const account = (bankAccount ?? "").trim();
|
|
3232
|
-
const trailing = /^(.*?[^\d\s-])\s*(\d[\d\s-]*\d)$/u.exec(account);
|
|
3233
|
-
const leading = trailing ? null : /^(\d[\d\s-]*\d)\s*([^\d\s-].*)$/u.exec(account);
|
|
3234
|
-
const rawText = trailing ? trailing[1] : leading ? leading[2] : "";
|
|
3235
|
-
const textPart = rawText.replace(/[\s,,;;::]*(?:银行账号|银行帐号|账号|帐号|账户|帐户)?[\s,,;;::]*$/u, "").replace(/^[\s,,;;::]*(?:开户行|开户银行)?[\s,,;;::]*/u, "").trim();
|
|
3236
|
-
const digitPart = trailing ? trailing[2] : leading ? leading[1] : "";
|
|
3237
|
-
if (!textPart || !digitPart) return { bankName: name, bankAccount: account, split: false };
|
|
3238
|
-
return { bankName: name || textPart, bankAccount: digitPart, split: true };
|
|
3239
|
-
}
|
|
3240
|
-
function isSpecialInvoiceTypeName(name) {
|
|
3241
|
-
return name.includes("\u4E13\u7968") || name.includes("\u4E13\u7528\u53D1\u7968");
|
|
3242
|
-
}
|
|
3243
|
-
var QysLedgerGrouper = class {
|
|
3244
|
-
groups = /* @__PURE__ */ new Map();
|
|
3245
|
-
add(row, blocked) {
|
|
3246
|
-
const contractNo = row.contractNo ?? "";
|
|
3247
|
-
const purchaserName = row.purchaserName ?? "";
|
|
3248
|
-
const key = `${contractNo}|${purchaserName}`;
|
|
3249
|
-
let group = this.groups.get(key);
|
|
3250
|
-
if (!group) {
|
|
3251
|
-
group = {
|
|
3252
|
-
contractNo,
|
|
3253
|
-
contractFlowId: row.contractFlow?.id ?? "",
|
|
3254
|
-
contractFlowName: row.contractFlow?.name ?? "",
|
|
3255
|
-
purchaserName,
|
|
3256
|
-
purchaserTaxNos: /* @__PURE__ */ new Set(),
|
|
3257
|
-
invoiceTypes: /* @__PURE__ */ new Set(),
|
|
3258
|
-
goodsNames: /* @__PURE__ */ new Set(),
|
|
3259
|
-
taxRates: /* @__PURE__ */ new Set(),
|
|
3260
|
-
specifications: /* @__PURE__ */ new Set(),
|
|
3261
|
-
sellerNames: /* @__PURE__ */ new Set(),
|
|
3262
|
-
bankName: null,
|
|
3263
|
-
bankAccount: null,
|
|
3264
|
-
formDataIds: [],
|
|
3265
|
-
amountCents: 0,
|
|
3266
|
-
invalidAmountRows: [],
|
|
3267
|
-
blockedRows: 0
|
|
3268
|
-
};
|
|
3269
|
-
this.groups.set(key, group);
|
|
3270
|
-
}
|
|
3271
|
-
if (row.accountingCompany?.name) group.sellerNames.add(row.accountingCompany.name);
|
|
3272
|
-
if (blocked) {
|
|
3273
|
-
group.blockedRows += 1;
|
|
3274
|
-
return;
|
|
3275
|
-
}
|
|
3276
|
-
group.formDataIds.push(row.formDataId);
|
|
3277
|
-
if (!group.contractFlowId && row.contractFlow) {
|
|
3278
|
-
group.contractFlowId = row.contractFlow.id;
|
|
3279
|
-
group.contractFlowName = row.contractFlow.name;
|
|
3280
|
-
}
|
|
3281
|
-
if (row.purchaserTaxNo) group.purchaserTaxNos.add(row.purchaserTaxNo);
|
|
3282
|
-
if (row.invoiceType?.name) group.invoiceTypes.add(row.invoiceType.name);
|
|
3283
|
-
const goodsName = row.invoiceItemName ?? row.goodsName;
|
|
3284
|
-
if (goodsName) group.goodsNames.add(goodsName);
|
|
3285
|
-
if (row.taxRate?.name) group.taxRates.add(row.taxRate.name);
|
|
3286
|
-
if (row.specification) group.specifications.add(row.specification);
|
|
3287
|
-
if (group.bankName === null && group.bankAccount === null && (row.purchaserBankName || row.purchaserBankAccount)) {
|
|
3288
|
-
group.bankName = row.purchaserBankName ?? null;
|
|
3289
|
-
group.bankAccount = row.purchaserBankAccount ?? null;
|
|
3290
|
-
}
|
|
3291
|
-
if (row.amount !== null && /^\d+(?:\.\d{1,2})?$/u.test(row.amount)) {
|
|
3292
|
-
group.amountCents += toCents(row.amount, "\u5F00\u7968\u91D1\u989D");
|
|
3293
|
-
} else {
|
|
3294
|
-
group.invalidAmountRows.push(row.formDataId);
|
|
3295
|
-
}
|
|
2957
|
+
function inputCards(input) {
|
|
2958
|
+
const { cards, requestIds } = input;
|
|
2959
|
+
if (cards !== void 0 && requestIds !== void 0) {
|
|
2960
|
+
throw invoiceValidationError("input_ambiguous", "cards \u4E0E requestIds \u53EA\u80FD\u63D0\u4F9B\u4E00\u4E2A");
|
|
3296
2961
|
}
|
|
3297
|
-
result
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
const specialInvoiceWithoutTaxNo = group.purchaserTaxNos.size === 0 && specialTypes.length > 0;
|
|
3304
|
-
if (specialInvoiceWithoutTaxNo) {
|
|
3305
|
-
warnings.push(`\u8D2D\u65B9\u65E0\u7A0E\u53F7\uFF0C\u4E0D\u80FD\u5F00\u4E13\u7968\uFF08\u53F0\u8D26\u53D1\u7968\u7C7B\u578B\uFF1A${specialTypes.join("\u3001")}\uFF09\uFF0C\u8BF7\u5148\u5728\u53F0\u8D26\u6539\u4E3A\u666E\u7968\u518D\u53D1\u8D77`);
|
|
3306
|
-
}
|
|
3307
|
-
const bank = splitBankNameAndAccount(group.bankName, group.bankAccount);
|
|
3308
|
-
if (bank.split) {
|
|
3309
|
-
warnings.push(`\u53F0\u8D26\u300C\u8D2D\u4E70\u65B9\u5F00\u6237\u884C\u8D26\u53F7\u300D\u6DF7\u6709\u5F00\u6237\u884C\u540D\u79F0\uFF0C\u5DF2\u62C6\u5206\u4E3A\u5F00\u6237\u884C\u540D\u79F0\u300C${bank.bankName}\u300D\u3001\u8D26\u53F7\u300C${bank.bankAccount}\u300D`);
|
|
2962
|
+
let result;
|
|
2963
|
+
if (cards !== void 0) {
|
|
2964
|
+
if (!Array.isArray(cards)) throw invoiceValidationError("input_invalid", "cards \u5FC5\u987B\u662F workflow.search \u8FD4\u56DE\u7684 data.cards \u6570\u7EC4");
|
|
2965
|
+
result = cards.map((card, index) => {
|
|
2966
|
+
if (!card || typeof card !== "object" || Array.isArray(card)) {
|
|
2967
|
+
throw invoiceValidationError("input_invalid", `cards[${index}] \u5FC5\u987B\u662F\u5BF9\u8C61`);
|
|
3310
2968
|
}
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
warnings.push(`\u540C\u5408\u540C\u53E6\u6709 ${group.blockedRows} \u884C\u5DF2\u5F00\u7968\u3001\u5F00\u7968\u4E2D\u6216\u5DF2\u5E9F\u5F03\uFF0C\u6D41\u7A0B\u8054\u52A8\u53EF\u80FD\u4E00\u5E76\u5E26\u51FA\uFF0C\u8BF7\u5728 E10 \u6838\u5BF9\u660E\u7EC6`);
|
|
3318
|
-
}
|
|
3319
|
-
output.push({
|
|
3320
|
-
contractNo: group.contractNo,
|
|
3321
|
-
contractFlowId: group.contractFlowId,
|
|
3322
|
-
contractFlowName: group.contractFlowName,
|
|
3323
|
-
purchaserName: group.purchaserName,
|
|
3324
|
-
purchaserTaxNo: [...group.purchaserTaxNos].join("\u3001"),
|
|
3325
|
-
purchaserBankName: bank.bankName,
|
|
3326
|
-
purchaserBankAccount: bank.bankAccount,
|
|
3327
|
-
invoiceTypes: [...group.invoiceTypes],
|
|
3328
|
-
specialInvoiceWithoutTaxNo,
|
|
3329
|
-
goodsNames: [...group.goodsNames],
|
|
3330
|
-
taxRates: [...group.taxRates],
|
|
3331
|
-
specifications: [...group.specifications],
|
|
3332
|
-
sellerNames: [...group.sellerNames],
|
|
3333
|
-
rowCount: group.formDataIds.length,
|
|
3334
|
-
formDataIds: group.formDataIds,
|
|
3335
|
-
totalAmount: formatCents(group.amountCents),
|
|
3336
|
-
blockedRows: group.blockedRows,
|
|
3337
|
-
warnings
|
|
3338
|
-
});
|
|
3339
|
-
}
|
|
3340
|
-
return output;
|
|
2969
|
+
return { ...card, requestId: requestIdOf(card.requestId, `cards[${index}].requestId`) };
|
|
2970
|
+
});
|
|
2971
|
+
} else {
|
|
2972
|
+
const ids = typeof requestIds === "string" ? requestIds.split(",") : requestIds;
|
|
2973
|
+
if (!Array.isArray(ids)) throw invoiceValidationError("input_invalid", "\u5FC5\u987B\u63D0\u4F9B cards \u6216 requestIds");
|
|
2974
|
+
result = ids.map((id, index) => ({ requestId: requestIdOf(id, `requestIds[${index}]`) }));
|
|
3341
2975
|
}
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
2976
|
+
if (result.length === 0) throw invoiceValidationError("input_invalid", "cards / requestIds \u4E0D\u80FD\u4E3A\u7A7A");
|
|
2977
|
+
if (result.length > MAX_REQUESTS) throw invoiceValidationError("input_invalid", `\u4E00\u6B21\u6700\u591A\u67E5\u8BE2 ${MAX_REQUESTS} \u4E2A\u5408\u540C\u6D41\u7A0B`);
|
|
2978
|
+
return result;
|
|
2979
|
+
}
|
|
2980
|
+
var InvoiceIssuingContractsListOperation = class {
|
|
2981
|
+
name = "invoice.issuing.contracts.list";
|
|
3345
2982
|
async execute(input, { host }) {
|
|
3346
|
-
const
|
|
3347
|
-
const
|
|
3348
|
-
const
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
const
|
|
3355
|
-
if (contractNo && row.contractNo !== contractNo) return false;
|
|
3356
|
-
if (keyword && !matchesKeyword(row, keyword)) return false;
|
|
3357
|
-
const blockers = qysRowBlockers(row);
|
|
3358
|
-
grouper.add(row, blockers.length > 0);
|
|
3359
|
-
if (!includeIssued && blockers.length) return false;
|
|
3360
|
-
matched += 1;
|
|
3361
|
-
if (items.length < limit) items.push({ ...row, issuable: blockers.length === 0, blockers });
|
|
3362
|
-
return false;
|
|
3363
|
-
});
|
|
2983
|
+
const cards = inputCards(input);
|
|
2984
|
+
const summaries = /* @__PURE__ */ new Map();
|
|
2985
|
+
for (const { requestId } of cards) {
|
|
2986
|
+
if (summaries.has(requestId)) continue;
|
|
2987
|
+
const rows = await this.contractRows(host, requestId);
|
|
2988
|
+
summaries.set(requestId, summarizeContractRows(requestId, rows));
|
|
2989
|
+
}
|
|
2990
|
+
const merged = cards.map((card) => ({ ...card, ...summaries.get(card.requestId) }));
|
|
2991
|
+
const pendingCount = merged.filter((card) => card.invoiced === false).length;
|
|
3364
2992
|
return {
|
|
3365
2993
|
status: "COMPLETE",
|
|
3366
2994
|
data: {
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
scanned: scan.scanned,
|
|
3372
|
-
scanComplete: scan.complete
|
|
2995
|
+
cards: merged,
|
|
2996
|
+
count: merged.length,
|
|
2997
|
+
pendingCount,
|
|
2998
|
+
invoicedCount: merged.length - pendingCount
|
|
3373
2999
|
}
|
|
3374
3000
|
};
|
|
3375
3001
|
}
|
|
3002
|
+
async contractRows(host, requestId) {
|
|
3003
|
+
const rows = [];
|
|
3004
|
+
for (let pageNo = 1; pageNo <= MAX_DETAIL_PAGES; pageNo += 1) {
|
|
3005
|
+
const result = await host.invoiceMultipartRequest({
|
|
3006
|
+
path: CONTRACT_DATA_PATH,
|
|
3007
|
+
method: "POST",
|
|
3008
|
+
fields: {
|
|
3009
|
+
filter: contractFilter(requestId),
|
|
3010
|
+
fieldFilter: {},
|
|
3011
|
+
pageFilter: { filter: {}, filterIsNull: true, esbFilter: [] },
|
|
3012
|
+
pageAppId: PAGE_APP_ID,
|
|
3013
|
+
compId: COMP_ID,
|
|
3014
|
+
pageId: PAGE_ID,
|
|
3015
|
+
pageNo: String(pageNo),
|
|
3016
|
+
pageSize: String(DETAIL_PAGE_SIZE)
|
|
3017
|
+
},
|
|
3018
|
+
operation: this.name
|
|
3019
|
+
});
|
|
3020
|
+
assertBusinessSuccess(result, "issuing_contracts_query_failed", `\u67E5\u8BE2\u5408\u540C\u6D41\u7A0B ${requestId} \u7684\u5F00\u7968\u6570\u636E\u5931\u8D25`);
|
|
3021
|
+
const list = result?.data?.list;
|
|
3022
|
+
if (!Array.isArray(list)) {
|
|
3023
|
+
throw new InvoiceCliError("api", "issuing_contracts_query_failed", `\u5408\u540C\u6D41\u7A0B ${requestId} \u7684\u5F00\u7968\u6570\u636E\u8FD4\u56DE\u7F3A\u5C11 data.list`, { exitCode: 1 });
|
|
3024
|
+
}
|
|
3025
|
+
rows.push(...list);
|
|
3026
|
+
if (list.length < DETAIL_PAGE_SIZE) return rows;
|
|
3027
|
+
}
|
|
3028
|
+
throw new InvoiceCliError("api", "issuing_contracts_too_many_rows", `\u5408\u540C\u6D41\u7A0B ${requestId} \u7684\u5F00\u7968\u660E\u7EC6\u8D85\u8FC7 ${DETAIL_PAGE_SIZE * MAX_DETAIL_PAGES} \u884C`, { exitCode: 1 });
|
|
3029
|
+
}
|
|
3376
3030
|
};
|
|
3377
3031
|
|
|
3378
3032
|
// src/shortcuts/invoice/operations/list.ts
|
|
@@ -3462,12 +3116,26 @@ function addCalendarDays(isoDate, offsetDays) {
|
|
|
3462
3116
|
const [year, month, day] = isoDate.split("-").map(Number);
|
|
3463
3117
|
return formatUtcDate(new Date(Date.UTC(year, (month ?? 1) - 1, (day ?? 1) + offsetDays)));
|
|
3464
3118
|
}
|
|
3119
|
+
function addCalendarMonths(isoDate, offsetMonths) {
|
|
3120
|
+
const [year, month, day] = isoDate.split("-").map(Number);
|
|
3121
|
+
const target = new Date(Date.UTC(year, (month ?? 1) - 1 + offsetMonths, 1));
|
|
3122
|
+
const lastDay = new Date(Date.UTC(target.getUTCFullYear(), target.getUTCMonth() + 1, 0)).getUTCDate();
|
|
3123
|
+
target.setUTCDate(Math.min(day ?? 1, lastDay));
|
|
3124
|
+
return formatUtcDate(target);
|
|
3125
|
+
}
|
|
3465
3126
|
function shanghaiCalendarDate(offsetDays = 0, now = /* @__PURE__ */ new Date()) {
|
|
3466
3127
|
const today = new Intl.DateTimeFormat("en-CA", { timeZone: "Asia/Shanghai" }).format(now);
|
|
3467
3128
|
return offsetDays === 0 ? today : addCalendarDays(today, offsetDays);
|
|
3468
3129
|
}
|
|
3469
|
-
|
|
3470
|
-
|
|
3130
|
+
var REQUEST_DEFAULT_LOOKBACK_DAYS = 7;
|
|
3131
|
+
var REQUEST_PHONE_LOOKBACK_DAYS = 90;
|
|
3132
|
+
var REQUEST_SCENES = /* @__PURE__ */ new Set(["phone"]);
|
|
3133
|
+
function requestScene(value) {
|
|
3134
|
+
const scene = optionalString(value, "scene");
|
|
3135
|
+
if (scene !== void 0 && !REQUEST_SCENES.has(scene)) {
|
|
3136
|
+
throw invoiceValidationError("input_invalid", 'scene \u53EA\u652F\u6301 "phone"\uFF08\u8BDD\u8D39\u62A5\u9500\uFF09');
|
|
3137
|
+
}
|
|
3138
|
+
return scene;
|
|
3471
3139
|
}
|
|
3472
3140
|
function responseData(value) {
|
|
3473
3141
|
return value && typeof value === "object" && "data" in value ? value.data : value;
|
|
@@ -3542,65 +3210,6 @@ function stringifyEmployeeSuperiorsIds(value) {
|
|
|
3542
3210
|
function employeeSuperiorsEnvelope(value) {
|
|
3543
3211
|
return resultEnvelope(stringifyEmployeeSuperiorsIds(value), "invoice.reim.employee-superiors");
|
|
3544
3212
|
}
|
|
3545
|
-
var flowCreateFields = ["work_flow_id", "mainFormId", "request_name", "main_fields", "detail_rows", "need_user_confirm", "unable_to_fill"];
|
|
3546
|
-
var flowUpdateFields = ["requestId", "mainFormId", "main_fields", "detail_rows", "deleteDetailRows", "need_user_confirm", "unable_to_fill"];
|
|
3547
|
-
var flowMetaFields = /* @__PURE__ */ new Set(["continuation", "confirm"]);
|
|
3548
|
-
function flowPayloadFromInput(input, allowedFields) {
|
|
3549
|
-
const source = asObject(input, "input");
|
|
3550
|
-
if (source.payload !== void 0) {
|
|
3551
|
-
return { value: structuredClone(asObject(source.payload, "payload")), prefix: "payload." };
|
|
3552
|
-
}
|
|
3553
|
-
const allowed = new Set(allowedFields);
|
|
3554
|
-
const value = {};
|
|
3555
|
-
for (const [key, item] of Object.entries(source)) {
|
|
3556
|
-
if (flowMetaFields.has(key)) continue;
|
|
3557
|
-
if (!allowed.has(key)) throw invoiceValidationError("input_invalid", `${key} \u4E0D\u662F\u652F\u6301\u7684\u62A5\u9500\u5355\u5B57\u6BB5`);
|
|
3558
|
-
value[key] = item;
|
|
3559
|
-
}
|
|
3560
|
-
return { value: structuredClone(value), prefix: "" };
|
|
3561
|
-
}
|
|
3562
|
-
function ensureFlowCreatePayload(input) {
|
|
3563
|
-
const { value, prefix } = flowPayloadFromInput(input, flowCreateFields);
|
|
3564
|
-
asNonEmptyString(value.work_flow_id, `${prefix}work_flow_id`);
|
|
3565
|
-
asNonEmptyString(value.mainFormId, `${prefix}mainFormId`);
|
|
3566
|
-
asNonEmptyString(value.request_name, `${prefix}request_name`);
|
|
3567
|
-
if (!Array.isArray(value.main_fields)) throw invoiceValidationError("input_invalid", `${prefix}main_fields \u5FC5\u987B\u662F\u6570\u7EC4`);
|
|
3568
|
-
if (!Array.isArray(value.detail_rows) || value.detail_rows.length === 0) {
|
|
3569
|
-
throw invoiceValidationError("input_invalid", `${prefix}detail_rows \u5FC5\u987B\u662F\u975E\u7A7A\u6570\u7EC4`);
|
|
3570
|
-
}
|
|
3571
|
-
return value;
|
|
3572
|
-
}
|
|
3573
|
-
function ensureFlowUpdatePayload(input) {
|
|
3574
|
-
const { value, prefix } = flowPayloadFromInput(input, flowUpdateFields);
|
|
3575
|
-
asNonEmptyString(value.requestId, `${prefix}requestId`);
|
|
3576
|
-
asNonEmptyString(value.mainFormId, `${prefix}mainFormId`);
|
|
3577
|
-
const hasMain = Array.isArray(value.main_fields) && value.main_fields.length > 0;
|
|
3578
|
-
const hasDetails = Array.isArray(value.detail_rows) && value.detail_rows.length > 0;
|
|
3579
|
-
const hasDeletes = Array.isArray(value.deleteDetailRows) && value.deleteDetailRows.length > 0;
|
|
3580
|
-
if (!hasMain && !hasDetails && !hasDeletes) {
|
|
3581
|
-
const target = prefix ? `${prefix}\u5FC5\u987B` : "input \u5FC5\u987B";
|
|
3582
|
-
throw invoiceValidationError("input_invalid", `${target}\u5305\u542B main_fields\u3001detail_rows \u6216 deleteDetailRows \u81F3\u5C11\u4E00\u7C7B\u53D8\u66F4`);
|
|
3583
|
-
}
|
|
3584
|
-
return value;
|
|
3585
|
-
}
|
|
3586
|
-
function flowPreview(payload) {
|
|
3587
|
-
return {
|
|
3588
|
-
requestName: payload.request_name || "",
|
|
3589
|
-
workflowId: payload.work_flow_id || "",
|
|
3590
|
-
mainFormId: payload.mainFormId || "",
|
|
3591
|
-
mainFieldCount: Array.isArray(payload.main_fields) ? payload.main_fields.length : 0,
|
|
3592
|
-
detailRowCount: Array.isArray(payload.detail_rows) ? payload.detail_rows.length : 0
|
|
3593
|
-
};
|
|
3594
|
-
}
|
|
3595
|
-
function updatePreview(payload) {
|
|
3596
|
-
return {
|
|
3597
|
-
requestId: String(payload.requestId),
|
|
3598
|
-
mainFormId: payload.mainFormId,
|
|
3599
|
-
mainFieldCount: Array.isArray(payload.main_fields) ? payload.main_fields.length : 0,
|
|
3600
|
-
detailRowCount: Array.isArray(payload.detail_rows) ? payload.detail_rows.length : 0,
|
|
3601
|
-
deleteDetailRowCount: Array.isArray(payload.deleteDetailRows) ? payload.deleteDetailRows.length : 0
|
|
3602
|
-
};
|
|
3603
|
-
}
|
|
3604
3213
|
var InvoiceReimFileOcrPreviewOperation = class {
|
|
3605
3214
|
name = "invoice.reim.file-ocr.preview";
|
|
3606
3215
|
async execute(input, { host }) {
|
|
@@ -3630,20 +3239,38 @@ var InvoiceReimFileOcrPreviewOperation = class {
|
|
|
3630
3239
|
};
|
|
3631
3240
|
var InvoiceReimRequestsListOperation = class {
|
|
3632
3241
|
name = "invoice.reim.requests.list";
|
|
3242
|
+
/**
|
|
3243
|
+
* 发起日期窗口:结束日取传入值或东八区当天,发给接口前再加 1 天。
|
|
3244
|
+
* 没传开始日时:话费(scene=phone)取结束日前 90 天;其他取结束日前 7 天,
|
|
3245
|
+
* 第 1 页查不到再放宽到结束日前 1 个月。
|
|
3246
|
+
*/
|
|
3633
3247
|
async execute(input, { host }) {
|
|
3634
|
-
const
|
|
3635
|
-
|
|
3636
|
-
|
|
3248
|
+
const pageNo = integerInput(input.pageNo, "pageNo", { min: 1, max: 1e4 });
|
|
3249
|
+
const pageSize = integerInput(input.pageSize, "pageSize", { min: 1, max: 200, defaultValue: 100 });
|
|
3250
|
+
const requestname = optionalString(input.requestname, "requestname");
|
|
3251
|
+
const explicitStart = optionalDate(input.cusCreateDateStart, "cusCreateDateStart");
|
|
3252
|
+
const scene = requestScene(input.scene);
|
|
3253
|
+
const endDate = optionalDate(input.cusCreateDateEnd, "cusCreateDateEnd") ?? shanghaiCalendarDate(0);
|
|
3254
|
+
const query = async (start2) => {
|
|
3255
|
+
const body = { pageNo, pageSize };
|
|
3256
|
+
if (requestname !== void 0) body.requestname = requestname;
|
|
3257
|
+
body.cusCreateDateStart = start2;
|
|
3258
|
+
body.cusCreateDateEnd = addCalendarDays(endDate, 1);
|
|
3259
|
+
const result2 = await host.invoiceRequest({ path: "/api/inc/book/getRequestListByTabId", method: "POST", body, operation: this.name });
|
|
3260
|
+
assertBusinessSuccess(result2, `${this.name}_failed`, "\u63A5\u53E3\u8FD4\u56DE\u4E1A\u52A1\u5931\u8D25");
|
|
3261
|
+
return result2;
|
|
3637
3262
|
};
|
|
3638
|
-
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
|
|
3646
|
-
|
|
3263
|
+
let start = explicitStart ?? addCalendarDays(endDate, -(scene === "phone" ? REQUEST_PHONE_LOOKBACK_DAYS : REQUEST_DEFAULT_LOOKBACK_DAYS));
|
|
3264
|
+
let widened = false;
|
|
3265
|
+
let result = await query(start);
|
|
3266
|
+
if (explicitStart === void 0 && scene === void 0 && pageNo === 1 && Array.isArray(result?.data) && result.data.length === 0) {
|
|
3267
|
+
start = addCalendarMonths(endDate, -1);
|
|
3268
|
+
widened = true;
|
|
3269
|
+
result = await query(start);
|
|
3270
|
+
}
|
|
3271
|
+
const envelope = resultEnvelope(projectRequestListResult(result), this.name);
|
|
3272
|
+
envelope.data.query = { cusCreateDateStart: start, cusCreateDateEnd: endDate, widened };
|
|
3273
|
+
return envelope;
|
|
3647
3274
|
}
|
|
3648
3275
|
};
|
|
3649
3276
|
var InvoiceReimWorkflowResolveOperation = class {
|
|
@@ -3664,86 +3291,6 @@ var InvoiceReimWorkflowResolveOperation = class {
|
|
|
3664
3291
|
return resultEnvelope(result, "invoice.reim.workflow.resolve");
|
|
3665
3292
|
}
|
|
3666
3293
|
};
|
|
3667
|
-
var InvoiceReimFormStructureOperation = class {
|
|
3668
|
-
name = "invoice.reim.form.structure";
|
|
3669
|
-
async execute(input, { host }) {
|
|
3670
|
-
const result = await host.invoiceRequest({
|
|
3671
|
-
path: "/api/inc/book/getFormStructure",
|
|
3672
|
-
method: "GET",
|
|
3673
|
-
query: {
|
|
3674
|
-
workflowId: asNonEmptyString(input.workflowId, "workflowId"),
|
|
3675
|
-
nodeId: optionalString(input.nodeId, "nodeId") || "1"
|
|
3676
|
-
},
|
|
3677
|
-
operation: this.name
|
|
3678
|
-
});
|
|
3679
|
-
return resultEnvelope(result, "invoice.reim.form.structure");
|
|
3680
|
-
}
|
|
3681
|
-
};
|
|
3682
|
-
var InvoiceReimRowInfoOperation = class {
|
|
3683
|
-
name = "invoice.reim.row-info";
|
|
3684
|
-
async execute(input, { host }) {
|
|
3685
|
-
const session = await host.getSession();
|
|
3686
|
-
const result = await host.invoiceFormRequest({
|
|
3687
|
-
path: "/api/secondev/fna/expense/dataInfo/getRowInfo",
|
|
3688
|
-
method: "POST",
|
|
3689
|
-
query: { sf_request_type: "fetch" },
|
|
3690
|
-
fields: {
|
|
3691
|
-
cdzt: optionalString(input.cdzt, "cdzt") || session.userId,
|
|
3692
|
-
requestid: input.requestid === void 0 ? "" : String(input.requestid),
|
|
3693
|
-
invoiceId: asNonEmptyString(input.invoiceId, "invoiceId")
|
|
3694
|
-
},
|
|
3695
|
-
operation: this.name
|
|
3696
|
-
});
|
|
3697
|
-
return resultEnvelope(result, "invoice.reim.row-info");
|
|
3698
|
-
}
|
|
3699
|
-
};
|
|
3700
|
-
var InvoiceReimRowInfoBatchOperation = class {
|
|
3701
|
-
name = "invoice.reim.row-info-batch";
|
|
3702
|
-
async execute(input, { host }) {
|
|
3703
|
-
const invoiceIds = normalizeIdList(input.invoiceIds, "invoiceIds");
|
|
3704
|
-
const session = await host.getSession();
|
|
3705
|
-
const cdzt = optionalString(input.cdzt, "cdzt") || session.userId;
|
|
3706
|
-
const requestid = input.requestid === void 0 ? "" : String(input.requestid);
|
|
3707
|
-
const results = [];
|
|
3708
|
-
const CONCURRENCY = 4;
|
|
3709
|
-
let cursor = 0;
|
|
3710
|
-
const workers = Array.from({ length: Math.min(CONCURRENCY, invoiceIds.length) }, async () => {
|
|
3711
|
-
while (cursor < invoiceIds.length) {
|
|
3712
|
-
const index = cursor;
|
|
3713
|
-
cursor += 1;
|
|
3714
|
-
const invoiceId = invoiceIds[index];
|
|
3715
|
-
try {
|
|
3716
|
-
const result = await host.invoiceFormRequest({
|
|
3717
|
-
path: "/api/secondev/fna/expense/dataInfo/getRowInfo",
|
|
3718
|
-
method: "POST",
|
|
3719
|
-
query: { sf_request_type: "fetch" },
|
|
3720
|
-
fields: { cdzt, requestid, invoiceId },
|
|
3721
|
-
operation: this.name
|
|
3722
|
-
});
|
|
3723
|
-
assertBusinessSuccess(result, "reim_row_info_failed", `\u83B7\u53D6\u53D1\u7968 ${invoiceId} \u884C\u9884\u586B\u5931\u8D25`);
|
|
3724
|
-
const data = result && typeof result === "object" && "data" in result ? result.data : result;
|
|
3725
|
-
results[index] = { invoiceId, status: "success", data };
|
|
3726
|
-
} catch (error) {
|
|
3727
|
-
const message = error instanceof Error ? error.message : "\u672A\u77E5\u9519\u8BEF";
|
|
3728
|
-
results[index] = { invoiceId, status: "fail", error: message };
|
|
3729
|
-
}
|
|
3730
|
-
}
|
|
3731
|
-
});
|
|
3732
|
-
await Promise.all(workers);
|
|
3733
|
-
const succeeded = results.filter((r) => r.status === "success");
|
|
3734
|
-
const failed = results.filter((r) => r.status === "fail");
|
|
3735
|
-
return {
|
|
3736
|
-
status: failed.length === results.length ? "PARTIAL" : "COMPLETE",
|
|
3737
|
-
data: {
|
|
3738
|
-
results,
|
|
3739
|
-
succeeded: succeeded.length,
|
|
3740
|
-
failed: failed.length,
|
|
3741
|
-
total: results.length,
|
|
3742
|
-
workflow: workflow("invoice.reim.row-info-batch", failed.length ? "PARTIAL" : "COMPLETE")
|
|
3743
|
-
}
|
|
3744
|
-
};
|
|
3745
|
-
}
|
|
3746
|
-
};
|
|
3747
3294
|
var InvoiceReimEmployeeSuperiorsOperation = class {
|
|
3748
3295
|
name = "invoice.reim.employee-superiors";
|
|
3749
3296
|
async execute(_input, { host }) {
|
|
@@ -3803,190 +3350,8 @@ var InvoiceReimFieldSearchOperation = class {
|
|
|
3803
3350
|
};
|
|
3804
3351
|
}
|
|
3805
3352
|
};
|
|
3806
|
-
var InvoiceReimFlowCreatePrepareOperation = class {
|
|
3807
|
-
name = "invoice.reim.flow.create.prepare";
|
|
3808
|
-
async execute(input, { host, continuation }) {
|
|
3809
|
-
const payload = ensureFlowCreatePayload(input);
|
|
3810
|
-
const invoiceIds = payload.detail_rows.map((row) => row?.invoiceId).filter((id) => typeof id === "string" && id.trim() !== "");
|
|
3811
|
-
const assignedWarnings = [];
|
|
3812
|
-
if (invoiceIds.length > 0) {
|
|
3813
|
-
try {
|
|
3814
|
-
const detailResult = await host.invoiceRequest({
|
|
3815
|
-
path: "/api/inc/get",
|
|
3816
|
-
method: "POST",
|
|
3817
|
-
body: { ids: invoiceIds, mask: 0, userFlag: "1", isDelFlag: "1", req_base: reqBase() },
|
|
3818
|
-
operation: "invoice.reim.flow.create.prepare"
|
|
3819
|
-
});
|
|
3820
|
-
const infos = Array.isArray(detailResult?.infos) ? detailResult.infos : [];
|
|
3821
|
-
for (const entry of infos) {
|
|
3822
|
-
if (entry?.ret?.ret !== 0 || !entry.info) continue;
|
|
3823
|
-
const info = entry.info;
|
|
3824
|
-
const fid = String(info.fid ?? info.id ?? "");
|
|
3825
|
-
const number = String(info.number ?? fid);
|
|
3826
|
-
const listReim = info?.oreim?.list_reim;
|
|
3827
|
-
if (Array.isArray(listReim) && listReim.length > 0) {
|
|
3828
|
-
const names = listReim.map((r) => typeof r?.name === "string" ? r.name : "").filter((n) => n.trim()).join("\u3001");
|
|
3829
|
-
assignedWarnings.push(`\u53D1\u7968 ${number} \u5DF2\u6302\u5728\u62A5\u9500\u5355\uFF1A${names || "(\u672A\u77E5)"}\uFF0C\u7EE7\u7EED\u521B\u5EFA\u53EF\u80FD\u5BFC\u81F4\u91CD\u590D\u62A5\u9500`);
|
|
3830
|
-
}
|
|
3831
|
-
}
|
|
3832
|
-
} catch {
|
|
3833
|
-
}
|
|
3834
|
-
}
|
|
3835
|
-
const session = await host.getSession();
|
|
3836
|
-
const continuationToken = await continuation.issue({
|
|
3837
|
-
operation: "invoice.reim.flow.create.apply",
|
|
3838
|
-
workflow: workflow("invoice.reim.flow.create", "AWAITING_CONFIRMATION"),
|
|
3839
|
-
baseUrl: session.baseUrl,
|
|
3840
|
-
profile: session.profile,
|
|
3841
|
-
userId: session.userId,
|
|
3842
|
-
fingerprint: objectFingerprint(payload),
|
|
3843
|
-
preview: flowPreview(payload)
|
|
3844
|
-
});
|
|
3845
|
-
return {
|
|
3846
|
-
status: "AWAITING_CONFIRMATION",
|
|
3847
|
-
data: {
|
|
3848
|
-
preview: flowPreview(payload),
|
|
3849
|
-
continuation: continuationToken,
|
|
3850
|
-
expiresInSeconds: 600,
|
|
3851
|
-
warnings: assignedWarnings.length > 0 ? assignedWarnings : void 0,
|
|
3852
|
-
workflow: workflow("invoice.reim.flow.create", "AWAITING_CONFIRMATION")
|
|
3853
|
-
}
|
|
3854
|
-
};
|
|
3855
|
-
}
|
|
3856
|
-
};
|
|
3857
|
-
var InvoiceReimFlowCreateApplyOperation = class {
|
|
3858
|
-
name = "invoice.reim.flow.create.apply";
|
|
3859
|
-
async execute(input, { host, continuation }) {
|
|
3860
|
-
if (input.confirm !== true) throw invoiceConfirmationError("invoice.reim.flow.create.apply", { hint: "\u91CD\u65B0\u8C03\u7528\u65F6\u4F20\u5165 confirm=true" });
|
|
3861
|
-
const lease = await continuation.verify(input.continuation, "invoice.reim.flow.create.apply");
|
|
3862
|
-
const payload = ensureFlowCreatePayload(input);
|
|
3863
|
-
if (typeof lease.fingerprint !== "string") throw invoiceValidationError("continuation_invalid", "\u62A5\u9500\u5355\u521B\u5EFA continuation \u7F3A\u5C11\u62A5\u9500\u5355\u6307\u7EB9");
|
|
3864
|
-
if (objectFingerprint(payload) !== lease.fingerprint) throw invoiceValidationError("target_changed", "\u62A5\u9500\u5355\u8F7D\u8377\u4E0E\u786E\u8BA4\u65F6\u4E0D\u4E00\u81F4\uFF0C\u8BF7\u91CD\u65B0\u51C6\u5907");
|
|
3865
|
-
const session = await host.getSession();
|
|
3866
|
-
if (!sessionMatches(lease, session)) throw invoiceValidationError("context_mismatch", "\u786E\u8BA4\u4E0A\u4E0B\u6587\u5DF2\u53D8\u5316\uFF0C\u8BF7\u91CD\u65B0\u51C6\u5907\u62A5\u9500\u5355\u521B\u5EFA");
|
|
3867
|
-
let result;
|
|
3868
|
-
try {
|
|
3869
|
-
result = await host.invoiceRequest({ path: "/api/inc/book/createFlowNew", method: "POST", body: payload, operation: this.name, timeoutMs: 9e4 });
|
|
3870
|
-
} catch (error) {
|
|
3871
|
-
if (isInvoiceNetworkError(error)) {
|
|
3872
|
-
throw invoicePartialError("\u62A5\u9500\u5355\u521B\u5EFA\u8BF7\u6C42\u53D1\u9001\u540E\u8FDE\u63A5\u4E2D\u65AD\uFF0C\u7ED3\u679C\u4E0D\u786E\u5B9A\uFF0C\u7981\u6B62\u81EA\u52A8\u91CD\u8BD5", {
|
|
3873
|
-
preview: lease.preview,
|
|
3874
|
-
workflow: workflow("invoice.reim.flow.create", "EXECUTING")
|
|
3875
|
-
}, { stage: "reim-flow-create" });
|
|
3876
|
-
}
|
|
3877
|
-
throw error;
|
|
3878
|
-
}
|
|
3879
|
-
assertBusinessSuccess(result, "reim_flow_create_failed", "\u62A5\u9500\u5355\u521B\u5EFA\u5931\u8D25");
|
|
3880
|
-
const requestId = result?.data?.requestId || result?.requestId;
|
|
3881
|
-
if (!requestId) {
|
|
3882
|
-
throw invoicePartialError("\u62A5\u9500\u5355\u521B\u5EFA\u63A5\u53E3\u8FD4\u56DE\u6210\u529F\u4F46\u7F3A\u5C11 requestId\uFF0C\u7ED3\u679C\u4E0D\u786E\u5B9A", {
|
|
3883
|
-
preview: lease.preview,
|
|
3884
|
-
result,
|
|
3885
|
-
workflow: workflow("invoice.reim.flow.create", "VERIFYING")
|
|
3886
|
-
}, { stage: "reim-flow-create-response" });
|
|
3887
|
-
}
|
|
3888
|
-
const sessionContext = await host.getSession();
|
|
3889
|
-
return {
|
|
3890
|
-
status: "COMPLETE",
|
|
3891
|
-
data: {
|
|
3892
|
-
requestId: String(requestId),
|
|
3893
|
-
requestName: payload.request_name,
|
|
3894
|
-
viewUrl: `${sessionContext.baseUrl}/sp/workflow/flowpage/view/${requestId}`,
|
|
3895
|
-
result,
|
|
3896
|
-
workflow: workflow("invoice.reim.flow.create", "COMPLETE")
|
|
3897
|
-
}
|
|
3898
|
-
};
|
|
3899
|
-
}
|
|
3900
|
-
};
|
|
3901
|
-
var InvoiceReimFlowUpdatePrepareOperation = class {
|
|
3902
|
-
name = "invoice.reim.flow.update.prepare";
|
|
3903
|
-
async execute(input, { host, continuation }) {
|
|
3904
|
-
const payload = ensureFlowUpdatePayload(input);
|
|
3905
|
-
const session = await host.getSession();
|
|
3906
|
-
const continuationToken = await continuation.issue({
|
|
3907
|
-
operation: "invoice.reim.flow.update.apply",
|
|
3908
|
-
workflow: workflow("invoice.reim.flow.update", "AWAITING_CONFIRMATION"),
|
|
3909
|
-
baseUrl: session.baseUrl,
|
|
3910
|
-
profile: session.profile,
|
|
3911
|
-
userId: session.userId,
|
|
3912
|
-
fingerprint: objectFingerprint(payload),
|
|
3913
|
-
preview: updatePreview(payload)
|
|
3914
|
-
});
|
|
3915
|
-
return {
|
|
3916
|
-
status: "AWAITING_CONFIRMATION",
|
|
3917
|
-
data: {
|
|
3918
|
-
preview: updatePreview(payload),
|
|
3919
|
-
continuation: continuationToken,
|
|
3920
|
-
expiresInSeconds: 600,
|
|
3921
|
-
workflow: workflow("invoice.reim.flow.update", "AWAITING_CONFIRMATION")
|
|
3922
|
-
}
|
|
3923
|
-
};
|
|
3924
|
-
}
|
|
3925
|
-
};
|
|
3926
|
-
var InvoiceReimFlowUpdateApplyOperation = class {
|
|
3927
|
-
name = "invoice.reim.flow.update.apply";
|
|
3928
|
-
async execute(input, { host, continuation }) {
|
|
3929
|
-
if (input.confirm !== true) throw invoiceConfirmationError("invoice.reim.flow.update.apply", { hint: "\u91CD\u65B0\u8C03\u7528\u65F6\u4F20\u5165 confirm=true" });
|
|
3930
|
-
const lease = await continuation.verify(input.continuation, "invoice.reim.flow.update.apply");
|
|
3931
|
-
const payload = ensureFlowUpdatePayload(input);
|
|
3932
|
-
if (typeof lease.fingerprint !== "string") throw invoiceValidationError("continuation_invalid", "\u62A5\u9500\u5355\u66F4\u65B0 continuation \u7F3A\u5C11\u62A5\u9500\u5355\u6307\u7EB9");
|
|
3933
|
-
if (objectFingerprint(payload) !== lease.fingerprint) throw invoiceValidationError("target_changed", "\u62A5\u9500\u5355\u66F4\u65B0\u8F7D\u8377\u4E0E\u786E\u8BA4\u65F6\u4E0D\u4E00\u81F4\uFF0C\u8BF7\u91CD\u65B0\u51C6\u5907");
|
|
3934
|
-
const session = await host.getSession();
|
|
3935
|
-
if (!sessionMatches(lease, session)) throw invoiceValidationError("context_mismatch", "\u786E\u8BA4\u4E0A\u4E0B\u6587\u5DF2\u53D8\u5316\uFF0C\u8BF7\u91CD\u65B0\u51C6\u5907\u62A5\u9500\u5355\u66F4\u65B0");
|
|
3936
|
-
let result;
|
|
3937
|
-
try {
|
|
3938
|
-
result = await host.invoiceRequest({ path: "/api/inc/book/updateFlow", method: "POST", body: payload, operation: this.name, timeoutMs: 9e4 });
|
|
3939
|
-
} catch (error) {
|
|
3940
|
-
if (isInvoiceNetworkError(error)) {
|
|
3941
|
-
throw invoicePartialError("\u62A5\u9500\u5355\u66F4\u65B0\u8BF7\u6C42\u53D1\u9001\u540E\u8FDE\u63A5\u4E2D\u65AD\uFF0C\u7ED3\u679C\u4E0D\u786E\u5B9A\uFF0C\u7981\u6B62\u81EA\u52A8\u91CD\u8BD5", {
|
|
3942
|
-
preview: lease.preview,
|
|
3943
|
-
workflow: workflow("invoice.reim.flow.update", "EXECUTING")
|
|
3944
|
-
}, { stage: "reim-flow-update" });
|
|
3945
|
-
}
|
|
3946
|
-
throw error;
|
|
3947
|
-
}
|
|
3948
|
-
assertBusinessSuccess(result, "reim_flow_update_failed", "\u62A5\u9500\u5355\u66F4\u65B0\u5931\u8D25");
|
|
3949
|
-
const data = result?.data || {};
|
|
3950
|
-
if (data.deleteDetailSuccess === false || data.updateFormSuccess === false) {
|
|
3951
|
-
throw invoicePartialError("\u62A5\u9500\u5355\u66F4\u65B0\u8FD4\u56DE\u90E8\u5206\u5931\u8D25\uFF0C\u53EF\u80FD\u5DF2\u6709\u90E8\u5206\u53D8\u66F4\u751F\u6548", {
|
|
3952
|
-
preview: lease.preview,
|
|
3953
|
-
result,
|
|
3954
|
-
workflow: workflow("invoice.reim.flow.update", "VERIFYING")
|
|
3955
|
-
}, { stage: "reim-flow-update-response" });
|
|
3956
|
-
}
|
|
3957
|
-
return {
|
|
3958
|
-
status: "COMPLETE",
|
|
3959
|
-
data: {
|
|
3960
|
-
requestId: String(payload.requestId),
|
|
3961
|
-
result,
|
|
3962
|
-
workflow: workflow("invoice.reim.flow.update", "COMPLETE")
|
|
3963
|
-
}
|
|
3964
|
-
};
|
|
3965
|
-
}
|
|
3966
|
-
};
|
|
3967
3353
|
|
|
3968
3354
|
// src/shortcuts/invoice/operations/reim-auto.ts
|
|
3969
|
-
var REIM_TEMPLATE_WORKFLOW_ID = "100003460000000060";
|
|
3970
|
-
var REIM_TEMPLATE_WORKFLOW_NAME = "\u603B\u90E8\u8D39\u7528\u62A5\u9500";
|
|
3971
|
-
var DEFAULT_SUBJECT_ID = "1256664958132969489";
|
|
3972
|
-
var CNY_ID = "100001050000000001";
|
|
3973
|
-
var BANK_OPTION_VALUE = "7";
|
|
3974
|
-
var DETAIL_INVOICE_FIELD_ID = "100003720000077896";
|
|
3975
|
-
var DETAIL_SUBJECT_FIELD_ID = "100003720000000360";
|
|
3976
|
-
var DETAIL_CURRENCY_FIELD_ID = "100003720000052200";
|
|
3977
|
-
var MAIN_METHOD_FIELD_ID = "100003720000000084";
|
|
3978
|
-
var MAIN_CUSTOMER_FIELD_ID = "100003720000000687";
|
|
3979
|
-
var MAIN_CONTRACT_FIELD_ID = "100003720000001376";
|
|
3980
|
-
var TEMPLATE_SELECT_OPTIONS = {
|
|
3981
|
-
[MAIN_METHOD_FIELD_ID]: {
|
|
3982
|
-
"7": "\u94F6\u884C\uFF08\u4E2A\u4EBA\u62A5\u9500\uFF09",
|
|
3983
|
-
"4": "\u51B2\u9500\u501F\u6B3E",
|
|
3984
|
-
"6": "\u94F6\u884C\uFF08\u4ED8\u516C\u53F8\uFF09"
|
|
3985
|
-
}
|
|
3986
|
-
};
|
|
3987
|
-
var TEMPLATE_SUBJECT_NAMES = { [DEFAULT_SUBJECT_ID]: "\u65E5\u5E38\u6D88\u8D39" };
|
|
3988
|
-
var TEMPLATE_CURRENCY_NAMES = { [CNY_ID]: "\u4EBA\u6C11\u5E01" };
|
|
3989
|
-
var TEMPLATE_CUSTOMER_NAMES = { "100504500000311504": "\u6CDB\u5FAE\u4E0A\u6D77" };
|
|
3990
3355
|
var MONEY_PATTERN2 = /^-?\d+(?:\.\d{1,2})?$/u;
|
|
3991
3356
|
function boundedInteger(value, name, options) {
|
|
3992
3357
|
const parsed = value === void 0 ? options.defaultValue : Number(value);
|
|
@@ -3995,13 +3360,7 @@ function boundedInteger(value, name, options) {
|
|
|
3995
3360
|
}
|
|
3996
3361
|
return parsed;
|
|
3997
3362
|
}
|
|
3998
|
-
function
|
|
3999
|
-
if (value === void 0 || value === null || value === "") return void 0;
|
|
4000
|
-
const text3 = asNonEmptyString(value, name);
|
|
4001
|
-
if (text3.length > maxLength) throw invoiceValidationError("input_invalid", `${name} \u957F\u5EA6\u4E0D\u80FD\u8D85\u8FC7 ${maxLength}`);
|
|
4002
|
-
return text3;
|
|
4003
|
-
}
|
|
4004
|
-
function toCents2(value) {
|
|
3363
|
+
function toCents(value) {
|
|
4005
3364
|
if (value === void 0 || value === null || value === "") return null;
|
|
4006
3365
|
const match = MONEY_PATTERN2.exec(String(value));
|
|
4007
3366
|
if (!match) return null;
|
|
@@ -4020,7 +3379,7 @@ function sumMoney(values) {
|
|
|
4020
3379
|
let sum = 0;
|
|
4021
3380
|
let invalid = 0;
|
|
4022
3381
|
for (const value of values) {
|
|
4023
|
-
const cents2 =
|
|
3382
|
+
const cents2 = toCents(value);
|
|
4024
3383
|
if (cents2 === null) {
|
|
4025
3384
|
invalid += 1;
|
|
4026
3385
|
continue;
|
|
@@ -4029,16 +3388,10 @@ function sumMoney(values) {
|
|
|
4029
3388
|
}
|
|
4030
3389
|
return { amount: centsToMoney(sum), invalid };
|
|
4031
3390
|
}
|
|
4032
|
-
function todayInShanghai() {
|
|
4033
|
-
return new Intl.DateTimeFormat("en-CA", { timeZone: "Asia/Shanghai" }).format(/* @__PURE__ */ new Date());
|
|
4034
|
-
}
|
|
4035
3391
|
function invoiceRecordId(info) {
|
|
4036
3392
|
const raw = info.fid ?? info.id;
|
|
4037
3393
|
return raw === void 0 || raw === null ? "" : String(raw);
|
|
4038
3394
|
}
|
|
4039
|
-
function cleanFysm(value) {
|
|
4040
|
-
return String(value ?? "").replace(/\*/g, "").trim();
|
|
4041
|
-
}
|
|
4042
3395
|
function reimRequestNames(info) {
|
|
4043
3396
|
const entries = info?.oreim?.list_reim;
|
|
4044
3397
|
if (!Array.isArray(entries)) return [];
|
|
@@ -4060,449 +3413,11 @@ function candidateItem(info) {
|
|
|
4060
3413
|
reimRequests: reimRequestNames(info)
|
|
4061
3414
|
};
|
|
4062
3415
|
}
|
|
4063
|
-
var RED_REVERSED_STATUS = 8;
|
|
4064
|
-
function isRedReversedInvoice(info) {
|
|
4065
|
-
const raw = info?.comm_info?.pro?.status;
|
|
4066
|
-
const status = typeof raw === "number" ? raw : Number(raw ?? 0);
|
|
4067
|
-
return status === RED_REVERSED_STATUS;
|
|
4068
|
-
}
|
|
4069
|
-
async function mapWithConcurrency(items, limit, fn) {
|
|
4070
|
-
const results = new Array(items.length);
|
|
4071
|
-
let cursor = 0;
|
|
4072
|
-
const workers = Array.from({ length: Math.min(limit, items.length) }, async () => {
|
|
4073
|
-
while (cursor < items.length) {
|
|
4074
|
-
const index = cursor;
|
|
4075
|
-
cursor += 1;
|
|
4076
|
-
results[index] = await fn(items[index], index);
|
|
4077
|
-
}
|
|
4078
|
-
});
|
|
4079
|
-
await Promise.all(workers);
|
|
4080
|
-
return results;
|
|
4081
|
-
}
|
|
4082
|
-
function optionalName(value) {
|
|
4083
|
-
const text3 = value === void 0 || value === null ? "" : String(value).trim();
|
|
4084
|
-
return text3 || void 0;
|
|
4085
|
-
}
|
|
4086
|
-
async function fetchSuperiors(host, warnings) {
|
|
4087
|
-
const value = await host.invoiceRequest({
|
|
4088
|
-
path: "/api/inc/book/getEmployeeSuperiors",
|
|
4089
|
-
method: "GET",
|
|
4090
|
-
rewriteJsonText: quoteEmployeeIdsInJsonText,
|
|
4091
|
-
operation: "invoice.reim.template.build"
|
|
4092
|
-
});
|
|
4093
|
-
assertBusinessSuccess(value, "reim_superiors_failed", "\u83B7\u53D6\u4EBA\u5458\u4E0A\u7EA7\u5931\u8D25");
|
|
4094
|
-
const data = value?.data && typeof value.data === "object" ? value.data : value;
|
|
4095
|
-
const currentEmployeeId = String(data?.currentEmployee?.id ?? "");
|
|
4096
|
-
if (!currentEmployeeId) throw invoiceValidationError("superiors_invalid", "\u672A\u53D6\u5F97\u5F53\u524D\u4EBA\u5458 ID\uFF0C\u65E0\u6CD5\u7EC4\u88C5\u62A5\u9500\u5355");
|
|
4097
|
-
const directId = data?.directSuperior?.id === void 0 || data?.directSuperior?.id === null ? void 0 : String(data.directSuperior.id);
|
|
4098
|
-
if (!directId) warnings.push("\u63A5\u53E3\u672A\u8FD4\u56DE directSuperior\uFF08\u76F4\u5C5E\u4E0A\u7EA7\uFF09\uFF0C\u62A5\u9500\u4EBA\u4E0A\u7EA7/\u627F\u62C5\u4EBA\u76F4\u63A5\u4E0A\u7EA7\u5B57\u6BB5\u7559\u7A7A\uFF0C\u9700\u5728\u786E\u8BA4\u65F6\u8865\u5145");
|
|
4099
|
-
const allSuperiorIds = Array.isArray(data?.allSuperiors) ? data.allSuperiors.map((item) => String(item?.id ?? "")).filter((id) => id) : [];
|
|
4100
|
-
if (!allSuperiorIds.length) warnings.push("\u63A5\u53E3\u672A\u8FD4\u56DE allSuperiors\uFF0C\u627F\u62C5\u4EBA\u6240\u6709\u4E0A\u7EA7\u5B57\u6BB5\u7559\u7A7A");
|
|
4101
|
-
const allSuperiorNames = Array.isArray(data?.allSuperiors) ? data.allSuperiors.map((item) => optionalName(item?.name) ?? "").filter((name) => name) : [];
|
|
4102
|
-
return {
|
|
4103
|
-
currentEmployeeId,
|
|
4104
|
-
currentEmployeeName: optionalName(data?.currentEmployee?.name),
|
|
4105
|
-
directSuperiorId: directId,
|
|
4106
|
-
directSuperiorName: optionalName(data?.directSuperior?.name),
|
|
4107
|
-
allSuperiorIds,
|
|
4108
|
-
allSuperiorNames
|
|
4109
|
-
};
|
|
4110
|
-
}
|
|
4111
|
-
async function resolveWorkflowId(host, input) {
|
|
4112
|
-
if (input.workflowId !== void 0) {
|
|
4113
|
-
const id2 = asNonEmptyString(input.workflowId, "workflowId");
|
|
4114
|
-
return { id: id2, name: id2 === REIM_TEMPLATE_WORKFLOW_ID ? REIM_TEMPLATE_WORKFLOW_NAME : void 0 };
|
|
4115
|
-
}
|
|
4116
|
-
const value = await host.invoiceRequest({
|
|
4117
|
-
path: "/api/inc/book/getReimburseWorkflowByRequestIds",
|
|
4118
|
-
method: "POST",
|
|
4119
|
-
body: { requestIds: [] },
|
|
4120
|
-
operation: "invoice.reim.template.build"
|
|
4121
|
-
});
|
|
4122
|
-
assertBusinessSuccess(value, "reim_workflow_resolve_failed", "\u89E3\u6790\u5019\u9009\u62A5\u9500\u6D41\u7A0B\u5931\u8D25");
|
|
4123
|
-
const data = value?.data && typeof value.data === "object" ? value.data : value;
|
|
4124
|
-
const candidates = Array.isArray(data?.candidateWorkflows) ? data.candidateWorkflows : [];
|
|
4125
|
-
if (candidates.length === 0) throw invoiceValidationError("workflow_unresolved", "\u6CA1\u6709\u53EF\u7528\u7684\u5019\u9009\u62A5\u9500\u6D41\u7A0B");
|
|
4126
|
-
if (candidates.length > 1) {
|
|
4127
|
-
const names = candidates.map((item) => `${item?.workFlowName ?? ""}(${item?.workFlowId ?? ""})`).join("\u3001");
|
|
4128
|
-
throw invoiceValidationError("input_ambiguous", `\u5019\u9009\u62A5\u9500\u6D41\u7A0B\u591A\u4E8E\u4E00\u4E2A\uFF0C\u8BF7\u663E\u5F0F\u4F20\u5165 workflowId\uFF1A${names}`);
|
|
4129
|
-
}
|
|
4130
|
-
const id = String(candidates[0].workFlowId);
|
|
4131
|
-
const name = optionalName(candidates[0].workFlowName) ?? (id === REIM_TEMPLATE_WORKFLOW_ID ? REIM_TEMPLATE_WORKFLOW_NAME : void 0);
|
|
4132
|
-
return { id, name };
|
|
4133
|
-
}
|
|
4134
|
-
async function searchFieldOptionId(host, workflowId, fieldId, name) {
|
|
4135
|
-
const value = await host.invoiceRequest({
|
|
4136
|
-
path: "/api/government/formStructure/fieldRelateSearch",
|
|
4137
|
-
method: "GET",
|
|
4138
|
-
query: { keywords: name, fieldId, formModeType: "wf", workflowId, nodeId: "100004140000000271" },
|
|
4139
|
-
operation: "invoice.reim.template.build"
|
|
4140
|
-
});
|
|
4141
|
-
assertBusinessSuccess(value, "reim_field_search_failed", `\u6309\u540D\u79F0\u300C${name}\u300D\u641C\u7D22\u5B57\u6BB5\u53EF\u9009\u9879\u5931\u8D25`);
|
|
4142
|
-
const items = Array.isArray(value?.data) ? value.data : [];
|
|
4143
|
-
const ids = Array.from(new Set(items.map((item) => String(item?.id ?? "")).filter((id) => Boolean(id))));
|
|
4144
|
-
if (!ids.length) throw invoiceValidationError("related_customer_unresolved", `\u6309\u540D\u79F0\u300C${name}\u300D\u6CA1\u6709\u641C\u7D22\u5230\u76F8\u5173\u5BA2\u6237\uFF0C\u8BF7\u6539\u7528 relatedCustomerId`);
|
|
4145
|
-
if (ids.length > 1) {
|
|
4146
|
-
const names = items.map((item) => `${item?.name ?? ""}(${item?.id ?? ""})`).join("\u3001");
|
|
4147
|
-
throw invoiceValidationError("input_ambiguous", `\u540D\u79F0\u300C${name}\u300D\u5339\u914D\u5230\u591A\u4E2A\u76F8\u5173\u5BA2\u6237\uFF0C\u8BF7\u6539\u7528 relatedCustomerId\uFF1A${names}`);
|
|
4148
|
-
}
|
|
4149
|
-
return ids[0];
|
|
4150
|
-
}
|
|
4151
|
-
function collectSelectOptions(raw) {
|
|
4152
|
-
const collected = {};
|
|
4153
|
-
const fields = Array.isArray(raw) ? raw : [];
|
|
4154
|
-
for (const field of fields) {
|
|
4155
|
-
const fieldId = String(field?.fieldId ?? "");
|
|
4156
|
-
const options = field?.options;
|
|
4157
|
-
if (!fieldId || !Array.isArray(options) || !options.length) continue;
|
|
4158
|
-
const map = {};
|
|
4159
|
-
for (const option of options) {
|
|
4160
|
-
const optionValue2 = option?.optionValue === void 0 || option?.optionValue === null ? "" : String(option.optionValue);
|
|
4161
|
-
const optionName = optionalName(option?.optionName);
|
|
4162
|
-
if (optionValue2 && optionName) map[optionValue2] = optionName;
|
|
4163
|
-
}
|
|
4164
|
-
if (Object.keys(map).length) collected[fieldId] = map;
|
|
4165
|
-
}
|
|
4166
|
-
return collected;
|
|
4167
|
-
}
|
|
4168
|
-
async function fetchStructure(host, workflowId) {
|
|
4169
|
-
const value = await host.invoiceRequest({
|
|
4170
|
-
path: "/api/inc/book/getFormStructure",
|
|
4171
|
-
method: "GET",
|
|
4172
|
-
query: { workflowId, nodeId: "1" },
|
|
4173
|
-
operation: "invoice.reim.template.build"
|
|
4174
|
-
});
|
|
4175
|
-
assertBusinessSuccess(value, "reim_structure_failed", "\u83B7\u53D6\u62A5\u9500\u8868\u5355\u7ED3\u6784\u5931\u8D25");
|
|
4176
|
-
const data = value?.data && typeof value.data === "object" ? value.data : value;
|
|
4177
|
-
const mainFormId = String(data?.mainFormId ?? "");
|
|
4178
|
-
if (!mainFormId) throw invoiceValidationError("structure_invalid", "\u8868\u5355\u7ED3\u6784\u7F3A\u5C11 mainFormId");
|
|
4179
|
-
const subTables = Array.isArray(data?.subTables) ? data.subTables : [];
|
|
4180
|
-
const byName = subTables.find((table) => String(table?.subFormName ?? "").includes("\u8D39\u7528\u660E\u7EC6"));
|
|
4181
|
-
const bySignature = subTables.find((table) => Array.isArray(table?.subFields) && table.subFields.some((field) => String(field?.fieldId ?? "") === DETAIL_INVOICE_FIELD_ID));
|
|
4182
|
-
const target = byName || bySignature;
|
|
4183
|
-
if (!target) {
|
|
4184
|
-
const names = subTables.map((table) => String(table?.subFormName ?? "")).filter(Boolean).join("\u3001");
|
|
4185
|
-
throw invoiceValidationError("structure_invalid", `\u8868\u5355\u7ED3\u6784\u4E2D\u6CA1\u6709\u53EF\u8BC6\u522B\u7684\u8D39\u7528\u660E\u7EC6\u5B50\u8868\uFF08\u73B0\u6709\u5B50\u8868\uFF1A${names || "\u65E0"}\uFF09`);
|
|
4186
|
-
}
|
|
4187
|
-
const selectOptions = {
|
|
4188
|
-
...TEMPLATE_SELECT_OPTIONS,
|
|
4189
|
-
...collectSelectOptions(data?.mainFields)
|
|
4190
|
-
};
|
|
4191
|
-
for (const table of subTables) {
|
|
4192
|
-
Object.assign(selectOptions, collectSelectOptions(table?.subFields));
|
|
4193
|
-
}
|
|
4194
|
-
return {
|
|
4195
|
-
mainFormId,
|
|
4196
|
-
detailSubFormId: String(target.subFormId),
|
|
4197
|
-
detailSubFormName: String(target.subFormName ?? ""),
|
|
4198
|
-
selectOptions
|
|
4199
|
-
};
|
|
4200
|
-
}
|
|
4201
|
-
async function fetchInvoiceInfos(host, invoiceIds) {
|
|
4202
|
-
const value = await host.invoiceRequest({
|
|
4203
|
-
path: "/api/inc/get",
|
|
4204
|
-
method: "POST",
|
|
4205
|
-
body: { ids: invoiceIds, mask: 0, userFlag: "1", isDelFlag: "1", req_base: reqBase() },
|
|
4206
|
-
operation: "invoice.reim.template.build"
|
|
4207
|
-
});
|
|
4208
|
-
assertBusinessSuccess(value, "invoice_detail_failed", "\u83B7\u53D6\u53D1\u7968\u8BE6\u60C5\u5931\u8D25");
|
|
4209
|
-
const infos = Array.isArray(value?.infos) ? value.infos : [];
|
|
4210
|
-
const byId = /* @__PURE__ */ new Map();
|
|
4211
|
-
for (const entry of infos) {
|
|
4212
|
-
if (entry?.ret?.ret !== 0 || !entry.info) continue;
|
|
4213
|
-
byId.set(invoiceRecordId(entry.info), entry.info);
|
|
4214
|
-
}
|
|
4215
|
-
const missing = invoiceIds.filter((id) => !byId.has(id));
|
|
4216
|
-
if (missing.length) {
|
|
4217
|
-
throw invoiceValidationError("invoice_not_found", `\u4EE5\u4E0B\u53D1\u7968\u672A\u627E\u5230\u6216\u65E0\u6743\u67E5\u770B\uFF1A${missing.join("\u3001")}`);
|
|
4218
|
-
}
|
|
4219
|
-
return byId;
|
|
4220
|
-
}
|
|
4221
|
-
async function fetchRowInfo(host, userId, invoiceId) {
|
|
4222
|
-
const value = await host.invoiceFormRequest({
|
|
4223
|
-
path: "/api/secondev/fna/expense/dataInfo/getRowInfo",
|
|
4224
|
-
method: "POST",
|
|
4225
|
-
query: { sf_request_type: "fetch" },
|
|
4226
|
-
fields: { cdzt: userId, requestid: "", invoiceId },
|
|
4227
|
-
operation: "invoice.reim.template.build"
|
|
4228
|
-
});
|
|
4229
|
-
assertBusinessSuccess(value, "reim_row_info_failed", `\u83B7\u53D6\u53D1\u7968 ${invoiceId} \u884C\u9884\u586B\u5931\u8D25`);
|
|
4230
|
-
return value?.data && typeof value.data === "object" ? value.data : value;
|
|
4231
|
-
}
|
|
4232
|
-
function detailField(fieldId, fieldName, value) {
|
|
4233
|
-
return { fieldId, fieldName, value };
|
|
4234
|
-
}
|
|
4235
|
-
function mainField(fieldId, fieldName, value, optionValue2) {
|
|
4236
|
-
return optionValue2 !== void 0 ? { fieldId, fieldName, optionValue: optionValue2 } : { fieldId, fieldName, value };
|
|
4237
|
-
}
|
|
4238
|
-
function renderIdWithName(id, names) {
|
|
4239
|
-
const text3 = id === void 0 || id === null ? "" : String(id).trim();
|
|
4240
|
-
if (!text3) return "";
|
|
4241
|
-
const name = names[text3];
|
|
4242
|
-
return name ? `${name}(${text3})` : text3;
|
|
4243
|
-
}
|
|
4244
|
-
function renderIdList(value, names) {
|
|
4245
|
-
const text3 = value === void 0 || value === null ? "" : String(value);
|
|
4246
|
-
if (!text3) return "";
|
|
4247
|
-
const parts = text3.split(",").map((part) => part.trim()).filter(Boolean);
|
|
4248
|
-
if (parts.length <= 1) return renderIdWithName(text3, names);
|
|
4249
|
-
return parts.map((part) => renderIdWithName(part, names)).join(", ");
|
|
4250
|
-
}
|
|
4251
|
-
function renderMainFieldView(field, dictionaries) {
|
|
4252
|
-
if (field.optionValue !== void 0) {
|
|
4253
|
-
const optionValue2 = String(field.optionValue);
|
|
4254
|
-
const optionName = dictionaries.selectOptions[field.fieldId]?.[optionValue2];
|
|
4255
|
-
return {
|
|
4256
|
-
fieldId: field.fieldId,
|
|
4257
|
-
fieldName: field.fieldName,
|
|
4258
|
-
optionValue: optionValue2,
|
|
4259
|
-
text: optionName ? `${optionName}(optionValue=${optionValue2})` : `optionValue=${optionValue2}`
|
|
4260
|
-
};
|
|
4261
|
-
}
|
|
4262
|
-
const value = field.value === void 0 || field.value === null ? "" : String(field.value);
|
|
4263
|
-
if (dictionaries.employees[value]) {
|
|
4264
|
-
return { fieldId: field.fieldId, fieldName: field.fieldName, value, text: `${dictionaries.employees[value]}(${value})` };
|
|
4265
|
-
}
|
|
4266
|
-
if (dictionaries.customers[value]) {
|
|
4267
|
-
return { fieldId: field.fieldId, fieldName: field.fieldName, value, text: `${dictionaries.customers[value]}(${value})` };
|
|
4268
|
-
}
|
|
4269
|
-
if (value.includes(",") && value.split(",").every((part) => dictionaries.employees[part.trim()])) {
|
|
4270
|
-
return { fieldId: field.fieldId, fieldName: field.fieldName, value, text: renderIdList(value, dictionaries.employees) };
|
|
4271
|
-
}
|
|
4272
|
-
return { fieldId: field.fieldId, fieldName: field.fieldName, value, text: value };
|
|
4273
|
-
}
|
|
4274
|
-
async function buildReimCreatePayload(input, host, operationName) {
|
|
4275
|
-
const invoiceIdsRaw = input.invoiceIds;
|
|
4276
|
-
if (invoiceIdsRaw === void 0 && input.invoiceId !== void 0) {
|
|
4277
|
-
input.invoiceIds = [input.invoiceId];
|
|
4278
|
-
}
|
|
4279
|
-
if (!Array.isArray(input.invoiceIds) || input.invoiceIds.length === 0) {
|
|
4280
|
-
throw invoiceValidationError("input_invalid", "invoiceIds \u5FC5\u987B\u662F\u975E\u7A7A\u6570\u7EC4");
|
|
4281
|
-
}
|
|
4282
|
-
if (input.invoiceIds.length > 100) throw invoiceValidationError("input_invalid", "invoiceIds \u5355\u6B21\u6700\u591A 100 \u5F20");
|
|
4283
|
-
const invoiceIds = input.invoiceIds.map((id, index) => {
|
|
4284
|
-
const text3 = String(id ?? "").trim();
|
|
4285
|
-
if (!/^[1-9]\d*$/.test(text3)) throw invoiceValidationError("input_invalid", `invoiceIds[${index}] \u5FC5\u987B\u662F\u6B63\u6574\u6570 ID`);
|
|
4286
|
-
return text3;
|
|
4287
|
-
});
|
|
4288
|
-
if (new Set(invoiceIds).size !== invoiceIds.length) {
|
|
4289
|
-
throw invoiceValidationError("input_invalid", "invoiceIds \u4E0D\u80FD\u5305\u542B\u91CD\u590D ID");
|
|
4290
|
-
}
|
|
4291
|
-
const requestName = optionalString2(input.requestName, "requestName", 100);
|
|
4292
|
-
if (!requestName) throw invoiceValidationError("input_invalid", "requestName \u5FC5\u586B");
|
|
4293
|
-
const reason = optionalString2(input.reason, "reason");
|
|
4294
|
-
let relatedCustomerId = optionalString2(input.relatedCustomerId, "relatedCustomerId", 32);
|
|
4295
|
-
const relatedCustomerNameInput = optionalString2(input.relatedCustomerName, "relatedCustomerName", 200);
|
|
4296
|
-
const contractNoInput = optionalString2(input.contractNo, "contractNo", 100);
|
|
4297
|
-
const contractNo = contractNoInput ?? "20260999";
|
|
4298
|
-
const warnings = [];
|
|
4299
|
-
const session = await host.getSession();
|
|
4300
|
-
const superiors = await fetchSuperiors(host, warnings);
|
|
4301
|
-
const workflowRef = await resolveWorkflowId(host, input);
|
|
4302
|
-
const workflowId = workflowRef.id;
|
|
4303
|
-
const structure = await fetchStructure(host, workflowId);
|
|
4304
|
-
const invoices = await fetchInvoiceInfos(host, invoiceIds);
|
|
4305
|
-
if (!relatedCustomerId && relatedCustomerNameInput) {
|
|
4306
|
-
relatedCustomerId = await searchFieldOptionId(host, workflowId, MAIN_CUSTOMER_FIELD_ID, relatedCustomerNameInput);
|
|
4307
|
-
}
|
|
4308
|
-
for (const id of invoiceIds) {
|
|
4309
|
-
const info = invoices.get(id);
|
|
4310
|
-
const number = String(info.number ?? id);
|
|
4311
|
-
const status = Number(info?.comm_info?.pro?.status ?? 0);
|
|
4312
|
-
if (status === 8) {
|
|
4313
|
-
throw invoiceValidationError("invoice_not_reimbursable", `\u53D1\u7968 ${number} \u5DF2\u5168\u989D\u7EA2\u51B2\uFF08status=8\uFF09\uFF0C\u4E0D\u80FD\u7528\u4E8E\u62A5\u9500`);
|
|
4314
|
-
}
|
|
4315
|
-
const assigned = reimRequestNames(info);
|
|
4316
|
-
if (assigned.length) {
|
|
4317
|
-
warnings.push(`\u53D1\u7968 ${number} \u5DF2\u6302\u5728\u62A5\u9500\u5355\uFF1A${assigned.join("\u3001")}\uFF0C\u7EE7\u7EED\u7EC4\u88C5\u5B58\u5728\u91CD\u590D\u62A5\u9500\u98CE\u9669`);
|
|
4318
|
-
}
|
|
4319
|
-
if (!MONEY_PATTERN2.test(String(info?.comm_info?.price?.total ?? ""))) {
|
|
4320
|
-
throw invoiceValidationError("invoice_total_invalid", `\u53D1\u7968 ${number} \u7684\u7968\u9762\u91D1\u989D\u7F3A\u5931\u6216\u683C\u5F0F\u5F02\u5E38`);
|
|
4321
|
-
}
|
|
4322
|
-
}
|
|
4323
|
-
const rowInfos = await mapWithConcurrency(invoiceIds, 4, async (id, index) => {
|
|
4324
|
-
try {
|
|
4325
|
-
return await fetchRowInfo(host, session.userId, id);
|
|
4326
|
-
} catch (error) {
|
|
4327
|
-
warnings.push(`\u53D1\u7968 ${String(invoices.get(id)?.number ?? id)} \u884C\u9884\u586B\u83B7\u53D6\u5931\u8D25\uFF08\u7B2C ${index + 1} \u884C\u6309\u7968\u9762\u515C\u5E95\uFF09`);
|
|
4328
|
-
return {};
|
|
4329
|
-
}
|
|
4330
|
-
});
|
|
4331
|
-
const rowMeta = invoiceIds.map((id, index) => {
|
|
4332
|
-
const info = invoices.get(id);
|
|
4333
|
-
const rowInfo = rowInfos[index] || {};
|
|
4334
|
-
const subjectId = String(rowInfo.subjectId || DEFAULT_SUBJECT_ID);
|
|
4335
|
-
const currencyEntry = Array.isArray(rowInfo.bz) ? rowInfo.bz[0] : void 0;
|
|
4336
|
-
const currencyId = String(currencyEntry?.id ?? CNY_ID);
|
|
4337
|
-
return {
|
|
4338
|
-
invoiceId: id,
|
|
4339
|
-
invoiceNumber: String(info?.number ?? ""),
|
|
4340
|
-
subjectId,
|
|
4341
|
-
subjectName: optionalName(rowInfo.subjectName) ?? TEMPLATE_SUBJECT_NAMES[subjectId],
|
|
4342
|
-
currencyId,
|
|
4343
|
-
currencyName: optionalName(currencyEntry?.name) ?? TEMPLATE_CURRENCY_NAMES[currencyId],
|
|
4344
|
-
expenseNote: cleanFysm(rowInfo.fysm)
|
|
4345
|
-
};
|
|
4346
|
-
});
|
|
4347
|
-
const detailRows = invoiceIds.map((id, index) => {
|
|
4348
|
-
const info = invoices.get(id);
|
|
4349
|
-
const rowInfo = rowInfos[index] || {};
|
|
4350
|
-
const pro = info?.comm_info?.pro || {};
|
|
4351
|
-
const total = String(info?.comm_info?.price?.total ?? "");
|
|
4352
|
-
return {
|
|
4353
|
-
dataIndex: index + 1,
|
|
4354
|
-
subFormId: structure.detailSubFormId,
|
|
4355
|
-
invoiceId: id,
|
|
4356
|
-
fields: [
|
|
4357
|
-
detailField("100003720000000419", "\u8D39\u7528\u65E5\u671F", String(rowInfo.date || pro.date || "")),
|
|
4358
|
-
detailField("100003720000000228", "\u5B9E\u62A5\u91D1\u989D", total),
|
|
4359
|
-
detailField("100003720000016373", "\u7533\u8BF7\u91D1\u989D", total),
|
|
4360
|
-
detailField("1211391578999111696", "\u4EBA\u6C11\u5E01\u91D1\u989D", total),
|
|
4361
|
-
detailField(DETAIL_SUBJECT_FIELD_ID, "\u8D39\u7528\u7C7B\u578B\uFF08\u79D1\u76EE\uFF09", rowMeta[index].subjectId),
|
|
4362
|
-
detailField("100003720000000361", "\u8D39\u7528\u8BF4\u660E", cleanFysm(rowInfo.fysm)),
|
|
4363
|
-
detailField("100003720000000362", "\u9644\u4EF6\u6570", "1"),
|
|
4364
|
-
detailField(DETAIL_CURRENCY_FIELD_ID, "\u5E01\u79CD", CNY_ID),
|
|
4365
|
-
detailField(DETAIL_INVOICE_FIELD_ID, "\u76F8\u5173\u53D1\u7968", id)
|
|
4366
|
-
]
|
|
4367
|
-
};
|
|
4368
|
-
});
|
|
4369
|
-
const { amount: totalAmount } = sumMoney(detailRows.map((row) => row.fields.find((field) => field.fieldId === "100003720000000228")?.value));
|
|
4370
|
-
if (!totalAmount || toCents2(totalAmount) === 0) {
|
|
4371
|
-
throw invoiceValidationError("invoice_total_invalid", "\u53D1\u7968\u91D1\u989D\u5408\u8BA1\u4E3A 0 \u6216\u65E0\u6CD5\u89E3\u6790\uFF0C\u62D2\u7EDD\u7EC4\u88C5\u62A5\u9500\u5355");
|
|
4372
|
-
}
|
|
4373
|
-
const today = todayInShanghai();
|
|
4374
|
-
const mainFields = [
|
|
4375
|
-
mainField("100003720000000073", "\u7533\u8BF7\u4EBA", superiors.currentEmployeeId),
|
|
4376
|
-
mainField("100003720000000075", "\u62A5\u9500\u65E5\u671F", today),
|
|
4377
|
-
mainField("100003720000000088", "\u62A5\u9500\u4E8B\u7531", reason || requestName),
|
|
4378
|
-
mainField("100003720000000084", "\u62A5\u9500\u65B9\u5F0F", void 0, BANK_OPTION_VALUE)
|
|
4379
|
-
];
|
|
4380
|
-
if (relatedCustomerId) mainFields.push(mainField(MAIN_CUSTOMER_FIELD_ID, "\u76F8\u5173\u5BA2\u6237", relatedCustomerId));
|
|
4381
|
-
else warnings.push("\u672A\u63D0\u4F9B relatedCustomerId\uFF0C\u76F8\u5173\u5BA2\u6237\u5B57\u6BB5\u7559\u7A7A");
|
|
4382
|
-
mainFields.push(
|
|
4383
|
-
mainField("100003720000001375", "\u4EBA\u5458ID", superiors.currentEmployeeId)
|
|
4384
|
-
);
|
|
4385
|
-
if (!contractNoInput) {
|
|
4386
|
-
warnings.push('contractNo \u672A\u4F20\u5165\uFF0C\u5DF2\u4F7F\u7528\u9ED8\u8BA4\u5408\u540C\u53F7 "20260999"');
|
|
4387
|
-
}
|
|
4388
|
-
if (contractNo) mainFields.push(mainField(MAIN_CONTRACT_FIELD_ID, "\u5408\u540C\u53F7", contractNo));
|
|
4389
|
-
mainFields.push(
|
|
4390
|
-
mainField("100003720000008409", "\u627F\u62C5\u4E3B\u4F53", superiors.currentEmployeeId),
|
|
4391
|
-
mainField("100003720000012512", "\u63D0\u5355\u4EBA\u5458", superiors.currentEmployeeId),
|
|
4392
|
-
mainField("100003720000012513", "\u63D0\u5355\u4EBA\u5458ID", superiors.currentEmployeeId),
|
|
4393
|
-
mainField("100003720000012514", "\u7533\u8BF7\u65E5\u671F", today)
|
|
4394
|
-
);
|
|
4395
|
-
if (superiors.directSuperiorId) {
|
|
4396
|
-
mainFields.push(
|
|
4397
|
-
mainField("100003720000013859", "\u62A5\u9500\u4EBA\u4E0A\u7EA7", superiors.directSuperiorId),
|
|
4398
|
-
mainField("100003720000029984", "\u627F\u62C5\u4EBA\u76F4\u63A5\u4E0A\u7EA7", superiors.directSuperiorId)
|
|
4399
|
-
);
|
|
4400
|
-
}
|
|
4401
|
-
if (superiors.allSuperiorIds.length) {
|
|
4402
|
-
mainFields.push(mainField("1159505470551416896", "\u627F\u62C5\u4EBA\u6240\u6709\u4E0A\u7EA7", superiors.allSuperiorIds.join(",")));
|
|
4403
|
-
}
|
|
4404
|
-
mainFields.push(
|
|
4405
|
-
mainField("100003720000000080", "\u62A5\u9500\u603B\u91D1\u989D", totalAmount),
|
|
4406
|
-
mainField("100003720000012506", "\u62A5\u9500\u5408\u8BA1\uFF08\u5C0F\u5199\uFF09", totalAmount),
|
|
4407
|
-
mainField("100003720000013853", "\u5B9E\u9645\u62A5\u9500\u91D1\u989Dnew", totalAmount),
|
|
4408
|
-
mainField("1211462428610863218", "\u4EBA\u6C11\u5E01\u91D1\u989D\u5408\u8BA1", totalAmount),
|
|
4409
|
-
mainField("100003720000000081", "\u9644\u4EF6\u603B\u6570", String(detailRows.length))
|
|
4410
|
-
);
|
|
4411
|
-
const payload = {
|
|
4412
|
-
work_flow_id: workflowId,
|
|
4413
|
-
mainFormId: structure.mainFormId,
|
|
4414
|
-
request_name: requestName,
|
|
4415
|
-
main_fields: mainFields,
|
|
4416
|
-
detail_rows: detailRows,
|
|
4417
|
-
need_user_confirm: [],
|
|
4418
|
-
unable_to_fill: []
|
|
4419
|
-
};
|
|
4420
|
-
const unresolved = [];
|
|
4421
|
-
const employeeNames = {};
|
|
4422
|
-
if (superiors.currentEmployeeName) employeeNames[superiors.currentEmployeeId] = superiors.currentEmployeeName;
|
|
4423
|
-
if (superiors.directSuperiorId && superiors.directSuperiorName) {
|
|
4424
|
-
employeeNames[superiors.directSuperiorId] = superiors.directSuperiorName;
|
|
4425
|
-
}
|
|
4426
|
-
superiors.allSuperiorIds.forEach((id, index) => {
|
|
4427
|
-
const name = superiors.allSuperiorNames[index];
|
|
4428
|
-
if (name) employeeNames[id] = name;
|
|
4429
|
-
else unresolved.push(`\u4EBA\u5458 ${id}`);
|
|
4430
|
-
});
|
|
4431
|
-
const subjectNames = { ...TEMPLATE_SUBJECT_NAMES };
|
|
4432
|
-
const currencyNames = { ...TEMPLATE_CURRENCY_NAMES };
|
|
4433
|
-
for (const meta of rowMeta) {
|
|
4434
|
-
if (meta.subjectName) subjectNames[meta.subjectId] = meta.subjectName;
|
|
4435
|
-
else unresolved.push(`\u8D39\u7528\u79D1\u76EE ${meta.subjectId}`);
|
|
4436
|
-
if (meta.currencyName) currencyNames[meta.currencyId] = meta.currencyName;
|
|
4437
|
-
else unresolved.push(`\u5E01\u79CD ${meta.currencyId}`);
|
|
4438
|
-
}
|
|
4439
|
-
const customerNames = {};
|
|
4440
|
-
if (relatedCustomerId) {
|
|
4441
|
-
const name = relatedCustomerNameInput ?? TEMPLATE_CUSTOMER_NAMES[relatedCustomerId];
|
|
4442
|
-
if (name) customerNames[relatedCustomerId] = name;
|
|
4443
|
-
else {
|
|
4444
|
-
unresolved.push(`\u76F8\u5173\u5BA2\u6237 ${relatedCustomerId}`);
|
|
4445
|
-
warnings.push(`\u76F8\u5173\u5BA2\u6237 ${relatedCustomerId} \u65E0\u6CD5\u81EA\u52A8\u53D6\u5230\u4E2D\u6587\u540D\uFF08\u5B57\u6BB5\u53EF\u9009\u9879\u76EE\u53EA\u652F\u6301\u6309\u540D\u79F0\u641C\u7D22\uFF0C\u4E0D\u652F\u6301\u6309 ID \u53CD\u67E5\uFF09\uFF1B\u5982\u9700\u5C55\u793A\u4E2D\u6587\u540D\u8BF7\u4F20\u5165 relatedCustomerName`);
|
|
4446
|
-
}
|
|
4447
|
-
}
|
|
4448
|
-
const labels = {
|
|
4449
|
-
workflow: { id: workflowId, name: workflowRef.name ?? "" },
|
|
4450
|
-
mainFormId: structure.mainFormId,
|
|
4451
|
-
detailSubForm: { id: structure.detailSubFormId, name: structure.detailSubFormName },
|
|
4452
|
-
employees: employeeNames,
|
|
4453
|
-
subjects: subjectNames,
|
|
4454
|
-
currencies: currencyNames,
|
|
4455
|
-
customers: customerNames,
|
|
4456
|
-
selectOptions: structure.selectOptions,
|
|
4457
|
-
customer: relatedCustomerId ? { id: relatedCustomerId, name: customerNames[relatedCustomerId] ?? null } : null,
|
|
4458
|
-
unresolved: Array.from(new Set(unresolved))
|
|
4459
|
-
};
|
|
4460
|
-
const dictionaries = {
|
|
4461
|
-
employees: employeeNames,
|
|
4462
|
-
customers: customerNames,
|
|
4463
|
-
selectOptions: structure.selectOptions
|
|
4464
|
-
};
|
|
4465
|
-
const preview2 = {
|
|
4466
|
-
requestName,
|
|
4467
|
-
workflowId,
|
|
4468
|
-
mainFormId: structure.mainFormId,
|
|
4469
|
-
mainFieldCount: mainFields.length,
|
|
4470
|
-
detailRowCount: detailRows.length,
|
|
4471
|
-
totalAmount,
|
|
4472
|
-
invoiceCount: invoiceIds.length,
|
|
4473
|
-
// 以下三项已把字典类 ID 渲染成「中文(id)」,调用方可直接展示,无需额外查询。
|
|
4474
|
-
mainFields: mainFields.map((field) => renderMainFieldView(field, dictionaries)),
|
|
4475
|
-
detailRows: rowMeta.map((meta, index) => ({
|
|
4476
|
-
dataIndex: index + 1,
|
|
4477
|
-
invoiceId: meta.invoiceId,
|
|
4478
|
-
invoiceNumber: meta.invoiceNumber,
|
|
4479
|
-
amount: String(detailRows[index].fields.find((field) => field.fieldId === "100003720000000228")?.value ?? ""),
|
|
4480
|
-
expenseNote: meta.expenseNote,
|
|
4481
|
-
subject: renderIdWithName(meta.subjectId, subjectNames),
|
|
4482
|
-
currency: renderIdWithName(meta.currencyId, currencyNames)
|
|
4483
|
-
})),
|
|
4484
|
-
unresolvedLabels: labels.unresolved
|
|
4485
|
-
};
|
|
4486
|
-
return { payload, preview: preview2, labels, warnings, workflowId };
|
|
4487
|
-
}
|
|
4488
|
-
function templateEnvelope(result, operationName) {
|
|
4489
|
-
return {
|
|
4490
|
-
status: "COMPLETE",
|
|
4491
|
-
data: {
|
|
4492
|
-
payload: result.payload,
|
|
4493
|
-
preview: result.preview,
|
|
4494
|
-
labels: result.labels,
|
|
4495
|
-
warnings: result.warnings,
|
|
4496
|
-
workflow: workflow(operationName, "COMPLETE")
|
|
4497
|
-
}
|
|
4498
|
-
};
|
|
4499
|
-
}
|
|
4500
3416
|
var InvoiceReimCandidatesListOperation = class {
|
|
4501
3417
|
name = "invoice.reim.candidates.list";
|
|
4502
3418
|
async execute(input, { host }) {
|
|
4503
3419
|
const pageSize = boundedInteger(input.page_size, "page_size", { min: 10, max: 200, defaultValue: 50 });
|
|
4504
3420
|
const maxItems = boundedInteger(input.max_items, "max_items", { min: 1, max: 500, defaultValue: 200 });
|
|
4505
|
-
const includeRedReversed = input.include_red_reversed === true;
|
|
4506
3421
|
const dateBegin = optionalEpochSeconds(input.date_begin, "date_begin");
|
|
4507
3422
|
const dateEnd = optionalEpochSeconds(input.date_end, "date_end");
|
|
4508
3423
|
const consumptionBegin = optionalEpochSeconds(input.consumption_tm_begin, "consumption_tm_begin");
|
|
@@ -4518,7 +3433,6 @@ var InvoiceReimCandidatesListOperation = class {
|
|
|
4518
3433
|
let total = 0;
|
|
4519
3434
|
let hasMore = false;
|
|
4520
3435
|
let startPos = 0;
|
|
4521
|
-
let skippedRedReversed = 0;
|
|
4522
3436
|
let pulled = 0;
|
|
4523
3437
|
do {
|
|
4524
3438
|
const body = {
|
|
@@ -4539,10 +3453,7 @@ var InvoiceReimCandidatesListOperation = class {
|
|
|
4539
3453
|
const infos = Array.isArray(result?.infos) ? result.infos : [];
|
|
4540
3454
|
for (const info of infos) {
|
|
4541
3455
|
pulled += 1;
|
|
4542
|
-
if (
|
|
4543
|
-
skippedRedReversed += 1;
|
|
4544
|
-
continue;
|
|
4545
|
-
}
|
|
3456
|
+
if (isRedReversedInvoice(info)) continue;
|
|
4546
3457
|
kept.push(info);
|
|
4547
3458
|
}
|
|
4548
3459
|
startPos += infos.length;
|
|
@@ -4555,11 +3466,9 @@ var InvoiceReimCandidatesListOperation = class {
|
|
|
4555
3466
|
}
|
|
4556
3467
|
const available = [];
|
|
4557
3468
|
const assigned = [];
|
|
4558
|
-
const redReversed = [];
|
|
4559
3469
|
for (const info of capped) {
|
|
4560
3470
|
const item = candidateItem(info);
|
|
4561
|
-
if (item.
|
|
4562
|
-
else if (item.reimRequests.length) assigned.push(item);
|
|
3471
|
+
if (item.reimRequests.length) assigned.push(item);
|
|
4563
3472
|
else available.push(item);
|
|
4564
3473
|
}
|
|
4565
3474
|
const summarize = (items) => {
|
|
@@ -4570,11 +3479,8 @@ var InvoiceReimCandidatesListOperation = class {
|
|
|
4570
3479
|
const summary = {
|
|
4571
3480
|
availableCount: available.length,
|
|
4572
3481
|
assignedCount: assigned.length,
|
|
4573
|
-
redReversedCount: redReversed.length,
|
|
4574
3482
|
availableAmount: summarize(available),
|
|
4575
|
-
assignedAmount: summarize(assigned)
|
|
4576
|
-
redReversedAmount: summarize(redReversed),
|
|
4577
|
-
filteredRedReversedCount: skippedRedReversed
|
|
3483
|
+
assignedAmount: summarize(assigned)
|
|
4578
3484
|
};
|
|
4579
3485
|
return {
|
|
4580
3486
|
status: "COMPLETE",
|
|
@@ -4584,7 +3490,6 @@ var InvoiceReimCandidatesListOperation = class {
|
|
|
4584
3490
|
hasMore: pulled < total,
|
|
4585
3491
|
available,
|
|
4586
3492
|
assigned,
|
|
4587
|
-
redReversed,
|
|
4588
3493
|
summary,
|
|
4589
3494
|
warnings,
|
|
4590
3495
|
workflow: workflow(this.name, "COMPLETE")
|
|
@@ -4592,41 +3497,6 @@ var InvoiceReimCandidatesListOperation = class {
|
|
|
4592
3497
|
};
|
|
4593
3498
|
}
|
|
4594
3499
|
};
|
|
4595
|
-
var InvoiceReimTemplateBuildOperation = class {
|
|
4596
|
-
name = "invoice.reim.template.build";
|
|
4597
|
-
async execute(input, { host }) {
|
|
4598
|
-
const result = await buildReimCreatePayload(input, host, this.name);
|
|
4599
|
-
return templateEnvelope(result, this.name);
|
|
4600
|
-
}
|
|
4601
|
-
};
|
|
4602
|
-
var InvoiceReimFlowCreateAutoPrepareOperation = class {
|
|
4603
|
-
name = "invoice.reim.flow.create.auto-prepare";
|
|
4604
|
-
async execute(input, { host, continuation }) {
|
|
4605
|
-
const result = await buildReimCreatePayload(input, host, this.name);
|
|
4606
|
-
const session = await host.getSession();
|
|
4607
|
-
const continuationToken = await continuation.issue({
|
|
4608
|
-
operation: "invoice.reim.flow.create.apply",
|
|
4609
|
-
workflow: workflow("invoice.reim.flow.create", "AWAITING_CONFIRMATION"),
|
|
4610
|
-
baseUrl: session.baseUrl,
|
|
4611
|
-
profile: session.profile,
|
|
4612
|
-
userId: session.userId,
|
|
4613
|
-
fingerprint: objectFingerprint(result.payload),
|
|
4614
|
-
preview: result.preview
|
|
4615
|
-
});
|
|
4616
|
-
return {
|
|
4617
|
-
status: "AWAITING_CONFIRMATION",
|
|
4618
|
-
data: {
|
|
4619
|
-
preview: result.preview,
|
|
4620
|
-
payload: result.payload,
|
|
4621
|
-
labels: result.labels,
|
|
4622
|
-
continuation: continuationToken,
|
|
4623
|
-
expiresInSeconds: 600,
|
|
4624
|
-
warnings: result.warnings,
|
|
4625
|
-
workflow: workflow("invoice.reim.flow.create", "AWAITING_CONFIRMATION")
|
|
4626
|
-
}
|
|
4627
|
-
};
|
|
4628
|
-
}
|
|
4629
|
-
};
|
|
4630
3500
|
|
|
4631
3501
|
// src/shortcuts/invoice/operations/update.ts
|
|
4632
3502
|
var InvoiceUpdatePrepareOperation = class {
|
|
@@ -4654,7 +3524,7 @@ var InvoiceUpdatePrepareOperation = class {
|
|
|
4654
3524
|
});
|
|
4655
3525
|
return {
|
|
4656
3526
|
status: "AWAITING_CONFIRMATION",
|
|
4657
|
-
data: { invoice: preview(info, session.baseUrl), changes: diffs, continuation: continuationToken, expiresInSeconds:
|
|
3527
|
+
data: { invoice: preview(info, session.baseUrl), changes: diffs, continuation: continuationToken, expiresInSeconds: CONTINUATION_TTL_SECONDS, workflow: workflow("invoice.update", "AWAITING_CONFIRMATION") }
|
|
4658
3528
|
};
|
|
4659
3529
|
}
|
|
4660
3530
|
};
|
|
@@ -4885,18 +3755,10 @@ function buildRegistry() {
|
|
|
4885
3755
|
new InvoiceReimRequestsListOperation(),
|
|
4886
3756
|
new InvoiceReimWorkflowResolveOperation(),
|
|
4887
3757
|
new InvoiceReimCandidatesListOperation(),
|
|
4888
|
-
new InvoiceReimTemplateBuildOperation(),
|
|
4889
|
-
new InvoiceReimFlowCreateAutoPrepareOperation(),
|
|
4890
|
-
new InvoiceReimFormStructureOperation(),
|
|
4891
|
-
new InvoiceReimRowInfoOperation(),
|
|
4892
|
-
new InvoiceReimRowInfoBatchOperation(),
|
|
4893
3758
|
new InvoiceReimEmployeeSuperiorsOperation(),
|
|
4894
3759
|
new InvoiceReimFieldSearchOperation(),
|
|
4895
|
-
new
|
|
4896
|
-
new
|
|
4897
|
-
new InvoiceReimFlowUpdatePrepareOperation(),
|
|
4898
|
-
new InvoiceReimFlowUpdateApplyOperation(),
|
|
4899
|
-
new InvoiceIssuingQysListOperation()
|
|
3760
|
+
new InvoiceIssuingContractsListOperation(),
|
|
3761
|
+
new InvoiceIssuingContractDetailOperation()
|
|
4900
3762
|
];
|
|
4901
3763
|
for (const handler of handlers) {
|
|
4902
3764
|
if (registry.has(handler.name)) throw new Error(`duplicate invoice operation handler: ${handler.name}`);
|
|
@@ -4905,15 +3767,24 @@ function buildRegistry() {
|
|
|
4905
3767
|
for (const contract of invoiceOperations) {
|
|
4906
3768
|
if (!registry.has(contract.name)) throw new Error(`missing invoice operation handler: ${contract.name}`);
|
|
4907
3769
|
}
|
|
3770
|
+
for (const retired of invoiceRetiredOperations) {
|
|
3771
|
+
if (registry.has(retired.name)) throw new Error(`retired invoice operation is still registered: ${retired.name}`);
|
|
3772
|
+
}
|
|
4908
3773
|
return registry;
|
|
4909
3774
|
}
|
|
4910
3775
|
var invoiceOperationRegistry = buildRegistry();
|
|
4911
3776
|
function getInvoiceOperation(operation) {
|
|
4912
3777
|
const handler = invoiceOperationRegistry.get(operation);
|
|
4913
|
-
if (
|
|
4914
|
-
|
|
3778
|
+
if (handler) return handler;
|
|
3779
|
+
const retired = invoiceRetiredOperations.find((item) => item.name === operation);
|
|
3780
|
+
if (retired) {
|
|
3781
|
+
throw invoiceValidationError(
|
|
3782
|
+
"operation_retired",
|
|
3783
|
+
`\u4E1A\u7968\u901A\u4E0D\u652F\u6301\u64CD\u4F5C\uFF1A${operation}\uFF08\u5DF2\u4E0B\u7EBF\uFF09\u3002${retired.replacement}\uFF1B\u8BE6\u89C1 weaver-e10-yepiaotong \u7684 ${retired.reference}`,
|
|
3784
|
+
{ operation, replacement: retired.replacement, reference: retired.reference }
|
|
3785
|
+
);
|
|
4915
3786
|
}
|
|
4916
|
-
|
|
3787
|
+
throw invoiceValidationError("operation_unknown", `\u4E1A\u7968\u901A\u4E0D\u652F\u6301\u64CD\u4F5C\uFF1A${operation}`);
|
|
4917
3788
|
}
|
|
4918
3789
|
|
|
4919
3790
|
// src/shortcuts/invoice/operations.ts
|
|
@@ -4974,21 +3845,27 @@ function withJsonInputOptions(command) {
|
|
|
4974
3845
|
return command;
|
|
4975
3846
|
}
|
|
4976
3847
|
function withOutputOptions(command) {
|
|
4977
|
-
command.option("--view <mode>", "output view: full (default), summary (list ops) or detail (invoice.get)").option("--
|
|
3848
|
+
command.option("--view <mode>", "output view: full (default), summary (list ops) or detail (invoice.get)").option("--fields <paths>", "comma-separated dot paths to keep, e.g. number,detailUrl").addOption(new Option("--format <mode>").hideHelp());
|
|
4978
3849
|
return command;
|
|
4979
3850
|
}
|
|
3851
|
+
function rejectRemovedFormat(value) {
|
|
3852
|
+
if (value === void 0 || String(value).trim() === "json") return;
|
|
3853
|
+
throw invoiceValidationError(
|
|
3854
|
+
"format_removed",
|
|
3855
|
+
"--format markdown \u5DF2\u79FB\u9664\uFF1A\u5217\u8868\u6539\u7528 --view summary\uFF0Cinvoice get \u6539\u7528 --view detail\uFF0C\u518D\u6309\u5B57\u6BB5\u5728\u56DE\u590D\u91CC\u62FC markdown \u8868\u683C"
|
|
3856
|
+
);
|
|
3857
|
+
}
|
|
4980
3858
|
function withInvoiceOptions(command) {
|
|
4981
3859
|
return withOutputOptions(withJsonInputOptions(command));
|
|
4982
3860
|
}
|
|
4983
3861
|
function projectionFrom(options) {
|
|
4984
3862
|
const opts = asOptions(options);
|
|
3863
|
+
rejectRemovedFormat(opts.format);
|
|
4985
3864
|
const view = normalizeView(opts.view);
|
|
4986
3865
|
const fields = normalizeFields(opts.fields);
|
|
4987
|
-
const format = formatFrom(opts.format);
|
|
4988
3866
|
return {
|
|
4989
3867
|
...view ? { view } : {},
|
|
4990
|
-
...fields ? { fields } : {}
|
|
4991
|
-
...format ? { format } : {}
|
|
3868
|
+
...fields ? { fields } : {}
|
|
4992
3869
|
};
|
|
4993
3870
|
}
|
|
4994
3871
|
function intOption(value) {
|
|
@@ -5027,18 +3904,9 @@ async function executeAndPrint(ctx, operation, input, projection = {}) {
|
|
|
5027
3904
|
continuation: createInvoiceContinuationSigner(ctx)
|
|
5028
3905
|
});
|
|
5029
3906
|
const projected = applyInvoiceProjection(operation, result.data, projection);
|
|
5030
|
-
if (projection.format === "markdown") {
|
|
5031
|
-
if (ctx.getGlobalOptions().json) {
|
|
5032
|
-
throw invoiceValidationError(
|
|
5033
|
-
"input_conflict",
|
|
5034
|
-
"--format markdown \u4E0E --json \u4E92\u65A5\uFF1Amarkdown \u662F\u6E32\u67D3\u6863\uFF08\u6587\u672C\uFF09\uFF0C\u4E0D\u662F JSON\u3002\u53BB\u6389 --json \u518D\u8BD5"
|
|
5035
|
-
);
|
|
5036
|
-
}
|
|
5037
|
-
process.stdout.write(renderInvoiceMarkdown(operation, projected.data));
|
|
5038
|
-
return;
|
|
5039
|
-
}
|
|
5040
3907
|
ctx.output.write(successEnvelope(operation, { status: result.status, data: projected.data }, projected.meta), { json: true });
|
|
5041
3908
|
} catch (error) {
|
|
3909
|
+
reportPlatformError(error);
|
|
5042
3910
|
console.error(JSON.stringify(failureEnvelope(error), null, 2));
|
|
5043
3911
|
process.exitCode = isCliError(error) ? error.exitCode : 1 /* GeneralError */;
|
|
5044
3912
|
}
|