From a9a3f943efb083de8ed88b293897886b3ef612a2 Mon Sep 17 00:00:00 2001
From: helongyang <647556386@qq.com>
Date: 星期一, 11 八月 2025 17:37:09 +0800
Subject: [PATCH] 功能增添优化

---
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockViewService.cs |   27 ++++++++++++++++++++++++---
 1 files changed, 24 insertions(+), 3 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockViewService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockViewService.cs"
index 39133c9..843d8f7 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockViewService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_StockService/StockViewService.cs"
@@ -72,6 +72,13 @@
                                     sugarQueryable1 = sugarQueryable1.Where(x => x.Details.Any(v => v.BatchNo.Contains(searchParameters.Value)));
                                 }
                             }
+                            {
+                                SearchParameters? searchParameters = searchParametersList.FirstOrDefault(x => x.Name == nameof(Dt_StockInfo.LocationCode).FirstLetterToLower());
+                                if (searchParameters != null)
+                                {
+                                    sugarQueryable1 = sugarQueryable1.Where(x => x.LocationCode == searchParameters.Value);
+                                }
+                            }
 
                         }
 
@@ -175,8 +182,22 @@
                 Navigate? navigate = propertyInfo.GetCustomAttribute<Navigate>();
                 if (navigate != null)
                 {
-                    List<ExpandoObject> list = _dbBase.Queryable(detailType.Name, "detail").Where(navigate.GetName(), "=", pageData.Value).ToPageList(pageData.Page, pageData.Rows, ref totalCount);
-                    return new PageGridData<ExpandoObject>(totalCount, list);
+                    List<Dt_StockInfoDetail> list = _dbBase.Queryable<Dt_StockInfoDetail>().Where(navigate.GetName(), "=", pageData.Value).ToPageList(pageData.Page, pageData.Rows, ref totalCount);
+                    decimal sum = 0;
+                    list.ForEach(x =>
+                    {
+                        sum += Convert.ToDecimal(x.StockQuantity);
+                    });
+                    PageGridData<Dt_StockInfoDetail> pageGridData = new PageGridData<Dt_StockInfoDetail>()
+                    {
+                        Total = totalCount,
+                        Rows = list,
+                        Summary = new
+                        {
+                            StockQuantity = Math.Round(sum, 3),
+                        }
+                    };
+                    return pageGridData;
                 }
             }
             return new PageGridData<object>(total: 0, null);
@@ -289,7 +310,7 @@
                 {
                     x.MaterielCode = (string.Join(",", x.Details.Select(x => x.MaterielCode).Distinct())) ?? "绌虹";
                     x.BatchNo = (string.Join(",", x.Details.Select(x => x.BatchNo).Distinct())) ?? "鏃�";
-                    x.StockCounts = x.Details.Sum(x => x.StockQuantity).ToString() + x.Details.FirstOrDefault()?.Unit;
+                    x.StockCounts = Math.Round(x.Details.Sum(x => x.StockQuantity),3).ToString() + x.Details.FirstOrDefault()?.Unit;
                     x.MaterielSpec= x.Details.FirstOrDefault()?.MaterielSpec ?? "";
                     x.MaterielName= x.Details.FirstOrDefault()?.MaterielName ?? "";
                 }

--
Gitblit v1.9.3