| | |
| | | return |
| | | } |
| | | |
| | | if params.QuotationNumber != "" { |
| | | find, err := model.NewQuotationSearch(nil).SetNumber(params.QuotationNumber).Find() |
| | | if err != nil { |
| | | ctx.FailWithMsg(ecode.UnknownErr, "报价单信息查询失败") |
| | | return |
| | | } |
| | | products := find.Products |
| | | ctx.OkWithDetailed(response.ListResponse{ |
| | | Data: products, |
| | | Count: int64(len(products)), |
| | | }) |
| | | return |
| | | } |
| | | cli := product.NewProductServiceClient(grpc_init.CrmApsGrpcServiceConn) |
| | | getProductListResponse, err := cli.GetProductList(ctx.GetCtx(), &product.GetProductListRequest{ |
| | | Page: cast.ToInt32(params.Page), |
| | |
| | | productList[k].Amount = decimal.NewFromFloat(1) |
| | | productList[k].Total = productList[k].Price.Mul(productList[k].Amount).Round(2) |
| | | productList[k].Unit = v.Unit |
| | | productList[k].Type = v.Type |
| | | productList[k].Specs = v.Specs |
| | | } |
| | | |
| | | ctx.OkWithDetailed(response.ListResponse{ |
| | |
| | | // @Summary 获取产品订单信息 |
| | | // @Produce application/json |
| | | // @Param number path string true "明细编码" |
| | | // @Success 200 {object} contextx.Response{data=[]product.WorkOrderInfo} "成功" |
| | | // @Success 200 {object} contextx.Response{data=response.Info} "成功" |
| | | // |
| | | // @Router /api/product/getProductOrderInfo/{number} [get] |
| | | func (ci *ProductApi) GetProductOrderInfo(c *gin.Context) { |
| | |
| | | ctx.FailWithMsg(ecode.UnknownErr, "内部错误") |
| | | return |
| | | } |
| | | var result response.Info |
| | | var list []response.WorkOrderInfo |
| | | for _, orderInfo := range info.List { |
| | | var wo response.WorkOrderInfo |
| | |
| | | wo.EndTime = orderInfo.EndTime |
| | | list = append(list, wo) |
| | | } |
| | | ctx.OkWithDetailed(list) |
| | | result.MakeInfo = list |
| | | var purchaseInfo []response.Purchase |
| | | for _, pl := range info.PurchaseList { |
| | | var p response.Purchase |
| | | p.Amount = pl.Amount |
| | | p.Status = pl.Status |
| | | p.PurchaseName = pl.PurchaseName |
| | | p.PurchaseNumber = pl.PurchaseNumber |
| | | p.SupplierName = pl.SupplierName |
| | | purchaseInfo = append(purchaseInfo, p) |
| | | } |
| | | result.PurchaseInfo = purchaseInfo |
| | | ctx.OkWithDetailed(result) |
| | | } |