From 708880e13eb29c306ff9255c0516ff3d9d99c69c Mon Sep 17 00:00:00 2001
From: z8018 <1282578289@qq.com>
Date: 星期四, 18 十二月 2025 14:11:58 +0800
Subject: [PATCH] 调拨出库条码记录

---
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_BasicService/MESOperation/FeedbackMesService.cs                  |   95 ++++++
 项目代码/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_Core/AOP/SqlSugarAop.cs                                          |   17 
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_BasicService/BasicService.cs                                     |   75 ++--
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_Model/Models/Basic/Dt_MaterielCodeInfo.cs                        |   34 ++
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_Model/Models/Record/Dt_MesReturnRecord.cs                        |    6 
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_Core/BaseRepository/RepositoryBase.cs                            |  271 ++----------------
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_IBasicService/MESOperation/IFeedbackMesService.cs                |    2 
 /dev/null                                                                                               |    0 
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_Model/Models/Allocate/Dt_AllocateMaterialInfo.cs                 |   95 ++++++
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_OutboundService/OutboundService.cs                               |  142 ++++++++-
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_DTO/ReturnMES/BarcodeReturnDTO.cs                                |   70 +++++
 13 files changed, 496 insertions(+), 311 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 564919e..f89fb1b 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/CodeChunks.db-shm" "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-shm"
deleted file mode 100644
index ecbefef..0000000
--- "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-shm"
+++ /dev/null
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/CodeChunks.db-wal" "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-wal"
deleted file mode 100644
index 40dea86..0000000
--- "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-wal"
+++ /dev/null
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 339483f..9843f1f 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/.vs/WIDESEA_WMSServer/CopilotIndices/17.14.1204.46620/SemanticSymbols.db-shm" "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-shm"
deleted file mode 100644
index 14141d6..0000000
--- "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-shm"
+++ /dev/null
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-wal" "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-wal"
deleted file mode 100644
index a155b9c..0000000
--- "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-wal"
+++ /dev/null
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_BasicService/BasicService.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_BasicService/BasicService.cs"
index 269547c..3be1d07 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_BasicService/BasicService.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_BasicService/BasicService.cs"
@@ -40,50 +40,55 @@
         }
 
         #region
+
+        static object lockObj = new object();
         public string CreateCodeByRule(string ruleCode)
         {
-            string code = string.Empty;
-            DateTime dataTime = DateTime.Now;
-            DateTime now = DateTime.Now;
-
-            try
+            lock (lockObj)
             {
-                Dt_CodeRuleConfig ruleConfig = _unitOfWorkManage.Db.Queryable<Dt_CodeRuleConfig>().Where(x => x.RuleCode == ruleCode).First();
-                if (ruleConfig.ModifyDate != null)
-                {
-                    dataTime = ruleConfig.ModifyDate.Value;
-                }
-                else
-                {
-                    dataTime = ruleConfig.CreateDate;
-                }
+                string code = string.Empty;
+                DateTime dataTime = DateTime.Now;
+                DateTime now = DateTime.Now;
 
-                if (now.Year == dataTime.Year && now.Month == dataTime.Month && now.Day == dataTime.Day)
+                try
                 {
-                    now = dataTime;
-                    ruleConfig.CurrentVal = Convert.ToInt32(ruleConfig.CurrentVal) + 1;
+                    Dt_CodeRuleConfig ruleConfig = _unitOfWorkManage.Db.Queryable<Dt_CodeRuleConfig>().Where(x => x.RuleCode == ruleCode).First();
+                    if (ruleConfig.ModifyDate != null)
+                    {
+                        dataTime = ruleConfig.ModifyDate.Value;
+                    }
+                    else
+                    {
+                        dataTime = ruleConfig.CreateDate;
+                    }
+
+                    if (now.Year == dataTime.Year && now.Month == dataTime.Month && now.Day == dataTime.Day)
+                    {
+                        now = dataTime;
+                        ruleConfig.CurrentVal = Convert.ToInt32(ruleConfig.CurrentVal) + 1;
+                    }
+                    else
+                    {
+                        ruleConfig.CurrentVal = 1;
+                    }
+
+                    ruleConfig.ModifyDate = DateTime.Now;
+
+                    code = ruleConfig.Format;
+                    code = code.Replace($"[{CodeFormatTypeEnum.YYYY}]", now.Year.ToString().PadLeft(4, '0'));
+                    code = code.Replace($"[{CodeFormatTypeEnum.MM}]", now.Month.ToString().PadLeft(2, '0'));
+                    code = code.Replace($"[{CodeFormatTypeEnum.DD}]", now.Day.ToString().PadLeft(2, '0'));
+                    code = code.Replace($"[{CodeFormatTypeEnum.ST}]", ruleConfig.StartStr.ToString());
+                    code = code.Replace($"[{CodeFormatTypeEnum.NUM}]", ruleConfig.CurrentVal.ToString().PadLeft(ruleConfig.Length, '0'));
+
+                    _unitOfWorkManage.Db.Updateable(ruleConfig).ExecuteCommand();
                 }
-                else
+                catch (Exception ex)
                 {
-                    ruleConfig.CurrentVal = 1;
+                    throw new Exception(ex.Message);
                 }
-
-                ruleConfig.ModifyDate = DateTime.Now;
-
-                code = ruleConfig.Format;
-                code = code.Replace($"[{CodeFormatTypeEnum.YYYY}]", now.Year.ToString().PadLeft(4, '0'));
-                code = code.Replace($"[{CodeFormatTypeEnum.MM}]", now.Month.ToString().PadLeft(2, '0'));
-                code = code.Replace($"[{CodeFormatTypeEnum.DD}]", now.Day.ToString().PadLeft(2, '0'));
-                code = code.Replace($"[{CodeFormatTypeEnum.ST}]", ruleConfig.StartStr.ToString());
-                code = code.Replace($"[{CodeFormatTypeEnum.NUM}]", ruleConfig.CurrentVal.ToString().PadLeft(ruleConfig.Length, '0'));
-
-                _unitOfWorkManage.Db.Updateable(ruleConfig).ExecuteCommand();
+                return code;
             }
-            catch (Exception ex)
-            {
-
-            }
-            return code;
         }
         #endregion
 
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_BasicService/MESOperation/FeedbackMesService.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_BasicService/MESOperation/FeedbackMesService.cs"
index 412dba3..151e481 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_BasicService/MESOperation/FeedbackMesService.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_BasicService/MESOperation/FeedbackMesService.cs"
@@ -4,6 +4,7 @@
 using System.Text;
 using System.Threading.Tasks;
 using Newtonsoft.Json;
