- 在 expense.go 中添加 BanFlag 字段用于标识报销单状态 - 在 receipt.go 中添加 BanFlag 字段用于标识结汇单状态 - 在 request.go 中添加 BanFlag 字段用于标识申请单状态 - 所有新增字段均支持 1=禁用 2=启用 的状态定义
154 lines
4.8 KiB
Go
154 lines
4.8 KiB
Go
package erp
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"git.kumo.work/shama/service/client"
|
|
receipt2 "git.kumo.work/shama/service/erp/receipt"
|
|
"git.kumo.work/shama/service/lib/bean"
|
|
"github.com/shopspring/decimal"
|
|
)
|
|
|
|
type receipt struct {
|
|
receipt2.Receipt
|
|
}
|
|
type ArgsReceiptList struct {
|
|
Page bean.Page
|
|
Search ReceiptSearch
|
|
}
|
|
type ReceiptSearch struct {
|
|
ReceiptSerial string // 收汇单号
|
|
CustomId int64 // 客户筛选
|
|
CustomName string // 客户筛选
|
|
BankName string // 结汇银行
|
|
ReceiptDateStart *time.Time // 创建开始时间
|
|
ReceiptDateEnd *time.Time // 创建结束时间
|
|
BanFlag int64 // 禁用标记 1=禁用 2=启用
|
|
}
|
|
type ReplyReceiptList struct {
|
|
List []ReceiptItem `json:"list"`
|
|
Total int64 `json:"total"`
|
|
}
|
|
type ReceiptItem struct {
|
|
Id int64 `json:"id"`
|
|
ReceiptSerial string `json:"receiptSerial"`
|
|
CustomId int64 `json:"customId"`
|
|
CustomName string `json:"customName"`
|
|
ReceiptDate time.Time `json:"receiptDate"`
|
|
Currency string `json:"currency"`
|
|
CurrencyName string `json:"currencyName"`
|
|
CurrencySymbol string `json:"currencySymbol"`
|
|
CurrencyRate decimal.Decimal `json:"currencyRate"`
|
|
BankName string `json:"bankName"`
|
|
EntryAmount decimal.Decimal `json:"entryAmount"`
|
|
ReceivableFxAmount decimal.Decimal `json:"receivableFxAmount"`
|
|
CreatedStaffId int64 `json:"createdStaffId"`
|
|
CreatedAt *time.Time `json:"createdAt"`
|
|
UpdatedAt *time.Time `json:"updatedAt"`
|
|
}
|
|
|
|
// List @TITLE 列表
|
|
func (r *receipt) List(ctx context.Context, args ArgsReceiptList) (reply ReplyReceiptList, err error) {
|
|
xClient, err := client.GetClient(r)
|
|
if err != nil {
|
|
return
|
|
}
|
|
err = xClient.Call(ctx, "List", args, &reply)
|
|
return
|
|
}
|
|
|
|
type ArgsReceiptAdd struct {
|
|
StaffId int64
|
|
ReceiptAdd
|
|
}
|
|
type ReceiptAdd struct {
|
|
ReceiptDate time.Time // 收汇日期
|
|
Currency string // 币种
|
|
CurrencyName string // 币种名称
|
|
CurrencySymbol string // 币种符号
|
|
CurrencyRate decimal.Decimal // 币种汇率
|
|
CustomId int64 // 客户id
|
|
BankName string // 结汇银行
|
|
EntryAmount decimal.Decimal // 外币入账金额
|
|
ForeignFee decimal.Decimal // 国外扣费
|
|
DomesticFee decimal.Decimal // 国内扣费
|
|
DomesticFeeType DomesticFeeType // 国内扣费类型 1=外币 2=人民币
|
|
}
|
|
|
|
// Add @TITLE 添加
|
|
func (r *receipt) Add(ctx context.Context, args ArgsReceiptAdd) (receiptId int64, err error) {
|
|
xClient, err := client.GetClient(r)
|
|
if err != nil {
|
|
return
|
|
}
|
|
err = xClient.Call(ctx, "Add", args, &receiptId)
|
|
return
|
|
}
|
|
|
|
type ReplyReceiptInfo struct {
|
|
Id int64 `json:"id"`
|
|
ReceiptSerial string `json:"receiptSerial"`
|
|
ReceiptDate time.Time `json:"receiptDate"`
|
|
Currency string `json:"currency"`
|
|
CurrencyName string `json:"currencyName"`
|
|
CurrencySymbol string `json:"currencySymbol"`
|
|
CurrencyRate decimal.Decimal `json:"currencyRate"`
|
|
CustomId int64 `json:"customId"`
|
|
CustomName string `json:"customName"`
|
|
BankName string `json:"bankName"`
|
|
EntryAmount decimal.Decimal `json:"entryAmount"`
|
|
ForeignFee decimal.Decimal `json:"foreignFee"`
|
|
DomesticFee decimal.Decimal `json:"domesticFee"`
|
|
DomesticFeeType int64 `json:"domesticFeeType"`
|
|
ReceivableFxAmount decimal.Decimal `json:"receivableFxAmount"`
|
|
CreatedStaffId int64 `json:"createdStaffId"`
|
|
CreatedAt *time.Time `json:"createdAt"`
|
|
UpdatedAt *time.Time `json:"updatedAt"`
|
|
}
|
|
|
|
// Info @TITLE 详情
|
|
func (r *receipt) Info(ctx context.Context, receiptId int64) (reply ReplyReceiptInfo, err error) {
|
|
xClient, err := client.GetClient(r)
|
|
if err != nil {
|
|
return
|
|
}
|
|
err = xClient.Call(ctx, "Info", receiptId, &reply)
|
|
return
|
|
}
|
|
|
|
type ArgsReceiptEdit struct {
|
|
ReceiptId int64
|
|
ReceiptAdd
|
|
}
|
|
|
|
// Edit @TITLE 编辑
|
|
func (r *receipt) Edit(ctx context.Context, args ArgsReceiptEdit) (err error) {
|
|
xClient, err := client.GetClient(r)
|
|
if err != nil {
|
|
return
|
|
}
|
|
reply := 0
|
|
return xClient.Call(ctx, "Edit", args, &reply)
|
|
}
|
|
|
|
// Ik3cloud @TITLE 金蝶同步
|
|
func (r *receipt) Ik3cloud(ctx context.Context, receiptId int64) (err error) {
|
|
xClient, err := client.GetClient(r)
|
|
if err != nil {
|
|
return
|
|
}
|
|
reply := 0
|
|
return xClient.Call(ctx, "Ik3cloud", receiptId, &reply)
|
|
}
|
|
|
|
// Cancel @TITLE 作废
|
|
func (r *receipt) Cancel(ctx context.Context, receiptId int64) (err error) {
|
|
xClient, err := client.GetClient(r)
|
|
if err != nil {
|
|
return
|
|
}
|
|
reply := 0
|
|
return xClient.Call(ctx, "Cancel", receiptId, &reply)
|
|
}
|