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/purchase_wms_grpc.pb.go | 36 +++++++
proto/purchase_wms/purchase_wms.pb.go | 209 ++++++++++++++++++++++++++++++++++-------
proto/purchase_wms.proto | 11 ++
proto/purchase_wms/server.go | 28 +++++
4 files changed, 246 insertions(+), 38 deletions(-)
diff --git a/proto/purchase_wms.proto b/proto/purchase_wms.proto
index c344dfd..8ae8034 100644
--- a/proto/purchase_wms.proto
+++ b/proto/purchase_wms.proto
@@ -8,6 +8,7 @@
rpc GetSupplierListByProductId(GetSupplierListByProductIdRequest) returns (GetSupplierListByProductIdResponse) {}
rpc CreatePurchaseByWms(CreatePurchaseByWmsRequest) returns (CreatePurchaseByWmsResponse) {}
rpc GetPurchaseInfo(GetPurchaseInfoRequest) returns (GetPurchaseInfoResponse) {}
+ rpc ExistSupplier(ExistSupplierRequest) returns (ExistSupplierResponse) {}
}
//------------------------------------------PurchaseToWms--------------------------------
@@ -92,5 +93,15 @@
repeated PurchaseInfo Infos = 1;
}
+//--------------------------------------------------ExistSupplier---------------------------------------
+
+message ExistSupplierRequest {
+ repeated string ProductId = 1;
+}
+
+message ExistSupplierResponse {
+ bool Exist = 1;
+}
+
diff --git a/proto/purchase_wms/purchase_wms.pb.go b/proto/purchase_wms/purchase_wms.pb.go
index 5af5073..054124e 100644
--- a/proto/purchase_wms/purchase_wms.pb.go
+++ b/proto/purchase_wms/purchase_wms.pb.go
@@ -791,6 +791,100 @@
return nil
}
+type ExistSupplierRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ ProductId []string `protobuf:"bytes,1,rep,name=ProductId,proto3" json:"ProductId,omitempty"`
+}
+
+func (x *ExistSupplierRequest) Reset() {
+ *x = ExistSupplierRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_purchase_wms_proto_msgTypes[13]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *ExistSupplierRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ExistSupplierRequest) ProtoMessage() {}
+
+func (x *ExistSupplierRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_purchase_wms_proto_msgTypes[13]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ExistSupplierRequest.ProtoReflect.Descriptor instead.
+func (*ExistSupplierRequest) Descriptor() ([]byte, []int) {
+ return file_purchase_wms_proto_rawDescGZIP(), []int{13}
+}
+
+func (x *ExistSupplierRequest) GetProductId() []string {
+ if x != nil {
+ return x.ProductId
+ }
+ return nil
+}
+
+type ExistSupplierResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Exist bool `protobuf:"varint,1,opt,name=Exist,proto3" json:"Exist,omitempty"`
+}
+
+func (x *ExistSupplierResponse) Reset() {
+ *x = ExistSupplierResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_purchase_wms_proto_msgTypes[14]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *ExistSupplierResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ExistSupplierResponse) ProtoMessage() {}
+
+func (x *ExistSupplierResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_purchase_wms_proto_msgTypes[14]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ExistSupplierResponse.ProtoReflect.Descriptor instead.
+func (*ExistSupplierResponse) Descriptor() ([]byte, []int) {
+ return file_purchase_wms_proto_rawDescGZIP(), []int{14}
+}
+
+func (x *ExistSupplierResponse) GetExist() bool {
+ if x != nil {
+ return x.Exist
+ }
+ return false
+}
+
var File_purchase_wms_proto protoreflect.FileDescriptor
var file_purchase_wms_proto_rawDesc = []byte{
@@ -876,35 +970,46 @@
0x68, 0x61, 0x73, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x12, 0x23, 0x0a, 0x05, 0x49, 0x6e, 0x66, 0x6f, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32,
0x0d, 0x2e, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05,
- 0x49, 0x6e, 0x66, 0x6f, 0x73, 0x32, 0xad, 0x03, 0x0a, 0x0f, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61,
- 0x73, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3e, 0x0a, 0x0d, 0x50, 0x75, 0x72,
- 0x63, 0x68, 0x61, 0x73, 0x65, 0x54, 0x6f, 0x57, 0x6d, 0x73, 0x12, 0x15, 0x2e, 0x50, 0x75, 0x72,
- 0x63, 0x68, 0x61, 0x73, 0x65, 0x54, 0x6f, 0x57, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
- 0x74, 0x1a, 0x16, 0x2e, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x54, 0x6f, 0x57, 0x6d,
- 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x55, 0x0a, 0x14, 0x55, 0x70, 0x64,
- 0x61, 0x74, 0x65, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75,
- 0x73, 0x12, 0x1c, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61,
- 0x73, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
- 0x1d, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65,
- 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00,
- 0x12, 0x67, 0x0a, 0x1a, 0x47, 0x65, 0x74, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x4c,
- 0x69, 0x73, 0x74, 0x42, 0x79, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x64, 0x12, 0x22,
- 0x2e, 0x47, 0x65, 0x74, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74,
- 0x42, 0x79, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65,
- 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72,
- 0x4c, 0x69, 0x73, 0x74, 0x42, 0x79, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x64, 0x52,
- 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x52, 0x0a, 0x13, 0x43, 0x72, 0x65,
- 0x61, 0x74, 0x65, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x42, 0x79, 0x57, 0x6d, 0x73,
- 0x12, 0x1b, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73,
- 0x65, 0x42, 0x79, 0x57, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e,
- 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x42, 0x79,
- 0x57, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x46, 0x0a,
- 0x0f, 0x47, 0x65, 0x74, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x49, 0x6e, 0x66, 0x6f,
- 0x12, 0x17, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x49, 0x6e,
- 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x47, 0x65, 0x74, 0x50,
- 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f,
- 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x10, 0x5a, 0x0e, 0x2e, 0x2f, 0x70, 0x75, 0x72, 0x63, 0x68,
- 0x61, 0x73, 0x65, 0x5f, 0x77, 0x6d, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+ 0x49, 0x6e, 0x66, 0x6f, 0x73, 0x22, 0x34, 0x0a, 0x14, 0x45, 0x78, 0x69, 0x73, 0x74, 0x53, 0x75,
+ 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1c, 0x0a,
+ 0x09, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09,
+ 0x52, 0x09, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x64, 0x22, 0x2d, 0x0a, 0x15, 0x45,
+ 0x78, 0x69, 0x73, 0x74, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70,
+ 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x45, 0x78, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20,
+ 0x01, 0x28, 0x08, 0x52, 0x05, 0x45, 0x78, 0x69, 0x73, 0x74, 0x32, 0xef, 0x03, 0x0a, 0x0f, 0x50,
+ 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x3e,
+ 0x0a, 0x0d, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x54, 0x6f, 0x57, 0x6d, 0x73, 0x12,
+ 0x15, 0x2e, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x54, 0x6f, 0x57, 0x6d, 0x73, 0x52,
+ 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73,
+ 0x65, 0x54, 0x6f, 0x57, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x55,
+ 0x0a, 0x14, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65,
+ 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1c, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50,
+ 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71,
+ 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x75, 0x72,
+ 0x63, 0x68, 0x61, 0x73, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f,
+ 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x67, 0x0a, 0x1a, 0x47, 0x65, 0x74, 0x53, 0x75, 0x70, 0x70,
+ 0x6c, 0x69, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x79, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63,
+ 0x74, 0x49, 0x64, 0x12, 0x22, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65,
+ 0x72, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x79, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x64,
+ 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x75, 0x70,
+ 0x70, 0x6c, 0x69, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x42, 0x79, 0x50, 0x72, 0x6f, 0x64, 0x75,
+ 0x63, 0x74, 0x49, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x52,
+ 0x0a, 0x13, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65,
+ 0x42, 0x79, 0x57, 0x6d, 0x73, 0x12, 0x1b, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x75,
+ 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x42, 0x79, 0x57, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65,
+ 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x75, 0x72, 0x63, 0x68,
+ 0x61, 0x73, 0x65, 0x42, 0x79, 0x57, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
+ 0x22, 0x00, 0x12, 0x46, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73,
+ 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x17, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x75, 0x72, 0x63, 0x68,
+ 0x61, 0x73, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18,
+ 0x2e, 0x47, 0x65, 0x74, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x49, 0x6e, 0x66, 0x6f,
+ 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x40, 0x0a, 0x0d, 0x45, 0x78,
+ 0x69, 0x73, 0x74, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x12, 0x15, 0x2e, 0x45, 0x78,
+ 0x69, 0x73, 0x74, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65,
+ 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x45, 0x78, 0x69, 0x73, 0x74, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69,
+ 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x10, 0x5a, 0x0e,
+ 0x2e, 0x2f, 0x70, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x5f, 0x77, 0x6d, 0x73, 0x62, 0x06,
+ 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@@ -919,7 +1024,7 @@
return file_purchase_wms_proto_rawDescData
}
-var file_purchase_wms_proto_msgTypes = make([]protoimpl.MessageInfo, 13)
+var file_purchase_wms_proto_msgTypes = make([]protoimpl.MessageInfo, 15)
var file_purchase_wms_proto_goTypes = []interface{}{
(*PurchaseProduct)(nil), // 0: PurchaseProduct
(*PurchaseToWmsRequest)(nil), // 1: PurchaseToWmsRequest
@@ -934,6 +1039,8 @@
(*GetPurchaseInfoRequest)(nil), // 10: GetPurchaseInfoRequest
(*PurchaseInfo)(nil), // 11: PurchaseInfo
(*GetPurchaseInfoResponse)(nil), // 12: GetPurchaseInfoResponse
+ (*ExistSupplierRequest)(nil), // 13: ExistSupplierRequest
+ (*ExistSupplierResponse)(nil), // 14: ExistSupplierResponse
}
var file_purchase_wms_proto_depIdxs = []int32{
0, // 0: PurchaseToWmsRequest.Product:type_name -> PurchaseProduct
@@ -944,13 +1051,15 @@
5, // 5: PurchaseService.GetSupplierListByProductId:input_type -> GetSupplierListByProductIdRequest
8, // 6: PurchaseService.CreatePurchaseByWms:input_type -> CreatePurchaseByWmsRequest
10, // 7: PurchaseService.GetPurchaseInfo:input_type -> GetPurchaseInfoRequest
- 2, // 8: PurchaseService.PurchaseToWms:output_type -> PurchaseToWmsResponse
- 4, // 9: PurchaseService.UpdatePurchaseStatus:output_type -> UpdatePurchaseStatusResponse
- 7, // 10: PurchaseService.GetSupplierListByProductId:output_type -> GetSupplierListByProductIdResponse
- 9, // 11: PurchaseService.CreatePurchaseByWms:output_type -> CreatePurchaseByWmsResponse
- 12, // 12: PurchaseService.GetPurchaseInfo:output_type -> GetPurchaseInfoResponse
- 8, // [8:13] is the sub-list for method output_type
- 3, // [3:8] is the sub-list for method input_type
+ 13, // 8: PurchaseService.ExistSupplier:input_type -> ExistSupplierRequest
+ 2, // 9: PurchaseService.PurchaseToWms:output_type -> PurchaseToWmsResponse
+ 4, // 10: PurchaseService.UpdatePurchaseStatus:output_type -> UpdatePurchaseStatusResponse
+ 7, // 11: PurchaseService.GetSupplierListByProductId:output_type -> GetSupplierListByProductIdResponse
+ 9, // 12: PurchaseService.CreatePurchaseByWms:output_type -> CreatePurchaseByWmsResponse
+ 12, // 13: PurchaseService.GetPurchaseInfo:output_type -> GetPurchaseInfoResponse
+ 14, // 14: PurchaseService.ExistSupplier:output_type -> ExistSupplierResponse
+ 9, // [9:15] is the sub-list for method output_type
+ 3, // [3:9] is the sub-list for method input_type
3, // [3:3] is the sub-list for extension type_name
3, // [3:3] is the sub-list for extension extendee
0, // [0:3] is the sub-list for field type_name
@@ -1118,6 +1227,30 @@
return nil
}
}
+ file_purchase_wms_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*ExistSupplierRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_purchase_wms_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*ExistSupplierResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
}
type x struct{}
out := protoimpl.TypeBuilder{
@@ -1125,7 +1258,7 @@
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_purchase_wms_proto_rawDesc,
NumEnums: 0,
- NumMessages: 13,
+ NumMessages: 15,
NumExtensions: 0,
NumServices: 1,
},
diff --git a/proto/purchase_wms/purchase_wms_grpc.pb.go b/proto/purchase_wms/purchase_wms_grpc.pb.go
index dcc5c68..cc71d37 100644
--- a/proto/purchase_wms/purchase_wms_grpc.pb.go
+++ b/proto/purchase_wms/purchase_wms_grpc.pb.go
@@ -23,6 +23,7 @@
GetSupplierListByProductId(ctx context.Context, in *GetSupplierListByProductIdRequest, opts ...grpc.CallOption) (*GetSupplierListByProductIdResponse, error)
CreatePurchaseByWms(ctx context.Context, in *CreatePurchaseByWmsRequest, opts ...grpc.CallOption) (*CreatePurchaseByWmsResponse, error)
GetPurchaseInfo(ctx context.Context, in *GetPurchaseInfoRequest, opts ...grpc.CallOption) (*GetPurchaseInfoResponse, error)
+ ExistSupplier(ctx context.Context, in *ExistSupplierRequest, opts ...grpc.CallOption) (*ExistSupplierResponse, error)
}
type purchaseServiceClient struct {
@@ -78,6 +79,15 @@
return out, nil
}
+func (c *purchaseServiceClient) ExistSupplier(ctx context.Context, in *ExistSupplierRequest, opts ...grpc.CallOption) (*ExistSupplierResponse, error) {
+ out := new(ExistSupplierResponse)
+ err := c.cc.Invoke(ctx, "/PurchaseService/ExistSupplier", in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
// PurchaseServiceServer is the server API for PurchaseService service.
// All implementations must embed UnimplementedPurchaseServiceServer
// for forward compatibility
@@ -87,6 +97,7 @@
GetSupplierListByProductId(context.Context, *GetSupplierListByProductIdRequest) (*GetSupplierListByProductIdResponse, error)
CreatePurchaseByWms(context.Context, *CreatePurchaseByWmsRequest) (*CreatePurchaseByWmsResponse, error)
GetPurchaseInfo(context.Context, *GetPurchaseInfoRequest) (*GetPurchaseInfoResponse, error)
+ ExistSupplier(context.Context, *ExistSupplierRequest) (*ExistSupplierResponse, error)
mustEmbedUnimplementedPurchaseServiceServer()
}
@@ -108,6 +119,9 @@
}
func (UnimplementedPurchaseServiceServer) GetPurchaseInfo(context.Context, *GetPurchaseInfoRequest) (*GetPurchaseInfoResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetPurchaseInfo not implemented")
+}
+func (UnimplementedPurchaseServiceServer) ExistSupplier(context.Context, *ExistSupplierRequest) (*ExistSupplierResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method ExistSupplier not implemented")
}
func (UnimplementedPurchaseServiceServer) mustEmbedUnimplementedPurchaseServiceServer() {}
@@ -212,6 +226,24 @@
return interceptor(ctx, in, info, handler)
}
+func _PurchaseService_ExistSupplier_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(ExistSupplierRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(PurchaseServiceServer).ExistSupplier(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: "/PurchaseService/ExistSupplier",
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(PurchaseServiceServer).ExistSupplier(ctx, req.(*ExistSupplierRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
// PurchaseService_ServiceDesc is the grpc.ServiceDesc for PurchaseService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
@@ -239,6 +271,10 @@
MethodName: "GetPurchaseInfo",
Handler: _PurchaseService_GetPurchaseInfo_Handler,
},
+ {
+ MethodName: "ExistSupplier",
+ Handler: _PurchaseService_ExistSupplier_Handler,
+ },
},
Streams: []grpc.StreamDesc{},
Metadata: "purchase_wms.proto",
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