From 587f0335544a6a0be00de5f56cb31af81169121e Mon Sep 17 00:00:00 2001
From: heshaofeng <heshaofeng@hnkhzn.com>
Date: 星期四, 04 十二月 2025 15:58:17 +0800
Subject: [PATCH] 提交

---
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Outbound.cs   |   54 -----
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundPickingService.cs |    5 
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_Core/BaseRepository/RepositoryBase.cs     |  426 +++++++++++++++++++++++-----------------------
 3 files changed, 221 insertions(+), 264 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_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 dc57ad4..2d08e68 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"
@@ -869,237 +869,237 @@
              .WhereIF(whereExpression != null, whereExpression).ToListAsync();
         }
 
-        //public bool DeleteAndMoveIntoHty(TEntity entity, OperateTypeEnum operateType)
-        //{
-        //    Type type = entity.GetType();
-        //    Assembly assembly = type.Assembly;
-        //    Type? htyType = assembly.GetType(type.FullName + "_Hty");
-        //    if (htyType != null)
-        //    {
-        //        object? obj = Activator.CreateInstance(htyType);
-        //        PropertyInfo keyPro = typeof(TEntity).GetKeyProperty();
-        //        PropertyInfo? operateTypePro = htyType.GetProperty(nameof(IBaseHistoryEntity.OperateType));
-        //        PropertyInfo? sourceIdPro = htyType.GetProperty(nameof(IBaseHistoryEntity.SourceId));
-        //        if (obj != null && keyPro != null && operateTypePro != null && sourceIdPro != null)
-        //        {
-        //            operateTypePro.SetValue(obj, operateType.ToString());
-        //            sourceIdPro.SetValue(obj, keyPro.GetValue(entity));
-
-        //            List<PropertyInfo> propertyInfos = htyType.GetProperties().Where(x => x.Name != operateTypePro.Name && x.Name != sourceIdPro.Name && x.Name != keyPro.Name).ToList();
-
-        //            for (int i = 0; i < propertyInfos.Count; i++)
-        //            {
-        //                PropertyInfo propertyInfo = propertyInfos[i];
-        //                PropertyInfo? property = type.GetProperty(propertyInfo.Name);
-
-        //                if (property != null)
-        //                {
-        //                    if (propertyInfo.Name == nameof(BaseEntity.Modifier))
-        //                    {
-        //                        propertyInfo.SetValue(obj, App.User.UserId > 0 ? App.User.UserName : "System");
-        //                    }
-        //                    else if (propertyInfo.Name == nameof(BaseEntity.ModifyDate))
-        //                    {
-        //                        propertyInfo.SetValue(obj, DateTime.Now);
-        //                    }                            
-        //                    else
-        //                    {
-        //                        propertyInfo.SetValue(obj, property.GetValue(entity));
-        //                    }
-        //                }
-        //            }
-        //            if (obj != null)
-        //                _db.InsertableByObject(obj).AS(type.Name + "_Hty").ExecuteCommand();
-        //        }
-        //    }
-        //    return DeleteData(entity);
-
-        //}
-
         public bool DeleteAndMoveIntoHty(TEntity entity, OperateTypeEnum operateType)
         {
-            // 鏍稿績閫昏緫锛氱敤浜嬪姟淇濊瘉鍘熷瓙鎬э紝寮傚父鎹曡幏閬垮厤娴佺▼涓柇锛屾棩蹇楄緟鍔╂帓鏌�
-            bool isSuccess = false;
-            string entityTypeName = entity?.GetType().Name ?? "鏈煡瀹炰綋";
-
-            try
+            Type type = entity.GetType();
+            Assembly assembly = type.Assembly;
+            Type? htyType = assembly.GetType(type.FullName + "_Hty");
+            if (htyType != null)
             {
-                // 鍓嶇疆鏍¢獙锛氬疄浣撲笉鑳戒负绌�
-                if (entity == null)
+                object? obj = Activator.CreateInstance(htyType);
+                PropertyInfo keyPro = typeof(TEntity).GetKeyProperty();
+                PropertyInfo? operateTypePro = htyType.GetProperty(nameof(IBaseHistoryEntity.OperateType));
+                PropertyInfo? sourceIdPro = htyType.GetProperty(nameof(IBaseHistoryEntity.SourceId));
+                if (obj != null && keyPro != null && operateTypePro != null && sourceIdPro != null)
                 {
-                    return false;
-                }
+                    operateTypePro.SetValue(obj, operateType.ToString());
+                    sourceIdPro.SetValue(obj, keyPro.GetValue(entity));
 
-                Type entityType = entity.GetType();
-                Assembly assembly = entityType.Assembly;
-                string htyTypeName = $"{entityType.FullName}_Hty";
-                Type? htyType = assembly.GetType(htyTypeName);
+                    List<PropertyInfo> propertyInfos = htyType.GetProperties().Where(x => x.Name != operateTypePro.Name && x.Name != sourceIdPro.Name && x.Name != keyPro.Name).ToList();
 
-                // 1. 妫�鏌ュ巻鍙茶〃绫诲瀷鏄惁瀛樺湪
-                if (htyType == null)
-                {
-                 
-                    return false;
-                }
-
-                // 2. 鍒涘缓鍘嗗彶琛ㄥ疄渚嬶紙澶勭悊鏃犲弬鏋勯�犲嚱鏁颁笉瀛樺湪鐨勬儏鍐碉級
-                object? htyObj;
-                try
-                {
-                    htyObj = Activator.CreateInstance(htyType);
-                }
-                catch (Exception ex)
-                {
-                    // _logger.LogError(ex, "DeleteAndMoveIntoHty锛氬垱寤哄巻鍙茶〃瀹炰緥 {HtyTypeName} 澶辫触", htyTypeName);
-                    return false;
-                }
-                if (htyObj == null)
-                {
-                    // _logger.LogWarning("DeleteAndMoveIntoHty锛氬巻鍙茶〃瀹炰緥 {HtyTypeName} 鍒涘缓缁撴灉涓簄ull", htyTypeName);
-                    return false;
-                }
-
-                // 3. 鑾峰彇鏍稿績灞炴�э紙鎸囧畾BindingFlags纭繚鑾峰彇鍏叡瀹炰緥灞炴�э級
-                BindingFlags propFlags = BindingFlags.Public | BindingFlags.Instance;
-                PropertyInfo? keyPro = typeof(TEntity).GetKeyProperty(); // 鑷畾涔夋柟娉曢渶纭繚杩斿洖闈炵┖锛屾澶勫鍔犲垽绌�
-                PropertyInfo? operateTypePro = htyType.GetProperty(nameof(IBaseHistoryEntity.OperateType), propFlags);
-                PropertyInfo? sourceIdPro = htyType.GetProperty(nameof(IBaseHistoryEntity.SourceId), propFlags);
-
-                // 鏍¢獙鏍稿績灞炴�ф槸鍚﹀瓨鍦�
-                if (keyPro == null)
-                {
-                    //_logger.LogError("DeleteAndMoveIntoHty锛氬疄浣� {EntityType} 鏈壘鍒颁富閿睘鎬�", entityType.FullName);
-                    return false;
-                }
-                if (operateTypePro == null)
-                {
-                    //_logger.LogError("DeleteAndMoveIntoHty锛氬巻鍙茶〃 {HtyTypeName} 鏈壘鍒癘perateType灞炴��", htyTypeName);
-                    return false;
-                }
-                if (sourceIdPro == null)
-                {
-                    // _logger.LogError("DeleteAndMoveIntoHty锛氬巻鍙茶〃 {HtyTypeName} 鏈壘鍒癝ourceId灞炴��", htyTypeName);
-                    return false;
-                }
-
-                // 4. 璧嬪�兼牳蹇冨睘鎬э紙鏍¢獙绫诲瀷鍖归厤锛岄伩鍏峉etValue鎶涘紓甯革級
-                try
-                {
-                    // 澶勭悊OperateType绫诲瀷鍖归厤锛氳嫢鍘嗗彶琛ㄥ睘鎬ф槸鏋氫妇绫诲瀷锛岀洿鎺ヤ紶鏋氫妇鑰岄潪瀛楃涓�
-                    if (operateTypePro.PropertyType == typeof(OperateTypeEnum))
+                    for (int i = 0; i < propertyInfos.Count; i++)
                     {
-                        operateTypePro.SetValue(htyObj, operateType);
-                    }
-                    else if (operateTypePro.PropertyType == typeof(string))
-                    {
-                        operateTypePro.SetValue(htyObj, operateType.ToString());
-                    }
-                    else
-                    {
-                        //_logger.LogError("DeleteAndMoveIntoHty锛氬巻鍙茶〃 {HtyTypeName} 鐨凮perateType灞炴�х被鍨� {PropType} 涓嶅尮閰嶏紙浠呮敮鎸佹灇涓�/瀛楃涓诧級", htyTypeName, operateTypePro.PropertyType.FullName);
-                        return false;
-                    }
+                        PropertyInfo propertyInfo = propertyInfos[i];
+                        PropertyInfo? property = type.GetProperty(propertyInfo.Name);
 
-                    // 璧嬪�糞ourceId锛堟牎楠岀被鍨嬪尮閰嶏級
-                    object sourceIdValue = keyPro.GetValue(entity)!;
-                    if (sourceIdPro.PropertyType != sourceIdValue.GetType())
-                    {
-                        sourceIdValue = Convert.ChangeType(sourceIdValue, sourceIdPro.PropertyType); // 绫诲瀷杞崲
-                    }
-                    sourceIdPro.SetValue(htyObj, sourceIdValue);
-                }
-                catch (Exception ex)
-                {
-                    // _logger.LogError(ex, "DeleteAndMoveIntoHty锛氬巻鍙茶〃 {HtyTypeName} 鏍稿績灞炴�ц祴鍊煎け璐�", htyTypeName);
-                    return false;
-                }
-
-                // 5. 璧嬪�煎叾浠栧睘鎬э紙鎺掗櫎鏍稿績灞炴�э級
-                List<PropertyInfo> htyProperties = htyType.GetProperties(propFlags)
-                    .Where(x => x.Name != operateTypePro.Name
-                             && x.Name != sourceIdPro.Name
-                             && x.Name != keyPro.Name)
-                    .ToList();
-
-                foreach (PropertyInfo htyProp in htyProperties)
-                {
-                    PropertyInfo? entityProp = entityType.GetProperty(htyProp.Name, propFlags);
-                    if (entityProp == null) continue; // 瀹炰綋鏃犺灞炴�у垯璺宠繃
-
-                    try
-                    {
-                        object propValue;
-                        // 澶勭悊淇敼浜猴細閬垮厤App.User绌哄紩鐢�
-                        if (htyProp.Name == nameof(BaseEntity.Modifier))
+                        if (property != null)
                         {
-                            propValue = App.User?.UserId > 0 ? App.User?.UserName : "System";
+                            if (propertyInfo.Name == nameof(BaseEntity.Modifier))
+                            {
+                                propertyInfo.SetValue(obj, App.User.UserId > 0 ? App.User.UserName : "System");
+                            }
+                            else if (propertyInfo.Name == nameof(BaseEntity.ModifyDate))
+                            {
+                                propertyInfo.SetValue(obj, DateTime.Now);
+                            }
+                            else
+                            {
+                                propertyInfo.SetValue(obj, property.GetValue(entity));
+                            }
                         }
-                        // 澶勭悊淇敼鏃堕棿
-                        else if (htyProp.Name == nameof(BaseEntity.ModifyDate))
-                        {
-                            propValue = DateTime.Now;
-                        }
-                        // 鍏朵粬灞炴�т粠鍘熷疄浣撳彇鍊�
-                        else
-                        {
-                            propValue = entityProp.GetValue(entity) ?? DBNull.Value; // 澶勭悊null鍊�
-                        }
-
-                        // 绫诲瀷杞崲鍚庤祴鍊硷紙閬垮厤绫诲瀷涓嶅尮閰嶏級
-                        if (propValue != DBNull.Value && propValue != null)
-                        {
-                            propValue = Convert.ChangeType(propValue, htyProp.PropertyType);
-                        }
-                        htyProp.SetValue(htyObj, propValue);
                     }
-                    catch (Exception ex)
-                    {
-                        // _logger.LogWarning(ex, "DeleteAndMoveIntoHty锛氬巻鍙茶〃 {HtyTypeName} 灞炴�� {PropName} 璧嬪�煎け璐ワ紝璺宠繃璇ュ睘鎬�", htyTypeName, htyProp.Name);
-                    }
+                    if (obj != null)
+                        _db.InsertableByObject(obj).AS(type.Name + "_Hty").ExecuteCommand();
                 }
-                try
-                {                   
-                    // 鎵ц鎻掑叆鍘嗗彶琛�
-                    int insertRows = _db.InsertableByObject(htyObj).AS(entityType.Name + "_Hty").ExecuteCommand();
-
-                    if (insertRows <= 0)
-                    {
-                        // _logger.LogError("DeleteAndMoveIntoHty锛氬巻鍙茶〃 {HtyTypeName} 鎻掑叆澶辫触锛堝奖鍝嶈鏁�0锛�", htyTypeName);
-                        _db.InsertableByObject(htyObj).AS(entityType.Name + "_Hty").ExecuteCommand();
-                        return false;
-                    }
-                    // 鎻掑叆鎴愬姛鍚庢墽琛屽垹闄�
-                    bool deleteSuccess = DeleteData(entity);
-                    if (!deleteSuccess)
-                    {
-                        //_logger.LogError("DeleteAndMoveIntoHty锛氬疄浣� {EntityType} 鍒犻櫎澶辫触", entityType.FullName);
-                        DeleteData(entity);
-                        return false;
-                    }
-                    // 鎻愪氦浜嬪姟
-                 
-                    isSuccess = true;
-                    //_logger.LogInformation("DeleteAndMoveIntoHty锛氬疄浣� {EntityType} 宸叉垚鍔熺Щ鍏ュ巻鍙茶〃骞跺垹闄ゅ師鏁版嵁", entityType.FullName);
-                }
-                catch (Exception ex)
-                {
-                   
-                    // _logger.LogError(ex, "DeleteAndMoveIntoHty锛氫簨鍔℃墽琛屽け璐ワ紙鎻掑叆鍘嗗彶琛�/鍒犻櫎鍘熸暟鎹級", entityType.FullName);
-                    return false;
-                }         
             }
-            catch (Exception ex)
-            {
-                //  _logger.LogError(ex, "DeleteAndMoveIntoHty锛氬鐞嗗疄浣� {EntityTypeName} 鏃跺彂鐢熸湭鎹曡幏寮傚父", entityTypeName);
-                return false;
-            }
+            return DeleteData(entity);
 
-            return isSuccess;
         }
 
