From e57b06871c0a0276a308592f7906678e8be4dbe4 Mon Sep 17 00:00:00 2001
From: heshaofeng <heshaofeng@hnkhzn.com>
Date: 星期六, 06 十二月 2025 23:12:58 +0800
Subject: [PATCH] 提交

---
 项目代码/WIDESEA_WMSClient/src/router/viewGird.js                                                          |    4 
 项目代码/WIDESEA_WMSClient/src/views/stock/stockInfoDetailByMaterielSum.vue                                |    6 
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_AllocateService/AllocateDetailService.cs                        |   73 +++++++++---
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Stock/StockInfoDetailController.cs        |    5 
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_IStockService/IStockInfoDetailService.cs                        |    1 
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_IStockService/IStockDetailByMaterielService.cs                  |    6 
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Stock/StockDetailByMaterielController.cs  |   26 ++++
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_InboundService/InboundOrderService.cs                           |    2 
 项目代码/WIDESEA_WMSClient/src/views/outbound/BatchPickingConfirm.vue                                      |    4 
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/Allocate/AllocateOrderDetailController.cs |    6 
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_Model/Models/Stock/StockDetailByMateriel.cs                     |    7 +
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_StockService/StockDetailByMaterielService.cs                    |  156 +++++++++++++++++++++++++
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_IAllocateService/IAllocateDetailService.cs                      |    1 
 项目代码/WIDESEA_WMSClient/src/extension/outbound/extend/newAllocateOrderDetail.vue                        |    2 
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_StockService/StockInfoDetailService.cs                          |   35 -----
 15 files changed, 258 insertions(+), 76 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/outbound/extend/newAllocateOrderDetail.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/outbound/extend/newAllocateOrderDetail.vue"
index 620c0a1..2de8386 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/outbound/extend/newAllocateOrderDetail.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/extension/outbound/extend/newAllocateOrderDetail.vue"
@@ -326,7 +326,7 @@
         wheres: JSON.stringify(wheres), // 鏌ヨ鏉′欢锛屾牸寮忎负[{ name: "瀛楁", value: "xx" }]
       };
       this.http
-        .post("api/AllocateOrderDetail/GetPageData", param, "鏌ヨ涓�")
+        .post("api/AllocateOrderDetail/GetDetailPage", param, "鏌ヨ涓�")
         .then((x) => {
           this.tableData = x.rows;
         });
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/router/viewGird.js" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/router/viewGird.js"
index 84f4804..3c3b62e 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/router/viewGird.js"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/router/viewGird.js"
@@ -219,8 +219,8 @@
     component: () => import('@/views/check/ReCheckOrder.vue')
   },
   {
-    path: '/stockInfoDetailByMaterielSum',
-    name: 'Dt_StockInfoDetailss',
+    path: '/StockDetailByMateriel',
+    name: 'StockDetailByMateriel',
     component: () => import('@/views/stock/stockInfoDetailByMaterielSum.vue')
   }
 ]
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/outbound/BatchPickingConfirm.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/outbound/BatchPickingConfirm.vue"
index 48d960a..1c9c6a2 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/outbound/BatchPickingConfirm.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/outbound/BatchPickingConfirm.vue"
@@ -27,8 +27,8 @@
             @keyup.enter.native="onBarcodeScan">
           </el-input>
           <el-button type="success" @click="confirmPicking">纭鎷i��</el-button>
