From e5a48de88081f1fe0e5250a6e147c392d22acd4b Mon Sep 17 00:00:00 2001
From: zhangqian <zhangqian@123.com>
Date: 星期二, 19 三月 2024 13:09:38 +0800
Subject: [PATCH] 发货信息字段完善

---
 service/salesDetails.go |   17 +++++++++++++++++
 1 files changed, 17 insertions(+), 0 deletions(-)

diff --git a/service/salesDetails.go b/service/salesDetails.go
index d49170c..4e10826 100644
--- a/service/salesDetails.go
+++ b/service/salesDetails.go
@@ -146,3 +146,20 @@
 	orders, err := model.NewDeliveryOrderSearch().SetSalesDetailsID(saleDetailID).FindAll()
 	return orders, err
 }
+
+func (slf SalesDetailsService) GetProducts(saleDetailNumber string) (products []*model.Product, err error) {
+	salesDetails, err := slf.GetSalesDetailsByNumber(saleDetailNumber)
+	if err != nil {
+		return nil, err
+	}
+	// get contact list
+	salesDetailsProducts, err := model.NewSalesDetailsProductSearch().SetSalesDetailsId(salesDetails.Id).FindAll()
+	if err != nil {
+		return
+	}
+	productIDs := make([]uint, 0)
+	for _, v := range salesDetailsProducts {
+		productIDs = append(productIDs, v.ProductId)
+	}
+	return model.NewProductSearch(nil).SetIds(productIDs).FindAll()
+}

--
Gitblit v1.8.0