|
@@ -30,7 +30,7 @@ func Report(r *GinRouter) {
|
|
|
|
|
|
// 加工单
|
|
// 加工单
|
|
func ReportListDownload(c *gin.Context, apictx *ApiSession) (interface{}, error) {
|
|
func ReportListDownload(c *gin.Context, apictx *ApiSession) (interface{}, error) {
|
|
- page, size, query := UtilQueryPageSize(c)
|
|
|
|
|
|
+ _, _, query := UtilQueryPageSize(c)
|
|
// start, stop := CreatePageRange(page, size)
|
|
// start, stop := CreatePageRange(page, size)
|
|
supplierId := primitive.NilObjectID
|
|
supplierId := primitive.NilObjectID
|
|
if _supplierId, ok := query["supplierId"]; ok {
|
|
if _supplierId, ok := query["supplierId"]; ok {
|
|
@@ -110,11 +110,7 @@ func ReportListDownload(c *gin.Context, apictx *ApiSession) (interface{}, error)
|
|
}
|
|
}
|
|
|
|
|
|
if len(reports) < 1 {
|
|
if len(reports) < 1 {
|
|
- return repo.PageResult{
|
|
|
|
- Page: page,
|
|
|
|
- Size: size,
|
|
|
|
- Total: 0,
|
|
|
|
- }, nil
|
|
|
|
|
|
+ return nil, errors.New("没有单据信息")
|
|
}
|
|
}
|
|
lists := []map[string]interface{}{}
|
|
lists := []map[string]interface{}{}
|
|
for _, report := range reports {
|
|
for _, report := range reports {
|
|
@@ -152,6 +148,7 @@ func ReportListDownload(c *gin.Context, apictx *ApiSession) (interface{}, error)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
f := excelize.NewFile()
|
|
f := excelize.NewFile()
|
|
|
|
+ defer f.Close()
|
|
index := f.NewSheet("Sheet1")
|
|
index := f.NewSheet("Sheet1")
|
|
f.SetActiveSheet(index)
|
|
f.SetActiveSheet(index)
|
|
f.SetDefaultFont("宋体")
|
|
f.SetDefaultFont("宋体")
|
|
@@ -181,6 +178,7 @@ func ReportListDownload(c *gin.Context, apictx *ApiSession) (interface{}, error)
|
|
if err != nil {
|
|
if err != nil {
|
|
return nil, err
|
|
return nil, err
|
|
}
|
|
}
|
|
|
|
+
|
|
return nil, nil
|
|
return nil, nil
|
|
}
|
|
}
|
|
|
|
|
|
@@ -312,18 +310,10 @@ func CreatePageRange(page, size int64) (int64, int64) {
|
|
if size < 1 {
|
|
if size < 1 {
|
|
size = 10
|
|
size = 10
|
|
}
|
|
}
|
|
- // var start int64 = 0
|
|
|
|
- // var stop int64 = 9
|
|
|
|
- // if size < 1 {
|
|
|
|
- // return start, stop
|
|
|
|
- // }
|
|
|
|
|
|
|
|
- // if page > 0 {
|
|
|
|
start := (page - 1) * size
|
|
start := (page - 1) * size
|
|
stop := page*size - 1
|
|
stop := page*size - 1
|
|
|
|
|
|
- // }
|
|
|
|
-
|
|
|
|
return start, stop
|
|
return start, stop
|
|
}
|
|
}
|
|
|
|
|