service/erp/purchase/clause.go

77 lines
1.6 KiB
Go
Raw Normal View History

2024-07-16 17:18:31 +08:00
package purchase
import (
"context"
"git.kumo.work/shama/service/client"
"time"
)
type clause struct {
}
type ClauseItem struct {
2024-09-20 14:51:43 +08:00
Id int64 `json:"id"`
PurchaseId int64 `json:"purchaseId"`
Sort int64 `json:"sort"`
Key string `json:"key"`
Value string `json:"value"`
CreatedAt *time.Time `json:"createdAt"`
UpdatedAt *time.Time `json:"updatedAt"`
2024-07-16 17:18:31 +08:00
}
// All @TITLE 获取条款
2024-09-20 14:51:43 +08:00
func (c *clause) All(ctx context.Context, purchaseIds []int64) (reply []ClauseItem, err error) {
2024-07-16 17:18:31 +08:00
xClient, err := client.GetClient(c)
if err != nil {
return
}
2024-09-20 14:51:43 +08:00
err = xClient.Call(ctx, "All", purchaseIds, &reply)
2024-07-16 17:18:31 +08:00
return
}
type ArgsClauseAdd struct {
PurchaseId int64 // 采购合同ID
2024-09-05 17:06:40 +08:00
ClauseAdds []ClauseAdd
2024-07-16 17:18:31 +08:00
}
type ClauseAdd struct {
Sort int64 // 排序
Key string // 项目
Value string // 内容
}
// Add @TITLE 添加条款
func (c *clause) Add(ctx context.Context, args ArgsClauseAdd) (err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
reply := 0
return xClient.Call(ctx, "Add", args, &reply)
}
type ArgsClauseEdit struct {
ClauseId int64 // 条款ID
ClauseAdd
}
// Edit @TITLE 编辑条款
func (c *clause) Edit(ctx context.Context, args ArgsClauseEdit) (err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
reply := 0
return xClient.Call(ctx, "Edit", args, &reply)
}
// Delete @TITLE 删除条款
func (c *clause) Delete(ctx context.Context, clauseIds []int64) (err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
reply := 0
return xClient.Call(ctx, "Delete", clauseIds, &reply)
}