From 27be7a2c517404e4622470edf7b83b13129220ff Mon Sep 17 00:00:00 2001 From: jiangshuai <291802688@qq.com> Date: 星期五, 08 十二月 2023 11:14:04 +0800 Subject: [PATCH] merge conflicts --- models/scrap.go | 6 proto/inventory_order.proto | 39 + response/report_forms_response.go | 1 service/input_history_search.go | 64 + models/move_history.go | 4 controllers/report_forms_controller.go | 13 models/operation.go | 2 docs/swagger.yaml | 24 proto/product_inventory/server.go | 4 pkg/blevex/bleve.go | 11 proto/product_inventory/product_inventory.pb.go | 159 ++-- proto/inventory_order/inventory_order.pb.go | 548 +++++++++++++++++ proto/purchase_wms/purchase_wms.pb.go | 225 ++++--- proto/supplier/client.go | 50 proto/product_inventory.proto | 3 proto/purchase_wms/server.go | 21 proto/inventory_order/server.go | 81 ++ controllers/operation.go | 156 +++- proto/init_client/init_client.go | 45 + controllers/code.go | 42 proto/inventory_order/inventory_order_grpc.pb.go | 72 ++ controllers/reorder_rule_controller.go | 43 proto/client/client.go | 43 proto/purchase_wms.proto | 4 docs/docs.go | 38 + conf/config.yaml | 4 docs/swagger.json | 36 + router/router.go | 1 constvar/const.go | 2 main.go | 28 30 files changed, 1,365 insertions(+), 404 deletions(-) diff --git a/conf/config.yaml b/conf/config.yaml index 1d5cc35..2985275 100644 --- a/conf/config.yaml +++ b/conf/config.yaml @@ -25,5 +25,5 @@ storePath: uploads/file grpcServer: apsAddr: 192.168.20.119:9091 - crmAddr: :9092 - srmAddr: 192.168.20.118:9093 + crmAddr: 192.168.20.119:9092 + srmAddr: 192.168.20.119:9093 diff --git a/constvar/const.go b/constvar/const.go index bcbb44c..b8b90e3 100644 --- a/constvar/const.go +++ b/constvar/const.go @@ -176,7 +176,7 @@ OperationStatus_Waiting //姝e湪绛夊緟 OperationStatus_Ready //灏辩华 OperationStatus_Finish //瀹屾垚 - OperationStatus_Cancel //瀹屾垚 + OperationStatus_Cancel //鍙栨秷 ) type PostType int diff --git a/controllers/code.go b/controllers/code.go index f293bb3..f539fc4 100644 --- a/controllers/code.go +++ b/controllers/code.go @@ -3,38 +3,36 @@ import ( "github.com/gin-gonic/gin" "github.com/spf13/cast" - "google.golang.org/grpc" - "google.golang.org/grpc/credentials/insecure" - "wms/conf" cd "wms/extend/code" "wms/extend/util" "wms/models" "wms/pkg/contextx" "wms/pkg/logx" "wms/proto/code" + "wms/proto/init_client" "wms/request" ) type CodeApi struct{} -var ( - codeServiceConn *grpc.ClientConn -) - -func InitCodeServiceConn() { - var err error - codeServiceConn, err = grpc.Dial(conf.GrpcServerConf.ApsAddr, grpc.WithTransportCredentials(insecure.NewCredentials())) - if err != nil { - logx.Errorf("grpc dial product service error: %v", err.Error()) - return - } -} - -func CloseCodeServiceConn() { - if codeServiceConn != nil { - codeServiceConn.Close() - } -} +//var ( +// codeServiceConn *grpc.ClientConn +//) +// +//func InitCodeServiceConn() { +// var err error +// codeServiceConn, err = grpc.Dial(conf.GrpcServerConf.ApsAddr, grpc.WithTransportCredentials(insecure.NewCredentials())) +// if err != nil { +// logx.Errorf("grpc dial product service error: %v", err.Error()) +// return +// } +//} +// +//func CloseCodeServiceConn() { +// if codeServiceConn != nil { +// codeServiceConn.Close() +// } +//} // GetCodeList // @@ -54,7 +52,7 @@ params.CodeStandID = c.Query("codeStandID") params.Name = c.Query("name") params.Type = c.Query("type") - client := code.NewCodeServiceClient(codeServiceConn) + client := code.NewCodeServiceClient(init_client.ApsConn) list, err := client.GetCodeList(ctx.GetCtx(), &code.GetCodeListRequest{ Page: cast.ToInt32(params.Page), PageSize: cast.ToInt32(params.PageSize), diff --git a/controllers/operation.go b/controllers/operation.go index aea483f..75f6c38 100644 --- a/controllers/operation.go +++ b/controllers/operation.go @@ -8,15 +8,12 @@ "github.com/gin-gonic/gin" "github.com/shopspring/decimal" "github.com/xuri/excelize/v2" - "google.golang.org/grpc" - "google.golang.org/grpc/credentials/insecure" "gorm.io/gorm" "os" "sort" "strconv" "strings" "time" - "wms/conf" "wms/constvar" "wms/extend/code" "wms/extend/util" @@ -25,10 +22,13 @@ "wms/pkg/logx" "wms/pkg/structx" "wms/proto/client" + "wms/proto/init_client" + "wms/proto/inventory_order" "wms/proto/product_inventory" "wms/proto/purchase_wms" "wms/proto/supplier" "wms/request" + "wms/service" "wms/utils/http" "wms/utils/upload" ) @@ -169,6 +169,30 @@ } return nil +} + +// GetOperationInfo +// @Tags 鍏ュ簱/鍑哄簱 +// @Summary 鍏ュ簱/鍑哄簱鍒楄〃 +// @Produce application/json +// +// @Param id path string true "id" +// +// @Success 200 {object} util.Response "鎴愬姛" +// @Router /api-wms/v1/operation/getOperationInfo/{id} [get] +func (slf OperationController) GetOperationInfo(c *gin.Context) { + number := c.Param("id") + if number == "" { + util.ResponseFormat(c, code.RequestParamError, "鍙傛暟瑙f瀽澶辫触锛屽弬鏁颁笉鑳戒负绌�") + return + } + id, _ := strconv.Atoi(number) + operation, err := models.NewOperationSearch().SetID(id).SetPreload(true).First() + if err != nil { + util.ResponseFormat(c, code.RequestParamError, err.Error()) + return + } + util.ResponseFormat(c, code.Success, operation) } // List @@ -338,7 +362,7 @@ util.ResponseFormat(c, code.RequestError, "璇ュ嚭鍏ュ簱淇℃伅鏃犳硶瀹屾垚") return } - if err := models.WithTransaction(func(tx *gorm.DB) error { + err = models.WithTransaction(func(tx *gorm.DB) error { if err := models.NewOperationSearch().SetOrm(tx).SetID(id).Update(&models.Operation{Status: constvar.OperationStatus_Finish, AuditDate: time.Now().Format("2006-01-02 15:04:05")}); err != nil { return err @@ -498,8 +522,8 @@ return err } } - if operation.SourceNumber != "" { - go UpdatePurchaseStatus(operation.SourceNumber) + if operation.Source != "" { + go UpdatePurchaseStatus(operation.Source, operation.SourceNumber) } } @@ -531,10 +555,13 @@ } locAmount, res := models.NewLocationProductAmountSearch(). SetProductId(v.ID). - SetLocationId(operation.ToLocationID). + SetLocationId(operation.FromLocationID). FirstRes() if res.Error != nil { - return err + if res.Error == gorm.ErrRecordNotFound { + return errors.New("褰撳墠浠撳簱娌℃湁璇ヤ骇鍝�,璇峰厛鍏ュ簱") + } + return res.Error } if locAmount.Amount.LessThan(value) { return errors.New(fmt.Sprintf("浜у搧锛�%v,搴撳瓨锛�%v,鍑哄簱锛�%v,鏁伴噺涓嶅锛屾棤娉曞畬鎴愬嚭搴撴搷浣�", v.Name, v.Amount.String(), value.String())) @@ -544,8 +571,8 @@ return err } } - if operation.SourceNumber != "" { - go UpdateSalesDetailStatus(operation.SourceNumber) + if operation.Source != "" { + go UpdateOutStatus(operation.Source, operation.Number, 4) } } @@ -698,7 +725,8 @@ } } return nil - }); err != nil { + }) + if err != nil { util.ResponseFormat(c, code.RequestError, err.Error()) return } @@ -708,6 +736,7 @@ func AddMoveHistory(operationList []*models.Operation, db *gorm.DB) error { var histories []*models.MoveHistory + operationMap := make(map[int]*models.Operation, len(operationList)) for _, operation := range operationList { for _, v := range operation.Details { history := &models.MoveHistory{ @@ -716,6 +745,7 @@ OperationTypeId: operation.OperationTypeId, OperationTypeName: operation.OperationTypeName, OperationId: operation.Id, + ProductId: v.ProductId, ProductName: v.Product.Name, Amount: v.Amount, Unit: v.Product.Unit, @@ -727,57 +757,75 @@ } histories = append(histories, history) } + operationMap[operation.Id] = operation } if err := db.Model(&models.MoveHistory{}).Create(&histories).Error; err != nil { return err } + for _, history := range histories { + service.AddNewHistoryReportRecord(history, operationMap[history.OperationId]) + } return nil } -var ( - ProductInventoryServiceConn *grpc.ClientConn - PurchaseServiceConn *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 +// } +//} +// +//func CloseProductInventoryServiceConn() { +// if ProductInventoryServiceConn != nil { +// ProductInventoryServiceConn.Close() +// } +// if PurchaseServiceConn != nil { +// PurchaseServiceConn.Close() +// } +//} -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 +func UpdateOutStatus(source, number string, status int64) { + if source == "CRM" { + cl := product_inventory.NewProductInventoryServiceClient(init_client.CrmConn) + _, err := cl.UpdateSalesDetailStatus(context.Background(), &product_inventory.UpdateSalesDetailStatusRequest{ + Number: number, + SalesDetailStatus: "宸插嚭搴�", + }) + if err != nil { + logx.Errorf("grpc dial UpdateSalesDetailStatus service error: %v", err) + } } - 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 + if source == "APS_APPLY_MATERIAL" { + cl := inventory_order.NewInventoryOrderServiceClient(init_client.ApsConn) + _, err := cl.UpdateMaterialApplyStatus(context.Background(), &inventory_order.UpdateMaterialApplyStatusRequest{ + Number: number, + Status: status, + }) + if err != nil { + logx.Errorf("grpc dial UpdateSalesDetailStatus service error: %v", err) + } } } -func CloseProductInventoryServiceConn() { - if ProductInventoryServiceConn != nil { - ProductInventoryServiceConn.Close() - } - if PurchaseServiceConn != nil { - PurchaseServiceConn.Close() - } -} - -func UpdateSalesDetailStatus(number string) { - client := product_inventory.NewProductInventoryServiceClient(ProductInventoryServiceConn) - _, err := client.UpdateSalesDetailStatus(context.Background(), &product_inventory.UpdateSalesDetailStatusRequest{ - Number: number, - SalesDetailStatus: "宸插嚭搴�", - }) - if err != nil { - logx.Errorf("grpc dial UpdateSalesDetailStatus service error: %v", err) - } -} - -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) +func UpdatePurchaseStatus(source, number string) { + if source == "SRM_PURCHASE" { + cl := purchase_wms.NewPurchaseServiceClient(init_client.SrmConn) + _, err := cl.UpdatePurchaseStatus(context.Background(), &purchase_wms.UpdatePurchaseStatusRequest{Number: number}) + if err != nil { + logx.Errorf("grpc dial UpdatePurchaseStatus service error: %v", err) + } } } @@ -859,6 +907,10 @@ if err := models.NewOperationSearch().SetID(operation.Id).Save(operation); err != nil { util.ResponseFormat(c, code.SaveFail, err.Error()) return + } + //鏇存柊aps鐗╂枡鐢宠鐘舵�� + if operation.Source == "APS_APPLY_MATERIAL" { + go UpdateOutStatus(operation.Source, operation.Number, 3) } util.ResponseFormat(c, code.Success, "鎿嶄綔鎴愬姛") } @@ -1079,7 +1131,7 @@ // // @Router /api-wms/v1/operation/getSupplierList [get] func (slf OperationController) GetSupplierList(c *gin.Context) { - cli := supplier.NewSupplierServiceClient(supplier.SupplierConn) + cli := supplier.NewSupplierServiceClient(init_client.SrmConn) resp, err := cli.GetSupplierList(c, &supplier.SupplierListRequest{Status: 1}) if err != nil { util.ResponseFormat(c, code.RequestParamError, "grpc璋冪敤澶辫触:"+err.Error()) @@ -1097,7 +1149,7 @@ // // @Router /api-wms/v1/operation/getClientList [get] func (slf OperationController) GetClientList(c *gin.Context) { - cli := client.NewClientServiceClient(client.ClientConn) + cli := client.NewClientServiceClient(init_client.CrmConn) resp, err := cli.GetClientList(c, &client.ClientListRequest{}) if err != nil { util.ResponseFormat(c, code.RequestParamError, "grpc璋冪敤澶辫触:"+err.Error()) diff --git a/controllers/reorder_rule_controller.go b/controllers/reorder_rule_controller.go index 13002bd..d1fce38 100644 --- a/controllers/reorder_rule_controller.go +++ b/controllers/reorder_rule_controller.go @@ -3,19 +3,16 @@ import ( "github.com/gin-gonic/gin" "github.com/shopspring/decimal" - "google.golang.org/grpc" - "google.golang.org/grpc/credentials/insecure" "gorm.io/gorm" "strconv" "strings" "time" - "wms/conf" "wms/constvar" "wms/extend/code" "wms/extend/util" "wms/models" - "wms/pkg/logx" "wms/pkg/timex" + "wms/proto/init_client" "wms/proto/inventory_order" "wms/proto/purchase_wms" "wms/request" @@ -260,22 +257,22 @@ util.ResponseFormat(c, code.Success, "鏇存柊鎴愬姛") } -var InventoryOrderServiceConn *grpc.ClientConn - -func InitInventoryOrderServiceConn() { - var err error - InventoryOrderServiceConn, err = grpc.Dial(conf.GrpcServerConf.ApsAddr, grpc.WithTransportCredentials(insecure.NewCredentials())) - if err != nil { - logx.Errorf("grpc dial product service error: %v", err.Error()) - return - } -} - -func CloseInventoryOrderServiceConn() { - if InventoryOrderServiceConn != nil { - InventoryOrderServiceConn.Close() - } -} +//var InventoryOrderServiceConn *grpc.ClientConn +// +//func InitInventoryOrderServiceConn() { +// var err error +// InventoryOrderServiceConn, err = grpc.Dial(conf.GrpcServerConf.ApsAddr, grpc.WithTransportCredentials(insecure.NewCredentials())) +// if err != nil { +// logx.Errorf("grpc dial product service error: %v", err.Error()) +// return +// } +//} +// +//func CloseInventoryOrderServiceConn() { +// if InventoryOrderServiceConn != nil { +// InventoryOrderServiceConn.Close() +// } +//} // OrderAgain // @Tags 閲嶈璐ц鍒� @@ -291,7 +288,7 @@ return } if params.Route == "閲囪喘" { - client := purchase_wms.NewPurchaseServiceClient(PurchaseServiceConn) + client := purchase_wms.NewPurchaseServiceClient(init_client.SrmConn) resp, err := client.GetSupplierListByProductId(c, &purchase_wms.GetSupplierListByProductIdRequest{ProductId: params.ProductId}) if err != nil { util.ResponseFormat(c, code.RequestParamError, "grpc璋冪敤澶辫触") @@ -300,7 +297,7 @@ util.ResponseFormat(c, code.Success, resp.List) return } - client := inventory_order.NewInventoryOrderServiceClient(InventoryOrderServiceConn) + client := inventory_order.NewInventoryOrderServiceClient(init_client.ApsConn) order, err := client.CreateNewOrder(c, &inventory_order.CreateNewOrderRequest{ OrderNumber: params.OrderNumber.IntPart(), Unit: params.Unit, @@ -368,7 +365,7 @@ // @Router /api-wms/v1/reorderRule/submitOrder [post] func (slf ReorderRuleController) SubmitOrder(c *gin.Context) { var params models.ReorderRule - client := purchase_wms.NewPurchaseServiceClient(PurchaseServiceConn) + client := purchase_wms.NewPurchaseServiceClient(init_client.SrmConn) resp, err := client.CreatePurchaseByWms(c, &purchase_wms.CreatePurchaseByWmsRequest{ SupplierId: params.SupplierId, ProductId: params.ProductId, diff --git a/controllers/report_forms_controller.go b/controllers/report_forms_controller.go index 2489b45..9575819 100644 --- a/controllers/report_forms_controller.go +++ b/controllers/report_forms_controller.go @@ -260,11 +260,12 @@ } if len(ids) == 0 { util.ResponseFormatList(c, code.Success, result, 0) + return } } detailsSearch.Orm = detailsSearch.Orm.Model(&models.MoveHistory{}). - Select("number, updated_at as date, product_name as product_name, from_location_id," + + Select("number, updated_at as date, product_name as product_name, from_location_id, operation_id," + "to_location_id, amount, unit, operator as contacted_name, base_operation_type, weight, product_id, from_location, to_location").Order("id desc") if len(ids) > 0 { detailsSearch.Orm = detailsSearch.Orm.Where("id in ?", ids) @@ -272,6 +273,16 @@ if params.BaseOperationType != 0 { detailsSearch.Orm = detailsSearch.Orm.Where("base_operation_type = ?", params.BaseOperationType) } + var t int64 + err = detailsSearch.Orm.Count(&t).Error + if err != nil { + util.ResponseFormat(c, code.RequestParamError, fmt.Errorf("鏌ヨ鎬绘潯鏁板け璐�: %v", err)) + return + } + total = uint64(t) + if params.Page*params.PageSize > 0 { + detailsSearch.Orm = detailsSearch.Orm.Offset((params.Page - 1) * params.PageSize).Limit(params.PageSize) + } err = detailsSearch.Orm.Find(&result).Error if err != nil { util.ResponseFormat(c, code.RequestParamError, fmt.Errorf("鏌ヨ鎿嶄綔鏄庣粏澶辫触: %v", err)) diff --git a/docs/docs.go b/docs/docs.go index 1ea6fb1..d04b932 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -1150,6 +1150,34 @@ } } }, + "/api-wms/v1/operation/getOperationInfo/{id}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "鍏ュ簱/鍑哄簱" + ], + "summary": "鍏ュ簱/鍑哄簱鍒楄〃", + "parameters": [ + { + "type": "string", + "description": "id", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "鎴愬姛", + "schema": { + "$ref": "#/definitions/util.Response" + } + } + } + } + }, "/api-wms/v1/operation/getSupplierList": { "get": { "produces": [ @@ -2708,7 +2736,7 @@ 5 ], "x-enum-comments": { - "OperationStatus_Cancel": "瀹屾垚", + "OperationStatus_Cancel": "鍙栨秷", "OperationStatus_Draft": "鑽夌", "OperationStatus_Finish": "瀹屾垚", "OperationStatus_Ready": "灏辩华", @@ -3341,6 +3369,9 @@ "type": "string" }, "receiverPhone": { + "type": "string" + }, + "source": { "type": "string" }, "sourceNumber": { @@ -4628,6 +4659,9 @@ "description": "鍗曞彿", "type": "string" }, + "operationId": { + "type": "integer" + }, "productId": { "type": "string" }, @@ -4754,6 +4788,8 @@ Description: "", InfoInstanceName: "swagger", SwaggerTemplate: docTemplate, + LeftDelim: "{{", + RightDelim: "}}", } func init() { diff --git a/docs/swagger.json b/docs/swagger.json index 81393c2..aa784ae 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -1138,6 +1138,34 @@ } } }, + "/api-wms/v1/operation/getOperationInfo/{id}": { + "get": { + "produces": [ + "application/json" + ], + "tags": [ + "鍏ュ簱/鍑哄簱" + ], + "summary": "鍏ュ簱/鍑哄簱鍒楄〃", + "parameters": [ + { + "type": "string", + "description": "id", + "name": "id", + "in": "path", + "required": true + } + ], + "responses": { + "200": { + "description": "鎴愬姛", + "schema": { + "$ref": "#/definitions/util.Response" + } + } + } + } + }, "/api-wms/v1/operation/getSupplierList": { "get": { "produces": [ @@ -2696,7 +2724,7 @@ 5 ], "x-enum-comments": { - "OperationStatus_Cancel": "瀹屾垚", + "OperationStatus_Cancel": "鍙栨秷", "OperationStatus_Draft": "鑽夌", "OperationStatus_Finish": "瀹屾垚", "OperationStatus_Ready": "灏辩华", @@ -3329,6 +3357,9 @@ "type": "string" }, "receiverPhone": { + "type": "string" + }, + "source": { "type": "string" }, "sourceNumber": { @@ -4616,6 +4647,9 @@ "description": "鍗曞彿", "type": "string" }, + "operationId": { + "type": "integer" + }, "productId": { "type": "string" }, diff --git a/docs/swagger.yaml b/docs/swagger.yaml index b481d9a..d136a20 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -180,7 +180,7 @@ - 5 type: integer x-enum-comments: - OperationStatus_Cancel: 瀹屾垚 + OperationStatus_Cancel: 鍙栨秷 OperationStatus_Draft: 鑽夌 OperationStatus_Finish: 瀹屾垚 OperationStatus_Ready: 灏辩华 @@ -635,6 +635,8 @@ receiverName: type: string receiverPhone: + type: string + source: type: string sourceNumber: description: 婧愬崟鍙� @@ -1519,6 +1521,8 @@ number: description: 鍗曞彿 type: string + operationId: + type: integer productId: type: string productName: @@ -2292,6 +2296,24 @@ summary: 鑾峰彇鐗╂祦鍏徃鍒楄〃 tags: - 鍏ュ簱/鍑哄簱 + /api-wms/v1/operation/getOperationInfo/{id}: + get: + parameters: + - description: id + in: path + name: id + required: true + type: string + produces: + - application/json + responses: + "200": + description: 鎴愬姛 + schema: + $ref: '#/definitions/util.Response' + summary: 鍏ュ簱/鍑哄簱鍒楄〃 + tags: + - 鍏ュ簱/鍑哄簱 /api-wms/v1/operation/getSupplierList: get: produces: diff --git a/main.go b/main.go index 91c2eeb..1801bbf 100644 --- a/main.go +++ b/main.go @@ -11,13 +11,12 @@ "syscall" "time" "wms/conf" - "wms/controllers" "wms/models" "wms/pkg/logx" - "wms/proto/client" + "wms/proto/init_client" + "wms/proto/inventory_order" "wms/proto/product_inventory" "wms/proto/purchase_wms" - "wms/proto/supplier" "wms/router" "wms/service" ) @@ -48,11 +47,12 @@ } go shutdown(server) //鍚姩grpc瀹㈡埛绔� - go controllers.InitInventoryOrderServiceConn() - go controllers.InitProductInventoryServiceConn() - go controllers.InitCodeServiceConn() - go supplier.InitConn() - go client.InitConn() + //go controllers.InitInventoryOrderServiceConn() + //go controllers.InitProductInventoryServiceConn() + //go controllers.InitCodeServiceConn() + //go supplier.InitConn() + //go client.InitConn() + go init_client.InitClient() //鍚姩grpc鏈嶅姟 go func() { ln, err := net.Listen("tcp", ":"+conf.WebConf.GrpcPort) @@ -65,6 +65,7 @@ //todo 娣诲姞鍏蜂綋鏈嶅姟 product_inventory.RegisterProductInventoryServiceServer(s, &product_inventory.Server{}) purchase_wms.RegisterPurchaseServiceServer(s, &purchase_wms.Server{}) + inventory_order.RegisterInventoryOrderServiceServer(s, &inventory_order.Server{}) err = s.Serve(ln) if err != nil { logx.Errorf("grpc server init error: %v", err.Error()) @@ -88,11 +89,12 @@ ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) defer cancel() - controllers.CloseInventoryOrderServiceConn() - controllers.CloseProductInventoryServiceConn() - controllers.CloseCodeServiceConn() - supplier.CloseConn() - client.CloseConn() + //controllers.CloseInventoryOrderServiceConn() + //controllers.CloseProductInventoryServiceConn() + //controllers.CloseCodeServiceConn() + //supplier.CloseConn() + //client.CloseConn() + init_client.CloseClient() // 鍏抽棴HTTP鏈嶅姟鍣� if err := server.Shutdown(ctx); err != nil { logx.Infof("鏈嶅姟浼橀泤閫�鍑哄け璐�: %v", err) diff --git a/models/move_history.go b/models/move_history.go index ffc1b61..ef75cbd 100644 --- a/models/move_history.go +++ b/models/move_history.go @@ -17,8 +17,8 @@ BaseOperationType constvar.BaseOperationType `json:"baseOperationType" gorm:"type:tinyint;not null;comment:鍩虹浣滀笟绫诲瀷"` //鍩虹浣滀笟绫诲瀷 OperationTypeId int `json:"operationTypeId" gorm:"type:int;not null;comment:浣滀笟绫诲瀷id"` //浣滀笟绫诲瀷id OperationTypeName string `json:"operationTypeName" gorm:"type:varchar(127);not null;comment:浣滀笟绫诲瀷鍚嶇О"` //浣滀笟绫诲瀷鍚嶇О - OperationId int `json:"operationRecordId" gorm:"type:int;not null;comment:鎿嶄綔id"` //鎿嶄綔id - ProductId int `json:"productId" gorm:"type:int;not null;comment:浜у搧id"` //浜у搧id + OperationId int `json:"operationId" gorm:"type:int;not null;comment:鎿嶄綔id"` //鎿嶄綔id + ProductId string `json:"productId" gorm:"type:varchar(255);not null;comment:浜у搧id"` //浜у搧id ProductName string `json:"productName" gorm:"type:varchar(255);not null;comment:浜у搧鍚嶇О"` //浜у搧鍚嶇О Amount decimal.Decimal `json:"amount" gorm:"type:decimal(20,2);not null;comment:鏁伴噺"` //鏁伴噺 Unit string `json:"unit" gorm:"type:char(10);not null;comment:鍗曚綅"` //鍗曚綅 diff --git a/models/operation.go b/models/operation.go index 1996968..c866d0f 100644 --- a/models/operation.go +++ b/models/operation.go @@ -33,6 +33,7 @@ WaybillNumber string `json:"waybillNumber" gorm:"type:varchar(255);comment:杩愬崟鍙�"` //杩愬崟鍙� Weight decimal.Decimal `gorm:"type:decimal(20,2);comment:閲嶉噺" json:"weight"` //閲嶉噺 LogisticWeight decimal.Decimal `gorm:"type:decimal(20,2);comment:鐗╂祦閲嶉噺" json:"logisticWeight"` //鐗╂祦閲嶉噺 + Source string `json:"source" gorm:"type:varchar(255);comment:鏉ユ簮绯荤粺,鐢ㄤ簬杩斿洖淇敼鐘舵��"` Details []*OperationDetails `json:"details" gorm:"foreignKey:OperationID;references:Id"` BaseOperationType constvar.BaseOperationType `json:"baseOperationType" gorm:"type:tinyint;not null;comment:鍩虹浣滀笟绫诲瀷"` //鍩虹浣滀笟绫诲瀷 @@ -53,6 +54,7 @@ Preload bool Disuse bool Ids []int + Numbers []string } ) diff --git a/models/scrap.go b/models/scrap.go index 5856b29..144743a 100644 --- a/models/scrap.go +++ b/models/scrap.go @@ -15,9 +15,9 @@ Number string `json:"number" gorm:"column:number;type:varchar(255)"` //鍗曞彿 Status int `json:"status" gorm:"type:tinyint;not null;comment:鐘舵��"` //鐘舵�� - ProductId int `json:"productId" gorm:"type:int;not null;comment:浜у搧id"` //浜у搧id - ProductName string `json:"productName" gorm:"type:varchar(255);not null;comment:浜у搧鍚嶇О"` //浜у搧鍚嶇О - Quantity decimal.Decimal `json:"quantity" gorm:"type:decimal(20,2);not null;comment:鏁伴噺"` //鏁伴噺 + ProductId int `json:"productId" gorm:"type:int;not null;comment:浜у搧id"` //浜у搧id + ProductName string `json:"productName" gorm:"type:varchar(255);not null;comment:浜у搧鍚嶇О"` //浜у搧鍚嶇О + Quantity decimal.Decimal `json:"quantity" gorm:"type:decimal(20,2);not null;default:0;comment:鏁伴噺"` //鏁伴噺 FromLocationId int `json:"fromLocationId" gorm:"type:int;not null;comment:婧愪綅缃甶d"` //婧愪綅缃甶d FromLocation Location `json:"fromLocation" gorm:"foreignKey:FromLocationId"` //婧愪綅缃� diff --git a/pkg/blevex/bleve.go b/pkg/blevex/bleve.go index 40b334e..08fe999 100644 --- a/pkg/blevex/bleve.go +++ b/pkg/blevex/bleve.go @@ -69,7 +69,7 @@ if err != nil { return } - req := bleve.NewSearchRequest(bleve.NewQueryStringQuery(keyword)) + req := bleve.NewSearchRequest(bleve.NewMatchQuery(keyword)) req.From = from req.Size = size res, err := index.Search(req) @@ -93,15 +93,12 @@ // Create a boolean query with a should clause for fuzzy search boolQuery := bleve.NewBooleanQuery() - - fuzzyQuery := bleve.NewFuzzyQuery(keyword) - fuzzyQuery.SetFuzziness(2) // Set the fuzziness level as needed - - boolQuery.AddShould(fuzzyQuery) + fuzzyQuery := bleve.NewMatchQuery(keyword) + boolQuery.AddMust(fuzzyQuery) // Add a must clause for category filtering for key, val := range conditions { - query := bleve.NewQueryStringQuery(fmt.Sprintf("%s:%s", key, val)) + query := bleve.NewQueryStringQuery(fmt.Sprintf("%v:%v", key, val)) boolQuery.AddMust(query) } req := bleve.NewSearchRequest(boolQuery) diff --git a/proto/client/client.go b/proto/client/client.go index 14289b3..b3be957 100644 --- a/proto/client/client.go +++ b/proto/client/client.go @@ -1,27 +1,20 @@ package client -import ( - "google.golang.org/grpc" - "google.golang.org/grpc/credentials/insecure" - "wms/conf" - "wms/pkg/logx" -) - -var ( - ClientConn *grpc.ClientConn -) - -func InitConn() { - var err error - ClientConn, err = grpc.Dial(conf.GrpcServerConf.CrmAddr, grpc.WithTransportCredentials(insecure.NewCredentials())) - if err != nil { - logx.Errorf("grpc dial product service error: %v", err.Error()) - return - } -} - -func CloseConn() { - if ClientConn != nil { - ClientConn.Close() - } -} +//var ( +// ClientConn *grpc.ClientConn +//) +// +//func InitConn() { +// var err error +// ClientConn, err = grpc.Dial(conf.GrpcServerConf.CrmAddr, grpc.WithTransportCredentials(insecure.NewCredentials())) +// if err != nil { +// logx.Errorf("grpc dial product service error: %v", err.Error()) +// return +// } +//} +// +//func CloseConn() { +// if ClientConn != nil { +// ClientConn.Close() +// } +//} diff --git a/proto/init_client/init_client.go b/proto/init_client/init_client.go new file mode 100644 index 0000000..d0acfb7 --- /dev/null +++ b/proto/init_client/init_client.go @@ -0,0 +1,45 @@ +package init_client + +import ( + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" + "wms/conf" + "wms/pkg/logx" +) + +var ( + ApsConn *grpc.ClientConn + CrmConn *grpc.ClientConn + SrmConn *grpc.ClientConn +) + +func InitClient() { + var err error + ApsConn, err = grpc.Dial(conf.GrpcServerConf.ApsAddr, grpc.WithTransportCredentials(insecure.NewCredentials())) + if err != nil { + logx.Errorf("grpc dial product service error: %v", err.Error()) + return + } + CrmConn, err = grpc.Dial(conf.GrpcServerConf.CrmAddr, grpc.WithTransportCredentials(insecure.NewCredentials())) + if err != nil { + logx.Errorf("grpc dial product service error: %v", err.Error()) + return + } + SrmConn, err = grpc.Dial(conf.GrpcServerConf.SrmAddr, grpc.WithTransportCredentials(insecure.NewCredentials())) + if err != nil { + logx.Errorf("grpc dial product service error: %v", err.Error()) + return + } +} + +func CloseClient() { + if ApsConn != nil { + ApsConn.Close() + } + if CrmConn != nil { + CrmConn.Close() + } + if SrmConn != nil { + SrmConn.Close() + } +} diff --git a/proto/inventory_order.proto b/proto/inventory_order.proto index 113c6de..65d34d7 100644 --- a/proto/inventory_order.proto +++ b/proto/inventory_order.proto @@ -4,6 +4,8 @@ service inventoryOrderService { rpc CreateNewOrder(CreateNewOrderRequest) returns(CreateNewOrderResponse) {} + rpc CreateOperationList(CreateOperationListRequest) returns(CreateOperationListResponse) {} + rpc UpdateMaterialApplyStatus(UpdateMaterialApplyStatusRequest) returns(UpdateMaterialApplyStatusResponse) {} } message CreateNewOrderRequest{ @@ -17,4 +19,41 @@ int32 Code = 1; string Msg = 2; string OrderId = 3; +} + +//-------------------------------------------------------CreateOperationList------------------------------------ + +message OperationProduct { + string ProductNumber = 1; + int64 Amount = 2; +} + +message OperationList { + string SourceNumber = 1; + repeated OperationProduct Products = 2; +} + +message CreateOperationListRequest{ + int64 OperationType = 1; + string Source = 2; + repeated OperationList List = 3; +} + +message OperationResponse{ + string WorkOrderId = 1; + string Number = 2; +} + +message CreateOperationListResponse{ + repeated OperationResponse List = 1; +} + +//--------------------------------------------------UpdateMaterialApplyStatus----------------------------------- + +message UpdateMaterialApplyStatusRequest{ + string Number = 1; + int64 Status = 2; +} + +message UpdateMaterialApplyStatusResponse{ } \ 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 6fe5871..c4c2590 100644 --- a/proto/inventory_order/inventory_order.pb.go +++ b/proto/inventory_order/inventory_order.pb.go @@ -154,6 +154,374 @@ return "" } +type OperationProduct struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + ProductNumber string `protobuf:"bytes,1,opt,name=ProductNumber,proto3" json:"ProductNumber,omitempty"` + Amount int64 `protobuf:"varint,2,opt,name=Amount,proto3" json:"Amount,omitempty"` +} + +func (x *OperationProduct) Reset() { + *x = OperationProduct{} + if protoimpl.UnsafeEnabled { + mi := &file_inventory_order_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *OperationProduct) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OperationProduct) ProtoMessage() {} + +func (x *OperationProduct) ProtoReflect() protoreflect.Message { + mi := &file_inventory_order_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 OperationProduct.ProtoReflect.Descriptor instead. +func (*OperationProduct) Descriptor() ([]byte, []int) { + return file_inventory_order_proto_rawDescGZIP(), []int{2} +} + +func (x *OperationProduct) GetProductNumber() string { + if x != nil { + return x.ProductNumber + } + return "" +} + +func (x *OperationProduct) GetAmount() int64 { + if x != nil { + return x.Amount + } + return 0 +} + +type OperationList struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + SourceNumber string `protobuf:"bytes,1,opt,name=SourceNumber,proto3" json:"SourceNumber,omitempty"` + Products []*OperationProduct `protobuf:"bytes,2,rep,name=Products,proto3" json:"Products,omitempty"` +} + +func (x *OperationList) Reset() { + *x = OperationList{} + if protoimpl.UnsafeEnabled { + mi := &file_inventory_order_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *OperationList) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OperationList) ProtoMessage() {} + +func (x *OperationList) ProtoReflect() protoreflect.Message { + mi := &file_inventory_order_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 OperationList.ProtoReflect.Descriptor instead. +func (*OperationList) Descriptor() ([]byte, []int) { + return file_inventory_order_proto_rawDescGZIP(), []int{3} +} + +func (x *OperationList) GetSourceNumber() string { + if x != nil { + return x.SourceNumber + } + return "" +} + +func (x *OperationList) GetProducts() []*OperationProduct { + if x != nil { + return x.Products + } + return nil +} + +type CreateOperationListRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + OperationType int64 `protobuf:"varint,1,opt,name=OperationType,proto3" json:"OperationType,omitempty"` + Source string `protobuf:"bytes,2,opt,name=Source,proto3" json:"Source,omitempty"` + List []*OperationList `protobuf:"bytes,3,rep,name=List,proto3" json:"List,omitempty"` +} + +func (x *CreateOperationListRequest) Reset() { + *x = CreateOperationListRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_inventory_order_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateOperationListRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateOperationListRequest) ProtoMessage() {} + +func (x *CreateOperationListRequest) ProtoReflect() protoreflect.Message { + mi := &file_inventory_order_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 CreateOperationListRequest.ProtoReflect.Descriptor instead. +func (*CreateOperationListRequest) Descriptor() ([]byte, []int) { + return file_inventory_order_proto_rawDescGZIP(), []int{4} +} + +func (x *CreateOperationListRequest) GetOperationType() int64 { + if x != nil { + return x.OperationType + } + return 0 +} + +func (x *CreateOperationListRequest) GetSource() string { + if x != nil { + return x.Source + } + return "" +} + +func (x *CreateOperationListRequest) GetList() []*OperationList { + if x != nil { + return x.List + } + return nil +} + +type OperationResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + WorkOrderId string `protobuf:"bytes,1,opt,name=WorkOrderId,proto3" json:"WorkOrderId,omitempty"` + Number string `protobuf:"bytes,2,opt,name=Number,proto3" json:"Number,omitempty"` +} + +func (x *OperationResponse) Reset() { + *x = OperationResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_inventory_order_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *OperationResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*OperationResponse) ProtoMessage() {} + +func (x *OperationResponse) ProtoReflect() protoreflect.Message { + mi := &file_inventory_order_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 OperationResponse.ProtoReflect.Descriptor instead. +func (*OperationResponse) Descriptor() ([]byte, []int) { + return file_inventory_order_proto_rawDescGZIP(), []int{5} +} + +func (x *OperationResponse) GetWorkOrderId() string { + if x != nil { + return x.WorkOrderId + } + return "" +} + +func (x *OperationResponse) GetNumber() string { + if x != nil { + return x.Number + } + return "" +} + +type CreateOperationListResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + List []*OperationResponse `protobuf:"bytes,1,rep,name=List,proto3" json:"List,omitempty"` +} + +func (x *CreateOperationListResponse) Reset() { + *x = CreateOperationListResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_inventory_order_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateOperationListResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateOperationListResponse) ProtoMessage() {} + +func (x *CreateOperationListResponse) ProtoReflect() protoreflect.Message { + mi := &file_inventory_order_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 CreateOperationListResponse.ProtoReflect.Descriptor instead. +func (*CreateOperationListResponse) Descriptor() ([]byte, []int) { + return file_inventory_order_proto_rawDescGZIP(), []int{6} +} + +func (x *CreateOperationListResponse) GetList() []*OperationResponse { + if x != nil { + return x.List + } + return nil +} + +type UpdateMaterialApplyStatusRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Number string `protobuf:"bytes,1,opt,name=Number,proto3" json:"Number,omitempty"` + Status int64 `protobuf:"varint,2,opt,name=Status,proto3" json:"Status,omitempty"` +} + +func (x *UpdateMaterialApplyStatusRequest) Reset() { + *x = UpdateMaterialApplyStatusRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_inventory_order_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateMaterialApplyStatusRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateMaterialApplyStatusRequest) ProtoMessage() {} + +func (x *UpdateMaterialApplyStatusRequest) ProtoReflect() protoreflect.Message { + mi := &file_inventory_order_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 UpdateMaterialApplyStatusRequest.ProtoReflect.Descriptor instead. +func (*UpdateMaterialApplyStatusRequest) Descriptor() ([]byte, []int) { + return file_inventory_order_proto_rawDescGZIP(), []int{7} +} + +func (x *UpdateMaterialApplyStatusRequest) GetNumber() string { + if x != nil { + return x.Number + } + return "" +} + +func (x *UpdateMaterialApplyStatusRequest) GetStatus() int64 { + if x != nil { + return x.Status + } + return 0 +} + +type UpdateMaterialApplyStatusResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *UpdateMaterialApplyStatusResponse) Reset() { + *x = UpdateMaterialApplyStatusResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_inventory_order_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateMaterialApplyStatusResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateMaterialApplyStatusResponse) ProtoMessage() {} + +func (x *UpdateMaterialApplyStatusResponse) ProtoReflect() protoreflect.Message { + mi := &file_inventory_order_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 UpdateMaterialApplyStatusResponse.ProtoReflect.Descriptor instead. +func (*UpdateMaterialApplyStatusResponse) Descriptor() ([]byte, []int) { + return file_inventory_order_proto_rawDescGZIP(), []int{8} +} + var File_inventory_order_proto protoreflect.FileDescriptor var file_inventory_order_proto_rawDesc = []byte{ @@ -172,12 +540,60 @@ 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, 0x18, 0x0a, 0x07, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x07, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x49, 0x64, 0x32, 0x5c, 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, + 0x28, 0x09, 0x52, 0x07, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x49, 0x64, 0x22, 0x50, 0x0a, 0x10, 0x4f, + 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x12, + 0x24, 0x0a, 0x0d, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x4e, + 0x75, 0x6d, 0x62, 0x65, 0x72, 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, 0x62, 0x0a, + 0x0d, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 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, 0x2d, 0x0a, 0x08, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x73, 0x18, 0x02, + 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x08, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, + 0x73, 0x22, 0x7e, 0x0a, 0x1a, 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, 0x12, + 0x24, 0x0a, 0x0d, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x0d, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x22, 0x0a, + 0x04, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x4f, 0x70, + 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x04, 0x4c, 0x69, 0x73, + 0x74, 0x22, 0x4d, 0x0a, 0x11, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x57, 0x6f, 0x72, 0x6b, 0x4f, 0x72, + 0x64, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x57, 0x6f, 0x72, + 0x6b, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x4e, 0x75, 0x6d, 0x62, + 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, + 0x22, 0x45, 0x0a, 0x1b, 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, 0x12, + 0x26, 0x0a, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, + 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x52, 0x04, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x52, 0x0a, 0x20, 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, 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, 0x16, 0x0a, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x03, 0x52, 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x23, 0x0a, 0x21, 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, + 0x32, 0x96, 0x02, 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, 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, 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, @@ -195,19 +611,33 @@ return file_inventory_order_proto_rawDescData } -var file_inventory_order_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_inventory_order_proto_msgTypes = make([]protoimpl.MessageInfo, 9) var file_inventory_order_proto_goTypes = []interface{}{ - (*CreateNewOrderRequest)(nil), // 0: CreateNewOrderRequest - (*CreateNewOrderResponse)(nil), // 1: CreateNewOrderResponse + (*CreateNewOrderRequest)(nil), // 0: CreateNewOrderRequest + (*CreateNewOrderResponse)(nil), // 1: CreateNewOrderResponse + (*OperationProduct)(nil), // 2: OperationProduct + (*OperationList)(nil), // 3: OperationList + (*CreateOperationListRequest)(nil), // 4: CreateOperationListRequest + (*OperationResponse)(nil), // 5: OperationResponse + (*CreateOperationListResponse)(nil), // 6: CreateOperationListResponse + (*UpdateMaterialApplyStatusRequest)(nil), // 7: UpdateMaterialApplyStatusRequest + (*UpdateMaterialApplyStatusResponse)(nil), // 8: UpdateMaterialApplyStatusResponse } var file_inventory_order_proto_depIdxs = []int32{ - 0, // 0: inventoryOrderService.CreateNewOrder:input_type -> CreateNewOrderRequest - 1, // 1: inventoryOrderService.CreateNewOrder:output_type -> CreateNewOrderResponse - 1, // [1:2] is the sub-list for method output_type - 0, // [0:1] is the sub-list for method input_type - 0, // [0:0] is the sub-list for extension type_name - 0, // [0:0] is the sub-list for extension extendee - 0, // [0:0] is the sub-list for field type_name + 2, // 0: OperationList.Products:type_name -> OperationProduct + 3, // 1: CreateOperationListRequest.List:type_name -> OperationList + 5, // 2: CreateOperationListResponse.List:type_name -> OperationResponse + 0, // 3: inventoryOrderService.CreateNewOrder:input_type -> CreateNewOrderRequest + 4, // 4: inventoryOrderService.CreateOperationList:input_type -> CreateOperationListRequest + 7, // 5: inventoryOrderService.UpdateMaterialApplyStatus:input_type -> UpdateMaterialApplyStatusRequest + 1, // 6: inventoryOrderService.CreateNewOrder:output_type -> CreateNewOrderResponse + 6, // 7: inventoryOrderService.CreateOperationList:output_type -> CreateOperationListResponse + 8, // 8: inventoryOrderService.UpdateMaterialApplyStatus:output_type -> UpdateMaterialApplyStatusResponse + 6, // [6:9] is the sub-list for method output_type + 3, // [3:6] 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_inventory_order_proto_init() } @@ -240,6 +670,90 @@ return nil } } + file_inventory_order_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*OperationProduct); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_inventory_order_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*OperationList); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_inventory_order_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateOperationListRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_inventory_order_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*OperationResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_inventory_order_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateOperationListResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_inventory_order_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateMaterialApplyStatusRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_inventory_order_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateMaterialApplyStatusResponse); 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{ @@ -247,7 +761,7 @@ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_inventory_order_proto_rawDesc, NumEnums: 0, - NumMessages: 2, + NumMessages: 9, 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 eaeb0a2..a5383bc 100644 --- a/proto/inventory_order/inventory_order_grpc.pb.go +++ b/proto/inventory_order/inventory_order_grpc.pb.go @@ -19,6 +19,8 @@ // 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 InventoryOrderServiceClient interface { CreateNewOrder(ctx context.Context, in *CreateNewOrderRequest, opts ...grpc.CallOption) (*CreateNewOrderResponse, error) + CreateOperationList(ctx context.Context, in *CreateOperationListRequest, opts ...grpc.CallOption) (*CreateOperationListResponse, error) + UpdateMaterialApplyStatus(ctx context.Context, in *UpdateMaterialApplyStatusRequest, opts ...grpc.CallOption) (*UpdateMaterialApplyStatusResponse, error) } type inventoryOrderServiceClient struct { @@ -38,11 +40,31 @@ return out, nil } +func (c *inventoryOrderServiceClient) CreateOperationList(ctx context.Context, in *CreateOperationListRequest, opts ...grpc.CallOption) (*CreateOperationListResponse, error) { + out := new(CreateOperationListResponse) + err := c.cc.Invoke(ctx, "/inventoryOrderService/CreateOperationList", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *inventoryOrderServiceClient) UpdateMaterialApplyStatus(ctx context.Context, in *UpdateMaterialApplyStatusRequest, opts ...grpc.CallOption) (*UpdateMaterialApplyStatusResponse, error) { + out := new(UpdateMaterialApplyStatusResponse) + err := c.cc.Invoke(ctx, "/inventoryOrderService/UpdateMaterialApplyStatus", 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 type InventoryOrderServiceServer interface { CreateNewOrder(context.Context, *CreateNewOrderRequest) (*CreateNewOrderResponse, error) + CreateOperationList(context.Context, *CreateOperationListRequest) (*CreateOperationListResponse, error) + UpdateMaterialApplyStatus(context.Context, *UpdateMaterialApplyStatusRequest) (*UpdateMaterialApplyStatusResponse, error) mustEmbedUnimplementedInventoryOrderServiceServer() } @@ -52,6 +74,12 @@ func (UnimplementedInventoryOrderServiceServer) CreateNewOrder(context.Context, *CreateNewOrderRequest) (*CreateNewOrderResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method CreateNewOrder not implemented") +} +func (UnimplementedInventoryOrderServiceServer) CreateOperationList(context.Context, *CreateOperationListRequest) (*CreateOperationListResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateOperationList not implemented") +} +func (UnimplementedInventoryOrderServiceServer) UpdateMaterialApplyStatus(context.Context, *UpdateMaterialApplyStatusRequest) (*UpdateMaterialApplyStatusResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateMaterialApplyStatus not implemented") } func (UnimplementedInventoryOrderServiceServer) mustEmbedUnimplementedInventoryOrderServiceServer() {} @@ -84,6 +112,42 @@ return interceptor(ctx, in, info, handler) } +func _InventoryOrderService_CreateOperationList_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateOperationListRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InventoryOrderServiceServer).CreateOperationList(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/inventoryOrderService/CreateOperationList", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InventoryOrderServiceServer).CreateOperationList(ctx, req.(*CreateOperationListRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _InventoryOrderService_UpdateMaterialApplyStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateMaterialApplyStatusRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InventoryOrderServiceServer).UpdateMaterialApplyStatus(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/inventoryOrderService/UpdateMaterialApplyStatus", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InventoryOrderServiceServer).UpdateMaterialApplyStatus(ctx, req.(*UpdateMaterialApplyStatusRequest)) + } + 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) @@ -95,6 +159,14 @@ MethodName: "CreateNewOrder", Handler: _InventoryOrderService_CreateNewOrder_Handler, }, + { + MethodName: "CreateOperationList", + Handler: _InventoryOrderService_CreateOperationList_Handler, + }, + { + MethodName: "UpdateMaterialApplyStatus", + Handler: _InventoryOrderService_UpdateMaterialApplyStatus_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "inventory_order.proto", diff --git a/proto/inventory_order/server.go b/proto/inventory_order/server.go new file mode 100644 index 0000000..998dcc7 --- /dev/null +++ b/proto/inventory_order/server.go @@ -0,0 +1,81 @@ +package inventory_order + +import ( + "context" + "github.com/shopspring/decimal" + "strconv" + "time" + "wms/constvar" + "wms/models" + "wms/pkg/timex" +) + +type Server struct { + UnimplementedInventoryOrderServiceServer +} + +func (s *Server) CreateOperationList(ctx context.Context, req *CreateOperationListRequest) (*CreateOperationListResponse, error) { + var operations []*models.Operation + warehouse, err := models.NewWarehouseSearch().First() + if err != nil { + return nil, err + } + fromLocation, err := models.NewLocationSearch().SetID(warehouse.LocationId).First() + if err != nil { + return nil, err + } + toLocation, err := models.NewLocationSearch().SetType(int(constvar.LocationTypeCustomer)).First() + if err != nil { + return nil, err + } + tp := constvar.BaseOperationTypeOutgoing + if req.OperationType == 1 { + tp = constvar.BaseOperationTypeIncoming + fromLocation, err = models.NewLocationSearch().SetType(int(constvar.LocationTypeVendor)).First() + if err != nil { + return nil, err + } + toLocation, err = models.NewLocationSearch().SetID(warehouse.LocationId).First() + if err != nil { + return nil, err + } + } + operationType, err := models.NewOperationTypeSearch().SetWarehouseId(warehouse.Id).SetBaseOperationType(tp).First() + if err != nil { + return nil, err + } + operationResp := make([]*OperationResponse, 0) + for _, list := range req.List { + var operation models.Operation + var details []*models.OperationDetails + var or OperationResponse + operation.SourceNumber = list.SourceNumber + operation.OperationDate = timex.TimeToString2(time.Now()) + operation.Number = strconv.FormatInt(time.Now().Unix(), 10) + operation.Status = constvar.OperationStatus_Ready + operation.OperationTypeName = operationType.Name + operation.OperationTypeId = operationType.Id + operation.FromLocationID = fromLocation.Id + operation.ToLocationID = toLocation.Id + operation.BaseOperationType = constvar.BaseOperationTypeOutgoing + operation.Source = req.Source + or.WorkOrderId = operation.SourceNumber + or.Number = operation.Number + operationResp = append(operationResp, &or) + if req.OperationType == 1 { + operation.BaseOperationType = constvar.BaseOperationTypeIncoming + } + for _, product := range list.Products { + var detail models.OperationDetails + detail.ProductId = product.ProductNumber + detail.Amount = decimal.NewFromInt(product.Amount) + details = append(details, &detail) + } + operation.Details = details + operations = append(operations, &operation) + } + err = models.NewOperationSearch().CreateBatch(operations) + resp := new(CreateOperationListResponse) + resp.List = operationResp + return resp, err +} diff --git a/proto/product_inventory.proto b/proto/product_inventory.proto index 7da35cb..4c6552f 100644 --- a/proto/product_inventory.proto +++ b/proto/product_inventory.proto @@ -14,7 +14,8 @@ string Address = 3;//鏀惰揣鍦板潃 string Phone = 4; int32 DeliverType = 5;//浜や粯绫诲瀷 - repeated InventoryProduct ProductList = 6; + string Source = 6; + repeated InventoryProduct ProductList = 7; } message InventoryProduct{ diff --git a/proto/product_inventory/product_inventory.pb.go b/proto/product_inventory/product_inventory.pb.go index 26c7209..d9473c7 100644 --- a/proto/product_inventory/product_inventory.pb.go +++ b/proto/product_inventory/product_inventory.pb.go @@ -30,7 +30,8 @@ Address string `protobuf:"bytes,3,opt,name=Address,proto3" json:"Address,omitempty"` //鏀惰揣鍦板潃 Phone string `protobuf:"bytes,4,opt,name=Phone,proto3" json:"Phone,omitempty"` DeliverType int32 `protobuf:"varint,5,opt,name=DeliverType,proto3" json:"DeliverType,omitempty"` //浜や粯绫诲瀷 - ProductList []*InventoryProduct `protobuf:"bytes,6,rep,name=ProductList,proto3" json:"ProductList,omitempty"` + Source string `protobuf:"bytes,6,opt,name=Source,proto3" json:"Source,omitempty"` + ProductList []*InventoryProduct `protobuf:"bytes,7,rep,name=ProductList,proto3" json:"ProductList,omitempty"` } func (x *CreateOperationRequest) Reset() { @@ -98,6 +99,13 @@ return x.DeliverType } return 0 +} + +func (x *CreateOperationRequest) GetSource() string { + if x != nil { + return x.Source + } + return "" } func (x *CreateOperationRequest) GetProductList() []*InventoryProduct { @@ -576,7 +584,7 @@ var file_product_inventory_proto_rawDesc = []byte{ 0x0a, 0x17, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, - 0x6f, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xd5, 0x01, 0x0a, 0x16, 0x43, 0x72, + 0x6f, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xed, 0x01, 0x0a, 0x16, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 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, 0x1c, 0x0a, 0x09, @@ -586,82 +594,83 @@ 0x72, 0x65, 0x73, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x50, 0x68, 0x6f, 0x6e, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x0b, 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x33, 0x0a, 0x0b, - 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x06, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x11, 0x2e, 0x49, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x50, 0x72, 0x6f, - 0x64, 0x75, 0x63, 0x74, 0x52, 0x0b, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x4c, 0x69, 0x73, - 0x74, 0x22, 0x3a, 0x0a, 0x10, 0x49, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 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, 0x09, 0x52, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x3f, 0x0a, - 0x17, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 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, 0x38, - 0x0a, 0x1e, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x50, 0x72, - 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x6e, 0x66, 0x6f, 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, 0xcd, 0x02, 0x0a, 0x0b, 0x50, 0x72, 0x6f, - 0x64, 0x75, 0x63, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, - 0x4f, 0x72, 0x64, 0x65, 0x72, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0b, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x12, - 0x0a, 0x04, 0x55, 0x6e, 0x69, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x55, 0x6e, - 0x69, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x49, 0x6e, 0x76, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x07, 0x49, 0x6e, 0x76, 0x6f, 0x69, 0x63, 0x65, 0x12, 0x18, 0x0a, 0x07, - 0x43, 0x61, 0x72, 0x72, 0x69, 0x65, 0x72, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x43, - 0x61, 0x72, 0x72, 0x69, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x57, 0x61, 0x79, 0x62, 0x69, 0x6c, - 0x6c, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x57, 0x61, 0x79, 0x62, 0x69, 0x6c, 0x6c, - 0x12, 0x1c, 0x0a, 0x09, 0x53, 0x61, 0x6c, 0x65, 0x50, 0x72, 0x69, 0x63, 0x65, 0x18, 0x08, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x09, 0x53, 0x61, 0x6c, 0x65, 0x50, 0x72, 0x69, 0x63, 0x65, 0x12, 0x18, - 0x0a, 0x07, 0x56, 0x61, 0x6c, 0x6f, 0x72, 0x65, 0x6d, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x07, 0x56, 0x61, 0x6c, 0x6f, 0x72, 0x65, 0x6d, 0x12, 0x1c, 0x0a, 0x09, 0x57, 0x61, 0x72, 0x65, - 0x68, 0x6f, 0x75, 0x73, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x57, 0x61, 0x72, - 0x65, 0x68, 0x6f, 0x75, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, - 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x28, - 0x0a, 0x0f, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, - 0x72, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, - 0x6c, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x22, 0x77, 0x0a, 0x1f, 0x47, 0x65, 0x74, 0x49, - 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, - 0x6e, 0x66, 0x6f, 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, 0x2e, 0x0a, 0x0b, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x4c, 0x69, 0x73, 0x74, - 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, - 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0b, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x4c, 0x69, 0x73, - 0x74, 0x22, 0x66, 0x0a, 0x1e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x61, 0x6c, 0x65, 0x73, - 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 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, 0x12, 0x2c, 0x0a, 0x11, 0x53, - 0x61, 0x6c, 0x65, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x53, 0x61, 0x6c, 0x65, 0x73, 0x44, 0x65, 0x74, - 0x61, 0x69, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x47, 0x0a, 0x1f, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x53, 0x61, 0x6c, 0x65, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 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, 0x32, 0xa1, 0x02, 0x0a, 0x17, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x6e, - 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x46, - 0x0a, 0x0f, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x12, 0x17, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x43, 0x72, 0x65, - 0x61, 0x74, 0x65, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x5e, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x76, + 0x0b, 0x44, 0x65, 0x6c, 0x69, 0x76, 0x65, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, 0x06, + 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x53, 0x6f, + 0x75, 0x72, 0x63, 0x65, 0x12, 0x33, 0x0a, 0x0b, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x4c, + 0x69, 0x73, 0x74, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x49, 0x6e, 0x76, 0x65, + 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x52, 0x0b, 0x50, 0x72, + 0x6f, 0x64, 0x75, 0x63, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x3a, 0x0a, 0x10, 0x49, 0x6e, 0x76, + 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 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, 0x09, 0x52, 0x06, 0x41, + 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x3f, 0x0a, 0x17, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, + 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 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, 0x38, 0x0a, 0x1e, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x6e, 0x66, - 0x6f, 0x12, 0x1f, 0x2e, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, - 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, - 0x79, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x5e, 0x0a, 0x17, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x6f, 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, 0xcd, 0x02, 0x0a, 0x0b, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x6e, 0x66, 0x6f, + 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, 0x64, + 0x12, 0x12, 0x0a, 0x04, 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, + 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x4f, 0x72, 0x64, 0x65, 0x72, 0x41, 0x6d, 0x6f, + 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x4f, 0x72, 0x64, 0x65, 0x72, + 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x55, 0x6e, 0x69, 0x74, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x55, 0x6e, 0x69, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x49, 0x6e, + 0x76, 0x6f, 0x69, 0x63, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x49, 0x6e, 0x76, + 0x6f, 0x69, 0x63, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x43, 0x61, 0x72, 0x72, 0x69, 0x65, 0x72, 0x18, + 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x43, 0x61, 0x72, 0x72, 0x69, 0x65, 0x72, 0x12, 0x18, + 0x0a, 0x07, 0x57, 0x61, 0x79, 0x62, 0x69, 0x6c, 0x6c, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x07, 0x57, 0x61, 0x79, 0x62, 0x69, 0x6c, 0x6c, 0x12, 0x1c, 0x0a, 0x09, 0x53, 0x61, 0x6c, 0x65, + 0x50, 0x72, 0x69, 0x63, 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x53, 0x61, 0x6c, + 0x65, 0x50, 0x72, 0x69, 0x63, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x56, 0x61, 0x6c, 0x6f, 0x72, 0x65, + 0x6d, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x56, 0x61, 0x6c, 0x6f, 0x72, 0x65, 0x6d, + 0x12, 0x1c, 0x0a, 0x09, 0x57, 0x61, 0x72, 0x65, 0x68, 0x6f, 0x75, 0x73, 0x65, 0x18, 0x0a, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x09, 0x57, 0x61, 0x72, 0x65, 0x68, 0x6f, 0x75, 0x73, 0x65, 0x12, 0x16, + 0x0a, 0x06, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, + 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x28, 0x0a, 0x0f, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, + 0x62, 0x6c, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0f, 0x41, 0x76, 0x61, 0x69, 0x6c, 0x61, 0x62, 0x6c, 0x65, 0x4e, 0x75, 0x6d, 0x62, 0x65, 0x72, + 0x22, 0x77, 0x0a, 0x1f, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, + 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x6e, 0x66, 0x6f, 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, 0x2e, 0x0a, 0x0b, 0x50, 0x72, 0x6f, + 0x64, 0x75, 0x63, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, + 0x2e, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x0b, 0x50, 0x72, + 0x6f, 0x64, 0x75, 0x63, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x22, 0x66, 0x0a, 0x1e, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x53, 0x61, 0x6c, 0x65, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 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, 0x12, 0x2c, 0x0a, 0x11, 0x53, 0x61, 0x6c, 0x65, 0x73, 0x44, 0x65, 0x74, 0x61, + 0x69, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x53, 0x61, 0x6c, 0x65, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, - 0x73, 0x12, 0x1f, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x61, 0x6c, 0x65, 0x73, 0x44, - 0x65, 0x74, 0x61, 0x69, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x61, 0x6c, 0x65, 0x73, + 0x73, 0x22, 0x47, 0x0a, 0x1f, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x61, 0x6c, 0x65, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x15, 0x5a, 0x13, 0x2e, 0x2f, 0x70, 0x72, 0x6f, 0x64, - 0x75, 0x63, 0x74, 0x5f, 0x69, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, + 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, 0x32, 0xa1, 0x02, 0x0a, 0x17, 0x70, + 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x53, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x46, 0x0a, 0x0f, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x17, 0x2e, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x4f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4f, 0x70, 0x65, 0x72, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x5e, + 0x0a, 0x17, 0x47, 0x65, 0x74, 0x49, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x50, 0x72, + 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x1f, 0x2e, 0x47, 0x65, 0x74, 0x49, + 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, + 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x47, 0x65, 0x74, + 0x49, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, + 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x5e, + 0x0a, 0x17, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x53, 0x61, 0x6c, 0x65, 0x73, 0x44, 0x65, 0x74, + 0x61, 0x69, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1f, 0x2e, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x53, 0x61, 0x6c, 0x65, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x53, 0x74, 0x61, + 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x53, 0x61, 0x6c, 0x65, 0x73, 0x44, 0x65, 0x74, 0x61, 0x69, 0x6c, 0x53, 0x74, + 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x15, + 0x5a, 0x13, 0x2e, 0x2f, 0x70, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x5f, 0x69, 0x6e, 0x76, 0x65, + 0x6e, 0x74, 0x6f, 0x72, 0x79, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/proto/product_inventory/server.go b/proto/product_inventory/server.go index bb375e1..28310a3 100644 --- a/proto/product_inventory/server.go +++ b/proto/product_inventory/server.go @@ -167,6 +167,10 @@ } operation.ToLocationID = first.Id operation.BaseOperationType = constvar.BaseOperationTypeOutgoing + operation.ReceiverName = req.Addressee + operation.ReceiverPhone = req.Phone + operation.ReceiverAddr = req.Address + operation.Source = req.Source if req.DeliverType == 1 { for _, product := range req.ProductList { var detail models.OperationDetails diff --git a/proto/purchase_wms.proto b/proto/purchase_wms.proto index 213f11b..c344dfd 100644 --- a/proto/purchase_wms.proto +++ b/proto/purchase_wms.proto @@ -20,12 +20,14 @@ message PurchaseToWmsRequest { string Number = 1; //閲囪喘缂栧彿 string SupplierName = 2; //渚涘簲鍟� - repeated PurchaseProduct Product = 3; + string Source = 3;//鏉ユ簮 + repeated PurchaseProduct Product = 4; } message PurchaseToWmsResponse { int32 code = 1; string message = 2; + string Warehouse = 3; } //------------------------------------------------UpdatePurchaseStatus------------------------------------- diff --git a/proto/purchase_wms/purchase_wms.pb.go b/proto/purchase_wms/purchase_wms.pb.go index 432d96e..5af5073 100644 --- a/proto/purchase_wms/purchase_wms.pb.go +++ b/proto/purchase_wms/purchase_wms.pb.go @@ -82,7 +82,8 @@ 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"` + Source string `protobuf:"bytes,3,opt,name=Source,proto3" json:"Source,omitempty"` //鏉ユ簮 + Product []*PurchaseProduct `protobuf:"bytes,4,rep,name=Product,proto3" json:"Product,omitempty"` } func (x *PurchaseToWmsRequest) Reset() { @@ -131,6 +132,13 @@ return "" } +func (x *PurchaseToWmsRequest) GetSource() string { + if x != nil { + return x.Source + } + return "" +} + func (x *PurchaseToWmsRequest) GetProduct() []*PurchaseProduct { if x != nil { return x.Product @@ -143,8 +151,9 @@ 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"` + Code int32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` + Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` + Warehouse string `protobuf:"bytes,3,opt,name=Warehouse,proto3" json:"Warehouse,omitempty"` } func (x *PurchaseToWmsResponse) Reset() { @@ -189,6 +198,13 @@ func (x *PurchaseToWmsResponse) GetMessage() string { if x != nil { return x.Message + } + return "" +} + +func (x *PurchaseToWmsResponse) GetWarehouse() string { + if x != nil { + return x.Warehouse } return "" } @@ -783,109 +799,112 @@ 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, + 0x96, 0x01, 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, 0x16, 0x0a, 0x06, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x53, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x2a, 0x0a, 0x07, + 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x18, 0x04, 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, 0x63, 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, 0x12, + 0x1c, 0x0a, 0x09, 0x57, 0x61, 0x72, 0x65, 0x68, 0x6f, 0x75, 0x73, 0x65, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x09, 0x57, 0x61, 0x72, 0x65, 0x68, 0x6f, 0x75, 0x73, 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, 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, - 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, + 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, 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, 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, + 0x73, 0x12, 0x1c, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, + 0x73, 0x65, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x1d, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, + 0x12, 0x67, 0x0a, 0x1a, 0x47, 0x65, 0x74, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x4c, + 0x69, 0x73, 0x74, 0x42, 0x79, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x64, 0x12, 0x22, + 0x2e, 0x47, 0x65, 0x74, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x4c, 0x69, 0x73, 0x74, + 0x42, 0x79, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x75, 0x70, 0x70, 0x6c, 0x69, 0x65, 0x72, + 0x4c, 0x69, 0x73, 0x74, 0x42, 0x79, 0x50, 0x72, 0x6f, 0x64, 0x75, 0x63, 0x74, 0x49, 0x64, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x52, 0x0a, 0x13, 0x43, 0x72, 0x65, + 0x61, 0x74, 0x65, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x42, 0x79, 0x57, 0x6d, 0x73, + 0x12, 0x1b, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, + 0x65, 0x42, 0x79, 0x57, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1c, 0x2e, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x42, 0x79, + 0x57, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x46, 0x0a, + 0x0f, 0x47, 0x65, 0x74, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x49, 0x6e, 0x66, 0x6f, + 0x12, 0x17, 0x2e, 0x47, 0x65, 0x74, 0x50, 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x49, 0x6e, + 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x47, 0x65, 0x74, 0x50, + 0x75, 0x72, 0x63, 0x68, 0x61, 0x73, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x10, 0x5a, 0x0e, 0x2e, 0x2f, 0x70, 0x75, 0x72, 0x63, 0x68, + 0x61, 0x73, 0x65, 0x5f, 0x77, 0x6d, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/proto/purchase_wms/server.go b/proto/purchase_wms/server.go index 173e7db..9cf3096 100644 --- a/proto/purchase_wms/server.go +++ b/proto/purchase_wms/server.go @@ -3,6 +3,7 @@ import ( "context" "github.com/shopspring/decimal" + "gorm.io/gorm" "strconv" "time" "wms/constvar" @@ -22,6 +23,7 @@ operation.Number = strconv.FormatInt(time.Now().Unix(), 10) operation.Status = constvar.OperationStatus_Ready operation.CompanyName = req.SupplierName + operation.Source = req.Source warehouse, err := models.NewWarehouseSearch().First() if err != nil { return nil, err @@ -49,6 +51,21 @@ detail.Amount = decimal.NewFromInt(product.Amount) details = append(details, &detail) } - err = models.NewOperationSearch().Create(&operation) - return new(PurchaseToWmsResponse), err + err = models.WithTransaction(func(db *gorm.DB) error { + err := models.NewOperationSearch().SetOrm(db).Create(&operation) + if err != nil { + return err + } + for _, detail := range details { + detail.OperationID = operation.Id + } + err = models.NewOperationDetailsSearch().SetOrm(db).CreateBatch(details) + return err + }) + if err != nil { + return nil, err + } + resp := new(PurchaseToWmsResponse) + resp.Warehouse = warehouse.Name + return resp, nil } diff --git a/proto/supplier/client.go b/proto/supplier/client.go index be1c71f..d261344 100644 --- a/proto/supplier/client.go +++ b/proto/supplier/client.go @@ -1,27 +1,27 @@ package supplier -import ( - "google.golang.org/grpc" - "google.golang.org/grpc/credentials/insecure" - "wms/conf" - "wms/pkg/logx" -) - -var ( - SupplierConn *grpc.ClientConn -) - -func InitConn() { - var err error - SupplierConn, err = grpc.Dial(conf.GrpcServerConf.SrmAddr, grpc.WithTransportCredentials(insecure.NewCredentials())) - if err != nil { - logx.Errorf("grpc dial product service error: %v", err.Error()) - return - } -} - -func CloseConn() { - if SupplierConn != nil { - SupplierConn.Close() - } -} +//import ( +// "google.golang.org/grpc" +// "google.golang.org/grpc/credentials/insecure" +// "wms/conf" +// "wms/pkg/logx" +//) +// +//var ( +// SupplierConn *grpc.ClientConn +//) +// +//func InitConn() { +// var err error +// SupplierConn, err = grpc.Dial(conf.GrpcServerConf.SrmAddr, grpc.WithTransportCredentials(insecure.NewCredentials())) +// if err != nil { +// logx.Errorf("grpc dial product service error: %v", err.Error()) +// return +// } +//} +// +//func CloseConn() { +// if SupplierConn != nil { +// SupplierConn.Close() +// } +//} diff --git a/response/report_forms_response.go b/response/report_forms_response.go index 4a60e50..6585587 100644 --- a/response/report_forms_response.go +++ b/response/report_forms_response.go @@ -33,6 +33,7 @@ ProductId string `json:"productId"` FromLocationId int `json:"fromLocationId"` ToLocationId int `json:"toLocationId"` + OperationId int `json:"operationId"` } type LocationForms struct { diff --git a/router/router.go b/router/router.go index bef5f29..ae57b87 100644 --- a/router/router.go +++ b/router/router.go @@ -81,6 +81,7 @@ operationAPI := r.Group(urlPrefix + "/operation") { operationAPI.POST("list", operationController.List) + operationAPI.GET("getOperationInfo/:id", operationController.GetOperationInfo) operationAPI.POST("operation", operationController.Add) operationAPI.POST("update", operationController.Update) operationAPI.DELETE("operation/:id", operationController.Delete) diff --git a/service/input_history_search.go b/service/input_history_search.go index 319d763..45803c5 100644 --- a/service/input_history_search.go +++ b/service/input_history_search.go @@ -12,14 +12,19 @@ ) type HistoryReport struct { - ID int - BaseOperationType constvar.BaseOperationType - Number string //鎿嶄綔鍗曞彿 - ProductId string //浜у搧缂栧彿 - ProductName string //浜у搧鍚嶇О - OperationTypeName string //涓氬姟鍚嶇О - FromLocation string //婧愪綅缃悕绉� - ToLocation string //鐩爣浣嶇疆鍚嶇О + ID int `json:"ID,omitempty"` + BaseOperationType constvar.BaseOperationType `json:"baseOperationType,omitempty"` + Number string `json:"number,omitempty"` //鎿嶄綔鍗曞彿 + ProductId string `json:"productId,omitempty"` //浜у搧缂栧彿 + ProductName string `json:"productName,omitempty"` //浜у搧鍚嶇О + OperationTypeName string `json:"operationTypeName,omitempty"` //涓氬姟鍚嶇О + FromLocation string `json:"fromLocation,omitempty"` //婧愪綅缃悕绉� + ToLocation string `json:"toLocation,omitempty"` //鐩爣浣嶇疆鍚嶇О + Date string `json:"date,omitempty"` //鏃ユ湡 + Company string `json:"company,omitempty"` // 渚涘簲鍟�/瀹㈡埛 + Carrier string `json:"carrier,omitempty"` //鎵胯繍鍟嗗悕绉� + WaybillNumber string `json:"waybillNumber"` //杩愬崟鍙� + ReceiverName string `json:"receiverName"` //鏀惰揣浜� } const ( @@ -36,19 +41,24 @@ return } records := make([]*models.MoveHistory, 0, 100) - reports := make([]*HistoryReport, 0, 100) err = models.NewMoveHistorySearch().Orm.FindInBatches(&records, 100, func(tx *gorm.DB, batch int) error { - err = structx.AssignTo(records, &reports) + operationIds := make([]int, 0, len(records)) + for _, record := range records { + operationIds = append(operationIds, record.OperationId) + } + + operations, err := models.NewOperationSearch().SetPreload(true).SetIds(operationIds).FindNotTotal() if err != nil { - logx.Errorf("AddNewHistoryReportRecord AssignTo err:%v", err) return err } - for _, report := range reports { - err = blevex.Add(HistoryReportIndexName, strconv.Itoa(report.ID), report) - if err != nil { - logx.Errorf("InitHistoryReportData add failed, err:%v, index:%v, data:%v", err, HistoryReportIndexName, report) - return err - } + operationMap := make(map[int]*models.Operation, len(operations)) + + for _, operation := range operations { + operationMap[operation.Id] = operation + } + + for _, record := range records { + AddNewHistoryReportRecord(record, operationMap[record.OperationId]) } return nil }).Error @@ -62,7 +72,7 @@ func SearchHistoryReport(keyword string, operationType constvar.BaseOperationType, page, pageSize int) (recordIds []int, total uint64, err error) { var ids []string from := (page - 1) * pageSize - ids, total, err = blevex.ComplexSearch(HistoryReportIndexName, keyword, map[string]interface{}{"BaseOperationType": operationType}, from, pageSize) + ids, total, err = blevex.ComplexSearch(HistoryReportIndexName, keyword, map[string]interface{}{"baseOperationType": operationType}, from, pageSize) if err != nil { return } @@ -76,19 +86,21 @@ return } -func AddNewHistoryReportRecord(moveHistoryId int) { +func AddNewHistoryReportRecord(record *models.MoveHistory, operation *models.Operation) { var report HistoryReport - record, err := models.NewMoveHistorySearch().SetID(uint(moveHistoryId)).First() - if err != nil { - logx.Errorf("AddNewHistoryReportRecord Find err:%v", err) - return - } - err = structx.AssignTo(record, &report) + err := structx.AssignTo(record, &report) if err != nil { logx.Errorf("AddNewHistoryReportRecord AssignTo err:%v", err) return } - err = blevex.Add(HistoryReportIndexName, strconv.Itoa(moveHistoryId), report) + + report.Date = record.UpdatedAt.Format("2006-01-02") + report.Carrier = operation.LogisticCompany.Name + report.Company = operation.CompanyName + report.WaybillNumber = operation.WaybillNumber + report.ReceiverName = operation.ReceiverName + + err = blevex.Add(HistoryReportIndexName, strconv.Itoa(record.Id), report) if err != nil { logx.Errorf("AddNewHistoryReportRecord bleve add err:%v", err) return -- Gitblit v1.8.0