From 917fcfa0149b5e9a6bb23cbb31decbaaa02b19ae Mon Sep 17 00:00:00 2001
From: heshaofeng <heshaofeng@hnkhzn.com>
Date: 星期二, 23 十二月 2025 08:50:27 +0800
Subject: [PATCH] Merge branch 'htq20251215' of http://115.159.85.185:8098/r/ZhongRui/ALDbanyunxiangmu into htq20251215

---
 项目代码/WMS无仓储版/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.1204.46620/SemanticSymbols.db |    0 
 项目代码/WMS无仓储版/WIDESEA_WMSServer/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.1204.46620/CodeChunks.db      |    0 
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundService.cs                               |   17 ++++++++++++-----
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_Core/BaseRepository/RepositoryBase.cs                            |    9 ++++++---
 4 files changed, 18 insertions(+), 8 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/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.1204.46620/CodeChunks.db" "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/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.1204.46620/CodeChunks.db"
index fdaab99..7daab4d 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/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.1204.46620/CodeChunks.db"
+++ "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/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.1204.46620/CodeChunks.db"
Binary files differ
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/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.1204.46620/SemanticSymbols.db" "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/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.1204.46620/SemanticSymbols.db"
index b492550..2644848 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/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.1204.46620/SemanticSymbols.db"
+++ "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/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.1204.46620/SemanticSymbols.db"
Binary files differ
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_Core/BaseRepository/RepositoryBase.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_Core/BaseRepository/RepositoryBase.cs"
index aae83ad..a49d374 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_Core/BaseRepository/RepositoryBase.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_Core/BaseRepository/RepositoryBase.cs"
@@ -873,7 +873,10 @@
         {
             Type type = entity.GetType();
             Assembly assembly = type.Assembly;
-            Type? htyType = assembly.GetType(type.FullName + "_Hty");
+
+            Type? htyType = assembly.GetTypes().FirstOrDefault(t => !t.IsInterface && !t.IsAbstract && type.IsAssignableFrom(t) && typeof(IBaseHistoryEntity).IsAssignableFrom(t));
+
+            //assembly.GetType(type.FullName + "_Hty");
             if (htyType != null)
             {
                 object? obj = Activator.CreateInstance(htyType);
@@ -892,7 +895,7 @@
                         PropertyInfo propertyInfo = propertyInfos[i];
                         PropertyInfo? property = type.GetProperty(propertyInfo.Name);
 
-                        if (property != null)
+                        if (property != null && property.CanWrite)
                         {
                             if (propertyInfo.Name == nameof(BaseEntity.Modifier))
                             {
@@ -905,7 +908,7 @@
                         }
                     }
                     if (obj != null)
-                        _db.InsertableByObject(obj).AS(type.Name + "_Hty").ExecuteCommand();
+                        _db.InsertableByObject(obj).AS(htyType.Name).ExecuteCommand();
                 }
             }
             return DeleteData(entity);
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_OutboundService/OutboundService.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_OutboundService/OutboundService.cs"
index b2df8da..51a849f 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_OutboundService/OutboundService.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_OutboundService/OutboundService.cs"
@@ -1015,34 +1015,41 @@
                         //}
                         List<Barcodes> barcodesList = new List<Barcodes>();
                         List<Dt_StockInfoDetail> stockInfoDetails = stockInfo.Details.Where((x => x.StockQuantity > x.OutboundQuantity)).ToList();
+
+                        decimal itemQuantity = item.LockQuantity - item.OverOutQuantity;
+
                         foreach (var stockDetail in stockInfoDetails)
                         {
-                            if (item.LockQuantity - item.OverOutQuantity >= stockDetail.StockQuantity - stockInfoDetail.OutboundQuantity)
+                            if (itemQuantity >= stockDetail.StockQuantity - stockDetail.OutboundQuantity)
                             {
                                 Barcodes barcodes = new Barcodes
                                 {
                                     Barcode = stockDetail.Barcode,
-                                    Qty = stockDetail.StockQuantity - stockInfoDetail.OutboundQuantity,
+                                    Qty = stockDetail.StockQuantity - stockDetail.OutboundQuantity,
                                     SupplyCode = stockDetail?.SupplyCode ?? "",
                                     BatchNo = stockDetail?.BatchNo ?? "",
                                     Unit = stockDetail?.Unit ?? ""
                                 };
 
-                                stockDetail.StockQuantity = stockInfoDetail.OutboundQuantity;
+                                itemQuantity -= (stockDetail.StockQuantity - stockDetail.OutboundQuantity);
+                                stockDetail.OutboundQuantity = stockDetail.StockQuantity;
                                 barcodesList.Add(barcodes);
+
+                                if (itemQuantity <= 0) break;
                             }
                             else
                             {
                                 Barcodes barcodes = new Barcodes
                                 {
                                     Barcode = stockDetail.Barcode,
-                                    Qty = item.LockQuantity - item.OverOutQuantity,
+                                    Qty = itemQuantity,
                                     SupplyCode = stockDetail?.SupplyCode ?? "",
                                     BatchNo = stockDetail?.BatchNo ?? "",
                                     Unit = stockDetail?.Unit ?? ""
                                 };
-                                stockInfoDetail.OutboundQuantity += item.LockQuantity - item.OverOutQuantity;
+                                stockDetail.OutboundQuantity += itemQuantity;
                                 barcodesList.Add(barcodes);
+                                break;
                             }
                         }
 

--
Gitblit v1.9.3