* feat: support product yarn batches * feat: improve product yarn ratio workflow * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
40 lines
996 B
Go
40 lines
996 B
Go
package yarn
|
|
|
|
import (
|
|
"context"
|
|
|
|
"muyu-apiserver/gateway/internal/svc"
|
|
"muyu-apiserver/gateway/internal/types"
|
|
"muyu-apiserver/rpc/inventory/pb"
|
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
)
|
|
|
|
type ListYarnLogic struct {
|
|
logx.Logger
|
|
ctx context.Context
|
|
svcCtx *svc.ServiceContext
|
|
}
|
|
|
|
func NewListYarnLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ListYarnLogic {
|
|
return &ListYarnLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx}
|
|
}
|
|
|
|
func (l *ListYarnLogic) ListYarn(req *types.ListYarnReq) (*types.ListYarnResp, error) {
|
|
resp, err := l.svcCtx.InventoryRpc.ListYarn(l.ctx, &pb.ListYarnReq{
|
|
Page: req.Page,
|
|
PageSize: req.PageSize,
|
|
YarnName: req.YarnName,
|
|
SupplierId: req.SupplierId,
|
|
Status: req.Status,
|
|
})
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
list := make([]types.YarnInfo, 0, len(resp.List))
|
|
for _, item := range resp.List {
|
|
list = append(list, yarnInfoFromPB(item))
|
|
}
|
|
return &types.ListYarnResp{Total: resp.Total, List: list}, nil
|
|
}
|