feat(accounting): 初始化旧版做账服务模块
- 添加费用(cost)相关结构体与方法定义 - 添加产品(product)相关结构体与方法定义 - 添加备注(remark)相关结构体与方法定义 - 添加做账主服务(old)及列表、详情等核心接口 - 定义做账单据相关的数据模型和查询参数结构 - 实现通过RPC客户端调用后端服务的通用逻辑 - 添加开票产品资料和做账工厂相关接口定义
This commit is contained in:
136
erp/accounting/old.go
Normal file
136
erp/accounting/old.go
Normal file
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user