-          <el-button type="warning" @click="openSplitDialog">鎷嗗寘</el-button>
-          <el-button type="info" @click="openRevertSplitDialog">鎾ら攢鎷嗗寘</el-button>
+          <!-- <el-button type="warning" @click="openSplitDialog">鎷嗗寘</el-button>
+          <el-button type="info" @click="openRevertSplitDialog">鎾ら攢鎷嗗寘</el-button> -->
           <el-button type="info" @click="handleEmptyPallet">鍙栫┖绠�</el-button>
           <el-button type="primary" @click="openBatchReturnDialog">鍥炲簱</el-button>
         </div>
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/stock/stockInfoDetailByMaterielSum.vue" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/stock/stockInfoDetailByMaterielSum.vue"
index 0e48a14..ff9e92c 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/stock/stockInfoDetailByMaterielSum.vue"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WIDESEA_WMSClient/src/views/stock/stockInfoDetailByMaterielSum.vue"
@@ -12,9 +12,9 @@
     const table = ref({
       key: "id",
       footer: "Foots",
-      cnName: "搴撳瓨淇℃伅鏄庣粏",
-      name: "stockInfoDetail",
-      url: "/StockInfoDetail/",
+      cnName: "搴撳瓨姹囨��",
+      name: "StockDetailByMateriel",
+      url: "/StockDetailByMateriel/",
       sortName: "id",
     });
     const editFormFields = ref({
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_AllocateService/AllocateDetailService.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_AllocateService/AllocateDetailService.cs"
index 16ac24f..cd2b75e 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_AllocateService/AllocateDetailService.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_AllocateService/AllocateDetailService.cs"
@@ -15,37 +15,72 @@
 {
     public class AllocateDetailService : ServiceBase<Dt_AllocateOrderDetail, IRepository<Dt_AllocateOrderDetail>>, IAllocateDetailService
     {
-        public AllocateDetailService(IRepository<Dt_AllocateOrderDetail> BaseDal) : base(BaseDal)
+        public readonly IRepository<Dt_AllocateOrder> _allocateOrderRepository;
+        public AllocateDetailService(IRepository<Dt_AllocateOrderDetail> BaseDal, IRepository<Dt_AllocateOrder> allocateOrderRepository) : base(BaseDal)
         {
+            _allocateOrderRepository = allocateOrderRepository;
         }
 
         IRepository<Dt_AllocateOrderDetail> IAllocateDetailService.Repository => BaseDal;
 
-        public override PageGridData<Dt_AllocateOrderDetail> GetPageData(PageDataOptions options)
+        public override PageGridData<Dt_OutboundOrderDetail> GetDetailPage(PageDataOptions options)
         {
+            string wheres = ValidatePageOptions(options);
+            //鑾峰彇鎺掑簭瀛楁
+            Dictionary<string, SqlSugar.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);
+            }
 
-            ISugarQueryable<Dt_AllocateOrderDetail> sugarQueryable1 = BaseDal.Db.Queryable<Dt_AllocateOrderDetail>();
+
+            int totalCount = 0;
+            List<SearchParameters> searchParametersList = new List<SearchParameters>();
             if (!string.IsNullOrEmpty(options.Wheres))
             {
-
-                List<SearchParameters> searchParametersList = options.Wheres.DeserializeObject<List<SearchParameters>>();
-                int totalCount = 0;
-                if (searchParametersList.Count > 0)
+                try
                 {
-                    {
-                        SearchParameters? searchParameters = searchParametersList.FirstOrDefault(x => x.Name == nameof(Dt_AllocateOrderDetail.OrderId).FirstLetterToLower());
-                        if (searchParameters != null)
-                        {
-                            sugarQueryable1 = sugarQueryable1.Where(x => x.OrderId == searchParameters.Value.ObjToInt());
-                            var dataList = sugarQueryable1.ToPageList(options.Page, options.Rows, ref totalCount);
-                            return new PageGridData<Dt_AllocateOrderDetail>(totalCount, dataList);
-                        }
-                    }
-
-
+                    searchParametersList = options.Wheres.DeserializeObject<List<SearchParameters>>();
+                    options.Filter = searchParametersList;
                 }
+                catch { }
             }
-            return new PageGridData<Dt_AllocateOrderDetail>();
+            //var data = BaseDal.Db.Queryable<Dt_AllocateOrderDetail>()
+            //    .WhereIF(!wheres.IsNullOrEmpty(), wheres)
+            //    .OrderBy(orderByModels)
+            //    .ToPageList(options.Page, options.Rows, ref totalCount);
+            //Dt_AllocateOrder allocateOrder = _allocateOrderRepository.QueryFirst(x => x.Id == (int)options.Value);
+            //Dt_InboundOrder _InboundOrder = SqlSugarHelper.DbWMS.Queryable<Dt_InboundOrder>().Where(x => x.UpperOrderNo == allocateOrder.UpperOrderNo).First();
+            //var details = _inboundOrderDetailRepository.QueryData(x => x.OrderId == _InboundOrder.Id );
+            //foreach (var item in data)
+            //{
+            //    var detail = details.Where(x => x.MaterielCode == item.MaterielCode).FirstOrDefault();
+            //    if (detail != null)
+            //    {
+            //        item.OrderQuantity = detail.OrderQuantity;
+            //        item.ReceiptQuantity = detail.ReceiptQuantity;
+            //        item.OverInQuantity = detail.OverInQuantity;
+            //        item.OrderDetailStatus = detail.OrderDetailStatus;
+            //    }
+            //}
+            //return new PageGridData<Dt_AllocateOrderDetail>(totalCount, data);
+
+            Dt_AllocateOrder allocateOrder = _allocateOrderRepository.QueryFirst(x => x.Id == options.Filter.FirstOrDefault().Value.ObjToInt());
+            Dt_OutboundOrder _InboundOrder = SqlSugarHelper.DbWMS.Queryable<Dt_OutboundOrder>().Where(x => x.UpperOrderNo == allocateOrder.UpperOrderNo).First();
+
+            var data = BaseDal.Db.Queryable<Dt_OutboundOrderDetail>()
+                .WhereIF(!_InboundOrder.IsNullOrEmpty(), x => x.OrderId == _InboundOrder.Id)
+                .OrderBy(orderByModels)
+                .ToPageList(options.Page, options.Rows, ref totalCount);
+
+
+            return new PageGridData<Dt_OutboundOrderDetail>(totalCount, data);
         }
     }
 }
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_IAllocateService/IAllocateDetailService.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_IAllocateService/IAllocateDetailService.cs"
index 0d40c4b..e99b66e 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_IAllocateService/IAllocateDetailService.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_IAllocateService/IAllocateDetailService.cs"
@@ -12,5 +12,6 @@
     public interface IAllocateDetailService : IService<Dt_AllocateOrderDetail>
     {
         IRepository<Dt_AllocateOrderDetail> Repository { get; }
+
     }
 }
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_IStockService/IStockDetailByMaterielService.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_IStockService/IStockDetailByMaterielService.cs"
index 1e93b7a..d7838cc 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_IStockService/IStockDetailByMaterielService.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_IStockService/IStockDetailByMaterielService.cs"
@@ -11,10 +11,8 @@
 
 namespace WIDESEA_IStockService
 {
-    public interface IStockDetailByMaterielService : IService<StockDetailByMateriel>
+    public interface IStockDetailByMaterielService : IDependency
     {
-        IRepository<StockDetailByMateriel> Repository { get; }
-
-        PageGridData<StockDetailByMateriel> GetPageData2(PageDataOptions options);
+        PageGridData<StockDetailByMateriel> GetPageGridData(PageDataOptions options);
     }
 }
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_IStockService/IStockInfoDetailService.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_IStockService/IStockInfoDetailService.cs"
index 4a4d548..93c7e76 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_IStockService/IStockInfoDetailService.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_IStockService/IStockInfoDetailService.cs"
@@ -15,6 +15,5 @@
 
         PageGridData<StockInfoDetailWithPalletDto> GetPageData2(PageDataOptions options);
 
