批发商品库列表

finance
黄伟 2 years ago
parent cb2acd7cfe
commit 5a225deaba

@ -0,0 +1,200 @@
package batch
import (
"git.oa00.com/supply-chain/service/client"
"git.oa00.com/supply-chain/service/lib/bean"
"github.com/shopspring/decimal"
"golang.org/x/net/context"
)
type Goods struct {
goods
}
type goods struct {
}
type GoodsSearch struct {
Name string // 商品名称
CategoryIds []uint // 类目id
BrandName string // 品牌名
UpcCode string // 商品条码
Handle uint // 处理状态 1=待处理 2=入库 3=废弃
SkuId uint // 供应商skuId
MinSupplyPrice decimal.Decimal // 最小采购价
MaxSupplyPrice decimal.Decimal // 最大采购价
}
type ArgsGoodsList struct {
Search GoodsSearch
Page bean.Page
}
type GoodsItem struct {
Id uint `json:"id"`
Name string `json:"name"`
Img string `json:"img"`
GoodsNum string `json:"goodsNum"`
CategoryId uint `json:"categoryId"`
BrandId uint `json:"brandId"`
BrandName string `json:"brandName"`
SkuItems []GoodsItemLists `json:"skuItems"`
UpcCodes []string `json:"upcCodes"`
StockCount uint `json:"stockCount"`
GuidePrices []decimal.Decimal `json:"guidePrices"`
SupplyPrices []decimal.Decimal `json:"supplyPrices"`
Status uint `json:"status"`
CreatedAt int64 `json:"createdAt"`
}
type GoodsItemLists struct {
Id uint `json:"id"`
Specifications []SkuSpecificationItem `json:"specifications"`
Stock uint `json:"stock"`
SupplyPrice decimal.Decimal `json:"supplyPrice"`
GoodsId uint `json:"goodsId"`
Img string `json:"img"`
UpcCode string `json:"upcCode"`
}
type GoodsSpecificationItem struct {
Name string `json:"name"`
Values []string `json:"values"`
}
type SkuSpecificationItem struct {
Name string `json:"name"`
Value string `json:"value"`
}
type ReplyGoodsLists struct {
List []GoodsItem `json:"list"`
Total int64 `json:"total"`
}
// Lists @Title 获取商品列表
func (g *goods) Lists(ctx context.Context, args ArgsGoodsList) (reply ReplyGoodsLists, err error) {
xClient, err := client.GetClient(g)
if err != nil {
return
}
err = xClient.Call(ctx, "Lists", args, &reply)
return
}
type ArgsGoodsInfo struct {
SkuId uint
}
type ReplyGoodsInfo struct {
Id uint `json:"id"`
Name string `json:"name"`
SupplierId uint `json:"supplierId"`
SupplierName string `json:"supplierName"`
CategoryId uint `json:"categoryId"`
BrandId uint `json:"brandId"`
Imgs []string `json:"imgs"`
Content string `json:"content"`
Attributes []GoodsAttributeItem `json:"attributes"`
Skus []SkuItem `json:"skus"`
Status uint `json:"status"`
}
type GoodsAttributeItem struct {
Name string `json:"name"`
Value string `json:"value"`
GroupName string `json:"groupName"`
}
type SkuSpecItem struct {
Name string `json:"name"`
Value string `json:"value"`
}
type SkuItem struct {
SkuId uint `json:"skuId"`
Color string `json:"color"`
Size string `json:"size"`
SupplyPrice decimal.Decimal `json:"supplyPrice"`
MarketPrice decimal.Decimal `json:"marketPrice"`
UpcCode string `json:"upcCode"`
UnitId uint `json:"uintId"`
TaxCategoryId uint `json:"taxCategoryId"`
TaxName string `json:"taxName"`
TaxCode string `json:"taxCode"`
Unit string `json:"uint"`
Tax decimal.Decimal `json:"tax"`
Img string `json:"img"`
}
// Info @Title 商品详情
func (g *goods) Info(ctx context.Context, goodsId uint) (reply ReplyGoodsInfo, err error) {
xClient, err := client.GetClient(g)
if err != nil {
return
}
err = xClient.Call(ctx, "Info", goodsId, &reply)
return
}
// GetImgs @Title 获取商品主图
func (g *goods) GetImgs(ctx context.Context, goodsId uint) (reply []string, err error) {
xClient, err := client.GetClient(g)
if err != nil {
return
}
err = xClient.Call(ctx, "GetImgs", goodsId, &reply)
return
}
type AdoptItem struct {
Id uint `json:"id"`
Name string `json:"name"`
Error string `json:"error"`
}
// Adopt @Title 批量入库
func (g *goods) Adopt(ctx context.Context, goodsIds []uint) (reply []AdoptItem, err error) {
xClient, err := client.GetClient(g)
if err != nil {
return
}
err = xClient.Call(ctx, "Adopt", goodsIds, &reply)
return
}
// Discard @Title 批量废弃
func (g *goods) Discard(ctx context.Context, goodsIds []uint) (err error) {
xClient, err := client.GetClient(g)
if err != nil {
return
}
reply := 0
err = xClient.Call(ctx, "Discard", goodsIds, &reply)
return
}
// ReHandle @Title 重新处理商品
func (g *goods) ReHandle(ctx context.Context, goodsIds []uint) (reply []AdoptItem, err error) {
xClient, err := client.GetClient(g)
if err != nil {
return nil, err
}
err = xClient.Call(ctx, "ReHandle", goodsIds, &reply)
return
}
type ReplyByIdItem struct {
SkuId uint `json:"skuId"`
SupplierId uint `json:"supplierIds"`
SupplierName string `json:"supplierName"`
}
// FindBySkuIds @Title 根据商品Ids获取商品信息
func (g *goods) FindBySkuIds(ctx context.Context, skuIds []uint) (reply []ReplyByIdItem, err error) {
xClient, err := client.GetClient(g)
if err != nil {
return nil, err
}
err = xClient.Call(ctx, "FindBySkuIds", skuIds, &reply)
return
}

@ -4,6 +4,7 @@ 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"
)
@ -16,6 +17,7 @@ type Supplier struct {
LogisticsCompany logisticsCompany
ReturnAddress returnAddress
Afs afs
BatchGoods batch.Goods
}
type supplier struct {

Loading…
Cancel
Save