You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
service/supplier/supplier.go

185 lines
4.6 KiB

package supplier
import (
"context"
"git.oa00.com/supply-chain/service/client"
"git.oa00.com/supply-chain/service/lib/bean"
"git.oa00.com/supply-chain/service/supplier/batch"
"github.com/shopspring/decimal"
)
type Supplier struct {
2 years ago
Goods goods
Apply supplierApply
2 years ago
supplier
2 years ago
WarnLiaison warnLiaison
WalletApply supplierWalletApply
LogisticsCompany logisticsCompany
ReturnAddress returnAddress
2 years ago
Afs afs
2 years ago
AfsAudit afsAudit
BatchGoods batch.Goods
2 years ago
}
type supplier struct {
}
type ArgsSupplierAdd struct {
SupplierName string // 供应商名称
Account string // 账户
Password string // 密码
PayType uint // 结算类型
Liaison string // 联系人
Phone string // 手机号
Annex string // 附件
ApplyUserId uint // 申请人Id
}
// Add @Title 添加供应商
2 years ago
func (s *supplier) Add(ctx context.Context, args ArgsSupplierAdd) error {
xClient, err := client.GetClient(s)
if err != nil {
return err
}
reply := 0
return xClient.Call(ctx, "Add", args, &reply)
}
type SupplierSearch struct {
SupplierName string
Status uint
}
type ArgsSupplierLists struct {
Search SupplierSearch
Page bean.Page
}
type ReplySupplierLists struct {
Lists []SupplierItem
Total int64
}
type SupplierItem struct {
2 years ago
Id uint
SupplierName string // 供应商名称
Status uint // 状态
Prepayment decimal.Decimal // 预付款余额
WarnStatus uint // 预警状态
ApplyUserId uint // 创建人Id
CreatedAt int64 // 创建时间
}
// Lists @Title 供应商列表
func (s *supplier) Lists(ctx context.Context, args ArgsSupplierLists) (reply ReplySupplierLists, err error) {
xClient, err := client.GetClient(s)
if err != nil {
return ReplySupplierLists{}, err
}
err = xClient.Call(ctx, "Lists", args, &reply)
return
}
// Enabled @Title 启用供应商
func (s *supplier) Enabled(ctx context.Context, supplierId uint) error {
xClient, err := client.GetClient(s)
if err != nil {
return err
}
reply := 0
return xClient.Call(ctx, "Enabled", supplierId, &reply)
}
// Disabled @Title 启用供应商
func (s *supplier) Disabled(ctx context.Context, supplierId uint) error {
xClient, err := client.GetClient(s)
if err != nil {
return err
}
reply := 0
return xClient.Call(ctx, "Disabled", supplierId, &reply)
}
type ReplySupplierInfo struct {
2 years ago
SupplierId uint
SupplierName string // 供应商名称
Account string // 账户名
PayType uint // 结算方式
Liaison string // 联系人
Phone string // 手机号
Annex string // 附件
WarnStatus uint // 预警状态
WarnValue decimal.Decimal // 预警值
}
// Info @Title 供应商详情
func (s *supplier) Info(ctx context.Context, supplierId uint) (reply ReplySupplierInfo, err error) {
xClient, err := client.GetClient(s)
if err != nil {
return ReplySupplierInfo{}, err
}
err = xClient.Call(ctx, "Info", supplierId, &reply)
return
}
2 years ago
// InfoByBatchOrderSn @Title 通过订单获取供应商信息
func (s *supplier) InfoByBatchOrderSn(ctx context.Context, batchOrderSn string) (reply ReplySupplierInfo, err error) {
xClient, err := client.GetClient(s)
if err != nil {
return ReplySupplierInfo{}, err
}
err = xClient.Call(ctx, "InfoByBatchOrderSn", batchOrderSn, &reply)
return
}
type ArgsSupplierEdit struct {
SupplierId uint
SupplierName string // 供应商名称
Password string // 密码
PayType uint // 结算方式
Liaison string // 联系然
Phone string // 手机号
Annex string // 附件
}
// Edit @Title 供应商详情
func (s *supplier) Edit(ctx context.Context, args ArgsSupplierEdit) error {
xClient, err := client.GetClient(s)
if err != nil {
return err
}
reply := 0
return xClient.Call(ctx, "Edit", args, &reply)
}
type ArgsSupplierUpdateWarn struct {
SupplierId uint
WarnStatus uint // 预警状态 1=开启 2=关闭
Value decimal.Decimal // 预警值
}
// UpdateWarn @Title 开启预警
func (s *supplier) UpdateWarn(ctx context.Context, args ArgsSupplierUpdateWarn) error {
xClient, err := client.GetClient(s)
if err != nil {
return err
}
reply := 0
return xClient.Call(ctx, "UpdateWarn", args, &reply)
}
2 years ago
type ReplySupplierItem struct {
Id uint `json:"id"`
Name string `json:"name"`
}
// Select @Title 筛选非禁用的供应商
2 years ago
func (s *supplier) Select(ctx context.Context, status uint) (reply []ReplySupplierItem, err error) {
2 years ago
xClient, err := client.GetClient(s)
if err != nil {
return nil, err
}
err = xClient.Call(ctx, "Select", status, &reply)
return
}