-        PageGridData<StockDetailDtO> GetPageDataByMateriel(PageDataOptions options);
     }
 }
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_InboundService/InboundOrderService.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_InboundService/InboundOrderService.cs"
index 2dd5af5..a53f5bf 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_InboundService/InboundOrderService.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_InboundService/InboundOrderService.cs"
@@ -652,7 +652,7 @@
             {
                 return WebResponseContent.Instance.Error("鎵樼洏鍙蜂笉鑳戒负绌�");
             }
-            var stock = _stockRepository.Db.Queryable<Dt_StockInfo>().Includes(o => o.Details).First(x => x.PalletCode == palletCode && x.StockStatus == (int)StockStatusEmun.缁勭洏鏆傚瓨);
+            var stock = _stockRepository.Db.Queryable<Dt_StockInfo>().Includes(o => o.Details).First(x => x.PalletCode == palletCode && (x.StockStatus == (int)StockStatusEmun.缁勭洏鏆傚瓨|| x.StockStatus == StockStatusEmun.鍏ュ簱纭.ObjToInt()));
             if (stock == null)
             {
                 return WebResponseContent.Instance.Error($"鏈壘鍒版墭鐩樺彿{palletCode}瀵瑰簲鐨勫簱瀛樿褰�");
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_Model/Models/Stock/StockDetailByMateriel.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_Model/Models/Stock/StockDetailByMateriel.cs"
index 3e31cd2..0ce5391 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_Model/Models/Stock/StockDetailByMateriel.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_Model/Models/Stock/StockDetailByMateriel.cs"
@@ -70,5 +70,12 @@
         public DateTime? ValidDate { get; set; }
 
         public string Remark { get; set; }
+
+        public string Creater { get; set; }
+
+        public DateTime? CreateDate { get; set; }
+        public string Modifier { get; set; }
+        public DateTime? ModifyDate { get; set; }
+
     }
 }
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/StockDetailByMaterielService.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/StockDetailByMaterielService.cs"
index 15e4b18..ea36886 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/StockDetailByMaterielService.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/StockDetailByMaterielService.cs"
@@ -1,12 +1,164 @@
-锘縰sing System;
+锘縰sing SqlSugar;
+using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using WIDESEA_Core;
+using WIDESEA_Core.BaseRepository;
+using WIDESEA_Core.BaseServices;
+using WIDESEA_Core.Helper;
+using WIDESEA_DTO.Stock;
+using WIDESEA_IStockService;
+using WIDESEA_Model.Models;
 
 namespace WIDESEA_StockService
 {
-    internal class StockDetailByMaterielService
+    public class StockDetailByMaterielService :IStockDetailByMaterielService
     {
+        private readonly IUnitOfWorkManage _unitOfWorkManage;
+        private readonly SqlSugarClient _dbBase;
+
+        public StockDetailByMaterielService(IUnitOfWorkManage unitOfWorkManage)
+        {
+            _unitOfWorkManage = unitOfWorkManage;
+            _dbBase = unitOfWorkManage.GetDbClient();
+        }
+
+
+        public virtual PageGridData<StockDetailByMateriel> GetPageGridData(PageDataOptions options)
+        {
+            try
+            {
+
+                List<StockDetailByMateriel> materielnfoStatistics = new List<StockDetailByMateriel>();
+                ISugarQueryable<Dt_StockInfoDetail> sugarQueryable1 = _dbBase.Queryable<Dt_StockInfoDetail>();
+
+                ISugarQueryable<Dt_StockInfo> sugarQueryable = _dbBase.Queryable<Dt_StockInfo>();
+                if (!string.IsNullOrEmpty(options.Wheres))
+                {
+                    try
+                    {
+                        List<SearchParameters> searchParametersList = options.Wheres.DeserializeObject<List<SearchParameters>>();
+                        if (searchParametersList.Count > 0)
+                        {
+                            {
+                                SearchParameters? searchParameters = searchParametersList.FirstOrDefault(x => x.Name == nameof(Dt_StockInfoDetail.MaterielCode).FirstLetterToLower());
+                                if (searchParameters != null)
+                                {
+                                    sugarQueryable1 = sugarQueryable1.Where(x => x.MaterielCode.Contains(searchParameters.Value));
+                                }
+                            }
+                            {
+                                SearchParameters? searchParameters = searchParametersList.FirstOrDefault(x => x.Name == nameof(Dt_StockInfo.WarehouseId).FirstLetterToLower());
+                                if (searchParameters != null)
+                                {
+                                    sugarQueryable = sugarQueryable.Where(x => x.WarehouseId.Equals(searchParameters.Value));
+                                }
+                            }
+                            {
+                                SearchParameters? searchParameters = searchParametersList.FirstOrDefault(x => x.Name == nameof(Dt_StockInfo.StockStatus).FirstLetterToLower());
+                                if (searchParameters != null)
+                                {
+                                    sugarQueryable = sugarQueryable.Where(x => x.StockStatus.Equals(searchParameters.Value));
+                                }
+                            }
+                            {
+                                SearchParameters? searchParameters = searchParametersList.FirstOrDefault(x => x.Name == nameof(Dt_StockInfoDetail.MaterielName).FirstLetterToLower());
+                                if (searchParameters != null)
+                                {
+                                    sugarQueryable1 = sugarQueryable1.Where(x => x.MaterielName.Contains(searchParameters.Value));
+                                }
+                            }
+
+                        }
+
+                    }
+                    catch (Exception ex)
+                    {
+
+                    }
+                }
+
+
+                ISugarQueryable<StockDetailByMateriel> sugarQueryable2 = sugarQueryable1.InnerJoin(sugarQueryable, (b, a) => b.StockId == a.Id).Where((b, a) => a.LocationCode != "" && a.LocationCode != null).Select((b, a)
+                    => new StockDetailByMateriel
+                    {
+                       StockId = b.StockId,
+                        MaterielCode = b.MaterielCode,
+                        MaterielName = b.MaterielName,
+                        StockQuantity = (decimal)b.StockQuantity,
+                        OutboundQuantity = (decimal)b.OutboundQuantity,
+                        OrderNo = b.OrderNo,
+                        BatchNo = b.BatchNo,
+                        SerialNumber = b.SerialNumber,
+                        SupplyCode = b.SupplyCode,
+                        WarehouseCode = b.WarehouseCode,
+                        Barcode = b.Barcode,
+                        Unit = b.Unit,
+                        Creater = b.Creater,
+                        CreateDate= b.CreateDate,
+                        Modifier = b.Modifier,
+                        ModifyDate = b.ModifyDate,
+                        Remark = a.Remark,
+
+                    });
+                // 鑾峰彇鎵�鏈夋暟鎹�
+                var allData = sugarQueryable2.ToList();
+
+                // 浣跨敤瀛楀吀杩涜鍒嗙粍姹囨��
+                var groupedData = new Dictionary<string, StockDetailByMateriel>();
+                foreach (var item in allData)
+                {
+                    // 纭繚鍒濆鍊间负decimal绫诲瀷
+                    if (groupedData.ContainsKey(item.MaterielCode))
+                    {
+                        groupedData[item.MaterielCode].StockQuantity += Convert.ToDecimal(item.StockQuantity);
+                        groupedData[item.MaterielCode].OutboundQuantity += Convert.ToDecimal(item.OutboundQuantity);
+                    }
+                    else
+                    {
+                        groupedData[item.MaterielCode] = new StockDetailByMateriel
+                        {
+                            StockId = item.StockId,
+                            MaterielCode = item.MaterielCode,
+                            MaterielName = item.MaterielName,
+                            StockQuantity = Convert.ToDecimal(item.StockQuantity),
+                            OutboundQuantity = Convert.ToDecimal(item.OutboundQuantity),
+                            OrderNo = item.OrderNo,
+                            BatchNo = item.BatchNo,
+                            SerialNumber = item.SerialNumber,
+                            SupplyCode = item.SupplyCode,
+                            WarehouseCode = item.WarehouseCode,
+                            Barcode = item.Barcode,
+                            Creater = item.Creater,
+                            CreateDate = item.CreateDate,
+                            Modifier = item.Modifier,
+                            ModifyDate = item.ModifyDate,
+                            Unit = item.Unit,
+                            Remark = item.Remark
+                        };
+                    }
+                }
+
+                // 杞崲涓哄垪琛�
+                materielnfoStatistics = groupedData.Values.ToList();
+
+                // 鍒嗛〉澶勭悊
+                int startIndex = (options.Page - 1) * options.Rows;
+                int endIndex = Math.Min(startIndex + options.Rows, materielnfoStatistics.Count);
+                materielnfoStatistics = materielnfoStatistics.GetRange(startIndex, endIndex - startIndex);
+
+                int count = groupedData.Count;
+
+                return new PageGridData<StockDetailByMateriel>(count, materielnfoStatistics);
+
+            }
+            catch (Exception ex)
+            {
+
+            }
+            return new PageGridData<StockDetailByMateriel>();
+        }
     }
 }
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 4371f76..61edf7a 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"
@@ -73,41 +73,6 @@
             return new PageGridData<StockInfoDetailWithPalletDto> { Rows = dtoList, Total = lists.Total, Summary = lists.Summary  };
         }
 
