From f7be98192c3bd032034de902a42ceb216a01758a Mon Sep 17 00:00:00 2001 From: kanade Date: Mon, 25 May 2026 15:59:24 +0800 Subject: [PATCH] =?UTF-8?q?feat(erp):=20=E6=B7=BB=E5=8A=A0=E9=A2=84?= =?UTF-8?q?=E4=BB=98=E6=AC=BE=E5=8A=9F=E8=83=BD=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在Request结构体中新增Prepaid字段 - 新增prepaid.go文件实现预付款相关操作 - 添加PrepaidItem结构体定义预付款项目字段 - 实现All方法用于获取费用列表 - 实现Add方法用于添加预付款记录 - 实现Edit方法用于编辑预付款记录 - 实现Delete方法用于删除预付款记录 - 定义ArgsPrepaidAdd和PrepaidAdd参数结构体 - 定义ArgsPrepaidEdit参数结构体用于编辑操作 --- erp/request/prepaid.go | 77 ++++++++++++++++++++++++++++++++++++++++++ erp/request/request.go | 5 +-- 2 files changed, 80 insertions(+), 2 deletions(-) create mode 100644 erp/request/prepaid.go diff --git a/erp/request/prepaid.go b/erp/request/prepaid.go new file mode 100644 index 0000000..be52bcc --- /dev/null +++ b/erp/request/prepaid.go @@ -0,0 +1,77 @@ +package request + +import ( + "context" + "time" + + "git.kumo.work/shama/service/client" + "github.com/shopspring/decimal" +) + +type prepaid struct { +} + +type PrepaidItem struct { + Id int64 `json:"id"` + InvoiceSerial string `json:"invoiceSerial"` + Amount decimal.Decimal `json:"amount"` + Remark string `json:"remark"` + CreatedAt *time.Time `json:"createdAt"` + UpdatedAt *time.Time `json:"updatedAt"` +} + +// All @TITLE 获取费用 +func (c *prepaid) All(ctx context.Context, requestId int64) (reply []PrepaidItem, err error) { + xClient, err := client.GetClient(c) + if err != nil { + return + } + err = xClient.Call(ctx, "All", requestId, &reply) + return +} + +type ArgsPrepaidAdd struct { + RequestId int64 // 付款申请单ID + PrepaidAdd +} + +type PrepaidAdd struct { + InvoiceSerial string // 发票编号 + Amount decimal.Decimal // 金额 + Remark string // 备注 +} + +// Add @TITLE 添加费用 +func (c *prepaid) Add(ctx context.Context, args ArgsPrepaidAdd) (err error) { + xClient, err := client.GetClient(c) + if err != nil { + return + } + reply := 0 + return xClient.Call(ctx, "Add", args, &reply) +} + +type ArgsPrepaidEdit struct { + PrepaidId int64 // 费用ID + PrepaidAdd +} + +// Edit @TITLE 编辑费用 +func (c *prepaid) Edit(ctx context.Context, args ArgsPrepaidEdit) (err error) { + xClient, err := client.GetClient(c) + if err != nil { + return + } + reply := 0 + return xClient.Call(ctx, "Edit", args, &reply) +} + +// Delete @TITLE 删除费用 +func (c *prepaid) Delete(ctx context.Context, prepaidIds []int64) (err error) { + xClient, err := client.GetClient(c) + if err != nil { + return + } + reply := 0 + return xClient.Call(ctx, "Delete", prepaidIds, &reply) +} diff --git a/erp/request/request.go b/erp/request/request.go index 4dfb699..d3f3d5a 100644 --- a/erp/request/request.go +++ b/erp/request/request.go @@ -1,6 +1,7 @@ package request type Request struct { - Cost cost - Audit audit + Cost cost + Audit audit + Prepaid prepaid }