* 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>
38 lines
911 B
Go
38 lines
911 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 CreateYarnLogic struct {
|
|
logx.Logger
|
|
ctx context.Context
|
|
svcCtx *svc.ServiceContext
|
|
}
|
|
|
|
func NewCreateYarnLogic(ctx context.Context, svcCtx *svc.ServiceContext) *CreateYarnLogic {
|
|
return &CreateYarnLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx}
|
|
}
|
|
|
|
func (l *CreateYarnLogic) CreateYarn(req *types.CreateYarnReq) (*types.IdResp, error) {
|
|
resp, err := l.svcCtx.InventoryRpc.CreateYarn(l.ctx, &pb.CreateYarnReq{
|
|
YarnName: req.YarnName,
|
|
Color: req.Color,
|
|
WeightGM: req.WeightGM,
|
|
SupplierId: req.SupplierId,
|
|
DyeFactory: req.DyeFactory,
|
|
ImageUrl: req.ImageUrl,
|
|
Remark: req.Remark,
|
|
})
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &types.IdResp{Id: resp.Id}, nil
|
|
}
|