-        public PageGridData<StockDetailDtO> GetPageDataByMateriel(PageDataOptions options)
-        {
-            PageGridData<Dt_StockInfoDetail> lists = base.GetPageData(options);
-
-            List<StockDetailDtO> dtoList = lists.Rows.GroupBy(detail => new { detail.MaterielCode, detail.BatchNo, detail.SupplyCode }).Select(group =>
-            {
-                var firstItem = group.First();
-                return new StockDetailDtO
-                {
-                    Id = firstItem.Id,
-                    StockId = firstItem.StockId,
-                    MaterielCode = group.Key.MaterielCode, 
-                    MaterielName = firstItem.MaterielName,
-                    OrderNo = firstItem.OrderNo,
-                    BatchNo = group.Key.BatchNo, 
-                    ProductionDate = firstItem.ProductionDate,
-                    EffectiveDate = firstItem.EffectiveDate,
-                    SerialNumber = firstItem.SerialNumber,
-                    // 鏍稿績锛氬褰撳墠鍒嗙粍鐨凷tockQuantity姹傚拰
-                    StockQuantity = group.Sum(item => item.StockQuantity),
-                    OutboundQuantity = firstItem.OutboundQuantity,
-                    Status = firstItem.Status,
-                    Unit = firstItem.Unit,
-                    InboundOrderRowNo = firstItem.InboundOrderRowNo,
-                    SupplyCode = group.Key.SupplyCode,
-                    WarehouseCode = firstItem.WarehouseCode,
-                    Barcode = firstItem.Barcode,
-                    BusinessType = firstItem.BusinessType,
-                    Remark = firstItem.Remark
-                };
-            }).ToList();
-            
-
-            return new PageGridData<StockDetailDtO> { Rows = dtoList, Total = lists.Total, Summary = lists.Summary };
-        }
     }
  }
 
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_WMSServer/Controllers/Allocate/AllocateOrderDetailController.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_WMSServer/Controllers/Allocate/AllocateOrderDetailController.cs"
index 7f0c236..e259237 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_WMSServer/Controllers/Allocate/AllocateOrderDetailController.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_WMSServer/Controllers/Allocate/AllocateOrderDetailController.cs"
@@ -1,5 +1,9 @@
-锘縰sing Microsoft.AspNetCore.Mvc;
+锘縰sing Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Mvc;
+using WIDESEA_Core;
+using WIDESEA_Core.Attributes;
 using WIDESEA_Core.BaseController;
