From 4c182b863d4766bae67ef421f097af8f97626774 Mon Sep 17 00:00:00 2001
From: liujiandao <274878379@qq.com>
Date: 星期二, 21 十一月 2023 14:48:43 +0800
Subject: [PATCH] aps插入与查看采购单
---
api/v1/purchase/purchase.go | 2
proto/purchase_wms/purchase_wms_grpc.pb.go | 36 ++++
proto/purchase_wms/purchase_wms.pb.go | 358 +++++++++++++++++++++++++++++++++++++------
config.yaml | 2
proto/purchase_wms.proto | 22 ++
proto/purchase_wms/server.go | 40 ++++
6 files changed, 400 insertions(+), 60 deletions(-)
diff --git a/api/v1/purchase/purchase.go b/api/v1/purchase/purchase.go
index 975babc..bd0a9d1 100644
--- a/api/v1/purchase/purchase.go
+++ b/api/v1/purchase/purchase.go
@@ -195,7 +195,7 @@
// @Security ApiKeyAuth
// @accept application/json
// @Produce application/json
-// @Param data query request.PageInfo true "椤电爜, 姣忛〉澶у皬"
+// @Param data query purchaserequest.PurchaseSearch true "鍙傛暟"
// @Success 200 {object} response.Response{data=response.PageResult,msg=string} "鍒嗛〉鑾峰彇閲囪喘鍗曞垪琛�,杩斿洖鍖呮嫭鍒楄〃,鎬绘暟,椤电爜,姣忛〉鏁伴噺"
// @Router /purchase/purchaseList [get]
func (e *PurchaseApi) GetPurchaseList(c *gin.Context) {
diff --git a/config.yaml b/config.yaml
index cf7226f..1476dbe 100644
--- a/config.yaml
+++ b/config.yaml
@@ -50,7 +50,7 @@
grpc-port: "9093"
grpc-url: 192.168.20.119:9091
grpc-admin-url: 192.168.20.119:50051
- grpc-wms-url: 192.168.20.118:8006
+ grpc-wms-url: 192.168.20.119:8006
tencent-cos:
bucket: xxxxx-10005608
region: ap-shanghai
diff --git a/proto/purchase_wms.proto b/proto/purchase_wms.proto
index 1e8a838..213f11b 100644
--- a/proto/purchase_wms.proto
+++ b/proto/purchase_wms.proto
@@ -7,6 +7,7 @@
rpc UpdatePurchaseStatus(UpdatePurchaseStatusRequest) returns (UpdatePurchaseStatusResponse) {}
rpc GetSupplierListByProductId(GetSupplierListByProductIdRequest) returns (GetSupplierListByProductIdResponse) {}
rpc CreatePurchaseByWms(CreatePurchaseByWmsRequest) returns (CreatePurchaseByWmsResponse) {}
+ rpc GetPurchaseInfo(GetPurchaseInfoRequest) returns (GetPurchaseInfoResponse) {}
}
//------------------------------------------PurchaseToWms--------------------------------
@@ -62,6 +63,7 @@
int64 SupplierId = 1;
string ProductId = 2;
int64 Amount = 3;
+ string Source = 4;
}
message CreatePurchaseByWmsResponse {
@@ -70,3 +72,23 @@
string PurchaseNumber = 3;
}
+//-------------------------------------------------------GetPurchaseInfo---------------------------------------
+
+message GetPurchaseInfoRequest {
+ repeated string PurchaseNumbers = 1;
+}
+
+message PurchaseInfo {
+ string purchaseNumber = 1;
+ string purchaseName = 2;
+ string supplierName = 3;
+ int64 amount = 4;
+ int64 status = 5;
+}
+
+message GetPurchaseInfoResponse {
+ repeated PurchaseInfo Infos = 1;
+}
+
+
+
diff --git a/proto/purchase_wms/purchase_wms.pb.go b/proto/purchase_wms/purchase_wms.pb.go
index e60e691..432d96e 100644
--- a/proto/purchase_wms/purchase_wms.pb.go
+++ b/proto/purchase_wms/purchase_wms.pb.go
@@ -476,6 +476,7 @@
SupplierId int64 `protobuf:"varint,1,opt,name=SupplierId,proto3" json:"SupplierId,omitempty"`
ProductId string `protobuf:"bytes,2,opt,name=ProductId,proto3" json:"ProductId,omitempty"`
Amount int64 `protobuf:"varint,3,opt,name=Amount,proto3" json:"Amount,omitempty"`
+ Source string `protobuf:"bytes,4,opt,name=Source,proto3" json:"Source,omitempty"`
}
func (x *CreatePurchaseByWmsRequest) Reset() {
@@ -529,6 +530,13 @@
return x.Amount
}
return 0
+}
+
+func (x *CreatePurchaseByWmsRequest) GetSource() string {
+ if x != nil {
+ return x.Source
+ }
+ return ""
}
type CreatePurchaseByWmsResponse struct {
@@ -594,6 +602,179 @@
return ""
}
+type GetPurchaseInfoRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ PurchaseNumbers []string `protobuf:"bytes,1,rep,name=PurchaseNumbers,proto3" json:"PurchaseNumbers,omitempty"`
+}
+
+func (x *GetPurchaseInfoRequest) Reset() {
+ *x = GetPurchaseInfoRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_purchase_wms_proto_msgTypes[10]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GetPurchaseInfoRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GetPurchaseInfoRequest) ProtoMessage() {}
+
+func (x *GetPurchaseInfoRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_purchase_wms_proto_msgTypes[10]
+ 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 GetPurchaseInfoRequest.ProtoReflect.Descriptor instead.
+func (*GetPurchaseInfoRequest) Descriptor() ([]byte, []int) {
+ return file_purchase_wms_proto_rawDescGZIP(), []int{10}
+}
+
+func (x *GetPurchaseInfoRequest) GetPurchaseNumbers() []string {
+ if x != nil {
+ return x.PurchaseNumbers
+ }
+ return nil
+}
+
+type PurchaseInfo struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ PurchaseNumber string `protobuf:"bytes,1,opt,name=purchaseNumber,proto3" json:"purchaseNumber,omitempty"`
+ PurchaseName string `protobuf:"bytes,2,opt,name=purchaseName,proto3" json:"purchaseName,omitempty"`
+ SupplierName string `protobuf:"bytes,3,opt,name=supplierName,proto3" json:"supplierName,omitempty"`
+ Amount int64 `protobuf:"varint,4,opt,name=amount,proto3" json:"amount,omitempty"`
+ Status int64 `protobuf:"varint,5,opt,name=status,proto3" json:"status,omitempty"`
+}
+
+func (x *PurchaseInfo) Reset() {
+ *x = PurchaseInfo{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_purchase_wms_proto_msgTypes[11]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *PurchaseInfo) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*PurchaseInfo) ProtoMessage() {}
+
+func (x *PurchaseInfo) ProtoReflect() protoreflect.Message {
+ mi := &file_purchase_wms_proto_msgTypes[11]
+ 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 PurchaseInfo.ProtoReflect.Descriptor instead.
+func (*PurchaseInfo) Descriptor() ([]byte, []int) {
+ return file_purchase_wms_proto_rawDescGZIP(), []int{11}
+}
+
+func (x *PurchaseInfo) GetPurchaseNumber() string {
+ if x != nil {
+ return x.PurchaseNumber
+ }
+ return ""
+}
+
+func (x *PurchaseInfo) GetPurchaseName() string {
+ if x != nil {
+ return x.PurchaseName
+ }
+ return ""
+}
+
+func (x *PurchaseInfo) GetSupplierName() string {
+ if x != nil {
+ return x.SupplierName
+ }
+ return ""
+}
+
+func (x *PurchaseInfo) GetAmount() int64 {
+ if x != nil {
+ return x.Amount
+ }
+ return 0
+}
+
+func (x *PurchaseInfo) GetStatus() int64 {
+ if x != nil {
+ return x.Status
+ }
+ return 0
+}
+
+type GetPurchaseInfoResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Infos []*PurchaseInfo `protobuf:"bytes,1,rep,name=Infos,proto3" json:"Infos,omitempty"`
+}
+
+func (x *GetPurchaseInfoResponse) Reset() {
+ *x = GetPurchaseInfoResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_purchase_wms_proto_msgTypes[12]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *GetPurchaseInfoResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*GetPurchaseInfoResponse) ProtoMessage() {}
+
+func (x *GetPurchaseInfoResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_purchase_wms_proto_msgTypes[12]
+ 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 GetPurchaseInfoResponse.ProtoReflect.Descriptor instead.
+func (*GetPurchaseInfoResponse) Descriptor() ([]byte, []int) {
+ return file_purchase_wms_proto_rawDescGZIP(), []int{12}
+}
+
+func (x *GetPurchaseInfoResponse) GetInfos() []*PurchaseInfo {
+ if x != nil {
+ return x.Infos
+ }
+ return nil
+}
+
var File_purchase_wms_proto protoreflect.FileDescriptor
var file_purchase_wms_proto_rawDesc = []byte{
@@ -641,45 +822,70 @@
0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x21, 0x0a, 0x04,
0x4c, 0x69, 0x73, 0x74, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x53, 0x75, 0x70,
0x70, 0x6c, 0x69, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x22,
- 0x72, 0x0a, 0x1a, 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, 0x12, 0x1e, 0x0a,
- 0x0a, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
- 0x03, 0x52, 0x0a, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1c, 0x0a,
- 0x09, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
- 0x52, 0x09, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x41,
- 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x41, 0x6d, 0x6f,
- 0x75, 0x6e, 0x74, 0x22, 0x6b, 0x0a, 0x1b, 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, 0x12, 0x12, 0x0a, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05,
- 0x52, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x18, 0x02, 0x20,
- 0x01, 0x28, 0x09, 0x52, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x26, 0x0a, 0x0e, 0x50, 0x75, 0x72, 0x63,
- 0x68, 0x61, 0x73, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
- 0x52, 0x0e, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72,
- 0x32, 0xe5, 0x02, 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,
+ 0x8a, 0x01, 0x0a, 0x1a, 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, 0x12, 0x1e,
+ 0x0a, 0x0a, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01,
+ 0x28, 0x03, 0x52, 0x0a, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x49, 0x64, 0x12, 0x1c,
+ 0x0a, 0x09, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28,
+ 0x09, 0x52, 0x09, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06,
+ 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x41, 0x6d,
+ 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x04,
+ 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x22, 0x6b, 0x0a, 0x1b,
+ 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, 0x12, 0x12, 0x0a, 0x04, 0x43,
+ 0x6f, 0x64, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x43, 0x6f, 0x64, 0x65, 0x12,
+ 0x10, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x4d, 0x73,
+ 0x67, 0x12, 0x26, 0x0a, 0x0e, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x4e, 0x75, 0x6d,
+ 0x62, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x50, 0x75, 0x72, 0x63, 0x68,
+ 0x61, 0x73, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0x42, 0x0a, 0x16, 0x47, 0x65, 0x74,
+ 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75,
+ 0x65, 0x73, 0x74, 0x12, 0x28, 0x0a, 0x0f, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x4e,
+ 0x75, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x50, 0x75,
+ 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x73, 0x22, 0xae, 0x01,
+ 0x0a, 0x0c, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x26,
+ 0x0a, 0x0e, 0x70, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72,
+ 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x70, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65,
+ 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x22, 0x0a, 0x0c, 0x70, 0x75, 0x72, 0x63, 0x68, 0x61,
+ 0x73, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x70, 0x75,
+ 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x73, 0x75,
+ 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
+ 0x52, 0x0c, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x16,
+ 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06,
+ 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73,
+ 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x3e,
+ 0x0a, 0x17, 0x47, 0x65, 0x74, 0x50, 0x75, 0x72, 0x63, 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, 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, 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,
+ 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,
}
var (
@@ -694,7 +900,7 @@
return file_purchase_wms_proto_rawDescData
}
-var file_purchase_wms_proto_msgTypes = make([]protoimpl.MessageInfo, 10)
+var file_purchase_wms_proto_msgTypes = make([]protoimpl.MessageInfo, 13)
var file_purchase_wms_proto_goTypes = []interface{}{
(*PurchaseProduct)(nil), // 0: PurchaseProduct
(*PurchaseToWmsRequest)(nil), // 1: PurchaseToWmsRequest
@@ -706,23 +912,29 @@
(*GetSupplierListByProductIdResponse)(nil), // 7: GetSupplierListByProductIdResponse
(*CreatePurchaseByWmsRequest)(nil), // 8: CreatePurchaseByWmsRequest
(*CreatePurchaseByWmsResponse)(nil), // 9: CreatePurchaseByWmsResponse
+ (*GetPurchaseInfoRequest)(nil), // 10: GetPurchaseInfoRequest
+ (*PurchaseInfo)(nil), // 11: PurchaseInfo
+ (*GetPurchaseInfoResponse)(nil), // 12: GetPurchaseInfoResponse
}
var file_purchase_wms_proto_depIdxs = []int32{
- 0, // 0: PurchaseToWmsRequest.Product:type_name -> PurchaseProduct
- 6, // 1: GetSupplierListByProductIdResponse.List:type_name -> SupplierList
- 1, // 2: PurchaseService.PurchaseToWms:input_type -> PurchaseToWmsRequest
- 3, // 3: PurchaseService.UpdatePurchaseStatus:input_type -> UpdatePurchaseStatusRequest
- 5, // 4: PurchaseService.GetSupplierListByProductId:input_type -> GetSupplierListByProductIdRequest
- 8, // 5: PurchaseService.CreatePurchaseByWms:input_type -> CreatePurchaseByWmsRequest
- 2, // 6: PurchaseService.PurchaseToWms:output_type -> PurchaseToWmsResponse
- 4, // 7: PurchaseService.UpdatePurchaseStatus:output_type -> UpdatePurchaseStatusResponse
- 7, // 8: PurchaseService.GetSupplierListByProductId:output_type -> GetSupplierListByProductIdResponse
- 9, // 9: PurchaseService.CreatePurchaseByWms:output_type -> CreatePurchaseByWmsResponse
- 6, // [6:10] is the sub-list for method output_type
- 2, // [2:6] is the sub-list for method input_type
- 2, // [2:2] is the sub-list for extension type_name
- 2, // [2:2] is the sub-list for extension extendee
- 0, // [0:2] is the sub-list for field type_name
+ 0, // 0: PurchaseToWmsRequest.Product:type_name -> PurchaseProduct
+ 6, // 1: GetSupplierListByProductIdResponse.List:type_name -> SupplierList
+ 11, // 2: GetPurchaseInfoResponse.Infos:type_name -> PurchaseInfo
+ 1, // 3: PurchaseService.PurchaseToWms:input_type -> PurchaseToWmsRequest
+ 3, // 4: PurchaseService.UpdatePurchaseStatus:input_type -> UpdatePurchaseStatusRequest
+ 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
+ 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
}
func init() { file_purchase_wms_proto_init() }
@@ -851,6 +1063,42 @@
return nil
}
}
+ file_purchase_wms_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*GetPurchaseInfoRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_purchase_wms_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*PurchaseInfo); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_purchase_wms_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*GetPurchaseInfoResponse); 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{
@@ -858,7 +1106,7 @@
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_purchase_wms_proto_rawDesc,
NumEnums: 0,
- NumMessages: 10,
+ NumMessages: 13,
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 bab2cda..dcc5c68 100644
--- a/proto/purchase_wms/purchase_wms_grpc.pb.go
+++ b/proto/purchase_wms/purchase_wms_grpc.pb.go
@@ -22,6 +22,7 @@
UpdatePurchaseStatus(ctx context.Context, in *UpdatePurchaseStatusRequest, opts ...grpc.CallOption) (*UpdatePurchaseStatusResponse, error)
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)
}
type purchaseServiceClient struct {
@@ -68,6 +69,15 @@
return out, nil
}
+func (c *purchaseServiceClient) GetPurchaseInfo(ctx context.Context, in *GetPurchaseInfoRequest, opts ...grpc.CallOption) (*GetPurchaseInfoResponse, error) {
+ out := new(GetPurchaseInfoResponse)
+ err := c.cc.Invoke(ctx, "/PurchaseService/GetPurchaseInfo", 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
@@ -76,6 +86,7 @@
UpdatePurchaseStatus(context.Context, *UpdatePurchaseStatusRequest) (*UpdatePurchaseStatusResponse, error)
GetSupplierListByProductId(context.Context, *GetSupplierListByProductIdRequest) (*GetSupplierListByProductIdResponse, error)
CreatePurchaseByWms(context.Context, *CreatePurchaseByWmsRequest) (*CreatePurchaseByWmsResponse, error)
+ GetPurchaseInfo(context.Context, *GetPurchaseInfoRequest) (*GetPurchaseInfoResponse, error)
mustEmbedUnimplementedPurchaseServiceServer()
}
@@ -94,6 +105,9 @@
}
func (UnimplementedPurchaseServiceServer) CreatePurchaseByWms(context.Context, *CreatePurchaseByWmsRequest) (*CreatePurchaseByWmsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CreatePurchaseByWms not implemented")
+}
+func (UnimplementedPurchaseServiceServer) GetPurchaseInfo(context.Context, *GetPurchaseInfoRequest) (*GetPurchaseInfoResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method GetPurchaseInfo not implemented")
}
func (UnimplementedPurchaseServiceServer) mustEmbedUnimplementedPurchaseServiceServer() {}
@@ -180,6 +194,24 @@
return interceptor(ctx, in, info, handler)
}
+func _PurchaseService_GetPurchaseInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(GetPurchaseInfoRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(PurchaseServiceServer).GetPurchaseInfo(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: "/PurchaseService/GetPurchaseInfo",
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(PurchaseServiceServer).GetPurchaseInfo(ctx, req.(*GetPurchaseInfoRequest))
+ }
+ 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)
@@ -203,6 +235,10 @@
MethodName: "CreatePurchaseByWms",
Handler: _PurchaseService_CreatePurchaseByWms_Handler,
},
+ {
+ MethodName: "GetPurchaseInfo",
+ Handler: _PurchaseService_GetPurchaseInfo_Handler,
+ },
},
Streams: []grpc.StreamDesc{},
Metadata: "purchase_wms.proto",
diff --git a/proto/purchase_wms/server.go b/proto/purchase_wms/server.go
index 1e1e099..235def6 100644
--- a/proto/purchase_wms/server.go
+++ b/proto/purchase_wms/server.go
@@ -69,8 +69,14 @@
var purchaseRecord purchase.Purchase
purchaseRecord.PurchaseTypeId = int(pt.ID)
purchaseRecord.SupplierId = int(req.SupplierId)
- purchaseRecord.OrderSource = "WMS鎺ㄩ��"
- purchaseRecord.Name = "WMS琛ヨ揣"
+ if req.Source == "WMS" {
+ purchaseRecord.OrderSource = "WMS鎺ㄩ��"
+ purchaseRecord.Name = "WMS琛ヨ揣"
+ } else if req.Source == "APS" {
+ purchaseRecord.OrderSource = "APS鎺ㄩ��"
+ purchaseRecord.Name = "APS閲囪喘"
+ }
+
purchaseRecord.ID = 0
purchaseRecord.Status = purchase.OrderStatusConfirmed
purchaseRecord.HandledBy = "admin"
@@ -89,7 +95,11 @@
pp.Amount = purchaseRecord.Quantity
pp.Price = decimal.NewFromFloat(product.PurchasePrice)
pp.Total = purchaseRecord.TotalPrice
- pp.Remark = "WMS琛ヨ揣"
+ if req.Source == "WMS" {
+ pp.Remark = "WMS琛ヨ揣"
+ } else if req.Source == "APS" {
+ pp.Remark = "APS閲囪喘"
+ }
err = global.GVA_DB.Transaction(func(tx *gorm.DB) error {
err = tx.Create(&purchaseRecord).Error
@@ -106,3 +116,27 @@
resp.PurchaseNumber = purchaseRecord.Number
return resp, nil
}
+
+func (s *Server) GetPurchaseInfo(ctx context.Context, req *GetPurchaseInfoRequest) (*GetPurchaseInfoResponse, error) {
+ if len(req.PurchaseNumbers) == 0 {
+ return nil, errors.New("閲囪喘鍗曠紪鐮佷笉鑳戒负绌�")
+ }
+ var ps []purchase.Purchase
+ err := global.GVA_DB.Model(&purchase.Purchase{}).Where("number in (?)", req.PurchaseNumbers).Preload("Supplier").Find(&ps).Error
+ if err != nil {
+ return nil, err
+ }
+ infos := make([]*PurchaseInfo, 0)
+ for _, p := range ps {
+ var info PurchaseInfo
+ info.PurchaseNumber = p.Number
+ info.PurchaseName = p.Name
+ info.SupplierName = p.Supplier.Name
+ info.Amount = p.Quantity.IntPart()
+ info.Status = int64(p.Status)
+ infos = append(infos, &info)
+ }
+ resp := new(GetPurchaseInfoResponse)
+ resp.Infos = infos
+ return resp, nil
+}
--
Gitblit v1.8.0