Parcourir la source

fix download bill title

animeic il y a 2 ans
Parent
commit
c412faaf7f
3 fichiers modifiés avec 17 ajouts et 1 suppressions
  1. 5 0
      boxcost/api/bill-produce.go
  2. 5 0
      boxcost/api/bill.go
  3. 7 1
      boxcost/api/plan.go

+ 5 - 0
boxcost/api/bill-produce.go

@@ -181,6 +181,11 @@ func DownProduceBill(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 
 	billExcel := NewProduceBill(f)
 	billExcel.Content = &bill
+	info := model.Setting{}
+	repo.RepoSeachDoc(apictx.CreateRepoCtx(), &repo.DocSearchOptions{
+		CollectName: "infos",
+	}, &info)
+	billExcel.Title = fmt.Sprintf("%s加工单", info.CompanyName)
 	//设置对应的数据
 	billExcel.Draws()
 

+ 5 - 0
boxcost/api/bill.go

@@ -149,6 +149,11 @@ func DownLoadBills(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 
 	billExcel := NewPurchaseBill(f)
 	billExcel.Content = &bill
+	info := model.Setting{}
+	repo.RepoSeachDoc(apictx.CreateRepoCtx(), &repo.DocSearchOptions{
+		CollectName: "infos",
+	}, &info)
+	billExcel.Title = fmt.Sprintf("%s原材料采购单", info.CompanyName)
 
 	//设置对应的数据
 	billExcel.Draws()

+ 7 - 1
boxcost/api/plan.go

@@ -73,7 +73,11 @@ func DownLoadPlan(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 	f.SetActiveSheet(index)
 	f.SetDefaultFont("宋体")
 
-	//
+	info := model.Setting{}
+	repo.RepoSeachDoc(apictx.CreateRepoCtx(), &repo.DocSearchOptions{
+		CollectName: "infos",
+	}, &info)
+
 	offset := 0
 	for _, mat := range curComp.Mats {
 		// 采购单
@@ -88,6 +92,7 @@ func DownLoadPlan(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 			if found {
 				purchaseExcel := NewPurchaseBill(f)
 				purchaseExcel.Content = &purchase
+				purchaseExcel.Title = fmt.Sprintf("%s原材料采购单", info.CompanyName)
 				//设置对应的数据
 				purchaseExcel.Offset = offset
 				purchaseExcel.Draws()
@@ -109,6 +114,7 @@ func DownLoadPlan(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 					if found {
 						produceExcel := NewProduceBill(f)
 						produceExcel.Content = &produce
+						produceExcel.Title = fmt.Sprintf("%s加工单", info.CompanyName)
 						//设置对应的数据
 						produceExcel.Offset = offset
 						produceExcel.Draws()