+using WIDESEA_DTO.Inbound;
 using WIDESEA_IAllocateService;
 using WIDESEA_Model.Models;
 
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_WMSServer/Controllers/Stock/StockDetailByMaterielController.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_WMSServer/Controllers/Stock/StockDetailByMaterielController.cs"
new file mode 100644
index 0000000..27e5858
--- /dev/null
+++ "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_WMSServer/Controllers/Stock/StockDetailByMaterielController.cs"
@@ -0,0 +1,26 @@
+锘縰sing Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Mvc;
+using WIDESEA_Core;
+using WIDESEA_DTO.Stock;
+using WIDESEA_IStockService;
+using WIDESEA_Model.Models;
+using WIDESEA_StockService;
+
+namespace WIDESEA_WMSServer.Controllers.Stock
+{
+    [Route("api/StockDetailByMateriel")]
+    [Authorize, ApiController]
+    public class StockDetailByMaterielController:Controller
+    {
+        public readonly IStockDetailByMaterielService _stockDetailByMaterielService;
+        public StockDetailByMaterielController(IStockDetailByMaterielService stockDetailByMaterielService)
+        {
+            _stockDetailByMaterielService = stockDetailByMaterielService;
+        }
+        [HttpPost, Route("GetPageData")]
+        public PageGridData<StockDetailByMateriel> GetPageData([FromBody] PageDataOptions options)
+        {
+            return _stockDetailByMaterielService.GetPageGridData(options);
+        }
+    }
+}
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_WMSServer/Controllers/Stock/StockInfoDetailController.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_WMSServer/Controllers/Stock/StockInfoDetailController.cs"
index 607f07b..e192624 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_WMSServer/Controllers/Stock/StockInfoDetailController.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_WMSServer/Controllers/Stock/StockInfoDetailController.cs"
@@ -31,10 +31,5 @@
             return Json(result);
         }
 
-        [HttpPost, Route("GetPageDataByMateriel"),AllowAnonymous]
-        public PageGridData<StockDetailDtO> GetPageDataByMateriel([FromBody] PageDataOptions options)
-        {
-            return Service.GetPageDataByMateriel(options);
-        }
     }
 }

--
Gitblit v1.9.3