From 57c1d91e82ec4085ccedf099063cd14e609a301f Mon Sep 17 00:00:00 2001 From: jiangshuai <291802688@qq.com> Date: 星期三, 15 十一月 2023 16:36:50 +0800 Subject: [PATCH] Merge branch 'master' of http://192.168.5.5:10010/r/aps/WMS --- controllers/operation.go | 32 + controllers/reorder_rule_controller.go | 53 + docs/swagger.yaml | 36 + proto/purchase_wms.proto | 72 ++ controllers/location.go | 5 docs/docs.go | 54 ++ conf/config.yaml | 1 docs/swagger.json | 54 ++ models/reorder_rule.go | 1 proto/product_inventory/server.go | 2 proto/purchase_wms/purchase_wms_grpc.pb.go | 209 ++++++++ proto/purchase_wms/purchase_wms.pb.go | 873 ++++++++++++++++++++++++++++++++++ conf/config.go | 5 main.go | 2 proto/purchase_wms/server.go | 54 ++ 15 files changed, 1,442 insertions(+), 11 deletions(-) diff --git a/conf/config.go b/conf/config.go index df4cfba..8f14bb5 100644 --- a/conf/config.go +++ b/conf/config.go @@ -40,6 +40,7 @@ grpcServerConf struct { ApsAddr string //aps鏈嶅姟grpc鍦板潃 CrmAddr string //crm鏈嶅姟grpc鍦板潃 + SrmAddr string //srm鏈嶅姟grpc鍦板潃 } ) @@ -69,6 +70,7 @@ GrpcPort := os.Getenv("WMS_GRPC") // 鍙澶栨彁渚沢rpc鏈嶅姟锛屾湰鏈嶅姟涓嶇敤 apsAddr := os.Getenv("APS_GRPC") crmAddr := os.Getenv("CRM_GRPC") + srmAddr := os.Getenv("SRM_GRPC") if len(GrpcPort) > 0 { WebConf.GrpcPort = GrpcPort } @@ -84,6 +86,9 @@ if len(crmAddr) > 0 { GrpcServerConf.CrmAddr = crmAddr } + if len(srmAddr) > 0 { + GrpcServerConf.SrmAddr = srmAddr + } DBHost := os.Getenv("DB_HOST") DBName := os.Getenv("DB_NAME") diff --git a/conf/config.yaml b/conf/config.yaml index bb68479..63a0e2b 100644 --- a/conf/config.yaml +++ b/conf/config.yaml @@ -26,3 +26,4 @@ grpcServer: apsAddr: 192.168.20.119:9091 crmAddr: 192.168.20.118:9092 + srmAddr: 192.168.20.118:9093 diff --git a/controllers/location.go b/controllers/location.go index e1102fa..29ad83b 100644 --- a/controllers/location.go +++ b/controllers/location.go @@ -98,6 +98,11 @@ if location.ParentId == 0 { tree = append(tree, location) } else { + if _, ok := m[location.ParentId]; !ok { + tree = append(tree, location) + continue + } + m[location.ParentId].Children = make([]*models.Location, 0) m[location.ParentId].Children = append(m[location.ParentId].Children, location) } } diff --git a/controllers/operation.go b/controllers/operation.go index 72eaadd..d7912aa 100644 --- a/controllers/operation.go +++ b/controllers/operation.go @@ -23,6 +23,7 @@ "wms/pkg/logx" "wms/pkg/structx" "wms/proto/product_inventory" + "wms/proto/purchase_wms" "wms/request" ) @@ -488,6 +489,9 @@ return err } } + if operation.SourceNumber != "" { + go UpdatePurchaseStatus(operation.SourceNumber) + } } @@ -530,6 +534,9 @@ if err := models.NewLocationProductAmountSearch().SetID(locAmount.Id).Update(locAmount); err != nil { return err } + } + if operation.SourceNumber != "" { + go UpdateSalesDetailStatus(operation.SourceNumber) } } @@ -684,17 +691,23 @@ util.ResponseFormat(c, code.RequestError, err.Error()) return } - if operation.SourceNumber != "" { - go UpdateSalesDetailStatus(operation.SourceNumber) - } + util.ResponseFormat(c, code.Success, "鎿嶄綔鎴愬姛") } -var ProductInventoryServiceConn *grpc.ClientConn +var ( + ProductInventoryServiceConn *grpc.ClientConn + PurchaseServiceConn *grpc.ClientConn +) func InitProductInventoryServiceConn() { var err error ProductInventoryServiceConn, err = grpc.Dial(conf.GrpcServerConf.CrmAddr, grpc.WithTransportCredentials(insecure.NewCredentials())) + if err != nil { + logx.Errorf("grpc dial product service error: %v", err.Error()) + return + } + PurchaseServiceConn, err = grpc.Dial(conf.GrpcServerConf.SrmAddr, grpc.WithTransportCredentials(insecure.NewCredentials())) if err != nil { logx.Errorf("grpc dial product service error: %v", err.Error()) return @@ -704,6 +717,9 @@ func CloseProductInventoryServiceConn() { if ProductInventoryServiceConn != nil { ProductInventoryServiceConn.Close() + } + if PurchaseServiceConn != nil { + PurchaseServiceConn.Close() } } @@ -718,6 +734,14 @@ } } +func UpdatePurchaseStatus(number string) { + client := purchase_wms.NewPurchaseServiceClient(PurchaseServiceConn) + _, err := client.UpdatePurchaseStatus(context.Background(), &purchase_wms.UpdatePurchaseStatusRequest{Number: number}) + if err != nil { + logx.Errorf("grpc dial UpdatePurchaseStatus service error: %v", err) + } +} + // ListTransfer // @Tags 鍏ュ簱/鍑哄簱 // @Summary 搴撳瓨璋冩嫧鍒楄〃 diff --git a/controllers/reorder_rule_controller.go b/controllers/reorder_rule_controller.go index a2b1dbe..4eeaa18 100644 --- a/controllers/reorder_rule_controller.go +++ b/controllers/reorder_rule_controller.go @@ -17,6 +17,7 @@ "wms/pkg/logx" "wms/pkg/timex" "wms/proto/inventory_order" + "wms/proto/purchase_wms" "wms/request" ) @@ -289,6 +290,16 @@ util.ResponseFormat(c, code.RequestParamError, "鍙傛暟瑙f瀽澶辫触锛屾暟鎹被鍨嬮敊璇�") return } + if params.Route == "閲囪喘" { + client := purchase_wms.NewPurchaseServiceClient(PurchaseServiceConn) + resp, err := client.GetSupplierListByProductId(c, &purchase_wms.GetSupplierListByProductIdRequest{ProductId: params.ProductId}) + if err != nil { + util.ResponseFormat(c, code.RequestParamError, "grpc璋冪敤澶辫触") + return + } + util.ResponseFormat(c, code.Success, resp.List) + return + } client := inventory_order.NewInventoryOrderServiceClient(InventoryOrderServiceConn) order, err := client.CreateNewOrder(c, &inventory_order.CreateNewOrderRequest{ OrderNumber: params.OrderNumber.IntPart(), @@ -300,18 +311,25 @@ util.ResponseFormat(c, code.RequestParamError, "grpc璋冪敤澶辫触") return } + err = orderAgain(params, order.OrderId) + if err != nil { + util.ResponseFormat(c, code.RequestParamError, "閲嶈澶辫触") + return + } + util.ResponseFormat(c, code.Success, "閲嶈鎴愬姛") +} + +func orderAgain(params models.ReorderRule, SourceNumber string) error { location, err := models.NewLocationSearch().SetID(params.LocationId).First() if err != nil { - util.ResponseFormat(c, code.RequestParamError, "鏌ヨ浣嶇疆淇℃伅澶辫触") - return + return err } houseCode := strings.Split(location.JointName, "/")[0] var operationType models.OperationType err = models.NewOperationTypeSearch().Orm.Model(&models.OperationType{}).Joins("left join wms_warehouse on wms_job_type.warehouse_id = wms_warehouse.id"). Where("wms_job_type.base_operation_type = 1 and wms_warehouse.code = ?", houseCode).First(&operationType).Error if err != nil { - util.ResponseFormat(c, code.RequestParamError, "鏌ヨ浣嶇疆淇℃伅澶辫触") - return + return err } var operation models.Operation var details models.OperationDetails @@ -327,7 +345,7 @@ operation.FromLocationID = 1 operation.Number = strconv.FormatInt(time.Now().Unix(), 10) operation.ToLocationID = params.LocationId - operation.SourceNumber = order.OrderId + operation.SourceNumber = SourceNumber err = models.WithTransaction(func(db *gorm.DB) error { if err = models.NewOperationSearch().SetOrm(db).Create(&operation); err != nil { @@ -337,9 +355,32 @@ err = models.NewReorderRuleSearch().SetOrm(db).SetID(params.Id).Update(¶ms) return err }) + + return err +} + +// SubmitOrder +// @Tags 閲嶈璐ц鍒� +// @Summary 鍐嶈涓�娆� +// @Produce application/json +// @Param object body models.ReorderRule true "鍙傛暟" +// @Success 200 {object} util.Response "鎴愬姛" +// @Router /api-wms/v1/reorderRule/submitOrder [post] +func (slf ReorderRuleController) SubmitOrder(c *gin.Context) { + var params models.ReorderRule + client := purchase_wms.NewPurchaseServiceClient(PurchaseServiceConn) + resp, err := client.CreatePurchaseByWms(c, &purchase_wms.CreatePurchaseByWmsRequest{ + SupplierId: params.SupplierId, + ProductId: params.ProductId, + Amount: params.OrderNumber.IntPart(), + }) + if err != nil { + util.ResponseFormat(c, code.RequestParamError, "grpc璋冪敤澶辫触") + return + } + err = orderAgain(params, resp.PurchaseNumber) if err != nil { util.ResponseFormat(c, code.RequestParamError, "閲嶈澶辫触") return } - util.ResponseFormat(c, code.Success, "閲嶈鎴愬姛") } diff --git a/docs/docs.go b/docs/docs.go index 76ee786..0ec54bf 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -2167,6 +2167,36 @@ } } }, + "/api-wms/v1/reorderRule/submitOrder": { + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "閲嶈璐ц鍒�" + ], + "summary": "鍐嶈涓�娆�", + "parameters": [ + { + "description": "鍙傛暟", + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/models.ReorderRule" + } + } + ], + "responses": { + "200": { + "description": "鎴愬姛", + "schema": { + "$ref": "#/definitions/util.Response" + } + } + } + } + }, "/api-wms/v1/reorderRule/updateReorderRule": { "post": { "produces": [ @@ -3002,6 +3032,9 @@ "description": "HSCode string ` + "`" + `gorm:\"type:varchar(255);comment:HS缂栫爜\" json:\"HSCode\"` + "`" + ` //HS缂栫爜\nOriginCountryId int ` + "`" + `gorm:\"type:int(11);comment:鍘熶骇鍦癷d\" json:\"originCountryId\"` + "`" + ` //鍘熶骇鍦癷d\nOriginCountryName string ` + "`" + `gorm:\"type:varchar(255);comment:鍘熶骇鍦板悕绉癨" json:\"originCountryName\"` + "`" + ` //鍘熶骇鍦板悕绉�", "type": "string" }, + "inputAmount": { + "type": "number" + }, "internalNotes": { "description": "鍐呴儴璇存槑", "type": "string" @@ -3034,7 +3067,15 @@ "description": "鏈�澶у簱瀛�", "type": "number" }, + "maxInventoryRule": { + "description": "鏈�澶у簱瀛�", + "type": "number" + }, "minInventory": { + "description": "鏈�灏忓簱瀛�", + "type": "number" + }, + "minInventoryRule": { "description": "鏈�灏忓簱瀛�", "type": "number" }, @@ -3073,6 +3114,12 @@ "description": "鍑哄簱璇存槑", "type": "string" }, + "outputAmount": { + "type": "number" + }, + "predictionAmount": { + "type": "number" + }, "principal": { "description": "璐熻矗浜�", "type": "string" @@ -3099,6 +3146,9 @@ }, "purchaseType": { "$ref": "#/definitions/constvar.PurchaseType" + }, + "reorderRuleNum": { + "type": "integer" }, "salePrice": { "description": "閿�鍞崟浠�", @@ -3381,6 +3431,10 @@ "description": "璺嚎", "type": "string" }, + "supplierId": { + "description": "渚涘簲鍟唅d", + "type": "integer" + }, "unit": { "description": "鍗曚綅", "type": "string" diff --git a/docs/swagger.json b/docs/swagger.json index fb080eb..d545fcc 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -2155,6 +2155,36 @@ } } }, + "/api-wms/v1/reorderRule/submitOrder": { + "post": { + "produces": [ + "application/json" + ], + "tags": [ + "閲嶈璐ц鍒�" + ], + "summary": "鍐嶈涓�娆�", + "parameters": [ + { + "description": "鍙傛暟", + "name": "object", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/models.ReorderRule" + } + } + ], + "responses": { + "200": { + "description": "鎴愬姛", + "schema": { + "$ref": "#/definitions/util.Response" + } + } + } + } + }, "/api-wms/v1/reorderRule/updateReorderRule": { "post": { "produces": [ @@ -2990,6 +3020,9 @@ "description": "HSCode string `gorm:\"type:varchar(255);comment:HS缂栫爜\" json:\"HSCode\"` //HS缂栫爜\nOriginCountryId int `gorm:\"type:int(11);comment:鍘熶骇鍦癷d\" json:\"originCountryId\"` //鍘熶骇鍦癷d\nOriginCountryName string `gorm:\"type:varchar(255);comment:鍘熶骇鍦板悕绉癨" json:\"originCountryName\"` //鍘熶骇鍦板悕绉�", "type": "string" }, + "inputAmount": { + "type": "number" + }, "internalNotes": { "description": "鍐呴儴璇存槑", "type": "string" @@ -3022,7 +3055,15 @@ "description": "鏈�澶у簱瀛�", "type": "number" }, + "maxInventoryRule": { + "description": "鏈�澶у簱瀛�", + "type": "number" + }, "minInventory": { + "description": "鏈�灏忓簱瀛�", + "type": "number" + }, + "minInventoryRule": { "description": "鏈�灏忓簱瀛�", "type": "number" }, @@ -3061,6 +3102,12 @@ "description": "鍑哄簱璇存槑", "type": "string" }, + "outputAmount": { + "type": "number" + }, + "predictionAmount": { + "type": "number" + }, "principal": { "description": "璐熻矗浜�", "type": "string" @@ -3087,6 +3134,9 @@ }, "purchaseType": { "$ref": "#/definitions/constvar.PurchaseType" + }, + "reorderRuleNum": { + "type": "integer" }, "salePrice": { "description": "閿�鍞崟浠�", @@ -3369,6 +3419,10 @@ "description": "璺嚎", "type": "string" }, + "supplierId": { + "description": "渚涘簲鍟唅d", + "type": "integer" + }, "unit": { "description": "鍗曚綅", "type": "string" diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 37b8823..e097e09 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -465,6 +465,8 @@ OriginCountryId int `gorm:"type:int(11);comment:鍘熶骇鍦癷d" json:"originCountryId"` //鍘熶骇鍦癷d OriginCountryName string `gorm:"type:varchar(255);comment:鍘熶骇鍦板悕绉�" json:"originCountryName"` //鍘熶骇鍦板悕绉� type: string + inputAmount: + type: number internalNotes: description: 鍐呴儴璇存槑 type: string @@ -487,7 +489,13 @@ maxInventory: description: 鏈�澶у簱瀛� type: number + maxInventoryRule: + description: 鏈�澶у簱瀛� + type: number minInventory: + description: 鏈�灏忓簱瀛� + type: number + minInventoryRule: description: 鏈�灏忓簱瀛� type: number minPurchaseAmount: @@ -515,6 +523,10 @@ outStorageExplain: description: 鍑哄簱璇存槑 type: string + outputAmount: + type: number + predictionAmount: + type: number principal: description: 璐熻矗浜� type: string @@ -533,6 +545,8 @@ type: number purchaseType: $ref: '#/definitions/constvar.PurchaseType' + reorderRuleNum: + type: integer salePrice: description: 閿�鍞崟浠� type: number @@ -723,6 +737,9 @@ route: description: 璺嚎 type: string + supplierId: + description: 渚涘簲鍟唅d + type: integer unit: description: 鍗曚綅 type: string @@ -2866,6 +2883,25 @@ summary: 鍐嶈涓�娆� tags: - 閲嶈璐ц鍒� + /api-wms/v1/reorderRule/submitOrder: + post: + parameters: + - description: 鍙傛暟 + in: body + name: object + required: true + schema: + $ref: '#/definitions/models.ReorderRule' + produces: + - application/json + responses: + "200": + description: 鎴愬姛 + schema: + $ref: '#/definitions/util.Response' + summary: 鍐嶈涓�娆� + tags: + - 閲嶈璐ц鍒� /api-wms/v1/reorderRule/updateReorderRule: post: parameters: diff --git a/main.go b/main.go index 0fb90de..9069f9a 100644 --- a/main.go +++ b/main.go @@ -15,6 +15,7 @@ "wms/models" "wms/pkg/logx" "wms/proto/product_inventory" + "wms/proto/purchase_wms" "wms/router" ) @@ -58,6 +59,7 @@ s := grpc.NewServer() //todo 娣诲姞鍏蜂綋鏈嶅姟 product_inventory.RegisterProductInventoryServiceServer(s, &product_inventory.Server{}) + purchase_wms.RegisterPurchaseServiceServer(s, &purchase_wms.Server{}) err = s.Serve(ln) if err != nil { logx.Errorf("grpc server init error: %v", err.Error()) diff --git a/models/reorder_rule.go b/models/reorder_rule.go index 868ef41..f3a1e75 100644 --- a/models/reorder_rule.go +++ b/models/reorder_rule.go @@ -22,6 +22,7 @@ Unit string `json:"unit" gorm:"type:varchar(100);comment:鍗曚綅"` //鍗曚綅 Amount decimal.Decimal `json:"amount" gorm:"-"` //鍦ㄥ簱鏁伴噺 Prediction decimal.Decimal `json:"prediction" gorm:"-"` //棰勬祴鏁伴噺 + SupplierId int64 `json:"supplierId" gorm:"-"` //渚涘簲鍟唅d } ReorderRuleSearch struct { ReorderRule diff --git a/proto/product_inventory/server.go b/proto/product_inventory/server.go index 5abf83f..bb375e1 100644 --- a/proto/product_inventory/server.go +++ b/proto/product_inventory/server.go @@ -156,7 +156,7 @@ } operation.OperationTypeName = operationType.Name operation.OperationTypeId = operationType.Id - location, err := models.NewLocationSearch().SetJointNames([]string{warehouse.Code}).First() + location, err := models.NewLocationSearch().SetID(warehouse.LocationId).First() if err != nil { return nil, err } diff --git a/proto/purchase_wms.proto b/proto/purchase_wms.proto new file mode 100644 index 0000000..1e8a838 --- /dev/null +++ b/proto/purchase_wms.proto @@ -0,0 +1,72 @@ +syntax = "proto3"; + +option go_package = "./purchase_wms"; + +service PurchaseService { + rpc PurchaseToWms(PurchaseToWmsRequest) returns (PurchaseToWmsResponse); + rpc UpdatePurchaseStatus(UpdatePurchaseStatusRequest) returns (UpdatePurchaseStatusResponse) {} + rpc GetSupplierListByProductId(GetSupplierListByProductIdRequest) returns (GetSupplierListByProductIdResponse) {} + rpc CreatePurchaseByWms(CreatePurchaseByWmsRequest) returns (CreatePurchaseByWmsResponse) {} +} + +//------------------------------------------PurchaseToWms-------------------------------- + +message PurchaseProduct{ + string Id = 1; + int64 Amount = 2; +} + +message PurchaseToWmsRequest { + string Number = 1; //閲囪喘缂栧彿 + string SupplierName = 2; //渚涘簲鍟� + repeated PurchaseProduct Product = 3; +} + +message PurchaseToWmsResponse { + int32 code = 1; + string message = 2; +} + +//------------------------------------------------UpdatePurchaseStatus------------------------------------- + +message UpdatePurchaseStatusRequest { + string Number = 1;//閲囪喘缂栧彿 +} + +message UpdatePurchaseStatusResponse { + int32 Code = 1; + string Msg = 2; +} + +//--------------------------------------------------GetSupplierListByProductId------------------------------ + +message GetSupplierListByProductIdRequest { + string ProductId = 1; +} + +message SupplierList { + int64 supplierId = 1; + string supplierName = 2; + float purchasePrice = 3;//閲囪喘浠锋牸 +} + +message GetSupplierListByProductIdResponse { + int32 Code = 1; + string Msg = 2; + repeated SupplierList List = 3; +} + +//-----------------------------------------------------CreatePurchaseByWms-------------------------------------- + +message CreatePurchaseByWmsRequest { + int64 SupplierId = 1; + string ProductId = 2; + int64 Amount = 3; +} + +message CreatePurchaseByWmsResponse { + int32 Code = 1; + string Msg = 2; + string PurchaseNumber = 3; +} + diff --git a/proto/purchase_wms/purchase_wms.pb.go b/proto/purchase_wms/purchase_wms.pb.go new file mode 100644 index 0000000..e60e691 --- /dev/null +++ b/proto/purchase_wms/purchase_wms.pb.go @@ -0,0 +1,873 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.26.0 +// protoc v4.24.0 +// source: purchase_wms.proto + +package purchase_wms + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type PurchaseProduct struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id string `protobuf:"bytes,1,opt,name=Id,proto3" json:"Id,omitempty"` + Amount int64 `protobuf:"varint,2,opt,name=Amount,proto3" json:"Amount,omitempty"` +} + +func (x *PurchaseProduct) Reset() { + *x = PurchaseProduct{} + if protoimpl.UnsafeEnabled { + mi := &file_purchase_wms_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PurchaseProduct) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PurchaseProduct) ProtoMessage() {} + +func (x *PurchaseProduct) ProtoReflect() protoreflect.Message { + mi := &file_purchase_wms_proto_msgTypes[0] + 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 PurchaseProduct.ProtoReflect.Descriptor instead. +func (*PurchaseProduct) Descriptor() ([]byte, []int) { + return file_purchase_wms_proto_rawDescGZIP(), []int{0} +} + +func (x *PurchaseProduct) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *PurchaseProduct) GetAmount() int64 { + if x != nil { + return x.Amount + } + return 0 +} + +type PurchaseToWmsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Number string `protobuf:"bytes,1,opt,name=Number,proto3" json:"Number,omitempty"` //閲囪喘缂栧彿 + SupplierName string `protobuf:"bytes,2,opt,name=SupplierName,proto3" json:"SupplierName,omitempty"` //渚涘簲鍟� + Product []*PurchaseProduct `protobuf:"bytes,3,rep,name=Product,proto3" json:"Product,omitempty"` +} + +func (x *PurchaseToWmsRequest) Reset() { + *x = PurchaseToWmsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_purchase_wms_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PurchaseToWmsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PurchaseToWmsRequest) ProtoMessage() {} + +func (x *PurchaseToWmsRequest) ProtoReflect() protoreflect.Message { + mi := &file_purchase_wms_proto_msgTypes[1] + 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 PurchaseToWmsRequest.ProtoReflect.Descriptor instead. +func (*PurchaseToWmsRequest) Descriptor() ([]byte, []int) { + return file_purchase_wms_proto_rawDescGZIP(), []int{1} +} + +func (x *PurchaseToWmsRequest) GetNumber() string { + if x != nil { + return x.Number + } + return "" +} + +func (x *PurchaseToWmsRequest) GetSupplierName() string { + if x != nil { + return x.SupplierName + } + return "" +} + +func (x *PurchaseToWmsRequest) GetProduct() []*PurchaseProduct { + if x != nil { + return x.Product + } + return nil +} + +type PurchaseToWmsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Code int32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` + Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` +} + +func (x *PurchaseToWmsResponse) Reset() { + *x = PurchaseToWmsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_purchase_wms_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *PurchaseToWmsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*PurchaseToWmsResponse) ProtoMessage() {} + +func (x *PurchaseToWmsResponse) ProtoReflect() protoreflect.Message { + mi := &file_purchase_wms_proto_msgTypes[2] + 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 PurchaseToWmsResponse.ProtoReflect.Descriptor instead. +func (*PurchaseToWmsResponse) Descriptor() ([]byte, []int) { + return file_purchase_wms_proto_rawDescGZIP(), []int{2} +} + +func (x *PurchaseToWmsResponse) GetCode() int32 { + if x != nil { + return x.Code + } + return 0 +} + +func (x *PurchaseToWmsResponse) GetMessage() string { + if x != nil { + return x.Message + } + return "" +} + +type UpdatePurchaseStatusRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Number string `protobuf:"bytes,1,opt,name=Number,proto3" json:"Number,omitempty"` //閲囪喘缂栧彿 +} + +func (x *UpdatePurchaseStatusRequest) Reset() { + *x = UpdatePurchaseStatusRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_purchase_wms_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdatePurchaseStatusRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdatePurchaseStatusRequest) ProtoMessage() {} + +func (x *UpdatePurchaseStatusRequest) ProtoReflect() protoreflect.Message { + mi := &file_purchase_wms_proto_msgTypes[3] + 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 UpdatePurchaseStatusRequest.ProtoReflect.Descriptor instead. +func (*UpdatePurchaseStatusRequest) Descriptor() ([]byte, []int) { + return file_purchase_wms_proto_rawDescGZIP(), []int{3} +} + +func (x *UpdatePurchaseStatusRequest) GetNumber() string { + if x != nil { + return x.Number + } + return "" +} + +type UpdatePurchaseStatusResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Code int32 `protobuf:"varint,1,opt,name=Code,proto3" json:"Code,omitempty"` + Msg string `protobuf:"bytes,2,opt,name=Msg,proto3" json:"Msg,omitempty"` +} + +func (x *UpdatePurchaseStatusResponse) Reset() { + *x = UpdatePurchaseStatusResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_purchase_wms_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdatePurchaseStatusResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdatePurchaseStatusResponse) ProtoMessage() {} + +func (x *UpdatePurchaseStatusResponse) ProtoReflect() protoreflect.Message { + mi := &file_purchase_wms_proto_msgTypes[4] + 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 UpdatePurchaseStatusResponse.ProtoReflect.Descriptor instead. +func (*UpdatePurchaseStatusResponse) Descriptor() ([]byte, []int) { + return file_purchase_wms_proto_rawDescGZIP(), []int{4} +} + +func (x *UpdatePurchaseStatusResponse) GetCode() int32 { + if x != nil { + return x.Code + } + return 0 +} + +func (x *UpdatePurchaseStatusResponse) GetMsg() string { + if x != nil { + return x.Msg + } + return "" +} + +type GetSupplierListByProductIdRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ProductId string `protobuf:"bytes,1,opt,name=ProductId,proto3" json:"ProductId,omitempty"` +} + +func (x *GetSupplierListByProductIdRequest) Reset() { + *x = GetSupplierListByProductIdRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_purchase_wms_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetSupplierListByProductIdRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetSupplierListByProductIdRequest) ProtoMessage() {} + +func (x *GetSupplierListByProductIdRequest) ProtoReflect() protoreflect.Message { + mi := &file_purchase_wms_proto_msgTypes[5] + 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 GetSupplierListByProductIdRequest.ProtoReflect.Descriptor instead. +func (*GetSupplierListByProductIdRequest) Descriptor() ([]byte, []int) { + return file_purchase_wms_proto_rawDescGZIP(), []int{5} +} + +func (x *GetSupplierListByProductIdRequest) GetProductId() string { + if x != nil { + return x.ProductId + } + return "" +} + +type SupplierList struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SupplierId int64 `protobuf:"varint,1,opt,name=supplierId,proto3" json:"supplierId,omitempty"` + SupplierName string `protobuf:"bytes,2,opt,name=supplierName,proto3" json:"supplierName,omitempty"` + PurchasePrice float32 `protobuf:"fixed32,3,opt,name=purchasePrice,proto3" json:"purchasePrice,omitempty"` //閲囪喘浠锋牸 +} + +func (x *SupplierList) Reset() { + *x = SupplierList{} + if protoimpl.UnsafeEnabled { + mi := &file_purchase_wms_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SupplierList) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SupplierList) ProtoMessage() {} + +func (x *SupplierList) ProtoReflect() protoreflect.Message { + mi := &file_purchase_wms_proto_msgTypes[6] + 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 SupplierList.ProtoReflect.Descriptor instead. +func (*SupplierList) Descriptor() ([]byte, []int) { + return file_purchase_wms_proto_rawDescGZIP(), []int{6} +} + +func (x *SupplierList) GetSupplierId() int64 { + if x != nil { + return x.SupplierId + } + return 0 +} + +func (x *SupplierList) GetSupplierName() string { + if x != nil { + return x.SupplierName + } + return "" +} + +func (x *SupplierList) GetPurchasePrice() float32 { + if x != nil { + return x.PurchasePrice + } + return 0 +} + +type GetSupplierListByProductIdResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Code int32 `protobuf:"varint,1,opt,name=Code,proto3" json:"Code,omitempty"` + Msg string `protobuf:"bytes,2,opt,name=Msg,proto3" json:"Msg,omitempty"` + List []*SupplierList `protobuf:"bytes,3,rep,name=List,proto3" json:"List,omitempty"` +} + +func (x *GetSupplierListByProductIdResponse) Reset() { + *x = GetSupplierListByProductIdResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_purchase_wms_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetSupplierListByProductIdResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetSupplierListByProductIdResponse) ProtoMessage() {} + +func (x *GetSupplierListByProductIdResponse) ProtoReflect() protoreflect.Message { + mi := &file_purchase_wms_proto_msgTypes[7] + 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 GetSupplierListByProductIdResponse.ProtoReflect.Descriptor instead. +func (*GetSupplierListByProductIdResponse) Descriptor() ([]byte, []int) { + return file_purchase_wms_proto_rawDescGZIP(), []int{7} +} + +func (x *GetSupplierListByProductIdResponse) GetCode() int32 { + if x != nil { + return x.Code + } + return 0 +} + +func (x *GetSupplierListByProductIdResponse) GetMsg() string { + if x != nil { + return x.Msg + } + return "" +} + +func (x *GetSupplierListByProductIdResponse) GetList() []*SupplierList { + if x != nil { + return x.List + } + return nil +} + +type CreatePurchaseByWmsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + 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"` +} + +func (x *CreatePurchaseByWmsRequest) Reset() { + *x = CreatePurchaseByWmsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_purchase_wms_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreatePurchaseByWmsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreatePurchaseByWmsRequest) ProtoMessage() {} + +func (x *CreatePurchaseByWmsRequest) ProtoReflect() protoreflect.Message { + mi := &file_purchase_wms_proto_msgTypes[8] + 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 CreatePurchaseByWmsRequest.ProtoReflect.Descriptor instead. +func (*CreatePurchaseByWmsRequest) Descriptor() ([]byte, []int) { + return file_purchase_wms_proto_rawDescGZIP(), []int{8} +} + +func (x *CreatePurchaseByWmsRequest) GetSupplierId() int64 { + if x != nil { + return x.SupplierId + } + return 0 +} + +func (x *CreatePurchaseByWmsRequest) GetProductId() string { + if x != nil { + return x.ProductId + } + return "" +} + +func (x *CreatePurchaseByWmsRequest) GetAmount() int64 { + if x != nil { + return x.Amount + } + return 0 +} + +type CreatePurchaseByWmsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Code int32 `protobuf:"varint,1,opt,name=Code,proto3" json:"Code,omitempty"` + Msg string `protobuf:"bytes,2,opt,name=Msg,proto3" json:"Msg,omitempty"` + PurchaseNumber string `protobuf:"bytes,3,opt,name=PurchaseNumber,proto3" json:"PurchaseNumber,omitempty"` +} + +func (x *CreatePurchaseByWmsResponse) Reset() { + *x = CreatePurchaseByWmsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_purchase_wms_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreatePurchaseByWmsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreatePurchaseByWmsResponse) ProtoMessage() {} + +func (x *CreatePurchaseByWmsResponse) ProtoReflect() protoreflect.Message { + mi := &file_purchase_wms_proto_msgTypes[9] + 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 CreatePurchaseByWmsResponse.ProtoReflect.Descriptor instead. +func (*CreatePurchaseByWmsResponse) Descriptor() ([]byte, []int) { + return file_purchase_wms_proto_rawDescGZIP(), []int{9} +} + +func (x *CreatePurchaseByWmsResponse) GetCode() int32 { + if x != nil { + return x.Code + } + return 0 +} + +func (x *CreatePurchaseByWmsResponse) GetMsg() string { + if x != nil { + return x.Msg + } + return "" +} + +func (x *CreatePurchaseByWmsResponse) GetPurchaseNumber() string { + if x != nil { + return x.PurchaseNumber + } + return "" +} + +var File_purchase_wms_proto protoreflect.FileDescriptor + +var file_purchase_wms_proto_rawDesc = []byte{ + 0x0a, 0x12, 0x70, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x5f, 0x77, 0x6d, 0x73, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x39, 0x0a, 0x0f, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, + 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, + 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, + 0x7e, 0x0a, 0x14, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x54, 0x6f, 0x57, 0x6d, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x16, 0x0a, 0x06, 0x4e, 0x75, 0x6d, 0x62, 0x65, + 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, + 0x22, 0x0a, 0x0c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x4e, + 0x61, 0x6d, 0x65, 0x12, 0x2a, 0x0a, 0x07, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x18, 0x03, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x50, + 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x07, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x22, + 0x45, 0x0a, 0x15, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x54, 0x6f, 0x57, 0x6d, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x18, 0x0a, 0x07, + 0x6d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x6d, + 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x22, 0x35, 0x0a, 0x1b, 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, 0x12, 0x16, 0x0a, 0x06, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0x44, 0x0a, + 0x1c, 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, 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, 0x22, 0x41, 0x0a, 0x21, 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, 0x12, 0x1c, 0x0a, 0x09, 0x50, 0x72, 0x6f, 0x64, + 0x75, 0x63, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x50, 0x72, 0x6f, + 0x64, 0x75, 0x63, 0x74, 0x49, 0x64, 0x22, 0x78, 0x0a, 0x0c, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, + 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, + 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0a, 0x73, 0x75, 0x70, 0x70, + 0x6c, 0x69, 0x65, 0x72, 0x49, 0x64, 0x12, 0x22, 0x0a, 0x0c, 0x73, 0x75, 0x70, 0x70, 0x6c, 0x69, + 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x73, 0x75, + 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x24, 0x0a, 0x0d, 0x70, 0x75, + 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x50, 0x72, 0x69, 0x63, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x02, 0x52, 0x0d, 0x70, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x50, 0x72, 0x69, 0x63, 0x65, + 0x22, 0x6d, 0x0a, 0x22, 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, 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, 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, + 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, +} + +var ( + file_purchase_wms_proto_rawDescOnce sync.Once + file_purchase_wms_proto_rawDescData = file_purchase_wms_proto_rawDesc +) + +func file_purchase_wms_proto_rawDescGZIP() []byte { + file_purchase_wms_proto_rawDescOnce.Do(func() { + file_purchase_wms_proto_rawDescData = protoimpl.X.CompressGZIP(file_purchase_wms_proto_rawDescData) + }) + return file_purchase_wms_proto_rawDescData +} + +var file_purchase_wms_proto_msgTypes = make([]protoimpl.MessageInfo, 10) +var file_purchase_wms_proto_goTypes = []interface{}{ + (*PurchaseProduct)(nil), // 0: PurchaseProduct + (*PurchaseToWmsRequest)(nil), // 1: PurchaseToWmsRequest + (*PurchaseToWmsResponse)(nil), // 2: PurchaseToWmsResponse + (*UpdatePurchaseStatusRequest)(nil), // 3: UpdatePurchaseStatusRequest + (*UpdatePurchaseStatusResponse)(nil), // 4: UpdatePurchaseStatusResponse + (*GetSupplierListByProductIdRequest)(nil), // 5: GetSupplierListByProductIdRequest + (*SupplierList)(nil), // 6: SupplierList + (*GetSupplierListByProductIdResponse)(nil), // 7: GetSupplierListByProductIdResponse + (*CreatePurchaseByWmsRequest)(nil), // 8: CreatePurchaseByWmsRequest + (*CreatePurchaseByWmsResponse)(nil), // 9: CreatePurchaseByWmsResponse +} +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 +} + +func init() { file_purchase_wms_proto_init() } +func file_purchase_wms_proto_init() { + if File_purchase_wms_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_purchase_wms_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PurchaseProduct); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_purchase_wms_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PurchaseToWmsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_purchase_wms_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*PurchaseToWmsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_purchase_wms_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdatePurchaseStatusRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_purchase_wms_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdatePurchaseStatusResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_purchase_wms_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetSupplierListByProductIdRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_purchase_wms_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SupplierList); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_purchase_wms_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetSupplierListByProductIdResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_purchase_wms_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreatePurchaseByWmsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_purchase_wms_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreatePurchaseByWmsResponse); 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{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_purchase_wms_proto_rawDesc, + NumEnums: 0, + NumMessages: 10, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_purchase_wms_proto_goTypes, + DependencyIndexes: file_purchase_wms_proto_depIdxs, + MessageInfos: file_purchase_wms_proto_msgTypes, + }.Build() + File_purchase_wms_proto = out.File + file_purchase_wms_proto_rawDesc = nil + file_purchase_wms_proto_goTypes = nil + file_purchase_wms_proto_depIdxs = nil +} diff --git a/proto/purchase_wms/purchase_wms_grpc.pb.go b/proto/purchase_wms/purchase_wms_grpc.pb.go new file mode 100644 index 0000000..bab2cda --- /dev/null +++ b/proto/purchase_wms/purchase_wms_grpc.pb.go @@ -0,0 +1,209 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. + +package purchase_wms + +import ( + context "context" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" +) + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +// Requires gRPC-Go v1.32.0 or later. +const _ = grpc.SupportPackageIsVersion7 + +// PurchaseServiceClient is the client API for PurchaseService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. +type PurchaseServiceClient interface { + PurchaseToWms(ctx context.Context, in *PurchaseToWmsRequest, opts ...grpc.CallOption) (*PurchaseToWmsResponse, error) + 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) +} + +type purchaseServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewPurchaseServiceClient(cc grpc.ClientConnInterface) PurchaseServiceClient { + return &purchaseServiceClient{cc} +} + +func (c *purchaseServiceClient) PurchaseToWms(ctx context.Context, in *PurchaseToWmsRequest, opts ...grpc.CallOption) (*PurchaseToWmsResponse, error) { + out := new(PurchaseToWmsResponse) + err := c.cc.Invoke(ctx, "/PurchaseService/PurchaseToWms", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *purchaseServiceClient) UpdatePurchaseStatus(ctx context.Context, in *UpdatePurchaseStatusRequest, opts ...grpc.CallOption) (*UpdatePurchaseStatusResponse, error) { + out := new(UpdatePurchaseStatusResponse) + err := c.cc.Invoke(ctx, "/PurchaseService/UpdatePurchaseStatus", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *purchaseServiceClient) GetSupplierListByProductId(ctx context.Context, in *GetSupplierListByProductIdRequest, opts ...grpc.CallOption) (*GetSupplierListByProductIdResponse, error) { + out := new(GetSupplierListByProductIdResponse) + err := c.cc.Invoke(ctx, "/PurchaseService/GetSupplierListByProductId", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *purchaseServiceClient) CreatePurchaseByWms(ctx context.Context, in *CreatePurchaseByWmsRequest, opts ...grpc.CallOption) (*CreatePurchaseByWmsResponse, error) { + out := new(CreatePurchaseByWmsResponse) + err := c.cc.Invoke(ctx, "/PurchaseService/CreatePurchaseByWms", 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 +type PurchaseServiceServer interface { + PurchaseToWms(context.Context, *PurchaseToWmsRequest) (*PurchaseToWmsResponse, error) + UpdatePurchaseStatus(context.Context, *UpdatePurchaseStatusRequest) (*UpdatePurchaseStatusResponse, error) + GetSupplierListByProductId(context.Context, *GetSupplierListByProductIdRequest) (*GetSupplierListByProductIdResponse, error) + CreatePurchaseByWms(context.Context, *CreatePurchaseByWmsRequest) (*CreatePurchaseByWmsResponse, error) + mustEmbedUnimplementedPurchaseServiceServer() +} + +// UnimplementedPurchaseServiceServer must be embedded to have forward compatible implementations. +type UnimplementedPurchaseServiceServer struct { +} + +func (UnimplementedPurchaseServiceServer) PurchaseToWms(context.Context, *PurchaseToWmsRequest) (*PurchaseToWmsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method PurchaseToWms not implemented") +} +func (UnimplementedPurchaseServiceServer) UpdatePurchaseStatus(context.Context, *UpdatePurchaseStatusRequest) (*UpdatePurchaseStatusResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdatePurchaseStatus not implemented") +} +func (UnimplementedPurchaseServiceServer) GetSupplierListByProductId(context.Context, *GetSupplierListByProductIdRequest) (*GetSupplierListByProductIdResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetSupplierListByProductId not implemented") +} +func (UnimplementedPurchaseServiceServer) CreatePurchaseByWms(context.Context, *CreatePurchaseByWmsRequest) (*CreatePurchaseByWmsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreatePurchaseByWms not implemented") +} +func (UnimplementedPurchaseServiceServer) mustEmbedUnimplementedPurchaseServiceServer() {} + +// UnsafePurchaseServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to PurchaseServiceServer will +// result in compilation errors. +type UnsafePurchaseServiceServer interface { + mustEmbedUnimplementedPurchaseServiceServer() +} + +func RegisterPurchaseServiceServer(s grpc.ServiceRegistrar, srv PurchaseServiceServer) { + s.RegisterService(&PurchaseService_ServiceDesc, srv) +} + +func _PurchaseService_PurchaseToWms_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(PurchaseToWmsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PurchaseServiceServer).PurchaseToWms(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/PurchaseService/PurchaseToWms", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PurchaseServiceServer).PurchaseToWms(ctx, req.(*PurchaseToWmsRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PurchaseService_UpdatePurchaseStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdatePurchaseStatusRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PurchaseServiceServer).UpdatePurchaseStatus(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/PurchaseService/UpdatePurchaseStatus", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PurchaseServiceServer).UpdatePurchaseStatus(ctx, req.(*UpdatePurchaseStatusRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PurchaseService_GetSupplierListByProductId_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetSupplierListByProductIdRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PurchaseServiceServer).GetSupplierListByProductId(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/PurchaseService/GetSupplierListByProductId", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PurchaseServiceServer).GetSupplierListByProductId(ctx, req.(*GetSupplierListByProductIdRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _PurchaseService_CreatePurchaseByWms_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreatePurchaseByWmsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(PurchaseServiceServer).CreatePurchaseByWms(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/PurchaseService/CreatePurchaseByWms", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(PurchaseServiceServer).CreatePurchaseByWms(ctx, req.(*CreatePurchaseByWmsRequest)) + } + 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) +var PurchaseService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "PurchaseService", + HandlerType: (*PurchaseServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "PurchaseToWms", + Handler: _PurchaseService_PurchaseToWms_Handler, + }, + { + MethodName: "UpdatePurchaseStatus", + Handler: _PurchaseService_UpdatePurchaseStatus_Handler, + }, + { + MethodName: "GetSupplierListByProductId", + Handler: _PurchaseService_GetSupplierListByProductId_Handler, + }, + { + MethodName: "CreatePurchaseByWms", + Handler: _PurchaseService_CreatePurchaseByWms_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "purchase_wms.proto", +} diff --git a/proto/purchase_wms/server.go b/proto/purchase_wms/server.go new file mode 100644 index 0000000..173e7db --- /dev/null +++ b/proto/purchase_wms/server.go @@ -0,0 +1,54 @@ +package purchase_wms + +import ( + "context" + "github.com/shopspring/decimal" + "strconv" + "time" + "wms/constvar" + "wms/models" + "wms/pkg/timex" +) + +type Server struct { + UnimplementedPurchaseServiceServer +} + +func (s *Server) PurchaseToWms(c context.Context, req *PurchaseToWmsRequest) (*PurchaseToWmsResponse, error) { + var operation models.Operation + var details []*models.OperationDetails + operation.SourceNumber = req.Number + operation.OperationDate = timex.TimeToString2(time.Now()) + operation.Number = strconv.FormatInt(time.Now().Unix(), 10) + operation.Status = constvar.OperationStatus_Ready + operation.CompanyName = req.SupplierName + warehouse, err := models.NewWarehouseSearch().First() + if err != nil { + return nil, err + } + operationType, err := models.NewOperationTypeSearch().SetWarehouseId(warehouse.Id).SetBaseOperationType(constvar.BaseOperationTypeIncoming).First() + if err != nil { + return nil, err + } + operation.OperationTypeName = operationType.Name + operation.OperationTypeId = operationType.Id + location, err := models.NewLocationSearch().SetID(warehouse.LocationId).First() + if err != nil { + return nil, err + } + operation.ToLocationID = location.Id + first, err := models.NewLocationSearch().SetType(int(constvar.LocationTypeVendor)).First() + if err != nil { + return nil, err + } + operation.FromLocationID = first.Id + operation.BaseOperationType = constvar.BaseOperationTypeIncoming + for _, product := range req.Product { + var detail models.OperationDetails + detail.ProductId = product.Id + detail.Amount = decimal.NewFromInt(product.Amount) + details = append(details, &detail) + } + err = models.NewOperationSearch().Create(&operation) + return new(PurchaseToWmsResponse), err +} -- Gitblit v1.8.0