+using SqlSugar;
 using WIDESEA_Core;
 using WIDESEA_Core.BaseRepository;
 using WIDESEA_Core.BaseServices;
@@ -25,14 +26,16 @@
         private readonly IRepository<Dt_OutboundOrder> _outboundOrderRepository;
         private readonly IBasicService _basicService;
         private readonly IRepository<Dt_AllocateOrder> _allocateRepository;
+        private readonly IRepository<Dt_MaterialCodeInfo> _materialCodeInfoRepository;
 
-        public FeedbackMesService(IRepository<Dt_MesReturnRecord> BaseDal, IUnitOfWorkManage unitOfWorkManage, HttpClientHelper httpClientHelper, IRepository<Dt_OutboundOrder> outboundOrderRepository, IBasicService basicService, IRepository<Dt_AllocateOrder> allocateRepository) : base(BaseDal)
+        public FeedbackMesService(IRepository<Dt_MesReturnRecord> BaseDal, IUnitOfWorkManage unitOfWorkManage, HttpClientHelper httpClientHelper, IRepository<Dt_OutboundOrder> outboundOrderRepository, IBasicService basicService, IRepository<Dt_AllocateOrder> allocateRepository, IRepository<Dt_MaterialCodeInfo> materialCodeInfoRepository) : base(BaseDal)
         {
             _unitOfWorkManage = unitOfWorkManage;
             _httpClientHelper = httpClientHelper;
             _outboundOrderRepository = outboundOrderRepository;
             _basicService = basicService;
             _allocateRepository = allocateRepository;
+            _materialCodeInfoRepository = materialCodeInfoRepository;
         }
 
         public WebResponseContent OutboundFeedback(string orderNo)
@@ -105,7 +108,6 @@
                     InterfaceType = 1,
                     OrderId = outboundOrder.Id,
                     OrderNo = outboundOrder.OrderNo,
-                    OrderType = outboundOrder.OrderType,
                     RequestCode = reqCode,
                     RequestData = requestData,
                     FailureReason = message,
@@ -140,7 +142,7 @@
 
                     _outboundOrderRepository.Db.Updateable(outboundOrderDetails).ExecuteCommand();
                 }
-                
+
                 _unitOfWorkManage.CommitTran();
 
                 WebResponseContent responseContent = new WebResponseContent();
@@ -148,7 +150,7 @@
                 responseContent.Message = message;
                 return responseContent;
             }
-            catch(Exception ex)
+            catch (Exception ex)
             {
                 return WebResponseContent.Instance.Error(ex.Message);
             }
@@ -234,7 +236,6 @@
                         InterfaceType = 1,
                         OrderId = outboundOrder.Id,
                         OrderNo = outboundOrder.OrderNo,
-                        OrderType = outboundOrder.OrderType,
                         RequestCode = returnDTO.ReqCode,
                         RequestData = returnDTO.Serialize(),
                         FailureReason = message,
@@ -329,5 +330,89 @@
                 return null;
             }
         }
