From f12af5485a50736494ca034c5fae753386587412 Mon Sep 17 00:00:00 2001
From: 647556386 <647556386@qq.com>
Date: 星期四, 18 十二月 2025 22:17:29 +0800
Subject: [PATCH] 1

---
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_BasicService/MESOperation/FeedbackMesService.cs |   31 ++++++++++++++++++++++---------
 1 files changed, 22 insertions(+), 9 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 151e481..fdc1f9a 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"
@@ -59,7 +59,7 @@
                     {
                         return WebResponseContent.Instance.Error($"鏋勫缓鍥炶皟瀵硅薄澶辫触");
                     }
-                    string apiUrl = "";
+                    string apiUrl = AppSettings.GetValue("MaterialOutboundFeedbackUrl");
                     returnDTO.ReqCode = reqCode;
                     returnDTO.ReqTime = reqTime;
                     requestData = returnDTO.Serialize();
@@ -79,7 +79,7 @@
                     {
                         return WebResponseContent.Instance.Error($"鏋勫缓鍥炶皟瀵硅薄澶辫触");
                     }
-                    string apiUrl = "";
+                    string apiUrl = AppSettings.GetValue("AllocationFeedbackUrl"); ;
                     returnDTO.ReqCode = reqCode;
                     returnDTO.ReqTime = reqTime;
                     requestData = returnDTO.Serialize();
@@ -88,7 +88,7 @@
                     httpResponseResult.ApiUrl = apiUrl;
                 }
 
-                bool isSuccess = httpResponseResult.IsSuccess && httpResponseResult.Data != null && httpResponseResult.Data.Code == "200";
+                bool isSuccess = httpResponseResult.IsSuccess && httpResponseResult.Data.Code == "200";
                 string message = "鎴愬姛";
                 if (!isSuccess)
                 {
@@ -96,16 +96,16 @@
                     {
                         message = $"MES鎺ュ彛杩斿洖閿欒锛孒TTP浠g爜锛歿httpResponseResult.StatusCode}锛屼俊鎭細{httpResponseResult.ErrorMessage}";
                     }
-                    else if (httpResponseResult.Data.Code != "200")
+                    else if (httpResponseResult?.Data?.Code != "200")
                     {
-                        message = $"璋冪敤MES鎺ュ彛澶辫触锛屼唬鐮侊細{httpResponseResult.Data.Code}锛屼俊鎭細{httpResponseResult.Data.Message}";
+                        message = $"璋冪敤MES鎺ュ彛澶辫触锛屼唬鐮侊細{httpResponseResult?.Data?.Code}锛屼俊鎭細{httpResponseResult?.Data?.Message}";
                     }
                 }
 
                 Dt_MesReturnRecord mesReturnRecord = new Dt_MesReturnRecord()
                 {
                     ApiUrl = httpResponseResult.ApiUrl,
-                    InterfaceType = 1,
+                    InterfaceType = outboundOrder.OrderType == 0 ? 1 : 3,
                     OrderId = outboundOrder.Id,
                     OrderNo = outboundOrder.OrderNo,
                     RequestCode = reqCode,
@@ -140,7 +140,19 @@
                         x.ReturnJsonData = "";
                     });
 
+                    mesReturnRecord.ReturnType = outboundOrder.Details.Count == outboundOrderDetails.Count ? 1 : 2;
+
+                    if (outboundOrder.Details.Count == outboundOrderDetails.Count && outboundOrderDetails.All(x => x.ReturnToMESStatus == 1 || x.ReturnToMESStatus == 2))
+                    {
+                        outboundOrder.ReturnToMESStatus = isSuccess ? 1 : 2;
+                    }
+                    else
+                    {
+                        outboundOrder.ReturnToMESStatus = isSuccess ? 3 : 4;
+                    }
+
                     _outboundOrderRepository.Db.Updateable(outboundOrderDetails).ExecuteCommand();
+                    _outboundOrderRepository.UpdateData(outboundOrder);
                 }
 
                 _unitOfWorkManage.CommitTran();
@@ -341,7 +353,7 @@
                     return WebResponseContent.Instance.Error($"鏈壘鍒扮墿鏂欐潯鐮佷俊鎭瘂newBarcode}");
                 }
 
-                string apiUrl = "";
+                string apiUrl = AppSettings.GetValue("BarcodeFeedbackUrl");
 
                 BarcodeReturnDTO returnDTO = new BarcodeReturnDTO()
                 {
@@ -355,7 +367,8 @@
                     Qty = materialCodeInfo.AfterQuantity,
                     SupplyCode = materialCodeInfo.SuplierCode,
                     Unit = materialCodeInfo.Unit,
-                    WarehouseCode = materialCodeInfo.WarehouseCode
+                    WarehouseCode = materialCodeInfo.WarehouseCode,
+                    OldQty = materialCodeInfo.OriginalQuantity
                 };
 
                 string reqCode = Guid.NewGuid().ToString();
@@ -365,7 +378,7 @@
                 HttpResponseResult<MesResponseDTO> httpResponseResult = _httpClientHelper.Post<MesResponseDTO>(apiUrl, requestData);
                 httpResponseResult.ApiUrl = apiUrl;
 
-                bool isSuccess = httpResponseResult.IsSuccess && httpResponseResult.Data != null && httpResponseResult.Data.Code == "200";
+                bool isSuccess = httpResponseResult.IsSuccess && httpResponseResult.Data.Code == "200";
                 string message = "鎴愬姛";
                 if (!isSuccess)
                 {

--
Gitblit v1.9.3