From f8199011df53b4d88ce1268e8e1ff4196a9ef127 Mon Sep 17 00:00:00 2001 From: liujiandao <274878379@qq.com> Date: 星期四, 28 十二月 2023 14:57:00 +0800 Subject: [PATCH] 查看物料有没有供应商 --- proto/purchase_wms/server.go | 28 ++++++++++++++++++++++++++++ 1 files changed, 28 insertions(+), 0 deletions(-) diff --git a/proto/purchase_wms/server.go b/proto/purchase_wms/server.go index 24fa4d3..2fc6d26 100644 --- a/proto/purchase_wms/server.go +++ b/proto/purchase_wms/server.go @@ -160,3 +160,31 @@ resp.Infos = infos return resp, nil } + +func (s *Server) ExistSupplier(ctx context.Context, req *ExistSupplierRequest) (*ExistSupplierResponse, error) { + resp := new(ExistSupplierResponse) + if len(req.ProductId) == 0 { + resp.Exist = false + return resp, nil + } + var products []test.SupplierMaterial + err := global.GVA_DB.Model(&test.SupplierMaterial{}).Where("number in (?)", req.ProductId).Find(&products).Error + if err != nil { + return nil, err + } + for _, number := range req.ProductId { + exit := false + for _, product := range products { + if number == product.Number && product.SupplierId > 0 { + exit = true + break + } + } + if !exit { + resp.Exist = exit + return resp, nil + } + } + resp.Exist = true + return resp, nil +} -- Gitblit v1.8.0