| | |
| | | "outsourcing/pkg/logx" |
| | | "outsourcing/pkg/structx" |
| | | "outsourcing/request" |
| | | "outsourcing/response" |
| | | "outsourcing/service" |
| | | "outsourcing/service/outsourcing" |
| | | "outsourcing/utils/jwt" |
| | |
| | | // @Summary 物料搜索 |
| | | // @Produce application/json |
| | | // @Param object body request.MaterialSearch true "参数" |
| | | // @Success 200 {object} util.ResponseList{[]models.OutsourcingOrderDeliveryDetails} "成功" |
| | | // @Success 200 {object} util.ResponseList{[]response.Material} "成功" |
| | | // @Router /api-outsourcing/v1/order/materialSearch [post] |
| | | func (slf *OrderController) MaterialSearch(c *gin.Context) { |
| | | var params request.MaterialSearch |
| | |
| | | return |
| | | } |
| | | client := outsourcing.NewOutsourcingServiceClient(service.ApsServiceConn) |
| | | list, err := client.GetMaterialList(c, &outsourcing.GetMaterialListRequest{ |
| | | resp, err := client.GetMaterialList(c, &outsourcing.GetMaterialListRequest{ |
| | | Page: int32(params.Page), |
| | | PageSize: int32(params.PageSize), |
| | | Keyword: params.Keyword, |
| | | }) |
| | | |
| | | if err != nil { |
| | | logx.Errorf("grpc outsourcing GetProductList err:%v", err) |
| | | util.ResponseFormat(c, code.RequestParamError, "查询失败") |
| | | return |
| | | } |
| | | util.ResponseFormat(c, code.Success, list) |
| | | |
| | | data := make([]*response.Material, 0, len(resp.List)) |
| | | for _, item := range resp.List { |
| | | data = append(data, &response.Material{ |
| | | Number: item.ID, |
| | | Name: item.Name, |
| | | Unit: item.Unit, |
| | | Specs: item.Specs, |
| | | Type: item.Type, |
| | | }) |
| | | } |
| | | |
| | | util.ResponseFormat(c, code.Success, data) |
| | | } |