From 940b5fb0e9aa3275ba2b8d9b48049d95cebf14d0 Mon Sep 17 00:00:00 2001 From: kanade Date: Tue, 11 Nov 2025 11:24:07 +0800 Subject: [PATCH] =?UTF-8?q?feat(accounting):=20=E5=88=9D=E5=A7=8B=E5=8C=96?= =?UTF-8?q?=E6=97=A7=E7=89=88=E5=81=9A=E8=B4=A6=E6=9C=8D=E5=8A=A1=E6=A8=A1?= =?UTF-8?q?=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加费用(cost)相关结构体与方法定义 - 添加产品(product)相关结构体与方法定义 - 添加备注(remark)相关结构体与方法定义 - 添加做账主服务(old)及列表、详情等核心接口 - 定义做账单据相关的数据模型和查询参数结构 - 实现通过RPC客户端调用后端服务的通用逻辑 - 添加开票产品资料和做账工厂相关接口定义 --- erp/accounting/old.go | 136 ++++++++++++++++++++++++++++++++++ erp/accounting/old/cost.go | 34 +++++++++ erp/accounting/old/old.go | 7 ++ erp/accounting/old/product.go | 57 ++++++++++++++ erp/accounting/old/remark.go | 31 ++++++++ 5 files changed, 265 insertions(+) create mode 100644 erp/accounting/old.go create mode 100644 erp/accounting/old/cost.go create mode 100644 erp/accounting/old/old.go create mode 100644 erp/accounting/old/product.go create mode 100644 erp/accounting/old/remark.go diff --git a/erp/accounting/old.go b/erp/accounting/old.go new file mode 100644 index 0000000..b3cc2d3 --- /dev/null +++ b/erp/accounting/old.go @@ -0,0 +1,136 @@ +package accounting + +import ( + "context" + "time" + + "git.kumo.work/shama/service/client" + old2 "git.kumo.work/shama/service/erp/accounting/old" + "git.kumo.work/shama/service/lib/bean" + "github.com/shopspring/decimal" +) + +type old struct { + old2.Old +} +type ArgsAccountingList struct { + Page bean.Page + Search AccountingSearch +} +type AccountingSearch struct { + AccountingSerial string // 做账单号 + CustomId int64 // 客户id + CustomName string // 客户名称 + CustomShortName string // 客户简称 + WorkflowStatus []int64 // 审批状态 + CreatedAtStart *time.Time // 创建开始时间 + CreatedAtEnd *time.Time // 创建结束时间 + CreatedStaffIds []int64 // 创建人 + StaffIds []int64 // 业务员 + AccountingIds []int64 // 做账id + BanFlag int64 // 是否有效 +} + +type ReplyAccountingList struct { + List []AccountingItem `json:"list"` + Total int64 `json:"total"` +} +type AccountingItem struct { + Id int64 `json:"id"` + AccountingSerial string `json:"accountingSerial"` + InvoiceDate *time.Time `json:"invoiceDate"` + InvoiceSerial string `json:"invoiceSerial"` + CreatedAt *time.Time `json:"createdAt"` + CustomShortName string `json:"customShortName"` + CustomName string `json:"customName"` + CreatedStaffId int64 `json:"createdStaffId"` + WorkflowId int64 `json:"workflowId"` + WorkflowStatus int64 `json:"workflowStatus"` + WorkflowReason string `json:"workflowReason"` + TotalBoxCount int64 `json:"totalBoxCount"` + TotalAmount decimal.Decimal `json:"totalAmount"` + TotalVolume decimal.Decimal `json:"totalVolume"` + TotalGrossWeight decimal.Decimal `json:"totalGrossWeight"` + TotalNetWeight decimal.Decimal `json:"totalNetWeight"` +} + +// List @TITLE 列表 +func (o *old) List(ctx context.Context, args ArgsAccountingList) (reply ReplyAccountingList, err error) { + xClient, err := client.GetClient(o) + if err != nil { + return + } + err = xClient.Call(ctx, "List", args, &reply) + return +} + +type ReplyAccountingInfo struct { + Id int64 `json:"id"` + CustomId int64 `json:"customId"` + CustomShortName string `json:"customShortName"` + CustomName string `json:"customName"` + InvoiceDate *time.Time `json:"invoiceDate"` + InvoiceDateEnd *time.Time `json:"invoiceDateEnd"` + InvoiceSerial string `json:"invoiceSerial"` + AccountingSerial string `json:"accountingSerial"` + Remark string `json:"remark"` + WorkflowId int64 `json:"workflowId"` + WorkflowStatus int64 `json:"workflowStatus"` + WorkflowReason string `json:"workflowReason"` + BanFlag int64 `json:"banFlag"` + CreatedStaffId int64 `json:"createdStaffId"` + CreatedAt *time.Time `json:"createdAt"` + TotalBoxCount int64 `json:"totalBoxCount"` + TotalAmount decimal.Decimal `json:"totalAmount"` + TotalVolume decimal.Decimal `json:"totalVolume"` + TotalGrossWeight decimal.Decimal `json:"totalGrossWeight"` + TotalNetWeight decimal.Decimal `json:"totalNetWeight"` +} + +// Info @TITLE 详情 +func (o *old) Info(ctx context.Context, accountingId int64) (reply ReplyAccountingInfo, err error) { + xClient, err := client.GetClient(o) + if err != nil { + return + } + err = xClient.Call(ctx, "Info", accountingId, &reply) + return +} + +type InvoiceProductItem struct { + FactoryId int64 `json:"factoryId" label:"工厂id"` // 工厂id + FactoryName string `json:"factoryName" label:"工厂名称"` // 工厂名称 + CustomsSerial string `json:"customsSerial" label:"hs编码"` // hs编码 + CustomsName string `json:"customsName" label:"报关名称"` // 报关名称 + CustomsInvoiceUnit string `json:"customsInvoiceUnit" label:"开票单位"` // 开票单位 + CustomsUnit string `json:"customsUnit" label:"报关单位"` // 报关单位 + RealCustomsInvoiceUnit string `json:"realCustomsInvoiceUnit" label:"实际开票单位"` // 实际开票单位 + InvoiceCount decimal.Decimal `json:"invoiceCount" label:"开票数量"` // 开票数量 + Amount decimal.Decimal `json:"amount" label:"金额"` // 金额 +} + +// InvoiceProducts @TITLE 开票产品资料 +func (o *old) InvoiceProducts(ctx context.Context, accountingId int64) (reply []InvoiceProductItem, err error) { + xClient, err := client.GetClient(o) + if err != nil { + return + } + err = xClient.Call(ctx, "InvoiceProducts", accountingId, &reply) + return + +} + +type ReplyAccountFactoryItem struct { + FactoryId int64 `json:"factoryId"` // 工厂id + FactoryName string `json:"factoryName"` // 工厂名称 +} + +// Factories @TITLE 做账工厂 +func (o *old) Factories(ctx context.Context, accountingId int64) (reply []ReplyAccountFactoryItem, err error) { + xClient, err := client.GetClient(o) + if err != nil { + return + } + err = xClient.Call(ctx, "Factories", accountingId, &reply) + return +} diff --git a/erp/accounting/old/cost.go b/erp/accounting/old/cost.go new file mode 100644 index 0000000..5955915 --- /dev/null +++ b/erp/accounting/old/cost.go @@ -0,0 +1,34 @@ +package old + +import ( + "context" + "time" + + "git.kumo.work/shama/service/client" + "github.com/shopspring/decimal" +) + +type cost struct { +} + +type CostItem struct { + Id int64 `json:"id"` + FactoryId int64 `json:"factoryId"` + FactoryName string `json:"factoryName"` + FactoryShortName string `json:"factoryShortName"` + Name string `json:"name"` + Amount decimal.Decimal `json:"amount"` + Remarks string `json:"remarks"` + CreatedAt *time.Time `json:"createdAt"` + UpdatedAt *time.Time `json:"updatedAt"` +} + +// All @TITLE 获取费用 +func (c *cost) All(ctx context.Context, accountingId int64) (reply []CostItem, err error) { + xClient, err := client.GetClient(c) + if err != nil { + return + } + err = xClient.Call(ctx, "All", accountingId, &reply) + return +} diff --git a/erp/accounting/old/old.go b/erp/accounting/old/old.go new file mode 100644 index 0000000..b0f2d8d --- /dev/null +++ b/erp/accounting/old/old.go @@ -0,0 +1,7 @@ +package old + +type Old struct { + Cost cost + Product product + Remark remark +} diff --git a/erp/accounting/old/product.go b/erp/accounting/old/product.go new file mode 100644 index 0000000..53e4fc9 --- /dev/null +++ b/erp/accounting/old/product.go @@ -0,0 +1,57 @@ +package old + +import ( + "context" + + "git.kumo.work/shama/service/client" + "github.com/shopspring/decimal" +) + +type product struct { +} + +type ProductItem struct { + Id int64 `json:"id"` + PurchaseProductId int64 `json:"purchaseProductId"` + SaleProductId int64 `json:"saleProductId"` + Sort int64 `json:"sort"` + Serial string `json:"serial"` + PiSerial string `json:"piSerial"` + CustomSerial string `json:"customSerial"` + Name string `json:"name"` + CustomsSerial string `json:"customsSerial"` + CustomsName string `json:"customsName"` + CustomsInvoiceUnit string `json:"customsInvoiceUnit"` + CustomsUnit string `json:"customsUnit"` + RealCustomsInvoiceUnit string `json:"realCustomsInvoiceUnit"` + InvoiceType int64 `json:"invoiceType"` + InvoiceCount decimal.Decimal `json:"invoiceCount"` + AccountingCount int64 `json:"accountingCount"` + OuterNum *int64 `json:"outerNum"` + BoxCount int64 `json:"boxCount"` + PurchasePrice decimal.Decimal `json:"purchasePrice"` + Amount decimal.Decimal `json:"amount"` + Volume *decimal.Decimal `json:"volume"` + TotalVolume decimal.Decimal `json:"totalVolume"` + GrossWeight *decimal.Decimal `json:"grossWeight"` + TotalGrossWeight decimal.Decimal `json:"totalGrossWeight"` + NetWeight *decimal.Decimal `json:"netWeight"` + TotalNetWeight decimal.Decimal `json:"totalNetWeight"` + PackageDescription string `json:"packageDescription"` + FactoryId int64 `json:"factoryId"` + FactoryName string `json:"factoryName"` + SaleProductAccountingCount int64 `json:"saleProductAccountingCount"` + SaleProductPurchasedCount int64 `json:"saleProductPurchasedCount"` + ContainerNumber string `json:"containerNumber"` + ContainerNumberBoxCount int64 `json:"containerNumberBoxCount"` +} + +// All @TITLE 获取产品 +func (p *product) All(ctx context.Context, accountingId int64) (reply []ProductItem, err error) { + xClient, err := client.GetClient(p) + if err != nil { + return + } + err = xClient.Call(ctx, "All", accountingId, &reply) + return +} diff --git a/erp/accounting/old/remark.go b/erp/accounting/old/remark.go new file mode 100644 index 0000000..ea6934f --- /dev/null +++ b/erp/accounting/old/remark.go @@ -0,0 +1,31 @@ +package old + +import ( + "context" + "time" + + "git.kumo.work/shama/service/client" +) + +type remark struct { +} + +type RemarkItem struct { + Id int64 `json:"id"` + FactoryId int64 `json:"factoryId"` + FactoryName string `json:"factoryName"` + FactoryShortName string `json:"factoryShortName"` + Remarks string `json:"remarks"` + CreatedAt *time.Time `json:"createdAt"` + UpdatedAt *time.Time `json:"updatedAt"` +} + +// All @TITLE 获取备注 +func (r *remark) All(ctx context.Context, accountingId int64) (reply []RemarkItem, err error) { + xClient, err := client.GetClient(r) + if err != nil { + return + } + err = xClient.Call(ctx, "All", accountingId, &reply) + return +}