+
+        public WebResponseContent BarcodeFeedback(string newBarcode)
+        {
+            try
+            {
+                Dt_MaterialCodeInfo materialCodeInfo = _materialCodeInfoRepository.QueryFirst(x => x.NewBarcode == newBarcode, new Dictionary<string, OrderByType> { { nameof(Dt_MaterialCodeInfo.Id), OrderByType.Desc } });
+                if (materialCodeInfo == null)
+                {
+                    return WebResponseContent.Instance.Error($"鏈壘鍒扮墿鏂欐潯鐮佷俊鎭瘂newBarcode}");
+                }
+
+                string apiUrl = "";
+
+                BarcodeReturnDTO returnDTO = new BarcodeReturnDTO()
+                {
+                    BatchNo = materialCodeInfo.BatchNo,
+                    FactoryArea = materialCodeInfo.FactoryArea,
+                    OperationType = 1,
+                    MaterialCode = materialCodeInfo.MaterialCode,
+                    NewmaterialCode = materialCodeInfo.NewBarcode,
+                    OldmaterialCode = materialCodeInfo.OldBarcode,
+                    Operator = materialCodeInfo.Creater,
+                    Qty = materialCodeInfo.AfterQuantity,
+                    SupplyCode = materialCodeInfo.SuplierCode,
+                    Unit = materialCodeInfo.Unit,
+                    WarehouseCode = materialCodeInfo.WarehouseCode
+                };
+
+                string reqCode = Guid.NewGuid().ToString();
+                string reqTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
+                string requestData = returnDTO.Serialize();
+
+                HttpResponseResult<MesResponseDTO> httpResponseResult = _httpClientHelper.Post<MesResponseDTO>(apiUrl, requestData);
+                httpResponseResult.ApiUrl = apiUrl;
+
+                bool isSuccess = httpResponseResult.IsSuccess && httpResponseResult.Data != null && httpResponseResult.Data.Code == "200";
+                string message = "鎴愬姛";
+                if (!isSuccess)
+                {
+                    if (!httpResponseResult.IsSuccess)
+                    {
+                        message = $"MES鎺ュ彛杩斿洖閿欒锛孒TTP浠g爜锛歿httpResponseResult.StatusCode}锛屼俊鎭細{httpResponseResult.ErrorMessage}";
+                    }
+                    else if (httpResponseResult.Data.Code != "200")
+                    {
+                        message = $"璋冪敤MES鎺ュ彛澶辫触锛屼唬鐮侊細{httpResponseResult.Data.Code}锛屼俊鎭細{httpResponseResult.Data.Message}";
+                    }
+                }
+
+                Dt_MesReturnRecord mesReturnRecord = new Dt_MesReturnRecord()
+                {
+                    ApiUrl = httpResponseResult.ApiUrl,
+                    InterfaceType = 1,
+                    OrderId = materialCodeInfo.OrderId ?? 0,
+                    OrderNo = materialCodeInfo.OrderNo ?? "",
+                    RequestCode = reqCode,
+                    RequestData = requestData,
+                    FailureReason = message,
+                    LastReturnTime = DateTime.Now,
+                    HttpStatusCode = httpResponseResult.StatusCode.ObjToInt(),
+                    ResponseData = httpResponseResult.Content,
+                    ReturnType = 0,
+                    ReturnCount = 1,
+                    ReturnStatus = httpResponseResult.IsSuccess ? 1 : 2,
+                    SuccessTime = httpResponseResult.IsSuccess ? DateTime.Now : null
+                };
+
+                _unitOfWorkManage.BeginTran();
+                _unitOfWorkManage.Db.Insertable(mesReturnRecord).ExecuteCommand();
+                materialCodeInfo.ReturnStatus = httpResponseResult.IsSuccess ? 1 : 2;
+                _materialCodeInfoRepository.UpdateData(materialCodeInfo);
+
+                _unitOfWorkManage.CommitTran();
+
+                WebResponseContent responseContent = new WebResponseContent();
+                responseContent.Status = isSuccess;
+                responseContent.Message = message;
+                return responseContent;
+            }
+            catch (Exception ex)
+            {
+                return WebResponseContent.Instance.Error(ex.Message);
+            }
+        }
     }
 }
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/AOP/SqlSugarAop.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/AOP/SqlSugarAop.cs"
index 14b05f2..ecf2a9c 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/AOP/SqlSugarAop.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/AOP/SqlSugarAop.cs"
@@ -72,7 +72,14 @@
                 }
             }
 
-            if (entityInfo.EntityValue is BaseEntity baseEntity)
+            if (entityInfo.EntityValue is BaseEntity entity && entityInfo.EntityValue is IBaseHistoryEntity historyEntity)
+            {
+                if (entityInfo.OperationType == DataFilterType.InsertByObject && entityInfo.PropertyName == nameof(BaseEntity.CreateDate))
+                {
+                    historyEntity.InsertTime = DateTime.Now;
+                }
+            }
+            else if (entityInfo.EntityValue is BaseEntity baseEntity)
             {
                 // 鏂板鎿嶄綔
                 if (entityInfo.OperationType == DataFilterType.InsertByObject && entityInfo.PropertyName == nameof(BaseEntity.CreateDate))
@@ -96,14 +103,6 @@
                             baseEntity.Creater = App.User.UserName;
                             break;
                     }
-                }
-            }
-
-            if (entityInfo.EntityValue is IBaseHistoryEntity baseHistoryEntity)
-            {
-                if (entityInfo.OperationType == DataFilterType.InsertByObject && entityInfo.PropertyName == nameof(IBaseHistoryEntity.InsertTime))
-                {
-                    baseHistoryEntity.InsertTime = DateTime.Now;
                 }
             }
         }
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 2d08e68..aae83ad 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"
@@ -898,10 +898,6 @@
                             {
                                 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));
@@ -916,246 +912,59 @@
 
         }
 
-        //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)
-{
-    Type type = typeof(TEntity);
-    Assembly assembly = type.Assembly;
-    Type? htyType = assembly.GetType(type.FullName + "_Hty");
-    if (htyType != null)
-    {
-        object? obj2 = Activator.CreateInstance(htyType);
-        PropertyInfo keyPro = typeof(TEntity).GetKeyProperty();
-        PropertyInfo? operateTypePro = htyType.GetProperty(nameof(IBaseHistoryEntity.OperateType));
-        PropertyInfo? sourceIdPro = htyType.GetProperty(nameof(IBaseHistoryEntity.SourceId));
-        if (obj2 != null && keyPro != null && operateTypePro != null && sourceIdPro != null)
         {
-            List<PropertyInfo> propertyInfos = htyType.GetProperties().Where(x => x.Name != operateTypePro.Name && x.Name != sourceIdPro.Name && x.Name != keyPro.Name).ToList();
-            List<object> list = new List<object>();
-            foreach (var item in entities)
+            Type type = typeof(TEntity);
+            Assembly assembly = type.Assembly;
+            Type? htyType = assembly.GetType(type.FullName + "_Hty");
+            if (htyType != null)
             {
-                object? obj = Activator.CreateInstance(htyType);
-                if (obj != null)
+                object? obj2 = Activator.CreateInstance(htyType);
+                PropertyInfo keyPro = typeof(TEntity).GetKeyProperty();
+                PropertyInfo? operateTypePro = htyType.GetProperty(nameof(IBaseHistoryEntity.OperateType));
+                PropertyInfo? sourceIdPro = htyType.GetProperty(nameof(IBaseHistoryEntity.SourceId));
+                if (obj2 != null && keyPro != null && operateTypePro != null && sourceIdPro != null)
                 {
-                    operateTypePro.SetValue(obj, operateType.ToString());
-                    sourceIdPro.SetValue(obj, keyPro.GetValue(item));
-                    for (int i = 0; i < propertyInfos.Count; i++)
+                    List<PropertyInfo> propertyInfos = htyType.GetProperties().Where(x => x.Name != operateTypePro.Name && x.Name != sourceIdPro.Name && x.Name != keyPro.Name).ToList();
+                    List<object> list = new List<object>();
+                    foreach (var item in entities)
                     {
-                        PropertyInfo propertyInfo = propertyInfos[i];
-                        PropertyInfo? property = type.GetProperty(propertyInfo.Name);
-
-                        if (property != null)
+                        object? obj = Activator.CreateInstance(htyType);
+                        if (obj != null)
                         {
-                            if (propertyInfo.Name == nameof(BaseEntity.Modifier))
+                            operateTypePro.SetValue(obj, operateType.ToString());
+                            sourceIdPro.SetValue(obj, keyPro.GetValue(item));
+                            for (int i = 0; i < propertyInfos.Count; i++)
                             {
-                                propertyInfo.SetValue(obj, App.User.UserId > 0 ? App.User.UserName : "System");
+                                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(item));
+                                    }
+                                }
                             }
-                            else if (propertyInfo.Name == nameof(BaseEntity.ModifyDate))
-                            {
-                                propertyInfo.SetValue(obj, DateTime.Now);
-                            }
-                            else
-                            {
-                                propertyInfo.SetValue(obj, property.GetValue(item));
-                            }
+                            list.Add(obj);
                         }
                     }
-                    list.Add(obj);
+                    if (list.Count > 0)
+                        _db.InsertableByObject(list).AS(type.Name + "_Hty").ExecuteCommand();
+
                 }
             }
