api/v1/salesDetails.go | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
docs/docs.go | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
docs/swagger.json | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
docs/swagger.yaml | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
router/salesDetails.go | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
api/v1/salesDetails.go
@@ -289,53 +289,6 @@ ctx.OkWithDetailed(list) } // CreateOperation // // @Tags SalesDetails // @Summary 创建产品出库信息 // @Produce application/json // @Param object body request.SalesDetails true "查询参数" // @Success 200 {object} response.ListResponse // // @Router /api/salesDetails/createOperation [post] func (s *SalesDetailsApi) CreateOperation(c *gin.Context) { var params request.SalesDetails ctx, ok := contextx.NewContext(c, ¶ms) if !ok { return } m := make(map[string]interface{}) m["status"] = params.Status err := model.NewSalesDetailsSearch().SetNumber(params.Number).UpdateByMap(m) if err != nil { ctx.FailWithMsg(ecode.UnknownErr, "状态更新失败") return } client := product_inventory.NewProductInventoryServiceClient(ProductInventoryServiceConn) products := make([]*product_inventory.InventoryProduct, 0) for _, product := range params.Products { var p product_inventory.InventoryProduct p.Id = product.Number p.Amount = product.Amount.String() products = append(products, &p) } _, err = client.CreateOperation(ctx.GetCtx(), &product_inventory.CreateOperationRequest{ Number: params.Number, Addressee: params.Addressee, Address: params.Address, Phone: params.Phone, DeliverType: int32(params.DeliverType), ProductList: products, }) if err != nil { logx.Errorf("CreateOperation err: %v", err.Error()) ctx.FailWithMsg(ecode.UnknownErr, "grpc调用错误") return } ctx.Ok() } // GetApsProjectList // // @Tags SalesDetails @@ -358,16 +311,16 @@ ctx.OkWithDetailed(projectList.List) } // SendSalesDetailsToApsProject // SendSalesDetailsToOtherSystem // // @Tags SalesDetails // @Summary 推送销售明细信息到aps项目模块 // @Summary 推送销售明细信息到其他系统 // @Produce application/json // @Param object body request.SalesDetails true "查询参数" // @Success 200 {object} response.ListResponse // // @Router /api/salesDetails/sendSalesDetailsToApsProject [post] func (s *SalesDetailsApi) SendSalesDetailsToApsProject(c *gin.Context) { // @Router /api/salesDetails/sendSalesDetailsToOtherSystem [post] func (s *SalesDetailsApi) SendSalesDetailsToOtherSystem(c *gin.Context) { var params request.SalesDetails ctx, ok := contextx.NewContext(c, ¶ms) if !ok { @@ -381,18 +334,40 @@ return } products := make([]*crm_aps.SalesDetailsProduct, 0) //推送到wms wmsProducts := make([]*product_inventory.InventoryProduct, 0) for _, product := range params.Products { var p product_inventory.InventoryProduct p.Id = product.Number p.Amount = product.Amount.String() wmsProducts = append(wmsProducts, &p) } clientWms := product_inventory.NewProductInventoryServiceClient(ProductInventoryServiceConn) _, err = clientWms.CreateOperation(ctx.GetCtx(), &product_inventory.CreateOperationRequest{ Number: params.Number, Addressee: params.Addressee, Address: params.Address, Phone: params.Phone, DeliverType: int32(params.DeliverType), ProductList: wmsProducts, }) if err != nil { logx.Errorf("CreateOperation err: %v", err.Error()) } //推送到aps ApsProducts := make([]*crm_aps.SalesDetailsProduct, 0) var total decimal.Decimal for _, product := range params.Products { var sp crm_aps.SalesDetailsProduct sp.ProductId = product.Number sp.Amount = product.Amount.IntPart() products = append(products, &sp) ApsProducts = append(ApsProducts, &sp) total = total.Add(product.Amount) } client := crm_aps.NewCrmAndApsGrpcServiceClient(grpc_init.CrmApsGrpcServiceConn) _, err = client.SendSalesDetailsToApsProject(c, &crm_aps.SendSalesDetailsToApsProjectRequest{ clientAps := crm_aps.NewCrmAndApsGrpcServiceClient(grpc_init.CrmApsGrpcServiceConn) _, err = clientAps.SendSalesDetailsToApsProject(c, &crm_aps.SendSalesDetailsToApsProjectRequest{ Number: params.Number, ClientName: params.Client.Name, MemberName: params.Member.Username, @@ -401,9 +376,12 @@ Source: params.Source, ProductTotal: total.IntPart(), ProjectId: params.ProjectId, Products: products, Products: ApsProducts, }) if err != nil { //状态还原 m["status"] = constvar.WaitConfirmed _ = model.NewSalesDetailsSearch().SetNumber(params.Number).UpdateByMap(m) ctx.FailWithMsg(ecode.UnknownErr, "grpc调用错误: "+err.Error()) return } docs/docs.go
@@ -6971,36 +6971,6 @@ } } }, "/api/salesDetails/createOperation": { "post": { "produces": [ "application/json" ], "tags": [ "SalesDetails" ], "summary": "创建产品出库信息", "parameters": [ { "description": "查询参数", "name": "object", "in": "body", "required": true, "schema": { "$ref": "#/definitions/request.SalesDetails" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/response.ListResponse" } } } } }, "/api/salesDetails/delete": { "delete": { "produces": [ @@ -7148,7 +7118,7 @@ } } }, "/api/salesDetails/sendSalesDetailsToApsProject": { "/api/salesDetails/sendSalesDetailsToOtherSystem": { "post": { "produces": [ "application/json" @@ -7156,7 +7126,7 @@ "tags": [ "SalesDetails" ], "summary": "推送销售明细信息到aps项目模块", "summary": "推送销售明细信息到其他系统", "parameters": [ { "description": "查询参数", docs/swagger.json
@@ -6959,36 +6959,6 @@ } } }, "/api/salesDetails/createOperation": { "post": { "produces": [ "application/json" ], "tags": [ "SalesDetails" ], "summary": "创建产品出库信息", "parameters": [ { "description": "查询参数", "name": "object", "in": "body", "required": true, "schema": { "$ref": "#/definitions/request.SalesDetails" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/response.ListResponse" } } } } }, "/api/salesDetails/delete": { "delete": { "produces": [ @@ -7136,7 +7106,7 @@ } } }, "/api/salesDetails/sendSalesDetailsToApsProject": { "/api/salesDetails/sendSalesDetailsToOtherSystem": { "post": { "produces": [ "application/json" @@ -7144,7 +7114,7 @@ "tags": [ "SalesDetails" ], "summary": "推送销售明细信息到aps项目模块", "summary": "推送销售明细信息到其他系统", "parameters": [ { "description": "查询参数", docs/swagger.yaml
@@ -10657,25 +10657,6 @@ summary: 添加销售明细 tags: - SalesDetails /api/salesDetails/createOperation: post: parameters: - description: 查询参数 in: body name: object required: true schema: $ref: '#/definitions/request.SalesDetails' produces: - application/json responses: "200": description: OK schema: $ref: '#/definitions/response.ListResponse' summary: 创建产品出库信息 tags: - SalesDetails /api/salesDetails/delete: delete: parameters: @@ -10767,7 +10748,7 @@ summary: 销售明细单列表 tags: - SalesDetails /api/salesDetails/sendSalesDetailsToApsProject: /api/salesDetails/sendSalesDetailsToOtherSystem: post: parameters: - description: 查询参数 @@ -10783,7 +10764,7 @@ description: OK schema: $ref: '#/definitions/response.ListResponse' summary: 推送销售明细信息到aps项目模块 summary: 推送销售明细信息到其他系统 tags: - SalesDetails /api/salesDetails/update: router/salesDetails.go
@@ -18,8 +18,8 @@ salesDetailsRouter.POST("updateStatus", salesDetailsApi.UpdateStatus) // 更新销售明细状态 salesDetailsRouter.POST("list", salesDetailsApi.List) // 获取销售明细单列表 salesDetailsRouter.GET("getProductInventoryInfo/:number", salesDetailsApi.GetProductInventoryInfo) // 获取产品库存信息 salesDetailsRouter.POST("createOperation", salesDetailsApi.CreateOperation) // 创建产品出库信息 //salesDetailsRouter.POST("createOperation", salesDetailsApi.CreateOperation) // 创建产品出库信息 salesDetailsRouter.GET("getApsProjectList", salesDetailsApi.GetApsProjectList) // 获取aps项目列表 salesDetailsRouter.POST("sendSalesDetailsToApsProject", salesDetailsApi.SendSalesDetailsToApsProject) // 推送销售明细信息到aps项目模块 // 创建产品出库信息 salesDetailsRouter.POST("sendSalesDetailsToOtherSystem", salesDetailsApi.SendSalesDetailsToOtherSystem) // 推送销售明细信息到其他系统 // 创建产品出库信息 } }