This commit is contained in:
2024-07-16 17:18:31 +08:00
parent 6dd80a46ca
commit f9bb041a2e
26 changed files with 1995 additions and 14 deletions

View File

@@ -0,0 +1,73 @@
package purchase
import (
"context"
"git.kumo.work/shama/service/client"
"time"
)
type annotations struct {
}
type AnnotationsItem struct {
Id int64 `json:"id"`
Sort int64 `json:"sort"`
Value string `json:"value"`
CreatedAt *time.Time `json:"createdAt"`
UpdatedAt *time.Time `json:"updatedAt"`
}
// All @TITLE 获取附注
func (a *annotations) All(ctx context.Context, purchaseId int64) (reply []AnnotationsItem, err error) {
xClient, err := client.GetClient(a)
if err != nil {
return
}
err = xClient.Call(ctx, "All", purchaseId, &reply)
return
}
type ArgsAnnotationsAdd struct {
PurchaseId int64 // 采购合同ID
AnnotationsAdd
}
type AnnotationsAdd struct {
Sort int64 // 排序
Value string // 内容
}
// Add @TITLE 添加附注
func (a *annotations) Add(ctx context.Context, args ArgsAnnotationsAdd) (err error) {
xClient, err := client.GetClient(a)
if err != nil {
return
}
reply := 0
return xClient.Call(ctx, "Add", args, &reply)
}
type ArgsAnnotationsEdit struct {
AnnotationsId int64 // 附注ID
AnnotationsAdd
}
// Edit @TITLE 编辑附注
func (a *annotations) Edit(ctx context.Context, args ArgsAnnotationsEdit) (err error) {
xClient, err := client.GetClient(a)
if err != nil {
return
}
reply := 0
return xClient.Call(ctx, "Edit", args, &reply)
}
// Delete @TITLE 删除附注
func (a *annotations) Delete(ctx context.Context, annotationsIds []int64) (err error) {
xClient, err := client.GetClient(a)
if err != nil {
return
}
reply := 0
return xClient.Call(ctx, "Delete", annotationsIds, &reply)
}

75
erp/purchase/clause.go Normal file
View File

@@ -0,0 +1,75 @@
package purchase
import (
"context"
"git.kumo.work/shama/service/client"
"time"
)
type clause struct {
}
type ClauseItem struct {
Id int64 `json:"id"`
Sort int64 `json:"sort"`
Key string `json:"key"`
Value string `json:"value"`
CreatedAt *time.Time `json:"createdAt"`
UpdatedAt *time.Time `json:"updatedAt"`
}
// All @TITLE 获取条款
func (c *clause) All(ctx context.Context, purchaseId int64) (reply []ClauseItem, err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
err = xClient.Call(ctx, "All", purchaseId, &reply)
return
}
type ArgsClauseAdd struct {
PurchaseId int64 // 采购合同ID
ClauseAdd
}
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)
}

76
erp/purchase/cost.go Normal file
View File

@@ -0,0 +1,76 @@
package purchase
import (
"context"
"git.kumo.work/shama/service/client"
"github.com/shopspring/decimal"
"time"
)
type cost struct {
}
type CostItem struct {
Id int64 `json:"id"`
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, purchaseId int64) (reply []CostItem, err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
err = xClient.Call(ctx, "All", purchaseId, &reply)
return
}
type ArgsCostAdd struct {
PurchaseId int64 // 采购合同ID
CostAdd
}
type CostAdd struct {
Name string // 费用名
Amount decimal.Decimal // 金额
Remarks string // 备注信息
}
// Add @TITLE 添加费用
func (c *cost) Add(ctx context.Context, args ArgsCostAdd) (err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
reply := 0
return xClient.Call(ctx, "Add", args, &reply)
}
type ArgsCostEdit struct {
CostId int64 // 费用ID
CostAdd
}
// Edit @TITLE 编辑费用
func (c *cost) Edit(ctx context.Context, args ArgsCostEdit) (err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
reply := 0
return xClient.Call(ctx, "Edit", args, &reply)
}
// Delete @TITLE 删除费用
func (c *cost) Delete(ctx context.Context, costIds []int64) (err error) {
xClient, err := client.GetClient(c)
if err != nil {
return
}
reply := 0
return xClient.Call(ctx, "Delete", costIds, &reply)
}

4
erp/purchase/product.go Normal file
View File

@@ -0,0 +1,4 @@
package purchase
type product struct {
}

8
erp/purchase/purchase.go Normal file
View File

@@ -0,0 +1,8 @@
package purchase
type Purchase struct {
Cost cost
Clause clause
Annotations annotations
Product product
}