service/erp/purchase.go
2024-08-01 14:51:51 +08:00

68 lines
2.0 KiB
Go

package erp
import (
"context"
"git.kumo.work/shama/service/client"
purchase2 "git.kumo.work/shama/service/erp/purchase"
"github.com/shopspring/decimal"
"time"
)
type purchase struct {
purchase2.Purchase
}
type ArgsPurchaseAdd struct {
SaleId int64 // 销售合同
Products []PurchaseProduct
}
type PurchaseProduct struct {
SaleProductId int64 // 销售合同产品id
FactoryId int64 // 采购工厂id
Num int64 // 采购数量
Price decimal.Decimal // 采购单价
Currency string // 币种
CurrencyName string // 币种名称
CurrencySymbol string // 币种符号
CurrencyRate decimal.Decimal // 币种汇率
MeasureUnit string // 数量单位
}
// Add @TITLE 添加采购合同
func (p *purchase) Add(ctx context.Context, args ArgsPurchaseAdd) (err error) {
xClient, err := client.GetClient(p)
if err != nil {
return
}
reply := 0
err = xClient.Call(ctx, "Add", args, &reply)
return
}
type ArgsPurchaseEdit struct {
PurchaseId int64 // 采购合同id
Po string // po
OrderDate *time.Time // 下单日期
FactoryAddress string // 工厂地址
FactoryPhone string // 工厂电话
FactoryFax string // 工厂传真
DeliveryDate *time.Time // 采购交期
DeliveryDateEnd *time.Time // 采购交期结束
DeliveryPlace string // 交货地点
AdvancePayment *decimal.Decimal // 预付款货
FrontMark string // 正面唛头
SideMark string // 侧面唛头
InnerBoxText string // 内盒文字
Remarks string // 合同备注
}
// Edit @TITLE 编辑采购合同
func (p *purchase) Edit(ctx context.Context, args ArgsPurchaseEdit) (err error) {
xClient, err := client.GetClient(p)
if err != nil {
return
}
reply := 0
err = xClient.Call(ctx, "Edit", args, &reply)
return
}