| | |
| | | return &UpdateSalesDetailResponse{}, nil |
| | | } |
| | | |
| | | func (s *Server) RemoveSalesDetail(ctx context.Context, req *RemoveSalesDetailRequest) (*RemoveSalesDetailRequest, error) { |
| | | func (s *Server) RemoveSalesDetail(ctx context.Context, req *RemoveSalesDetailRequest) (*RemoveSalesDetailResponse, error) { |
| | | if req.Number == "" { |
| | | return nil, errors.New("销售明细编号为空") |
| | | } |
| | |
| | | return nil, errors.New("销售明细删除失败") |
| | | } |
| | | |
| | | return &RemoveSalesDetailRequest{}, nil |
| | | return &RemoveSalesDetailResponse{}, nil |
| | | } |
| | | |
| | | func (s *Server) GetCrmSalesDetailsProductInfo(ctx context.Context, req *GetCrmSalesDetailsProductInfoRequest) (*GetCrmSalesDetailsProductInfoResponse, error) { |
| | | if req.SalesDetailsNumber == "" { |
| | | return nil, errors.New("销售明细编号为空") |
| | | } |
| | | first, err := model.NewSalesDetailsSearch().SetPreload(true).SetNumber(req.SalesDetailsNumber).First() |
| | | if err != nil { |
| | | return nil, err |
| | | } |
| | | list := make([]*CrmSalesDetailsProductInfo, 0) |
| | | for _, product := range first.Products { |
| | | var csp CrmSalesDetailsProductInfo |
| | | csp.ProductId = product.Number |
| | | csp.ProductName = product.Name |
| | | csp.Specs = product.Specs |
| | | csp.Unit = product.Unit |
| | | csp.Amount = product.Amount.IntPart() |
| | | csp.Cost = product.Cost |
| | | csp.Price = product.Price.IntPart() |
| | | csp.Total = product.Total.IntPart() |
| | | csp.Profit = product.Profit |
| | | csp.Margin = product.Margin |
| | | list = append(list, &csp) |
| | | } |
| | | resp := new(GetCrmSalesDetailsProductInfoResponse) |
| | | resp.List = list |
| | | return resp, nil |
| | | } |