From 348eaae6ec7d37ea1998b6148f91fc43eaed2d8a Mon Sep 17 00:00:00 2001
From: 647556386 <647556386@qq.com>
Date: 星期二, 03 二月 2026 17:22:33 +0800
Subject: [PATCH] 1

---
 项目代码/WMS无仓储版/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService.cs |   81 ++++++++++------------------------------
 1 files changed, 20 insertions(+), 61 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_TaskInfoService/TaskService.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_TaskInfoService/TaskService.cs"
index 5a6c56d..2816365 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_TaskInfoService/TaskService.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_TaskInfoService/TaskService.cs"
@@ -303,7 +303,7 @@
             stockInfo.StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
             stockInfo.Details.ForEach(x =>
             {
-                x.Status = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
+                x.Status = StockStatusEmun.鍏ュ簱纭.ObjToInt();
             });
             _stockService.StockInfoService.Repository.UpdateData(stockInfo);
             _stockService.StockInfoDetailService.Repository.UpdateData(stockInfo.Details);
@@ -332,8 +332,6 @@
             try
             {
                 _locationStatusChangeRecordService.AddLocationStatusChangeRecord(locationInfo, beforeStatus, StockChangeType.Inbound.ObjToInt(), "", task.TaskNum);
-
-                _recordService.StockQuantityChangeRecordService.AddStockChangeRecord(stockInfo, stockInfo.Details, beforeQuantity, stockInfo.Details.Sum(x => x.StockQuantity) + beforeQuantity, WIDESEA_Common.StockEnum.StockChangeType.MaterielGroup);
             }
             catch (Exception ex)
             {
@@ -384,8 +382,6 @@
                                }).ToList();
                             allocatefeedmodel.Details = groupedData;
 
