From bbc4a3a07baf111c9074ceee7728158fb3eedf1a Mon Sep 17 00:00:00 2001
From: pan <antony1029@163.com>
Date: 星期二, 25 十一月 2025 05:33:35 +0800
Subject: [PATCH] 提交

---
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_BasicService/InvokeMESService.cs |   61 ++++++++++++++++++++++++++----
 1 files changed, 52 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/InvokeMESService.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/InvokeMESService.cs"
index 48dfcb1..a14fd53 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/InvokeMESService.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/InvokeMESService.cs"
@@ -12,6 +12,7 @@
 using System.Threading.Tasks;
 using WIDESEA_Core;
 using WIDESEA_Core.BaseRepository;
+using WIDESEA_DTO.Allocate;
 using WIDESEA_DTO.Basic;
 using WIDESEA_DTO.Inbound;
 using WIDESEA_DTO.Outbound;
@@ -41,6 +42,12 @@
             _inboundOrderRepository = inboundOrderRepository;
         }
 
+        /// <summary>
+        /// 鍏ュ簱鍙嶉
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        /// <exception cref="HttpRequestException"></exception>
         public async Task<ResponseModel> FeedbackInbound(FeedbackInboundRequestModel model)
         {
             string json =JsonConvert.SerializeObject(model, new JsonSerializerSettings
@@ -63,8 +70,14 @@
 
             return JsonConvert.DeserializeObject<ResponseModel>(body);
         }
-
-        public async Task FeedbackOutbound(FeedbackOutboundRequestModel model)
+             
+        /// <summary>
+        /// 鍑哄簱鍙嶉
+        /// </summary>
+        /// <param name="model"></param>
+        /// <returns></returns>
+        /// <exception cref="HttpRequestException"></exception>
+        public async Task<ResponseModel> FeedbackOutbound(FeedbackOutboundRequestModel model)
         {
             string json = JsonConvert.SerializeObject(model, new JsonSerializerSettings
             {
@@ -75,6 +88,8 @@
             _client.DefaultRequestHeaders.Clear();
             _client.DefaultRequestHeaders.Add("Accept", "application/json");
 
+            _logger.LogInformation("InvokeMESService  FeedbackOutbound :  " + json);
+
             var response = await _client.PostAsync("AldMaterialOutbound/MaterialOutbound", content);
             string body = await response.Content.ReadAsStringAsync();
 
@@ -84,7 +99,31 @@
                 throw new HttpRequestException(body);
             }
 
-            // JsonConvert.DeserializeObject<ResponseModel>(body);
+
+            return JsonConvert.DeserializeObject<ResponseModel>(body);
+        }
+
+        public  async Task<ResponseModel> FeedbackAllocate(AllocateDto model)
+        {
+            string json = JsonConvert.SerializeObject(model, new JsonSerializerSettings
+            {
+                ContractResolver = new Newtonsoft.Json.Serialization.CamelCasePropertyNamesContractResolver()
+            });
+            var content = new StringContent(json, Encoding.UTF8, "application/json");
+            var _client = _httpClientFactory.CreateClient("MESUrl");
+            _client.DefaultRequestHeaders.Clear();
+            _client.DefaultRequestHeaders.Add("Accept", "application/json");
+            _logger.LogInformation("InvokeMESService  FeedbackAllocate :  " + json);
+            var response = await _client.PostAsync("AldAllocationOperation/AllocationOperation", content);
+            string body = await response.Content.ReadAsStringAsync();
+            _logger.LogInformation("InvokeMESService  FeedbackAllocate  body:  " + body);
+            if (!response.IsSuccessStatusCode)
+            {
+
+                throw new HttpRequestException(body);
+            }
+
+            return JsonConvert.DeserializeObject<ResponseModel>(body);
         }
 
         public async Task<ResponseModel> NewMaterielToMes(MaterielToMesDTO model)
@@ -113,8 +152,11 @@
 
             var content = new StringContent(json, Encoding.UTF8, "application/json");
 
-            using var response = await client.PostAsync("", content);
+            _logger.LogInformation("InvokeMESService  NewMaterielToMes :  " + json);
+
+            using var response = await client.PostAsync("AldBarcodeInformation/BarcodeInformation", content);
             var responseText = await response.Content.ReadAsStringAsync();
+            _logger.LogInformation("InvokeMESService  NewMaterielToMes  body:  " + responseText);
             if (!response.IsSuccessStatusCode)
             {
                 throw new HttpRequestException(responseText);
@@ -200,27 +242,28 @@
                                         business_type = inboundOrder.BusinessType,
                                         factoryArea = inboundOrder.FactoryArea,
                                         operationType=1,
-                                        Operator= inboundOrder.Modifier,
+                                        Operator= inboundOrder.Operator,
                                         orderNo = inboundOrder.UpperOrderNo,
                                         status = inboundOrder.OrderStatus,
                                         details = new List<FeedbackInboundDetailsModel>()
 
                                     };
                                     
-                                    var groupedData = lists.GroupBy(item => new { item.MaterielCode, item.SupplyCode, item.BatchNo, item.InboundOrderRowNo, item.Unit, item.WarehouseCode })
+                                    var groupedData = lists.GroupBy(item => new { item.MaterielCode, item.SupplyCode, item.BatchNo, item.InboundOrderRowNo, item.BarcodeUnit, item.WarehouseCode })
                                        .Select(group => new FeedbackInboundDetailsModel
                                        {
                                            materialCode = group.Key.MaterielCode,
                                            supplyCode = group.Key.SupplyCode,
                                            batchNo = group.Key.BatchNo,
                                            lineNo = group.Key.InboundOrderRowNo,
+                                           qty = group.Sum(x=>x.BarcodeQty),
                                            // warehouseCode = group.Key.WarehouseCode=="0"?"1072": group.Key.WarehouseCode,
-                                           warehouseCode = "1072",
-                                           unit = group.Key.Unit,
+                                           warehouseCode =group.Key.WarehouseCode,
+                                           unit = group.Key.BarcodeUnit,
                                            barcodes = group.Select(row => new FeedbackBarcodesModel
                                            {
                                                barcode = row.Barcode,
-                                               qty = row.StockQuantity
+                                               qty = row.BarcodeQty
                                            }).ToList()
                                        }).ToList();
                                     feedmodel.details = groupedData;

--
Gitblit v1.9.3