zhangqian
2024-08-01 b06dff2254f73c8f7aeb0bc58c04025561b84dcc
controllers/operation.go
@@ -1125,14 +1125,17 @@
      f.SetCellValue(sheet, "B"+strconv.Itoa(rowIndex), v.Product.Type)    // 型号
      f.SetCellValue(sheet, "C"+strconv.Itoa(rowIndex), v.Product.Unit)    // 单位
      f.SetCellValue(sheet, "D"+strconv.Itoa(rowIndex), v.Amount.String()) // 数量
      unit := service.CreateMoreUnit(v.Amount, v.Product.MoreUnitList)
      for _, v1 := range unit {
      var moreAmount, moreUnit []string
      for _, v1 := range v.MoreUnitList {
         if !v1.Amount.IsZero() {
            f.SetCellValue(sheet, "E"+strconv.Itoa(rowIndex), v1.Amount) // 辅数量
            f.SetCellValue(sheet, "F"+strconv.Itoa(rowIndex), v1.Unit)   // 辅单位
            break
            moreAmount = append(moreAmount, v1.Amount.String())
            moreUnit = append(moreUnit, v1.Unit)
         }
      }
      if len(moreAmount) > 0 {
         f.SetCellValue(sheet, "E"+strconv.Itoa(rowIndex), strings.Join(moreAmount, "/")) // 辅数量
         f.SetCellValue(sheet, "F"+strconv.Itoa(rowIndex), strings.Join(moreUnit, "/"))   // 辅单位
      }
      f.SetCellValue(sheet, "G"+strconv.Itoa(rowIndex), v.Product.SalePrice.String()) // 单价
      // 金额
      if !v.Product.SalePrice.IsZero() {