+        //public bool DeleteAndMoveIntoHty(TEntity entity, OperateTypeEnum operateType)
+        //{
+        //    // 鏍稿績閫昏緫锛氱敤浜嬪姟淇濊瘉鍘熷瓙鎬э紝寮傚父鎹曡幏閬垮厤娴佺▼涓柇锛屾棩蹇楄緟鍔╂帓鏌�
+        //    bool isSuccess = false;
+        //    string entityTypeName = entity?.GetType().Name ?? "鏈煡瀹炰綋";
+
+        //    try
+        //    {
+        //        // 鍓嶇疆鏍¢獙锛氬疄浣撲笉鑳戒负绌�
+        //        if (entity == null)
+        //        {
+        //            return false;
+        //        }
+
+        //        Type entityType = entity.GetType();
+        //        Assembly assembly = entityType.Assembly;
+        //        string htyTypeName = $"{entityType.FullName}_Hty";
+        //        Type? htyType = assembly.GetType(htyTypeName);
+
+        //        // 1. 妫�鏌ュ巻鍙茶〃绫诲瀷鏄惁瀛樺湪
+        //        if (htyType == null)
+        //        {
+
+        //            return false;
+        //        }
+
+        //        // 2. 鍒涘缓鍘嗗彶琛ㄥ疄渚嬶紙澶勭悊鏃犲弬鏋勯�犲嚱鏁颁笉瀛樺湪鐨勬儏鍐碉級
+        //        object? htyObj;
+        //        try
+        //        {
+        //            htyObj = Activator.CreateInstance(htyType);
+        //        }
+        //        catch (Exception ex)
+        //        {
+        //            // _logger.LogError(ex, "DeleteAndMoveIntoHty锛氬垱寤哄巻鍙茶〃瀹炰緥 {HtyTypeName} 澶辫触", htyTypeName);
+        //            return false;
+        //        }
+        //        if (htyObj == null)
+        //        {
+        //            // _logger.LogWarning("DeleteAndMoveIntoHty锛氬巻鍙茶〃瀹炰緥 {HtyTypeName} 鍒涘缓缁撴灉涓簄ull", htyTypeName);
+        //            return false;
+        //        }
+
+        //        // 3. 鑾峰彇鏍稿績灞炴�э紙鎸囧畾BindingFlags纭繚鑾峰彇鍏叡瀹炰緥灞炴�э級
+        //        BindingFlags propFlags = BindingFlags.Public | BindingFlags.Instance;
+        //        PropertyInfo? keyPro = typeof(TEntity).GetKeyProperty(); // 鑷畾涔夋柟娉曢渶纭繚杩斿洖闈炵┖锛屾澶勫鍔犲垽绌�
+        //        PropertyInfo? operateTypePro = htyType.GetProperty(nameof(IBaseHistoryEntity.OperateType), propFlags);
+        //        PropertyInfo? sourceIdPro = htyType.GetProperty(nameof(IBaseHistoryEntity.SourceId), propFlags);
+
+        //        // 鏍¢獙鏍稿績灞炴�ф槸鍚﹀瓨鍦�
+        //        if (keyPro == null)
+        //        {
+        //            //_logger.LogError("DeleteAndMoveIntoHty锛氬疄浣� {EntityType} 鏈壘鍒颁富閿睘鎬�", entityType.FullName);
+        //            return false;
+        //        }
+        //        if (operateTypePro == null)
+        //        {
+        //            //_logger.LogError("DeleteAndMoveIntoHty锛氬巻鍙茶〃 {HtyTypeName} 鏈壘鍒癘perateType灞炴��", htyTypeName);
+        //            return false;
+        //        }
+        //        if (sourceIdPro == null)
+        //        {
+        //            // _logger.LogError("DeleteAndMoveIntoHty锛氬巻鍙茶〃 {HtyTypeName} 鏈壘鍒癝ourceId灞炴��", htyTypeName);
+        //            return false;
+        //        }
+
+        //        // 4. 璧嬪�兼牳蹇冨睘鎬э紙鏍¢獙绫诲瀷鍖归厤锛岄伩鍏峉etValue鎶涘紓甯革級
+        //        try
+        //        {
+        //            // 澶勭悊OperateType绫诲瀷鍖归厤锛氳嫢鍘嗗彶琛ㄥ睘鎬ф槸鏋氫妇绫诲瀷锛岀洿鎺ヤ紶鏋氫妇鑰岄潪瀛楃涓�
+        //            if (operateTypePro.PropertyType == typeof(OperateTypeEnum))
+        //            {
+        //                operateTypePro.SetValue(htyObj, operateType);
+        //            }
+        //            else if (operateTypePro.PropertyType == typeof(string))
+        //            {
+        //                operateTypePro.SetValue(htyObj, operateType.ToString());
+        //            }
+        //            else
+        //            {
+        //                //_logger.LogError("DeleteAndMoveIntoHty锛氬巻鍙茶〃 {HtyTypeName} 鐨凮perateType灞炴�х被鍨� {PropType} 涓嶅尮閰嶏紙浠呮敮鎸佹灇涓�/瀛楃涓诧級", htyTypeName, operateTypePro.PropertyType.FullName);
+        //                return false;
+        //            }
+
+        //            // 璧嬪�糞ourceId锛堟牎楠岀被鍨嬪尮閰嶏級
+        //            object sourceIdValue = keyPro.GetValue(entity)!;
+        //            if (sourceIdPro.PropertyType != sourceIdValue.GetType())
+        //            {
+        //                sourceIdValue = Convert.ChangeType(sourceIdValue, sourceIdPro.PropertyType); // 绫诲瀷杞崲
+        //            }
+        //            sourceIdPro.SetValue(htyObj, sourceIdValue);
+        //        }
+        //        catch (Exception ex)
+        //        {
+        //            // _logger.LogError(ex, "DeleteAndMoveIntoHty锛氬巻鍙茶〃 {HtyTypeName} 鏍稿績灞炴�ц祴鍊煎け璐�", htyTypeName);
+        //            return false;
+        //        }
+
+        //        // 5. 璧嬪�煎叾浠栧睘鎬э紙鎺掗櫎鏍稿績灞炴�э級
+        //        List<PropertyInfo> htyProperties = htyType.GetProperties(propFlags)
+        //            .Where(x => x.Name != operateTypePro.Name
+        //                     && x.Name != sourceIdPro.Name
+        //                     && x.Name != keyPro.Name)
+        //            .ToList();
+
+        //        foreach (PropertyInfo htyProp in htyProperties)
+        //        {
+        //            PropertyInfo? entityProp = entityType.GetProperty(htyProp.Name, propFlags);
+        //            if (entityProp == null) continue; // 瀹炰綋鏃犺灞炴�у垯璺宠繃
+
+        //            try
+        //            {
+        //                object propValue;
+        //                // 澶勭悊淇敼浜猴細閬垮厤App.User绌哄紩鐢�
+        //                if (htyProp.Name == nameof(BaseEntity.Modifier))
+        //                {
+        //                    propValue = App.User?.UserId > 0 ? App.User?.UserName : "System";
+        //                }
+        //                // 澶勭悊淇敼鏃堕棿
+        //                else if (htyProp.Name == nameof(BaseEntity.ModifyDate))
+        //                {
+        //                    propValue = DateTime.Now;
+        //                }
+        //                // 鍏朵粬灞炴�т粠鍘熷疄浣撳彇鍊�
+        //                else
+        //                {
+        //                    propValue = entityProp.GetValue(entity) ?? DBNull.Value; // 澶勭悊null鍊�
+        //                }
+
+        //                // 绫诲瀷杞崲鍚庤祴鍊硷紙閬垮厤绫诲瀷涓嶅尮閰嶏級
+        //                if (propValue != DBNull.Value && propValue != null)
+        //                {
+        //                    propValue = Convert.ChangeType(propValue, htyProp.PropertyType);
+        //                }
+        //                htyProp.SetValue(htyObj, propValue);
+        //            }
+        //            catch (Exception ex)
+        //            {
+        //                // _logger.LogWarning(ex, "DeleteAndMoveIntoHty锛氬巻鍙茶〃 {HtyTypeName} 灞炴�� {PropName} 璧嬪�煎け璐ワ紝璺宠繃璇ュ睘鎬�", htyTypeName, htyProp.Name);
+        //            }
+        //        }
+        //        try
+        //        {                   
+        //            // 鎵ц鎻掑叆鍘嗗彶琛�
+        //            int insertRows = _db.InsertableByObject(htyObj).AS(entityType.Name + "_Hty").ExecuteCommand();
+
+        //            if (insertRows <= 0)
+        //            {
+        //                // _logger.LogError("DeleteAndMoveIntoHty锛氬巻鍙茶〃 {HtyTypeName} 鎻掑叆澶辫触锛堝奖鍝嶈鏁�0锛�", htyTypeName);
+        //                _db.InsertableByObject(htyObj).AS(entityType.Name + "_Hty").ExecuteCommand();
+        //                return false;
+        //            }
+        //            // 鎻掑叆鎴愬姛鍚庢墽琛屽垹闄�
+        //            bool deleteSuccess = DeleteData(entity);
+        //            if (!deleteSuccess)
+        //            {
+        //                //_logger.LogError("DeleteAndMoveIntoHty锛氬疄浣� {EntityType} 鍒犻櫎澶辫触", entityType.FullName);
+        //                DeleteData(entity);
+        //                return false;
+        //            }
+        //            // 鎻愪氦浜嬪姟
+
+        //            isSuccess = true;
+        //            //_logger.LogInformation("DeleteAndMoveIntoHty锛氬疄浣� {EntityType} 宸叉垚鍔熺Щ鍏ュ巻鍙茶〃骞跺垹闄ゅ師鏁版嵁", entityType.FullName);
+        //        }
+        //        catch (Exception ex)
+        //        {
+
+        //            // _logger.LogError(ex, "DeleteAndMoveIntoHty锛氫簨鍔℃墽琛屽け璐ワ紙鎻掑叆鍘嗗彶琛�/鍒犻櫎鍘熸暟鎹級", entityType.FullName);
+        //            return false;
+        //        }         
+        //    }
+        //    catch (Exception ex)
+        //    {
+        //        //  _logger.LogError(ex, "DeleteAndMoveIntoHty锛氬鐞嗗疄浣� {EntityTypeName} 鏃跺彂鐢熸湭鎹曡幏寮傚父", entityTypeName);
+        //        return false;
+        //    }
+
+        //    return isSuccess;
+        //}
 
 
-public bool DeleteAndMoveIntoHty(List<TEntity> entities, OperateTypeEnum operateType)
+
+        public bool DeleteAndMoveIntoHty(List<TEntity> entities, OperateTypeEnum operateType)
 {
     Type type = typeof(TEntity);
     Assembly assembly = type.Assembly;
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/OutboundPickingService.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/OutboundPickingService.cs"
index e8de990..6e1a64e 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/OutboundPickingService.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/OutboundPickingService.cs"
@@ -1124,7 +1124,7 @@
         {
             // 鑾峰彇鏈�鏂扮殑璁㈠崟鏄庣粏鏁版嵁锛堝甫閿侊級
             var currentOrderDetail = await _outboundOrderDetailService.Db.Queryable<Dt_OutboundOrderDetail>()
-                .With(SqlWith.RowLock)
+                //.With(SqlWith.RowLock)
                 .FirstAsync(x => x.Id == orderDetailId);
 
             decimal newOverOutQuantity = currentOrderDetail.OverOutQuantity - cancelQty;
@@ -3004,7 +3004,8 @@
                     stockInfo.Details = new List<Dt_StockInfoDetail>();
                 }
                 var inboindId = 0; Dt_InboundOrder dt_InboundOrder = null;
-                var dbinbound = _inboundOrderRepository.QueryData(x => x.InboundOrderNo == dbinboundOrderDetails.First().OrderNo).First();
+                var orderno = dbinboundOrderDetails.First().OrderNo;
+                var dbinbound = _inboundOrderRepository.QueryData(x => x.InboundOrderNo == orderno).FirstOrDefault();
                 if (dbinbound == null)
                 {
                     dt_InboundOrder = new Dt_InboundOrder
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_TaskInfoService/TaskService_Outbound.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_TaskInfoService/TaskService_Outbound.cs"
index 5cf304e..29100af 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_TaskInfoService/TaskService_Outbound.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_TaskInfoService/TaskService_Outbound.cs"
@@ -159,7 +159,7 @@
                     foreach (var key in keys)
                     {
                         var detail = _outboundOrderDetailService.Db.Ado.SqlQuerySingle<Dt_OutboundOrderDetail>(
-                            "SELECT * FROM Dt_OutboundOrderDetail WITH (UPDLOCK, ROWLOCK) WHERE Id = @Id",
+                            "SELECT * FROM Dt_OutboundOrderDetail WITH (UPDLOCK) WHERE Id = @Id",
                             new { Id = key });
 
                         if (detail != null)
@@ -387,7 +387,6 @@
                             // TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)),
                             PalletType = stockInfo.PalletType,
                             WarehouseId = stockInfo.WarehouseId,
-
                         };
                         //if (taskType != TaskTypeEnum.OutEmpty)
                         //{
@@ -403,51 +402,7 @@
             return tasks;
         }
 
-        public List<Dt_Task> GetTasks(List<Dt_StockInfo> stockInfos, TaskTypeEnum taskType)
-        {
-            List<Dt_Task> tasks = new List<Dt_Task>();
-            List<Dt_LocationInfo> locationInfos = _locationInfoService.Repository.QueryData(x => stockInfos.Select(x => x.LocationCode).Contains(x.LocationCode));
-            for (int i = 0; i < stockInfos.Count; i++)
-            {
-                Dt_StockInfo stockInfo = stockInfos[i];
 
-                if (stockInfo != null)
-                {
-                    Dt_LocationInfo? locationInfo = locationInfos.FirstOrDefault(x => x.LocationCode == stockInfo.LocationCode);
-                    if (!tasks.Exists(x => x.PalletCode == stockInfo.PalletCode))
-                    {
-                        Dt_Task task = new()
-                        {
-                            CurrentAddress = stockInfo.LocationCode,
-                            Grade = 0,
-                            PalletCode = stockInfo.PalletCode,
-                            NextAddress = "",
-                            Roadway = locationInfo.RoadwayNo,
-                            SourceAddress = stockInfo.LocationCode,
-                            TargetAddress = "",
-                            TaskStatus = TaskStatusEnum.New.ObjToInt(),
-                            TaskType = taskType.ObjToInt(),
-                            //TaskNum = BaseDal.GetTaskNum(nameof(SequenceEnum.SeqTaskNum)),
-                            PalletType = stockInfo.PalletType,
-                            WarehouseId = stockInfo.WarehouseId,
-
-                        };
-                        //if (taskType != TaskTypeEnum.OutEmpty)
-                        //{
-                        //    task.MaterielCode = stockInfo.Details?.Where(x => x.StockId == stockInfo.Id).FirstOrDefault()?.MaterielCode;
-                        //    task.Quantity = (float)stockInfo.Details?.Where(x => x.StockId == stockInfo.Id).Sum(x => x.StockQuantity);
-                        //    task.BatchNo = stockInfo.Details?.Where(x => x.StockId == stockInfo.Id).FirstOrDefault()?.BatchNo;
-                        //}
-                        //if (stockInfo.StockLength > 0)
-                        //{
-                        //    task.TaskLength = stockInfo.StockLength;
-                        //}
-                        tasks.Add(task);
-                    }
-                }
-            }
-            return tasks;
-        }
 
         #region 鍐呭瓨閿佺鐞嗗櫒
         private static readonly ConcurrentDictionary<string, SemaphoreSlim> _normalmaterialLocks =
@@ -713,7 +668,8 @@
             Dt_OutboundOrderDetail? orderDetail = null;
             List<Dt_OutStockLockInfo>? outStockLockInfos = null;
             List<Dt_LocationInfo>? locationInfos = null;
-            if (outboundOrderDetail.OrderDetailStatus == OrderDetailStatusEnum.New.ObjToInt())
+            if (outboundOrderDetail.OrderDetailStatus == OrderDetailStatusEnum.New.ObjToInt() ||
+                outboundOrderDetail.OrderDetailStatus == OrderDetailStatusEnum.Outbound.ObjToInt())
             {
                 (List<Dt_StockInfo>, Dt_OutboundOrderDetail, List<Dt_OutStockLockInfo>, List<Dt_LocationInfo>) result = _outboundOrderDetailService.AssignStockOutbound(outboundOrderDetail, stockSelectViews);
                 if (result.Item1 != null && result.Item1.Count > 0)
@@ -749,7 +705,7 @@
                 if (stockLockInfos != null && stockLockInfos.Count > 0)
                 {
                     List<Dt_StockInfo> stocks = _stockService.StockInfoService.GetStockInfosByPalletCodes(stockLockInfos.Select(x => x.PalletCode).Distinct().ToList());
-                    tasks = GetTasks(stocks, TaskTypeEnum.Outbound);
+                    tasks = GetTasks(stocks, TaskTypeEnum.Outbound,station);
                 }
             }
 
@@ -1001,7 +957,7 @@
             List<Dt_Task> tasks = new List<Dt_Task>();
 
             // 鑾峰彇璁㈠崟鏄庣粏
-            var outboundOrderDetail = await _outboundOrderDetailService.Db.Queryable<Dt_OutboundOrderDetail>().With("UPDLOCK, ROWLOCK")
+            var outboundOrderDetail = await _outboundOrderDetailService.Db.Queryable<Dt_OutboundOrderDetail>().With("UPDLOCK")
                 .FirstAsync(x => x.Id == orderDetailId);
 
             if (outboundOrderDetail == null)

--
Gitblit v1.9.3