service/erp/product/quote.go

93 lines
2.6 KiB
Go
Raw Normal View History

2024-07-16 17:18:31 +08:00
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
}