* 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>
42 lines
1009 B
Go
42 lines
1009 B
Go
package yarn
|
|
|
|
import (
|
|
"context"
|
|
|
|
"muyu-apiserver/gateway/internal/svc"
|
|
"muyu-apiserver/gateway/internal/types"
|
|
"muyu-apiserver/pkg/ctxdata"
|
|
"muyu-apiserver/rpc/inventory/pb"
|
|
|
|
"github.com/zeromicro/go-zero/core/logx"
|
|
)
|
|
|
|
type UpdateYarnLogic struct {
|
|
logx.Logger
|
|
ctx context.Context
|
|
svcCtx *svc.ServiceContext
|
|
}
|
|
|
|
func NewUpdateYarnLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UpdateYarnLogic {
|
|
return &UpdateYarnLogic{Logger: logx.WithContext(ctx), ctx: ctx, svcCtx: svcCtx}
|
|
}
|
|
|
|
func (l *UpdateYarnLogic) UpdateYarn(req *types.UpdateYarnReq) (*types.IdResp, error) {
|
|
id := ctxdata.GetPathId(l.ctx)
|
|
_, err := l.svcCtx.InventoryRpc.UpdateYarn(l.ctx, &pb.UpdateYarnReq{
|
|
YarnId: id,
|
|
YarnName: req.YarnName,
|
|
Color: req.Color,
|
|
WeightGM: req.WeightGM,
|
|
SupplierId: req.SupplierId,
|
|
DyeFactory: req.DyeFactory,
|
|
ImageUrl: req.ImageUrl,
|
|
Remark: req.Remark,
|
|
Status: req.Status,
|
|
})
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &types.IdResp{Id: id}, nil
|
|
}
|