From 51bd4ac4f323fab99ff9ac20763ca15af0e53a57 Mon Sep 17 00:00:00 2001
From: heshaofeng <heshaofeng@hnkhzn.com>
Date: 星期四, 22 一月 2026 21:51:15 +0800
Subject: [PATCH] 1

---
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_BasicService/MESOperation/FeedbackMesService.cs |   46 +++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 43 insertions(+), 3 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_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 fc049c4..00e76f5 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"
@@ -7,6 +7,7 @@
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using WIDESEA_Common.OrderEnum;
 using WIDESEA_Core;
 using WIDESEA_Core.BaseRepository;
 using WIDESEA_Core.BaseServices;
@@ -51,7 +52,15 @@
                 {
                     return webResponse = WebResponseContent.Instance.Error($"鏈壘鍒板搴旂殑鍑哄簱鍗曚俊鎭�");
                 }
+                if(outboundOrder.OrderType == InOrderTypeEnum.ReCheck.ObjToInt() || outboundOrder.CreateType == OrderCreateTypeEnum.CreateInSystem.ObjToInt())
+                {
+                    return webResponse = WebResponseContent.Instance.OK($"璇ュ崟鎹棤闇�鍥炰紶MES");
+                }
 
+                if (outboundOrder.IsBatch == 0 && outboundOrder.OrderStatus != OutOrderStatusEnum.鍑哄簱瀹屾垚.ObjToInt())
+                {
+                    return webResponse = WebResponseContent.Instance.OK($"璇ュ崟鎹睘浜庝笉鍒嗘壒鑷姩鍥炰紶锛屼笉鍙墜鍔ㄥ垎鎵瑰洖浼�");
+                }
                 List<Dt_MesReturnRecord> returnRecords = BaseDal.QueryData(x => x.OrderNo == orderNo && x.OrderId == outboundOrder.Id && x.ReturnStatus == 2);
 
                 foreach (var item in returnRecords)
@@ -98,7 +107,23 @@
 
                     if (returnDTO.Details.Count <= 0)
                     {
+                        if (returnRecords.Count() == returnRecords.Count(x => x.ReturnStatus == 1))
+                        {
+                            outboundOrder.ReturnToMESStatus = 1;
+                        }
+                        else if (returnRecords.Count(x => x.ReturnStatus == 2) > 0)
+                        {
+                            outboundOrder.ReturnToMESStatus = 4;
+                        }
+                        else if (returnRecords.Count() == returnRecords.Count(x => x.ReturnStatus == 2))
+                        {
+                            outboundOrder.ReturnToMESStatus = 2;
+                        }
+                        _outboundOrderRepository.UpdateData(outboundOrder);
+
+
                         return webResponse = WebResponseContent.Instance.OK($"璇ュ崟鎹病鏈夐渶瑕佸洖浼犳槑缁嗭紝澶辫触鏁版嵁鍥炰紶{returnRecords.Count()}鏉★紝鍥炰紶鎴愬姛{returnRecords.Count(x=>x.ReturnStatus == 1)}鏉★紝鍥炰紶澶辫触{returnRecords.Count(x => x.ReturnStatus == 2)}鏉�");
+
                     }
 
                     string apiUrl = AppSettings.GetValue("MaterialOutboundFeedbackUrl");
@@ -129,10 +154,25 @@
 
                     if (returnDTO.Details.Count <= 0)
                     {
+                        if(returnRecords.Count() == returnRecords.Count(x => x.ReturnStatus == 1))
+                        {
+                            outboundOrder.ReturnToMESStatus = 1;
+                        }
+                        else if(returnRecords.Count(x => x.ReturnStatus == 2)>0)
+                        {
+                            outboundOrder.ReturnToMESStatus = 4;
+                        }
+                        else if (returnRecords.Count() == returnRecords.Count(x => x.ReturnStatus == 2))
+                        {
+                            outboundOrder.ReturnToMESStatus = 2;
+                        }
+                        _outboundOrderRepository.UpdateData(outboundOrder);
+                        
+                        
                         return webResponse = WebResponseContent.Instance.OK($"璇ュ崟鎹病鏈夐渶瑕佸洖浼犳槑缁嗭紝澶辫触鏁版嵁鍥炰紶{returnRecords.Count()}鏉★紝鍥炰紶鎴愬姛{returnRecords.Count(x => x.ReturnStatus == 1)}鏉★紝鍥炰紶澶辫触{returnRecords.Count(x => x.ReturnStatus == 2)}鏉�");
                     }
 
-                    string apiUrl = AppSettings.GetValue("AllocationFeedbackUrl"); ;
+                    string apiUrl = AppSettings.GetValue("AllocationFeedbackUrl");
                     returnDTO.ReqCode = reqCode;
                     returnDTO.ReqTime = reqTime;
                     JsonSerializerSettings settings = new JsonSerializerSettings
@@ -213,7 +253,7 @@
 
                 _unitOfWorkManage.CommitTran();
                 int successCount = returnRecords.Where(x => x.ReturnStatus == 1).Count() + (isSuccess ? 1 : 0);
-                int failCount = returnRecords.Where(x => x.ReturnStatus == 2).Count() + (isSuccess ? 1 : 0);
+                int failCount = returnRecords.Where(x => x.ReturnStatus == 2).Count() + (!isSuccess ? 1 : 0);
 
                 webResponse.Status = true;
                 webResponse.Message = $"鍥炶皟鎴愬姛鏉℃暟锛歿successCount}锛屽洖璋冨け璐ユ潯鏁帮細{failCount}";
@@ -462,7 +502,7 @@
                 Dt_MesReturnRecord mesReturnRecord = new Dt_MesReturnRecord()
                 {
                     ApiUrl = httpResponseResult.ApiUrl,
-                    InterfaceType = 1,
+                    InterfaceType = 4,
                     OrderId = materialCodeInfo.OrderId ?? 0,
                     OrderNo = materialCodeInfo.OrderNo ?? "",
                     RequestCode = reqCode,

--
Gitblit v1.9.3