-            if (list.Count > 0)
-                _db.InsertableByObject(list).AS(type.Name + "_Hty").ExecuteCommand();
-
+            return DeleteData(entities);
         }
-    }
-    return DeleteData(entities);
-}
-        //List<TResult> QueryMuch<T, T2, T3, TResult>(
-        //    Expression<Func<T, T2, T3, object[]>> joinExpression,
-        //    Expression<Func<T, T2, T3, TResult>> selectExpression,
-        //    Expression<Func<T, T2, T3, bool>> whereLambda = null) where T : class, new(){throw new NotImplementedException();}
-        //Task<PageModel<TEntity>> QueryPage(PaginationModel pagination){throw new NotImplementedException();}
     }
 }
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_DTO/ReturnMES/BarcodeReturnDTO.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_DTO/ReturnMES/BarcodeReturnDTO.cs"
new file mode 100644
index 0000000..84d00cc
--- /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_DTO/ReturnMES/BarcodeReturnDTO.cs"
@@ -0,0 +1,70 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WIDESEA_DTO.ReturnMES
+{
+
+    /// <summary>
+    /// 
+    /// </summary>
+    public class BarcodeReturnDTO : BaseReturnDTO
+    {
+        /// <summary>
+        /// 
+        /// </summary>
+        public string OldmaterialCode {  get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string NewmaterialCode {  get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string Unit {  get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string FactoryArea {  get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public decimal Qty {  get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string SupplyCode {  get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string BatchNo {  get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string MaterialCode {  get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string WarehouseCode {  get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public int OperationType {  get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public string Operator {  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_IBasicService/MESOperation/IFeedbackMesService.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_IBasicService/MESOperation/IFeedbackMesService.cs"
index bd0825b..d7a761e 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_IBasicService/MESOperation/IFeedbackMesService.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_IBasicService/MESOperation/IFeedbackMesService.cs"
@@ -10,5 +10,7 @@
     public interface IFeedbackMesService : IDependency
     {
         WebResponseContent OutboundFeedback(string orderNo);
+
+        WebResponseContent BarcodeFeedback(string newBarcode);
     }
 }
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/Allocate/Dt_AllocateMaterialInfo.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/Allocate/Dt_AllocateMaterialInfo.cs"
new file mode 100644
index 0000000..b34ceea
--- /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_Model/Models/Allocate/Dt_AllocateMaterialInfo.cs"
@@ -0,0 +1,95 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using SqlSugar;
+using WIDESEA_Core.DB.Models;
+
+namespace WIDESEA_Model.Models
+{
+    /// <summary>
+    /// 
+    /// </summary>
+    [SugarTable(nameof(Dt_AllocateMaterialInfo))]
+    public class Dt_AllocateMaterialInfo : BaseEntity
+    {
+        /// <summary>
+        /// 涓婚敭
+        /// </summary>
+        [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "涓婚敭")]
+        public int Id { get; set; }
+
+        /// <summary>
+        /// 璁㈠崟涓婚敭
+        /// </summary>
+        [SugarColumn(IsNullable = false, ColumnDescription = "璁㈠崟涓婚敭")]
+        public int OrderId { get; set; }
+
+        /// <summary>
+        /// 璁㈠崟鍙�
+        /// </summary>
+        [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "璁㈠崟鍙�")]
+        public string OrderNo { get; set; }
+
+        /// <summary>
+        /// 鐗╂枡缂栧彿
+        /// </summary>
+        [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "鐗╂枡缂栧彿")]
+        public string MaterialCode { get; set; }
+
+        /// <summary>
+        /// 鐗╂枡鍚嶇О
+        /// </summary>
+        [SugarColumn(IsNullable = true, Length = 200, ColumnDescription = "鐗╂枡鍚嶇О")]
+        public string MaterialName { get; set; }
+
+        /// <summary>
+        /// 鍘傚尯
+        /// </summary>
+        [SugarColumn(IsNullable = true, Length = 20, ColumnDescription = "鍘傚尯")]
+        public string FactoryArea { get; set; }
+
+        /// <summary>
+        /// 鎵规
+        /// </summary>
+        [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "鎵规")]
+        public string BatchNo { get; set; }
+
+        /// <summary>
+        /// 鏁伴噺
+        /// </summary>
+        [SugarColumn(IsNullable = false, DecimalDigits = 3, ColumnDescription = "鏁伴噺")]
+        public decimal Quantity { get; set; }
+
+        /// <summary>
+        /// 鍗曚綅
+        /// </summary>
+        [SugarColumn(IsNullable = false, Length = 20, ColumnDescription = "鍗曚綅")]
+        public string Unit { get; set; }
+
+        /// <summary>
+        /// 渚涘簲鍟�
+        /// </summary>
+        [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "渚涘簲鍟�")]
+        public string SupplyCode { get; set; }
+
+        /// <summary>
+        /// 浠撳簱
+        /// </summary>
+        [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "浠撳簱")]
+        public string WarehouseCode { get; set; }
+
+        /// <summary>
+        /// 鐗╂枡鐮�
+        /// </summary>
+        [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "鐗╂枡鐮�")]
+        public string Barcode { get; set; }
+
+        /// <summary>
+        /// 澶囨敞
+        /// </summary>
+        [SugarColumn(IsNullable = true, Length = 500, ColumnDescription = "澶囨敞")]
+        public string Remark { 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_Model/Models/Basic/Dt_MaterielCodeInfo.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/Basic/Dt_MaterielCodeInfo.cs"
index 5800b3b..060b17f 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/Basic/Dt_MaterielCodeInfo.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/Basic/Dt_MaterielCodeInfo.cs"
@@ -40,6 +40,18 @@
         public string? SuplierCode { get; set; }
 
         /// <summary>
+        /// 
+        /// </summary>
+        [SugarColumn(IsNullable = true)]
+        public int? OrderId { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        [SugarColumn(IsNullable = true, Length = 50)]
+        public string? OrderNo { get; set; }
+
+        /// <summary>
         /// 閲囪喘鍗曞彿
         /// </summary>
         [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "閲囪喘鍗曞彿")]
@@ -64,6 +76,12 @@
         public string? FactoryArea { get; set; }
 
         /// <summary>
+        /// 
+        /// </summary>
+        [SugarColumn(IsNullable = true, Length = 50, ColumnDescription = "鍘傚尯")]
+        public string? WarehouseCode { get; set; }
+
+        /// <summary>
         /// 鏃ユ湡
         /// </summary>
         [SugarColumn(IsNullable = false, ColumnDescription = "鐗╂枡缂栧彿")]
@@ -79,31 +97,37 @@
         /// 鍘熸潯鐮�
         /// </summary>
         [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "鍘熸潯鐮�")]
-        public string OldBarcode {  get; set; }
+        public string OldBarcode { get; set; }
 
         /// <summary>
         /// 鍘熸暟閲�
         /// </summary>
         [SugarColumn(IsNullable = false, ColumnDescription = "鍘熸暟閲�")]
-        public decimal OriginalQuantity {  get; set; }
+        public decimal OriginalQuantity { get; set; }
 
         /// <summary>
         /// 鏂版暟閲�
         /// </summary>
         [SugarColumn(IsNullable = false, ColumnDescription = "鏂版暟閲�")]
-        public decimal AfterQuantity {  get; set; }
+        public decimal AfterQuantity { get; set; }
 
         /// <summary>
         /// 鍗曚綅
         /// </summary>
 
         [SugarColumn(IsNullable = false, Length = 50, ColumnDescription = "鍗曚綅")]
-        public string Unit {  get; set; }
+        public string Unit { get; set; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        [SugarColumn(IsNullable = false)]
+        public int ReturnStatus { get; set; }
 
         /// <summary>
         /// 澶囨敞
         /// </summary>
         [SugarColumn(IsNullable = true, Length = 500, ColumnDescription = "澶囨敞")]
-        public string? Remark {  get; set; }
+        public string? Remark { 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_Model/Models/Record/Dt_MesReturnRecord.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/Record/Dt_MesReturnRecord.cs"
index ec480f8..2821101 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/Record/Dt_MesReturnRecord.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/Record/Dt_MesReturnRecord.cs"
@@ -17,12 +17,6 @@
         public int Id { get; set; }
 
         /// <summary>
-        /// 鍗曟嵁绫诲瀷
-        /// </summary>
-        [SugarColumn(IsNullable = false)]
-        public int OrderType { get; set; }
-
-        /// <summary>
         /// 鍗曟嵁涓昏〃ID
         /// </summary>
         [SugarColumn(IsNullable = false)]
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 ecc4177..d5718b0 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"
@@ -1,4 +1,5 @@
-锘縰sing AutoMapper;
+锘縰sing System.Reflection.Emit;
+using AutoMapper;
 using Dm.filter;
 using MailKit.Search;
 using Mapster;
@@ -7,7 +8,6 @@
 using Org.BouncyCastle.Asn1.Ocsp;
 using Org.BouncyCastle.Crypto;
 using SqlSugar;
-using System.Reflection.Emit;
 using WIDESEA_BasicService;
 using WIDESEA_Common.CommonEnum;
 using WIDESEA_Common.LocationEnum;
@@ -26,6 +26,7 @@
 using WIDESEA_IRecordService;
 using WIDESEA_IStockService;
 using WIDESEA_Model.Models;
+using static HslCommunication.Profinet.Knx.KnxCode;
 
 namespace WIDESEA_OutboundService
 {
@@ -56,6 +57,8 @@
         private readonly IRepository<Dt_Task> _taskRepository;
         private readonly ILocationInfoService _locationInfoService;
         private readonly IESSApiService _eSSApiService;
+        private readonly IRepository<Dt_AllocateOrder> _allocateOrderRepository;
+        private readonly IRepository<Dt_AllocateMaterialInfo> _allocateMaterialInfoRepository;
 
         private Dictionary<string, string> stations = new Dictionary<string, string>
         {
@@ -69,7 +72,7 @@
             {"3-1","3-5" },
         };
 
-        public OutboundService(IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_OutboundOrderDetail> detailRepository, IRepository<Dt_OutboundOrder> outboundRepository, IRepository<Dt_OutStockLockInfo> outboundLockInfoRepository, IRepository<Dt_StockInfo> stockInfoRepository, IRepository<Dt_StockInfoDetail> stockDetailRepository, IRepository<Dt_StockQuantityChangeRecord> stockChangeRepository, IRepository<Dt_StockInfoDetail_Hty> stockDetailHistoryRepository, IBasicService basicService, IOutboundOrderDetailService outboundOrderDetailService, IOutboundOrderService outboundOrderService, IOutStockLockInfoService outboundStockLockInfoService, IFeedbackMesService feedbackMesService, IRepository<Dt_Task> taskRepository, ILocationInfoService locationInfoService, IESSApiService eSSApiService)
+        public OutboundService(IMapper mapper, IUnitOfWorkManage unitOfWorkManage, IRepository<Dt_OutboundOrderDetail> detailRepository, IRepository<Dt_OutboundOrder> outboundRepository, IRepository<Dt_OutStockLockInfo> outboundLockInfoRepository, IRepository<Dt_StockInfo> stockInfoRepository, IRepository<Dt_StockInfoDetail> stockDetailRepository, IRepository<Dt_StockQuantityChangeRecord> stockChangeRepository, IRepository<Dt_StockInfoDetail_Hty> stockDetailHistoryRepository, IBasicService basicService, IOutboundOrderDetailService outboundOrderDetailService, IOutboundOrderService outboundOrderService, IOutStockLockInfoService outboundStockLockInfoService, IFeedbackMesService feedbackMesService, IRepository<Dt_Task> taskRepository, ILocationInfoService locationInfoService, IESSApiService eSSApiService, IRepository<Dt_AllocateOrder> allocateOrderRepository, IRepository<Dt_AllocateMaterialInfo> allocateMaterialInfoRepository)
         {
             _mapper = mapper;
             _unitOfWorkManage = unitOfWorkManage;
@@ -90,6 +93,8 @@
             _taskRepository = taskRepository;
             _locationInfoService = locationInfoService;
             _eSSApiService = eSSApiService;
+            _allocateOrderRepository = allocateOrderRepository;
+            _allocateMaterialInfoRepository = allocateMaterialInfoRepository;
         }
 
         #region 鍑哄簱鍒嗛厤
@@ -838,8 +843,7 @@
         }
         #endregion
 
-
-
+        #region 鏁寸鍑哄簱
         public WebResponseContent CompleteOutboundWithPallet(OutboundCompletePalletRequestDTO request)
         {
             WebResponseContent content = WebResponseContent.Instance;
@@ -953,6 +957,34 @@
                     // 鏁寸鍑哄簱鏃犻渶鎷嗗寘
                     PerformFullOutboundOperation(stockInfo, request, lockInfo.TaskNum.GetValueOrDefault());
 
+                    if (outboundOrder.OrderType != 0)
+                    {
+
+                        Dt_AllocateOrder allocateOrder = _allocateOrderRepository.QueryFirst(x => x.OrderNo == outboundOrder.OrderNo);
+                        if (allocateOrder != null)
+                        {
+                            List<Dt_AllocateMaterialInfo> allocateMaterialInfos = new List<Dt_AllocateMaterialInfo>();
+                            foreach (var item in stockInfo.Details)
+                            {
+                                Dt_AllocateMaterialInfo allocateMaterialInfo = new Dt_AllocateMaterialInfo()
+                                {
+                                    Barcode = item.Barcode,
+                                    BatchNo = item.BatchNo,
+                                    FactoryArea = item.FactoryArea,
+                                    MaterialCode = item.MaterielCode,
+                                    MaterialName = item.MaterielName,
+                                    OrderId = outboundOrder.Id,
+                                    OrderNo = outboundOrder.OrderNo,
+                                    Quantity = item.StockQuantity,
+                                    SupplyCode = item.SupplyCode,
+                                    Unit = item.Unit,
+                                    WarehouseCode = allocateOrder.ToWarehouse
+                                };
+                                allocateMaterialInfos.Add(allocateMaterialInfo);
+                            }
+                            _allocateMaterialInfoRepository.AddData(allocateMaterialInfos);
+                        }
+                    }
 
                     decimal allocatedQuantity = actualOutboundQuantity;
                     List<Dt_OutboundOrderDetail> updateDetails = new();
@@ -1163,6 +1195,7 @@
             _stockDetailRepository.DeleteData(stockInfo.Details);
             _stockChangeRepository.AddData(changeRecords);
         }
+        #endregion
 
         #region 鎷i��
         /// <summary>
@@ -1269,21 +1302,76 @@
                 // 8. 鍒ゆ柇鏄惁闇�瑕佹媶鍖咃紙褰撳嚭搴撴暟閲忓皬浜庡簱瀛樻暟閲忔椂闇�瑕佹媶鍖咃級
                 bool isUnpacked = actualOutboundQuantity < stockDetail.StockQuantity;
                 List<MaterialCodeReturnDTO> returnDTOs = new List<MaterialCodeReturnDTO>();
-
+                string newBarcode = string.Empty;
                 // 9. 寮�鍚簨鍔�
                 _unitOfWorkManage.BeginTran();
                 try
                 {
                     decimal beforeQuantity = stockDetail.StockQuantity; // 鍘熷搴撳瓨閲�
 
+                    Dt_AllocateMaterialInfo allocateMaterialInfo = new Dt_AllocateMaterialInfo();
+
                     // 鏍规嵁鏄惁鎷嗗寘鎵ц涓嶅悓鐨勬搷浣�
                     if (isUnpacked)
                     {
-                        returnDTOs = PerformUnpackOperation(stockDetail, stockInfo, actualOutboundQuantity, request, beforeQuantity, lockInfo.TaskNum.GetValueOrDefault());
+                        (string NewBarcode, List<MaterialCodeReturnDTO> MaterialCodeReturnDTOs) result = PerformUnpackOperation(stockDetail, stockInfo, actualOutboundQuantity, request, beforeQuantity, lockInfo.TaskNum.GetValueOrDefault(), outboundOrder.Id, outboundOrder.OrderNo);
+
+                        returnDTOs = result.MaterialCodeReturnDTOs;
+                        newBarcode = result.NewBarcode;
+
+                        MaterialCodeReturnDTO returnDTO = returnDTOs.First(x => x.Barcode == newBarcode);
+
+                        if (outboundOrder.OrderType != 0)
+                        {
+                            allocateMaterialInfo = new Dt_AllocateMaterialInfo()
+                            {
+                                Barcode = returnDTO.Barcode,
+                                BatchNo = returnDTO.BatchNo,
+                                FactoryArea = returnDTO.FactoryArea,
+                                MaterialCode = returnDTO.MaterialCode,
+                                MaterialName = returnDTO.MaterialName,
+                                OrderId = outboundOrder.Id,
+                                OrderNo = outboundOrder.OrderNo,
+                                Quantity = returnDTO.Quantity,
+                                SupplyCode = returnDTO.SuplierCode,
+                                Unit = stockDetail.Unit
+                            };
+                        }
+
                     }
                     else
                     {
                         PerformFullOutboundOperation(stockDetail, stockInfo, actualOutboundQuantity, request, beforeQuantity, lockInfo.TaskNum.GetValueOrDefault());
+
+                        if (outboundOrder.OrderType != 0)
+                        {
+                            allocateMaterialInfo = new Dt_AllocateMaterialInfo()
+                            {
+                                Barcode = stockDetail.Barcode,
+                                BatchNo = stockDetail.BatchNo,
+                                FactoryArea = stockDetail.FactoryArea,
+                                MaterialCode = stockDetail.MaterielCode,
+                                MaterialName = stockDetail.MaterielName,
+                                OrderId = outboundOrder.Id,
+                                OrderNo = outboundOrder.OrderNo,
+                                Quantity = stockDetail.StockQuantity,
+                                SupplyCode = stockDetail.SupplyCode,
+                                Unit = stockDetail.Unit
+                            };
+                        }
+
+                    }
+
+                    // 鍒ゆ柇鏄惁鏄皟鎷ㄥ崟
+                    if (outboundOrder.OrderType != 0)
+                    {
+                        Dt_AllocateOrder allocateOrder = _allocateOrderRepository.QueryFirst(x => x.OrderNo == outboundOrder.OrderNo);
+                        if (allocateOrder != null)
+                        {
+                            allocateMaterialInfo.WarehouseCode = allocateOrder.ToWarehouse;
+
+                            _allocateMaterialInfoRepository.AddData(allocateMaterialInfo);
+                        }
                     }
 
                     decimal allocatedQuantity = actualOutboundQuantity;
@@ -1385,6 +1473,12 @@
                     response.ScannedDetail = scannedDetail;
                     response.UpdatedDetails = updateDetails;
 
+                    if (!string.IsNullOrEmpty(newBarcode))
+                    {
+                        // 鐗╂枡鏂版潯鐮佸洖浼�
+                        _feedbackMesService.BarcodeFeedback(newBarcode);
+                    }
+
                     // 妫�鏌ュ嚭搴撳崟鏄惁瀹屾垚
                     if (CheckOutboundOrderCompleted(request.OrderNo))
                     {
@@ -1458,14 +1552,14 @@
         /// <param name="beforeQuantity"></param>
         /// <param name="taskNum"></param>
         /// <returns></returns>
-        private List<MaterialCodeReturnDTO> PerformUnpackOperation(Dt_StockInfoDetail stockDetail, Dt_StockInfo stockInfo,
-            decimal actualOutboundQuantity, OutboundCompleteRequestDTO request, decimal beforeQuantity, int taskNum)
+        private (string NewBarcode, List<MaterialCodeReturnDTO> MaterialCodeReturnDTOs) PerformUnpackOperation(Dt_StockInfoDetail stockDetail, Dt_StockInfo stockInfo,
+            decimal actualOutboundQuantity, OutboundCompleteRequestDTO request, decimal beforeQuantity, int taskNum, int orderId, string orderNo)
         {
             string newBarcode = GenerateNewBarcode();
 
             string remark = $"鎷嗗寘璁板綍锛屽師鏉$爜锛歿request.Barcode}锛屽師鏁伴噺锛歿stockDetail.StockQuantity}锛屽嚭搴撴潯鐮侊細{newBarcode}锛� 鍑哄簱鏁伴噺锛歿actualOutboundQuantity}锛屽洖搴撴潯鐮侊細{request.Barcode}锛屽洖搴撴暟閲忥細{stockDetail.StockQuantity - actualOutboundQuantity},鎿嶄綔鑰咃細{request.Operator}";
 
-            List<Dt_MaterialCodeInfo> materialCodeInfos = CreateMaterialCodeInfos(stockDetail, newBarcode, actualOutboundQuantity, remark);
+            List<Dt_MaterialCodeInfo> materialCodeInfos = CreateMaterialCodeInfos(stockDetail, newBarcode, actualOutboundQuantity, remark, taskNum, orderId, orderNo);
 
             List<MaterialCodeReturnDTO> returnDTOs = _mapper.Map<List<MaterialCodeReturnDTO>>(materialCodeInfos);
 
@@ -1491,7 +1585,7 @@
                 SupplyCode = stockDetail.SupplyCode,
                 FactoryArea = stockDetail.FactoryArea,
                 WarehouseCode = stockDetail.WarehouseCode,
-                Remark = $"鎷嗗寘鍓嶅師濮嬭褰曪紝鍘熸潯鐮侊細{request.Barcode}锛屽師鏁伴噺锛歿stockDetail.StockQuantity}锛屽嚭搴撴暟閲忥細{actualOutboundQuantity}锛屾搷浣滆�咃細{request.Operator}"
+                Remark = $"鎷嗗寘鍓嶅師濮嬭褰曪紝鍑哄簱鍗曞彿锛歿orderNo}锛屽嚭搴撳崟涓婚敭锛歿orderId}锛屽師鏉$爜锛歿request.Barcode}锛屽師鏁伴噺锛歿stockDetail.StockQuantity}锛屽嚭搴撴暟閲忥細{actualOutboundQuantity}锛屾搷浣滆�咃細{request.Operator}"
             };
             _stockDetailHistoryRepository.AddData(originalHistoryRecord);
 
@@ -1502,7 +1596,7 @@
                 // 鏇存柊鍘熷簱瀛樻槑缁�
                 stockDetail.StockQuantity = remainingQuantity;
                 //stockDetail.Barcode = newBarcode;
-                stockDetail.Remark = $"鎷嗗寘鍚庢洿鏂帮紝鍘熸潯鐮侊細{request.Barcode}锛屾柊鏁伴噺锛歿remainingQuantity}锛屾搷浣滆�咃細{request.Operator}";
+                stockDetail.Remark = $"鎷嗗寘鍚庢洿鏂帮紝鍑哄簱鍗曞彿锛歿orderNo}锛屽嚭搴撳崟涓婚敭锛歿orderId}锛屽師鏉$爜锛歿request.Barcode}锛屾柊鏁伴噺锛歿remainingQuantity}锛屾搷浣滆�咃細{request.Operator}";
                 _stockDetailRepository.UpdateData(stockDetail);
             }
 
@@ -1524,11 +1618,11 @@
                 AfterQuantity = beforeQuantity - actualOutboundQuantity,
                 SupplyCode = stockDetail.SupplyCode,
                 WarehouseCode = stockDetail.WarehouseCode,
-                Remark = $"鎷嗗寘鍑哄簱锛屽師鏉$爜锛歿request.Barcode}锛屾柊鏉$爜锛歿newBarcode}锛屽嚭搴撴暟閲忥細{actualOutboundQuantity}锛屽墿浣欙細{remainingQuantity}锛屾搷浣滆�咃細{request.Operator}"
+                Remark = $"鎷嗗寘鍑哄簱锛屽嚭搴撳崟鍙凤細{orderNo}锛屽嚭搴撳崟涓婚敭锛歿orderId}锛屽師鏉$爜锛歿request.Barcode}锛屾柊鏉$爜锛歿newBarcode}锛屽嚭搴撴暟閲忥細{actualOutboundQuantity}锛屽墿浣欙細{remainingQuantity}锛屾搷浣滆�咃細{request.Operator}"
             };
             _stockChangeRepository.AddData(unpackChangeRecord);
 
-            return returnDTOs;
+            return (newBarcode, returnDTOs);
         }
 
         /// <summary>
@@ -1612,7 +1706,7 @@
         /// <param name="afterQuantity"></param>
         /// <param name="remark"></param>
         /// <returns></returns>
-        private List<Dt_MaterialCodeInfo> CreateMaterialCodeInfos(Dt_StockInfoDetail stockDetail, string newBarcode, decimal splitQuantity, string remark)
+        private List<Dt_MaterialCodeInfo> CreateMaterialCodeInfos(Dt_StockInfoDetail stockDetail, string newBarcode, decimal splitQuantity, string remark, int taskNum, int orderId, string orderNo)
         {
             List<Dt_MaterialCodeInfo> materialCodeInfos = new List<Dt_MaterialCodeInfo>();
 
@@ -1633,7 +1727,11 @@
                 SuplierCode = stockDetail.SupplyCode,
                 Unit = stockDetail.Unit,
                 Date = DateTime.Now.ToString("yyyy-MM-dd"),
-                Remark = remark
+                Remark = remark,
+                WarehouseCode = stockDetail.WarehouseCode,
+                OrderNo = orderNo,
+                OrderId = orderId,
+                ReturnStatus = 0
             };
             materialCodeInfos.Add(outMaterialCodeInfo);
 
@@ -1652,7 +1750,11 @@
                 SuplierCode = stockDetail.SupplyCode,
                 Unit = stockDetail.Unit,
                 Date = DateTime.Now.ToString("yyyy-MM-dd"),
-                Remark = remark
+                Remark = remark,
+                WarehouseCode = stockDetail.WarehouseCode,
+                OrderNo = orderNo,
+                OrderId = orderId,
+                ReturnStatus = 0
             };
 
             materialCodeInfos.Add(returnMaterialCodeInfo);
@@ -1712,7 +1814,7 @@
             WebResponseContent content = new WebResponseContent();
             try
             {
-                var stock = await _stockInfoRepository.Db.Queryable<Dt_StockInfo>().Includes(x=>x.Details).Where(x => x.PalletCode == palletCode).FirstAsync();
+                var stock = await _stockInfoRepository.Db.Queryable<Dt_StockInfo>().Includes(x => x.Details).Where(x => x.PalletCode == palletCode).FirstAsync();
 
                 if (stock == null)
                 {
@@ -1726,7 +1828,7 @@
                 stockInfo_Hty.SourceId = stock.Id;
                 stockInfo_Hty.OperateType = "鍙栫┖绠�";
                 stockInfo_Hty.InsertTime = DateTime.Now;
-                
+
                 _unitOfWorkManage.BeginTran();
                 await _outboundRepository.Db.InsertNav(stockInfo_Hty).IncludesAllFirstLayer().ExecuteCommandAsync();
                 await _stockInfoRepository.DeleteDataByIdAsync(stock.Id);
@@ -1742,7 +1844,7 @@
 
         #endregion
 
-        #region
+        #region 鍥炲簱
         public async Task<WebResponseContent> ReturnToWarehouse(string palletCode, string OrderNo, string station)
         {
             WebResponseContent content = new WebResponseContent();

--
Gitblit v1.9.3