|
@@ -62,10 +62,12 @@ func ReportBillsDownload1(c *gin.Context, apictx *ApiSession) (interface{}, erro
|
|
|
redisCli := apictx.Svc.Redis
|
|
|
reportBillKey := "report-bill-list:" + apictx.User.Parent
|
|
|
isExist := redisCli.Exists(apictx.CreateRepoCtx().Ctx, reportBillKey).Val()
|
|
|
+ fmt.Println("是否存在:", isExist)
|
|
|
|
|
|
if isExist < 1 {
|
|
|
if len(purchases) > 0 {
|
|
|
for _, purchase := range purchases {
|
|
|
+
|
|
|
member := "purchase_" + purchase.Id.Hex()
|
|
|
score := purchase.CompleteTime.Unix()
|
|
|
redisCli.ZAdd(apictx.CreateRepoCtx().Ctx, reportBillKey, &redis.Z{Score: float64(score), Member: member})
|
|
@@ -128,12 +130,10 @@ func ReportBillsDownload1(c *gin.Context, apictx *ApiSession) (interface{}, erro
|
|
|
|
|
|
typeRows := []int{0, 0, 0, 0, 0}
|
|
|
for _, tId := range reports {
|
|
|
- tidArr := strings.Split(tId, "_")
|
|
|
var billExcel IExcel
|
|
|
|
|
|
- if tidArr[0] == "purchase" {
|
|
|
- purchase := typeBills[tidArr[1]].(*model.PurchaseBill)
|
|
|
-
|
|
|
+ if strings.Contains(tId, "purchase") {
|
|
|
+ purchase := typeBills[tId].(*model.PurchaseBill)
|
|
|
sheetName := "采购单"
|
|
|
index := f.NewSheet(sheetName)
|
|
|
if flagIndex < 0 {
|
|
@@ -175,9 +175,8 @@ func ReportBillsDownload1(c *gin.Context, apictx *ApiSession) (interface{}, erro
|
|
|
}
|
|
|
|
|
|
|
|
|
- if tidArr[0] == "produce" {
|
|
|
- produce := typeBills[tidArr[1]].(*model.ProduceBill)
|
|
|
-
|
|
|
+ if strings.Contains(tId, "produce") {
|
|
|
+ produce := typeBills[tId].(*model.ProduceBill)
|
|
|
sheetName := "加工单"
|
|
|
if produce.IsPrint {
|
|
|
sheetName = "加工单-印刷"
|
|
@@ -189,7 +188,7 @@ func ReportBillsDownload1(c *gin.Context, apictx *ApiSession) (interface{}, erro
|
|
|
flagIndex = index
|
|
|
}
|
|
|
|
|
|
- billExcel = NewPurchaseBill(f)
|
|
|
+ billExcel = NewProduceBill(f)
|
|
|
billExcel.SetSheetName(sheetName)
|
|
|
|
|
|
|
|
@@ -232,15 +231,15 @@ func ReportBillsDownload1(c *gin.Context, apictx *ApiSession) (interface{}, erro
|
|
|
}
|
|
|
|
|
|
|
|
|
- if tidArr[0] == "product" {
|
|
|
- product := typeBills[tidArr[1]].(*model.ProductBill)
|
|
|
+ if strings.Contains(tId, "product") {
|
|
|
+ product := typeBills[tId].(*model.ProductBill)
|
|
|
sheetName := "成品采购单"
|
|
|
index := f.NewSheet(sheetName)
|
|
|
if flagIndex < 0 {
|
|
|
flagIndex = index
|
|
|
}
|
|
|
|
|
|
- billExcel = NewPurchaseBill(f)
|
|
|
+ billExcel = NewProductBill(f)
|
|
|
billExcel.SetSheetName(sheetName)
|
|
|
|
|
|
|