This commit is contained in:
2024-08-08 10:50:16 +08:00
parent 81ffde828c
commit d2303e1658
8 changed files with 298 additions and 16 deletions

View File

@@ -4,6 +4,7 @@ import (
"context"
"git.kumo.work/shama/service/client"
purchase2 "git.kumo.work/shama/service/erp/purchase"
"git.kumo.work/shama/service/lib/bean"
"github.com/shopspring/decimal"
"time"
)
@@ -11,6 +12,50 @@ import (
type purchase struct {
purchase2.Purchase
}
type ArgsPurchaseList struct {
Page bean.Page
Search PurchaseSearch
}
type PurchaseSearch struct {
PiSerial string // 采购合同编号
PoSerial string // po
CustomShortName string // 客户简称
CreatedStaffIds []int64 // 创建人筛选
FactoryName string // 采购工厂
}
type ReplyPurchaseList struct {
List []PurchaseItem `json:"list"`
Total int64 `json:"total"`
}
type PurchaseItem struct {
Id int64 `json:"id"`
SaleId int64 `json:"saleId"`
PiSerial string `json:"piSerial"`
PoSerial string `json:"poSerial"`
CustomName string `json:"customName"`
CustomShortName string `json:"customShortName"`
DeliveryDate *time.Time `json:"deliveryDate"`
DeliveryDateEnd *time.Time `json:"deliveryDateEnd"`
OrderDate time.Time `json:"orderDate"`
CreatedStaffId int64 `json:"createdStaffId"`
WorkflowId int64 `json:"workflowId"`
WorkflowStatus int64 `json:"workflowStatus"`
FactoryName string `json:"factoryName"`
FactoryId int64 `json:"factoryId"`
CreatedAt *time.Time `json:"createdAt"`
UpdatedAt *time.Time `json:"updatedAt"`
}
// List @TITLE 采购合同列表
func (p *purchase) List(ctx context.Context, args ArgsPurchaseList) (reply ReplyPurchaseList, err error) {
xClient, err := client.GetClient(p)
if err != nil {
return
}
err = xClient.Call(ctx, "List", args, &reply)
return
}
type ArgsPurchaseAdd struct {
SaleId int64 // 销售合同
Products []PurchaseProduct
@@ -38,11 +83,51 @@ func (p *purchase) Add(ctx context.Context, args ArgsPurchaseAdd) (err error) {
return
}
type ReplyPurchaseInfo struct {
PurchaseId int64 `json:"purchaseId"`
FactoryId int64 `json:"factoryId"`
FactoryName string `json:"factoryName"`
FactoryAddress string `json:"factoryAddress"`
FactoryContact string `json:"factoryContact"`
FactoryPhone string `json:"factoryPhone"`
FactoryFax string `json:"factoryFax"`
DeliveryDate *time.Time `json:"deliveryDate"`
DeliveryDateEnd *time.Time `json:"deliveryDateEnd"`
DeliveryPlace string `json:"deliveryPlace"`
AdvancePayment *decimal.Decimal `json:"advancePayment"`
PoSerial string `json:"poSerial"`
PiSerial string `json:"piSerial"`
WorkflowId int64 `json:"workflowId"`
WorkflowStatus int64 `json:"workflowStatus"`
WorkflowReason string `json:"workflowReason"`
OrderDate time.Time `json:"orderDate"`
CustomShortName string `json:"customShortName"`
OurCompany string `json:"ourCompany"`
CreatedStaffId int64 `json:"createdStaffId"`
FrontMark string `json:"frontMark"`
SideMark string `json:"sideMark"`
InnerBoxText string `json:"innerBoxText"`
Remarks string `json:"remarks"`
CreatedAt *time.Time `json:"createdAt"`
UpdatedAt *time.Time `json:"updatedAt"`
}
// Info @TITLE 采购合同详情
func (p *purchase) Info(ctx context.Context, purchaseId int64) (reply ReplyPurchaseInfo, err error) {
xClient, err := client.GetClient(p)
if err != nil {
return
}
err = xClient.Call(ctx, "Info", purchaseId, &reply)
return
}
type ArgsPurchaseEdit struct {
PurchaseId int64 // 采购合同id
Po string // po
OrderDate *time.Time // 下单日期
FactoryAddress string // 工厂地址
FactoryContact string // 工厂联系人
FactoryPhone string // 工厂电话
FactoryFax string // 工厂传真
DeliveryDate *time.Time // 采购交期