-                            //var feedbackresult = await _invokeMESService.FeedbackAllocate(allocatefeedmodel);
-
                             var response = responseModel(inboundOrder, 3, null, allocatefeedmodel);
                             if (response != null && response.IsSuccess)
                             {
@@ -393,66 +389,24 @@
                                 .Where(it => it.Id == inboundOrder.Id).ExecuteCommand();
                                 _inboundOrderDetailService.Db.Updateable<Dt_InboundOrderDetail>().SetColumns(it => new Dt_InboundOrderDetail { ReturnToMESStatus = 1 })
                                 .Where(it => it.OrderId == inboundOrder.Id).ExecuteCommand();
+                                //鍥炰紶鎴愬姛搴撳瓨鎵嶅彲鐢�
+                                _stockRepository.Db.Updateable<Dt_StockInfoDetail>().SetColumns(it => new Dt_StockInfoDetail
+                                {
+                                    Status = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt()
+                                }).Where(it => it.OrderNo == inboundOrder.InboundOrderNo).ExecuteCommand();
+                            }
+                            else
+                            {
+                                _inboundOrderService.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus = 2, Remark = response.ErrorMessage })
+                                .Where(it => it.Id == inboundOrder.Id).ExecuteCommand();
+                                _inboundOrderDetailService.Db.Updateable<Dt_InboundOrderDetail>().SetColumns(it => new Dt_InboundOrderDetail { ReturnToMESStatus = 2 })
+                               .Where(it => it.OrderId == inboundOrder.Id).ExecuteCommand();
                             }
                         }
                     }
                     else if (inboundOrder.OrderType == InOrderTypeEnum.ReCheck.ObjToInt()) //閲嶆鍏ュ簱
                     {
                         //涓嶉渶瑕佸洖浼犮�傚崰涓�涓綅缃��
-                    }
-                    else if (inboundOrder.OrderType == InOrderTypeEnum.InternalAllocat.ObjToInt()) //鏅轰粨璋冩櫤浠�
-                    {
-                        _logger.LogInformation($"InboundTaskCompleted 鍥炲啓MES  : {inboundOrder.InboundOrderNo}  ,ordertype: {InOrderTypeEnum.InternalAllocat.ObjToInt()} ");
-                        // BusinessTypeEnum.鏅轰粨璋冩櫤浠�
-                        if (inboundOrder != null && inboundOrder.OrderStatus == InOrderStatusEnum.鍏ュ簱瀹屾垚.ObjToInt())
-                        {
-                            var allocate = _allocateService.Repository.QueryData(x => x.OrderNo == inboundOrder.InboundOrderNo).First();
-                            var allocatefeedmodel = new AllocateDto
-                            {
-                                ReqCode = Guid.NewGuid().ToString(),
-                                ReqTime = DateTime.Now.ToString(),
-                                BusinessType = BusinessTypeEnum.鏅轰粨璋冩櫤浠�.ObjToInt().ToString(),
-                                FactoryArea = inboundOrder.FactoryArea,
-                                OperationType = 1,
-                                Operator = inboundOrder.Operator,
-                                OrderNo = inboundOrder.UpperOrderNo,
-                                fromWarehouse = allocate?.FromWarehouse ?? "",
-                                toWarehouse = allocate?.ToWarehouse ?? "",
-                                Details = new List<AllocateDtoDetail>()
-
-                            };
-                            var query = inboundOrder.Details.AsQueryable();
-                            query = query.Where(item => item.ReturnToMESStatus == 0);
-                            var groupedData = query.GroupBy(item => new { item.MaterielCode, item.lineNo, item.BarcodeUnit, item.WarehouseCode })
-                               .Select(group => new AllocateDtoDetail
-                               {
-                                   MaterialCode = group.Key.MaterielCode,
-                                   LineNo = group.Key.lineNo,
-                                   WarehouseCode = group.Key.WarehouseCode,
-                                   Qty = group.Sum(x => x.BarcodeQty),
-                                   // warehouseCode= "1072",
-                                   Unit = group.Key.BarcodeUnit,
-                                   Barcodes = group.Select(row => new BarcodeInfo
-                                   {
-                                       Barcode = row.Barcode,
-                                       Qty = row.BarcodeQty,
-                                       BatchNo = row.BatchNo,
-                                       SupplyCode = row.SupplyCode,
-                                       Unit = row.BarcodeUnit
-                                   }).ToList()
-                               }).ToList();
-                            allocatefeedmodel.Details = groupedData;
-
-                            var feedbackresult = await _invokeMESService.FeedbackAllocate(allocatefeedmodel);
-                            if (feedbackresult != null && feedbackresult.code == 200)
-                            {
-                                _inboundOrderService.Db.Updateable<Dt_InboundOrder>().SetColumns(it => new Dt_InboundOrder { ReturnToMESStatus = 1 })
-                                .Where(it => it.Id == inboundOrder.Id).ExecuteCommand();
-                                _inboundOrderDetailService.Db.Updateable<Dt_InboundOrderDetail>().SetColumns(it => new Dt_InboundOrderDetail { ReturnToMESStatus = 1 })
-                                .Where(it => it.OrderId == inboundOrder.Id).ExecuteCommand();
-                            }
-                        }
-
                     }
                     else
                     {
@@ -502,6 +456,11 @@
                                 .Where(it => it.Id == inboundOrder.Id).ExecuteCommand();
                                 _inboundOrderDetailService.Db.Updateable<Dt_InboundOrderDetail>().SetColumns(it => new Dt_InboundOrderDetail { ReturnToMESStatus = 1 })
                                 .Where(it => it.OrderId == inboundOrder.Id).ExecuteCommand();
+                                //鍥炰紶鎴愬姛搴撳瓨鎵嶅彲鐢�
+                                _stockRepository.Db.Updateable<Dt_StockInfoDetail>().SetColumns(it => new Dt_StockInfoDetail
+                                {
+                                    Status = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt()
+                                }).Where(it => it.OrderNo == inboundOrder.InboundOrderNo).ExecuteCommand();
                             }
                             else
                             {
@@ -788,9 +747,9 @@
                 string reqTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                 string requestData = string.Empty;
                 List<string> lineNos = new List<string>();
-                if (outboundOrder.OrderStatus == OutOrderStatusEnum.鍑哄簱瀹屾垚.ObjToInt())
+                Dt_AllocateMaterialInfo allocateMaterialInfo = _allocateMaterialInfo.QueryFirst(x => x.OrderNo == outboundOrder.OrderNo);
+                if (outboundOrder.OrderStatus == OutOrderStatusEnum.鍑哄簱瀹屾垚.ObjToInt() && outboundOrder.OrderStatus == 0 && allocateMaterialInfo == null)
                 {
-                    
                     Dt_AllocateOrder allocateOrder = _allocateOrderRepository.QueryFirst(x => x.OrderNo == outboundOrder.OrderNo);
                     if (allocateOrder == null)
                     {

--
Gitblit v1.9.3