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
|
||||||
|
}
|
||||||
34
erp/accounting/old/cost.go
Normal file
34
erp/accounting/old/cost.go
Normal file
@@ -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
|
||||||
|
}
|
||||||
7
erp/accounting/old/old.go
Normal file
7
erp/accounting/old/old.go
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
package old
|
||||||
|
|
||||||
|
type Old struct {
|
||||||
|
Cost cost
|
||||||
|
Product product
|
||||||
|
Remark remark
|
||||||
|
}
|
||||||
57
erp/accounting/old/product.go
Normal file
57
erp/accounting/old/product.go
Normal file
@@ -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
|
||||||
|
}
|
||||||
31
erp/accounting/old/remark.go
Normal file
31
erp/accounting/old/remark.go
Normal file
@@ -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
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user