From d4b0b578752a1478f6c11b352fbb8d2bad1f9e1d Mon Sep 17 00:00:00 2001
From: huangxiaoqiang <huangxiaoqiang@hnkhzn.com>
Date: 星期三, 22 十月 2025 17:18:49 +0800
Subject: [PATCH] 1

---
 项目代码/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Boxing/BoxingInfoService.cs |   78 ++++++++++++++++++++------------------
 1 files changed, 41 insertions(+), 37 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Boxing/BoxingInfoService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Boxing/BoxingInfoService.cs"
index 79d8610..61e8777 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Boxing/BoxingInfoService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicServices/Boxing/BoxingInfoService.cs"
@@ -1,51 +1,55 @@
-锘縰sing Masuit.Tools;
+锘縰sing Mapster;
+using Masuit.Tools;
+using SqlSugar;
 using System.ComponentModel.DataAnnotations;
+using System.Linq.Expressions;
+using WIDESEA_Core.BaseRepository;
+using WIDESEA_DTO.Basic;
+using WIDESEA_IOrderRepository;
 
 namespace WIDESEA_StorageBasicService;
 
 public class BoxingInfoService : ServiceBase<DtBoxingInfo, IBoxingInfoRepository>, IBoxingInfoService
 {
-    public BoxingInfoService(IBoxingInfoRepository BaseDal) : base(BaseDal)
+    private readonly IUnitOfWorkManage _unitOfWorkManage;
+    public BoxingInfoService(IBoxingInfoRepository BaseDal,IUnitOfWorkManage unitOfWorkManage) : base(BaseDal)
     {
+        _unitOfWorkManage = unitOfWorkManage;
     }
-
-    public async Task<WebResponseContent> AddBoxingInfoAsync(DtBoxingInfo boxingInfo)
-    {
-        WebResponseContent content = new WebResponseContent();
-        var info = await BaseDal.QueryFirstAsync(x => x.PalletCode == boxingInfo.PalletCode);
-        if (!info.IsNullOrEmpty())
-        {
-            content.Error("璇ユ墭鐩樺凡瀛樺湪缁勭洏");
-        }
-        else
-        {
-            // 娣诲姞缁勭洏淇℃伅
-            var result = await BaseDal.AddDataNavAsync(boxingInfo);
-            if (result)
-            {
-                content.OK("娣诲姞鎴愬姛", boxingInfo);
-            }
-        }
-        return content;
-    }
-
     public override PageGridData<DtBoxingInfo> GetPageData(PageDataOptions options)
     {
-        return base.GetPageData(options);
-    }
+        string wheres = ValidatePageOptions(options);
+        //鑾峰彇鎺掑簭瀛楁
+        Dictionary<string, OrderByType> orderbyDic = GetPageDataSort(options, TProperties);
+        List<OrderByModel> orderByModels = new List<OrderByModel>();
+        foreach (var item in orderbyDic)
+        {
+            OrderByModel orderByModel = new()
+            {
+                FieldName = item.Key,
+                OrderByType = item.Value
+            };
+            orderByModels.Add(orderByModel);
+        }
 
-    // 楠岃瘉妯″瀷
-    public static List<ValidationResult> ValidateModel(object model)
-    {
-        // 鍒涘缓涓�涓獙璇佺粨鏋滃垪琛�
-        var validationResults = new List<ValidationResult>();
-        // 鍒涘缓涓�涓獙璇佷笂涓嬫枃
-        var validationContext = new ValidationContext(model, serviceProvider: null, items: null);
 
-        // 浣跨敤楠岃瘉鍣ㄥ皾璇曢獙璇佹ā鍨嬶紝骞跺皢楠岃瘉缁撴灉娣诲姞鍒伴獙璇佺粨鏋滃垪琛ㄤ腑
-        Validator.TryValidateObject(model, validationContext, validationResults, validateAllProperties: true);
-
-        // 杩斿洖楠岃瘉缁撴灉鍒楄〃
-        return validationResults;
+        int totalCount = 0;
+        List<SearchParameters> searchParametersList = new List<SearchParameters>();
+        if (!string.IsNullOrEmpty(options.Wheres))
+        {
+            try
+            {
+                searchParametersList = options.Wheres.DeserializeObject<List<SearchParameters>>();
+                options.Filter = searchParametersList;
+            }
+            catch { }
+        }
+        var data = BaseDal.Db.Queryable<DtBoxingInfo>()
+            .Includes(x => x.BoxingInfoDetails)
+            .WhereIF(!wheres.IsNullOrEmpty(), wheres)
+            .OrderBy(orderByModels)
+            .ToPageList(options.Page, options.Rows, ref totalCount);
+        new PageGridData<DtBoxingInfo>(totalCount, data);
+        return new PageGridData<DtBoxingInfo>(totalCount, data);
     }
 }
\ No newline at end of file

--
Gitblit v1.9.3