| | |
| | | } |
| | | number := c.Param("number") |
| | | client := product_inventory.NewProductInventoryServiceClient(grpc_init.ProductInventoryServiceConn) |
| | | info, err := client.GetInventoryProductInfo(ctx.GetCtx(), &product_inventory.GetInventoryProductInfoRequest{Number: number}) |
| | | info, err := client.GetOrderInputAndOutputInfo(ctx.GetCtx(), &product_inventory.GetOrderInputAndOutputInfoRequest{Number: number}) |
| | | if err != nil { |
| | | if strings.Contains(err.Error(), "record not found") { |
| | | ctx.Ok() |
| | |
| | | return |
| | | } |
| | | var list []response.ProductInfo |
| | | err = structx.AssignTo(info.ProductList, &list) |
| | | err = structx.AssignTo(info.OutputList, &list) |
| | | if err != nil { |
| | | ctx.FailWithMsg(ecode.UnknownErr, "转换错误") |
| | | return |
| | | } |
| | | |
| | | products, err := salesDetailsService.GetProducts(number) |
| | | m := make(map[string]*model.Product) |
| | | |
| | | for _, product := range products { |
| | | m[product.Number] = product |
| | | } |
| | | for _, v := range list { |
| | | if m[v.Number] == nil { |
| | | continue |
| | | } |
| | | v.OrderAmount = m[v.Number].Amount.String() |
| | | } |
| | | |
| | | ctx.OkWithDetailed(list) |
| | | } |
| | | |
| | |
| | | |
| | | if err != nil { |
| | | logx.Errorf("product_inventory.OrderProductOutput err:%v, params:%v", err, params) |
| | | ctx.FailWithMsg(ecode.UnknownErr, "发货失败") |
| | | ctx.FailWithMsg(ecode.UnknownErr, "发货失败"+err.Error()) |
| | | return |
| | | } |
| | | |