From 1123e3f0584fb402300499aee42d45e2150138cc Mon Sep 17 00:00:00 2001 From: liujiandao <274878379@qq.com> Date: 星期一, 01 四月 2024 16:01:04 +0800 Subject: [PATCH] aps查询工单入库信息 --- proto/inventory_order/server.go | 27 +++ proto/inventory_order.proto | 22 ++ proto/inventory_order/inventory_order.pb.go | 346 +++++++++++++++++++++++++++++++++++++------ proto/inventory_order/inventory_order_grpc.pb.go | 36 ++++ models/operation.go | 37 +++- 5 files changed, 410 insertions(+), 58 deletions(-) diff --git a/models/operation.go b/models/operation.go index 1296457..bd56ea2 100644 --- a/models/operation.go +++ b/models/operation.go @@ -53,15 +53,16 @@ OperationSearch struct { Operation - Order string - PageNum int - PageSize int - Keyword string - Orm *gorm.DB - Preload bool - Disuse bool - Ids []int - Numbers []string + Order string + PageNum int + PageSize int + Keyword string + Orm *gorm.DB + Preload bool + Disuse bool + Ids []int + SourceNumbers []string + SalesDetailsNumbers []string } ) @@ -118,6 +119,11 @@ return slf } +func (slf *OperationSearch) SetSourceNumbers(numbers []string) *OperationSearch { + slf.SourceNumbers = numbers + return slf +} + func (slf *OperationSearch) SetDisuse(disuse bool) *OperationSearch { slf.Disuse = disuse return slf @@ -143,6 +149,11 @@ return slf } +func (slf *OperationSearch) SetSalesDetailsNumbers(salesDetailsNumbers []string) *OperationSearch { + slf.SalesDetailsNumbers = salesDetailsNumbers + return slf +} + func (slf *OperationSearch) SetOperationSource(operationSource constvar.OperationSource) *OperationSearch { slf.OperationSource = operationSource return slf @@ -164,6 +175,10 @@ if slf.SourceNumber != "" { db = db.Where("source_number = ?", slf.SourceNumber) + } + + if len(slf.SourceNumbers) > 0 { + db = db.Where("source_number in (?)", slf.SourceNumbers) } if slf.Number != "" { @@ -198,6 +213,10 @@ db = db.Where("sales_details_number = ?", slf.SalesDetailsNumber) } + if len(slf.SalesDetailsNumbers) > 0 { + db = db.Where("sales_details_number in (?)", slf.SalesDetailsNumbers) + } + if slf.OperationSource != 0 { db = db.Where("operation_source = ?", slf.OperationSource) } diff --git a/proto/inventory_order.proto b/proto/inventory_order.proto index ea16e88..8820551 100644 --- a/proto/inventory_order.proto +++ b/proto/inventory_order.proto @@ -10,6 +10,7 @@ rpc UpdateMaterialApplyStatus(UpdateMaterialApplyStatusRequest) returns(UpdateMaterialApplyStatusResponse) {} rpc GetWarehouseInfo(GetWarehouseInfoRequest) returns(GetWarehouseInfoResponse) {} rpc UpdateOutsourceOrder(UpdateOutsourceOrderRequest) returns(UpdateOutsourceOrderResponse) {} + rpc GetOperationInfo(GetOperationInfoRequest) returns(GetOperationInfoResponse) {} } message CreateNewOrderRequest{ @@ -86,4 +87,23 @@ repeated OperationProduct Products = 2; } -message UpdateOutsourceOrderResponse{} \ No newline at end of file +message UpdateOutsourceOrderResponse{} + +//-------------------------------------------------GetOperationInfo----------------------------------------- + +message GetOperationInfoRequest{ + repeated string SourceNumber = 1;//鏉ユ簮缂栫爜 + repeated string SalesDetailsNumber = 2;//閿�鍞槑缁嗙紪鐮� + int64 Status = 3;//鐘舵�� +} + +message GetOperationInfoResponse{ + repeated OperationInfo list = 1; +} + +message OperationInfo { + string SourceNumber = 1;//鏉ユ簮缂栫爜 + string SalesDetailsNumber = 2;//閿�鍞槑缁嗙紪鐮� + string ProductId = 3; + int64 Amount = 4; +} \ No newline at end of file diff --git a/proto/inventory_order/inventory_order.pb.go b/proto/inventory_order/inventory_order.pb.go index 56d02df..e7c37bd 100644 --- a/proto/inventory_order/inventory_order.pb.go +++ b/proto/inventory_order/inventory_order.pb.go @@ -780,6 +780,187 @@ return file_inventory_order_proto_rawDescGZIP(), []int{13} } +type GetOperationInfoRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SourceNumber []string `protobuf:"bytes,1,rep,name=SourceNumber,proto3" json:"SourceNumber,omitempty"` //鏉ユ簮缂栫爜 + SalesDetailsNumber []string `protobuf:"bytes,2,rep,name=SalesDetailsNumber,proto3" json:"SalesDetailsNumber,omitempty"` //閿�鍞槑缁嗙紪鐮� + Status int64 `protobuf:"varint,3,opt,name=Status,proto3" json:"Status,omitempty"` //鐘舵�� +} + +func (x *GetOperationInfoRequest) Reset() { + *x = GetOperationInfoRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_inventory_order_proto_msgTypes[14] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetOperationInfoRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetOperationInfoRequest) ProtoMessage() {} + +func (x *GetOperationInfoRequest) ProtoReflect() protoreflect.Message { + mi := &file_inventory_order_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 GetOperationInfoRequest.ProtoReflect.Descriptor instead. +func (*GetOperationInfoRequest) Descriptor() ([]byte, []int) { + return file_inventory_order_proto_rawDescGZIP(), []int{14} +} + +func (x *GetOperationInfoRequest) GetSourceNumber() []string { + if x != nil { + return x.SourceNumber + } + return nil +} + +func (x *GetOperationInfoRequest) GetSalesDetailsNumber() []string { + if x != nil { + return x.SalesDetailsNumber + } + return nil +} + +func (x *GetOperationInfoRequest) GetStatus() int64 { + if x != nil { + return x.Status + } + return 0 +} + +type GetOperationInfoResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + List []*OperationInfo `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"` +} + +func (x *GetOperationInfoResponse) Reset() { + *x = GetOperationInfoResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_inventory_order_proto_msgTypes[15] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetOperationInfoResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetOperationInfoResponse) ProtoMessage() {} + +func (x *GetOperationInfoResponse) ProtoReflect() protoreflect.Message { + mi := &file_inventory_order_proto_msgTypes[15] + 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 GetOperationInfoResponse.ProtoReflect.Descriptor instead. +func (*GetOperationInfoResponse) Descriptor() ([]byte, []int) { + return file_inventory_order_proto_rawDescGZIP(), []int{15} +} + +func (x *GetOperationInfoResponse) GetList() []*OperationInfo { + if x != nil { + return x.List + } + return nil +} + +type OperationInfo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SourceNumber string `protobuf:"bytes,1,opt,name=SourceNumber,proto3" json:"SourceNumber,omitempty"` //鏉ユ簮缂栫爜 + SalesDetailsNumber string `protobuf:"bytes,2,opt,name=SalesDetailsNumber,proto3" json:"SalesDetailsNumber,omitempty"` //閿�鍞槑缁嗙紪鐮� + ProductId string `protobuf:"bytes,3,opt,name=ProductId,proto3" json:"ProductId,omitempty"` + Amount int64 `protobuf:"varint,4,opt,name=Amount,proto3" json:"Amount,omitempty"` +} + +func (x *OperationInfo) Reset() { + *x = OperationInfo{} + if protoimpl.UnsafeEnabled { + mi := &file_inventory_order_proto_msgTypes[16] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *OperationInfo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OperationInfo) ProtoMessage() {} + +func (x *OperationInfo) ProtoReflect() protoreflect.Message { + mi := &file_inventory_order_proto_msgTypes[16] + 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 OperationInfo.ProtoReflect.Descriptor instead. +func (*OperationInfo) Descriptor() ([]byte, []int) { + return file_inventory_order_proto_rawDescGZIP(), []int{16} +} + +func (x *OperationInfo) GetSourceNumber() string { + if x != nil { + return x.SourceNumber + } + return "" +} + +func (x *OperationInfo) GetSalesDetailsNumber() string { + if x != nil { + return x.SalesDetailsNumber + } + return "" +} + +func (x *OperationInfo) GetProductId() string { + if x != nil { + return x.ProductId + } + return "" +} + +func (x *OperationInfo) GetAmount() int64 { + if x != nil { + return x.Amount + } + return 0 +} + var File_inventory_order_proto protoreflect.FileDescriptor var file_inventory_order_proto_rawDesc = []byte{ @@ -863,36 +1044,63 @@ 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x08, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x73, 0x22, 0x1e, 0x0a, 0x1c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x75, 0x74, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xb8, 0x03, 0x0a, 0x15, 0x69, 0x6e, 0x76, 0x65, 0x6e, - 0x74, 0x6f, 0x72, 0x79, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, - 0x12, 0x43, 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x77, 0x4f, 0x72, 0x64, - 0x65, 0x72, 0x12, 0x16, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x77, 0x4f, 0x72, - 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x43, 0x72, 0x65, - 0x61, 0x74, 0x65, 0x4e, 0x65, 0x77, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x52, 0x0a, 0x13, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, - 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x1b, 0x2e, 0x43, - 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4c, 0x69, - 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x43, 0x72, 0x65, 0x61, - 0x74, 0x65, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x64, 0x0a, 0x19, 0x55, 0x70, 0x64, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x85, 0x01, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x4f, 0x70, + 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x12, 0x22, 0x0a, 0x0c, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, + 0x65, 0x72, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, + 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x2e, 0x0a, 0x12, 0x53, 0x61, 0x6c, 0x65, 0x73, 0x44, + 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x03, + 0x28, 0x09, 0x52, 0x12, 0x53, 0x61, 0x6c, 0x65, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, + 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x3e, + 0x0a, 0x18, 0x47, 0x65, 0x74, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, + 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x22, 0x0a, 0x04, 0x6c, 0x69, + 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x22, 0x99, + 0x01, 0x0a, 0x0d, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, + 0x12, 0x22, 0x0a, 0x0c, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4e, 0x75, + 0x6d, 0x62, 0x65, 0x72, 0x12, 0x2e, 0x0a, 0x12, 0x53, 0x61, 0x6c, 0x65, 0x73, 0x44, 0x65, 0x74, + 0x61, 0x69, 0x6c, 0x73, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x12, 0x53, 0x61, 0x6c, 0x65, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x73, 0x4e, 0x75, + 0x6d, 0x62, 0x65, 0x72, 0x12, 0x1c, 0x0a, 0x09, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, + 0x64, 0x18, 0x03, 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, 0x04, 0x20, 0x01, + 0x28, 0x03, 0x52, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x32, 0x83, 0x04, 0x0a, 0x15, 0x69, + 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x53, 0x65, 0x72, + 0x76, 0x69, 0x63, 0x65, 0x12, 0x43, 0x0a, 0x0e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x65, + 0x77, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x12, 0x16, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, + 0x65, 0x77, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, + 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4e, 0x65, 0x77, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x52, 0x0a, 0x13, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, + 0x12, 0x1b, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4c, + 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x64, 0x0a, + 0x19, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x74, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x41, + 0x70, 0x70, 0x6c, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x21, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x74, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x41, 0x70, 0x70, 0x6c, 0x79, - 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x21, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, - 0x61, 0x74, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x53, 0x74, 0x61, 0x74, - 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x55, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x4d, 0x61, 0x74, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x53, - 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, - 0x49, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x57, 0x61, 0x72, 0x65, 0x68, 0x6f, 0x75, 0x73, 0x65, 0x49, - 0x6e, 0x66, 0x6f, 0x12, 0x18, 0x2e, 0x47, 0x65, 0x74, 0x57, 0x61, 0x72, 0x65, 0x68, 0x6f, 0x75, - 0x73, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, - 0x47, 0x65, 0x74, 0x57, 0x61, 0x72, 0x65, 0x68, 0x6f, 0x75, 0x73, 0x65, 0x49, 0x6e, 0x66, 0x6f, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x55, 0x0a, 0x14, 0x55, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x4f, 0x75, 0x74, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4f, 0x72, 0x64, - 0x65, 0x72, 0x12, 0x1c, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x75, 0x74, 0x73, 0x6f, - 0x75, 0x72, 0x63, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x1d, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x75, 0x74, 0x73, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x00, 0x42, 0x13, 0x5a, 0x11, 0x2e, 0x2f, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, - 0x5f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, + 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x74, 0x65, 0x72, 0x69, 0x61, 0x6c, 0x41, 0x70, + 0x70, 0x6c, 0x79, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x00, 0x12, 0x49, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x57, 0x61, 0x72, 0x65, 0x68, 0x6f, + 0x75, 0x73, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x18, 0x2e, 0x47, 0x65, 0x74, 0x57, 0x61, 0x72, + 0x65, 0x68, 0x6f, 0x75, 0x73, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x19, 0x2e, 0x47, 0x65, 0x74, 0x57, 0x61, 0x72, 0x65, 0x68, 0x6f, 0x75, 0x73, 0x65, + 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x55, + 0x0a, 0x14, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x75, 0x74, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x12, 0x1c, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, + 0x75, 0x74, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4f, 0x75, 0x74, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x49, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x4f, 0x70, 0x65, 0x72, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x18, 0x2e, 0x47, 0x65, 0x74, 0x4f, + 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x47, 0x65, 0x74, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, + 0x6f, 0x6e, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, + 0x42, 0x13, 0x5a, 0x11, 0x2e, 0x2f, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x5f, + 0x6f, 0x72, 0x64, 0x65, 0x72, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -907,7 +1115,7 @@ return file_inventory_order_proto_rawDescData } -var file_inventory_order_proto_msgTypes = make([]protoimpl.MessageInfo, 14) +var file_inventory_order_proto_msgTypes = make([]protoimpl.MessageInfo, 17) var file_inventory_order_proto_goTypes = []interface{}{ (*CreateNewOrderRequest)(nil), // 0: CreateNewOrderRequest (*CreateNewOrderResponse)(nil), // 1: CreateNewOrderResponse @@ -923,30 +1131,36 @@ (*GetWarehouseInfoResponse)(nil), // 11: GetWarehouseInfoResponse (*UpdateOutsourceOrderRequest)(nil), // 12: UpdateOutsourceOrderRequest (*UpdateOutsourceOrderResponse)(nil), // 13: UpdateOutsourceOrderResponse - (common.OperationSource)(0), // 14: OperationSource + (*GetOperationInfoRequest)(nil), // 14: GetOperationInfoRequest + (*GetOperationInfoResponse)(nil), // 15: GetOperationInfoResponse + (*OperationInfo)(nil), // 16: OperationInfo + (common.OperationSource)(0), // 17: OperationSource } var file_inventory_order_proto_depIdxs = []int32{ 2, // 0: OperationList.Products:type_name -> OperationProduct 3, // 1: CreateOperationListRequest.List:type_name -> OperationList - 14, // 2: CreateOperationListRequest.OperationSource:type_name -> OperationSource + 17, // 2: CreateOperationListRequest.OperationSource:type_name -> OperationSource 5, // 3: CreateOperationListResponse.List:type_name -> OperationResponse 10, // 4: GetWarehouseInfoResponse.List:type_name -> WarehouseInfo 2, // 5: UpdateOutsourceOrderRequest.Products:type_name -> OperationProduct - 0, // 6: inventoryOrderService.CreateNewOrder:input_type -> CreateNewOrderRequest - 4, // 7: inventoryOrderService.CreateOperationList:input_type -> CreateOperationListRequest - 7, // 8: inventoryOrderService.UpdateMaterialApplyStatus:input_type -> UpdateMaterialApplyStatusRequest - 9, // 9: inventoryOrderService.GetWarehouseInfo:input_type -> GetWarehouseInfoRequest - 12, // 10: inventoryOrderService.UpdateOutsourceOrder:input_type -> UpdateOutsourceOrderRequest - 1, // 11: inventoryOrderService.CreateNewOrder:output_type -> CreateNewOrderResponse - 6, // 12: inventoryOrderService.CreateOperationList:output_type -> CreateOperationListResponse - 8, // 13: inventoryOrderService.UpdateMaterialApplyStatus:output_type -> UpdateMaterialApplyStatusResponse - 11, // 14: inventoryOrderService.GetWarehouseInfo:output_type -> GetWarehouseInfoResponse - 13, // 15: inventoryOrderService.UpdateOutsourceOrder:output_type -> UpdateOutsourceOrderResponse - 11, // [11:16] is the sub-list for method output_type - 6, // [6:11] is the sub-list for method input_type - 6, // [6:6] is the sub-list for extension type_name - 6, // [6:6] is the sub-list for extension extendee - 0, // [0:6] is the sub-list for field type_name + 16, // 6: GetOperationInfoResponse.list:type_name -> OperationInfo + 0, // 7: inventoryOrderService.CreateNewOrder:input_type -> CreateNewOrderRequest + 4, // 8: inventoryOrderService.CreateOperationList:input_type -> CreateOperationListRequest + 7, // 9: inventoryOrderService.UpdateMaterialApplyStatus:input_type -> UpdateMaterialApplyStatusRequest + 9, // 10: inventoryOrderService.GetWarehouseInfo:input_type -> GetWarehouseInfoRequest + 12, // 11: inventoryOrderService.UpdateOutsourceOrder:input_type -> UpdateOutsourceOrderRequest + 14, // 12: inventoryOrderService.GetOperationInfo:input_type -> GetOperationInfoRequest + 1, // 13: inventoryOrderService.CreateNewOrder:output_type -> CreateNewOrderResponse + 6, // 14: inventoryOrderService.CreateOperationList:output_type -> CreateOperationListResponse + 8, // 15: inventoryOrderService.UpdateMaterialApplyStatus:output_type -> UpdateMaterialApplyStatusResponse + 11, // 16: inventoryOrderService.GetWarehouseInfo:output_type -> GetWarehouseInfoResponse + 13, // 17: inventoryOrderService.UpdateOutsourceOrder:output_type -> UpdateOutsourceOrderResponse + 15, // 18: inventoryOrderService.GetOperationInfo:output_type -> GetOperationInfoResponse + 13, // [13:19] is the sub-list for method output_type + 7, // [7:13] is the sub-list for method input_type + 7, // [7:7] is the sub-list for extension type_name + 7, // [7:7] is the sub-list for extension extendee + 0, // [0:7] is the sub-list for field type_name } func init() { file_inventory_order_proto_init() } @@ -1123,6 +1337,42 @@ return nil } } + file_inventory_order_proto_msgTypes[14].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetOperationInfoRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_inventory_order_proto_msgTypes[15].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetOperationInfoResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_inventory_order_proto_msgTypes[16].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*OperationInfo); 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{ @@ -1130,7 +1380,7 @@ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_inventory_order_proto_rawDesc, NumEnums: 0, - NumMessages: 14, + NumMessages: 17, NumExtensions: 0, NumServices: 1, }, diff --git a/proto/inventory_order/inventory_order_grpc.pb.go b/proto/inventory_order/inventory_order_grpc.pb.go index 91d9dcd..2cccf05 100644 --- a/proto/inventory_order/inventory_order_grpc.pb.go +++ b/proto/inventory_order/inventory_order_grpc.pb.go @@ -23,6 +23,7 @@ UpdateMaterialApplyStatus(ctx context.Context, in *UpdateMaterialApplyStatusRequest, opts ...grpc.CallOption) (*UpdateMaterialApplyStatusResponse, error) GetWarehouseInfo(ctx context.Context, in *GetWarehouseInfoRequest, opts ...grpc.CallOption) (*GetWarehouseInfoResponse, error) UpdateOutsourceOrder(ctx context.Context, in *UpdateOutsourceOrderRequest, opts ...grpc.CallOption) (*UpdateOutsourceOrderResponse, error) + GetOperationInfo(ctx context.Context, in *GetOperationInfoRequest, opts ...grpc.CallOption) (*GetOperationInfoResponse, error) } type inventoryOrderServiceClient struct { @@ -78,6 +79,15 @@ return out, nil } +func (c *inventoryOrderServiceClient) GetOperationInfo(ctx context.Context, in *GetOperationInfoRequest, opts ...grpc.CallOption) (*GetOperationInfoResponse, error) { + out := new(GetOperationInfoResponse) + err := c.cc.Invoke(ctx, "/inventoryOrderService/GetOperationInfo", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // InventoryOrderServiceServer is the server API for InventoryOrderService service. // All implementations must embed UnimplementedInventoryOrderServiceServer // for forward compatibility @@ -87,6 +97,7 @@ UpdateMaterialApplyStatus(context.Context, *UpdateMaterialApplyStatusRequest) (*UpdateMaterialApplyStatusResponse, error) GetWarehouseInfo(context.Context, *GetWarehouseInfoRequest) (*GetWarehouseInfoResponse, error) UpdateOutsourceOrder(context.Context, *UpdateOutsourceOrderRequest) (*UpdateOutsourceOrderResponse, error) + GetOperationInfo(context.Context, *GetOperationInfoRequest) (*GetOperationInfoResponse, error) mustEmbedUnimplementedInventoryOrderServiceServer() } @@ -108,6 +119,9 @@ } func (UnimplementedInventoryOrderServiceServer) UpdateOutsourceOrder(context.Context, *UpdateOutsourceOrderRequest) (*UpdateOutsourceOrderResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateOutsourceOrder not implemented") +} +func (UnimplementedInventoryOrderServiceServer) GetOperationInfo(context.Context, *GetOperationInfoRequest) (*GetOperationInfoResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetOperationInfo not implemented") } func (UnimplementedInventoryOrderServiceServer) mustEmbedUnimplementedInventoryOrderServiceServer() {} @@ -212,6 +226,24 @@ return interceptor(ctx, in, info, handler) } +func _InventoryOrderService_GetOperationInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetOperationInfoRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InventoryOrderServiceServer).GetOperationInfo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/inventoryOrderService/GetOperationInfo", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InventoryOrderServiceServer).GetOperationInfo(ctx, req.(*GetOperationInfoRequest)) + } + return interceptor(ctx, in, info, handler) +} + // InventoryOrderService_ServiceDesc is the grpc.ServiceDesc for InventoryOrderService 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: "UpdateOutsourceOrder", Handler: _InventoryOrderService_UpdateOutsourceOrder_Handler, }, + { + MethodName: "GetOperationInfo", + Handler: _InventoryOrderService_GetOperationInfo_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "inventory_order.proto", diff --git a/proto/inventory_order/server.go b/proto/inventory_order/server.go index 52cb2f3..d5fed6b 100644 --- a/proto/inventory_order/server.go +++ b/proto/inventory_order/server.go @@ -2,6 +2,7 @@ import ( "context" + "errors" "github.com/shopspring/decimal" "strconv" "time" @@ -106,3 +107,29 @@ resp.List = list return resp, nil } + +func (s *Server) GetOperationInfo(ctx context.Context, req *GetOperationInfoRequest) (*GetOperationInfoResponse, error) { + if len(req.SourceNumber) == 0 && len(req.SalesDetailsNumber) == 0 { + return nil, errors.New("鏉ユ簮缂栫爜鍜岄攢鍞槑缁嗙紪鐮佷笉鑳藉悓鏃朵负绌�") + } + operations, err := models.NewOperationSearch().SetSourceNumbers(req.SourceNumber).SetSalesDetailsNumbers(req.SalesDetailsNumber). + SetStatus(constvar.OperationStatus(req.Status)).SetPreload(true).FindNotTotal() + if err != nil { + return nil, err + } + resp := new(GetOperationInfoResponse) + list := make([]*OperationInfo, 0) + for _, operation := range operations { + var ol OperationInfo + ol.SourceNumber = operation.SourceNumber + ol.SalesDetailsNumber = operation.SalesDetailsNumber + for _, detail := range operation.Details { + o := ol + o.ProductId = detail.ProductId + o.Amount = detail.Amount.IntPart() + list = append(list, &o) + } + } + resp.List = list + return resp, nil +} -- Gitblit v1.8.0