From 9ce02d17cafc6b8dab49b16fa20fdca4c978bb5b Mon Sep 17 00:00:00 2001
From: huangxiaoqiang <huangxiaoqiang@hnkhzn.com>
Date: 星期六, 13 十二月 2025 09:33:30 +0800
Subject: [PATCH] 新增文本日志Web端显示

---
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoDetailService.cs |  113 +++++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 110 insertions(+), 3 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoDetailService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoDetailService.cs"
index cd50907..d84a515 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoDetailService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS\346\227\240\344\273\223\345\202\250\347\211\210/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoDetailService.cs"
@@ -1,5 +1,14 @@
-锘縰sing WIDESEA_Core.BaseRepository;
+锘縰sing SqlSugar;
+using WIDESEA_Common.StockEnum;
+using System.Collections.Generic;
+using WIDESEA_Core;
+using WIDESEA_Core.BaseRepository;
 using WIDESEA_Core.BaseServices;
+using WIDESEA_Core.Enums;
+using WIDESEA_Core.Helper;
+using WIDESEA_Core.HttpContextUser;
+using WIDESEA_Core.Utilities;
+using WIDESEA_DTO.Stock;
 using WIDESEA_IStockService;
 using WIDESEA_Model.Models;
 
@@ -7,10 +16,12 @@
 {
     public partial class StockInfoDetailService : ServiceBase<Dt_StockInfoDetail, IRepository<Dt_StockInfoDetail>>, IStockInfoDetailService
     {
-        public StockInfoDetailService(IRepository<Dt_StockInfoDetail> BaseDal) : base(BaseDal)
+        public StockInfoDetailService(IRepository<Dt_StockInfoDetail> BaseDal, IRepository<Dt_StockInfo> stockinfoRepository) : base(BaseDal)
         {
+            _stockinfoRepository = stockinfoRepository;
         }
 
+        public IRepository<Dt_StockInfo> _stockinfoRepository;
         public IRepository<Dt_StockInfoDetail> Repository => BaseDal;
 
         public bool ExistBarcodes(string barcode)
@@ -20,7 +31,103 @@
 
         public bool ExistBarcodes(List<string> barcodes)
         {
-            return BaseDal.QueryFirst(x =>!string.IsNullOrEmpty( x.Barcode) &&  barcodes.Contains(x.Barcode)) != null;
+            return BaseDal.QueryFirst(x => !string.IsNullOrEmpty(x.Barcode) && barcodes.Contains(x.Barcode)) != null;
         }
+
+        public PageGridData<StockInfoDetailWithPalletDto> GetPageData2(PageDataOptions options)
+        {
+
+            string wheres = ValidatePageOptions(options);
+
+            var sugarQueryable = Db.Queryable<Dt_StockInfoDetail>().InnerJoin<Dt_StockInfo>((detail, item) => detail.StockId == item.Id)
+                .Where((detail, item) => item.StockStatus == StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt());
+
+            Dictionary<string, SqlSugar.OrderByType> orderbyDic = GetPageDataSort(options, TProperties);
+            List<OrderByModel> orderByModels = new List<OrderByModel>();
+            foreach (var item in orderbyDic)
+            {
+                if (item.Key.ToLower() == "id")
+                {
+                    OrderByModel orderByModel = new()
+                    {
+                        FieldName = "detail." + item.Key,
+                        OrderByType = item.Value
+                    };
+                    orderByModels.Add(orderByModel);
+                }
+                else
+                {
+                    OrderByModel orderByModel = new()
+                    {
+                        FieldName = item.Key,
+                        OrderByType = item.Value
+                    };
+                    orderByModels.Add(orderByModel);
+                }
+
+            }
+            int totalCount = 0;
+            List<SearchParameters> searchParametersList = new List<SearchParameters>();
+
+
+            if (!string.IsNullOrEmpty(options.Wheres))
+            {
+                try
+                {
+                    searchParametersList = options.Wheres.DeserializeObject<List<SearchParameters>>();
+                    if (searchParametersList != null && searchParametersList.Any())
+                    {
+                        foreach (var param in searchParametersList)
+                        {
+                            if (param.Name.Equals(nameof(Dt_StockInfo.PalletCode).FirstLetterToLower(), StringComparison.OrdinalIgnoreCase)
+                                && !string.IsNullOrEmpty(param.Value?.ToString()))
+                            {
+                                sugarQueryable = sugarQueryable.Where((detail, item) => item.PalletCode.Contains(param.Value));
+                            }
+                        }
+                    }
+                }
+                catch (Exception ex)
+                {
+                }
+            }          
+            var data = sugarQueryable
+             .WhereIF(!wheres.IsNullOrEmpty(), wheres)
+             .OrderBy(orderByModels)
+             .Select((detail, item) => new StockInfoDetailWithPalletDto
+             {
+                 Id = detail.Id,
+                 StockId = detail.StockId,
+                 MaterielCode = detail.MaterielCode,
+                 MaterielName = detail.MaterielName,
+                 OrderNo = detail.OrderNo,
+                 BatchNo = detail.BatchNo,
+                 ProductionDate = detail.ProductionDate,
+                 EffectiveDate = detail.EffectiveDate,
+                 SerialNumber = detail.SerialNumber,
+                 StockQuantity = detail.StockQuantity,
+                 OutboundQuantity = detail.OutboundQuantity,
+                 Status = detail.Status,
+                 Unit = detail.Unit,
+                 InboundOrderRowNo = detail.InboundOrderRowNo,
+                 SupplyCode = detail.SupplyCode,
+                 WarehouseCode = detail.WarehouseCode,
+                 Barcode = detail.Barcode,
+                 BusinessType = detail.BusinessType,
+                 Remark = detail.Remark,
+                 Creater = detail.Creater,
+                 CreateDate = detail.CreateDate,
+                 Modifier = detail.Modifier,
+                 ModifyDate = detail.ModifyDate,
+                 PalletCode = item.PalletCode
+             })
+             .ToPageList(options.Page, options.Rows, ref totalCount);
+
+
+            return new PageGridData<StockInfoDetailWithPalletDto>(totalCount, data);
+
+        }
+
     }
 }
+

--
Gitblit v1.9.3