部署
This commit is contained in:
170
erp/accounting.go
Normal file
170
erp/accounting.go
Normal file
@@ -0,0 +1,170 @@
|
||||
package erp
|
||||
|
||||
import (
|
||||
"context"
|
||||
"git.kumo.work/shama/service/client"
|
||||
accounting2 "git.kumo.work/shama/service/erp/accounting"
|
||||
"git.kumo.work/shama/service/lib/bean"
|
||||
"github.com/shopspring/decimal"
|
||||
"time"
|
||||
)
|
||||
|
||||
type accounting struct {
|
||||
accounting2.Accounting
|
||||
}
|
||||
type ArgsAccountingList struct {
|
||||
Page bean.Page
|
||||
Search AccountingSearch
|
||||
}
|
||||
type AccountingSearch struct {
|
||||
AccountingSerial string // 做账单号
|
||||
CustomName string // 客户名称
|
||||
CustomShortName string // 客户简称
|
||||
WorkflowStatus []int64 // 审批状态
|
||||
CreatedAtStart *time.Time // 创建开始时间
|
||||
CreatedAtEnd *time.Time // 创建结束时间
|
||||
CreatedStaffIds []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"`
|
||||
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 (a *accounting) List(ctx context.Context, args ArgsAccountingList) (reply ReplyAccountingList, err error) {
|
||||
xClient, err := client.GetClient(a)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = xClient.Call(ctx, "List", args, &reply)
|
||||
return
|
||||
}
|
||||
|
||||
type ArgsAccountingAdd struct {
|
||||
StaffId int64
|
||||
AccountingAdd AccountingAdd
|
||||
}
|
||||
|
||||
type AccountingAdd struct {
|
||||
CustomId int64 // 客户id
|
||||
CustomShortName string // 客户简称
|
||||
CustomName string // 客户名称
|
||||
InvoiceDate *time.Time // 发票日期
|
||||
InvoiceDateEnd *time.Time // 开票期限
|
||||
AccountingSerial string // 做账合同号
|
||||
Remark string // 备注
|
||||
Products []AccountingProductItem // 销售产品
|
||||
}
|
||||
|
||||
type AccountingProductItem struct {
|
||||
PurchaseProductId int64 // 采购产品id
|
||||
AccountingCount int64 // 做账数量
|
||||
CustomsSerial string // hs编码
|
||||
CustomsName string // 报关名称
|
||||
CustomsInvoiceUnit string // 开票单位
|
||||
InvoiceType int64 // 开票方式 1=按净重 2=按数量
|
||||
InvoiceCount decimal.Decimal // 开票数量
|
||||
}
|
||||
|
||||
// Add @TITLE 添加
|
||||
func (a *accounting) Add(ctx context.Context, args ArgsAccountingAdd) (accountId int64, err error) {
|
||||
xClient, err := client.GetClient(a)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = xClient.Call(ctx, "Add", args, &accountId)
|
||||
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"`
|
||||
AccountingSerial string `json:"accountingSerial"`
|
||||
Remark string `json:"remark"`
|
||||
WorkflowId int64 `json:"workflowId"`
|
||||
WorkflowStatus int64 `json:"workflowStatus"`
|
||||
WorkflowReason string `json:"workflowReason"`
|
||||
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 (a *accounting) Info(ctx context.Context, accountingId int64) (reply ReplyAccountingInfo, err error) {
|
||||
xClient, err := client.GetClient(a)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = xClient.Call(ctx, "Info", accountingId, &reply)
|
||||
return
|
||||
}
|
||||
|
||||
type ArgsAccountingEdit struct {
|
||||
AccountingId int64 // 做账合同id
|
||||
AccountingEdit AccountingEdit
|
||||
}
|
||||
|
||||
type AccountingEdit struct {
|
||||
InvoiceDate *time.Time // 发票日期
|
||||
InvoiceDateEnd *time.Time // 开票期限
|
||||
AccountingSerial string // 做账合同号
|
||||
Remark string // 备注
|
||||
}
|
||||
|
||||
// Edit @TITLE 编辑
|
||||
func (a *accounting) Edit(ctx context.Context, args ArgsAccountingEdit) (err error) {
|
||||
xClient, err := client.GetClient(a)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
reply := 0
|
||||
err = xClient.Call(ctx, "Edit", args, &reply)
|
||||
return
|
||||
}
|
||||
|
||||
type InvoiceProductItem struct {
|
||||
FactoryId int64 `json:"factoryId"`
|
||||
FactoryName string `json:"factoryName"`
|
||||
CustomsSerial string `json:"customsSerial"`
|
||||
CustomsName string `json:"customsName"`
|
||||
CustomsInvoiceUnit string `json:"customsInvoiceUnit"`
|
||||
InvoiceCount decimal.Decimal `json:"invoiceCount"`
|
||||
Amount decimal.Decimal `json:"amount"`
|
||||
}
|
||||
|
||||
// InvoiceProducts @TITLE 开票产品资料
|
||||
func (a *accounting) InvoiceProducts(ctx context.Context, accountingId int64) (reply []InvoiceProductItem, err error) {
|
||||
xClient, err := client.GetClient(a)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = xClient.Call(ctx, "InvoiceProducts", accountingId, &reply)
|
||||
return
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user