更新
This commit is contained in:
75
erp/product/category.go
Normal file
75
erp/product/category.go
Normal file
@@ -0,0 +1,75 @@
|
||||
package product
|
||||
|
||||
import (
|
||||
"context"
|
||||
"git.kumo.work/shama/service/client"
|
||||
"time"
|
||||
)
|
||||
|
||||
type category struct {
|
||||
}
|
||||
type CategoryItem struct {
|
||||
Id int64 `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Sort int64 `json:"sort"`
|
||||
ParentId int64 `json:"parentId"`
|
||||
CreatedAt *time.Time `json:"createdAt"`
|
||||
UpdatedAt *time.Time `json:"updatedAt"`
|
||||
Children []*CategoryItem `json:"children"`
|
||||
}
|
||||
type ArgsCategoryAll struct {
|
||||
}
|
||||
|
||||
// All @TITLE 全部分类
|
||||
func (c *category) All(ctx context.Context, args ArgsCategoryAll) (reply []CategoryItem, err error) {
|
||||
xClient, err := client.GetClient(c)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = xClient.Call(ctx, "All", args, &reply)
|
||||
return
|
||||
}
|
||||
|
||||
type ArgsCategoryAdd struct {
|
||||
Name string // 分类名称
|
||||
Sort int64 // 排序
|
||||
ParentId int64 // 父级分类
|
||||
}
|
||||
|
||||
// Add @TITLE 添加分类
|
||||
func (c *category) Add(ctx context.Context, args ArgsCategoryAdd) (err error) {
|
||||
xClient, err := client.GetClient(c)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
reply := 0
|
||||
err = xClient.Call(ctx, "Add", args, &reply)
|
||||
return
|
||||
}
|
||||
|
||||
type ArgsCategoryEdit struct {
|
||||
CategoryId int64 // 分类id
|
||||
ArgsCategoryAdd
|
||||
}
|
||||
|
||||
// Edit @TITLE 编辑分类
|
||||
func (c *category) Edit(ctx context.Context, args ArgsCategoryEdit) (err error) {
|
||||
xClient, err := client.GetClient(c)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
reply := 0
|
||||
err = xClient.Call(ctx, "Edit", args, &reply)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete @TITLE 删除分类
|
||||
func (c *category) Delete(ctx context.Context, categoryIds []int64) (err error) {
|
||||
xClient, err := client.GetClient(c)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
reply := 0
|
||||
err = xClient.Call(ctx, "Delete", categoryIds, &reply)
|
||||
return
|
||||
}
|
||||
5
erp/product/product.go
Normal file
5
erp/product/product.go
Normal file
@@ -0,0 +1,5 @@
|
||||
package product
|
||||
|
||||
type Product struct {
|
||||
Category category
|
||||
}
|
||||
92
erp/product/quote.go
Normal file
92
erp/product/quote.go
Normal file
@@ -0,0 +1,92 @@
|
||||
package product
|
||||
|
||||
import (
|
||||
"context"
|
||||
"git.kumo.work/shama/service/client"
|
||||
"github.com/shopspring/decimal"
|
||||
"time"
|
||||
)
|
||||
|
||||
type quote struct {
|
||||
}
|
||||
type QuoteItem struct {
|
||||
Id int64 `json:"id"`
|
||||
ProductId int64 `json:"productId"`
|
||||
FactoryId int64 `json:"factoryId"`
|
||||
FactoryName string `json:"factoryName"`
|
||||
FactorySerial string `json:"factorySerial"`
|
||||
Price *decimal.Decimal `json:"price"`
|
||||
StartNum *int64 `json:"startNum"`
|
||||
MeasureUnit string `json:"measureUnit"`
|
||||
Currency string `json:"currency"`
|
||||
CurrencyName string `json:"currencyName"`
|
||||
CurrencySymbol string `json:"currencySymbol"`
|
||||
CurrencyRate *decimal.Decimal `json:"currencyRate"`
|
||||
CreatedAt *time.Time `json:"createdAt"`
|
||||
UpdatedAt *time.Time `json:"updatedAt"`
|
||||
}
|
||||
type ArgsQuoteAll struct {
|
||||
}
|
||||
|
||||
// All @TITLE 全部工厂报价
|
||||
func (c *quote) All(ctx context.Context, args ArgsQuoteAll) (reply []QuoteItem, err error) {
|
||||
xClient, err := client.GetClient(c)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
err = xClient.Call(ctx, "All", args, &reply)
|
||||
return
|
||||
}
|
||||
|
||||
type ArgsQuoteAdd struct {
|
||||
Id int64 // 工厂报价id
|
||||
ProductId int64 // 产品id
|
||||
FactorySerial string // 工厂货号
|
||||
FactoryId int64 // 工厂id
|
||||
Price *decimal.Decimal // 采购单价
|
||||
StartNum *int64 // 起订量
|
||||
MeasureUnit string // 数量单位
|
||||
Currency string // 币种
|
||||
CurrencyName string // 币种名称
|
||||
CurrencySymbol string // 币种符号
|
||||
CurrencyRate *decimal.Decimal // 币种汇率
|
||||
MainFlag int64 // 主联系人标记(1=是,2=不是)
|
||||
}
|
||||
|
||||
// Add @TITLE 添加工厂报价
|
||||
func (c *quote) Add(ctx context.Context, args ArgsQuoteAdd) (err error) {
|
||||
xClient, err := client.GetClient(c)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
reply := 0
|
||||
err = xClient.Call(ctx, "Add", args, &reply)
|
||||
return
|
||||
}
|
||||
|
||||
type ArgsQuoteEdit struct {
|
||||
QuoteId int64 // 工厂报价id
|
||||
ArgsQuoteAdd
|
||||
}
|
||||
|
||||
// Edit @TITLE 编辑工厂报价
|
||||
func (c *quote) Edit(ctx context.Context, args ArgsQuoteEdit) (err error) {
|
||||
xClient, err := client.GetClient(c)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
reply := 0
|
||||
err = xClient.Call(ctx, "Edit", args, &reply)
|
||||
return
|
||||
}
|
||||
|
||||
// Delete @TITLE 删除工厂报价
|
||||
func (c *quote) Delete(ctx context.Context, quoteIds []int64) (err error) {
|
||||
xClient, err := client.GetClient(c)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
reply := 0
|
||||
err = xClient.Call(ctx, "Delete", quoteIds, &reply)
|
||||
return
|
||||
}
|
||||
Reference in New Issue
Block a user