From 606d1e513e712d125acdbcc9eddbc226713c9582 Mon Sep 17 00:00:00 2001 From: chenlin Date: Mon, 9 Sep 2024 15:32:50 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E4=BF=AE=E6=94=B9=E5=BA=93=E5=AD=98?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E9=87=87=E8=B4=AD=E6=88=90=E6=9C=AC=E5=90=88?= =?UTF-8?q?=E8=AE=A1=E3=80=81=E5=91=98=E5=B7=A5=E6=88=90=E6=9C=AC=E5=90=88?= =?UTF-8?q?=E8=AE=A1=E5=AD=97=E6=AE=B5=E7=B1=BB=E5=9E=8B=EF=BC=8C=E8=BF=94?= =?UTF-8?q?=E5=9B=9E=E5=B0=8F=E6=95=B0=E9=83=A8=E5=88=86=EF=BC=9B=202?= =?UTF-8?q?=E3=80=81=E5=95=86=E5=93=81=E9=9B=B6=E5=94=AE=E6=AF=9B=E5=88=A9?= =?UTF-8?q?=E6=B1=87=E6=80=BB=E9=A1=B5=EF=BC=8C=E5=91=98=E5=B7=A5=E6=AF=9B?= =?UTF-8?q?=E5=88=A9=E6=B7=BB=E5=8A=A0=E5=9B=9B=E8=88=8D=E4=BA=94=E5=85=A5?= =?UTF-8?q?=EF=BC=9B=203=E3=80=81=E6=9F=A5=E8=AF=A2=E9=87=87=E8=B4=AD?= =?UTF-8?q?=E6=8A=A5=E8=A1=A8=EF=BC=88=E6=8C=89=E5=95=86=E5=93=81=EF=BC=89?= =?UTF-8?q?=E9=A1=B5"=E5=B7=B2=E7=BB=88=E6=AD=A2"=E7=9A=84=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E4=B8=8D=E8=BF=94=E5=9B=9E=E6=9C=AA=E6=89=A7=E8=A1=8C?= =?UTF-8?q?=E9=87=91=E9=A2=9D=E5=92=8C=E6=95=B0=E9=87=8F=EF=BC=8C=E6=B1=87?= =?UTF-8?q?=E6=80=BB=E6=95=B0=E6=8D=AE=E5=A2=9E=E5=8A=A0=E5=9B=9B=E8=88=8D?= =?UTF-8?q?=E4=BA=94=E5=85=A5=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/models/commodity.go | 9 +++++---- app/admin/models/erp_order.go | 1 + app/admin/models/purchase.go | 12 +++++++----- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/app/admin/models/commodity.go b/app/admin/models/commodity.go index 1777534..3d8e3a7 100644 --- a/app/admin/models/commodity.go +++ b/app/admin/models/commodity.go @@ -11,6 +11,7 @@ import ( "go-admin/tools/config" "golang.org/x/sync/errgroup" "gorm.io/gorm" + "math" "math/rand" "sort" "strconv" @@ -2436,8 +2437,8 @@ type ErpStockCommodityListResp struct { Total int `json:"total"` // 数据总条数 PageIndex int `json:"pageIndex"` // 页码 PageSize int `json:"pageSize"` // 每页展示条数 - TotalWholesalePrice int `json:"total_wholesale_price"` // 入库采购价之和 - TotalStaffPrice int `json:"total_staff_price"` // 入库员工成本价之和 + TotalWholesalePrice float64 `json:"total_wholesale_price"` // 入库采购价之和 + TotalStaffPrice float64 `json:"total_staff_price"` // 入库员工成本价之和 ExportUrl string `json:"export_url"` } @@ -2546,8 +2547,8 @@ func (m *ErpStockCommodityListReq) GetDetailList(c *gin.Context, nType uint32) ( resp.Total = int(count) resp.PageIndex = page + 1 resp.PageSize = m.PageSize - resp.TotalWholesalePrice = int(nTotalCount.TotalWholesalePrice) - resp.TotalStaffPrice = int(nTotalCount.TotalStaffCostPrice + nTotalCount.TotalWholesalePrice) + resp.TotalWholesalePrice = math.Round(nTotalCount.TotalWholesalePrice*100) / 100 + resp.TotalStaffPrice = math.Round((nTotalCount.TotalStaffCostPrice+nTotalCount.TotalWholesalePrice)*100) / 100 return resp, nil } diff --git a/app/admin/models/erp_order.go b/app/admin/models/erp_order.go index 427f63d..da40df0 100644 --- a/app/admin/models/erp_order.go +++ b/app/admin/models/erp_order.go @@ -2844,6 +2844,7 @@ func QueryRetailMargin(req *ErpOrderRetailMarginReq, c *gin.Context) (*ErpOrderR existingData.SalesCost = math.Round(existingData.SalesCost*100) / 100 existingData.SalesMargin = math.Round(existingData.SalesMargin*100) / 100 existingData.EmployeeCost = math.Round(existingData.EmployeeCost*100) / 100 + existingData.EmployeeMargin = math.Round(existingData.EmployeeMargin*100) / 100 if existingData.SalesAmount == 0 { existingData.GrossMargins = "--" diff --git a/app/admin/models/purchase.go b/app/admin/models/purchase.go index 6b3e07f..2dd697b 100644 --- a/app/admin/models/purchase.go +++ b/app/admin/models/purchase.go @@ -4343,10 +4343,10 @@ func getReportByCommodityFromCommon(req *ErpPurchaseReportByCommodityReq, c *gin } resp.PlanCount = totalData.PlanCount - resp.PlanAmount = totalData.PlanAmount - resp.Amount = totalData.Amount + resp.PlanAmount = math.Round(totalData.PlanAmount*100) / 100 + resp.Amount = math.Round(totalData.Amount*100) / 100 resp.Count = totalData.Count - resp.NonExecutionAmount = totalData.NonExecutionAmount + resp.NonExecutionAmount = math.Round(totalData.NonExecutionAmount*100) / 100 resp.NonExecutionCount = totalData.NonExecutionCount if req.IsExport == 1 { @@ -4434,8 +4434,10 @@ func getPurchaseOrderAndCommodityData(orderID, commodityId uint32) (ErpCommodity purchaseOrderData.Amount = purchaseData.Amount purchaseOrderData.Price = purchaseData.Price purchaseOrderData.Count = purchaseData.Count - purchaseOrderData.NonExecutionAmount = purchaseData.NonExecutionAmount - purchaseOrderData.NonExecutionCount = purchaseData.NonExecutionCount + if purchaseOrder.State != ErpPurchaseOrderEnd { + purchaseOrderData.NonExecutionAmount = purchaseData.NonExecutionAmount + purchaseOrderData.NonExecutionCount = purchaseData.NonExecutionCount + } return purchaseOrderData, commodityData, nil }