From 8053877f1321da612b3cfa128b3ffffaf0d77e77 Mon Sep 17 00:00:00 2001 From: dsmzx <dsmzx@123.com> Date: 星期三, 26 六月 2024 16:33:00 +0800 Subject: [PATCH] 出库/入库 打印 修改bug --- controllers/operation.go | 23 ++++++++++++++--------- 1 files changed, 14 insertions(+), 9 deletions(-) diff --git a/controllers/operation.go b/controllers/operation.go index 2cc1671..af310c4 100644 --- a/controllers/operation.go +++ b/controllers/operation.go @@ -1002,8 +1002,8 @@ sheet := "Sheet1" f.SetCellValue(sheet, "A2", "鍗曚綅(閮ㄩ棬):"+operation.CompanyName) // 鍗曚綅閮ㄩ棬 - f.SetCellValue(sheet, "H2", operation.OperationDate) // 鏃堕棿 - f.SetCellValue(sheet, "O2", operation.Number) // 缂栧彿 + f.SetCellValue(sheet, "J2", operation.OperationDate) // 鏃堕棿 + f.SetCellValue(sheet, "Q2", operation.Number) // 缂栧彿 totalAmount := decimal.NewFromInt(0) // 鎬婚噾棰� totalPrice := decimal.NewFromInt(0) // 鎬讳环 @@ -1013,14 +1013,19 @@ if i > 9 { break } - f.SetCellValue(sheet, "A"+strconv.Itoa(rowIndex), v.Product.Name) // 浜у搧鍚嶇О - f.SetCellValue(sheet, "B"+strconv.Itoa(rowIndex), v.Product.Specs) //瑙勬牸 - f.SetCellValue(sheet, "C"+strconv.Itoa(rowIndex), v.TotalGrossWeight.String()) //閲嶉噺 - f.SetCellValue(sheet, "D"+strconv.Itoa(rowIndex), v.Amount.String()) //鏁伴噺 - f.SetCellValue(sheet, "E"+strconv.Itoa(rowIndex), v.AuxiliaryAmount.String()) //杈呭姪鏁伴噺 - f.SetCellValue(sheet, "F"+strconv.Itoa(rowIndex), v.AuxiliaryUnit) //杈呭姪鍗曚綅 + f.SetCellValue(sheet, "A"+strconv.Itoa(rowIndex), v.Product.Name) // 鍝佸悕 + 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 { + if !v1.Amount.IsZero() { + f.SetCellValue(sheet, "E"+strconv.Itoa(rowIndex), v1.Amount) // 杈呮暟閲� + f.SetCellValue(sheet, "F"+strconv.Itoa(rowIndex), v1.Unit) // 杈呭崟浣� + break + } + } f.SetCellValue(sheet, "G"+strconv.Itoa(rowIndex), v.Product.SalePrice.String()) // 鍗曚环 - // 閲戦 if !v.Product.SalePrice.IsZero() { ap := v.Amount.Mul(v.Product.SalePrice) -- Gitblit v1.8.0