From 2ebf584a05f828b5c87bfe49dd5c0692ccfb04e0 Mon Sep 17 00:00:00 2001
From: heshaofeng <heshaofeng@hnkhzn.com>
Date: 星期三, 03 十二月 2025 15:09:56 +0800
Subject: [PATCH] 提价

---
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_BasicService/InvokeMESService.cs |   34 ++++++++++++++++++++++++++--------
 1 files changed, 26 insertions(+), 8 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 d085b30..ff10286 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"
@@ -139,7 +139,7 @@
 
                 throw new HttpRequestException(body);
             }
-
+            _logger.LogInformation("InvokeMESService  FeedbackOutbound  body:  " + body);
 
             return JsonConvert.DeserializeObject<ResponseModel>(body);
         }
@@ -446,7 +446,7 @@
             }
             return WebResponseContent.Instance.OK();
         }
-      
+
         private async Task<WebResponseContent> HandleOutboundOrderBatchToMESCompletion(Dt_OutboundOrder outboundOrder, string orderNo)
         {
             // 瀹氫箟榛樿杩斿洖锛堟垚鍔熸�侊級
@@ -489,7 +489,7 @@
                     business_type = outboundOrder.BusinessType,
                     factoryArea = outboundOrder.FactoryArea,
                     operationType = 1,
-                    Operator = outboundOrder.Operator,
+                    Operator = outboundOrder.Operator!=""? outboundOrder.Operator:App.User.UserName,
                     orderNo = outboundOrder.UpperOrderNo,
                     documentsNO = documentNo,
                     status = outboundOrder.OrderStatus,
@@ -511,7 +511,7 @@
                         materialCode = detail.MaterielCode,
                         lineNo = detail.lineNo,
                         warehouseCode = detail.WarehouseCode,
-                        qty = 0,
+                        qty = detail.BarcodeQty,
                         currentDeliveryQty = 0,
                         unit = detail.BarcodeUnit,
                         barcodes = new List<WIDESEA_DTO.Outbound.BarcodesModel>()
@@ -544,14 +544,32 @@
                         else
                         {
                             barModel.qty = item.PickQuantity;
-                        }
-                        detailModel.qty += barModel.qty;
+                        }                 
                         detailModel.currentDeliveryQty += barModel.qty;
                         detailModel.barcodes.Add(barModel);
                     }
                     detailIds.Add(detail.Id);
                     feedModel.details.Add(detailModel);
                 }
+
+                feedModel.details = feedModel.details.GroupBy(item => new { item.materialCode, item.lineNo, item.warehouseCode, item.unit,item.qty  }).Select(group => new FeedbackOutboundDetailsModel
+                {
+                    materialCode = group.Key.materialCode,
+                    lineNo = group.Key.lineNo,
+                    warehouseCode = group.Key.warehouseCode,
+                    qty = group.Key.qty,
+                    currentDeliveryQty = group.Sum(x => x.currentDeliveryQty),
+                    unit = group.Key.unit,
+                    barcodes = group.SelectMany(x => x.barcodes.GroupBy(o => new { o.barcode, o.supplyCode, o.batchNo, o.unit }).Select(row => new WIDESEA_DTO.Outbound.BarcodesModel
+                    {
+                        barcode = row.Key.barcode,
+                        supplyCode = row.Key.supplyCode,
+                        batchNo = row.Key.batchNo,
+                        unit = row.Key.unit,
+                        qty = row.Sum(y => y.qty)
+                    })).ToList()
+                }).ToList();
+
                 var allCompleted = true;
 
                 // 绛涢�夊緟鍥炰紶鐨勬槑缁嗭紙ReturnToMESStatus=0锛�
@@ -843,14 +861,14 @@
         public static string Generate()
         {
             var now = DateTime.Now;
-            string datePart = now.ToString("yyyyMMdd");
+            string datePart = now.ToString("MMdd");
             long ticksPart = now.Ticks;
 
             // 鍘熷瓙閫掑璁℃暟鍣紙鍙栨ā1000锛岀‘淇濊鏁板櫒浠�3浣嶏紝鎺у埗闀垮害锛�
             long counterPart = Interlocked.Increment(ref _counter) % 1000;
 
             // 鎷兼帴锛氳鏁板櫒琛�0涓�3浣嶏紙閬垮厤浣嶆暟涓嶄竴鑷达級
-            return $"{datePart}{ticksPart}{counterPart:D3}";
+            return $"{datePart}{ticksPart}";
         }
     }
 }

--
Gitblit v1.9.3