|
|
|
package supply
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"database/sql"
|
|
|
|
"git.oa00.com/supply-chain/service/client"
|
|
|
|
"git.oa00.com/supply-chain/service/lib/bean"
|
|
|
|
"github.com/shopspring/decimal"
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
|
|
|
type skuAudit struct {
|
|
|
|
}
|
|
|
|
|
|
|
|
type ArgsSkuAuditLists struct {
|
|
|
|
Search SkuAuditSearch
|
|
|
|
Page bean.Page
|
|
|
|
}
|
|
|
|
|
|
|
|
type SkuAuditSearch struct {
|
|
|
|
SourceId uint // 供应商id
|
|
|
|
AdjustType uint // 加价类型
|
|
|
|
Status uint // 状态 1=未审核 2=通过 3=驳回
|
|
|
|
}
|
|
|
|
type SkuAndAuditItem struct {
|
|
|
|
AuditId uint `json:"auditId"`
|
|
|
|
SkuId uint `json:"skuId"`
|
|
|
|
AfterAdjustType uint `json:"afterAdjustType"`
|
|
|
|
AfterAdjustPrice decimal.Decimal `json:"afterAdjustPrice"`
|
|
|
|
Name string `json:"name"`
|
|
|
|
SupplyPrice decimal.Decimal `json:"supplyPrice"`
|
|
|
|
GuidePrice decimal.Decimal `json:"guidePrice"`
|
|
|
|
AdjustType uint `json:"adjustType"`
|
|
|
|
AdjustPrice decimal.Decimal `json:"adjustPrice"`
|
|
|
|
CustomerPrice decimal.Decimal `json:"customerPrice"`
|
|
|
|
Category string `json:"category"`
|
|
|
|
BrandName string `json:"brandName"`
|
|
|
|
SourceName string `json:"sourceName"`
|
|
|
|
AuditUserId uint `json:"auditUserId"`
|
|
|
|
AuditAt sql.NullTime `json:"auditAt"`
|
|
|
|
ImgUrl string `json:"imgUrl"`
|
|
|
|
Reason string `json:"reason"`
|
|
|
|
FirstCategoryName string `json:"firstCategoryName"`
|
|
|
|
SecondCategoryName string `json:"secondCategoryName"`
|
|
|
|
ThirdCategoryName string `json:"thirdCategoryName"`
|
|
|
|
CreatedAt time.Time `json:"createdAt"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type ReplySkuAuditLists struct {
|
|
|
|
Lists []SkuAndAuditItem `json:"lists"`
|
|
|
|
Total int64 `json:"total"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// Lists @Title 审核列表
|
|
|
|
func (s *skuAudit) Lists(ctx context.Context, args ArgsSkuAuditLists) (reply ReplySkuAuditLists, err error) {
|
|
|
|
xClient, err := client.GetClient(s)
|
|
|
|
if err != nil {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
err = xClient.Call(ctx, "Lists", args, &reply)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
type ArgsSkuAuditAdopt struct {
|
|
|
|
AuditUserId uint // 审核人
|
|
|
|
AuditIds []uint // 审核单id
|
|
|
|
}
|
|
|
|
|
|
|
|
// Adopt @Title 通过
|
|
|
|
func (s *skuAudit) Adopt(ctx context.Context, args ArgsSkuAuditAdopt) error {
|
|
|
|
reply := 0
|
|
|
|
xClient, err := client.GetClient(s)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
return xClient.Call(ctx, "Adopt", args, &reply)
|
|
|
|
}
|
|
|
|
|
|
|
|
type ArgsSkuAuditReject struct {
|
|
|
|
AuditUserId uint // 审核人
|
|
|
|
AuditIds []uint // 审核单id
|
|
|
|
Reason string // 驳回原因
|
|
|
|
}
|
|
|
|
|
|
|
|
// Reject @Title 驳回
|
|
|
|
func (s *skuAudit) Reject(ctx context.Context, args ArgsSkuAuditReject) error {
|
|
|
|
reply := 0
|
|
|
|
xClient, err := client.GetClient(s)
|
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
return xClient.Call(ctx, "Reject", args, &reply)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Stock @Title 库存查询
|
|
|
|
func (s *skuAudit) Stock() {
|
|
|
|
|
|
|
|
}
|